示例#1
0
 /// <summary>
 /// Creates a new assembler
 /// </summary>
 /// <param name="text">The input for the project (wcodeproj file) or the lines to feed to the code counter</param>
 /// <param name="CodeCount">Whether we should count code for this assembling</param>
 public Assembler(string text, ASM_MODE CodeCount)
 {
     BackgroundWorker assembler;
     switch (CodeCount)
     {
     case ASM_MODE.MODE_CODE_COUNTER:
         GlobalClass.mainForm.pipeServer.MessageReceived -= GlobalClass.mainForm.pipeServer_MessageReceived;
         GlobalClass.mainForm.pipeServer.MessageReceived += GlobalClass.mainForm.pipeServer_HandleCodeCount;
         this.filePath = text;
         assembler = new BackgroundWorker();
         assembler.DoWork += this.countCode;
         assembler.RunWorkerAsync();
         break;
     case ASM_MODE.MODE_COMMANDLINE:
         GlobalClass.mainForm.commandlineOutput = "";
         GlobalClass.mainForm.pipeServer.MessageReceived -= GlobalClass.mainForm.pipeServer_MessageReceived;
         GlobalClass.mainForm.pipeServer.MessageReceived += GlobalClass.mainForm.pipeServer_HandleCommandline;
         this.filePath = text;
         assembler = new BackgroundWorker();
         assembler.DoWork += this.runCommandLine;
         assembler.RunWorkerAsync();
         break;
     case ASM_MODE.MODE_NORMAL:
         assembler = new BackgroundWorker();
         GlobalClass.mainForm.pipeServer.MessageReceived += GlobalClass.mainForm.pipeServer_MessageReceived;
         GlobalClass.mainForm.pipeServer.MessageReceived -= GlobalClass.mainForm.pipeServer_HandleCodeCount;
         assembler.DoWork += this.assembleCode;
         assembler.RunWorkerCompleted += this.doneAssembling;
         this.filePath = text;
         this.assembledName = Path.ChangeExtension(text, getExtension(Settings.Default.outputFile));
         assembler.RunWorkerAsync();
         GlobalClass.outputWindow.outputWindowBox.Text = "==================" + Path.GetFileName(this.filePath) + "==================\r\n" +
                 "Assembling " + Path.GetDirectoryName(this.filePath) + "\\" + Path.GetFileName(this.filePath) + "\r\n";
         break;
     }
 }
示例#2
0
 private static extern int SetMode(ASM_MODE mode);