当前位置: 首页>>代码示例>>C#>>正文


C# OutputType.ToString方法代码示例

本文整理汇总了C#中OutputType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# OutputType.ToString方法的具体用法?C# OutputType.ToString怎么用?C# OutputType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OutputType的用法示例。


在下文中一共展示了OutputType.ToString方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OutputWatcher

		public OutputWatcher(OutputType type)
		{
			timer = new Timer();
			this._OutputType=type;
			timer.Enabled = true;
			timer.Interval = 100;
			if (_OutputType == OutputType.Console)
			{
				System.Console.SetOut(writer);
				System.Console.SetError(writer);
			} else if (_OutputType == OutputType.Debug) {
				//TODO
			} else {
				throw new ArgumentException("Cannot Find " + _OutputType.ToString() + "!");
			}
			timer.Tick += delegate(object sender, EventArgs e) { 
				if (Document.Text != writer.ToString())
				{
					Document.Text = writer.ToString();
					changed = true;
				}
			};
			
			Document = new Alsing.SourceCode.SyntaxDocument();
			changed = true;
		}
开发者ID:westybsa,项目名称:MP.LSharp,代码行数:26,代码来源:OutputWatcher.cs

示例2: GetKeylogger

        public static Keylogger GetKeylogger(OutputType logType)
        {
            switch (logType)
            {
                case OutputType.Console:
                    return new Keylogger(new ConsoleDataLogger());

                case OutputType.File:
                    return new Keylogger(new FileDataLogger());
            }

            throw new NotImplementedException($"Logging type of {logType.ToString("G")} is not supported.");
        }
开发者ID:Coderrob,项目名称:WindowsKeyLogger,代码行数:13,代码来源:KeyloggerFactory.cs

示例3: FindEntrySectionAndLoadSymbols

        /// <summary>
        /// Finds the entry section and loads the symbols from an array of intermediates.
        /// </summary>
        /// <param name="allowIdenticalRows">Flag specifying whether identical rows are allowed or not.</param>
        /// <param name="messageHandler">Message handler object to route all errors through.</param>
        /// <param name="expectedOutputType">Expected entry output type, based on output file extension provided to the linker.</param>
        /// <param name="entrySection">Located entry section.</param>
        /// <param name="allSymbols">Collection of symbols loaded.</param>
        internal void FindEntrySectionAndLoadSymbols(
            bool allowIdenticalRows,
            IMessageHandler messageHandler,
            OutputType expectedOutputType,
            out Section entrySection,
            out SymbolCollection allSymbols)
        {
            entrySection = null;
            allSymbols = new SymbolCollection();

            string outputExtension = Output.GetExtension(expectedOutputType);
            SectionType expectedEntrySectionType;
            try
            {
                expectedEntrySectionType = (SectionType)Enum.Parse(typeof(SectionType), expectedOutputType.ToString());
            }
            catch (ArgumentException)
            {
                expectedEntrySectionType = SectionType.Unknown;
            }

            foreach (Section section in this.collection.Keys)
            {
                if (SectionType.Product == section.Type || SectionType.Module == section.Type || SectionType.PatchCreation == section.Type || SectionType.Patch == section.Type || SectionType.Bundle == section.Type)
                {
                    if (SectionType.Unknown != expectedEntrySectionType && section.Type != expectedEntrySectionType)
                    {
                        messageHandler.OnMessage(WixWarnings.UnexpectedEntrySection(section.SourceLineNumbers, section.Type.ToString(), expectedEntrySectionType.ToString(), outputExtension));
                    }

                    if (null == entrySection)
                    {
                        entrySection = section;
                    }
                    else
                    {
                        messageHandler.OnMessage(WixErrors.MultipleEntrySections(entrySection.SourceLineNumbers, entrySection.Id, section.Id));
                        messageHandler.OnMessage(WixErrors.MultipleEntrySections2(section.SourceLineNumbers));
                    }
                }

                foreach (Symbol symbol in section.GetSymbols(messageHandler))
                {
                    try
                    {
                        Symbol existingSymbol = allSymbols[symbol.Name];
                        if (null == existingSymbol)
                        {
                            allSymbols.Add(symbol);
                        }
                        else if (allowIdenticalRows && existingSymbol.Row.IsIdentical(symbol.Row))
                        {
                            messageHandler.OnMessage(WixWarnings.IdenticalRowWarning(symbol.Row.SourceLineNumbers, existingSymbol.Name));
                            messageHandler.OnMessage(WixWarnings.IdenticalRowWarning2(existingSymbol.Row.SourceLineNumbers));
                        }
                        else
                        {
                            allSymbols.AddDuplicate(symbol);
                        }
                    }
                    catch (DuplicateSymbolsException)
                    {
                        // if there is already a duplicate symbol, just
                        // another to the list, don't bother trying to
                        // see if there are any identical symbols
                        allSymbols.AddDuplicate(symbol);
                    }
                }
            }
        }
