public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append(Type.ToString()); if (!Type.ToString().Equals(name)) { sb.Append(": "); sb.Append(name); } if (Children.Count != 0) { sb.Append("("); for (int i = 0; i < Children.Count; i++) { if (i != 0) { sb.Append(", "); } sb.Append(Children[i].ToString()); } sb.Append(")"); } return(sb.ToString()); }
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; }
internal static void Save() { IniFile ini = new IniFile(configpath); ini.Write("请勿编辑此文件", "Don't Edit This File", "请勿编辑此文件"); ini.Write("songVol", songVol.ToString()); ini.Write("needLyric", needLyric.ToString()); ini.Write("maxSongCount", maxSongCount.ToString()); ini.Write("outputUpdateTime", outputUpdateTime.ToString()); ini.Write("OutputType", OutputType.ToString()); ini.Write("CanMultiSong", CanMultiSong.ToString()); ini.Write("AdminOnly", AdminOnly.ToString()); ini.Write("MaxPlaySecond", MaxPlaySecond.ToString()); ini.Write("VoteNext", VoteNext.ToString()); ini.Write("LogStayTime", LogStayTime.ToString()); ini.Write("ControlOtherPlayer", ControlOtherPlayer.ToString()); ini.Write("OneLyric", OneLyric.ToString()); ini.Write("DanmakuControl", DanmakuControl.ToString()); ini.Write("OutputEmptyList", OutputEmptyList); ini.Write("OutputOtherNamePrefix", OutputOtherNamePrefix); ini.Write("moduleA", R_ModuleNameA); // 保存当前选择的搜索模块的名字 ini.Write("moduleB", R_ModuleNameB); OPT_Save(); BLK_Save(); }
void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); if (Optional.IsDefined(Name)) { writer.WritePropertyName("name"); writer.WriteStringValue(Name); } if (Optional.IsDefined(ExecutionCount)) { writer.WritePropertyName("execution_count"); writer.WriteNumberValue(ExecutionCount.Value); } writer.WritePropertyName("output_type"); writer.WriteStringValue(OutputType.ToString()); if (Optional.IsDefined(Text)) { writer.WritePropertyName("text"); writer.WriteObjectValue(Text); } if (Optional.IsDefined(Data)) { writer.WritePropertyName("data"); writer.WriteObjectValue(Data); } if (Optional.IsDefined(Metadata)) { writer.WritePropertyName("metadata"); writer.WriteObjectValue(Metadata); } writer.WriteEndObject(); }
/// <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>"); } }
internal override IEnumerable <KeyValuePair <string, string> > GetQueryParameters() { yield return(new KeyValuePair <string, string>("outputType", OutputType.ToString().ToLowerInvariant())); yield return(new KeyValuePair <string, string>("outputAudio", OutputAudio.ToString().ToLowerInvariant())); yield return(new KeyValuePair <string, string>("fadeInFadeOut", FadeInFadeOut.ToString().ToLowerInvariant())); yield return(new KeyValuePair <string, string>("maxMotionThumbnailDurationInSecs", MaxMotionThumbnailDurationInSecs.ToString(CultureInfo.InvariantCulture))); }
protected string GetOutputPath(string name, OutputType type) { var folder = string.Format("../../{0}/{1}", Folder, FolderOut); if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } return(Path.Combine(folder, name + "." + type.ToString().ToLower())); }
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); }
public static JObject CreateJObject(string name, string id, string description, OutputType type) { var obj = new JObject(); obj["ID"] = id; obj["Name"] = name; obj["Description"] = description; obj["Type"] = type.ToString(); return(obj); }
/// <summary> /// writes without final linebreak /// </summary> /// <param name="oType"></param> /// <param name="message"></param> /// <param name="args"></param> public void WriteStart(OutputType oType, string message, params object[] args) { if (oType == OutputType.Debug && !Debug) { return; } string msg = null; if (oType.ToString().ToLower().Contains("none")) { msg = message; } else { msg = string.Format("[{0}{1}] {2}", oType.ToString(), new string(' ', MaxOutputType - oType.ToString().Length), message); } WriteNext(oType, msg, args); }
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."); }
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."); }
public JObject Save() { var obj = new JObject(); obj["ID"] = ID; obj["Name"] = Name; obj["Description"] = Description; obj["Type"] = type.ToString(); if (output != null) { obj["Details"] = output.Save(); } return(obj); }
/// <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)); }
private string GetOutputString(DateTime date, OutputPrice outputPrice, OutputType outputType) { if (outputType == OutputType.Card) { return ($"{date.ToShortDateString()},{outputPrice.Service},{outputPrice.UnitPrice},,{outputType.ToString()}"); } if (outputType == OutputType.Cash) { return ($"{date.ToShortDateString()},{outputPrice.Service},,{outputPrice.UnitPrice},{outputType.ToString()}"); } throw new Exception($"OutputType: {outputType.ToString()} does not exist."); }
public virtual void ParseCode() { var sb = new StringBuilder(); sb.Append("public " + OutputType.ToString() + " func("); if (Arguments.Any()) { sb.Append(Arguments.Select(e => e.InputType.ToString() + " " + e.Name).Aggregate((e, f) => $"{e},{f}")); } sb.AppendLine(); sb.Append("{"); sb.Append(Code); sb.Append("}"); FullCode = sb.ToString(); }
public override string ToString() { string newline = "\r\n\t\t"; string str = "Name:" + Name + newline + "Enabled:" + Enabled + newline + "OutputType:" + OutputType.ToString() + newline + "TemplateFileName:" + TemplateFileName + newline + "OutputDirectory:" + OutputDirectory + newline + "FileNameFormat:" + FileNameFormat + newline + "OutputFileExtension:" + OutputFileExtension + newline + "Encoding:" + Encoding + newline + "Append:" + Append + newline ; return(str); }
/// <summary> /// Unbind a Windows Installer file. /// </summary> /// <param name="file">The Windows Installer file.</param> /// <param name="outputType">The type of output to create.</param> /// <param name="exportBasePath">The path where files should be exported.</param> /// <returns>The output representing the database.</returns> public Intermediate Unbind(string file, OutputType outputType, string exportBasePath) { if (!File.Exists(file)) { if (OutputType.Transform == outputType) { throw new WixException(ErrorMessages.FileNotFound(null, file, "Transform")); } else { throw new WixException(ErrorMessages.FileNotFound(null, file, "Database")); } } // if we don't have the temporary files object yet, get one Directory.CreateDirectory(this.TempFilesLocation); // ensure the base path is there var context = new UnbindContext(); context.InputFilePath = file; context.ExportBasePath = exportBasePath; context.IntermediateFolder = this.TempFilesLocation; context.IsAdminImage = this.IsAdminImage; context.SuppressDemodularization = this.SuppressDemodularization; context.SuppressExtractCabinets = this.SuppressExtractCabinets; foreach (var factory in this.BackendFactories) { if (factory.TryCreateBackend(outputType.ToString(), file, out var backend)) { return(backend.Unbind(context)); } } // TODO: Display message that could not find a unbinder for output type? return(null); }
/// <summary> /// Apply Changes on project node. /// </summary> /// <returns>E_INVALIDARG if internal ProjectMgr is null, otherwise applies changes and return S_OK.</returns> protected override int ApplyChanges() { if (ProjectMgr == null) { return(VSConstants.E_INVALIDARG); } var propertyPageFrame = (IVsPropertyPageFrame)ProjectMgr.Site.GetService((typeof(SVsPropertyPageFrame))); bool reloadRequired = ProjectMgr.TargetFrameworkMoniker != targetFrameworkMoniker; ProjectMgr.SetProjectProperty("AssemblyName", assemblyName); ProjectMgr.SetProjectProperty("OutputType", outputType.ToString()); ProjectMgr.SetProjectProperty("RootNamespace", defaultNamespace); ProjectMgr.SetProjectProperty("StartupObject", startupObject); ProjectMgr.SetProjectProperty("ApplicationIcon", applicationIcon); ProjectMgr.SetProjectProperty("AllowUnsafeBlocks", allowUnsafe.ToString()); ProjectMgr.SetProjectProperty("Ducky", useDuckTyping.ToString()); if (reloadRequired) { if (MessageBox.Show(SR.GetString(SR.ReloadPromptOnTargetFxChanged), SR.GetString(SR.ReloadPromptOnTargetFxChangedCaption), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { ProjectMgr.TargetFrameworkMoniker = targetFrameworkMoniker; } } IsDirty = false; if (reloadRequired) { // This prevents the property page from displaying bad data from the zombied (unloaded) project propertyPageFrame.HideFrame(); propertyPageFrame.ShowFrame(GetType().GUID); } return(VSConstants.S_OK); }
// 0 date // 1 type // 2 source // 3 msg // 4 obj type // 5 obj public string ToString() { string resultline = _DT.ToString(); resultline += ";" + _LogType.ToString(); resultline += ";" + _Source; resultline += ";" + _Message; switch (_LogType) { case OutputType.console: break; case OutputType.error: resultline += ";" + _ObjectType; resultline += ";" + Convert.ToBase64String(tobytes(_Data)); break; case OutputType.log: break; case OutputType.messagebox: break; case OutputType.warning: break; default: break; } return(resultline); }
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 // section (that's how it got its name after all). output.Sections.AddRange(output.EntrySection.ResolveReferences(output.Type, allSymbols, referencedSymbols, unresolvedReferences, this)); // Flattening the complex references that participate in groups. this.FlattenSectionsComplexReferences(output.Sections); if (this.encounteredError) { return null; } // The hard part in linking is processing the complex references. this.ProcessComplexReferences(output, output.Sections, referencedSymbols, componentsToFeatures, featuresToFeatures, modulesToFeatures); for (int i = 0; i < unresolvedReferences.Count; ++i) { Section.SimpleReferenceSection referenceSection = (Section.SimpleReferenceSection)unresolvedReferences[i]; if (this.allowUnresolvedReferences) { this.OnMessage(WixWarnings.UnresolvedReferenceWarning(referenceSection.WixSimpleReferenceRow.SourceLineNumbers, referenceSection.Section.Type.ToString(), referenceSection.Section.Id, referenceSection.WixSimpleReferenceRow.SymbolicName)); } else { this.OnMessage(WixErrors.UnresolvedReference(referenceSection.WixSimpleReferenceRow.SourceLineNumbers, referenceSection.Section.Type.ToString(), referenceSection.Section.Id, referenceSection.WixSimpleReferenceRow.SymbolicName)); } } if (this.encounteredError) { return null; } SymbolCollection unreferencedSymbols = output.Sections.GetOrphanedSymbols(referencedSymbols, this); // Display a warning message for Components that were never referenced by a Feature. foreach (Symbol symbol in unreferencedSymbols) { if ("Component" == symbol.Row.Table.Name) { this.OnMessage(WixErrors.OrphanedComponent(symbol.Row.SourceLineNumbers, (string)symbol.Row[0])); } } Dictionary<string, List<Symbol>> duplicatedSymbols = output.Sections.GetDuplicateSymbols(this); // Display a warning message for Components that were never referenced by a Feature. foreach (List<Symbol> duplicatedSymbolList in duplicatedSymbols.Values) { Symbol symbol = duplicatedSymbolList[0]; // Certain tables allow duplicates because they allow overrides. if (symbol.Row.Table.Name != "WixAction" && symbol.Row.Table.Name != "WixVariable") { this.OnMessage(WixErrors.DuplicateSymbol(symbol.Row.SourceLineNumbers, symbol.Name)); for (int i = 1; i < duplicatedSymbolList.Count; i++) { Symbol duplicateSymbol = duplicatedSymbolList[i]; this.OnMessage(WixErrors.DuplicateSymbol2(duplicateSymbol.Row.SourceLineNumbers)); } } } if (this.encounteredError) { return null; } if (null != this.unreferencedSymbolsFile) { sections.GetOrphanedSymbols(referencedSymbols, this).OutputSymbols(this.unreferencedSymbolsFile); } // resolve the feature to feature connects this.ResolveFeatureToFeatureConnects(featuresToFeatures, allSymbols); // start generating OutputTables and OutputRows for all the sections in the output RowCollection ensureTableRows = new RowCollection(); int sectionCount = 0; foreach (Section section in output.Sections) { sectionCount++; string sectionId = section.Id; if (null == sectionId && this.sectionIdOnRows) { sectionId = "wix.section." + sectionCount.ToString(CultureInfo.InvariantCulture); } foreach (Table table in section.Tables) { // By default, copy rows unless we've been asked to drop unreal tables from // the output and it's an unreal table and *not* a UX Manifest table. bool copyRows = true; if (this.dropUnrealTables && table.Definition.IsUnreal && !table.Definition.IsBootstrapperApplicationData) { copyRows = false; } // handle special tables switch (table.Name) { case "AppSearch": this.activeOutput.EnsureTable(this.tableDefinitions["Signature"]); break; case "Class": if (OutputType.Product == output.Type) { this.ResolveFeatures(table.Rows, 2, 11, componentsToFeatures, multipleFeatureComponents); } break; case "ChainPackage": case "ChainPackageGroup": case "MsiProperty": copyRows = true; break; case "CustomAction": if (OutputType.Module == this.activeOutput.Type) { this.activeOutput.EnsureTable(this.tableDefinitions["AdminExecuteSequence"]); this.activeOutput.EnsureTable(this.tableDefinitions["AdminUISequence"]); this.activeOutput.EnsureTable(this.tableDefinitions["AdvtExecuteSequence"]); this.activeOutput.EnsureTable(this.tableDefinitions["InstallExecuteSequence"]); this.activeOutput.EnsureTable(this.tableDefinitions["InstallUISequence"]); } foreach (Row row in table.Rows) { // For script CAs that specify HideTarget we should also hide the CA data property for the action. int bits = Convert.ToInt32(row[1]); if (MsiInterop.MsidbCustomActionTypeHideTarget == (bits & MsiInterop.MsidbCustomActionTypeHideTarget) && MsiInterop.MsidbCustomActionTypeInScript == (bits & MsiInterop.MsidbCustomActionTypeInScript)) { hiddenProperties[Convert.ToString(row[0])] = null; } } break; case "Dialog": this.activeOutput.EnsureTable(this.tableDefinitions["ListBox"]); break; case "Directory": foreach (Row row in table.Rows) { if (OutputType.Module == this.activeOutput.Type) { string directory = row[0].ToString(); if (Util.IsStandardDirectory(directory)) { // if the directory table contains references to standard windows folders // mergemod.dll will add customactions to set the MSM directory to // the same directory as the standard windows folder and will add references to // custom action to all the standard sequence tables. A problem will occur // if the MSI does not have these tables as mergemod.dll does not add these // tables to the MSI if absent. This code adds the tables in case mergemod.dll // needs them. this.activeOutput.EnsureTable(this.tableDefinitions["CustomAction"]); this.activeOutput.EnsureTable(this.tableDefinitions["AdminExecuteSequence"]); this.activeOutput.EnsureTable(this.tableDefinitions["AdminUISequence"]); this.activeOutput.EnsureTable(this.tableDefinitions["AdvtExecuteSequence"]); this.activeOutput.EnsureTable(this.tableDefinitions["InstallExecuteSequence"]); this.activeOutput.EnsureTable(this.tableDefinitions["InstallUISequence"]); } else { foreach (string standardDirectory in Util.StandardDirectories.Keys) { if (directory.StartsWith(standardDirectory, StringComparison.Ordinal)) { this.OnMessage(WixWarnings.StandardDirectoryConflictInMergeModule(row.SourceLineNumbers, directory, standardDirectory)); } } } } } break; case "Extension": if (OutputType.Product == output.Type) { this.ResolveFeatures(table.Rows, 1, 4, componentsToFeatures, multipleFeatureComponents); } break; case "ModuleSubstitution": containsModuleSubstitution = true; break; case "ModuleConfiguration": containsModuleConfiguration = true; break; case "MsiAssembly": if (this.suppressMsiAssemblyTable) { copyRows = false; } else if (OutputType.Product == output.Type) { this.ResolveFeatures(table.Rows, 0, 1, componentsToFeatures, multipleFeatureComponents); } break; case "ProgId": // the Extension table is required with a ProgId table this.activeOutput.EnsureTable(this.tableDefinitions["Extension"]); break; case "Property": for (int i = 0; i < table.Rows.Count; i++) { if (null == table.Rows[i][1]) { table.Rows.RemoveAt(i); i--; } } break; case "PublishComponent": if (OutputType.Product == output.Type) { this.ResolveFeatures(table.Rows, 2, 4, componentsToFeatures, multipleFeatureComponents); } break; case "Shortcut": if (OutputType.Product == output.Type) { this.ResolveFeatures(table.Rows, 3, 4, componentsToFeatures, multipleFeatureComponents); } break; case "TypeLib": if (OutputType.Product == output.Type) { this.ResolveFeatures(table.Rows, 2, 6, componentsToFeatures, multipleFeatureComponents); } break; case "Upgrade": foreach (UpgradeRow row in table.Rows) { secureProperties[row.ActionProperty] = null; } break; case "Variable": copyRows = true; break; case "WixAction": if (this.sectionIdOnRows) { foreach (Row row in table.Rows) { row.SectionId = sectionId; } } actionRows.AddRange(table.Rows); break; case "WixBBControl": case "WixControl": copyRows = true; break; case "WixCustomTable": this.LinkCustomTable(table, customTableDefinitions); copyRows = false; // we've created table definitions from these rows, no need to process them any longer break; case "WixCustomRow": foreach (Row row in table.Rows) { row.SectionId = (this.sectionIdOnRows ? sectionId : null); customRows.Add(row); } copyRows = false; break; case "WixEnsureTable": ensureTableRows.AddRange(table.Rows); break; case "WixFile": foreach (Row row in table.Rows) { // DiskId is not valid when creating a module, so set it to // 0 for all files to ensure proper sorting in the binder if (OutputType.Module == this.activeOutput.Type) { row[5] = 0; } // if the short file name was generated, check for collisions if (0x1 == (int)row[9]) { generatedShortFileNameIdentifiers.Add((string)row[0]); } } copyRows = true; break; case "WixFragment": copyRows = true; break; case "WixGroup": copyRows = true; break; case "WixInstanceTransforms": copyRows = true; break; case "WixMedia": copyRows = true; break; case "WixMerge": if (OutputType.Product == output.Type) { this.ResolveFeatures(table.Rows, 0, 7, modulesToFeatures, null); } copyRows = true; break; case "WixOrdering": copyRows = true; break; case "WixProperty": foreach (WixPropertyRow wixPropertyRow in table.Rows) { if (wixPropertyRow.Admin) { adminProperties[wixPropertyRow.Id] = null; } if (wixPropertyRow.Hidden) { hiddenProperties[wixPropertyRow.Id] = null; } if (wixPropertyRow.Secure) { secureProperties[wixPropertyRow.Id] = null; } } break; case "WixSuppressAction": suppressActionRows.AddRange(table.Rows); break; case "WixSuppressModularization": // just copy the rows to the output copyRows = true; break; case "WixVariable": // check for colliding values and collect the wix variable rows foreach (WixVariableRow row in table.Rows) { WixVariableRow collidingRow = (WixVariableRow)wixVariables[row.Id]; if (null == collidingRow || (collidingRow.Overridable && !row.Overridable)) { wixVariables[row.Id] = row; } else if (!row.Overridable || (collidingRow.Overridable && row.Overridable)) { this.OnMessage(WixErrors.WixVariableCollision(row.SourceLineNumbers, row.Id)); } } copyRows = false; break; case "WixPatchRef": case "WixPatchBaseline": case "WixPatchId": copyRows = true; break; } if (copyRows) { Table outputTable = this.activeOutput.EnsureTable(this.tableDefinitions[table.Name]); this.CopyTableRowsToOutputTable(table, outputTable, sectionId); } } } // Verify that there were no duplicate fragment Id's. Table wixFragmentTable = this.activeOutput.Tables["WixFragment"]; Hashtable fragmentIdIndex = new Hashtable(); if (null != wixFragmentTable) { foreach (Row row in wixFragmentTable.Rows) { string fragmentId = row.Fields[0].Data.ToString(); if (!fragmentIdIndex.ContainsKey(fragmentId)) { fragmentIdIndex.Add(fragmentId, row.SourceLineNumbers); } else { this.OnMessage(WixErrors.DuplicateSymbol(row.SourceLineNumbers, fragmentId)); if (null != fragmentIdIndex[fragmentId]) { this.OnMessage(WixErrors.DuplicateSymbol2((SourceLineNumberCollection)fragmentIdIndex[fragmentId])); } } } } // copy the module to feature connections into the output if (0 < modulesToFeatures.Count) { Table wixFeatureModulesTable = this.activeOutput.EnsureTable(this.tableDefinitions["WixFeatureModules"]); foreach (ConnectToFeature connectToFeature in modulesToFeatures) { foreach (string feature in connectToFeature.ConnectFeatures) { Row row = wixFeatureModulesTable.CreateRow(null); row[0] = feature; row[1] = connectToFeature.ChildId; } } } // ensure the creation of tables that need to exist if (0 < ensureTableRows.Count) { foreach (Row row in ensureTableRows) { string tableId = (string)row[0]; TableDefinition tableDef = null; try { tableDef = this.tableDefinitions[tableId]; } catch (WixMissingTableDefinitionException) { tableDef = customTableDefinitions[tableId]; } this.activeOutput.EnsureTable(tableDef); } } // copy all the suppress action rows to the output to suppress actions from merge modules if (0 < suppressActionRows.Count) { Table suppressActionTable = this.activeOutput.EnsureTable(this.tableDefinitions["WixSuppressAction"]); suppressActionTable.Rows.AddRange(suppressActionRows); } // sequence all the actions this.SequenceActions(actionRows, suppressActionRows); // check for missing table and add them or display an error as appropriate switch (this.activeOutput.Type) { case OutputType.Module: this.activeOutput.EnsureTable(this.tableDefinitions["Component"]); this.activeOutput.EnsureTable(this.tableDefinitions["Directory"]); this.activeOutput.EnsureTable(this.tableDefinitions["FeatureComponents"]); this.activeOutput.EnsureTable(this.tableDefinitions["File"]); this.activeOutput.EnsureTable(this.tableDefinitions["ModuleComponents"]); this.activeOutput.EnsureTable(this.tableDefinitions["ModuleSignature"]); break; case OutputType.PatchCreation: Table imageFamiliesTable = this.activeOutput.Tables["ImageFamilies"]; Table targetImagesTable = this.activeOutput.Tables["TargetImages"]; Table upgradedImagesTable = this.activeOutput.Tables["UpgradedImages"]; if (null == imageFamiliesTable || 1 > imageFamiliesTable.Rows.Count) { this.OnMessage(WixErrors.ExpectedRowInPatchCreationPackage("ImageFamilies")); } if (null == targetImagesTable || 1 > targetImagesTable.Rows.Count) { this.OnMessage(WixErrors.ExpectedRowInPatchCreationPackage("TargetImages")); } if (null == upgradedImagesTable || 1 > upgradedImagesTable.Rows.Count) { this.OnMessage(WixErrors.ExpectedRowInPatchCreationPackage("UpgradedImages")); } this.activeOutput.EnsureTable(this.tableDefinitions["Properties"]); break; case OutputType.Product: this.activeOutput.EnsureTable(this.tableDefinitions["File"]); this.activeOutput.EnsureTable(this.tableDefinitions["Media"]); break; } this.CheckForIllegalTables(this.activeOutput); // add the custom row data foreach (Row row in customRows) { TableDefinition customTableDefinition = (TableDefinition)customTableDefinitions[row[0].ToString()]; Table customTable = this.activeOutput.EnsureTable(customTableDefinition); Row customRow = customTable.CreateRow(row.SourceLineNumbers); customRow.SectionId = row.SectionId; string[] data = row[1].ToString().Split(Common.CustomRowFieldSeparator); for (int i = 0; i < data.Length; ++i) { bool foundColumn = false; string[] item = data[i].Split(colonCharacter, 2); for (int j = 0; j < customRow.Fields.Length; ++j) { if (customRow.Fields[j].Column.Name == item[0]) { if (0 < item[1].Length) { if (ColumnType.Number == customRow.Fields[j].Column.Type) { try { customRow.Fields[j].Data = Convert.ToInt32(item[1], CultureInfo.InvariantCulture); } catch (FormatException) { this.OnMessage(WixErrors.IllegalIntegerValue(row.SourceLineNumbers, customTableDefinition.Columns[i].Name, customTableDefinition.Name, item[1])); } catch (OverflowException) { this.OnMessage(WixErrors.IllegalIntegerValue(row.SourceLineNumbers, customTableDefinition.Columns[i].Name, customTableDefinition.Name, item[1])); } } else if (ColumnCategory.Identifier == customRow.Fields[j].Column.Category) { if (CompilerCore.IsIdentifier(item[1]) || Common.IsValidBinderVariable(item[1]) || ColumnCategory.Formatted == customRow.Fields[j].Column.Category) { customRow.Fields[j].Data = item[1]; } else { this.OnMessage(WixErrors.IllegalIdentifier(row.SourceLineNumbers, "Data", item[1])); } } else { customRow.Fields[j].Data = item[1]; } } foundColumn = true; break; } } if (!foundColumn) { this.OnMessage(WixErrors.UnexpectedCustomTableColumn(row.SourceLineNumbers, item[0])); } } for (int i = 0; i < customTableDefinition.Columns.Count; ++i) { if (!customTableDefinition.Columns[i].IsNullable && (null == customRow.Fields[i].Data || 0 == customRow.Fields[i].Data.ToString().Length)) { this.OnMessage(WixErrors.NoDataForColumn(row.SourceLineNumbers, customTableDefinition.Columns[i].Name, customTableDefinition.Name)); } } } //correct the section Id in FeatureComponents table if (this.sectionIdOnRows) { Hashtable componentSectionIds = new Hashtable(); Table componentTable = output.Tables["Component"]; if (null != componentTable) { foreach (Row componentRow in componentTable.Rows) { componentSectionIds.Add(componentRow.Fields[0].Data.ToString(), componentRow.SectionId); } } Table featureComponentsTable = output.Tables["FeatureComponents"]; if (null != featureComponentsTable) { foreach (Row featureComponentsRow in featureComponentsTable.Rows) { if (componentSectionIds.Contains(featureComponentsRow.Fields[1].Data.ToString())) { featureComponentsRow.SectionId = (string)componentSectionIds[featureComponentsRow.Fields[1].Data.ToString()]; } } } } // update the special properties if (0 < adminProperties.Count) { Table propertyTable = this.activeOutput.EnsureTable(this.tableDefinitions["Property"]); Row row = propertyTable.CreateRow(null); row[0] = "AdminProperties"; row[1] = GetPropertyListString(adminProperties); } if (0 < secureProperties.Count) { Table propertyTable = this.activeOutput.EnsureTable(this.tableDefinitions["Property"]); Row row = propertyTable.CreateRow(null); row[0] = "SecureCustomProperties"; row[1] = GetPropertyListString(secureProperties); } if (0 < hiddenProperties.Count) { Table propertyTable = this.activeOutput.EnsureTable(this.tableDefinitions["Property"]); Row row = propertyTable.CreateRow(null); row[0] = "MsiHiddenProperties"; row[1] = GetPropertyListString(hiddenProperties); } // add the ModuleSubstitution table to the ModuleIgnoreTable if (containsModuleSubstitution) { Table moduleIgnoreTableTable = this.activeOutput.EnsureTable(this.tableDefinitions["ModuleIgnoreTable"]); Row moduleIgnoreTableRow = moduleIgnoreTableTable.CreateRow(null); moduleIgnoreTableRow[0] = "ModuleSubstitution"; } // add the ModuleConfiguration table to the ModuleIgnoreTable if (containsModuleConfiguration) { Table moduleIgnoreTableTable = this.activeOutput.EnsureTable(this.tableDefinitions["ModuleIgnoreTable"]); Row moduleIgnoreTableRow = moduleIgnoreTableTable.CreateRow(null); moduleIgnoreTableRow[0] = "ModuleConfiguration"; } // index all the file rows FileRowCollection indexedFileRows = new FileRowCollection(); Table fileTable = this.activeOutput.Tables["File"]; if (null != fileTable) { indexedFileRows.AddRange(fileTable.Rows); } // flag all the generated short file name collisions foreach (string fileId in generatedShortFileNameIdentifiers) { FileRow fileRow = indexedFileRows[fileId]; string[] names = fileRow.FileName.Split('|'); string shortFileName = names[0]; // create lists of conflicting generated short file names if (!generatedShortFileNames.Contains(shortFileName)) { generatedShortFileNames.Add(shortFileName, new ArrayList()); } ((ArrayList)generatedShortFileNames[shortFileName]).Add(fileRow); } // check for generated short file name collisions foreach (DictionaryEntry entry in generatedShortFileNames) { string shortFileName = (string)entry.Key; ArrayList fileRows = (ArrayList)entry.Value; if (1 < fileRows.Count) { // sort the rows by DiskId fileRows.Sort(); this.OnMessage(WixWarnings.GeneratedShortFileNameConflict(((FileRow)fileRows[0]).SourceLineNumbers, shortFileName)); for (int i = 1; i < fileRows.Count; i++) { FileRow fileRow = (FileRow)fileRows[i]; if (null != fileRow.SourceLineNumbers) { this.OnMessage(WixWarnings.GeneratedShortFileNameConflict2(fileRow.SourceLineNumbers)); } } } } // copy the wix variable rows to the output after all overriding has been accounted for. if (0 < wixVariables.Count) { Table wixVariableTable = output.EnsureTable(this.tableDefinitions["WixVariable"]); foreach (WixVariableRow row in wixVariables.Values) { wixVariableTable.Rows.Add(row); } } // Bundles have groups of data that must be flattened in a way different from other types. this.FlattenBundleTables(output); if (this.encounteredError) { return null; } this.CheckOutputConsistency(output); // inspect the output InspectorCore inspectorCore = new InspectorCore(this.Message); foreach (InspectorExtension inspectorExtension in this.inspectorExtensions) { inspectorExtension.Core = inspectorCore; inspectorExtension.InspectOutput(output); // reset inspectorExtension.Core = null; } if (inspectorCore.EncounteredError) { this.encounteredError = true; } } finally { this.activeOutput = null; } return (this.encounteredError ? null : output); }
public void SetTitle(OutputType outs) { ((ZedGraphControl)histogramGrid).GraphPane.Title = "Гистограмма " + outs.ToString(); }
public void RunTrials() { Console.WriteLine("Pretzel Solitaire Solver"); string resultsHeader = "Suits: " + SuitCount.ToString(); resultsHeader += ", Values: " + ValueCount.ToString(); resultsHeader += ", Deal: " + Deal.ToString(); resultsHeader += ", Approach: " + Approach.ToString(); resultsHeader += ", Ouput: " + Output.ToString(); Console.WriteLine(resultsHeader); string summaryHeader = "\nTrial \tIters \tSolved \tMvTot \tMvMean \tDuel2s \tDCrabs"; if (Approach == ApproachType.FullTree) { summaryHeader += " \tNoFail \tDeadends_for_Solvable"; } if (Output != OutputType.Verbose) { Console.WriteLine(summaryHeader); } CardDeck deck = new CardDeck(SuitCount, ValueCount); DateTime solveStartTime = DateTime.UtcNow; string moveCounts = string.Empty; ushort totalSolvedPretzels = 0; ulong totalMoves = 0; ushort totalDuellingDeuces = 0; ushort totalDuckingCrabs = 0; ushort totalUnlosablePretzels = 0; ulong totalDeadendsForSolvablePretzels = 0; for (short t = 0; t < Trials; ++t) { ushort trialSolvedPretzels = 0; ulong trialMoves = 0; ushort trialDuellingDeuces = 0; ushort trialDuckingCrabs = 0; ushort trialUnlosablePretzels = 0; ulong trailDeadendsForSolvablePretzels = 0; for (short e = 0; e < Experiments; ++e) { if (Output == OutputType.Verbose) { Console.WriteLine("\nTrial " + t.ToString() + " Experiment " + e.ToString()); } deck.Shuffle(Deal); PretzelPosition position = new PretzelPosition(deck); if (Output == OutputType.Verbose) { Console.WriteLine(position.ToString()); } SolveResults results = Solve(position, Approach, Output); if (results.Solvable) { ++trialSolvedPretzels; trialMoves += results.Moves; if (Output == OutputType.SummaryWithMoveCounts) { moveCounts += results.Moves.ToString() + ", "; } trailDeadendsForSolvablePretzels += results.Deadends; if (results.Deadends == 0) { ++trialUnlosablePretzels; } } else { if (results.HasDuellingDeuces) { ++trialDuellingDeuces; if (Output == OutputType.Verbose) { Console.WriteLine("Duelling Deuces Detected"); } } if (results.HasDuckingCrab) { ++trialDuckingCrabs; if (Output == OutputType.Verbose) { Console.WriteLine("Ducking Crab Detected"); } } } } totalSolvedPretzels += trialSolvedPretzels; totalMoves += trialMoves; totalDuellingDeuces += trialDuellingDeuces; totalDuckingCrabs += trialDuckingCrabs; totalUnlosablePretzels += trialUnlosablePretzels; totalDeadendsForSolvablePretzels += trailDeadendsForSolvablePretzels; // output trial results if (Output == OutputType.Verbose) { Console.WriteLine(summaryHeader); } string trialResults = t.ToString(); trialResults += "\t" + Experiments.ToString(); trialResults += "\t" + trialSolvedPretzels.ToString(); trialResults += "\t" + trialMoves.ToString(); trialResults += "\t" + ((double)trialMoves / (double)trialSolvedPretzels).ToString("F"); trialResults += "\t" + trialDuellingDeuces.ToString(); trialResults += "\t" + trialDuckingCrabs.ToString(); if (Approach == ApproachType.FullTree) { trialResults += "\t" + trialUnlosablePretzels.ToString(); trialResults += "\t" + trailDeadendsForSolvablePretzels.ToString(); } Console.WriteLine(trialResults); if (Output == OutputType.SummaryWithMoveCounts) { moveCounts += "\n\n"; } } // output total results DateTime solveEndTime = DateTime.UtcNow; Console.WriteLine(""); string totalResults = "TOTAL: "; totalResults += "\t" + (Trials * Experiments).ToString(); totalResults += "\t" + totalSolvedPretzels.ToString(); totalResults += "\t" + totalMoves.ToString(); totalResults += "\t" + ((double)totalMoves / (double)totalSolvedPretzels).ToString("F"); totalResults += "\t" + totalDuellingDeuces.ToString(); totalResults += "\t" + totalDuckingCrabs.ToString(); if (Approach == ApproachType.FullTree) { totalResults += "\t" + totalUnlosablePretzels.ToString(); totalResults += "\t" + totalDeadendsForSolvablePretzels.ToString(); } Console.WriteLine(totalResults); if (Output == OutputType.SummaryWithMoveCounts) { Console.WriteLine("\nMove Counts for All Solved Pretzels, Grouped by Trial"); Console.WriteLine(moveCounts); } Console.WriteLine(""); Console.WriteLine((solveEndTime - solveStartTime).ToString() + " Elapsed"); Console.Write((char)7); // play bell }
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; } }
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); }
public override string ToString() { return(OutputType.ToString()); }
public TempFile(OutputType type) : this(type.ToString()) { }
public void SaveV1DTAGenerationParameters(XmlTextWriter xwriter) { xwriter.WriteWhitespace("\n\t"); xwriter.WriteStartElement("DTAGenerationParameters"); xwriter.WriteWhitespace("\n\t\t"); xwriter.WriteElementString("MinScan", MinScan.ToString()); xwriter.WriteWhitespace("\n\t\t"); xwriter.WriteElementString("MaxScan", MaxScan.ToString()); xwriter.WriteWhitespace("\n\t\t"); xwriter.WriteElementString("MinMass", MinMass.ToString("0.0000")); xwriter.WriteWhitespace("\n\t\t"); xwriter.WriteElementString("MaxMass", MaxMass.ToString("0.0000")); xwriter.WriteWhitespace("\n\t\t"); xwriter.WriteElementString("MinIonCount", MinIonCount.ToString()); xwriter.WriteWhitespace("\n\t\t"); if (ConsiderChargeValue > 0) { xwriter.WriteElementString("ConsiderCharge", "true"); xwriter.WriteWhitespace("\n\t\t"); } else { xwriter.WriteElementString("ConsiderCharge", "false"); xwriter.WriteWhitespace("\n\t\t"); } xwriter.WriteElementString("ChargeValueToConsider", ConsiderChargeValue.ToString()); xwriter.WriteWhitespace("\n\t\t"); xwriter.WriteElementString("CCMass", CCMass.ToString("0.0000")); xwriter.WriteWhitespace("\n\t\t"); xwriter.WriteElementString("WindowSizeToCheck", WindowSizetoCheck.ToString("0.0000")); xwriter.WriteWhitespace("\n\t\t"); xwriter.WriteElementString("ConsiderMultiplePrecursors", ConsiderMultiplePrecursors.ToString()); xwriter.WriteWhitespace("\n\t\t"); xwriter.WriteElementString("IsolationWindowSize", IsolationWindowSize.ToString()); xwriter.WriteWhitespace("\n\t\t"); xwriter.WriteElementString("OutputType", OutputType.ToString()); xwriter.WriteWhitespace("\n\t\t"); xwriter.WriteElementString("IsProfileDataForMzXML", IsProfileDataForMzXML.ToString()); xwriter.WriteWhitespace("\n\t\t"); xwriter.WriteElementString("WriteProgressFile", WriteProgressFile.ToString()); xwriter.WriteWhitespace("\n\t\t"); xwriter.WriteElementString("IgnoreMSnScans", IgnoreMSnScans.ToString()); if (IgnoreMSnScans) { var numLevels = NumMSnLevelsToIgnore; for (var levelNum = 0; levelNum < numLevels; levelNum++) { int level = _msnLevelsToIgnore[levelNum]; xwriter.WriteWhitespace("\n\t\t"); xwriter.WriteElementString("MSnLevelToIgnore", level.ToString()); } } xwriter.WriteWhitespace("\n\t"); xwriter.WriteEndElement(); }
/// <summary> /// Write a line to the output box and scroll down /// </summary> /// <param name="output"></param> public static void WriteLine(string output, OutputType outputType) { if ((outputType == OutputType.Arbiter && RemoraMain.ArbiterOutputButton.CheckState == CheckState.Checked) || (outputType == OutputType.Remora && RemoraMain.RemoraOutputButton.CheckState == CheckState.Checked)) { if (textBox != null) { // InvokeRequired required compares the thread ID of the // calling thread to the thread ID of the creating thread. // If these threads are different, it returns true. if (!textBox.InvokeRequired) { string text = textBox.Text; if (DisplayDateTimeOnOutput) { text += (DateTime.Now.ToShortTimeString() + ": " + outputType.ToString() + ": " + output + "\n"); } else { text += (output + "\n"); } if (text.Length > 5000) { text = text.Substring(text.Length - 5000); } textBox.Text = text; textBox.Select(textBox.Text.Length - 2, 0); textBox.ScrollToCaret(); } else { // invoke RemoraMain.BeginInvoke(new MethodInvoker(delegate() { string text = textBox.Text; if (DisplayDateTimeOnOutput) { text += (DateTime.Now.ToShortTimeString() + ": " + outputType.ToString() + ": " + output + "\n"); } else { text += (output + "\n"); } if (text.Length > 5000) { text = text.Substring(text.Length - 5000); } textBox.Text = text; textBox.Select(textBox.Text.Length - 2, 0); textBox.ScrollToCaret(); })); } } } }
static string Build(Project project, OutputType type) { string outFile = IO.Path.GetFullPath(IO.Path.Combine(project.OutDir, project.OutFileName) + "." + type.ToString().ToLower()); Utils.EnsureFileDir(outFile); if (IO.File.Exists(outFile)) IO.File.Delete(outFile); Build(project, outFile, type); return IO.File.Exists(outFile) ? outFile : null; }
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; } }
internal void AddProperties() { UrlValues.Add("postcode", PostCode?.ToLower()); UrlValues.Add("output_type", OutputType.ToString()?.ToLower()); UrlValues.Add("area_type", AreaType.ToString()?.ToLower()); }
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); } } }
/// <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); } } } }
public static string GenerateFilePathFromTemplate(string inputFilePath, OutputType outputFileExtension, string outputFilePathTemplate, int numberIndex, int numberMax) { if (string.IsNullOrEmpty(inputFilePath)) { return("Invalid input file path (argument 0)."); } string inputExtension = System.IO.Path.GetExtension(inputFilePath).Substring(1); string inputPathWithoutExtension = inputFilePath.Substring(0, inputFilePath.Length - inputExtension.Length - 1); string outputExtension = outputFileExtension.ToString().ToLowerInvariant(); if (string.IsNullOrEmpty(outputFilePathTemplate)) { // Default output path. return(inputPathWithoutExtension + "." + outputExtension); } string fileName = System.IO.Path.GetFileName(inputPathWithoutExtension); string parentDirectory = System.IO.Path.GetDirectoryName(inputPathWithoutExtension); if (!parentDirectory.EndsWith(System.IO.Path.DirectorySeparatorChar.ToString())) { parentDirectory += System.IO.Path.DirectorySeparatorChar; } string[] directories = parentDirectory.Substring(0, parentDirectory.Length - 1).Split(System.IO.Path.DirectorySeparatorChar); // Generate output path from template. string outputPath = outputFilePathTemplate; outputPath = outputPath.Replace("(path)", parentDirectory); outputPath = outputPath.Replace("(p)", parentDirectory); outputPath = outputPath.Replace("(filename)", fileName); outputPath = outputPath.Replace("(f)", fileName); outputPath = outputPath.Replace("(F)", fileName.ToUpperInvariant()); outputPath = outputPath.Replace("(outputext)", outputExtension); outputPath = outputPath.Replace("(o)", outputExtension); outputPath = outputPath.Replace("(O)", outputExtension.ToUpperInvariant()); outputPath = outputPath.Replace("(inputext)", inputExtension); outputPath = outputPath.Replace("(i)", inputExtension); outputPath = outputPath.Replace("(I)", inputExtension.ToUpperInvariant()); string myDocumentsFolder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments) + "\\"; outputPath = outputPath.Replace("(p:d)", myDocumentsFolder); outputPath = outputPath.Replace("(p:documents)", myDocumentsFolder); string myMusicFolder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyMusic) + "\\"; outputPath = outputPath.Replace("(p:m)", myMusicFolder); outputPath = outputPath.Replace("(p:music)", myMusicFolder); string myVideoFolder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyVideos) + "\\"; outputPath = outputPath.Replace("(p:v)", myVideoFolder); outputPath = outputPath.Replace("(p:videos)", myVideoFolder); string myPictureFolder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyPictures) + "\\"; outputPath = outputPath.Replace("(p:p)", myPictureFolder); outputPath = outputPath.Replace("(p:pictures)", myPictureFolder); for (int index = 0; index < directories.Length; index++) { outputPath = outputPath.Replace(string.Format("(d{0})", directories.Length - index - 1), directories[index]); outputPath = outputPath.Replace(string.Format("(D{0})", directories.Length - index - 1), directories[index].ToUpperInvariant()); } outputPath = outputPath.Replace("(n:i)", numberIndex.ToString()); outputPath = outputPath.Replace("(n:c)", numberMax.ToString()); outputPath += "." + outputExtension; return(outputPath); }
/// <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)); }
private static HtmlTag ExportButton(string name, OutputType outputType) { return(Button(name).AddClass("exportButton").Attr("outputType", outputType.ToString())); }
public OutputTypeViewModel(OutputType type) { this.Type = type; this.Category = Helpers.GetExtensionCategory(type.ToString().ToLowerInvariant()); }