コード例 #1
0
ファイル: setup.cs プロジェクト: NpoSaut/netFirmwaring
        private static void Main(string[] args)
        {
            var dir = new DirectoryInfo(@"..\..\..\FirmwarePacker\bin\Release");

            string exeFileFullName = dir.EnumerateFiles("*.exe").First().FullName;
            string exeFileName = Path.GetFileName(exeFileFullName);
            Assembly assembly = Assembly.LoadFile(exeFileFullName);

            const string projectName = "FmPack";

            var mainFeature = new Feature("Программа", true) { AllowChange = false, ConfigurableDir = "INSTALLDIR" };

            var project = new Project(projectName,
                                      new Dir(mainFeature, InstallerHelper.GetSautProgramLocation(projectName),
                                              new Files(dir.FullName + "\\*.*", InstallerHelper.IsFileDesired)),

                                      // Environment Variables
                                      new EnvironmentVariable("FmPack", "\"[INSTALLDIR]" + exeFileName + "\""),

                                      // Shortcuts
                                      new Dir(mainFeature, @"%ProgramMenu%\saut",
                                              new ExeFileShortcut(projectName, "[INSTALLDIR]" + exeFileName, "") { WorkingDirectory = "INSTALLDIR" }
                                          ),
                                      new Dir(mainFeature, "%Desktop%",
                                              new ExeFileShortcut(mainFeature, projectName, "[INSTALLDIR]" + exeFileName, "")
                                              {
                                                  WorkingDirectory = "INSTALLDIR"
                                              }
                                          ))
                          {
                              DefaultFeature = mainFeature,
                              OutDir = @"..\..\..\installers"
                          };

            project.ResolveWildCards(true)
                   .FindFile(f => f.Name.EndsWith(exeFileName))
                   .First()
                   .AddAssociation(new FileAssociation("fpc", "application/firmware-project", "Открыть", "\"%1\"")
                                   {
                                       Icon = "project.ico",
                                       Description = "Файл проекта для FmPack"
                                   });

            project.SetBasicThings(new Guid("1E7AA096-4665-4BE0-A5EB-D7EE62616E38"), DotNetVersion.DotNet4);
            project.SetInterface(InstallerInterfaceKind.SelectDirectory);
            project.SetProjectInformation(assembly,
                                          @"..\..\..\FirmwarePacker\icon.ico",
                                          "https://repo.nposaut.ru/#/tools?tool=FmPack");

            string msi = Compiler.BuildMsi(project);
            InstallerHelper.SignInstaller(msi);
        }
コード例 #2
0
ファイル: Installer.cs プロジェクト: NpoSaut/netRemoteUpdater
        private static void Main(string[] args)
        {
            var dir = new DirectoryInfo(@"..\..\..\LightUpdater\bin\Release");

            string exeFileFullName = dir.EnumerateFiles("*.exe").First().FullName;
            string exeFileName = Path.GetFileName(exeFileFullName);
            Assembly assembly = Assembly.LoadFile(exeFileFullName);

            string projectName = assembly.GetCustomAttributes<AssemblyTitleAttribute>().First().Title;

            var mainFeature = new Feature("Программа", true) { AllowChange = false, ConfigurableDir = "INSTALLDIR" };

            var project = new Project(projectName,
                                      new Dir(mainFeature, InstallerHelper.GetSautProgramLocation(projectName),
                                              new Files(dir.FullName + "\\*.*", InstallerHelper.IsFileDesired)),

                                      // Shortcuts
                                      new Dir(mainFeature, @"%ProgramMenu%",
                                              new ExeFileShortcut(projectName, "[INSTALLDIR]" + exeFileName, "") { WorkingDirectory = "INSTALLDIR" },
                                              new ExeFileShortcut(projectName + " (250 кбод)", "[INSTALLDIR]" + exeFileName, "/can1:250000 /can2:250000") { WorkingDirectory = "INSTALLDIR" }
                                          ),
                                      new Dir(mainFeature, "%Desktop%",
                                              new ExeFileShortcut(mainFeature, projectName, "[INSTALLDIR]" + exeFileName, "") { WorkingDirectory = "INSTALLDIR" }
                                          ))
            {
                DefaultFeature = mainFeature,
                OutDir = @"..\..\.."
            };

            project.ResolveWildCards(true)
                   .FindFile(f => f.Name.EndsWith(exeFileName))
                   .First()
                   .AddAssociation(new FileAssociation("sfp", "application/firmware-package", "Прошить", "\"%1\"")
                   {
                       Icon = "sfp.ico",
                       Description = "Файл пакета прошивки"
                   });

            project.SetBasicThings(new Guid("B390695C-291F-4B7F-8E13-1630F2BF12F1"), DotNetVersion.DotNet4);
            project.SetInterface(InstallerInterfaceKind.SelectDirectory);
            project.SetProjectInformation(assembly,
                                          @"..\..\..\LightUpdater\icon.ico",
                                          "https://repo.nposaut.ru/#/tools?tool=CanProg");

            string msi = Compiler.BuildMsi(project);
            InstallerHelper.SignInstaller(msi);
            Console.ReadLine();
        }