public void TryParse_Test() { var result = ApplicationVersionHelper.TryParse(TestAppVersionStr, out var gameVersion); Assert.True(result); Assert.AreEqual(TestAppVersion, gameVersion); }
public void GameVersion_Test() { var gameVersion = ApplicationVersionHelper.GameVersion(); Assert.NotNull(gameVersion); Assert.AreEqual(TestAppVersion, gameVersion); }
public void Setup() { var harmony = new Harmony($"{nameof(ApplicationVersionUtilsTests)}.{nameof(Setup)}"); harmony.Patch(SymbolExtensions.GetMethodInfo(() => ApplicationVersionHelper.GameVersionStr()), prefix: new HarmonyMethod(DelegateHelper.GetMethodInfo(MockedGetVersionStr))); }
private static async Task Main(string[] args) { Console.WriteLine( $"Application name: {new InMemoryKeyValueConfiguration(new NameValueCollection()).GetApplicationName()}"); var version = ApplicationVersionHelper.GetAppVersion(); Console.WriteLine($"Application version AssemblyFullName: {version?.AssemblyFullName}"); Console.WriteLine($"Application version AssemblyVersion: {version?.AssemblyVersion}"); Console.WriteLine($"Application version FileVersion: {version?.FileVersion}"); Console.WriteLine($"Application version InformationalVersion: {version?.InformationalVersion}"); var assemblies = ApplicationAssemblies.FilteredAssemblies(new[] { "Arbor" }); ApplicationAssemblies.FilteredAssemblies().LoadReferenceAssemblies();
public async Task <SettingsViewModel> Handle(SettingsViewRequest request, CancellationToken cancellationToken) { var routesWithController = RouteList.GetRoutesWithController(_applicationAssemblyResolver.GetAssemblies()); var configurationValues = new ConfigurationInfo(_configuration.SourceChain, _configuration.AllKeys .OrderBy(key => key) .Select(key => new ConfigurationKeyInfo(key, _configuration[key].MakeAnonymous(key, ArborStringExtensions.DefaultAnonymousKeyWords.ToArray()), _configuration.ConfiguratorFor(key)?.GetType().Name)) .ToImmutableArray()); IEnumerable <KeyValuePair <string, string> > aspNetConfigurationValues = _aspNetConfiguration .AsEnumerable() .Where(pair => !string.IsNullOrWhiteSpace(pair.Value)) .Select(pair => new KeyValuePair <string, string>(pair.Key, pair.Value.MakeAnonymous(pair.Key, ArborStringExtensions.DefaultAnonymousKeyWords.ToArray()))); var applicationVersionInfo = ApplicationVersionHelper.GetAppVersion(); var serviceDiagnosticsRegistrations = _serviceDiagnostics.Registrations; IKeyValueConfiguration applicationMetadata = await GetApplicationMetadataAsync(cancellationToken); ServiceInstance?GetInstance(ServiceRegistrationInfo serviceRegistrationInfo) { Type registrationType = serviceRegistrationInfo.ServiceDescriptorServiceType; if (serviceRegistrationInfo.ServiceDescriptorImplementationInstance is { }) { return(new ServiceInstance(registrationType, serviceRegistrationInfo.ServiceDescriptorImplementationInstance, serviceRegistrationInfo.Module)); } if (serviceRegistrationInfo.Factory is { })
/// <summary> /// Converts string representation of the game version to an <see cref="ApplicationVersion" /> struct. /// A return value indicates whether the conversion succeeded. /// </summary> /// <param name="versionAsString">A string containing a version to convert.</param> /// <param name="version"> /// When this method returns, contains the <see cref="ApplicationVersion" /> struct equivalent /// of the version contained in <paramref name="versionAsString" />, if the conversion succeeded /// or <see langword="default" /> if the conversion failed. /// </param> /// <returns><see langword="true" /> if <paramref name="versionAsString" /> was converted successfully; otherwise <see langword="false" />.</returns> public static bool TryParse(string?versionAsString, out ApplicationVersion version) => ApplicationVersionHelper.TryParse(versionAsString, out version);
/// <summary>Gets the version of the game as string.</summary> /// <returns>A string representation of the game version.</returns> public static string GameVersionStr() => ApplicationVersionHelper.GameVersionStr();
/// <summary>Gets the game version as an <see cref="ApplicationVersion" /> struct.</summary> /// <returns> /// <see cref="ApplicationVersion" /> struct representation of the game version /// if it was successfully obtained and parsed; otherwise <see langword="null" />. /// </returns> public static ApplicationVersion?GameVersion() => ApplicationVersionHelper.GameVersion();