Exemple #1
0
        public void Write(string outputRootPath, CSolution solution)
        {
            _fileWriter.RootPath = outputRootPath;

            /*
             * var visitor = new CVisualStudioVisitor(_logger, codeWriter,
             *  new FastSolutionVisitor(new CodeWriter(), fileWriter),
             *  new CProjectVisitor(_logger, new CodeWriter(), fileWriter),
             *  new CProjectFileVisitor(_logger, fileWriter, codeWriter), new CSharpCInterfaceVisitor(codeWriter),
             *  new CSharpCClassVisitor(codeWriter), new CSharpCMethodVisitor(codeWriter),
             *  new CSharpCPropertyVisitor(codeWriter),
             *  new CSharpCParameterVisitor(codeWriter),
             *  new CSharpCFieldVisitor(codeWriter),
             *  new CSharpCConstructorVisitor(codeWriter),
             *  null,
             *  new CSharpCClassAttributeVisitor(codeWriter),
             *  new CSharpCMethodAttributeVisitor(codeWriter));
             */
            solution.Accept(_visualStudioVisitor);

            //now that the .proto files and .cmd have been written to disk
            //execute the .cmd to generate the .cs files

            foreach (var project in solution.Project)
            {
                foreach (var pc in project.ProjectContent)
                {
                    if (pc.Content is CBatchFile)
                    {
                        var batchFile = pc.Content as CBatchFile;
                        if (!batchFile.ExecutePostKickstart)
                        {
                            continue;
                        }
                        //todo: this probably won't run in Docker / Linux
                        var processStartInfo = new ProcessStartInfo();
                        processStartInfo.FileName         = pc.File.FileName;
                        processStartInfo.WorkingDirectory = pc.File.WrittenToPath;
                        processStartInfo.WindowStyle      = ProcessWindowStyle.Hidden;
                        processStartInfo.UseShellExecute  = true;
                        Process.Start(processStartInfo);

                        //todo: verify success
                    }
                }
            }
        }