/// <summary> /// The actual implementation of the \e ToString method. /// </summary> /// <param name="format">The format specifier to use, e.g. <b>Console.WriteLine(stream.ToString("lv"));</b></param> /// <param name="provider">Allow clients to format output for their own types using [ICustomFormatter](https://msdn.microsoft.com/en-us/library/system.icustomformatter.aspx).</param> /// <returns>The formatted string.</returns> /// <exception cref="FormatException">thrown if an invalid format string is specified.</exception> /// \par Format specifiers: /// \arg \c G Stream name. Default when not using a format specifier. /// \arg \c LV Long version (verbose). /// \arg \c I Stream ID number. /// \arg \c T [Stream type](@ref AcUtils#StreamType): \e unknown, \e normal, \e dynamic, \e regular, \e workspace, \e snapshot, \e passthru, \e passthrough, \e gated or \e staging. /// \arg \c BT Stream's basis time: snapshot stream creation or dynamic stream time basis. /// \arg \c C Time the stream was created. /// \arg \c BN Basis stream name. /// \arg \c BI Basis stream ID number. /// \arg \c D Depot name. /// \arg \c DY \e True if dynamic, \e False in the case of workspace, snapshot or passthrough. /// \arg \c H \e True if stream is hidden, \e False otherwise. /// \arg \c DG \e True if stream has a default group, \e False otherwise. public string ToString(string format, IFormatProvider provider) { if (provider != null) { ICustomFormatter fmt = provider.GetFormat(this.GetType()) as ICustomFormatter; if (fmt != null) { return(fmt.Format(format, this, provider)); } } if (String.IsNullOrEmpty(format)) { format = "G"; } switch (format.ToUpperInvariant()) { case "G": // stream name; default when not using a format specifier return(Name); // general format should be short since it can be called by anything case "LV": // long version (verbose) return($"{Name} ({ID}) {{{Type}}} {Time}{Environment.NewLine}" + $"Basis: {BasisName} ({BasisID}){Environment.NewLine}" + $"Depot: {Depot}, Hidden: {Hidden}{(Hidden ? String.Empty : ", HasDefaultGroup: " + HasDefaultGroup)}"); case "I": // stream's ID number return(ID.ToString()); case "T": // type of stream: unknown, normal, dynamic, regular, workspace, snapshot, passthru, passthrough, gated, staging return(Type.ToString()); case "BT": // stream's time basis return(Time.ToString()); case "C": // stream's creation time or last time its name, time basis or state (remove, reactivate, reparent) changed return(StartTime.ToString()); case "BN": // basis stream name return(BasisName); case "BI": // basis stream ID number return(BasisID.ToString()); case "D": // depot name return(Depot.ToString()); case "DY": // true if dynamic, false in the case of workspace, snapshot or passthrough return(IsDynamic.ToString()); case "H": // True if stream is hidden, False otherwise return(Hidden.ToString()); case "DG": // True if stream has a default group, False otherwise return(HasDefaultGroup.ToString()); default: throw new FormatException($"The {format} format string is not supported."); } }
public void WriteToXml(XmlElement element) { element.SetAttribute("typeName", TypeName.FullName); element.SetAttribute("methodName", MethodName); element.SetAttribute("skipReason", ExplicitReason); element.SetAttribute("dynamic", IsDynamic.ToString()); }
public void WriteToXml(XmlElement element) { element.SetAttribute("projectId", GetProject().GetPersistentID()); element.SetAttribute("typeName", TypeName.FullName); element.SetAttribute("methodName", MethodName); element.SetAttribute("skipReason", ExplicitReason); element.SetAttribute("dynamic", IsDynamic.ToString()); }
public override void SaveXml(XmlElement element) { base.SaveXml(element); SetXmlAttribute(element, AttributeNames.AssemblyLocation, AssemblyLocation); SetXmlAttribute(element, AttributeNames.TypeName, TypeName); SetXmlAttribute(element, AttributeNames.MethodName, MethodName); SetXmlAttribute(element, AttributeNames.Explicitly, explicitly.ToString()); SetXmlAttribute(element, AttributeNames.Dynamic, IsDynamic.ToString()); }
public override void SaveXml(XmlElement element) { base.SaveXml(element); SetXmlAttribute(element, AttributeNames.ProjectId, ProjectId); SetXmlAttribute(element, AttributeNames.TypeName, TypeName); SetXmlAttribute(element, AttributeNames.MethodName, MethodName); SetXmlAttribute(element, AttributeNames.Explicitly, explicitly.ToString()); SetXmlAttribute(element, AttributeNames.Dynamic, IsDynamic.ToString()); }