Thursday

C# example:how to get version/created time of assembly

1, We need function like this :
  public string GetServerInfo(Assembly _assembly)
{
StringBuilder r = new StringBuilder();
try
{
r.AppendLine("Version:" + _assembly.GetName().Version.ToString());
r.Append("Build: " + System.IO.File.GetLastWriteTime(_assembly.Location).ToString("dd/MM/yyyy HH:mm"));
}
catch (Exception ex)
{
Logger.prn(ex);
}
return r.ToString();
}


Then we can call it like this :

Assembly _assembly = Assembly.GetExecutingAssembly();
string info= GetServerInfo(_assembly);

No comments:

imagemagic add text to image

rem different types of text annotations on existing images rem cyan yellow orange gold rem -gravity SouthWest rem draw text and anno...