mirror of
https://github.com/Caraxi/mare.client.git
synced 2025-12-12 17:07:22 +01:00
add analyzers and api
This commit is contained in:
parent
3b9b260ab3
commit
260c4a48ee
34 changed files with 435 additions and 265 deletions
|
|
@ -1,31 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MareSynchronos.Utils;
|
||||
|
||||
public static class VariousExtensions
|
||||
{
|
||||
public static DateTime GetLinkerTime(Assembly assembly)
|
||||
{
|
||||
const string BuildVersionMetadataPrefix = "+build";
|
||||
|
||||
var attribute = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>();
|
||||
if (attribute?.InformationalVersion != null)
|
||||
{
|
||||
var value = attribute.InformationalVersion;
|
||||
var index = value.IndexOf(BuildVersionMetadataPrefix);
|
||||
if (index > 0)
|
||||
{
|
||||
value = value[(index + BuildVersionMetadataPrefix.Length)..];
|
||||
return DateTime.ParseExact(value, "yyyy-MM-ddTHH:mm:ss:fffZ", CultureInfo.InvariantCulture);
|
||||
}
|
||||
}
|
||||
|
||||
return default;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue