protected override CalculatorValue OnCalc(IList <CalculatorValue> operands) { var r = CalculatorValue.NullObject; if (operands.Count >= 2) { string key = operands[0].AsString; int size = operands[1].Get <int>(); if (null != key) { byte[] m = new byte[size]; for (int i = 0; i < size; ++i) { m[i] = (byte)i; } Main.AddKeyValue(key, m); r = key; } } return(r); }
protected override CalculatorValue OnCalc(IList <CalculatorValue> operands) { var r = CalculatorValue.NullObject; if (operands.Count >= 2) { string key = operands[0].AsString; int size = operands[1].Get <int>(); if (null != key) { System.IntPtr m = System.Runtime.InteropServices.Marshal.AllocHGlobal(size); unsafe { byte *ptr = (byte *)m; for (int i = 0; i < size; ++i) { ptr[i] = (byte)i; } } Main.AddKeyValue(key, m); r = key; } } return(r); }