public InstallBuilder(string productName, string?companyName, string buildDir, Guid upgradeCode) { _ = buildDir ?? throw new ArgumentNullException(nameof(buildDir)); _productName = productName ?? throw new ArgumentNullException(nameof(productName)); _exeFileName = _productName + ".exe"; var assembly = Assembly.GetEntryAssembly() ?? throw new InvalidOperationException("EntryAssembly is null"); var assemblyName = assembly.GetName(); var version = assemblyName.Version; // ReSharper disable once AssignNullToNotNullAttribute var versionInfo = FileVersionInfo.GetVersionInfo(assembly.Location); var uninstallText = $"Uninstall {productName}"; const string system64FolderMsiexecExe = "[System64Folder]msiexec.exe"; const string productCode = "/x [ProductCode]"; _programMenuPath = $@"%ProgramMenu%\{productName}"; var programMenuDir = new Dir(_programMenuPath, new ExeFileShortcut(uninstallText, system64FolderMsiexecExe, productCode)); var desktopDir = new Dir(DesktopPath); companyName = companyName == null ? null : $"{companyName}\\"; _project = new ManagedProject(productName) { Dirs = new[] { new Dir($@"%ProgramFiles%\{companyName}{productName}", new Files($@"{buildDir}\*.*"), new ExeFileShortcut(uninstallText, system64FolderMsiexecExe, productCode)), programMenuDir, desktopDir }, Properties = new[] { new Property("ALLUSERS", "1"), new Property(FileName, _exeFileName) }, UpgradeCode = upgradeCode, Version = version, MajorUpgrade = new MajorUpgrade { AllowSameVersionUpgrades = false, DowngradeErrorMessage = "A later version of [ProductName] is already installed", Schedule = UpgradeSchedule.afterInstallInitialize }, MajorUpgradeStrategy = new MajorUpgradeStrategy { RemoveExistingProductAfter = Step.InstallInitialize, UpgradeVersions = VersionRange.ThisAndOlder }, ManagedUI = new ManagedUI { InstallDialogs = new ManagedDialogs { Dialogs.Welcome, Dialogs.InstallDir, Dialogs.Progress, Dialogs.Exit }, ModifyDialogs = new ManagedDialogs { Dialogs.MaintenanceType, Dialogs.Progress, Dialogs.Exit } }, ControlPanelInfo = { Manufacturer = versionInfo.CompanyName } }; }
public static IServiceCollection AddNintekCms <TSetup>(this IServiceCollection services, string connectionString) where TSetup : CmsSetup { var modelTypes = Assembly .GetEntryAssembly() .GetTypes() .Where(type => type.IsSubclassOf(typeof(Model))) .ToArray(); services.AddScoped(provider => new Bank(connectionString, modelTypes)); services.AddScoped <CmsSetup, TSetup>(); return(services); }
protected override void Load(ContainerBuilder builder) { base.Load(builder); var modelTypes = Assembly .GetEntryAssembly() .GetTypes() .Where(type => type.IsSubclassOf(typeof(Model))) .ToArray(); builder .Register(context => new Bank(_connectionString, modelTypes)) .InstancePerLifetimeScope(); }
private MappingSettings InitializeSettings(MappingSettings settings) { Assembly entryAssembly = Assembly.GetEntryAssembly(); string appDirectory = Path.GetDirectoryName(entryAssembly.Location); var assemblies = Directory.EnumerateFiles(appDirectory, "*.dll") .Select(Assembly.LoadFrom); var configuration = new ContainerConfiguration() .WithAssembly(entryAssembly) .WithAssemblies(assemblies) .WithExport <IDiffingService>(this) .WithExport <IEqualityComparer <ITypeReference> >(settings.TypeComparer); var compositionHost = configuration.CreateContainer(); settings.DiffFactory = new ElementDifferenceFactory(compositionHost); return(settings); }
/// <summary> /// Reads the necessary resources from the system and produces the author, license, build and version /// information about the application. /// </summary> /// <returns>relevant information about the application</returns> public static Pref Read() { string authors = "Michael Hoffmeister, Andreas Orzelski et al."; string licenseShort = "This software is licensed under the Apache License 2.0 (Apache-2.0)." + Environment.NewLine + "The Newtonsoft.JSON serialization is licensed under the MIT License (MIT)." + Environment.NewLine + "The QR code generation is licensed under the MIT license (MIT)." + Environment.NewLine + "The Zxing.Net Dot Matrix Code (DMC) generation is licensed " + "under the Apache License 2.0 (Apache-2.0)." + Environment.NewLine + "The Grapevine REST server framework is licensed " + "under the Apache License 2.0 (Apache-2.0)." + Environment.NewLine + "The AutomationML.Engine is licensed under the MIT license (MIT)." + "The MQTT server and client is licensed " + "under the MIT license (MIT)." + Environment.NewLine + "The IdentityModel OpenID client is licensed " + "under the Apache License 2.0 (Apache-2.0)." + Environment.NewLine + "The jose-jwt object signing and encryption is licensed " + "under the MIT license (MIT)."; string buildDate = ""; using (var stream = Assembly .GetExecutingAssembly() .GetManifestResourceStream("AasxWpfControlLibrary.Resources.BuildDate.txt")) { if (stream != null) { TextReader tr = new StreamReader(stream); string fileContents = tr.ReadToEnd(); if (fileContents.Length > 20) { fileContents = fileContents.Substring(0, 20) + ".."; } buildDate = fileContents.Trim(); } } string licenseLong = AasxPluginHelper.LoadLicenseTxtFromAssemblyDir( "LICENSE.txt", Assembly.GetEntryAssembly()); string version = "(not available)"; { // %date% in European format (e.g. during development) var m = Regex.Match(buildDate, @"(\d+)\.(\d+)\.(\d+)"); if (m.Success && m.Groups.Count >= 4) { version = "v" + ((m.Groups[3].Value.Length == 2) ? "20" : "") + m.Groups[3].Value + "-" + m.Groups[2].Value + "-" + m.Groups[1].Value; } else { // %date% in US local (e.g. from continuous integration from Github) m = Regex.Match(buildDate, @"(\d+)\/(\d+)\/(\d+)"); if (m.Success && m.Groups.Count >= 4) { version = "v" + ((m.Groups[3].Value.Length == 2) ? "20" : "") + m.Groups[3].Value + "-" + m.Groups[1].Value + "-" + m.Groups[2].Value; } } } return(new Pref(authors, licenseShort, buildDate, licenseLong, version)); }