Пример #1
0
        static void Main(string[] args)
        {
#if !DEBUG
            MainImpl(args);
#else
            WriteLineDelegate log = Console.WriteLine;
            try
            {
                MainImpl(args);
            }
            catch (BoringException e)
            {
                // for exceptions that may happen before core loop
                log($"Error: {e.Message}");
                log("Press any key to exit.");
                Console.ReadKey();
            }
            catch (Exception e)
            {
                log();
                log("*** Crash log ***");
                log();
                log(e.ToString());
                log();
                log("Program has crashed. Press any key to exit.");
                Console.ReadKey();
                throw;
            }
#endif
        }
Пример #2
0
        public ConsoleOutToRichTextBox(ref RichTextBox richTextBox, bool scrollDownOnWriteLine, int maximumNumberOfLinesToDisplay)
        {
            _richTextBox                   = richTextBox;
            _scrollDownOnWriteLine         = scrollDownOnWriteLine;
            _maximumNumberOfLinesToDisplay = maximumNumberOfLinesToDisplay;

            _writeLineDelegate = new WriteLineDelegate(WriteLine);
        }
Пример #3
0
 public void WriteLine(string text)
 {
     if (!textBox1.InvokeRequired)
     {
         textBox1.AppendText(text + "\r\n");
     }
     else
     {
         WriteLineDelegate d = new WriteLineDelegate(WriteLine);
         this.Invoke(d, new object[] { text });
     }
 }
Пример #4
0
 public FileDisassemblerHelper(
     SimpleReflector reflector,
     ProjectTypes projectType,
     string outputDirectory,
     WriteLineDelegate writeLineDelegate,
     SetProgressBarDelegate setProgressBarDelegate,
     IsCancelPendingDelegate isCancelPendingDelegate)
 {
     _reflector               = reflector;
     _projectType             = projectType;
     _outputDirectory         = outputDirectory;
     WriteLine               += writeLineDelegate;
     SetProgressBar          += setProgressBarDelegate;
     _isCancelPendingDelegate = isCancelPendingDelegate;
 }
Пример #5
0
 public ProgramSession(User user, WriteLineDelegate writeLine)
 {
     Eax        = new Register();
     Ebx        = new Register();
     Ecx        = new Register();
     Edx        = new Register();
     Ebp        = new Register();
     Esp        = new Register();
     Esi        = new Register();
     Edi        = new Register();
     Esp.Value  = SpaceVM.VirtualMemorySize;
     HeapOffset = 0;
     Offset     = user.Id * SpaceVM.VirtualMemorySize;
     _writeLine = writeLine;
 }
		public FileDisassemblerHelper(
			SimpleReflector reflector,
            ProjectTypes projectType,
			string outputDirectory,
			WriteLineDelegate writeLineDelegate,
			SetProgressBarDelegate setProgressBarDelegate,
            IsCancelPendingDelegate isCancelPendingDelegate)
		{
            _reflector = reflector;
			_projectType = projectType;
			_outputDirectory = outputDirectory;
			WriteLine += writeLineDelegate;
			SetProgressBar += setProgressBarDelegate;
            _isCancelPendingDelegate = isCancelPendingDelegate;
		}
 public ProgramSession(User user, WriteLineDelegate writeLine)
 {
     Eax = new Register();
     Ebx = new Register();
     Ecx = new Register();
     Edx = new Register();
     Ebp = new Register();
     Esp = new Register();
     Esi = new Register();
     Edi = new Register();
     Esp.Value = SpaceVM.VirtualMemorySize;
     HeapOffset = 0;
     Offset = user.Id*SpaceVM.VirtualMemorySize;
     _writeLine = writeLine;
 }
 public FileDisassemblerHelper(
     IAssemblyManager assemblyManager,
     ITranslatorManager TranslatorManager,
     ILanguageManager languageManager,
     int projectType,
     string outputDirectory,
     WriteLineDelegate writeLineDelegate,
     SetProgressBarDelegate setProgressBarDelegate)
 {
     _assemblyManager = assemblyManager;
     _TranslatorManager = TranslatorManager;
     _languageManager = languageManager;
     _projectType = projectType;
     _outputDirectory = outputDirectory;
     WriteLine += writeLineDelegate;
     SetProgressBar += setProgressBarDelegate;
 }
Пример #9
0
 public void Validate(WriteLineDelegate report)
 {
     if (string.IsNullOrEmpty(Name))
     {
         report("Profile name is empty");
     }
     else if (Name.HasIllegalFilenameChars())
     {
         report("Profile name contains invalid charactes");
     }
     ValidatePath(report, "target", Target);
     ValidatePath(report, "storage", Storage, forceDirectory: true);
     if (Capacity < 1)
     {
         report("Option <maxfiles> must be greater than 0.");
     }
 }
Пример #10
0
        static void ValidatePath(WriteLineDelegate report, string key, string path, bool forceDirectory = false)
        {
            if (string.IsNullOrEmpty(path))
            {
                report($"Path to <{key}> is empty.");
                return;
            }
            var dirExists  = Directory.Exists(path);
            var fileExists = File.Exists(path);

            if (!dirExists && !fileExists)
            {
                report($"Path to <{key}> does not exists or is not accessible.");
            }
            else if (forceDirectory && fileExists)
            {
                report($"Path to <{key}> must be directory.");
            }
        }
		public FileDisassemblerHelper(
			IAssemblyManager assemblyManager,
			ITranslatorManager TranslatorManager,
			ILanguageManager languageManager,
			int projectType,
			string outputDirectory,
			WriteLineDelegate writeLineDelegate,
			SetProgressBarDelegate setProgressBarDelegate, bool documentation, bool membersBody, bool publicOnly)
		{
			_assemblyManager = assemblyManager;
			_TranslatorManager = TranslatorManager;
			_languageManager = languageManager;
			_projectType = projectType;
			_outputDirectory = outputDirectory;
			this.documentation = documentation;
			this.membersBody = membersBody;
			this.publicOnly = publicOnly;
			WriteLine += writeLineDelegate;
			SetProgressBar += setProgressBarDelegate;
		}
Пример #12
0
 public FileDisassemblerHelper(
     IAssemblyManager assemblyManager,
     ITranslatorManager TranslatorManager,
     ILanguageManager languageManager,
     int projectType,
     string outputDirectory,
     WriteLineDelegate writeLineDelegate,
     SetProgressBarDelegate setProgressBarDelegate, bool documentation, bool membersBody, bool publicOnly)
 {
     _assemblyManager   = assemblyManager;
     _TranslatorManager = TranslatorManager;
     _languageManager   = languageManager;
     _projectType       = projectType;
     _outputDirectory   = outputDirectory;
     this.documentation = documentation;
     this.membersBody   = membersBody;
     this.publicOnly    = publicOnly;
     WriteLine         += writeLineDelegate;
     SetProgressBar    += setProgressBarDelegate;
 }
Пример #13
0
 public void WriteLine(string Input, params string[] args)
 {
     for (int i = 0; i < args.Length; i++)
     {
         Input = Input.Replace("{" + i + "}", args[i].ToString());
     }
     try
     {
         if (this.txtConsoleOutput.InvokeRequired)
         {
             // It's on a different thread, so use Invoke.
             WriteLineDelegate d = new WriteLineDelegate(WriteLine);
             this.Invoke(d, new object[] { txtConsoleOutput.Text + Input + Environment.NewLine });
         }
         else
         {
             txtConsoleOutput.Text = txtConsoleOutput.Text + Input + Environment.NewLine;
         }
     }
     catch { }
 }