32 lines
		
	
	
		
			964 B
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			964 B
		
	
	
	
		
			C#
		
	
	
	
	
	
| 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, StringComparison.Ordinal);
 | |
|             if (index > 0)
 | |
|             {
 | |
|                 value = value[(index + BuildVersionMetadataPrefix.Length)..];
 | |
|                 return DateTime.ParseExact(value, "yyyy-MM-ddTHH:mm:ss:fffZ", CultureInfo.InvariantCulture);
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         return default;
 | |
|     }
 | |
| }
 | 
