Exemple #1
0
        private static void InitializeC()
        {
            InitializeFile();
            HWND h = HWND.Cast(IntPtr.Zero);

            Console.WriteLine("F6 格式化 " + HotKeys.HotKey(h, 117, 0, (int)Keys.F6));
            Console.WriteLine("F5 编译 " + HotKeys.HotKey(h, 116, 0, (int)Keys.F5));
            Console.WriteLine("F4 " + HotKeys.HotKey(h, 115, 0, (int)Keys.F4));
            Console.WriteLine("Ctrl+W 清空文件变量 " + HotKeys.HotKey(h, 287, 2, (int)Keys.W));
            Console.WriteLine("Ctrl+E 收集文件名 " + HotKeys.HotKey(h, 269, 2, (int)Keys.E));
            Console.WriteLine("Ctrl+Q 排序方法 " + HotKeys.HotKey(h, 281, 2, (int)Keys.Q));
            // Console.WriteLine("F6 " + HotKeys.HotKey(h, 117, 0, (int)Keys.F6));
//			Console.WriteLine("F7 检查未下载成功的页面 " + HotKeys.HotKey(h, 118, 0, (int)Keys.F7));
            Console.WriteLine("F8 格式化评注 " + HotKeys.HotKey(h, 119, 0, (int)Keys.F8));
            Console.WriteLine("F9 命令2 " + HotKeys.HotKey(h, 120, 0, (int)Keys.F9));
//
//
            var msg       = new MSG();
            var handleRef = new HandleRef(null, IntPtr.Zero);

            while (HotKeys.GetMessageW(ref msg, handleRef, 0, 0))
            {
                if (msg.message == HotKeys.WM_HOTKEY)
                {
                    var k = ((int)msg.lParam >> 16) & 0xFFFF;
                    var m = (int)msg.lParam & 0xFFFF;
                    if (m == 1)
                    {
                        if (HandleFile(k, 1))
                        {
                        }
                    }
                    if (m == 2)
                    {
                        switch (k)
                        {
                        case 69:
                            Utils.ClipboardDirectory(dir => {
                                var files = Directory.GetFiles(dir);
                                var ls    = new List <string>();
                                foreach (var element in files)
                                {
                                    var extension = element.GetExtension();
                                    if (extension == ".c" || extension == ".cc" ||
                                        extension == ".cpp")
                                    {
                                        ls.Add(Path.GetFileName(element));
                                    }
                                }
                                Clipboard.SetText(string.Join("\n", ls.OrderBy(i => Path.GetExtension(i))
                                                              .ThenBy(i => Path.GetFileName(i))
                                                              ));
                            });
                            break;

                        case 81:
                            Utils.ClipboardString(C.FormatCode);
                            break;

                        case 87:
                            mFileName = null;
                            break;
                        }
                    }
                    else
                    {
                        switch (k)
                        {
                        case 115:
                            C.Command1();
                            break;

                        case 119:
                            Utils.ClipboardString(C.FormatAndroidComments);
                            break;

                        case 117:

                            bool skip = false;
                            Utils.ClipboardFile(f => {
                                var extension = f.GetExtension().ToLower();
                                if (extension == ".c" || extension == ".cc" || extension == ".h" ||
                                    extension == ".cpp" || extension == ".hpp" || extension == ".js")
                                {
                                    C.Foramt(f);
                                    skip      = true;
                                    mFileName = f;
                                }
                            });
                            if (!skip && mFileName != null)
                            {
                                C.Foramt(mFileName);
                            }
                            break;

                        case 120:
                            C.Command2();
                            break;
                        }
                    }
                }
            }
        }
Exemple #2
0
        private static void InitializeSafari()
        {
            HWND h = HWND.Cast(IntPtr.Zero);

            Console.WriteLine("F1 移除重复书籍 " + HotKeys.HotKey(h, 112, 0, (int)Keys.F1));
            Console.WriteLine("F2 压缩子目录 " + HotKeys.HotKey(h, 113, 0, (int)Keys.F2));
            Console.WriteLine("F5 格式化文件 " + HotKeys.HotKey(h, 116, 0, (int)Keys.F5));
            Console.WriteLine("F8 下载书籍 " + HotKeys.HotKey(h, 119, 0, (int)Keys.F8));
            Console.WriteLine("F9 搜索页 " + HotKeys.HotKey(h, 120, 0, (int)Keys.F9));
            Console.WriteLine("Alt+P " + HotKeys.HotKey(h, 1180, 1, (int)Keys.P));
            var msg       = new MSG();
            var handleRef = new HandleRef(null, IntPtr.Zero);

            while (HotKeys.GetMessageW(ref msg, handleRef, 0, 0))
            {
                if (msg.message == HotKeys.WM_HOTKEY)
                {
                    var k = ((int)msg.lParam >> 16) & 0xFFFF;
                    var m = (int)msg.lParam & 0xFFFF;
                    if (m == 1)
                    {
                        switch (k)
                        {
                        case 80:
                            Utils.ClipboardDirectory(Mobis.PrettyName);
                            break;
                        }
                    }
                    else
                    {
                        switch (k)
                        {
                        case 112:
                            var found = false;
                            Utils.ClipboardDirectory(dir => {
                                var styles = Path.Combine(dir, "style.txt").ReadAllText();
                                foreach (var element in Directory.GetFiles(dir, "*.html"))
                                {
                                    element.WriteAllText(element.ReadAllText().Replace("<head>", "<head>\r\n" + styles));
                                }
                                found = true;
                            });
                            if (found)
                            {
                                break;
                            }
                            Utils.ClipboardString(text => {
                                var matches = Regex.Matches(text, "<style[\\s\\S]*?</style>").Cast <Match>().Select(i => i.Value);

                                return(string.Join("\r\n", matches).Replace("#sbo-rt-content", "").Replace("}", "}\r\n\r\n"));
                            });
                            break;

                        case 113:
                            Utils.ClipboardDirectory(Safari.CreateFromDirectories);
                            break;


                        case 116:
                            Utils.ClipboardDirectory(Safari.ExecuteFormatFiles);
                            break;

                        case 119:
                            Utils.ClipboardDirectory(Safari.DownloadBooks);
                            break;

                        case 120:
                            Utils.ClipboardText(Safari.ExtractParseSearch);
                            break;
                        }
                    }
                }
            }
        }
