示例#1
0
        private void wB_Navigated(object sender, WebBrowserNavigatedEventArgs e)
        {
            string URL = wB.Url.ToString();

            Console.WriteLine(URL);
            URL = URL.Replace("https://", "");
            var m = my.explode("/", URL);

            if (m.Count() != 3)
            {
                return;
            }
            if (!my.IsNumeric(m[1]))
            {
                return;
            }
            downloadURL.Text = "https://" + URL;
        }
示例#2
0
        private void a_SelectedIndexChanged(object sender, EventArgs e)
        {
            //當選刀改變了
            ComboBox comboBox = (ComboBox)sender;

            string id         = my.explode("_", comboBox.Name)[1];
            string knife_kind = comboBox.SelectedIndex.ToString();

            //this.
            //MessageBox.Show(id + "," + comboBox.SelectedIndex.ToString());
            foreach (Control ta in GBox.Controls)
            {
                if (ta is ComboBox && ta.Name == "選正負_" + id)
                {
                    switch (knife_kind)
                    {
                    case "0":
                        ((ComboBox)ta).SelectedIndex = 0;
                        break;

                    case "1":
                    case "2":
                    case "3":
                    case "4":
                    case "6":
                        ((ComboBox)ta).SelectedIndex = 1;     // +
                        break;

                    case "5":
                        ((ComboBox)ta).SelectedIndex = 2;     // -
                        break;
                    }
                    break;
                }
            }
        }
示例#3
0
        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();
        }
示例#4
0
        static void Main(string[] args)
        {
            if (args.Count() < 1)
            {
                echo(MESSAGE);
                exit();
            }
            if (my.is_string_like(args[0], "https://") || my.is_string_like(args[0], "http://"))
            {
                URL = args[0];
            }
            if (!my.is_string_like(URL, "https://") && !my.is_string_like(URL, "http://"))
            {
                echo(MESSAGE);
                exit();
            }

            string data = my.b2s(my.file_get_contents(URL));
            //echo(data);
            List <string> preScripts = new List <string>();

            //preScripts.Add("$=function(){};");
            preScripts.Add("var adsbygoogle=null;");
            //preScripts.Add("var window=null;");
            preScripts.Add("var localStorage={'getItem':function(){return '';}, 'setItem':function(a,b){} };");
            preScripts.Add("var y='46';");
            preScripts.Add("function spp(){};");
            preScripts.Add("var WWWWWTTTTTFFFFF='';");
            preScripts.Add("var document='';");
            //preScripts.Add("function $(p){};");
            preScripts.Add("function loadingpage(p){};");
            preScripts.Add("function initcomment(p){};");
            preScripts.Add("function mm(p){return (parseInt((p-1)/10)%10)+(((p-1)%10)*3)};");
            preScripts.Add("function nn(n){return n<10?'00'+n:n<100?'0'+n:n;};");
            preScripts.Add("function su(a,b,c){var e=(a+'').substring(b,b+c);return (e);};");
            preScripts.Add("function lc(l){ if (l.length != 2) return l; var az = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\"; var a = l.substring(0,1); var b = l.substring(1, 2); if (a == \"Z\") return 8000 + az.indexOf(b); else return az.indexOf(a) * 52 + az.indexOf(b); };");
            preScripts.Add("function request(queryStringName){var returnValue=\"\";var URLString=new String(document.location);var serachLocation=-1;var queryStringLength=queryStringName.length;do{serachLocation=URLString.indexOf(queryStringName+\"\\= \");if (serachLocation!=-1){if ((URLString.charAt(serachLocation-1)=='?') || (URLString.charAt(serachLocation-1)=='&')){URLString=URLString.substr(serachLocation);break;}URLString=URLString.substr(serachLocation+queryStringLength+1);}}while (serachLocation!=-1)if (serachLocation!=-1){var seperatorLocation=URLString.indexOf(\" & \");if (seperatorLocation==-1){returnValue=URLString.substr(queryStringLength+1);}else{returnValue=URLString.substring(queryStringLength+1,seperatorLocation);} }return returnValue;}");
            string ch = "";

            if (!my.is_string_like(URL, "ch="))
            {
                ch = "1";
            }
            else
            {
                ch = my.explode("-", my.explode("ch=", URL)[1])[0];//第幾回
            }
            //preScripts.Add("ch=" +ch);
            //merge all scripts
            List <string> AllJS = new List <string>();
            var           mjs   = my.explode("<script>", data);

            for (int i = 6; i < mjs.Count(); i++)
            {
                var _m = my.explode("</script>", mjs[i]);
                AllJS.Add(_m[0]);
            }
            //var mScripts = my.explode("<script>", data)[7];
            //string scripts = my.explode("</script>", mScripts)[0].Trim();
            string scripts = my.implode("\n\n ", AllJS);

            scripts = scripts.Replace("var pi=ch", "ch=" + ch + ";var pi=ch");
            //scripts = scripts.Replace("\n", " ").Replace("\r", " ");
            //echo("\nCounts:" + my.explode("<script>", data).Count().ToString() + "\n");
            //echo(scripts);
            //exit();
            scripts = scripts.Replace("document.getElementById(e)", "e");

            scripts = scripts.Replace("}var", "};var");
            //scripts = scripts.Replace("ge('TheImg').src=", "WWWWWTTTTTFFFFF=");
            scripts = scripts.Replace(").src=", ");WWWWWTTTTTFFFFF=");
            //scripts = scripts.Replace(";", ";\n");
            //scripts = scripts.Replace(";", ";\n");
            //scripts = scripts.Replace("adsbygoogle", "//adsbygoogle");
            preScripts.Add(scripts);
            preScripts.Add("ps+\"___\"+\"https:\"+WWWWWTTTTTFFFFF;");


            //preScripts.Add("swtvv;");
            string sc = my.implode("\n", preScripts);

            sc = sc.Replace("; ", "; \n");
            sc = sc.Replace("(adsbygoogl", "//(adsbygoogl");
            //echo(sc);
            //exit();

            sc = sc.Replace("if (localStorage.getItem(\"imgmode\")" + my.get_between(sc, "if (localStorage.getItem(\"imgmode\")", "document.getElementById(\"barcodeimg\");"), "");
            sc = sc.Replace("document.writeln(\"<scr" + my.get_between(sc, "document.writeln(\"<scr", "ipt>\");") + "ipt>\");", "");
            sc = sc.Replace("document.writeln(\"<scr" + my.get_between(sc, "document.writeln(\"<scr", "ipt>\");") + "ipt>\");", "");
            sc = sc.Replace("document.getElementById(\"barcodeimg\");", "");
            sc = sc.Replace("(function() {" + my.get_between(sc, "(function() {", "})();") + "})();", "");

            //my.file_put_contents("sc.txt", sc);
            string finalData = EvalJScript(sc).ToString().Trim();
            //echo(sc);
            //echo(finalData);
            //exit();
            var    m      = my.explode("___", finalData);
            int    pages  = Convert.ToInt32(m[0]);
            string output = "Totals:" + pages.ToString() + "\n";
            string t      = m[1].Replace("/001_", "/{PAGE}_");

            //echo(t);
            //exit();
            for (int i = 1; i <= pages; i++)
            {
                //取得 WWWWWTTTTTFFFFF=...... 至 '.jpg';
                //WWWWWTTTTTFFFFF='//img'+su(yvdnl, 0, 1)+'.8comic.com/'+su(yvdnl,1,1)+'/'+ti+'/'+iyjco+'/'+ nn(p)+'_'+su(qvjme,mm(p),3)+'.jpg';
                //string d = t.Replace("{PAGE}", i.ToString().PadLeft(3, '0'));
                //output += d + "\n";
                var imgPath = "\"https:\"+" + my.get_between(sc, ";WWWWWTTTTTFFFFF=", ";");
                //echo(imgPath);
                //exit();
                var _sc = sc + "\n" + imgPath.Replace("(p)", "(" + i + ")") + ";";
                output += EvalJScript(_sc).ToString() + "\n";
            }
            echo(output);
        }
