Example #1
0
 public CoreStates(
     Service.Servers servers,
     VgcApis.Models.Datas.CoreInfo coreInfo)
 {
     this.servers  = servers;
     this.coreInfo = coreInfo;
 }
Example #2
0
        public MenuItemsServer(
            ToolStripMenuItem stopSelected,
            ToolStripMenuItem restartSelected,
            ToolStripMenuItem clearSysProxy,
            ToolStripMenuItem refreshSummary,
            ToolStripMenuItem selectAllAutorun,
            ToolStripMenuItem selectAll,
            ToolStripMenuItem selectNone,
            ToolStripMenuItem selectInvert,
            ToolStripMenuItem speedTestOnSelected,
            ToolStripMenuItem deleteSelected,
            ToolStripMenuItem copyAsV2rayLinks,
            ToolStripMenuItem copyAsVmessLinks,
            ToolStripMenuItem copyAsSubscriptions,
            ToolStripMenuItem deleteAllItems,
            ToolStripMenuItem modifySelected,
            ToolStripMenuItem packSelected,
            ToolStripMenuItem moveToTop,
            ToolStripMenuItem moveToBottom,
            ToolStripMenuItem collapsePanel,
            ToolStripMenuItem expansePanel)
        {
            cache   = Service.Cache.Instance;
            servers = Service.Servers.Instance;

            InitBatchOperation(
                stopSelected, restartSelected, speedTestOnSelected,
                deleteSelected, copyAsV2rayLinks, copyAsVmessLinks, copyAsSubscriptions,
                deleteAllItems, modifySelected, packSelected,
                moveToTop, moveToBottom, collapsePanel, expansePanel);
            InitSelection(selectAllAutorun, selectAll, selectNone, selectInvert);
            InitMisc(clearSysProxy, refreshSummary);
        }
Example #3
0
        public MenuItemsServer(
            ToolStripMenuItem stopSelected,
            ToolStripMenuItem restartSelected,
            ToolStripMenuItem clearSysProxy,
            ToolStripMenuItem refreshSummary,
            ToolStripMenuItem speedTestOnSelected,
            ToolStripMenuItem deleteSelected,
            ToolStripMenuItem copyAsV2rayLinks,
            ToolStripMenuItem copyAsVmessLinks,
            ToolStripMenuItem copyAsSubscriptions,
            ToolStripMenuItem deleteAllItems,
            ToolStripMenuItem modifySelected,
            ToolStripMenuItem packSelected,
            ToolStripMenuItem moveToTop,
            ToolStripMenuItem moveToBottom,
            ToolStripMenuItem collapsePanel,
            ToolStripMenuItem expansePanel,
            ToolStripMenuItem sortBySpeed,
            ToolStripMenuItem sortBySummary)
        {
            cache   = Service.Cache.Instance;
            servers = Service.Servers.Instance;

            InitCtrlSorting(sortBySpeed, sortBySummary);
            InitCtrlView(moveToTop, moveToBottom, collapsePanel, expansePanel);
            InitCtrlCopyToClipboard(copyAsV2rayLinks, copyAsVmessLinks, copyAsSubscriptions);
            InitCtrlDelete(deleteSelected, deleteAllItems);
            InitCtrlBatchOperation(stopSelected, restartSelected, speedTestOnSelected, modifySelected, packSelected);
            InitCtrlSysProxy(clearSysProxy, refreshSummary);
        }
Example #4
0
        public MenuUpdater(
            Views.WinForms.FormConfiger formConfiger,
            ToolStripMenuItem miReplaceServer,
            ToolStripMenuItem miLoadServer)
        {
            servers = Service.Servers.Instance;

            this.formConfiger    = formConfiger;
            this.miReplaceServer = miReplaceServer;
            this.miLoadServer    = miLoadServer;

            menuUpdater = new VgcApis.Libs.Tasks.LazyGuy(
                () =>
            {
                try
                {
                    VgcApis.Libs.Utils.RunInBackground(
                        UpdateServerMenus);
                }
                catch
                {
                    // Do not hurt me.
                }
            },
                VgcApis.Models.Consts.Intervals.FormConfigerMenuUpdateDelay);
        }
