Ejemplo n.º 1
0
        public void TestIni()
        {
            var data = @"[WindowSettings]
            Window X Pos=0
            Window Y Pos=0
            Window Maximized=false
            Window Name = Jabberwocky
            [Logging]
            Directory=C:\Rosetta Stone\Logs

            [Logging2]
            Directory =
            ";
            var ini = new Ini(data);

            var name = ini.Read("WindowSettings", "Window Name");
            Assert.AreEqual("Jabberwocky", name);

            var max = ini.Read("WindowSettings", "Window Maximized");
            Assert.AreEqual("false", max);

            var dir = ini.Read("Logging", "Directory");
            Assert.AreEqual(@"C:\Rosetta Stone\Logs", dir);

            var dir2 = ini.Read("Logging2", "Directory");
            Assert.AreEqual(string.Empty, dir2);
        }
Ejemplo n.º 2
0
        private void _BuildParams()
        {
            var config = new Ini(_ReadConfig());

            _StorageVerifyData.IPAddress = config.Read("Storage", "ipaddr");
            _StorageVerifyData.Port = int.Parse(config.Read("Storage", "port"));
            _StorageVerifyData.Account = config.Read("Storage", "account");
            _StorageVerifyData.Password = config.Read("Storage", "password");

            _FormulaVerifyData.IPAddress = config.Read("Formula", "ipaddr");
            _FormulaVerifyData.Port = int.Parse(config.Read("Formula", "port"));
            _FormulaVerifyData.Account = config.Read("Formula", "account");
            _FormulaVerifyData.Password = config.Read("Formula", "password");
        }
Ejemplo n.º 3
0
        private void _CreateStorage()
        {
            var config = new Ini(_ReadConfig());

            _IpAddress = config.Read("Storage", "ipaddr");
            _Port = int.Parse(config.Read("Storage", "port"));
            _Account = config.Read("Storage", "account");
            _Password = config.Read("Storage", "password");

            if(_IsIpAddress(_IpAddress))
            {
                _Storage = new Proxy();
            }
            else
            {
                var center = new Storage.Center(new DummyFrature());
                _Updater.Add(center);
                var factory = new StandaloneFactory(center);
                _Storage = new Proxy(factory);
            }
        }
Ejemplo n.º 4
0
        private void LaunchIni(string path)
        {
            var ini = new Ini(File.ReadAllText(path));
            var port_string = ini.Read("Launch", "port");
            var port = int.Parse(port_string);
            var dllpath = ini.Read("Launch", "path");
            var className = ini.Read("Launch", "class");

            Launch(port, dllpath, className);
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += (sender, a) =>
            {
                Regulus.Utility.CrashDump.Write();
                Environment.Exit(0);
            };

            Regulus.Utility.Log.Instance.RecordEvent += _WriteLog;
            if (args.Length == 0)
            {
                Console.WriteLine("Need to build parameters.");
                Console.WriteLine("ex . Regulus.Application.Protocol.Generator.exe build.ini");
                return;
            }
            var path = args[0];

            if (System.IO.File.Exists(path) == false)
            {
                Console.WriteLine($"Non-existent path {path}.");
                return;
            }

            try
            {
                var ini = new Regulus.Utility.Ini(System.IO.File.ReadAllText(path));

                var sourcePath = String.Empty;

                if (_TryRead(ini, "Build", "SourcePath", out sourcePath) == false)
                {
                    Program._ShowBuildIni();
                    return;
                }


                var protocolName = String.Empty;

                if (_TryRead(ini, "Build", "ProtocolName", out protocolName) == false)
                {
                    Program._ShowBuildIni();
                    return;
                }


                var outputPath = String.Empty;
                var outputCode = String.Empty;
                if (_TryRead(ini, "Build", "OutputPath", out outputPath))
                {
                    var sourceFullPath = System.IO.Path.GetFullPath(sourcePath);
                    var outputFullPath = System.IO.Path.GetFullPath(outputPath);

                    Console.WriteLine($"Source {sourceFullPath}");
                    Console.WriteLine($"Output {outputFullPath}");
                    var sourceAsm        = Assembly.LoadFile(sourceFullPath);
                    var libraryAsm       = Assembly.LoadFile("Regulus.Library.dll");
                    var remoteAsm        = Assembly.LoadFile("Regulus.Remote.dll");
                    var serizlizationAsm = Assembly.LoadFile("Regulus.Serialization.dll");
                    var assemblyBuilder  = new Regulus.Remote.Protocol.AssemblyBuilder(sourceAsm.GetExportedTypes());
                    _SaveToFile(assemblyBuilder.Create(), outputPath);

                    Console.WriteLine("Build success.");
                }
                if (_TryRead(ini, "Build", "OutputCode", out outputCode))
                {
                    var sourceFullPath = System.IO.Path.GetFullPath(sourcePath);
                    var outputFullPath = System.IO.Path.GetFullPath(outputCode);

                    Console.WriteLine($"Source {sourceFullPath}");
                    Console.WriteLine($"Output {outputFullPath}");
                    var sourceAsm = Assembly.LoadFile(sourceFullPath);
                    //var assemblyBuilder = new Regulus.Remote.Protocol.AssemblyBuilder();
                    //assemblyBuilder.BuildCode(sourceAsm, protocolName, outputFullPath);
                    throw new NotImplementedException();
                    Console.WriteLine("Build success.");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                Console.WriteLine("Build failure.");
            }
        }