Beispiel #1
0
        //main
        public override void InAMain(AMain node)
        {
            //    build def for allowed types
            BasicTypeDefinition intType;

            intType      = new BasicTypeDefinition();
            intType.name = "int";

            BasicTypeDefinition fltType;

            fltType      = new BasicTypeDefinition();
            fltType.name = "float";

            BasicTypeDefinition boolType;

            boolType      = new BasicTypeDefinition();
            boolType.name = "boolean";

            StringTypeDefinition stringType = new StringTypeDefinition();

            stringType.name = "string";

            //    create and seed symbol tables
            _currentSymbolTable = new Dictionary <string, Definition>();
            _currentSymbolTable.Add("int", intType);
            _currentSymbolTable.Add("float", fltType);
            _currentSymbolTable.Add("boolean", boolType);
            _currentSymbolTable.Add("string", stringType);
        }
Beispiel #2
0
        private static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                foreach (var arg in args)
                {
                    if (arg.ToLower() == "-tc")
                    {
                        Settings.UseTestConfig = true;
                    }
                }
            }

            #if DEBUG
            Settings.UseTestConfig = true;
            #endif

            try
            {
                if (UpdatePatcher())
                {
                    return;
                }

                if (RuntimePolicyHelper.LegacyV2RuntimeEnabledSuccessfully == true)
                {
                }

                Packet.IsServer = false;
                Settings.Load();

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                if (Settings.P_Patcher)
                {
                    Application.Run(PForm = new Launcher.AMain());
                }
                else
                {
                    Application.Run(Form = new CMain());
                }

                Settings.Save();
                CMain.InputKeys.Save();

                if (Restart)
                {
                    Application.Restart();
                }
            }
            catch (Exception ex)
            {
                CMain.SaveError(ex.ToString());
            }
        }
Beispiel #3
0
        private static void Main()
        {
            if (UpdatePatcher())
            {
                return;
            }

            if (RuntimePolicyHelper.LegacyV2RuntimeEnabledSuccessfully == true)
            {
            }

            try
            {
                Packet.IsServer = false;
                Settings.Load();

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                if (Settings.P_Patcher)
                {
                    Application.Run(PForm = new Launcher.AMain());
                }
                else
                {
                    Application.Run(Form = new CMain());
                }

                Settings.Save();

                if (Restart)
                {
                    Application.Restart();
                }
            }
            catch (Exception ex)
            {
                CMain.SaveError(ex.ToString());
            }
        }
Beispiel #4
0
        private static void Main(string[] args)
        {
#if DEBUG
            //Settings.UseTestConfig = true;
#endif

            //MirLog.info("DEBUG:" + Settings.UseTestConfig);
            try
            {
                //加大连接并发数
                System.Net.ServicePointManager.DefaultConnectionLimit = 256;

                if (UpdatePatcher())
                {
                    return;
                }

                if (RuntimePolicyHelper.LegacyV2RuntimeEnabledSuccessfully == true)
                {
                }

                long currExeLen = new FileInfo(Process.GetCurrentProcess().MainModule.FileName).Length;
                //客户端多开限制,只运行开3个客户端
                int       currClient = 0;
                string[]  dsmach     = { "Config", "Data", "DirectX", "Map", "Sound" };
                Process[] ps         = Process.GetProcesses();
                foreach (Process p in ps)
                {
                    try
                    {
                        if (p.MainModule.FileName == null)
                        {
                            continue;
                        }
                        MirLog.info(p.MainModule.FileName);
                        if (new FileInfo(p.MainModule.FileName).Length == currExeLen)
                        {
                            currClient++;
                        }

                        FileInfo        f           = new FileInfo(p.MainModule.FileName);
                        DirectoryInfo[] ds          = f.Directory.GetDirectories();
                        int             dsmachcount = 0;
                        foreach (DirectoryInfo di in ds)
                        {
                            foreach (string dm in dsmach)
                            {
                                if (di.Name.ToLower().Equals(dm.ToLower()))
                                {
                                    dsmachcount++;
                                }
                            }
                        }
                        if (dsmachcount >= 5)
                        {
                            //currClient++;
                        }
                    }
                    catch (Exception e)
                    {
                        MirLog.error(e.Message);
                    }
                }
                if (currClient >= 4)
                {
                    MirLog.info("最多只运行同时打开3个客户端");
                    MessageBox.Show("最多只运行同时打开3个客户端", "提示", MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
                    Application.Exit();
                    return;
                }


                Packet.IsServer = false;
                Settings.Load();

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                Application.Run(PForm = new Launcher.AMain());

                //if (Settings.P_Patcher) Application.Run(PForm = new Launcher.AMain());
                //else Application.Run(Form = new CMain());
                //Application.Run(Form = new CMain());
                //Application.Run( new Test());
                Settings.Save();
                CMain.InputKeys.Save();

                if (Restart)
                {
                    Application.Restart();
                }
            }
            catch (Exception ex)
            {
                CMain.SaveError(ex.ToString());
            }
        }
Beispiel #5
0
        private static void Main(string[] args)
        {
            //var discord = DiscordsApp.GetApp();
            discord.ClientId      = 863371338324508682;
            discord.StartFailure += DiscordOnStartFailure;
            discord.Started      += DiscordOnStarted;
            discord.HasException += DiscordOnHasException;
            discord.Stopped      += DiscordOnStopped;
            discord.StartApp();
            //discord.UpdateActivity();
            discord.StartLoop();

            if (args.Length > 0)
            {
                foreach (var arg in args)
                {
                    if (arg.ToLower() == "-tc")
                    {
                        Settings.UseTestConfig = true;
                    }
                }
            }

            #if DEBUG
            Settings.UseTestConfig = true;
            #endif

            try
            {
                if (UpdatePatcher())
                {
                    return;
                }

                if (RuntimePolicyHelper.LegacyV2RuntimeEnabledSuccessfully == true)
                {
                }

                Packet.IsServer = false;
                Settings.Load();

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                if (Settings.P_Patcher)
                {
                    discord.UpdateStage(StatusType.GameState, GameState.Patching);
                    discord.UpdateActivity();
                    Application.Run(PForm = new Launcher.AMain());
                }
                else
                {
                    discord.UpdateStage(StatusType.GameState, GameState.Launching);
                    discord.UpdateActivity();
                    Application.Run(Form = new CMain());
                }

                Settings.Save();
                CMain.InputKeys.Save();

                if (Restart)
                {
                    Application.Restart();
                }
            }
            catch (Exception ex)
            {
                CMain.SaveError(ex.ToString());
            }
        }