示例#5
0
        private void db_tree_DoubleClick(object sender, EventArgs e)
        {
            dialogMyBoxOn("資料載入中...", false);
            int  index   = ((TreeView)sender).SelectedNode.Index;
            bool is_root = true;
            //Console.WriteLine(((TreeView)sender).SelectedNode.FullPath);
            string fullPath = ((TreeView)sender).SelectedNode.FullPath;
            var    m        = my.explode("\\", fullPath);

            if (m.Length == 2)
            {
                //代表是子層

                db_tree_second_click(
                    ((TreeView)sender).SelectedNode.Parent.Index,
                    ((TreeView)sender).SelectedNode.Index,
                    ((TreeView)sender).SelectedNode.Text
                    );
                dialogMyBoxOff();
                return;
            }
            if (m.Length == 3)
            {
                //代表是點到 view、table 之類層
                db_tree_third_click(
                    ((TreeView)sender).SelectedNode.Parent.Parent.Index,
                    ((TreeView)sender).SelectedNode.Parent.Index,
                    ((TreeView)sender).SelectedNode.Parent.Text,
                    ((TreeView)sender).SelectedNode.Text);
                dialogMyBoxOff();
                return;
            }
            var db = myN.connections[index];

            //連線測試
            if (db["isConnect"].ToString() == "T")
            {
                //展開
                //收合
                //((TreeView)sender).SelectedNode.Toggle();

                /*switch (((TreeView)sender).SelectedNode.IsExpanded)
                 * {
                 *  case false:
                 *      ((TreeView)sender).SelectedNode.ExpandAll();
                 *      break;
                 *  default:
                 *
                 *      break;
                 * }
                 */
            }
            else
            {
                //連線,展開
                switch (db["kind"].ToString().ToLower())
                {
                case "postgresql":
                {
                    //Server=127.0.0.1;Port=5432;Database=myDataBase;User Id=myUsername;
                    //Password = myPassword;
                    myN.connections[index]["connString"] = "Server=" + myN.connections[index]["ip"].ToString() + ";" +
                                                           "Port=" + myN.connections[index]["port"].ToString() + ";" +
                                                           "User Id=" + myN.connections[index]["login_id"].ToString() + ";" +
                                                           "Password="******"pwd"].ToString() + ";" +
                                                           "Database=postgres;";
                    myN.connections[index]["pdo"] = new my_postgresql();
                    //((MySqlConnection)myN.connections[index]["pdo"]).ConnectionString = myN.connections[index]["connString"].ToString();
                    ((my_postgresql)myN.connections[index]["pdo"]).setConn(myN.connections[index]["connString"].ToString());
                    if (((my_postgresql)myN.connections[index]["pdo"]).MCT.State != ConnectionState.Open)
                    {
                        try
                        {
                            ((my_postgresql)myN.connections[index]["pdo"]).open();
                            myN.connections[index]["isConnect"]     = "T";
                            db_tree.Nodes[index].SelectedImageIndex = 1;
                            db_tree.Nodes[index].ImageIndex         = 1;
                            //取得 databases 列表
                            string SQL = @"
                                        SELECT
                                           ""datname"" AS ""Database""
                                        FROM
                                           ""pg_database""
                                    ";
                            //MySqlCommand cmd = new MySqlCommand(SQL, ((MySqlConnection)myN.connections[index]["pdo"]));
                            DataTable dt = ((my_postgresql)myN.connections[index]["pdo"]).selectSQL_SAFE(SQL);
                            //dt.Load(cmd.ExecuteReader());
                            for (int i = 0, max_i = dt.Rows.Count; i < max_i; i++)
                            {
                                TreeNode newNode = new TreeNode(dt.Rows[i]["Database"].ToString(), i, i);
                                newNode.ImageIndex         = 10;
                                newNode.SelectedImageIndex = 10;
                                db_tree.Nodes[index].Nodes.Add(newNode);
                            }
                            ((TreeView)sender).SelectedNode.ExpandAll();
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message);
                            myN.connections[index]["isConnect"] = "F";
                            //db_tree.Nodes[index].ImageIndex = 0;
                            //db_tree.Nodes[index].SelectedImageIndex = 0;
                            ((TreeView)sender).SelectedNode.Collapse();
                        }
                    }
                }
                break;

                case "sqlite":
                {
                    //Console.WriteLine(myN.connections[index]["path"].ToString());
                    myN.connections[index]["connString"] = "Data Source=" + myN.connections[index]["path"].ToString() + ";Version=3;";
                    myN.connections[index]["pdo"]        = new my_sqlite();
                    //((MySqlConnection)myN.connections[index]["pdo"]).ConnectionString = myN.connections[index]["connString"].ToString();
                    ((my_sqlite)myN.connections[index]["pdo"]).setConn(myN.connections[index]["connString"].ToString());
                    if (((my_sqlite)myN.connections[index]["pdo"]).MCT.State != ConnectionState.Open)
                    {
                        try
                        {
                            ((my_sqlite)myN.connections[index]["pdo"]).open();
                            myN.connections[index]["isConnect"]     = "T";
                            db_tree.Nodes[index].SelectedImageIndex = 1;
                            db_tree.Nodes[index].ImageIndex         = 1;
                            //取得 databases 列表
                            string    SQL = @"
                                    select 'main' AS `Database`;
                                ";
                            DataTable dt  = ((my_sqlite)myN.connections[index]["pdo"]).selectSQL_SAFE(SQL);
                            for (int i = 0, max_i = dt.Rows.Count; i < max_i; i++)
                            {
                                TreeNode newNode = new TreeNode(dt.Rows[i]["Database"].ToString(), i, i);
                                newNode.ImageIndex         = 10;
                                newNode.SelectedImageIndex = 10;
                                db_tree.Nodes[index].Nodes.Add(newNode);
                            }
                            ((TreeView)sender).SelectedNode.ExpandAll();
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message);
                            myN.connections[index]["isConnect"] = "F";
                            //db_tree.Nodes[index].ImageIndex = 0;
                            //db_tree.Nodes[index].SelectedImageIndex = 0;
                            ((TreeView)sender).SelectedNode.Collapse();
                        }
                    }
                }
                break;

                case "mysql":
                {
                    myN.connections[index]["connString"] = "server=" + myN.connections[index]["ip"].ToString() + ";" +
                                                           "port=" + myN.connections[index]["port"].ToString() + ";" +
                                                           "user id=" + myN.connections[index]["login_id"].ToString() + ";" +
                                                           "Password="******"pwd"].ToString() + ";" +
                                                           "database=;sslmode=none;charset=utf8;";
                    myN.connections[index]["pdo"] = new my_mysql();
                    //((MySqlConnection)myN.connections[index]["pdo"]).ConnectionString = myN.connections[index]["connString"].ToString();
                    ((my_mysql)myN.connections[index]["pdo"]).setConn(myN.connections[index]["connString"].ToString());
                    if (((my_mysql)myN.connections[index]["pdo"]).MCT.State != ConnectionState.Open)
                    {
                        try
                        {
                            ((my_mysql)myN.connections[index]["pdo"]).open();
                            myN.connections[index]["isConnect"]     = "T";
                            db_tree.Nodes[index].SelectedImageIndex = 1;
                            db_tree.Nodes[index].ImageIndex         = 1;
                            //取得 databases 列表
                            string SQL = @"
                                    show databases;
                                ";
                            //MySqlCommand cmd = new MySqlCommand(SQL, ((MySqlConnection)myN.connections[index]["pdo"]));
                            DataTable dt = ((my_mysql)myN.connections[index]["pdo"]).selectSQL_SAFE(SQL);
                            //dt.Load(cmd.ExecuteReader());
                            for (int i = 0, max_i = dt.Rows.Count; i < max_i; i++)
                            {
                                TreeNode newNode = new TreeNode(dt.Rows[i]["Database"].ToString(), i, i);
                                newNode.ImageIndex         = 10;
                                newNode.SelectedImageIndex = 10;
                                db_tree.Nodes[index].Nodes.Add(newNode);
                            }
                            ((TreeView)sender).SelectedNode.ExpandAll();
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message);
                            myN.connections[index]["isConnect"] = "F";
                            //db_tree.Nodes[index].ImageIndex = 0;
                            //db_tree.Nodes[index].SelectedImageIndex = 0;
                            ((TreeView)sender).SelectedNode.Collapse();
                        }
                    }
                }
                break;

                case "mssql":
                case "sqlserver":
                {
                    myN.connections[index]["connString"] = "Data Source=" + myN.connections[index]["ip"].ToString() + "," + myN.connections[index]["port"].ToString() + "; " +
                                                           // + "," + myN.connections[index]["port"].ToString() + "
                                                           "Integrated Security=True;" +
                                                           "Initial Catalog=master;" +
                                                           "User ID=" + myN.connections[index]["login_id"].ToString() + ";" +
                                                           "Password="******"pwd"].ToString() + "";
                    //Console.WriteLine(myN.connections[index]["connString"]);
                    myN.connections[index]["pdo"] = new my_mssql();
                    //((MySqlConnection)myN.connections[index]["pdo"]).ConnectionString = myN.connections[index]["connString"].ToString();
                    ((my_mssql)myN.connections[index]["pdo"]).setConn(myN.connections[index]["connString"].ToString());
                    if (((my_mssql)myN.connections[index]["pdo"]).MCT.State != ConnectionState.Open)
                    {
                        try
                        {
                            ((my_mssql)myN.connections[index]["pdo"]).open();
                            myN.connections[index]["isConnect"]     = "T";
                            db_tree.Nodes[index].SelectedImageIndex = 1;
                            db_tree.Nodes[index].ImageIndex         = 1;
                            //取得 databases 列表
                            string SQL = @"
                                  select [name] as [Database] from sys.databases WHERE name NOT IN ('master', 'tempdb', 'model', 'msdb')
                                ";
                            //MySqlCommand cmd = new MySqlCommand(SQL, ((MySqlConnection)myN.connections[index]["pdo"]));
                            DataTable dt = ((my_mssql)myN.connections[index]["pdo"]).selectSQL_SAFE(SQL);
                            //dt.Load(cmd.ExecuteReader());
                            for (int i = 0, max_i = dt.Rows.Count; i < max_i; i++)
                            {
                                TreeNode newNode = new TreeNode(dt.Rows[i]["Database"].ToString(), i, i);
                                newNode.ImageIndex         = 10;
                                newNode.SelectedImageIndex = 10;
                                db_tree.Nodes[index].Nodes.Add(newNode);
                            }
                            ((TreeView)sender).SelectedNode.ExpandAll();
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message);
                            myN.connections[index]["isConnect"] = "F";
                            //db_tree.Nodes[index].ImageIndex = 0;
                            //db_tree.Nodes[index].SelectedImageIndex = 0;
                            ((TreeView)sender).SelectedNode.Collapse();
                        }
                    }
                }
                break;
                }
            }
            dialogMyBoxOff();
        }