Example #5
0
        public MenuItemsSelect(
            ToolStripMenuItem selectAllCurPage,
            ToolStripMenuItem invertSelectionCurPage,
            ToolStripMenuItem selectNoneCurPage,

            ToolStripMenuItem selectAllAllPages,
            ToolStripMenuItem invertSelectionAllPages,
            ToolStripMenuItem selectNoneAllPages,

            ToolStripMenuItem selectAutorunAllPages,
            ToolStripMenuItem selectNoMarkAllPages,
            ToolStripMenuItem selectNoSpeedTestAllPages,
            ToolStripMenuItem selectRunningAllPages,
            ToolStripMenuItem selectTimeoutAllPages,
            ToolStripMenuItem selectUntrackAllPages,

            ToolStripMenuItem selectAllAllServers,
            ToolStripMenuItem invertSelectionAllServers,
            ToolStripMenuItem selectNoneAllServers,

            ToolStripMenuItem selectAutorunAllServers,
            ToolStripMenuItem selectNoMarkAllServers,
            ToolStripMenuItem selectNoSpeedTestAllServers,
            ToolStripMenuItem selectRunningAllServers,
            ToolStripMenuItem selectTimeoutAllServers,
            ToolStripMenuItem selectUntrackAllServers)


        {
            servers = Service.Servers.Instance;

            InitAllPagesSelectors(selectNoneAllPages, invertSelectionAllPages, selectAllAllPages, selectAutorunAllPages, selectRunningAllPages, selectTimeoutAllPages, selectNoSpeedTestAllPages, selectNoMarkAllPages, selectUntrackAllPages);
            InitAllServersSelector(selectNoneAllServers, invertSelectionAllServers, selectAllAllServers, selectAutorunAllServers, selectRunningAllServers, selectTimeoutAllServers, selectNoSpeedTestAllServers, selectNoMarkAllServers, selectUntrackAllServers);
            InitCurPageSelectors(selectAllCurPage, selectNoneCurPage, invertSelectionCurPage);
        }
Example #6
0
        public TabSetting(
            ComboBox cboxLanguage,
            ComboBox cboxPageSize,
            CheckBox chkServAutoTrack,
            CheckBox chkPortableMode,
            CheckBox chkSetUseV4,
            CheckBox chkSetEnableStat,
            CheckBox chkSetUpdateUseProxy,
            CheckBox chkSetCheckWhenAppStart)
        {
            this.setting = Service.Setting.Instance;
            this.servers = Service.Servers.Instance;

            // Do not put these lines of code into InitElement.
            this.cboxLanguage            = cboxLanguage;
            this.cboxPageSize            = cboxPageSize;
            this.chkServAutoTrack        = chkServAutoTrack;
            this.chkPortableMode         = chkPortableMode;
            this.chkSetUseV4             = chkSetUseV4;
            this.chkSetEnableStat        = chkSetEnableStat;
            this.chkSetCheckWhenAppStart = chkSetCheckWhenAppStart;
            this.chkSetUpdateUseProxy    = chkSetUpdateUseProxy;

            InitElement();
        }
Example #7
0
 public void Run(
     Service.Setting setting,
     Service.Servers servers)
 {
     this.settingService = setting;
     this.serversService = servers;
 }
Example #8
0
        public MenuItemsBasic(
            Form formMain,
            ToolStripMenuItem pluginToolStrip,

            ToolStripMenuItem miSimVmessServer,
            ToolStripMenuItem miImportLinkFromClipboard,
            ToolStripMenuItem miExportAllServer,
            ToolStripMenuItem miImportFromFile,
            ToolStripMenuItem miAbout,
            ToolStripMenuItem miHelp,
            ToolStripMenuItem miFormConfigEditor,
            ToolStripMenuItem miFormQRCode,
            ToolStripMenuItem miFormLog,
            ToolStripMenuItem miFormOptions,
            ToolStripMenuItem miDownloadV2rayCore,
            ToolStripMenuItem miRemoveV2rayCore,
            ToolStripMenuItem miCheckVgcUpdate)
        {
            servers    = Service.Servers.Instance;
            slinkMgr   = Service.ShareLinkMgr.Instance;
            updater    = Service.Updater.Instance;
            pluginServ = Service.PluginsServer.Instance;

            this.formMain = formMain;

            InitMenuPlugin(pluginToolStrip);

            InitMenuFile(miSimVmessServer, miImportLinkFromClipboard, miExportAllServer, miImportFromFile);
            InitMenuWindows(miFormConfigEditor, miFormQRCode, miFormLog, miFormOptions);
            InitMenuAbout(miAbout, miHelp, miDownloadV2rayCore, miRemoveV2rayCore, miCheckVgcUpdate);
        }
