private void CheatTasks()
        {
            BackupJournalOperations cheatBackupJournalOperations = new BackupJournalOperations();
            DateTime            timeToBackup          = DateTime.Now;
            List <IDestination> tmpDestinations       = new List <IDestination>();
            SourceFolders       tmpSourceFolders      = new SourceFolders();
            List <string>       tmpSourceFoldersPaths = new List <string>();

            tmpSourceFoldersPaths.Add(@"D:\KoFrMa\BackupThisFolder\");
            tmpSourceFolders.Paths = tmpSourceFoldersPaths;
            SourceMSSQL sourceMSSQL = new SourceMSSQL();

            sourceMSSQL.ServerName        = "(local)";
            sourceMSSQL.DatabaseName      = "dbNw";
            sourceMSSQL.NetworkCredential = new System.Net.NetworkCredential()
            {
                UserName = "******", Password = "******"
            };

            tmpDestinations.Add(new DestinationPlain()
            {
                Path = new DestinationPathLocal()
                {
                    Path = @"d:\KoFrMa\BackupGoesHere\"
                }
            });
            tmpDestinations.Add(new Destination7z()
            {
                Path = new DestinationPathLocal()
                {
                    Path = @"d:\KoFrMa\BackupGoesHere\"
                }, CompressionLevel = 0, SplitAfter = 5
            });
            Task taskTest = new Task
            {
                //Sources = cheatBackupJournalOperations.LoadBackupJournalObject(@"d:\KoFrMa\BackupGoesHere\KoFrMaBackup_2018_06_02_15_02_59\KoFrMaBackup.dat", debugLog),
                Sources = tmpSourceFolders,
                //Sources = sourceMSSQL,
                IDTask   = 0,
                LogLevel = 8,
                TemporaryFolderMaxBuffer = null,
                Destinations             = tmpDestinations,
                TimeToBackup             = timeToBackup.AddSeconds(1)
                                           //ScriptBefore = new ScriptInfo { ScriptItself = @"ping 127.0.0.1 > d:\tmp.txt",ScriptItselfFormat = "bat"},
                                           //ScriptAfter = new ScriptInfo { ScriptItself = @"ping 127.0.0.1 > d:\tmp.txt", ScriptItselfFormat = "bat" }
                                           //ScriptAfter = new ScriptInfo { PathToLocalScript = @"c:\Windows\media\Windows Notify.wav" }
            };

            debugLog.WriteJsonTaskToLog(taskTest);
            ScheduledTasks.Add(taskTest);

            debugLog.WriteToLog("List of scheduled tasks now contains " + this.ScheduledTasks.Count + " tasks", 6);
            if (this.ScheduledTasks.Count > 0)
            {
                debugLog.WriteToLog("Starting scheduled tasks check", 6);
                this.OnTimerTasksTick(null, null);
            }
        }
        private Task LoadJournalFromCacheIfNeeded(Task task)
        {
            Task taskWithLoadedJournal;

            if (task.Sources is SourceJournalLoadFromCache)
            {
                taskWithLoadedJournal = task;
                BackupJournalOperations o = new BackupJournalOperations();

                List <int> currentCacheFiles = this.SearchJournalCacheFolder();

                if (currentCacheFiles.Contains(((SourceJournalLoadFromCache)task.Sources).JournalID))
                {
                    taskWithLoadedJournal.Sources = o.LoadBackupJournalObject(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\KoFrMa\journalcache\" + ((SourceJournalLoadFromCache)task.Sources).JournalID.ToString(), debugLog);
                    debugLog.WriteToLog("Task journal was loaded from local cache and will be used for incremental/differencial backup.", 7);
                }

                else
                {
                    debugLog.WriteToLog("Task journal should be differencial/incremental but is not in cache, server needs to send one. Process fail is inevitable.", 2);
                }
                return(taskWithLoadedJournal);
            }
            else
            {
                return(task);
            }


            //BackupJournalObject backupJournalSource = null;
            //if (item.BackupJournalSource != null)
            //{
            //    backupJournalSource = item.BackupJournalSource;
            //    debugLog.WriteToLog("Task from the server contains backup journal, using it as journal for incremental/differencial backup.", 7);
            //}
            //else
            //{
            //    try
            //    {
            //        int sourceJournalId;
            //        sourceJournalId = Convert.ToInt32(item.SourceOfBackup);
            //        for (int i = 0; i < JournalCacheList.Count; i++)
            //        {
            //            if (sourceJournalId == JournalCacheList[i])
            //            {
            //                BackupJournalOperations o = new BackupJournalOperations();
            //                backupJournalSource = o.LoadBackupJournalObject(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\KoFrMa\journalcache\" + item.SourceOfBackup, debugLog);
            //                debugLog.WriteToLog("Task journal was loaded from local cache and will be used for incremental/differencial backup.", 7);
            //            }
            //            else
            //            {
            //                debugLog.WriteToLog("Task journal should be differencial/incremental but is not in cache, server needs to send one. Process fail is inevitable.", 2);
            //            }
            //        }

            //    }
            //    catch (Exception)
            //    {
            //        debugLog.WriteToLog("Task from the server doesn't contain backup journal, using the path entered for full backup.", 7);
            //    }
            //}
        }