コード例 #1
0
        public void addToLoadedO2ModulesMenu(string menuItemName, O2Thread.FuncVoid onMenuItemClick)
        {
            DI.o2GuiWithDockPanel.invokeOnThread(
                () =>
            {
                var toolStripItem = new ToolStripMenuItem(
                    menuItemName, null, new EventHandler((_object, _EventArgs) => O2Thread.mtaThread(onMenuItemClick)));

                ;
                loadedO2ModuleToolStripMenuItem.DropDownItems.Add(toolStripItem);
            });
        }
コード例 #2
0
 public void updateDebuggerRunningAndActiveStatus(O2Thread.FuncVoid updateCompleteCallback)
 {
     O2Thread.mtaThread(() =>
     {
         if (DI.o2MDbg != null)
         {
             debugggerRunning = DI.o2MDbg.IsRunning;
             debugggerActive  = DI.o2MDbg.IsActive;
             if (updateCompleteCallback != null)
             {
                 updateCompleteCallback();
             }
         }
     });
 }
コード例 #3
0
 public void startMDbg(O2Thread.FuncVoid onShellStart)
 {
     if (shell == null)
     {
         O2Thread.mtaThread(() =>
         {
             setMDbgEventsMessagesCallbacks();
             shell = new MDbgShell();
             shell.Start(new string[0]);
             setO2MDbgShellCallbacks();
             o2MdbgIsReady.Set();
             if (onShellStart != null)
             {
                 onShellStart();
             }
         });
     }
 }
コード例 #4
0
        /// <summary>
        /// ASync execution of code on the the Control thread unless we are on the correct thread
        /// and the execution will be sync
        /// </summary>
        public static void invokeOnThread(this Control control, O2Thread.FuncVoid codeToInvoke)
        {
            try
            {
                if (control.InvokeRequired)
                {
                    control.Invoke(new EventHandler((sender, e) => codeToInvoke()));
                }
                else
                {
                    codeToInvoke();
                }
            }

            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
        }
コード例 #5
0
        public O2MDbg(O2Thread.FuncVoid onShellStart)
        {
            if (DI.o2MDbg != null)
            {
                DI.log.error("DI.o2MDbg != null, and we should only have one instance of the O2MDbg per AppDomain, so this will override that one (and some data might be lost)");
            }
            DI.o2MDbg = this;

            sessionData                   = new O2MDbgSessionData(this);
            BreakPoints                   = new O2MDbgBreakPoint(this);
            LogInternalMDbgMessage        = false;
            LogCommandExecutionMessage    = true;
            AnimateOnStepEvent            = false;
            AutoContinueOnBreakPointEvent = false;
            LogBreakpointEvent            = true;
            debugggerActive               = false;
            debugggerRunning              = false;

            startMDbg(onShellStart);
        }
コード例 #6
0
        public static List <IXRule> compileXRules(O2Thread.FuncVoidT1 <string> currentTask, O2Thread.FuncVoidT1 <int> numberOfStepsToPerform, O2Thread.FuncVoid onStepEvent)
        {
            var compiledXRulesFiles = getCompiledXRulesAssemblies(currentTask, numberOfStepsToPerform, onStepEvent);

            currentTask("Moving XRules and its dependencies");

            numberOfStepsToPerform(compiledXRulesFiles.Count * 2);

            //var pathToAppDomainWithXRulesAssemblies = populateDirectoryWithAllDependencies(compiledXRulesFiles, onStepEvent);
            // dont add the dependencies since they are creating a prob with the cmd line tool
            Files.deleteAllFilesFromDir(XRules_Config.PathTo_XRulesCompiledDlls);
            foreach (var file in compiledXRulesFiles)
            {
                Files.Copy(file, XRules_Config.PathTo_XRulesCompiledDlls);
            }


            var pathToAppDomainWithXRulesAssemblies = XRules_Config.PathTo_XRulesCompiledDlls;

            // special case where we don't need the O2_XRules_Database.dll file in the )CompiledDlls folder
            //  var xRulesDatabaseOriginalDll = System.IO.Path.Combine(pathToAppDomainWithXRulesAssemblies, "O2_XRules_Database.dll");
            //  if (System.IO.File.Exists(xRulesDatabaseOriginalDll))
            //      System.IO.File.Delete(xRulesDatabaseOriginalDll);

            var xRulesAssemblies = new List <string>();

            foreach (var originalDll in compiledXRulesFiles)
            {
                var dllInXRulesCompiledDllFolder = originalDll.Replace(System.IO.Path.GetDirectoryName(originalDll),
                                                                       pathToAppDomainWithXRulesAssemblies);
                xRulesAssemblies.Add(dllInXRulesCompiledDllFolder);
            }
            return(loadXRules(xRulesAssemblies, currentTask, numberOfStepsToPerform, onStepEvent));
        }
コード例 #7
0
        public static List <IXRule> loadXRules(List <string> xRulesAssemblies, O2Thread.FuncVoidT1 <string> currentTask, O2Thread.FuncVoidT1 <int> numberOfStepsToPerform, O2Thread.FuncVoid onStepEvent)
        {
            if (currentTask != null)
            {
                currentTask("Loading XRules");
            }

            var xRules = new List <IXRule>();

            foreach (var xRuleAssembly in xRulesAssemblies)
            {
                var assembly = PublicDI.reflection.getAssembly(xRuleAssembly);
                if (assembly != null)
                {
                    xRules.AddRange(createXRulesFromAssembly(assembly));
                }
                if (onStepEvent != null)
                {
                    onStepEvent();
                }
            }
            if (currentTask != null)
            {
                currentTask("XRules Loading Complete");
            }
            return(xRules);
        }
