Esempio n. 1
0
 public static void  AddConfig(string config_name, string row_id_name)
 {
     if (ExcelConfigManager.Get(config_name) == null)
     {
         ExcelConfigManager.AddConfig(config_name).AddKVIndexAuto(row_id_name);
     }
 }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            ExcelConfigManager.PackageName = "";
            // ExcelConfigManager.FileGetFullPath = (p) => { return String.Format("../SampleData/{0}", p); };
            ExcelConfigManager.FileReadStream = (path) => { return(File.OpenRead(String.Format("../SampleData/{0}", path))); };

            ExcelConfigManager.Init(new string[] { "pb_header.pb", "kind.pb" });

            // 添加配置
            ExcelConfigSet set = ExcelConfigManager.AddConfig("arr_in_arr_cfg", null, "arr_in_arr_cfg.bin");

            if (null == set)
            {
                Console.WriteLine(ExcelConfigManager.LastError);
                return;
            }

            // 添加索引Key-Value
            set.AddKVIndexAuto("id");

            // 加载全部的配置
            ExcelConfigManager.ReloadAll();

            // 取数据
            var item = set.GetKVAuto(10001U);

            if (null == item)
            {
                Console.WriteLine("arr_in_arr_cfg 10001 not found");
            }
            else
            {
                Console.WriteLine(item.ToString());
                var arr = item.GetFieldList("arr");
                foreach (var msg in arr)
                {
                    Console.WriteLine(String.Format("Name={0}", ((xresloader.Protobuf.DynamicMessage)msg).GetFieldValue("name")));
                }
            }
        }