Example #9
0
        public FlyServer(
            Form formMain,
            FlowLayoutPanel panel,
            ToolStripLabel lbMarkFilter,
            ToolStripComboBox cboxMarkeFilter,
            ToolStripStatusLabel tslbTotal,
            ToolStripDropDownButton tsdbtnPager,
            ToolStripStatusLabel tslbPrePage,
            ToolStripStatusLabel tslbNextPage)
        {
            this.servers = Service.Servers.Instance;
            this.setting = Service.Setting.Instance;

            this.formMain       = formMain;
            this.flyPanel       = panel;
            this.cboxMarkFilter = cboxMarkeFilter;
            this.tsdbtnPager    = tsdbtnPager;
            this.tslbTotal      = tslbTotal;
            this.tslbPrePage    = tslbPrePage;
            this.tslbNextPage   = tslbNextPage;
            this.welcomeItem    = new Views.UserControls.WelcomeUI();

            InitFormControls(lbMarkFilter);
            BindDragDropEvent();
            RefreshUI();
            servers.OnRequireFlyPanelUpdate  += OnRequireFlyPanelUpdateHandler;
            servers.OnRequireFlyPanelReload  += OnRequireFlyPanelReloadHandler;
            servers.OnRequireStatusBarUpdate += OnRequireStatusBarUpdateHandler;
        }
Example #10
0
        public void Run(
            Service.Cache cache,
            Service.Setting setting,
            Service.ConfigMgr configMgr,
            Service.Servers servers)
        {
            //external dependency injection
            coreCtrl = new CoreServerComponent.CoreCtrl(setting, configMgr);
            states   = new CoreServerComponent.CoreStates(servers, coreInfo);
            logger   = new CoreServerComponent.Logger(setting);
            configer = new CoreServerComponent.Configer(
                setting, cache, configMgr, servers, coreInfo);

            Plug(this, coreCtrl);
            Plug(this, states);
            Plug(this, logger);
            Plug(this, configer);

            //inter-container dependency injection
            coreCtrl.Prepare();
            states.Prepare();
            logger.Prepare();
            configer.Prepare();


            //other initializiations
            coreCtrl.BindEvents();
        }
Example #11
0
        public Quick(
            Button skipCN,
            Button mtProto,
            CheckBox chkUseV4)
        {
            cache     = Service.Cache.Instance;
            servers   = Service.Servers.Instance;
            configMgr = Service.ConfigMgr.Instance;

            isUseV4 = chkUseV4.Checked;
            chkUseV4.CheckedChanged += (s, a) =>
            {
                isUseV4 = chkUseV4.Checked;
            };

            skipCN.Click += (s, a) =>
            {
                container.InjectConfigHelper(
                    () => configMgr
                    .InjectSkipCnSiteSettingsIntoConfig(
                        ref container.config,
                        isUseV4)
                    );
            };

            mtProto.Click += (s, a) =>
            {
                container.InjectConfigHelper(() =>
                {
                    InsertMTProto(ref container.config);
                });
            };
        }