开发者ID:bullshock29,项目名称:Wix3.6Toolset,代码行数:78,代码来源:SectionCollection.cs

示例4: Build

        static void Build(Project project, string path, OutputType type)
        {
            string oldCurrDir = Environment.CurrentDirectory;

            try
            {
                //System.Diagnostics.Debug.Assert(false);
                Compiler.TempFiles.Clear();
                string compiler = Utils.PathCombine(WixLocation, @"candle.exe");
                string linker = Utils.PathCombine(WixLocation, @"light.exe");

                if (!IO.File.Exists(compiler) || !IO.File.Exists(linker))
                {
                    Console.WriteLine("Wix binaries cannot be found. Expected location is " + IO.Path.GetDirectoryName(compiler));
                    throw new ApplicationException("Wix compiler/linker cannot be found");
                }
                else
                {
                    string wxsFile = BuildWxs(project, type);

                    if (autogeneratedWxsForVS != null)
                        CopyAsAutogen(wxsFile, autogeneratedWxsForVS);

                    if (!project.SourceBaseDir.IsEmpty())
                        Environment.CurrentDirectory = project.SourceBaseDir;

                    string objFile = IO.Path.ChangeExtension(wxsFile, ".wixobj");
                    string pdbFile = IO.Path.ChangeExtension(wxsFile, ".wixpdb");

                    string extensionDlls = "";
                    foreach (string dll in project.WixExtensions.Distinct())
                        extensionDlls += " -ext \"" + dll + "\"";

                    var candleOptions = CandleOptions + " " + project.CandleOptions;
                    var lightOptions = LightOptions + " " + project.LightOptions;

                    //AppDomain.CurrentDomain.ExecuteAssembly(compiler, null, new string[] { projFile }); //a bit unsafer version
                    Run(compiler, candleOptions + " " + extensionDlls + " \"" + wxsFile + "\" -out \"" + objFile + "\"");

                    if (IO.File.Exists(objFile))
                    {
                        string msiFile = IO.Path.ChangeExtension(wxsFile, "." + type.ToString().ToLower());
                        if (IO.File.Exists(msiFile))
                            IO.File.Delete(msiFile);

                        if (project.IsLocalized && IO.File.Exists(project.LocalizationFile))
                            Run(linker, lightOptions + " \"" + objFile + "\" -out \"" + msiFile + "\"" + extensionDlls + " -cultures:" + project.Language + " -loc \"" + project.LocalizationFile + "\"");
                        else
                            Run(linker, lightOptions + " \"" + objFile + "\" -out \"" + msiFile + "\"" + extensionDlls + " -cultures:" + project.Language);

                        if (IO.File.Exists(msiFile))
                        {
                            Compiler.TempFiles.Add(wxsFile);

                            Console.WriteLine("\n----------------------------------------------------------\n");
                            Console.WriteLine(type + " file has been built: " + path + "\n");
                            Console.WriteLine((type == OutputType.MSI ? " ProductName: " : " ModuleName: ") + project.Name);
                            Console.WriteLine(" Version    : " + project.Version);
                            Console.WriteLine(" ProductId  : {" + project.ProductId + "}");
                            Console.WriteLine(" UpgradeCode: {" + project.UpgradeCode + "}\n");
                            if (!project.AutoAssignedInstallDirPath.IsEmpty())
                            {
                                Console.WriteLine(" Auto-generated InstallDir ID:");
                                Console.WriteLine("   " + Compiler.AutoGeneration.InstallDirDefaultId + "=" + project.AutoAssignedInstallDirPath);
                            }
                            IO.File.Delete(objFile);
                            IO.File.Delete(pdbFile);

                            if (path != msiFile)
                            {
                                if (IO.File.Exists(path))
                                    IO.File.Delete(path);
                                IO.File.Move(msiFile, path);
                            }
                        }
                    }
                    else
                    {
                        Console.WriteLine("Cannot build " + wxsFile);
                        Trace.WriteLine("Cannot build " + wxsFile);
                    }
                }

                if (!PreserveTempFiles && !project.PreserveTempFiles)
                    foreach (var file in Compiler.TempFiles)
                        try
                        {
                            if (IO.File.Exists(file))
                                IO.File.Delete(file);
                        }
                        catch { }
            }
            finally
            {
                Environment.CurrentDirectory = oldCurrDir;
            }
        }
