private MemoryStream Preprocess(String fileName) { FileInfo file = new FileInfo(fileName); // all Preprocessor instances share the same symbol definitions IDLPreprocessor preproc = new IDLPreprocessor(file); preproc.Process(); MemoryStream resultProc = preproc.GetProcessed(); // debug print, create a new memory stream to protect resultProc from beeing manipulated... MemoryStream forRead = new MemoryStream(); resultProc.WriteTo(forRead); forRead.Seek(0, SeekOrigin.Begin); Encoding latin1 = Encoding.GetEncoding("ISO-8859-1"); StreamReader stReader = new StreamReader(forRead, latin1); String line = ""; while (line != null) { Debug.WriteLine(line); line = stReader.ReadLine(); } stReader.Close(); // make sure, resultStream is at the beginning resultProc.Seek(0, SeekOrigin.Begin); return(resultProc); }
private void Setup(String[] args) { m_commandLine = new IDLToCLSCommandLine(args); if (m_commandLine.IsHelpRequested) { HowTo(); Environment.Exit(0); } if (m_commandLine.IsInvalid) { Error(m_commandLine.ErrorMessage); } // create output directory if (!Directory.Exists(m_commandLine.OutputDirectory.FullName)) { Directory.CreateDirectory(m_commandLine.OutputDirectory.FullName); } // process include dirs for (int i = 0; i < m_commandLine.IdlSourceDirectories.Count; i++) { IDLPreprocessor.SetIdlDir((DirectoryInfo)m_commandLine.IdlSourceDirectories[i]); } if (m_commandLine.BaseDirectory != null) { Environment.CurrentDirectory = m_commandLine.BaseDirectory.FullName; } // preprocessor defines for (int i = 0; i < m_commandLine.PreprocessorDefines.Count; i++) { IDLPreprocessor.AddDefine((string)m_commandLine.PreprocessorDefines[i]); } // vt-skeleton generation setup if (m_commandLine.GenerateValueTypeSkeletons && m_commandLine.ValueTypeSkeletonCodeDomProviderType != null) { m_vtSkelcodeDomProvider = (CodeDomProvider)Activator.CreateInstance( m_commandLine.ValueTypeSkeletonCodeDomProviderType); } SetupAssemblyResolver(); AddCustomMappings(m_commandLine.CustomMappingFiles); }