Example #12
0
        public MenuItemsServer(
            // for invoke ui refresh
            MenuStrip menuContainer,

            // misc
            ToolStripMenuItem refreshSummary,
            ToolStripMenuItem deleteAllServers,
            ToolStripMenuItem deleteSelected,

            // copy
            ToolStripMenuItem copyAsV2cfgLinks,
            ToolStripMenuItem copyAsVmessLinks,
            ToolStripMenuItem copyAsVeeLinks,
            ToolStripMenuItem copyAsVmessSubscriptions,
            ToolStripMenuItem copyAsVeeSubscriptions,

            // batch op
            ToolStripMenuItem speedTestOnSelected,

            ToolStripMenuItem modifySelected,
            ToolStripMenuItem stopSelected,
            ToolStripMenuItem restartSelected,

            // view
            ToolStripMenuItem moveToTop,
            ToolStripMenuItem moveToBottom,
            ToolStripMenuItem foldPanel,
            ToolStripMenuItem expansePanel,
            ToolStripMenuItem sortBySpeed,
            ToolStripMenuItem sortBySummary)
        {
            cache    = Service.Cache.Instance;
            servers  = Service.Servers.Instance;
            setting  = Service.Setting.Instance;
            slinkMgr = Service.ShareLinkMgr.Instance;

            this.menuContainer = menuContainer; // for invoke ui update

            InitCtrlSorting(sortBySpeed, sortBySummary);
            InitCtrlView(moveToTop, moveToBottom, foldPanel, expansePanel);

            InitCtrlCopyToClipboard(
                copyAsV2cfgLinks,
                copyAsVmessLinks,
                copyAsVeeLinks,
                copyAsVmessSubscriptions,
                copyAsVeeSubscriptions);

            InitCtrlMisc(
                refreshSummary,
                deleteSelected,
                deleteAllServers);

            InitCtrlBatchOperation(
                stopSelected,
                restartSelected,
                speedTestOnSelected,
                modifySelected);
        }
Example #13
0
 public void Run(
     Service.Setting setting,
     Service.Servers servers)
 {
     this.apiUtils       = new Apis.ApiUtils();
     this.settingService = setting;
     this.serversService = servers;
 }
Example #14
0
        public WelcomeUI()
        {
            servers = Service.Servers.Instance;
            setting = Service.Setting.Instance;

            InitializeComponent();
            marginBottom = this.Height - pnlBasicUsage.Top;
        }
        public MenuItemVgcAutoUpdate(
            ToolStripMenuItem miCheckVgcUpdate)
        {
            setting = Service.Setting.Instance;
            servers = Service.Servers.Instance;

            InitAutoUpdater();
            miCheckVgcUpdate.Click += CheckForUpdate;
        }
Example #16
0
        public FormConfigerCtrl(string originalConfig)
        {
            servers = Service.Servers.Instance;

            this.originalFile   = string.Empty;
            this.originalConfig = string.Empty;

            LoadConfig(originalConfig);
        }
        FormBatchModifyServerSetting()
        {
            servers = Service.Servers.Instance;

            InitializeComponent();

            VgcApis.Libs.UI.AutoSetFormIcon(this);
            this.Show();
        }
Example #18
0
 public CoreCtrl(
     Service.Setting setting,
     Service.Servers servers,
     Service.ConfigMgr configMgr)
 {
     this.setting   = setting;
     this.servers   = servers;
     this.configMgr = configMgr;
 }
Example #19
0
        public FormMain()
        {
            setting = Service.Setting.Instance;
            servers = Service.Servers.Instance;

            InitializeComponent();
            VgcApis.Libs.UI.AutoSetFormIcon(this);
            Lib.UI.AutoScaleToolStripControls(this, 16);
            GenFormTitle();
        }
Example #20
0
        public FormQRCode()
        {
            servers  = Service.Servers.Instance;
            slinkMgr = Service.ShareLinkMgr.Instance;

            servIndex = -1;
            linkType  = VgcApis.Models.Datas.Enum.LinkTypes.vmess;

            InitializeComponent();

            VgcApis.Libs.UI.AutoSetFormIcon(this);
        }
Example #21
0
        public FlyServer(
            FlowLayoutPanel panel,
            ComboBox cboxMarkeFilter)
        {
            this.servers  = Service.Servers.Instance;
            this.flyPanel = panel;
            this.cboxMark = cboxMarkeFilter;

            InitMarkFilter(cboxMarkeFilter);
            BindDragDropEvent();
            servers.OnRequireFlyPanelUpdate += OnRequireFlyPanelUpdateHandler;
        }
Example #22
0
        FormQRCode()
        {
            servers = Service.Servers.Instance;

            servIndex = 0;
            linkType  = 0;

            InitializeComponent();

            VgcApis.Libs.UI.AutoSetFormIcon(this);
            this.Show();
        }
        FormBatchModifyServerSetting()
        {
            servers = Service.Servers.Instance;

            InitializeComponent();

#if DEBUG
            this.Icon = Properties.Resources.icon_light;
#else
            this.Icon = Properties.Resources.icon_dark;
#endif
            this.Show();
        }