开发者ID:denis-peshkov,项目名称:WixSharp,代码行数:97,代码来源:Compiler.cs

示例5: WriteToOutput

        /// <summary>
        /// Writes the message to the console in the specified format / color
        /// </summary>
        /// <param name="message"></param>
        /// <param name="type"></param>
        private static void WriteToOutput(string message, OutputType type)
        {
            if (xmlLog == null)
            {
                var current = System.Console.ForegroundColor;
                switch (type)
                {
                    case OutputType.Debug:
                        System.Console.ForegroundColor = ConsoleColor.Gray;
                        break;

                    case OutputType.Info:
                        System.Console.ForegroundColor = ConsoleColor.Blue;
                        break;

                    case OutputType.Warning:
                        System.Console.ForegroundColor = ConsoleColor.Yellow;
                        break;

                    case OutputType.Error:
                        System.Console.ForegroundColor = ConsoleColor.Red;
                        break;
                }

                System.Console.WriteLine(message);
                System.Console.ForegroundColor = current;
            }
            else
            {
                xmlLog.WriteLine("<message type=\"" + type.ToString() + "\" time=\"" + DateTime.Now.ToString("r") + "\">");
                xmlLog.WriteLine("<![CDATA[" + message + "]]>");
                xmlLog.WriteLine("</message>");
            }
        }
开发者ID:kascomp,项目名称:CruiseControl.NET,代码行数:39,代码来源:Program.cs

