本文整理汇总了C#中PythonDictionary.get方法的典型用法代码示例。如果您正苦于以下问题:C# PythonDictionary.get方法的具体用法?C# PythonDictionary.get怎么用?C# PythonDictionary.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PythonDictionary
的用法示例。
在下文中一共展示了PythonDictionary.get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Argument
public Argument(PythonBoss pyBoss, long address, PythonDictionary spec, Process process, int depth, Arguments parent, string namePrefix)
{
Address = address;
this.process = process;
_pyBoss = pyBoss;
_parent = parent;
NamePrefix = namePrefix;
// Parse the spec for this argument
// stackspec: [{"name": "socket",
// "size": 4,
// "type": None,
// "fuzz": NOFUZZ,
// "type_args": None},]
Fuzz = (bool)spec.get("fuzz");
Name = (string)spec.get("name");
_argumentType = (object)spec.get("type");
if ( spec.ContainsKey("type_args") )
{
_typeArgs = spec.get("type_args");
}
// Validate required fields
if (Name == null)
throw new Exception("ERROR: Argument specification must include 'name' attribute. Failed when parsing name prefix '" + namePrefix + "'.");
else if (Fuzz == null)
throw new Exception("ERROR: Argument specification must include 'fuzz' attribute. Failed when parsing type '" + namePrefix + Name + "'.");
else if (spec.get("size") == null)
throw new Exception("ERROR: Argument specification must include 'size' attribute. Failed when parsing type '" + namePrefix + Name + "'.");
if (spec.get("size") is string)
{
object sizeArgument = null;
if (parent.TryGetMemberSearchUp((string)spec.get("size"), out sizeArgument))
Size = ((Argument)sizeArgument).ToInt();
else
throw new Exception("ERROR: Unable to load size for type '" + Name + "' from parent member named '" + (string)spec.get("size") + "'. Please make sure this field exists in the parent.");
}
else if (spec.get("size") is int)
{
Size = (int)spec.get("size");
}
else
{
throw new Exception("ERROR: Unable to load size for type '" + Name + "'. The size must be of type 'int' or type 'string'. Size is type: '" + spec.get("size").ToString() + "'" );
}
// Read the data
try
{
Data = MemoryFunctions.ReadMemory(process.ProcessDotNet, address, (uint)Size);
}
catch (Exception e)
{
Data = null;
}
PointerTarget = null;
}