From a289ff17f47b788cf25b2bcb2bf041d3b355c676 Mon Sep 17 00:00:00 2001 From: xubo Date: Tue, 19 Mar 2019 16:52:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0C#=E4=BE=8B=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 43 +++++++++++++-------------- main.go | 2 +- v2/example/cpp/cpp/Config.h | 2 +- v2/example/csharp/Example/Config.bin | Bin 676 -> 708 bytes v2/example/csharp/Example/Config.cs | 2 +- v2/example/csharp/Example/Program.cs | 13 ++++---- v2/example/golang/Config.json | 2 +- v2/example/golang/table/table_gen.go | 2 +- v2/example/lua/Config.lua | 2 +- 9 files changed, 34 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index fbfaa8a0..bd466b03 100644 --- a/README.md +++ b/README.md @@ -139,37 +139,34 @@ tabtoy --mode=v2 --json_out=config.json --combinename=Config Table.xlsx [例子](https://github.com/davyxu/tabtoy/tree/master/v2/example/csharp) ```csharp - using (var stream = new FileStream("../../../../Config.bin", FileMode.Open)) - { - stream.Position = 0; + using (var stream = new FileStream("../../Config.bin", FileMode.Open)) + { + stream.Position = 0; - var reader = new tabtoy.DataReader(stream); - - if ( !reader.ReadHeader( ) ) - { - Console.WriteLine("combine file crack!"); - return; - } + var reader = new tabtoy.DataReader(stream); - var config = new gamedef.Config(); - table.Config.Deserialize(config, reader); + var config = new table.Config(); - // 直接通过下标获取或遍历 - var directFetch = config.Sample[2]; + var result = reader.ReadHeader(config.GetBuildID()); + if ( result != FileState.OK) + { + Console.WriteLine("combine file crack!"); + return; + } - // 根据索引取 - var indexFetch = config.GetSampleByID(100); - // 取不存在的元素时, 返回给定的默认值, 避免空 - var indexFetchByDefault = config.GetSampleByID(0, new gamedef.SampleDefine() ); + table.Config.Deserialize(config, reader); - // 添加日志输出或自定义输出 - config.TableLogger.AddTarget( new tabtoy.DebuggerTarget() ); + // 直接通过下标获取或遍历 + var directFetch = config.Sample[2]; - // 取空时, 当默认值不为空时, 输出日志 - var nullFetchOutLog = config.GetSampleByID( 0 ); + // 添加日志输出或自定义输出 + config.TableLogger.AddTarget(new tabtoy.DebuggerTarget()); - } + // 取空时, 当默认值不为空时, 输出日志 + var nullFetchOutLog = config.GetSampleByID(0); + + } ``` ### lua读取例子 diff --git a/main.go b/main.go index 9c01f393..78359507 100644 --- a/main.go +++ b/main.go @@ -10,7 +10,7 @@ import ( var log = golog.New("main") const ( - Version = "2.8.12" + Version = "2.9.0" ) func main() { diff --git a/v2/example/cpp/cpp/Config.h b/v2/example/cpp/cpp/Config.h index b28c9eb7..a9004cb1 100644 --- a/v2/example/cpp/cpp/Config.h +++ b/v2/example/cpp/cpp/Config.h @@ -1,5 +1,5 @@ // Generated by github.com/davyxu/tabtoy -// Version: 2.8.11 +// Version: 2.9.0 // DO NOT EDIT!! #include #include diff --git a/v2/example/csharp/Example/Config.bin b/v2/example/csharp/Example/Config.bin index c252fab507e4d2717ab708844c6fb5e54784398a..c019a81342c6251345d7c578292b34961e6faa78 100644 GIT binary patch delta 56 zcmZ3&dW4moiGhJ3B!p!mx4Mb~keO