示例#1
0
 public override string ToString()
 {
     return("{ " +
            "Value1 : " + ScorpioUtil.ToString(_Value1) + "," +
            "Value2 : " + _Value2 +
            " }");
 }
示例#2
0
 public override string ToString()
 {
     return("{ " +
            "TestID : " + _TestID + "," +
            "testEnum : " + _testEnum + "," +
            "TestDate : " + ScorpioUtil.ToString(_TestDate) +
            " }");
 }
示例#3
0
        static void ExecuteTMSTransporter(string username, string password, IEnumerable <string> args)
        {
            var argList = new List <string>()
            {
                "iTMSTransporter",
                "-u",
                username,
                "-p",
                password
            };

            argList.AddRange(args);
            Console.WriteLine(ScorpioUtil.StartProcess("xcrun", null, argList));
        }
示例#4
0
 public override string ToString()
 {
     return("{ " +
            "ID : " + _ID + "," +
            "TestInt : " + _TestInt + "," +
            "TestString : " + _TestString + "," +
            "TestLanguage : " + _TestLanguage + "," +
            "TestBool : " + _TestBool + "," +
            "TestInt2 : " + _TestInt2 + "," +
            "TestEnumName : " + _TestEnumName + "," +
            "TestArray : " + ScorpioUtil.ToString(_TestArray) + "," +
            "TestArray2 : " + ScorpioUtil.ToString(_TestArray2) + "," +
            "TestInt3 : " + _TestInt3 +
            " }");
 }
        public static ScriptTable ReadDatas(Script script, string fileName, string dataName, string keyName, string MD5)
        {
            ScriptTable   ret    = script.CreateTable();
            ScorpioReader reader = new ScorpioReader(GetBuffer(fileName));
            int           iRow   = ReadHead(reader, fileName, MD5);
            ScriptTable   data   = null;
            double        key    = 0;

            for (int i = 0; i < iRow; ++i)
            {
                data = ScorpioSerializer.Read(script, reader, dataName, false);
                key  = ScorpioUtil.ToDouble(data.GetValue(keyName).ObjectValue);
                if (ret.HasValue(key))
                {
                    throw new System.Exception("文件[" + fileName + "]有重复项 ID : " + key);
                }
                ret.SetValue(key, data);
                data.SetValue("ID", script.CreateDouble(key));
            }
            return(ret);
        }
示例#6
0
 protected void AddSign(int index)
 {
     __Sign = ScorpioUtil.AddSign(__Sign, index);
 }
示例#7
0
 public bool HasSign(int index)
 {
     return(ScorpioUtil.HasSign(__Sign, index));
 }
示例#8
0
        /// <summary>
        /// 读取一个网络协议或者一行table数据
        /// </summary>
        /// <param name="script">脚本引擎对象</param>
        /// <param name="reader">读取类</param>
        /// <param name="tableManager">tableManager类</param>
        /// <param name="fileName">table用文件名字</param>
        /// <param name="layoutTableName">结构名字</param>
        /// <param name="message">是否有标识</param>
        private static ScriptTable Read(Script script, IScorpioReader reader, string layoutTableName, bool message)
        {
            var table     = script.CreateTable();                           //返回的具体数据
            var layout    = (ScriptArray)script.GetValue(layoutTableName);  //数据结构
            var sign      = message ? reader.ReadInt32() : 0;
            var isInvalid = true;

            //string id = null;
            for (int i = 0; i < layout.Count(); ++i)
            {
                var config = layout.GetValue(i);        //单个数据的定义
                if (message && !ScorpioUtil.HasSign(sign, ScorpioUtil.ToInt32(config.GetValue(Index).ObjectValue)))
                {
                    continue;
                }
                var name    = config.GetValue(Name).ToString();          //字段名字
                var type    = config.GetValue(Type).ToString();          //字段类型
                var array   = config.GetValue(Array).LogicOperation();   //是否是数组
                var invalid = new Invalid();                             //本行是否是无效行
                if (array)
                {
                    var count = reader.ReadInt32();                      //读取元素个数
                    var value = script.CreateArray();
                    for (var j = 0; j < count; ++j)
                    {
                        value.Add(ReadObject(script, reader, type, message, invalid));
                    }
                    table.SetValue(name, value);
                    if (count > 0)
                    {
                        isInvalid = false;
                    }
                }
                else
                {
                    if (message)
                    {
                        table.SetValue(name, ReadObject(script, reader, type, message, invalid));
                    }
                    else
                    {
                        //var attribute = config.GetValue(Attribute) as ScriptTable;
                        //if (attribute.Count() == 0) {
                        table.SetValue(name, ReadObject(script, reader, type, message, invalid));
                        if (!invalid.value)
                        {
                            isInvalid = false;
                        }
                        //if (string.IsNullOrEmpty(id)) {
                        //    id = ScorpioUtil.ToInt32(obj.ObjectValue).ToString();
                        //}
                        //} else {
                        //    ReadObject(script, reader, tableManager, fileName, type, message, invalid);     //先读取一个值  如果是多国语言 生成数据的时候会写入一个空字符串
                        //    table.SetValue(name, script.CreateObject(tableManager.GetValue("getValue").call(attribute, fileName, name, id)));
                        //}
                    }
                }
            }
            if (!message)
            {
                table.SetValue("IsInvalid", script.CreateBool(isInvalid));
            }
            return(table);
        }