-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
df36999
commit c40d516
Showing
3 changed files
with
47 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text.Json; | ||
using System.Text.Json.Serialization; | ||
using kasic.Kasic; | ||
using kasic.Logging; | ||
using kasic.Memory; | ||
using kasic.Utils; | ||
using OperationResult; | ||
using System.Web; | ||
|
||
namespace kasic.Commands | ||
{ | ||
public class Dump : Command | ||
{ | ||
public Dump() : base("dump") | ||
{ | ||
CommandSettings = new CommandSettings() | ||
{ | ||
MinArgs = 0, | ||
MaxArgs = 0, | ||
ArgumentList = new ArgumentList(new List<KasicType>()), | ||
ReturnType = KasicType.STRING, | ||
}; | ||
} | ||
|
||
public override Result<IReturnObject, KasicError> Run(Context context, Arguments arguments, List<string> flags) | ||
{ | ||
var json =JsonSerializer.Serialize( | ||
Heap.Dump, typeof(List<HeapObject>), | ||
new JsonSerializerOptions() {WriteIndented = flags.Contains("-i")} | ||
); | ||
return new ReturnObject(this, json); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters