示例#1
0
        public static void Run()
        {
            //ExStart:1
            // The path to the File directory.
            string dataDir = RunExamples.GetDataDir_IMAP();
            // Create an instance of the ImapClient class
            ImapClient imapClient = new ImapClient();

            // Specify host, username and password, and set port for your client
            imapClient.Host            = "imap.gmail.com";
            imapClient.Username        = "******";
            imapClient.Password        = "******";
            imapClient.Port            = 993;
            imapClient.SecurityOptions = SecurityOptions.Auto;

            imapClient.UseMultiConnection = MultiConnectionMode.Enable;

            RestoreSettings settings = new RestoreSettings();

            settings.Recursive = true;
            PersonalStorage pst = PersonalStorage.FromFile(dataDir + @"\Outlook.pst");

            imapClient.Restore(pst, settings);
            //ExEnd:1
        }
示例#2
0
        private static void DisableRun()
        {
            Running = false;

            /*
             * if (Recording) {
             *  controller.WriteInputs();
             * }
             */
            Recording = false;
            State     = State.None;
            NextState = State.None;
            BindingHelper.RestorePlayerBindings();
            Celeste.Mod.Core.CoreModule.Settings.UseKeyboardForTextInput = KbTextInput;
            Controller.ResetSpawn = null;
            if (ExportSyncData)
            {
                EndExport();
                ExportSyncData = false;
            }

            LibTasHelper.EndExport();

            EnforceLegal     = false;
            AllowUnsafeInput = false;
            AnalogHelper.AnalogModeChange(AnalogueMode.Ignore);
            Hotkeys.ReleaseAllKeys();
            RestoreSettings.TryRestore();
        }
示例#3
0
        private static void EnableRun()
        {
            NextState &= ~State.Enable;
            InitializeRun(false);
            BindingHelper.SetTasBindings();
            KbTextInput = Celeste.Mod.Core.CoreModule.Settings.UseKeyboardForTextInput;
            Celeste.Mod.Core.CoreModule.Settings.UseKeyboardForTextInput = false;

            checkHotkeyStarTask = Task.Run(() => {
                while (Running || Hotkeys.HotkeyStart.Pressed)
                {
                    if (FrameLoops > 100)
                    {
                        if (Running && Hotkeys.HotkeyStart.Pressed)
                        {
                            DisableRun();
                        }
                    }
                }

                checkHotkeyStarTask = null;
            });

            RestoreSettings.TryBackup();
        }
 internal KeyValueStateProvider(ReplicatorSettings replicatorSettings,
                                LocalStoreSettings localStoreSettings,
                                bool enableIncrementalBackup, int?logTruncationIntervalInMinutes)
 {
     userDefinedReplicatorSettings      = replicatorSettings;
     userDefinedLocalStoreSettings      = localStoreSettings;
     userDefinedEnableIncrementalBackup = enableIncrementalBackup;
     userDefinedLogTruncationInterval   = logTruncationIntervalInMinutes;
     replicaRole         = ReplicaRole.Unknown;
     restoreSettings     = new RestoreSettings(true);
     isBackupInProgress  = 0;
     backupCallbackLock  = new SemaphoreSlim(1);
     backupCallbackCts   = null;
     backupCallbackTask  = null;
     isClosingOrAborting = false;
 }
 public void SetUp()
 {
     theSettings = new RestoreSettings();
 }
示例#6
0
        public void test_RestoreManager()
        {
            // Test settings:
            // The index of the restore object(s) to use:
            int[] restore_indices = { 1 };

            // The restored file gets its own file name registration, at:
            string file_name_reg_path = @"E:\temp\temp\ignore\fnr2.tsv";

            // At the very end, this test compares two directories
            string dir1_path = @"E:\temp\temp";  // the original directory
            string dir2_path = @"E:\temp\temp3"; // the restored directory

            Console.WriteLine("Testing RestoreManager.");

            var cloud_backup_services = create_cloud_backup_services_from_xml(cloud_backup_services_xml);
            var key_manager           = new BasicKeyManager(key_manager_xml);

            var restore_manager = new RestoreManager(restore_xml, cloud_backup_services,
                                                     key_manager, handle_app_events);

            // Print restore names
            Console.WriteLine("Restore names:");
            string[] restore_names = restore_manager.get_restore_names();
            foreach (var name in restore_names)
            {
                Console.WriteLine("  " + name);
            }
            Console.WriteLine();

            // Get Info about the restores
            Console.Write("Getting info on: ");
            foreach (var i in restore_indices)
            {
                Console.Write(restore_names[i] + " ");
            }
            Console.WriteLine();

            // To run the restore_manager.get_info(...) on a separate thread, use
            // the background manager.
            var file_name_reg  = new FileNameRegistration(file_name_reg_xml);
            var backup_manager = new BackupManager(backup_xml, file_name_reg,
                                                   cloud_backup_services, key_manager, handle_app_events);

            backup_manager.get_restore_info(restore_manager, restore_indices, skip_file_names: false);

            // Create a RestoreSettings settings object and then initiate a restore
            var restore_settings = new RestoreSettings();

            if (File.Exists(file_name_reg_path))
            {
                File.Delete(file_name_reg_path);
            }
            restore_settings.file_name_reg = new FileNameRegistration(file_name_reg_path);

            restore_settings.indices = restore_indices;
            restore_settings.restore_destination_lookup = restore_manager.default_destinations;

            Console.WriteLine("Starting restore.");
            backup_manager.restore(restore_manager, restore_settings);

            wait_for_backup_manager_thread_to_quit(backup_manager);

            // Code gets here after user hit "s" key to stop the backup manager thread.
            Console.WriteLine("\nComparing directories:");
            compare_directories(dir1_path, dir2_path);

            Console.WriteLine("\n");
        }