コード例 #1
0
        public void getSettingINI()
        {
            /*
             # setting.ini
             # [
             # {
             #   "name":"",
             #   "ip":"",
             #   "port":"",
             #   "kind":"",
             #   "login_id":"",
             #   "pwd":"",
             #   "isConnect":"F",
             #   "pdo": obj ,
             #   "connString": string
             # }
             # ]
             */
            List <Dictionary <string, string> > data = new List <Dictionary <string, string> >();
            string setting_path = my.pwd() + "\\setting.ini";

            if (!my.is_file(setting_path))
            {
                my.file_put_contents(setting_path, "");
            }
            string endata = my.b2s(my.file_get_contents(setting_path));
            //string dedata = my.dePWD_string(endata, the_code);
            JArray ja = new JArray();

            if (endata != "")
            {
                ja = my.json_decode(endata);
            }

            for (int i = 0, max_i = ja.Count; i < max_i; i++)
            {
                Dictionary <string, object> doo = new Dictionary <string, object>();
                foreach (JObject obj in ja[i])
                {
                    Dictionary <string, object> dictObj = obj.ToObject <Dictionary <string, object> >();
                    dictObj["isConnect"] = "F";
                    connections.Add(dictObj);
                }
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: shadowjohn/UCL_LIU_CSharp
        private void Form1_Load(object sender, EventArgs e)
        {
            //檢查不能重複啟動
            if (!ucl.checkLockSuccess())
            {
                MessageBox.Show("肥米已執行了...");
                Application.Exit();
            }
            //載入 UCLLIU.ini
            ucl.loadConfig();
            //載入字根檔
            ucl.loadJsonData();
            //如果有拚音,載入拚音功能
            if (my.is_file(my.pwd() + "\\pinyi.txt"))
            {
                ucl.same_sound_data = new List <string>(my.explode("\n", my.trim(my.b2s(my.file_get_contents(my.pwd() + "\\pinyi.txt")))));
            }

            //產生最簡根表
            ucl.generator_sp_table();

            word_label.Text = "";
            type_label.Text = "";
            KeyboardHook(this, e);
            //小圖加入版本
            notifyIcon1.Text = "肥米輸入法:" + ucl.VERSION;
            //修正一下畫面
            //


            /*this.TopLevel = true;
             * this.TopLevel = false;
             * this.TopLevel = true;
             * this.TopMost = true;
             * this.TopMost = false;
             * this.TopMost = true;
             */
            //Thread.Sleep(3000);
            btn_UCL.PerformClick();
            btn_UCL.PerformClick();
            //起始不可以是 topmost ,在程式執行後,才置高,不然
            //首次切換輸入法時,會失去原始的焦點(如記事本)
            this.TopMost = true;



            /*Thread.Sleep(1000);
             * SendKeys.SendWait("+");
             * Thread.Sleep(1000);
             * SendKeys.SendWait("+");
             * Thread.Sleep(1000);
             * SendKeys.SendWait("+");
             * Thread.Sleep(1000);
             * SendKeys.SendWait("+");
             * Thread.Sleep(1000);
             * SendKeys.SendWait("+");
             * Thread.Sleep(1000);
             * SendKeys.SendWait("+");
             * ucl.toAlphaOrNonAlpha();
             */
            //AllocConsole();
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: shadowjohn/system_status
        private void Form1_Load(object sender, EventArgs e)
        {
            ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); };
            ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;

            //System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
            //System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls;

            //嘗試當掉就中斷離開
            AppDomain currentDomain = AppDomain.CurrentDomain;

            currentDomain.UnhandledException += new UnhandledExceptionEventHandler(myCrash);
            this.LOCK_FILE = my.pwd() + "\\lock.txt";
            string COMPUTER_NAME = my.getSystemKey("COMPUTER_NAME");

            if (COMPUTER_NAME == "請填寫主機名稱")
            {
                MessageBox.Show("請填寫主機名稱...請先修改 system_status.exe.config");
                exit();
            }
            textSystemName.Text = COMPUTER_NAME;

            if (!my.is_file(this.LOCK_FILE))
            {
                my.file_put_contents(this.LOCK_FILE, "");
            }
            if (my.is_file_lock(this.LOCK_FILE))
            {
                //如果目前已是 lock 就結束
                CLog("Error ... Another zip process is running... ");
                Form1_FormClosing(sender, null);
                return;
            }
            //同時最多只能跑一支
            killSameProcessName();

            if (!my.isProcessRunning("system_status_watchdog"))
            {
                my.system(my.pwd() + "\\system_status_watchdog.exe", -1);
            }

            //寫入目前版本
            my.file_put_contents(my.pwd() + "\\version.txt", VERSION.ToString());

            notifyIcon1.Visible = true;
            //lock file
            s2 = new FileStream(this.LOCK_FILE, FileMode.Open, FileAccess.Read, FileShare.None);

            this.LOG_PATH = my.pwd() + "\\log";
            create_log_dir();
            this.Text += string.Format(" - 版本:{0}", VERSION);

            notifyIcon1.BalloonTipText  = "已縮小";
            notifyIcon1.BalloonTipTitle = this.Text;
            notifyIcon1.Text            = this.Text;

            this.StartPosition = FormStartPosition.CenterScreen;
            this.TopMost       = true;
            this.TopMost       = false;
            this.CenterToScreen();
            //載入設定檔
            //cIni.ini_init(this);
            //預設看要帶哪一個
            //cHdd.init(this);
            //cRunningProgram.init(this);
            //tabControl1.SelectTab("tabs_running_program");
            tabControl1.SelectTab("tabs_setting");
            tabControl1_Click(new object(), new EventArgs());

            /*if (iniData["setting"]["NAME"] == "")
             * {
             *  //首次使用,需先設定
             *  tabControl1.SelectTab("tabs_setting");
             *  tabControl1_Click(new object(), new EventArgs());
             * }
             */

            switch (my.getSystemKey("RUN_AT_START").ToUpper())
            {
            case "YES":
            {
                GLOBAL_RUN_AT_START = true;
            }
            break;
            }

            if (GLOBAL_RUN_AT_START)
            {
                //自動按
                btnManual_Click(sender, e);
                //自動縮小
                WindowState         = FormWindowState.Minimized;
                ShowInTaskbar       = false;
                notifyIcon1.Visible = true;
                notifyIcon1.ShowBalloonTip(1000);
            }
        }