const string Language = "Language"; //该字段是否有多国语言 //解析一个网络协议 // public static ScriptTable Deserialize(Script script, byte[] data, string layoutTableName) { // return Read(script, new ScorpioReader(data), null, "", layoutTableName, true); // } /// <summary> /// 脚本 读取excel文件数据内容 /// </summary> /// <param name="script">脚本引擎</param> /// <param name="fileName">文件名字</param> /// <param name="reader">文件读取</param> /// <param name="dataArray">数据集合</param> /// <param name="layoutTableName">布局</param> /// <param name="keyName">主key名字</param> /// <param name="MD5">文件结构MD5</param> /// <returns></returns> public static ScriptMap ReadDatas(string fileName, IScorpioReader reader, ScriptMap dataArray, string layoutTableName, string keyName, string MD5) { using (reader) { var script = dataArray.getScript(); var iRow = TableUtil.ReadHead(reader, fileName, MD5); //数据行数 var layout = script.Global.GetValue(layoutTableName).Get <ScriptArray>(); //数据结构 for (var i = 0; i < iRow; ++i) { var data = Read(script, reader, layout); //读取一行数据 var keyValue = data.GetValue(keyName); //获取key值 data.SetValue("ID", keyValue); var key = keyValue.Value; if (dataArray.ContainsKey(key)) { var value = dataArray.GetValue(key).Get <ScriptMap>(); foreach (var pair in data) { value.SetValue(pair.Key, pair.Value); } } else { dataArray.SetValue(key, new ScriptValue(data)); } } return(dataArray); } }
void line_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { Line line = sender as Line; lineConfig.ColumnName = line.Tag.ToString(); lineConfig.currentLine = line; lineConfig.TransferScript.Text = ""; string transString = ""; // 判断这个类型的解析器是否存在 if (ScriptMap.ContainsKey(line.Tag.ToString())) { transString = ScriptMap[line.Tag.ToString()]; } if (string.IsNullOrEmpty(transString)) { transString = TRANSFER_SCRIPT; } lineConfig.TransferScript.Text = transString; lineConfig.Visibility = System.Windows.Visibility.Visible; }