Exemplo n.º 1
0
        public void Generate(int countProcess, GenerateInput input, string appPath, int tryCount = 60, int waitMiliSeconds = 2000)
        {
            var oldCountProcess = countProcess;
            var getMcnpLnPath = input.AutoResParentPath;
            var inputFiles = Directory.GetFiles(input.InputParentPath);
            var vboApp = new FileInfo(appPath);

            Directory.CreateDirectory(getMcnpLnPath);

            var processInfo = new ProcessStartInfo()
            {
                FileName = vboApp.Name,
                WorkingDirectory = vboApp.Directory.FullName
            };

            var listOfProcess = new List<Process>();

            var rangeOfFiles = inputFiles.Length;

            for (int j = 0; j < rangeOfFiles; j++)
            {
                processInfo.Arguments = "\"" + inputFiles[j] + "\"";
                listOfProcess.Add(Process.Start(processInfo));
                Thread.Sleep(2000);

                if ((j + 1) == countProcess)
                {
                    while (Directory.GetDirectories(getMcnpLnPath).Length != countProcess)
                    {
                        Thread.Sleep(waitMiliSeconds);
                    }
                    while (!File.Exists(Path.Combine(Directory.GetDirectories(getMcnpLnPath)[j], "mcnpIn")))
                    {
                        Thread.Sleep(waitMiliSeconds);
                    }
                    for (int i = j; i >= j + 1 - oldCountProcess; i--)
                    {
                        listOfProcess[i].Kill();
                    }
                    countProcess += oldCountProcess;
                }
            }
        }
Exemplo n.º 2
0
        private static void Main(string[] args)
        {
            var genInp = new GenerateInput();
            var runVboApp = new RunVboApp();

            Console.WriteLine("Enter full path to standart input file:");
            var fullPathInput = Console.ReadLine();

            Console.WriteLine("Enter full path to folder wich contains generated folders with dat files:");
            var fullPathDataFolder = Console.ReadLine();

            Console.WriteLine("Enter number of parallel start process:");
            var processNumber = int.Parse(Console.ReadLine());

            Console.WriteLine("VBO path:");
            var vbo = Console.ReadLine();

            if (genInp.Generate(fullPathInput, fullPathDataFolder))
            runVboApp.Generate(processNumber, genInp, vbo);
        }