Esempio n. 1
0
        private void ReportToLogBoxAndLogger(LogBox logBox, string bookFolder, string msg)
        {
            // We've just told the user we are uploading book 'x'. Now tell them why we aren't.
            const string seeLogFile = "\n  See log file for details.";

            logBox.WriteMessage($"\n  {msg}{seeLogFile}");
            Logger.WriteEvent($"***{bookFolder}: {msg}");
        }
Esempio n. 2
0
        public void ShowLogBox()
        {
            Console.WriteLine("Showing LogBox");
            using (var e = new LogBoxFormForTest())
            {
                progress = e.progress;
                progress.WriteMessage("LogBox test");
                progress.ShowVerbose = true;
                for (int i = 0; i < 1000; i++)
                {
                    progress.WriteVerbose(".");
                }

                progress.WriteMessage("done");

                Console.WriteLine(progress.Text);
                Console.WriteLine(progress.Rtf);
                Console.WriteLine("Finished");
            }
        }
        /// ------------------------------------------------------------------------------------
        private void WriteLogMessagesForFileType(string initialMsg, IEnumerable <string> fileNames)
        {
            var list = fileNames.ToArray();

            if (list.Length == 0)
            {
                return;
            }

            LogBox.WriteMessageWithFontStyle(FontStyle.Bold | FontStyle.Underline, initialMsg);

            foreach (var filename in list)
            {
                LogBox.WriteMessage("\t" + filename);
            }
        }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// This is called by the Save method on the ZipFile class as the zip file is being
        /// saved to the disk.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void HandleZipExtractProgress(object s, ExtractProgressEventArgs e)
        {
            if (Cancel)
            {
                e.Cancel = true;
                return;
            }

            if (e.EventType != ZipProgressEventType.Extracting_BeforeExtractEntry)
            {
                return;
            }

            if (e.CurrentEntry.FileName != Path.GetFileName(_infoFile))
            {
                var filename = e.CurrentEntry.FileName.Replace("Data/", string.Empty).Replace("Audio/", string.Empty);
                LogBox.WriteMessage("\t" + filename);
            }

            _worker.ReportProgress(0);
        }
        /// ------------------------------------------------------------------------------------
        private void WriteLogMessageForFileName(string filename)
        {
            if (Path.GetFileName(_prjFiles[0]) == filename)
            {
                var text = LocalizationManager.GetString("DialogBoxes.BackupDlg.BackingUpProjectFilesMsg", "Backing Up Project Files...");
                LogBox.WriteMessageWithFontStyle(FontStyle.Bold | FontStyle.Underline, text);
            }

            if (_dataSourceFiles.Count > 0 &&
                Path.GetFileName(_dataSourceFiles[0]) == filename)
            {
                var text = LocalizationManager.GetString("DialogBoxes.BackupDlg.BackingUpDataSourceFilesMsg", "Backing Up Data Source Files...");
                LogBox.WriteMessageWithFontStyle(FontStyle.Bold | FontStyle.Underline, Environment.NewLine + text);
            }

            if (_audioFiles.Count > 0 &&
                Path.GetFileName(_audioFiles[0]) == filename)
            {
                var text = LocalizationManager.GetString("DialogBoxes.BackupDlg.BackingUpAudioFilesMsg", "Backing Up Audio Files...");
                LogBox.WriteMessageWithFontStyle(FontStyle.Bold | FontStyle.Underline, Environment.NewLine + text);
            }

            LogBox.WriteMessage("\t" + filename);
        }