Ejemplo n.º 1
0
 public static void Init(Assembly assembly, ProgramWrapper root, EventBus eventBus, List <IInjector> injectors)
 {
     Assembly  = assembly;
     Root      = root;
     EventBus  = eventBus;
     Injectors = injectors;
 }
Ejemplo n.º 2
0
        protected static string PerformFileConversion(ConversionArguments arguments)
        {
            var program = new ProgramWrapper(
                arguments.Source,
                arguments.AssemblyPath);

            return(program.Output);
        }
        protected override string GenerateOutput()
        {
            var program = new ProgramWrapper(this.assemblyPath);

            program.LogPath = new SysRegLogPathProvider().LogPath;

            return(program.Output);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Triggered on receiving a termination request. Clean up self, terminate all child process.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void OnProcessExit(object sender, EventArgs e)
        {
            LogMuxer.Instance.Info("Quitting");
            Wrapper?.Stop();

            // shut down all child processes
            foreach (var pid in ProgramWrapper.GetChildProcessIds(ProgramWrapper.SelfProcessId))
            {
                ProgramWrapper.QuitProcess(Process.GetProcessById(pid));
            }
        }
Ejemplo n.º 5
0
        protected static string PerformFileConversion(ConversionArguments arguments)
        {
            var program = new ProgramWrapper(
                arguments.Source,
                arguments.AssemblyPath)
            {
                LogPath = new SysRegLogPathProvider().LogPath
            };

            return(program.Output);
        }
Ejemplo n.º 6
0
        protected static string PerformFileConversion(ConversionArguments arguments)
        {
            var program = new ProgramWrapper(
                arguments.Source,
                arguments.AssemblyPath)
            {
#if Debug
                LogPath = @"C:\temp\Rosetta.log"
#endif
            };

            return(program.Output);
        }
Ejemplo n.º 7
0
        private void добавитьToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int    selectedRows     = dataGridView_Platforms.SelectedRows[0].Index;
            string idPlatformString = dataGridView_Platforms.Rows[selectedRows].Cells[0].Value.ToString();
            int    idPlatform       = int.Parse(idPlatformString);

            ProgramWrapper programWrapper = new ProgramWrapper();

            programWrapper.Name        = textBox_Name.Text;
            programWrapper.Site        = textBox_Suit.Text;
            programWrapper.PlatformsID = idPlatform;
            programWrapper.Add();

            DataGridViewSelectedRowCollection selectedRowsCategories   = dataGridView_Categories.SelectedRows;
            ProgramCategoriesWrapper          programCategoriesWrapper = new ProgramCategoriesWrapper();

            programCategoriesWrapper.Add(selectedRowsCategories);

            Close();
        }
Ejemplo n.º 8
0
        internal void Stop()
        {
            if (hasStopped)
            {
                return;
            }
            LogMuxer.Instance.Debug("Killing child processes");
            foreach (var wrapper in _programPool)
            {
                wrapper.Stop();
            }

            // First we notify all running process to quit
            LogMuxer.Instance.Debug("Killing subprocesses");
            foreach (var pid in ProgramWrapper.GetChildProcessIds(ProgramWrapper.SelfProcessId))
            {
                ProgramWrapper.QuitProcess(Process.GetProcessById(pid));
            }

            // ExecStop
            // only if the service started successfully
            if (hasStartedSuccessfully)
            {
                LogMuxer.Instance.Debug("Executing ExecStop");
                for (var i = 0; i < Globals.Config.ExecStop.Count; ++i)
                {
                    Run(Globals.Config.ExecStop[i], "ExecStop", i, isAsync: false);
                }
            }

            // ExecStopPost
            LogMuxer.Instance.Debug("Executing ExecStopPost");
            for (var i = 0; i < Globals.Config.ExecStopPost.Count; ++i)
            {
                Run(Globals.Config.ExecStopPost[i], "ExecStopPost", i, isAsync: false);
            }

            OnQuit?.Invoke(this, null);

            hasStopped = true;
        }
        private void InitializeStaticContext(InjectionFactoryContext ctx)
        {
            var assembly  = ctx.GetConcreteAssembly();
            var entry     = assembly.EntryPoint;
            var entryType = entry.DeclaringType;

            if (entryType == null)
            {
                throw new InvalidProgramException("Unable to find game enty type!");
            }

            var constructor = entryType.GetConstructor(new Type[0]);

            if (constructor == null)
            {
                throw new InvalidProgramException("Unable to find game entry constructor!");
            }

            var root = new ProgramWrapper(constructor.Invoke(new object[0]));

            StaticGameContext.Init(assembly, root, EventBus, ctx.Injectors);
        }
Ejemplo n.º 10
0
        protected virtual void ConvertAssembly()
        {
            var program = new ProgramWrapper(this.assemblyPath);

            program.LogPath = new SysRegLogPathProvider().LogPath;

            var output = program.Output;
            var info   = program.Info; // To display

            // Handling references
            output = this.GeneratePrependedText() + output;

            // Writing
            var outputPath = FileManager.GetAbsolutePath(this.outputFolder);

            if (!FileManager.IsDirectoryPathCorrect(outputPath))
            {
                throw new InvalidOperationException($"Folder '{outputPath}' does not exists!");
            }

            FileManager.WriteToFile(output, outputPath, $"{this.FileName}.{Extension}");

            Console.WriteLine($"Definition generated from assembly: {info}.");
        }
Ejemplo n.º 11
0
 public static void ClassInitialize(TestContext _)
 {
     ProgramWrapper = new ProgramWrapper(
         (args) =>
         Task.Run(() => Program.Main(args)));
 }
Ejemplo n.º 12
0
 static public void ClassInitialize(TestContext _)
 {
     ProgramWrapper = new ProgramWrapper(
         (string[] args) => Program.Main(args));
 }