Exemplo n.º 1
0
        public static void Initialize()
        {
            Variables.Load(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\LANG");

            if (Variables.Exist("SYS_LANG"))
            {
                CurrentLanguage = Variables.Read("SYS_LANG");
            }
        }
Exemplo n.º 2
0
        //初始化
        static public void INIT()
        {
            //從 DATA 載入所有已儲存的變量
            //Load all the variables
            Variables.Load(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\DATA");

            Variables.Write("$SYS_READY", "FALSE");

            //載入提示信息
            Localization.Initialize();

            //創建提示圖標
            //Set up notify icon
            notifyIcon.Icon         = AZUSA.Properties.Resources.icon;
            notifyIcon.Visible      = true;
            notifyIcon.DoubleClick += new EventHandler(notifyIcon_DoubleClick);

            //創建圖標右擊菜單的項目
            MenuItem itmMonitor = new MenuItem(Localization.GetMessage("PRCMON", "Process Monitor")); //進程監視器

            itmMonitor.Click += new EventHandler(itmMonitor_Click);
            MenuItem itmActivity = new MenuItem(Localization.GetMessage("ACTMON", "Activity Monitor")); //活動監視器

            itmActivity.Click += new EventHandler(itmActivity_Click);
            MenuItem itmRELD = new MenuItem(Localization.GetMessage("RELOAD", "Reload")); //重新載入

            itmRELD.Click += new EventHandler(itmRELD_Click);
            MenuItem itmEXIT = new MenuItem(Localization.GetMessage("EXIT", "Exit")); //退出

            itmEXIT.Click += new EventHandler(itmEXIT_Click);
            MenuItem sep = new MenuItem("-");

            ContextMenu menu = new ContextMenu(new MenuItem[] { itmMonitor, itmActivity, sep, itmRELD, itmEXIT });

            //把圖標右擊菜單設成上面創建的菜單
            notifyIcon.ContextMenu = menu;

            //搜索 Engines\ 底下的所有執行檔, SearchOption.AllDirectories 表示子目錄也在搜索範圍內
            //Start the engines
            string EngPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\Engines";

            string[] EngList = new string[] { };
            if (Directory.Exists(EngPath))
            {
                EngList = System.IO.Directory.GetFiles(EngPath, "*.exe", SearchOption.TopDirectoryOnly);
            }
            else
            {
                ERROR(Localization.GetMessage("ENGPATHMISSING", "The \\Engines folder is missing. AZUSA will not be able to perform any function without suitable engines."));

                return;
            }

            //提示本體啟動成功, 待各引擎啟動完畢後會再有提示的
            //MESSAGE(Localization.GetMessage("AZUSAREADY", "AZUSA is ready. Waiting for engines to initialize..."));

            //每一個執行檔都添加為引擎
            foreach (string exePath in EngList)
            {
                //如果不成功就發錯誤信息
                if (!ProcessManager.AddProcess(exePath.Replace(EngPath + @"\", "").Replace(".exe", "").Trim(), exePath))
                {
                    Internals.ERROR(Localization.GetMessage("ENGSTARTFAIL", "Unable to run {arg}. Please make sure it is in the correct folder.", exePath.Replace(EngPath + @"\", "").Replace(".exe", "").Trim()));
                }
            }
        }