add api to mare, change all to file scoped namespace
This commit is contained in:
		| @@ -6,27 +6,26 @@ using System.Reflection; | ||||
| using System.Text; | ||||
| using System.Threading.Tasks; | ||||
|  | ||||
| namespace MareSynchronos.Utils | ||||
| namespace MareSynchronos.Utils; | ||||
|  | ||||
| public static class VariousExtensions | ||||
| { | ||||
|     public static class VariousExtensions | ||||
|     public static DateTime GetLinkerTime(Assembly assembly) | ||||
|     { | ||||
|         public static DateTime GetLinkerTime(Assembly assembly) | ||||
|         const string BuildVersionMetadataPrefix = "+build"; | ||||
|  | ||||
|         var attribute = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>(); | ||||
|         if (attribute?.InformationalVersion != null) | ||||
|         { | ||||
|             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) | ||||
|             { | ||||
|                 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); | ||||
|                 } | ||||
|                 value = value[(index + BuildVersionMetadataPrefix.Length)..]; | ||||
|                 return DateTime.ParseExact(value, "yyyy-MM-ddTHH:mm:ss:fffZ", CultureInfo.InvariantCulture); | ||||
|             } | ||||
|  | ||||
|             return default; | ||||
|         } | ||||
|  | ||||
|         return default; | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Stanley Dimant
					Stanley Dimant