Exemple #3
0
        private static void InitializeAndroid()
        {
            HWND h = HWND.Cast(IntPtr.Zero);

            //Console.WriteLine("F1 移除重复书籍 " + HotKeys.HotKey(h, 112, 0, (int)Keys.F1));
            Console.WriteLine("F6 在资源文件中模糊查找 " + HotKeys.HotKey(h, 117, 0, (int)Keys.F6));
            Console.WriteLine("F7 检查未下载成功的页面 " + HotKeys.HotKey(h, 118, 0, (int)Keys.F7));
            Console.WriteLine("F9 生成Log " + HotKeys.HotKey(h, 120, 0, (int)Keys.F9));
            Console.WriteLine("Alt+Q 复制资源文件 " + HotKeys.HotKey(h, 1181, 1, (int)Keys.Q));
            Console.WriteLine("Alt+W 排序资源文件 " + HotKeys.HotKey(h, 1187, 1, (int)Keys.W));
            Console.WriteLine("Ctrl+T 生成记录(类) " + HotKeys.HotKey(h, 284, 2, (int)Keys.T));
            Console.WriteLine("Ctrl+R 格式化字符串常量 " + HotKeys.HotKey(h, 282, 2, (int)Keys.R));
            Console.WriteLine("Ctrl+E 生成记录(变量) " + HotKeys.HotKey(h, 269, 2, (int)Keys.E));
            Console.WriteLine("Ctrl+W 生成记录(字段) " + HotKeys.HotKey(h, 287, 2, (int)Keys.W));
            Console.WriteLine("Ctrl+Q 生成记录(参数值) " + HotKeys.HotKey(h, 281, 2, (int)Keys.Q));
            Console.WriteLine("Ctrl+M 反编译 " + HotKeys.HotKey(h, 277, 2, (int)Keys.M));
            Console.WriteLine("Ctrl+L 字符串到UTF8数组 " + HotKeys.HotKey(h, 276, 2, (int)Keys.L));
            var msg       = new MSG();
            var handleRef = new HandleRef(null, IntPtr.Zero);

            while (HotKeys.GetMessageW(ref msg, handleRef, 0, 0))
            {
                if (msg.message == HotKeys.WM_HOTKEY)
                {
                    var k = ((int)msg.lParam >> 16) & 0xFFFF;
                    var m = (int)msg.lParam & 0xFFFF;
                    if (m == 1)
                    {
                        switch (k)
                        {
                        case 81:                                //q
                            Utils.ClipboardFiles(Utils.CopySameLevelFiles);
                            break;

                        case 87:                                //q
                            Utils.ClipboardFile(f => {
                                if (f.EndsWith(".xml"))
                                {
                                    f.WriteAllText(Androids.OrderAndroidResource(f.ReadAllText()));
                                }
                            });
                            break;
                        }
                    }
                    if (m == 2)
                    {
                        switch (k)
                        {
                        case 69:                                //e
                            Utils.ClipboardString(Androids.LogVariables);
                            break;

                        case 76:
                            Utils.ClipboardString(s => string.Join(",", new UTF8Encoding(false).GetBytes(s).Select(i => i.ToString()))
                                                  + "\r\n"
                                                  + string.Join(",", Encoding.GetEncoding("gbk").GetBytes(s).Select(i => i.ToString())));
                            break;

                        case 77:                                //m
                            Utils.ClipboardFile(file => {
                                if (file.EndsWith(".apk"))
                                {
                                    Androids.ExtractApk(file);
                                }
                                else if (file.EndsWith(".dex"))
                                {
                                    Androids.ExtractJar(file);
                                }
                            });
                            break;

                        case 81:                                //q
                            Utils.ClipboardString(Androids.LogParameters);
                            break;

                        case 82:                                //R
                            Utils.ClipboardString(Androids.FormatConstStringFields);
                            break;

                        case 84:                                //T
                            Utils.ClipboardString(Androids.GenerateAndroidLog);
                            break;

                        case 87:                                //W
                            Utils.ClipboardString(Androids.LogFields);
                            break;
                        }
                    }
                    else
                    {
                        switch (k)
                        {
                        case 117:
                            Utils.ClipboardString(Androids.SearchInAndroidResourcesFuzzyUsePublic);
                            break;

                        case 118:
                            Utils.ClipboardDirectory(Safari.ExecuteCheckUnDownloadLink);
                            break;

                        case 120:
                            Utils.ClipboardString(Androids.LogParameters);
                            //Utils.ClipboardString(Androids.GenerateInterfaceFromClass);
                            break;
                        }
                    }
                }
            }
        }