public static TabsterVersion GetVersion() { if (_version == null) { var attribute = (AssemblyInformationalVersionAttribute)Assembly.GetExecutingAssembly() .GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), false).FirstOrDefault(); _version = attribute != null ? new TabsterVersion(attribute.InformationalVersion) : new TabsterVersion(Application.ProductVersion); } return(_version); }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { if (reader.TokenType == JsonToken.String) { try { var v = new TabsterVersion((string)reader.Value); return(v); } catch (Exception) { } } return(null); }
private static string GetHeaderInfo() { var sb = new StringBuilder(); sb.AppendLine(string.Format("Tabster {0}", TabsterEnvironment.GetVersion().ToString(TabsterVersionFormatFlags.BuildString))); var types = new[] { typeof(IAsciiTablature), // Tabster.Core typeof(Data.ITablatureFile), // Tabster.Data typeof(WinForms.TablatureTextEditorBase), // Tabster.WinForms typeof(Printing.TablaturePrintDocument), // Tabster.Printing }; foreach (var type in types) { var assembly = Assembly.GetAssembly(type); var version = new TabsterVersion(assembly.GetName().Version); sb.AppendLine(string.Format("Referenced: {0} - {1}", assembly.GetName().Name, version)); } return(sb.ToString()); }
public static TabsterVersion GetVersion() { if (_version == null) { var attribute = (AssemblyInformationalVersionAttribute) Assembly.GetExecutingAssembly() .GetCustomAttributes(typeof (AssemblyInformationalVersionAttribute), false).FirstOrDefault(); _version = attribute != null ? new TabsterVersion(attribute.InformationalVersion) : new TabsterVersion(Application.ProductVersion); } return _version; }