Example #24
0
        FormMain()
        {
            setting = Service.Setting.Instance;
            servers = Service.Servers.Instance;

            InitializeComponent();

#if DEBUG
            this.Icon = Properties.Resources.icon_light;
#endif
            Lib.UI.AutoScaleToolSripControls(this, 16);
            this.Show();
        }
Example #25
0
        FormMain()
        {
            setting = Service.Setting.Instance;
            servers = Service.Servers.Instance;

            InitializeComponent();

#if DEBUG
            this.Icon = Properties.Resources.icon_light;
#endif

            this.Show();
        }
Example #26
0
 public Configer(
     Service.Setting setting,
     Service.Cache cache,
     Service.ConfigMgr configMgr,
     Service.Servers servers,
     VgcApis.Models.Datas.CoreInfo coreInfo)
 {
     this.configMgr = configMgr;
     this.setting   = setting;
     this.cache     = cache;
     this.servers   = servers;
     this.coreInfo  = coreInfo;
 }
Example #27
0
        public void Run(
            Service.Cache cache,
            Service.Setting setting,
            Service.Servers servers)
        {
            this.cache   = cache;
            this.servers = servers;
            this.setting = setting;

            server        = new Service.Core(setting);
            server.OnLog += OnLogHandler;
            server.OnCoreStatusChanged += OnCoreStateChangedHandler;
        }
Example #28
0
        public MenuItemsServer(
            // for invoke ui refresh
            MenuStrip menuContainer,

            // system proxy
            ToolStripMenuItem curSysProxySummary,
            ToolStripMenuItem copyCurPacUrl,
            ToolStripMenuItem visitCurPacDebuggerUrl,
            ToolStripMenuItem clearSysProxy,
            ToolStripMenuItem restartPACServer,
            ToolStripMenuItem stopPACServer,

            // misc
            ToolStripMenuItem refreshSummary,
            ToolStripMenuItem deleteAllServers,
            ToolStripMenuItem deleteSelected,

            // copy
            ToolStripMenuItem copyAsV2rayLinks,
            ToolStripMenuItem copyAsVmessLinks,
            ToolStripMenuItem copyAsSubscriptions,

            // batch op
            ToolStripMenuItem speedTestOnSelected,
            ToolStripMenuItem modifySelected,
            ToolStripMenuItem packSelected,
            ToolStripMenuItem stopSelected,
            ToolStripMenuItem restartSelected,

            // view
            ToolStripMenuItem moveToTop,
            ToolStripMenuItem moveToBottom,
            ToolStripMenuItem foldPanel,
            ToolStripMenuItem expansePanel,
            ToolStripMenuItem sortBySpeed,
            ToolStripMenuItem sortBySummary)
        {
            cache     = Service.Cache.Instance;
            servers   = Service.Servers.Instance;
            setting   = Service.Setting.Instance;
            pacServer = Service.PacServer.Instance;

            this.menuContainer = menuContainer; // for invoke ui update

            InitCtrlSorting(sortBySpeed, sortBySummary);
            InitCtrlView(moveToTop, moveToBottom, foldPanel, expansePanel);
            InitCtrlCopyToClipboard(copyAsV2rayLinks, copyAsVmessLinks, copyAsSubscriptions);
            InitCtrlMisc(refreshSummary, deleteSelected, deleteAllServers);
            InitCtrlBatchOperation(stopSelected, restartSelected, speedTestOnSelected, modifySelected, packSelected);
            InitCtrlSysProxy(curSysProxySummary, copyCurPacUrl, visitCurPacDebuggerUrl, clearSysProxy, restartPACServer, stopPACServer);
        }
Example #29
0
        public FormConfiger(string originalConfigString = null)
        {
            setting = Service.Setting.Instance;
            servers = Service.Servers.Instance;

            isShowPanel = setting.isShowConfigerToolsPanel;
            formSearch  = null;
            InitializeComponent();
            formTitle = this.Text;
            this.originalConfigString = originalConfigString;

            VgcApis.Libs.UI.AutoSetFormIcon(this);
            this.Show();
        }
Example #30
0
        FormQRCode()
        {
            servers = Service.Servers.Instance;

            servIndex = 0;
            linkType  = 0;

            InitializeComponent();

#if DEBUG
            this.Icon = Properties.Resources.icon_light;
#endif
            this.Show();
        }