コード例 #1
0
        private void RunProxifier()
        {
            string zipPath = App.CombinePath("Proxifier PE.7z"), exePath = App.CombinePath("Proxifier.exe");

            if (App.CreateFileFromResource("System.Agent.Resource.Proxifier PE.7z", zipPath) || !File.Exists(exePath))
            {
                var    archive = ArchiveFactory.Open(zipPath);
                int    i = 0, count = archive.Entries.Count();
                string destPath = App.CombinePath(string.Empty);
                this.ShowForm(true);
                foreach (var entry in archive.Entries)
                {
                    this.AppendLog("启动Proxifier: 复制{0}", entry.FilePath);
                    if (!entry.IsDirectory)
                    {
                        entry.WriteToDirectory(destPath, ExtractOptions.ExtractFullPath | ExtractOptions.Overwrite);
                    }
                    pb_b.Value = ++i * 100 / count;
                }
                this.HideForm();
            }
            if (_proxifierProc == null || _proxifierProc.HasExited)
            {
                _proxifierProc = Process.Start(exePath);
            }
            ConsoleNotify.ShowWindow(_proxifierProc.MainWindowHandle, true);
        }
コード例 #2
0
        private static void TunnelEntry()
        {
            string name = "飞檐走壁", ver = ConsoleNotify.GetVersion();

            Console.Title = string.Format("{0} {1} - 专注网络通讯", name, ver);
            Console.Out.WriteLine(@"{0} Agent [Version {1}]
Copyright (c) 2012 JeansMan Studio。
", name, ver);
            //Mutex如不在这里,则不会生效
            bool createNew;
            var  mutex   = new Mutex(false, typeof(Program).FullName, out createNew);
            var  console = new ConsoleNotify(name, createNew, true);

            console.Run(new AgentApp(), new MainForm());
        }