本文整理汇总了C#中Muftec.Lib.OpCodeData类的典型用法代码示例。如果您正苦于以下问题:C# OpCodeData类的具体用法?C# OpCodeData怎么用?C# OpCodeData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OpCodeData类属于Muftec.Lib命名空间,在下文中一共展示了OpCodeData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InStrReverse
public static void InStrReverse(OpCodeData data)
{
var item2 = data.RuntimeStack.PopStr();
var item1 = data.RuntimeStack.PopStr();
data.RuntimeStack.Push(item1.LastIndexOf(item2));
}
示例2: Concatenate
public static void Concatenate(OpCodeData data)
{
var item2 = data.RuntimeStack.PopStr();
var item1 = data.RuntimeStack.PopStr();
data.RuntimeStack.Push(String.Concat(item1, item2));
}
示例3: ArrayAppendItem
public static void ArrayAppendItem(OpCodeData data)
{
var array = data.RuntimeStack.PopArray();
var item = data.RuntimeStack.Pop();
array.Add(item);
data.RuntimeStack.Push(array);
}
示例4: StackItemLReverse
public static void StackItemLReverse(OpCodeData data)
{
var count = data.RuntimeStack.PopInt();
if (count == 0) return;
if (count < 0)
throw new MuftecInvalidStackItemTypeException(data.RuntimeStack);
// Take n items
var popped = new List<MuftecStackItem>();
for (var i = 0; i < count; i++)
{
var item = data.RuntimeStack.Pop();
popped.Add(item);
}
// Push in reverse order
foreach (var item in popped)
{
data.RuntimeStack.Push(item);
}
// Re-add count
data.RuntimeStack.Push(count);
}
示例5: ArrayCompare
public static void ArrayCompare(OpCodeData data)
{
var array2 = data.RuntimeStack.PopArray();
var array1 = data.RuntimeStack.PopArray();
data.RuntimeStack.Push(array1.SequenceEqual(array2));
}
示例6: Atangent2
public static void Atangent2(OpCodeData data)
{
var fx = data.RuntimeStack.PopFloat();
var fy = data.RuntimeStack.PopFloat();
data.RuntimeStack.Push(System.Math.Atan2(fy, fx));
}
示例7: ArrayDeleteItem
public static void ArrayDeleteItem(OpCodeData data)
{
var index = data.RuntimeStack.PopInt();
var array = data.RuntimeStack.PopArray();
array.RemoveAt(index);
data.RuntimeStack.Push(array);
}
示例8: ArrayDeleteRange
public static void ArrayDeleteRange(OpCodeData data)
{
var index2 = data.RuntimeStack.PopInt();
var index1 = data.RuntimeStack.PopInt();
var array = data.RuntimeStack.PopArray().ToList();
array.RemoveRange(index1, index2 - index1 + 1);
data.RuntimeStack.Push(array);
}
示例9: ReadLineTest
public void ReadLineTest()
{
var runtimeStack = new Stack<MuftecStackItem>();
var data = new OpCodeData(runtimeStack);
InputOutput.ReadLine(data);
var runtimeStackExpected = new Stack<MuftecStackItem>();
runtimeStackExpected.Push(MuftecStackItem.Null);
TestShared.CompareStacks(runtimeStack, runtimeStackExpected);
}
示例10: PrintTest
public void PrintTest()
{
var runtimeStack = new Stack<MuftecStackItem>();
var data = new OpCodeData(runtimeStack);
runtimeStack.Push("Sample string");
InputOutput.Print(data);
var runtimeStackExpected = new Stack<MuftecStackItem>();
TestShared.CompareStacks(runtimeStack, runtimeStackExpected);
}
示例11: StackItemDupN
public static void StackItemDupN(OpCodeData data)
{
var count = data.RuntimeStack.PopInt();
if (count == 0) return;
if (count < 0)
throw new MuftecInvalidStackItemTypeException(data.RuntimeStack);
var topItems = data.RuntimeStack.Take(count).Reverse().ToList();
foreach (var item in topItems)
{
data.RuntimeStack.Push(item);
}
}
示例12: Explode
public static void Explode(OpCodeData data)
{
var item2 = data.RuntimeStack.PopStr();
var item1 = data.RuntimeStack.PopStr();
var exploded = item1.Split(new[] { item2 }, StringSplitOptions.None);
data.RuntimeStack.Push(exploded.Length);
foreach (var s in exploded)
{
data.RuntimeStack.Push(s);
}
}
示例13: ConcatenateTest
public void ConcatenateTest()
{
var runtimeStack = new Stack<MuftecStackItem>();
var data = new OpCodeData(runtimeStack);
runtimeStack.Push("test");
runtimeStack.Push("string");
Strings.Concatenate(data);
var runtimeStackExpected = new Stack<MuftecStackItem>();
runtimeStackExpected.Push("teststring");
TestShared.CompareStacks(runtimeStack, runtimeStackExpected);
}
示例14: StackDepthTest
public void StackDepthTest()
{
var runtimeStack = new Stack<MuftecStackItem>();
var data = new OpCodeData(runtimeStack);
runtimeStack.Push("Alfredo");
runtimeStack.Push(1.99);
StackOperations.StackDepth(data);
var runtimeStackExpected = new Stack<MuftecStackItem>();
runtimeStackExpected.Push("Alfredo");
runtimeStackExpected.Push(1.99);
runtimeStackExpected.Push(2);
TestShared.CompareStacks(runtimeStack, runtimeStackExpected);
}
示例15: ArrayAppendItemTest
public void ArrayAppendItemTest()
{
var runtimeStack = new Stack<MuftecStackItem>();
var data = new OpCodeData(runtimeStack);
runtimeStack.Push(6);
Arrays.ArrayStart(data);
runtimeStack.Push(5);
Arrays.ArrayEnd(data);
Arrays.ArrayMake(data);
Arrays.ArrayAppendItem(data);
var runtimeStackExpected = new Stack<MuftecStackItem>();
runtimeStackExpected.Push(new MuftecList { 5, 6 });
TestShared.CompareStacks(runtimeStack, runtimeStackExpected);
}