コード例 #8
0
 public static void compileXRules(O2Thread.FuncVoidT1 <List <IXRule> > onCompilation, O2Thread.FuncVoidT1 <string> currentTask, O2Thread.FuncVoidT1 <int> numberOfStepsToPerform, O2Thread.FuncVoid onStepEvent)
 {
     O2Thread.mtaThread(
         () =>
     {
         var xRules = compileXRules(currentTask, numberOfStepsToPerform, onStepEvent);
         onCompilation(xRules);
     });
 }
コード例 #9
0
 public static List <IXRule> getCompiledXRules(O2Thread.FuncVoidT1 <string> currentTask, O2Thread.FuncVoidT1 <int> numberOfStepsToPerform, O2Thread.FuncVoid onStepEvent)
 {
     if (XRules_Config.xRulesDatabase != null)
     {
         var xRulesAssemblies = Files.getFilesFromDir_returnFullPath(XRules_Config.PathTo_XRulesCompiledDlls, "*.dll");
         xRulesAssemblies.AddRange(Files.getFilesFromDir_returnFullPath(XRules_Config.PathTo_XRulesCompiledDlls, "*.exe"));
         return(loadXRules(xRulesAssemblies, currentTask, numberOfStepsToPerform, onStepEvent));
     }
     return(new List <IXRule>());
 }
コード例 #10
0
        public static List <String> compileAllFilesIndividually(List <String> filesToCompile, O2Thread.FuncVoidT1 <string> currentTask, O2Thread.FuncVoidT1 <int> numberOfStepsToPerform, O2Thread.FuncVoid onStepEvent)
        {
            currentTask("Compiling all rules individualy (one file at the time)");
            numberOfStepsToPerform(filesToCompile.Count);
            var compileEngine = new CompileEngine();

            PublicDI.log.info("Compiling All XRules source code files ONE at the time");
            var results = new List <String>();

            foreach (var fileToCompile in filesToCompile)
            {
                var assembly = compileEngine.compileSourceFile(fileToCompile);

                if (assembly != null)
                {
                    results.Add(assembly.Location);
                }
                else
                {
                    PublicDI.log.error("In XRules_Execution.compileAllFilesIndividually, could not compile file: {0}", fileToCompile);
                }
                onStepEvent();
            }
            return(results);
        }
コード例 #11
0
        public static List <String> getCompiledXRulesAssemblies(O2Thread.FuncVoidT1 <string> currentTask, O2Thread.FuncVoidT1 <int> numberOfStepsToPerform, O2Thread.FuncVoid onStepEvent)
        {
            currentTask("Compiling all rules together");
            numberOfStepsToPerform(1);
            // first try to scan all together
            var filesToCompile = Files.getFilesFromDir_returnFullPath(XRules_Config.PathTo_XRulesDatabase_fromO2, "*.cs", true);             // recursive search

            foreach (var xRuleFile in Files.getFilesFromDir_returnFullPath(XRules_Config.PathTo_XRulesDatabase_fromLocalDisk, "*.cs", true)) // recursive search
            {
                if (false == filesToCompile.Contains(xRuleFile))
                {
                    filesToCompile.Add(xRuleFile);
                }
            }
            PublicDI.log.info("There are {0} XRules to Compile", filesToCompile.Count);

            var compiledXRulesAssembly = compileAllFilesTogether(filesToCompile);

            onStepEvent();
            if (compiledXRulesAssembly != null)
            {
                return new List <String> {
                           compiledXRulesAssembly.Location
                }
            }
            ;

            // if we couldn't compile all at once, then compile each file individually
            PublicDI.log.error("It was not possible to compile all XRules together, going to try to compile each XRule file individually");
            //return compileAllFilesIndividually(filesToCompile,currentTask,numberOfStepsToPerform,onStepEvent);
            return(null);
        }
コード例 #12
0
        private static string populateDirectoryWithAllDependencies(List <String> compiledXRulesFiles, O2Thread.FuncVoid onStepEvent)
        {
            var targetDirectory = XRules_Config.PathTo_XRulesCompiledDlls;

            Files.deleteFilesFromDirThatMatchPattern(targetDirectory, "*.dll");
            foreach (var compiledFile in compiledXRulesFiles)
            {
                CecilAssemblyDependencies.populateDirectoryWithAllDependenciesOfAssembly(targetDirectory, compiledFile,
                                                                                         null);
                onStepEvent();
            }
            return(targetDirectory);
        }
コード例 #13
0
 public static void addControlToMenu(string menuItemName, O2Thread.FuncVoid onMenuItemClick)
 {
     DI.o2GuiWithDockPanel.addToLoadedO2ModulesMenu(menuItemName, onMenuItemClick);
 }
コード例 #14
0
 public static void addMenuItemWithOnClickEvent(string menuItemName, O2Thread.FuncVoid onMenuItemClick)
 {
 }