示例6: Link

        public Output Link(SectionCollection sections, ArrayList transforms, OutputType expectedOutputType)
        {
            Output output = null;

            try
            {
                SymbolCollection allSymbols;
                Section entrySection;
                bool containsModuleSubstitution = false;
                bool containsModuleConfiguration = false;

                StringCollection referencedSymbols = new StringCollection();
                ArrayList unresolvedReferences = new ArrayList();

                ConnectToFeatureCollection componentsToFeatures = new ConnectToFeatureCollection();
                ConnectToFeatureCollection featuresToFeatures = new ConnectToFeatureCollection();
                ConnectToFeatureCollection modulesToFeatures = new ConnectToFeatureCollection();

                this.activeOutput = null;
                this.encounteredError = false;

                SortedList adminProperties = new SortedList();
                SortedList secureProperties = new SortedList();
                SortedList hiddenProperties = new SortedList();

                RowCollection actionRows = new RowCollection();
                RowCollection suppressActionRows = new RowCollection();

                TableDefinitionCollection customTableDefinitions = new TableDefinitionCollection();
                RowCollection customRows = new RowCollection();

                StringCollection generatedShortFileNameIdentifiers = new StringCollection();
                Hashtable generatedShortFileNames = new Hashtable();

                Hashtable multipleFeatureComponents = new Hashtable();

                Hashtable wixVariables = new Hashtable();

                // verify that modularization types match for foreign key relationships
                foreach (TableDefinition tableDefinition in this.tableDefinitions)
                {
                    foreach (ColumnDefinition columnDefinition in tableDefinition.Columns)
                    {
                        if (null != columnDefinition.KeyTable && 0 > columnDefinition.KeyTable.IndexOf(';') && columnDefinition.IsKeyColumnSet)
                        {
                            try
                            {
                                TableDefinition keyTableDefinition = this.tableDefinitions[columnDefinition.KeyTable];

                                if (0 >= columnDefinition.KeyColumn || keyTableDefinition.Columns.Count < columnDefinition.KeyColumn)
                                {
                                    this.OnMessage(WixErrors.InvalidKeyColumn(tableDefinition.Name, columnDefinition.Name, columnDefinition.KeyTable, columnDefinition.KeyColumn));
                                }
                                else if (keyTableDefinition.Columns[columnDefinition.KeyColumn - 1].ModularizeType != columnDefinition.ModularizeType && ColumnModularizeType.CompanionFile != columnDefinition.ModularizeType)
                                {
                                    this.OnMessage(WixErrors.CollidingModularizationTypes(tableDefinition.Name, columnDefinition.Name, columnDefinition.KeyTable, columnDefinition.KeyColumn, columnDefinition.ModularizeType.ToString(), keyTableDefinition.Columns[columnDefinition.KeyColumn - 1].ModularizeType.ToString()));
                                }
                            }
                            catch (WixMissingTableDefinitionException)
                            {
                                // ignore missing table definitions - this error is caught in other places
                            }
                        }
                    }
                }

                // add in the extension sections
                foreach (WixExtension extension in this.extensions)
                {
                    Library library = extension.GetLibrary(this.tableDefinitions);

                    if (null != library)
                    {
                        sections.AddRange(library.Sections);
                    }
                }

                // first find the entry section and create the symbols hash for all the sections
                sections.FindEntrySectionAndLoadSymbols(this.allowIdenticalRows, this, expectedOutputType, out entrySection, out allSymbols);

                // should have found an entry section by now
                if (null == entrySection)
                {
                    throw new WixException(WixErrors.MissingEntrySection(expectedOutputType.ToString()));
                }

                // add the missing standard action symbols
                this.LoadStandardActionSymbols(allSymbols);

                // now that we know where we're starting from, create the output object
                output = new Output(null);
                output.EntrySection = entrySection; // Note: this entry section will get added to the Output.Sections collection later
                if (null != this.localizer && -1 != this.localizer.Codepage)
                {
                    output.Codepage = this.localizer.Codepage;
                }
                this.activeOutput = output;

                // Resolve the symbol references to find the set of sections we
                // care about for linking.  Of course, we start with the entry
//.........这里部分代码省略.........
开发者ID:zooba,项目名称:wix3,代码行数:101,代码来源:Linker.cs

示例7: BuildCmd

        static void BuildCmd(Project project, string path, OutputType type)
        {
            //very important to keep "ClientAssembly = " in all "public Build*" methods to ensure GetCallingAssembly
            //returns the build script assembly but not just another method of Compiler.
            if (ClientAssembly.IsEmpty())
                ClientAssembly = System.Reflection.Assembly.GetCallingAssembly().Location;

            string compiler = Utils.PathCombine(WixLocation, "candle.exe");
            string linker = Utils.PathCombine(WixLocation, "light.exe");
            string batchFile = path;

            if (!IO.File.Exists(compiler) && !IO.File.Exists(linker))
            {
                Console.WriteLine("Wix binaries cannot be found. Expected location is " + IO.Path.GetDirectoryName(compiler));
                throw new ApplicationException("Wix compiler/linker cannot be found");
            }
            else
            {
                string wxsFile = BuildWxs(project, type);

                string extensionDlls, objFile;
                string outDir = IO.Path.GetDirectoryName(wxsFile);
                string msiFile = IO.Path.ChangeExtension(wxsFile, "." + type.ToString().ToLower());

                string candleCmd = GenerateCandleCommand(project, wxsFile, outDir, out objFile, out extensionDlls);
                string lightCmd = GenerateLightCommand(project, msiFile, outDir, objFile, extensionDlls);

                using (var sw = new IO.StreamWriter(batchFile))
                {
                    sw.WriteLine("\"" + compiler + "\" " + candleCmd);
                    sw.WriteLine("\"" + linker + "\" " + lightCmd);
                }
            }
        }
开发者ID:Eun,项目名称:WixSharp,代码行数:34,代码来源:Compiler.cs

示例8: Build

        static void Build(Project project, string path, OutputType type)
        {
            string oldCurrDir = Environment.CurrentDirectory;

            try
            {
                //System.Diagnostics.Debug.Assert(false);
                Compiler.TempFiles.Clear();
                string compiler = Utils.PathCombine(WixLocation, @"candle.exe");
                string linker = Utils.PathCombine(WixLocation, @"light.exe");

                if (!IO.File.Exists(compiler) || !IO.File.Exists(linker))
                {
                    Console.WriteLine("Wix binaries cannot be found. Expected location is " + IO.Path.GetDirectoryName(compiler));
                    throw new ApplicationException("Wix compiler/linker cannot be found");
                }
                else
                {
                    string wxsFile = BuildWxs(project, type);

                    if (autogeneratedWxsForVS != null)
                        CopyAsAutogen(wxsFile, autogeneratedWxsForVS);

                    if (!project.SourceBaseDir.IsEmpty())
                        Environment.CurrentDirectory = project.SourceBaseDir;

                    string extensionDlls, objFile;

                    string outDir = IO.Path.GetDirectoryName(wxsFile);

                    string candleCmd = GenerateCandleCommand(project, wxsFile, outDir, out objFile, out extensionDlls);

            #if DEBUG
                    Console.WriteLine("<- Compiling");
                    Console.WriteLine(compiler + " " + candleCmd);
                    Console.WriteLine("->");
            #endif

                    Run(compiler, candleCmd);

                    if (IO.File.Exists(objFile))
                    {
                        string msiFile = IO.Path.ChangeExtension(wxsFile, "." + type.ToString().ToLower());
                        if (IO.File.Exists(msiFile))
                            IO.File.Delete(msiFile);

                        string lightCmd = GenerateLightCommand(project, msiFile, outDir, objFile, extensionDlls);
            #if DEBUG
                        Console.WriteLine("<- Linking");
                        Console.WriteLine(linker + " " + lightCmd);
                        Console.WriteLine("->");
            #endif

                        Run(linker, lightCmd);

                        if (IO.File.Exists(msiFile))
                        {
                            Compiler.TempFiles.Add(wxsFile);

                            Console.WriteLine("\n----------------------------------------------------------\n");
                            Console.WriteLine(type + " file has been built: " + path + "\n");
                            Console.WriteLine((type == OutputType.MSI ? " ProductName: " : " ModuleName: ") + project.Name);
                            Console.WriteLine(" Version    : " + project.Version);
                            Console.WriteLine(" ProductId  : {" + project.ProductId + "}");
                            Console.WriteLine(" UpgradeCode: {" + project.UpgradeCode + "}\n");
                            if (!project.AutoAssignedInstallDirPath.IsEmpty())
                            {
                                Console.WriteLine(" Auto-generated InstallDir ID:");
                                Console.WriteLine("   " + Compiler.AutoGeneration.InstallDirDefaultId + "=" + project.AutoAssignedInstallDirPath);
                            }

                            IO.Directory.GetFiles(outDir, "*.wixobj")
                                        .ForEach(file => file.DeleteIfExists());

                            IO.Path.ChangeExtension(wxsFile, ".wixpdb").DeleteIfExists();

                            if (path != msiFile)
                            {
                                path.DeleteIfExists();
                                IO.File.Move(msiFile, path);
                            }
                        }
                    }
                    else
                    {
                        Console.WriteLine("Cannot build " + wxsFile);
                        Trace.WriteLine("Cannot build " + wxsFile);
                    }
                }

                if (!PreserveTempFiles && !project.PreserveTempFiles)
                    Compiler.TempFiles.ForEach(file => file.DeleteIfExists());
            }
            finally
            {
                Environment.CurrentDirectory = oldCurrDir;
            }
        }
开发者ID:Eun,项目名称:WixSharp,代码行数:98,代码来源:Compiler.cs

示例9: AssertOutputExists

        /// <summary>
        /// Assert that the output directory and output file exist.  If they do not exist then 
        /// an assertion exception is thrown.
        /// </summary>
        /// <param name="configuration"></param>
        /// <param name="output"></param>
        /// <param name="solutionName"></param>
        protected void AssertOutputExists (ConfigurationType configType, OutputType outputType, string solutionName) {
            string baseDir = Path.Combine(this.CurrentBaseDir.FullName, solutionName);
            string binDir = Path.Combine(baseDir, "bin");
            string outputDir = Path.Combine(binDir, configType.ToString());
            string outputFile = Path.Combine(outputDir, 
                String.Format("{0}.{1}", solutionName, outputType.ToString()));

            DirectoryInfo od = new DirectoryInfo(outputDir);
            FileInfo of = new FileInfo(outputFile);

            Assert.IsTrue(od.Exists, String.Format("Output directory does not exist: {0}.", od.FullName));
            Assert.IsTrue(of.Exists, String.Format("Output file does not exist: {0}.", of.FullName));
        }
开发者ID:RoastBoy,项目名称:nant,代码行数:20,代码来源:SolutionTestBase.cs

示例10: AssertOuputFile

 private static void AssertOuputFile(GeneralPropertyPage page, string expectedAssemblyName, OutputType outputType)
 {
     FieldInfo outputTypeInfo = typeof(GeneralPropertyPage).GetField("outputType", BindingFlags.NonPublic | BindingFlags.Instance);
     outputTypeInfo.SetValue(page, outputType);
     Assert.AreEqual<string>(outputType.ToString(), outputTypeInfo.GetValue(page).ToString());
     string expectedOutputFile = expectedAssemblyName + PythonProjectNode.GetOuputExtension(outputType);
     Assert.AreEqual<string>(expectedOutputFile, page.OutputFile);
 }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:8,代码来源:TestPropertyPages.cs


注:本文中的OutputType.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。