示例#1
0
        public string call(string macroName, PythonDictionary parameters = null)
        {
            var macro  = _context.Macros.FirstOrDefault(o => o.Name == macroName);
            var script = macro.Script;

            if (parameters != null)
            {
                var macroParameters = new MacroScriptParameters();
                foreach (var k in parameters.keys())
                {
                    macroParameters.SetParameter((string)k, (string)parameters.get((string)k));
                }
                script = macroParameters.ReplaceParameters(macro);
            }
            var result = _runner.RunScript(script, _ledger, _context);

            return(result);
        }
示例#2
0
        private void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            ContractUtils.RequiresNotNull(info, "info");

            info.AddValue("__class__", _class);
            List <object> keys   = new List <object>();
            List <object> values = new List <object>();

            foreach (object o in _dict.keys())
            {
                keys.Add(o);
                object value;

                bool res = _dict.TryGetValue(o, out value);

                Debug.Assert(res);

                values.Add(value);
            }

            info.AddValue("keys", keys);
            info.AddValue("values", values);
        }
示例#3
0
 public object keys(CodeContext context)
 {
     return(Dictionary.keys());
 }