/// <nodoc /> public string RenderColumn(ColumnKind col, DateTime dateTime, int threadId, Severity severity, string message) { if (_constColumns.TryGetValue(col, out var constColumnValue)) { return(constColumnValue); } switch (col) { case ColumnKind.PreciseTimeStamp: return(FormatTimeStamp(dateTime.ToUniversalTime())); case ColumnKind.ThreadId: return(threadId.ToString()); case ColumnKind.ProcessId: return(System.Diagnostics.Process.GetCurrentProcess().Id.ToString()); case ColumnKind.LogLevel: return(((int)severity).ToString()); case ColumnKind.LogLevelFriendly: return(severity.ToString()); case ColumnKind.Message: return(message); default: throw Contract.AssertFailure("Unknown column type: " + col); } }
/// <summary> /// Imports a Origin OPJ file (tables only) into corresponding new tables in Altaxo. /// </summary> /// <param name="filename">The file name of the origin OPJ file.</param> /// <returns>Null if the import was successfull, or a error message.</returns> public static string Import(string filename) { var opj = new OpjFile(filename); opj.Parse(); // now create corresponding tables in Altaxo for (int nspread = 0; nspread < opj.numSpreads(); nspread++) { // Create a new table string tablename = Current.Project.DataTableCollection.FindNewItemName(opj.spreadName(nspread)); var table = new DataTable(tablename); int numberOfColumns = opj.numCols(nspread); for (int ncol = 0; ncol < numberOfColumns; ncol++) { string colname = opj.colName(nspread, ncol); string coltype = opj.colType(nspread, ncol); int numberOfRows = opj.numRows(nspread, ncol); ColumnKind kind = coltype == "X" ? ColumnKind.X : ColumnKind.V; var column = new DoubleColumn(numberOfRows); column.CopyDataFrom(opj.Data(nspread, ncol), numberOfRows); colname = table.DataColumns.FindUniqueColumnName(colname); table.DataColumns.Add(column, colname, kind, 0); } table.Name = tablename; Current.Project.DataTableCollection.Add(table); Current.ProjectService.CreateNewWorksheet(table); } return(null); }
public EntryChange(ResourceTableEntry entry, string?text, CultureInfo?culture, ColumnKind columnKind, string?originalText) { Entry = entry; Text = text; Culture = culture; ColumnKind = columnKind; OriginalText = originalText; }
public EntryChange([NotNull] ResourceTableEntry entry, [CanBeNull] string text, [CanBeNull] CultureInfo culture, ColumnKind columnKind, [CanBeNull] string originalText) { Entry = entry; Text = text; Culture = culture; ColumnKind = columnKind; OriginalText = originalText; }
public EntryChange(ResourceTableEntry entry, string text, CultureInfo culture, ColumnKind columnKind, string originalText) { Contract.Requires(entry != null); Entry = entry; Text = ProposedText = text; Culture = culture; ColumnKind = columnKind; OriginalText = originalText; }
/// <summary> /// Initializes a new instance of the class. /// </summary> public ColumnOptions(ColumnKind kind) : this() { Kind = kind; if (kind == ColumnKind.PrimaryKey) { Minimum = ConfigBase.MinID; Maximum = ConfigBase.MaxID; } }
/// <summary> /// Constructor. Initializes this object and does nothing else. /// </summary> /// <param name="logFilePath">Full path to log file</param> /// <param name="schema">CSV schema as a list of columns. Each element in the list denotes a column to be rendered at that position.</param> /// <param name="renderConstColums"> /// When false, const columns (<see cref="IsConstValueColumn"/>) from <paramref name="schema"/> are not /// rendered to log file (those columns become available through the <see ref="ConstSchema"/> property. /// </param> /// <param name="severity">Minimum severity to log</param> /// <param name="maxFileSize">Maximum size of the log file.</param> /// <param name="serviceName">Name of the service using this log. Used to render <see cref="ColumnKind.Service"/></param> /// <param name="buildId">A uniqu build identifier. Used to render <see cref="ColumnKind.BuildId"/></param> public CsvFileLog ( string logFilePath, IEnumerable <ColumnKind> schema, bool renderConstColums = true, Severity severity = Severity.Diagnostic, long maxFileSize = 0, string serviceName = null, Guid buildId = default ) : base ( logFilePath, severity, autoFlush: true, maxFileSize: maxFileSize, maxFileCount: 0 // unlimited ) { Contract.Requires(schema != null); BuildId = buildId == default ? Guid.NewGuid() : buildId; _constColumns = new Dictionary <ColumnKind, string> { [ColumnKind.Empty] = string.Empty, [ColumnKind.BuildId] = BuildId.ToString(), [ColumnKind.Machine] = Environment.MachineName, [ColumnKind.Service] = serviceName ?? string.Empty, [ColumnKind.env_os] = Environment.OSVersion.Platform.ToString(), [ColumnKind.env_osVer] = Environment.OSVersion.Version.ToString() }; if (renderConstColums) { FileSchema = schema.ToArray(); ConstSchema = new ColumnKind[0]; } else { var groupedByIsConst = schema .GroupBy(col => IsConstValueColumn(col)) .ToDictionary(grp => grp.Key, grp => grp.ToArray()); FileSchema = GetValueOrDefault(groupedByIsConst, key: false, defaultValue: new ColumnKind[0]); ConstSchema = GetValueOrDefault(groupedByIsConst, key: true, defaultValue: new ColumnKind[0]); } }
/// <nodoc /> public string RenderColumn(ColumnKind col, DateTime dateTime, int threadId, Severity severity, string message) { switch (col) { case ColumnKind.Empty: return(string.Empty); case ColumnKind.BuildId: return(BuildId.ToString()); case ColumnKind.Machine: return(Machine); case ColumnKind.PreciseTimeStamp: return(FormatTimeStamp(dateTime.ToUniversalTime())); case ColumnKind.LocalPreciseTimeStamp: return(FormatTimeStamp(dateTime.ToLocalTime())); case ColumnKind.ThreadId: return(threadId.ToString()); case ColumnKind.ProcessId: return(System.Diagnostics.Process.GetCurrentProcess().Id.ToString()); case ColumnKind.LogLevel: return(((int)severity).ToString()); case ColumnKind.LogLevelFriendly: return(severity.ToString()); case ColumnKind.Service: return(Service); case ColumnKind.Message: return(CsvEscape(message)); case ColumnKind.env_os: return(Environment.OSVersion.Platform.ToString()); case ColumnKind.env_osVer: return(Environment.OSVersion.Version.ToString()); default: throw Contract.AssertFailure("Unknown column type: " + col); } }
private void RoundTripColumnKind(ColumnKind persistedValue, ColumnKind expectedRoundTrippedValue) { var sarifLog = new SarifLog { Runs = new[] { new Run { Tool = new Tool { Driver = new ToolComponent { Name = "Test tool" } }, ColumnKind = persistedValue } } }; string json = JsonConvert.SerializeObject(sarifLog); sarifLog = JsonConvert.DeserializeObject <SarifLog>(json); sarifLog.Runs[0].ColumnKind.Should().Be(expectedRoundTrippedValue); }
internal void Initialize(Model parentModel, Type declaringType, string name, ColumnKind kind, Action <Column> initializer) { if (Kind != ColumnKind.None) { throw new InvalidOperationException(DiagnosticMessages.Column_AlreadyInitialized); } Debug.Assert(parentModel != null); ConstructModelMember(parentModel, declaringType, name); Kind = kind; if (OriginalDeclaringType == null) { OriginalDeclaringType = DeclaringType; } if (string.IsNullOrEmpty(OriginalName)) { OriginalName = name; } _initializer = initializer; Index = ParentModel.Add(this); _initializer?.Invoke(this); }
/// <summary> /// Adds a column with a given name and kind. /// </summary> /// <param name="datac">The column to add.</param> /// <param name="name">The name of the column.</param> /// <param name="kind">The kind of the column.</param> public void Add(Altaxo.Data.DataColumn datac, string name, ColumnKind kind) { Add(datac,name,kind,0); }
/// <summary> /// Whether the value of <paramref name="col"/> is constant over time. /// /// For example, <code>true</code> is returned for columns <see cref="ColumnKind.Empty"/>, /// <see cref="ColumnKind.BuildId"/>, <see cref="ColumnKind.Machine"/> etc., because their values /// don't change during a single execution of the program; in contrast, columns like /// <see cref="ColumnKind.Message"/>, <see cref="ColumnKind.PreciseTimeStamp"/> are not constant. /// </summary> public bool IsConstValueColumn(ColumnKind col) => _constColumns.ContainsKey(col);
/// <summary> /// Executes an action on cell button click. /// </summary> private bool ExecCellAction(ColumnOptions dataColumnOptions, ColumnOptions buttonColumnOptions, ref object cellValue) { ColumnKind dataKind = dataColumnOptions.Kind; ColumnKind buttonKind = buttonColumnOptions == null ? ColumnKind.Button : buttonColumnOptions.Kind; if (dataKind == ColumnKind.Color) { // select color FrmColorSelect frmColorSelect = new FrmColorSelect { SelectedColor = cellValue == null ? Color.Empty : StrToColor(cellValue.ToString()) }; if (frmColorSelect.ShowDialog() == DialogResult.OK) { cellValue = frmColorSelect.SelectedColor.Name; return(true); } } else if (dataKind == ColumnKind.Path) { // select file or folder string path = ""; string interfaceDir = ScadaUtils.NormalDir(project.Interface.InterfaceDir); string selectedPath = Path.Combine(interfaceDir, cellValue == null ? "" : cellValue.ToString()); if (buttonKind == ColumnKind.SelectFolderButton) { // select folder selectedPath = Path.GetDirectoryName(selectedPath); folderBrowserDialog.SelectedPath = Directory.Exists(selectedPath) ? selectedPath : interfaceDir; if (folderBrowserDialog.ShowDialog() == DialogResult.OK) { path = ScadaUtils.NormalDir(folderBrowserDialog.SelectedPath); } } else { // select file if (string.IsNullOrEmpty(selectedPath) || !File.Exists(selectedPath)) { openFileDialog.InitialDirectory = interfaceDir; openFileDialog.FileName = ""; } else { openFileDialog.InitialDirectory = Path.GetDirectoryName(selectedPath); openFileDialog.FileName = Path.GetFileName(selectedPath); } if (openFileDialog.ShowDialog() == DialogResult.OK) { openFileDialog.InitialDirectory = Path.GetDirectoryName(openFileDialog.FileName); path = openFileDialog.FileName; } } if (!string.IsNullOrEmpty(path)) { if (path.StartsWith(interfaceDir, StringComparison.OrdinalIgnoreCase)) { path = path.Substring(interfaceDir.Length); } cellValue = path; return(true); } } else if (dataKind == ColumnKind.SourceCode) { // edit source code FrmSourceCode frmSourceCode = new FrmSourceCode { MaxLength = dataColumnOptions.MaxLength, SourceCode = cellValue.ToString() }; if (frmSourceCode.ShowDialog() == DialogResult.OK) { cellValue = frmSourceCode.SourceCode; return(true); } } return(false); }
/// <summary> /// Add a column with a given name, kind, and group number. /// </summary> /// <param name="datac">The column to add.</param> /// <param name="name">The name of the column.</param> /// <param name="kind">The kind of the column.</param> /// <param name="groupNumber">The group number of the column.</param> public void Add(Altaxo.Data.DataColumn datac, string name, ColumnKind kind, int groupNumber) { if(name==null) name = this.FindNewColumnName(); else if( m_ColumnsByName.ContainsKey(name)) name = this.FindUniqueColumnName(name); Add(datac,new DataColumnInfo(name,kind,groupNumber)); }
internal static void Construct <T>(this T column, Model parentModel, Type declaringType, string name, ColumnKind kind, Action <T> baseInitializer, Action <T> initializer) where T : Column { initializer = column.MergeInitializer(baseInitializer, initializer); Action <Column> action = null; if (initializer != null) { ColumnInitializerManager <T> .SetInitializer(column, initializer); action = (x) => initializer((T)x); } column.Initialize(parentModel, declaringType, name, kind, action); }
/// <summary> /// Initializes a new instance of the class. /// </summary> /// <remarks>Use this constructor for primary key columns.</remarks> public ColumnOptions(ColumnKind kind, int min, int max) : this(kind) { Minimum = min; Maximum = max; }
/// <summary> /// Constructs a DataColumnInfo object. /// </summary> /// <param name="name">The name of the column.</param> /// <param name="kind">The kind of the column.</param> /// <param name="groupNumber">The group number of the column.</param> public DataColumnInfo(string name, ColumnKind kind, int groupNumber) { this.Name = name; this.Kind = kind; this.Group = groupNumber; }
private static bool SetEntryData([NotNull] this ResourceTableEntry entry, [CanBeNull] CultureInfo culture, ColumnKind columnKind, [CanBeNull] string text) { if (!entry.CanEdit(culture)) { return(false); } switch (columnKind) { case ColumnKind.Text: return(entry.Values.SetValue(culture, text)); case ColumnKind.Comment: return(entry.Comments.SetValue(culture, text)); default: throw new InvalidOperationException("Invalid Column Kind"); } }
private void Init(Tool tool, IEnumerable <Invocation> invocations, Conversion conversion, string language, IEnumerable <VersionControlDetails> versionControlProvenance, IDictionary <string, ArtifactLocation> originalUriBaseIds, IEnumerable <Artifact> artifacts, IEnumerable <LogicalLocation> logicalLocations, IEnumerable <Graph> graphs, IEnumerable <Result> results, RunAutomationDetails automationDetails, IEnumerable <RunAutomationDetails> runAggregates, string baselineGuid, IEnumerable <string> redactionTokens, string defaultEncoding, string defaultSourceLanguage, IEnumerable <string> newlineSequences, ColumnKind columnKind, ExternalPropertyFileReferences externalPropertyFileReferences, IEnumerable <ThreadFlowLocation> threadFlowLocations, IEnumerable <ToolComponent> taxonomies, IEnumerable <Address> addresses, IEnumerable <ToolComponent> translations, IEnumerable <ToolComponent> policies, IEnumerable <WebRequest> webRequests, IEnumerable <WebResponse> webResponses, SpecialLocations specialLocations, IDictionary <string, SerializedPropertyInfo> properties) { if (tool != null) { Tool = new Tool(tool); } if (invocations != null) { var destination_0 = new List <Invocation>(); foreach (var value_0 in invocations) { if (value_0 == null) { destination_0.Add(null); } else { destination_0.Add(new Invocation(value_0)); } } Invocations = destination_0; } if (conversion != null) { Conversion = new Conversion(conversion); } Language = language; if (versionControlProvenance != null) { var destination_1 = new List <VersionControlDetails>(); foreach (var value_1 in versionControlProvenance) { if (value_1 == null) { destination_1.Add(null); } else { destination_1.Add(new VersionControlDetails(value_1)); } } VersionControlProvenance = destination_1; } if (originalUriBaseIds != null) { OriginalUriBaseIds = new Dictionary <string, ArtifactLocation>(); foreach (var value_2 in originalUriBaseIds) { OriginalUriBaseIds.Add(value_2.Key, new ArtifactLocation(value_2.Value)); } } if (artifacts != null) { var destination_2 = new List <Artifact>(); foreach (var value_3 in artifacts) { if (value_3 == null) { destination_2.Add(null); } else { destination_2.Add(new Artifact(value_3)); } } Artifacts = destination_2; } if (logicalLocations != null) { var destination_3 = new List <LogicalLocation>(); foreach (var value_4 in logicalLocations) { if (value_4 == null) { destination_3.Add(null); } else { destination_3.Add(new LogicalLocation(value_4)); } } LogicalLocations = destination_3; } if (graphs != null) { var destination_4 = new List <Graph>(); foreach (var value_5 in graphs) { if (value_5 == null) { destination_4.Add(null); } else { destination_4.Add(new Graph(value_5)); } } Graphs = destination_4; } if (results != null) { var destination_5 = new List <Result>(); foreach (var value_6 in results) { if (value_6 == null) { destination_5.Add(null); } else { destination_5.Add(new Result(value_6)); } } Results = destination_5; } if (automationDetails != null) { AutomationDetails = new RunAutomationDetails(automationDetails); } if (runAggregates != null) { var destination_6 = new List <RunAutomationDetails>(); foreach (var value_7 in runAggregates) { if (value_7 == null) { destination_6.Add(null); } else { destination_6.Add(new RunAutomationDetails(value_7)); } } RunAggregates = destination_6; } BaselineGuid = baselineGuid; if (redactionTokens != null) { var destination_7 = new List <string>(); foreach (var value_8 in redactionTokens) { destination_7.Add(value_8); } RedactionTokens = destination_7; } DefaultEncoding = defaultEncoding; DefaultSourceLanguage = defaultSourceLanguage; if (newlineSequences != null) { var destination_8 = new List <string>(); foreach (var value_9 in newlineSequences) { destination_8.Add(value_9); } NewlineSequences = destination_8; } ColumnKind = columnKind; if (externalPropertyFileReferences != null) { ExternalPropertyFileReferences = new ExternalPropertyFileReferences(externalPropertyFileReferences); } if (threadFlowLocations != null) { var destination_9 = new List <ThreadFlowLocation>(); foreach (var value_10 in threadFlowLocations) { if (value_10 == null) { destination_9.Add(null); } else { destination_9.Add(new ThreadFlowLocation(value_10)); } } ThreadFlowLocations = destination_9; } if (taxonomies != null) { var destination_10 = new List <ToolComponent>(); foreach (var value_11 in taxonomies) { if (value_11 == null) { destination_10.Add(null); } else { destination_10.Add(new ToolComponent(value_11)); } } Taxonomies = destination_10; } if (addresses != null) { var destination_11 = new List <Address>(); foreach (var value_12 in addresses) { if (value_12 == null) { destination_11.Add(null); } else { destination_11.Add(new Address(value_12)); } } Addresses = destination_11; } if (translations != null) { var destination_12 = new List <ToolComponent>(); foreach (var value_13 in translations) { if (value_13 == null) { destination_12.Add(null); } else { destination_12.Add(new ToolComponent(value_13)); } } Translations = destination_12; } if (policies != null) { var destination_13 = new List <ToolComponent>(); foreach (var value_14 in policies) { if (value_14 == null) { destination_13.Add(null); } else { destination_13.Add(new ToolComponent(value_14)); } } Policies = destination_13; } if (webRequests != null) { var destination_14 = new List <WebRequest>(); foreach (var value_15 in webRequests) { if (value_15 == null) { destination_14.Add(null); } else { destination_14.Add(new WebRequest(value_15)); } } WebRequests = destination_14; } if (webResponses != null) { var destination_15 = new List <WebResponse>(); foreach (var value_16 in webResponses) { if (value_16 == null) { destination_15.Add(null); } else { destination_15.Add(new WebResponse(value_16)); } } WebResponses = destination_15; } if (specialLocations != null) { SpecialLocations = new SpecialLocations(specialLocations); } if (properties != null) { Properties = new Dictionary <string, SerializedPropertyInfo>(properties); } }
/// <summary> /// Initializes a new instance of the class. /// </summary> public ColumnOptions(ColumnKind kind, int maxLength = 0) : this() { Kind = kind; MaxLength = maxLength; }
public ColumnKindChangeEventArgs(ColumnKind oldKind, ColumnKind newKind) { _oldKind = oldKind; _newKind = newKind; }
private static string?GetEntryData(this ResourceTableEntry entry, CultureKey culture, ColumnKind columnKind) { var snapshot = entry.Snapshot; if (snapshot != null) { if (!snapshot.TryGetValue(culture, out var data) || (data == null)) { return(null); } return(columnKind switch { ColumnKind.Text => data.Text, ColumnKind.Comment => data.Comment, _ => throw new InvalidOperationException("Invalid Column Kind") });
/// <summary> /// Initializes a new instance of the <see cref="Run" /> class from the supplied values. /// </summary> /// <param name="tool"> /// An initialization value for the <see cref="P:Tool" /> property. /// </param> /// <param name="invocations"> /// An initialization value for the <see cref="P:Invocations" /> property. /// </param> /// <param name="conversion"> /// An initialization value for the <see cref="P:Conversion" /> property. /// </param> /// <param name="versionControlProvenance"> /// An initialization value for the <see cref="P:VersionControlProvenance" /> property. /// </param> /// <param name="originalUriBaseIds"> /// An initialization value for the <see cref="P:OriginalUriBaseIds" /> property. /// </param> /// <param name="artifacts"> /// An initialization value for the <see cref="P:Artifacts" /> property. /// </param> /// <param name="logicalLocations"> /// An initialization value for the <see cref="P:LogicalLocations" /> property. /// </param> /// <param name="graphs"> /// An initialization value for the <see cref="P:Graphs" /> property. /// </param> /// <param name="results"> /// An initialization value for the <see cref="P:Results" /> property. /// </param> /// <param name="id"> /// An initialization value for the <see cref="P:Id" /> property. /// </param> /// <param name="aggregateIds"> /// An initialization value for the <see cref="P:AggregateIds" /> property. /// </param> /// <param name="baselineInstanceGuid"> /// An initialization value for the <see cref="P:BaselineInstanceGuid" /> property. /// </param> /// <param name="markdownMessageMimeType"> /// An initialization value for the <see cref="P:MarkdownMessageMimeType" /> property. /// </param> /// <param name="redactionToken"> /// An initialization value for the <see cref="P:RedactionToken" /> property. /// </param> /// <param name="defaultFileEncoding"> /// An initialization value for the <see cref="P:DefaultFileEncoding" /> property. /// </param> /// <param name="defaultSourceLanguage"> /// An initialization value for the <see cref="P:DefaultSourceLanguage" /> property. /// </param> /// <param name="newlineSequences"> /// An initialization value for the <see cref="P:NewlineSequences" /> property. /// </param> /// <param name="columnKind"> /// An initialization value for the <see cref="P:ColumnKind" /> property. /// </param> /// <param name="externalPropertyFiles"> /// An initialization value for the <see cref="P:ExternalPropertyFiles" /> property. /// </param> /// <param name="properties"> /// An initialization value for the <see cref="P:Properties" /> property. /// </param> public Run(Tool tool, IEnumerable <Invocation> invocations, Conversion conversion, IEnumerable <VersionControlDetails> versionControlProvenance, IDictionary <string, ArtifactLocation> originalUriBaseIds, IEnumerable <Artifact> artifacts, IEnumerable <LogicalLocation> logicalLocations, IDictionary <string, Graph> graphs, IEnumerable <Result> results, RunAutomationDetails id, IEnumerable <RunAutomationDetails> aggregateIds, string baselineInstanceGuid, string markdownMessageMimeType, string redactionToken, string defaultFileEncoding, string defaultSourceLanguage, IEnumerable <string> newlineSequences, ColumnKind columnKind, ExternalPropertyFiles externalPropertyFiles, IDictionary <string, SerializedPropertyInfo> properties) { Init(tool, invocations, conversion, versionControlProvenance, originalUriBaseIds, artifacts, logicalLocations, graphs, results, id, aggregateIds, baselineInstanceGuid, markdownMessageMimeType, redactionToken, defaultFileEncoding, defaultSourceLanguage, newlineSequences, columnKind, externalPropertyFiles, properties); }
/// <summary> /// Copy constructor. /// </summary> /// <param name="from">Another object to copy from.</param> public DataColumnInfo(DataColumnInfo from) { this.Name = from.Name; this.Number = from.Number; this.Group = from.Group; this.Kind = from.Kind; }
/// <summary> /// Constructs a DataColumnInfo object. /// </summary> /// <param name="name">The name of the column.</param> /// <param name="kind">The kind of the column.</param> public DataColumnInfo(string name, ColumnKind kind) { this.Name = name; this.Kind = kind; }
/// <summary> /// Returns the const value of the <paramref name="col"/> column. /// Precondition: <see cref="IsConstValueColumn"/> must return true for <paramref name="col"/>. /// </summary> public string RenderConstColumn(ColumnKind col) { Contract.Requires(IsConstValueColumn(col)); return(_constColumns[col]); }
/// <summary> /// Initializes a new instance of the class. /// </summary> public ColumnOptions(ColumnKind kind, int maxLength) : this(kind) { MaxLength = maxLength; }
/// <summary> /// Either returns an existing column with name <c>columnname</c> and type <c>expectedtype</c> or creates a new column of the provided type. /// </summary> /// <param name="columnname">The column name.</param> /// <param name="expectedcolumntype">Expected type of the column.</param> /// <param name="kind">Only used when a new column is created.</param> /// <param name="groupNumber">Only used when a new column is created.</param> /// <returns>Either an existing column of name <c>columnname</c> and type <c>expectedtype</c>. If this is /// not the case, a new column with a similar name and the <c>expectedtype</c> is created and added to the collection. The new column is returned then.</returns> public DataColumn EnsureExistence(string columnname, System.Type expectedcolumntype, ColumnKind kind, int groupNumber) { if (IsColumnOfType(columnname, expectedcolumntype)) return this[columnname]; object o = System.Activator.CreateInstance(expectedcolumntype); if(!(o is DataColumn)) throw new ApplicationException("The type you provided is not compatible with DataColumn, provided type: " + expectedcolumntype.GetType().ToString()); Add((DataColumn)o, columnname, kind, groupNumber); return (DataColumn)o; }
/// <summary> /// Initializes a new instance of the <see cref="Run" /> class from the supplied values. /// </summary> /// <param name="tool"> /// An initialization value for the <see cref="P: Tool" /> property. /// </param> /// <param name="invocations"> /// An initialization value for the <see cref="P: Invocations" /> property. /// </param> /// <param name="conversion"> /// An initialization value for the <see cref="P: Conversion" /> property. /// </param> /// <param name="versionControlProvenance"> /// An initialization value for the <see cref="P: VersionControlProvenance" /> property. /// </param> /// <param name="originalUriBaseIds"> /// An initialization value for the <see cref="P: OriginalUriBaseIds" /> property. /// </param> /// <param name="files"> /// An initialization value for the <see cref="P: Files" /> property. /// </param> /// <param name="logicalLocations"> /// An initialization value for the <see cref="P: LogicalLocations" /> property. /// </param> /// <param name="graphs"> /// An initialization value for the <see cref="P: Graphs" /> property. /// </param> /// <param name="results"> /// An initialization value for the <see cref="P: Results" /> property. /// </param> /// <param name="resources"> /// An initialization value for the <see cref="P: Resources" /> property. /// </param> /// <param name="instanceGuid"> /// An initialization value for the <see cref="P: InstanceGuid" /> property. /// </param> /// <param name="correlationGuid"> /// An initialization value for the <see cref="P: CorrelationGuid" /> property. /// </param> /// <param name="logicalId"> /// An initialization value for the <see cref="P: LogicalId" /> property. /// </param> /// <param name="description"> /// An initialization value for the <see cref="P: Description" /> property. /// </param> /// <param name="automationLogicalId"> /// An initialization value for the <see cref="P: AutomationLogicalId" /> property. /// </param> /// <param name="baselineInstanceGuid"> /// An initialization value for the <see cref="P: BaselineInstanceGuid" /> property. /// </param> /// <param name="architecture"> /// An initialization value for the <see cref="P: Architecture" /> property. /// </param> /// <param name="richMessageMimeType"> /// An initialization value for the <see cref="P: RichMessageMimeType" /> property. /// </param> /// <param name="redactionToken"> /// An initialization value for the <see cref="P: RedactionToken" /> property. /// </param> /// <param name="defaultFileEncoding"> /// An initialization value for the <see cref="P: DefaultFileEncoding" /> property. /// </param> /// <param name="columnKind"> /// An initialization value for the <see cref="P: ColumnKind" /> property. /// </param> /// <param name="properties"> /// An initialization value for the <see cref="P: Properties" /> property. /// </param> public Run(Tool tool, IEnumerable <Invocation> invocations, Conversion conversion, IEnumerable <VersionControlDetails> versionControlProvenance, IDictionary <string, Uri> originalUriBaseIds, IDictionary <string, FileData> files, IDictionary <string, LogicalLocation> logicalLocations, IEnumerable <Graph> graphs, IEnumerable <Result> results, Resources resources, string instanceGuid, string correlationGuid, string logicalId, Message description, string automationLogicalId, string baselineInstanceGuid, string architecture, string richMessageMimeType, string redactionToken, string defaultFileEncoding, ColumnKind columnKind, IDictionary <string, SerializedPropertyInfo> properties) { Init(tool, invocations, conversion, versionControlProvenance, originalUriBaseIds, files, logicalLocations, graphs, results, resources, instanceGuid, correlationGuid, logicalId, description, automationLogicalId, baselineInstanceGuid, architecture, richMessageMimeType, redactionToken, defaultFileEncoding, columnKind, properties); }
private void Init(Tool tool, IEnumerable <Invocation> invocations, Conversion conversion, IEnumerable <VersionControlDetails> versionControlProvenance, IDictionary <string, ArtifactLocation> originalUriBaseIds, IEnumerable <Artifact> artifacts, IEnumerable <LogicalLocation> logicalLocations, IDictionary <string, Graph> graphs, IEnumerable <Result> results, RunAutomationDetails id, IEnumerable <RunAutomationDetails> aggregateIds, string baselineInstanceGuid, string markdownMessageMimeType, string redactionToken, string defaultFileEncoding, string defaultSourceLanguage, IEnumerable <string> newlineSequences, ColumnKind columnKind, ExternalPropertyFiles externalPropertyFiles, IDictionary <string, SerializedPropertyInfo> properties) { if (tool != null) { Tool = new Tool(tool); } if (invocations != null) { var destination_0 = new List <Invocation>(); foreach (var value_0 in invocations) { if (value_0 == null) { destination_0.Add(null); } else { destination_0.Add(new Invocation(value_0)); } } Invocations = destination_0; } if (conversion != null) { Conversion = new Conversion(conversion); } if (versionControlProvenance != null) { var destination_1 = new List <VersionControlDetails>(); foreach (var value_1 in versionControlProvenance) { if (value_1 == null) { destination_1.Add(null); } else { destination_1.Add(new VersionControlDetails(value_1)); } } VersionControlProvenance = destination_1; } if (originalUriBaseIds != null) { OriginalUriBaseIds = new Dictionary <string, ArtifactLocation>(); foreach (var value_2 in originalUriBaseIds) { OriginalUriBaseIds.Add(value_2.Key, new ArtifactLocation(value_2.Value)); } } if (artifacts != null) { var destination_2 = new List <Artifact>(); foreach (var value_3 in artifacts) { if (value_3 == null) { destination_2.Add(null); } else { destination_2.Add(new Artifact(value_3)); } } Artifacts = destination_2; } if (logicalLocations != null) { var destination_3 = new List <LogicalLocation>(); foreach (var value_4 in logicalLocations) { if (value_4 == null) { destination_3.Add(null); } else { destination_3.Add(new LogicalLocation(value_4)); } } LogicalLocations = destination_3; } if (graphs != null) { Graphs = new Dictionary <string, Graph>(); foreach (var value_5 in graphs) { Graphs.Add(value_5.Key, new Graph(value_5.Value)); } } if (results != null) { var destination_4 = new List <Result>(); foreach (var value_6 in results) { if (value_6 == null) { destination_4.Add(null); } else { destination_4.Add(new Result(value_6)); } } Results = destination_4; } if (id != null) { Id = new RunAutomationDetails(id); } if (aggregateIds != null) { var destination_5 = new List <RunAutomationDetails>(); foreach (var value_7 in aggregateIds) { if (value_7 == null) { destination_5.Add(null); } else { destination_5.Add(new RunAutomationDetails(value_7)); } } AggregateIds = destination_5; } BaselineInstanceGuid = baselineInstanceGuid; MarkdownMessageMimeType = markdownMessageMimeType; RedactionToken = redactionToken; DefaultFileEncoding = defaultFileEncoding; DefaultSourceLanguage = defaultSourceLanguage; if (newlineSequences != null) { var destination_6 = new List <string>(); foreach (var value_8 in newlineSequences) { destination_6.Add(value_8); } NewlineSequences = destination_6; } ColumnKind = columnKind; if (externalPropertyFiles != null) { ExternalPropertyFiles = new ExternalPropertyFiles(externalPropertyFiles); } if (properties != null) { Properties = new Dictionary <string, SerializedPropertyInfo>(properties); } }
/// <summary> /// Initializes a new instance of the <see cref="Run" /> class from the supplied values. /// </summary> /// <param name="tool"> /// An initialization value for the <see cref="P:Tool" /> property. /// </param> /// <param name="invocations"> /// An initialization value for the <see cref="P:Invocations" /> property. /// </param> /// <param name="conversion"> /// An initialization value for the <see cref="P:Conversion" /> property. /// </param> /// <param name="language"> /// An initialization value for the <see cref="P:Language" /> property. /// </param> /// <param name="versionControlProvenance"> /// An initialization value for the <see cref="P:VersionControlProvenance" /> property. /// </param> /// <param name="originalUriBaseIds"> /// An initialization value for the <see cref="P:OriginalUriBaseIds" /> property. /// </param> /// <param name="artifacts"> /// An initialization value for the <see cref="P:Artifacts" /> property. /// </param> /// <param name="logicalLocations"> /// An initialization value for the <see cref="P:LogicalLocations" /> property. /// </param> /// <param name="graphs"> /// An initialization value for the <see cref="P:Graphs" /> property. /// </param> /// <param name="results"> /// An initialization value for the <see cref="P:Results" /> property. /// </param> /// <param name="automationDetails"> /// An initialization value for the <see cref="P:AutomationDetails" /> property. /// </param> /// <param name="runAggregates"> /// An initialization value for the <see cref="P:RunAggregates" /> property. /// </param> /// <param name="baselineGuid"> /// An initialization value for the <see cref="P:BaselineGuid" /> property. /// </param> /// <param name="redactionTokens"> /// An initialization value for the <see cref="P:RedactionTokens" /> property. /// </param> /// <param name="defaultEncoding"> /// An initialization value for the <see cref="P:DefaultEncoding" /> property. /// </param> /// <param name="defaultSourceLanguage"> /// An initialization value for the <see cref="P:DefaultSourceLanguage" /> property. /// </param> /// <param name="newlineSequences"> /// An initialization value for the <see cref="P:NewlineSequences" /> property. /// </param> /// <param name="columnKind"> /// An initialization value for the <see cref="P:ColumnKind" /> property. /// </param> /// <param name="externalPropertyFileReferences"> /// An initialization value for the <see cref="P:ExternalPropertyFileReferences" /> property. /// </param> /// <param name="threadFlowLocations"> /// An initialization value for the <see cref="P:ThreadFlowLocations" /> property. /// </param> /// <param name="taxonomies"> /// An initialization value for the <see cref="P:Taxonomies" /> property. /// </param> /// <param name="addresses"> /// An initialization value for the <see cref="P:Addresses" /> property. /// </param> /// <param name="translations"> /// An initialization value for the <see cref="P:Translations" /> property. /// </param> /// <param name="policies"> /// An initialization value for the <see cref="P:Policies" /> property. /// </param> /// <param name="webRequests"> /// An initialization value for the <see cref="P:WebRequests" /> property. /// </param> /// <param name="webResponses"> /// An initialization value for the <see cref="P:WebResponses" /> property. /// </param> /// <param name="specialLocations"> /// An initialization value for the <see cref="P:SpecialLocations" /> property. /// </param> /// <param name="properties"> /// An initialization value for the <see cref="P:Properties" /> property. /// </param> public Run(Tool tool, IEnumerable <Invocation> invocations, Conversion conversion, string language, IEnumerable <VersionControlDetails> versionControlProvenance, IDictionary <string, ArtifactLocation> originalUriBaseIds, IEnumerable <Artifact> artifacts, IEnumerable <LogicalLocation> logicalLocations, IEnumerable <Graph> graphs, IEnumerable <Result> results, RunAutomationDetails automationDetails, IEnumerable <RunAutomationDetails> runAggregates, string baselineGuid, IEnumerable <string> redactionTokens, string defaultEncoding, string defaultSourceLanguage, IEnumerable <string> newlineSequences, ColumnKind columnKind, ExternalPropertyFileReferences externalPropertyFileReferences, IEnumerable <ThreadFlowLocation> threadFlowLocations, IEnumerable <ToolComponent> taxonomies, IEnumerable <Address> addresses, IEnumerable <ToolComponent> translations, IEnumerable <ToolComponent> policies, IEnumerable <WebRequest> webRequests, IEnumerable <WebResponse> webResponses, SpecialLocations specialLocations, IDictionary <string, SerializedPropertyInfo> properties) { Init(tool, invocations, conversion, language, versionControlProvenance, originalUriBaseIds, artifacts, logicalLocations, graphs, results, automationDetails, runAggregates, baselineGuid, redactionTokens, defaultEncoding, defaultSourceLanguage, newlineSequences, columnKind, externalPropertyFileReferences, threadFlowLocations, taxonomies, addresses, translations, policies, webRequests, webResponses, specialLocations, properties); }
private void Init(Tool tool, IEnumerable <Invocation> invocations, Conversion conversion, IEnumerable <VersionControlDetails> versionControlProvenance, IDictionary <string, Uri> originalUriBaseIds, IDictionary <string, FileData> files, IDictionary <string, LogicalLocation> logicalLocations, IEnumerable <Graph> graphs, IEnumerable <Result> results, Resources resources, string instanceGuid, string correlationGuid, string logicalId, Message description, string automationLogicalId, string baselineInstanceGuid, string architecture, string richMessageMimeType, string redactionToken, string defaultFileEncoding, ColumnKind columnKind, IDictionary <string, SerializedPropertyInfo> properties) { if (tool != null) { Tool = new Tool(tool); } if (invocations != null) { var destination_0 = new List <Invocation>(); foreach (var value_0 in invocations) { if (value_0 == null) { destination_0.Add(null); } else { destination_0.Add(new Invocation(value_0)); } } Invocations = destination_0; } if (conversion != null) { Conversion = new Conversion(conversion); } if (versionControlProvenance != null) { var destination_1 = new List <VersionControlDetails>(); foreach (var value_1 in versionControlProvenance) { if (value_1 == null) { destination_1.Add(null); } else { destination_1.Add(new VersionControlDetails(value_1)); } } VersionControlProvenance = destination_1; } ; if (files != null) { Files = new Dictionary <string, FileData>(); foreach (var value_2 in files) { Files.Add(value_2.Key, new FileData(value_2.Value)); } } if (logicalLocations != null) { LogicalLocations = new Dictionary <string, LogicalLocation>(); foreach (var value_3 in logicalLocations) { LogicalLocations.Add(value_3.Key, new LogicalLocation(value_3.Value)); } } if (graphs != null) { var destination_2 = new List <Graph>(); foreach (var value_4 in graphs) { if (value_4 == null) { destination_2.Add(null); } else { destination_2.Add(new Graph(value_4)); } } Graphs = destination_2; } if (results != null) { var destination_3 = new List <Result>(); foreach (var value_5 in results) { if (value_5 == null) { destination_3.Add(null); } else { destination_3.Add(new Result(value_5)); } } Results = destination_3; } if (resources != null) { Resources = new Resources(resources); } InstanceGuid = instanceGuid; CorrelationGuid = correlationGuid; LogicalId = logicalId; if (description != null) { Description = new Message(description); } AutomationLogicalId = automationLogicalId; BaselineInstanceGuid = baselineInstanceGuid; Architecture = architecture; RichMessageMimeType = richMessageMimeType; RedactionToken = redactionToken; DefaultFileEncoding = defaultFileEncoding; ColumnKind = columnKind; if (properties != null) { Properties = new Dictionary <string, SerializedPropertyInfo>(properties); } }
private static string GetEntryData([NotNull] this ResourceTableEntry entry, [NotNull] CultureKey culture, ColumnKind columnKind) { var snapshot = entry.Snapshot; if (snapshot != null) { if (!snapshot.TryGetValue(culture, out var data) || (data == null)) { return(null); } switch (columnKind) { case ColumnKind.Text: return(data.Text); case ColumnKind.Comment: return(data.Comment); default: throw new InvalidOperationException("Invalid Column Kind"); } } switch (columnKind) { case ColumnKind.Text: return(entry.Values.GetValue(culture)); case ColumnKind.Comment: return(entry.Comments.GetValue(culture)); default: throw new InvalidOperationException("Invalid Column Kind"); } }
private static string GetEntryData(this ResourceTableEntry entry, CultureKey culture, ColumnKind columnKind) { Contract.Requires(entry != null); Contract.Requires(culture != null); var snapshot = entry.Snapshot; if (snapshot != null) { ResourceData data; if (!snapshot.TryGetValue(culture, out data) || (data == null)) { return(null); } switch (columnKind) { case ColumnKind.Text: return(data.Text); case ColumnKind.Comment: return(data.Comment); default: throw new InvalidOperationException("Invalid Column Kind"); } } switch (columnKind) { case ColumnKind.Text: return(entry.Values.GetValue(culture)); case ColumnKind.Comment: return(entry.Comments.GetValue(culture)); default: throw new InvalidOperationException("Invalid Column Kind"); } }
private static bool SetEntryData(this ResourceTableEntry entry, CultureInfo culture, ColumnKind columnKind, string text) { Contract.Requires(entry != null); switch (columnKind) { case ColumnKind.Text: return(entry.Values.SetValue(culture, text)); case ColumnKind.Comment: return(entry.Comments.SetValue(culture, text)); default: throw new InvalidOperationException("Invalid Column Kind"); } }
/// <summary> /// Sets the kind of the column with column number <code>idx</code>. /// </summary> /// <param name="idx">The column number of the column.</param> /// <param name="columnKind">The new kind of the column.</param> public void SetColumnKind(int idx, ColumnKind columnKind) { DataColumnInfo info = GetColumnInfo(idx); info.Kind = columnKind; EnsureUniqueColumnKindsForIndependentVariables(info.Group,this[idx]); }