コード例 #1
0
 private static void _Import(Regulus.Utility.Console.IViewer view, Wheel wheel, string path)
 {
     try
     {
         var buffer = System.IO.File.ReadAllText(path);
         var set = Newtonsoft.Json.JsonConvert.DeserializeObject<VGame.CLR.Dump.WheelFieldSet>(buffer);
         wheel.Import(ref set);
     }
     catch(Exception)
     {
         view.WriteLine("失敗");
         throw;
     }
     view.WriteLine("成功");
 }
コード例 #2
0
        private static void _Export(Regulus.Utility.Console.IViewer view, Wheel wheel)
        {
            var data = wheel.Export();

            var guid = System.Guid.NewGuid();
            var path = $"Export{guid}.txt";
            view.WriteLine(path);
            System.IO.File.WriteAllText(path, Newtonsoft.Json.JsonConvert.SerializeObject(data));
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: jiowchern/Regulus
 private static void _BuildGameData(Regulus.Utility.Console.IViewer view)
 {
     var dataBuilder = new Regulus.Project.SamebestKeys.GameDataBuilder(Regulus.Project.SamebestKeys.GameData.Instance);
     var workPath = System.IO.Directory.GetCurrentDirectory();
     var files = System.IO.Directory.GetFiles(workPath, "*.map.txt");
     foreach (var file in files)
     {
         var stream = System.IO.File.ReadAllBytes(file);
         view.WriteLine("load game data : " + file);
         dataBuilder.Build(stream);
     }
 }
コード例 #4
0
        private static void _Spin(Regulus.Utility.Console.IViewer view, VGame.CLR.Wheel wheel)
        {
            var ir = new VGame.CLR.Input
            {
                Switch = 1,
                RunTime = 1,
                GameRate = 1,
                MaxBet = 10,
                MinBet = 1,
                Bet = 9,
                GameUndulate = 8,
                Line = 7,
                RecCycle = 6,
                WupCondi1 = 1,
                WupCondi2 = 1,
                WupRate = 1,
                Free = 0,
                Fever = 0,
                WinSet = 1
            };
            view.WriteLine("嘗試讀取Input.txt...");
            if(System.IO.File.Exists("Input.txt"))
            {
                view.WriteLine("成功.");
                var readed = System.IO.File.ReadAllText("Input.txt");
                ir = Newtonsoft.Json.JsonConvert.DeserializeObject<VGame.CLR.Input>(readed);
            }
            else
            {
                view.WriteLine("失敗.");
                view.WriteLine("建立預設Input.txt ...");

                System.IO.File.WriteAllText("Input.txt", Newtonsoft.Json.JsonConvert.SerializeObject(ir));
            }

            var output = wheel.Spin(ir);

            var guid = System.Guid.NewGuid();
            var inputPath = $"Input{guid}.txt";
            view.WriteLine(inputPath);
            System.IO.File.WriteAllText(inputPath , Newtonsoft.Json.JsonConvert.SerializeObject(ir));

            var outputPath = $"Output{guid}.txt";
            view.WriteLine(outputPath);
            System.IO.File.WriteAllText(outputPath, Newtonsoft.Json.JsonConvert.SerializeObject(output));
        }