Exemplo n.º 1
0
 public static void BasicAddCurrent(string accName)
 {
     Globals.DebugWriteLine(@"[JSInvoke:Basic\BasicSwitcherBase.BasicAddCurrent] accName:hidden");
     _ = BasicSwitcherFuncs.BasicAddCurrent(accName);
 }
Exemplo n.º 2
0
 public static void SwapToBasic(string accName)
 {
     Globals.DebugWriteLine(@"[JSInvoke:Basic\BasicSwitcherBase.SwapToBasic] accName:hidden");
     BasicSwitcherFuncs.SwapBasicAccounts(accName);
 }
Exemplo n.º 3
0
 public static void NewLogin_Basic()
 {
     Globals.DebugWriteLine(@"[JSInvoke:Basic\BasicSwitcherBase.NewLogin_Basic]");
     BasicSwitcherFuncs.SwapBasicAccounts();
 }
Exemplo n.º 4
0
        /// <summary>
        /// Backs up platform folders, settings, etc - as defined in the platform settings json
        /// </summary>
        private void BackupButton(bool everything = false)
        {
            if (!_currentlyBackingUp)
            {
                _currentlyBackingUp = true;
            }
            else
            {
                _ = GeneralInvocableFuncs.ShowToast("error", Lang["Toast_BackupBusy"], renderTo: "toastarea");
                return;
            }
            // Let user know it's copying files to a temp location
            _ = GeneralInvocableFuncs.ShowToast("info", Lang["Toast_BackupCopy"], renderTo: "toastarea");

            // Generate temporary folder:
            var tempFolder = $"BackupTemp\\Backup_{CurrentPlatform.FullName}_{DateTime.Now:dd-MM-yyyy_hh-mm-ss}";

            Directory.CreateDirectory("Backups\\BackupTemp");

            if (!everything)
            {
                foreach (var(f, t) in CurrentPlatform.BackupPaths)
                {
                    var fExpanded = BasicSwitcherFuncs.ExpandEnvironmentVariables(f);
                    var dest      = Path.Join(tempFolder, t);

                    // Handle file entry
                    if (Globals.IsFile(f))
                    {
                        Globals.CopyFile(f, dest);
                        continue;
                    }
                    if (!Directory.Exists(fExpanded))
                    {
                        continue;
                    }

                    // Handle folder entry
                    if (CurrentPlatform.BackupFileTypesInclude.Count > 0)
                    {
                        Globals.CopyFilesRecursive(fExpanded, dest, true, CurrentPlatform.BackupFileTypesInclude, true);
                    }
                    else if (CurrentPlatform.BackupFileTypesIgnore.Count > 0)
                    {
                        Globals.CopyFilesRecursive(fExpanded, dest, true, CurrentPlatform.BackupFileTypesIgnore, false);
                    }
                }
            }
            else
            {
                foreach (var(f, t) in CurrentPlatform.BackupPaths)
                {
                    var fExpanded = BasicSwitcherFuncs.ExpandEnvironmentVariables(f);
                    var dest      = Path.Join(tempFolder, t);

                    // Handle file entry
                    if (Globals.IsFile(f))
                    {
                        Globals.CopyFile(f, dest);
                        continue;
                    }
                    if (!Directory.Exists(fExpanded))
                    {
                        continue;
                    }

                    // Handle folder entry
                    Globals.CopyFilesRecursive(fExpanded, dest, true);
                }
            }

            var backupThread = new Thread(() => FinishBackup(tempFolder));

            backupThread.Start();
        }