示例#1
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += (sender, a) =>
            {
                Regulus.Utility.CrashDump.Write();
                Environment.Exit(0);
            };
            var ini = new Regulus.Utility.Ini(System.IO.File.ReadAllText(args[0]));

            var sourcePath = ini.Read("Setting", "SourcePath");
            var sourceNamespace = ini.Read("Setting", "Namespace");
            var providerName = ini.Read("Setting", "ProviderName");
            var outputPath = ini.Read("Setting", "OutputPath");
            var dumpCode = ini.Read("Setting", "DumpCode");

            GhostProviderGenerator ghostProviderGenerator  = new GhostProviderGenerator();
            var codes = ghostProviderGenerator.Build(sourcePath, outputPath, providerName, new string[] { sourceNamespace });

            if (dumpCode == "true")
            {
                System.IO.File.WriteAllLines(outputPath + ".cs" , codes);
            }
        }
        private static bool _TryGetIniString(Regulus.Utility.Ini ini, string section, string key, out string text)
        {
            text = string.Empty;
            bool success = false;

            try
            {
                text    = ini.Read(section, key);
                success = true;
            }
            catch (Exception)
            {
            }

            return(success);
        }
示例#3
0
            private void _StartIni(string path)
            {
                var ini = new Regulus.Utility.Ini(System.IO.File.ReadAllText(path));
                var port_string = ini.Read("Launch", "port");
                int port = int.Parse(port_string);
                string dllpath = ini.Read("Launch", "path");
                string className = ini.Read("Launch", "class");

                _Start(port, dllpath, className);
            }
示例#4
0
        static void Main(string[] args)
        {
            Regulus.Utility.Log.Instance.RecordEvent += _WriteLog;

            if (args.Length != 1)
            {
                Console.WriteLine("Param 1 Need to build file path.");

                var iniSample = @"
[Build]
common_path = path/common.dll
unityengine_path = path/UnityEngine.dll
agent_name = Namespace.Agent
output_path = path/protocol.dll
output_dir = path/dir
";
                Console.WriteLine("The format is as follows");
                Console.WriteLine(iniSample);
                System.IO.File.WriteAllText("BuildProtocol.ini", iniSample);
                return;
            }

            var path = args[0];

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

            var commonPath      = ini.Read("Build", "common_path");
            var unityenginePath = ini.Read("Build", "unityengine_path");

            var commonNamespace = ini.Read("Build", "agent_name");



            var commandFullPath = System.IO.Path.GetFullPath(commonPath);

            var unityengineFullPath = System.IO.Path.GetFullPath(unityenginePath);

            Console.WriteLine("Common path {0}", commandFullPath);
            Console.WriteLine("UnityEngine path {0}", unityengineFullPath);
            var commonAsm      = Assembly.LoadFile(commandFullPath);
            var unityengineAsm = Assembly.LoadFile(unityengineFullPath);


            var regulusLibrary       = _GetRegulusLibrary();
            var regulusRemoting      = _GetRegulusRemoting();
            var regulusProrocol      = _GetRegulusProtocol();
            var regulusProtocolUnity = _GetRegulusProtocolUnity();
            var regulusRemotingGhost = _GetRegulusRemotingGhost();
            var regulusSerialization = _GetRegulusSerialization();

            /*var assemblyOutputer = new AssemblyOutputer(commonAsm,  commonNamespace);
             * assemblyOutputer.ErrorMessageEvent += Console.WriteLine;
             *
             * string outputPath;
             * if (_TryGetIniString(ini, "Build" , "output_path", out outputPath))
             * {
             *  assemblyOutputer.OutputDll(outputPath, unityengineAsm, regulusLibrary, regulusRemoting, regulusProrocol, regulusProtocolUnity, regulusRemotingGhost, regulusSerialization);
             * }
             *
             *
             * string outputDir;
             * if (_TryGetIniString(ini, "Build", "output_dir", out outputDir))
             * {
             *  assemblyOutputer.OutputDir(outputDir);
             * }*/



            Regulus.Utility.Log.Instance.Shutdown();

            Console.WriteLine("done");
        }