public static bool LoadData(string path) { FileStream file = new FileStream(path, FileMode.Open); excel_table table = new excel_table(); if (file.Length <= 0) { Console.WriteLine("ConfigManager:LoadData:文件" + path + "为空"); return(false); } var data = new byte[file.Length]; file.Read(data, 0, data.Length); table.MergeFrom(data); //var configType = CONFIG_TYPE.Parse(table.ProtoMsgName.ToStringUtf8().ToUpper()); var tablePath = table.Path; foreach (var lineData in table.Table) { int index = lineData.Key; foreach (var cell in lineData.Value.CellData) { } } return(true); }
public static void test3() { FileStream file = new FileStream("all.proto.dat", FileMode.Open); Console.WriteLine(file.Length); excel_proto proto = new excel_proto(); proto.MergeFrom(file); Console.WriteLine(proto.ToString()); foreach (var it in proto.AllProto) { Console.WriteLine(it.Key); Console.WriteLine(it.Value.ToStringUtf8()); } var dataFile = new FileStream("test.dat", FileMode.Open); excel_table table = new excel_table(); table.MergeFrom(dataFile); Console.WriteLine(table.ProtoMsgName); foreach (var it in table.Table) { foreach (var cell in it.Value.CellData) { Console.WriteLine("int=" + cell.Int32Value + ",float=" + cell.FloatValue); } } Console.ReadKey(); }