Ejemplo n.º 1
0
 private void BtnActivate_Click(object sender, EventArgs e)
 {
     if (TxtKey.Text.Trim() == string.Empty)
     {
         ShowDialog("Input Licensing Key", Telerik.WinControls.RadMessageIcon.Info);
         return;
     }
     string key = TxtKey.Text.Trim();
     if (!string.IsNullOrEmpty(key))
     {
         EncryptedLicenseProvider provider = new EncryptedLicenseProvider();
         EncryptedLicenseProvider.SetParameters(MyConfiguration.LICENSE_PARAMETERS);
         EncryptedLicense license = provider.InstallLicense(MyConfiguration.licenseFile, key);
         if (license == null)
         {
             ShowDialog("Invalid License Key Entered", Telerik.WinControls.RadMessageIcon.Info);
             return;
         }
         else
         {
             ShowDialog("Activated Successfully", Telerik.WinControls.RadMessageIcon.Info);
             this.Hide();
             Application.DoEvents();
             Installer Frm = new Installer();
             Frm.ShowDialog();
             Application.Exit();
         }
     }
 }
        static public void Main(string[] args)
        {
            var installer = new Installer("DesktopApplication", "DesktopApplication installer", new Guid("5A151BE2-2AEE-40CB-9552-CF5DD00E1BCA"));

            installer.InstallerProject.SourceBaseDir = @"..\..\..\..\DesktopApplication";
            
            //Environment.SetEnvironmentVariable("bin", @"bin\$(var.Platform)\$(var.Configuration)");
            //Environment.SetEnvironmentVariable("bin", @"bin\$(Platform)\$(Configuration)");

            /*
            var t = Environment.GetEnvironmentVariable("$(Configuration)");
            t = Environment.GetEnvironmentVariable("$(Platform)");
            */

            Environment.SetEnvironmentVariable("bin", string.Format(@"bin\{0}\{1}", installer.ActivePlatformName, installer.ActiveConfigurationName));

            var dirPath = string.Format(@"{0}\{1}\{2}", "%ProgramFiles%", installer.InstallerProject.ControlPanelInfo.Manufacturer, installer.InstallerProject.Name);

            installer.InstallerProject.Dirs = new[] { new Dir(dirPath, new Files(@"%bin%\*")) };

            Compiler.PreserveTempFiles = true;

            var str = Compiler.BuildWxs(installer.InstallerProject);
            Console.WriteLine(str);

            str = Compiler.BuildMsi(installer.InstallerProject);
            Console.WriteLine(str);
        }
Ejemplo n.º 3
0
 private void BtnContEval_Click(object sender, EventArgs e)
 {
     this.Hide();
     Application.DoEvents();
     Installer Frm = new Installer();
     Frm.ShowDialog();
     Application.Exit();
 }
Ejemplo n.º 4
0
        public void Setup()
        {
            var files = Directory.GetFiles(".", "*.lnk");

            files.Each(File.Delete);

            installer = new Installer.Installer();
            installer.KnownFolderDesktop  = Path.GetFullPath(".");
            installer.KnownFolderPrograms = Path.GetFullPath(".");
            installer.BuildShortcuts();
        }
Ejemplo n.º 5
0
 private void Licensing_Load(object sender, EventArgs e)
 {
     if (!MyConfiguration.SkipLicensing)
     {
         EvaluationDialog evaluationDialog = new EvaluationDialog(MyConfiguration.Application_Title,MyConfiguration.Application_Title);
         LblDuration.Text = "You are on the day " + evaluationDialog.EvaluationMonitor.DaysInUse +" out of 30 day evaluation";
         this.Height = PnlDisplay.Height + 25;
         Application.DoEvents();
     }
     else
     {
         this.Hide();
         Application.DoEvents();
         Installer Frm = new Installer();
         Frm.ShowDialog();
         Application.Exit();
     }
 }
Ejemplo n.º 6
0
        public static void RunProperMode(Command command)
        {
            if (command.ContainsCommandArg("/Uninstall")) { // Are we in uninstall-mode?
                UninstallHelper uninstallHelper = new UninstallHelper();
                uninstallHelper.RunUninstall();
            } else if (command.ContainsCommandArg("-silentinstall")) {
                Globals.InPortableMode = command["-portable"].ToBool();
                Globals.IsSilentInstall = true;
                NamedPipeClientStream pipeClient = new NamedPipeClientStream(".", "www.pmuniverse.net-installer", PipeDirection.InOut, PipeOptions.None, System.Security.Principal.TokenImpersonationLevel.Impersonation);
                pipeClient.Connect();
                Pipes.StreamString clientStream = new Pipes.StreamString(pipeClient);
                Globals.SilentInstallCommunicationPipeStream = clientStream;
                Globals.SilentInstallCommunicationPipe = pipeClient;
                installWaitEvent = new ManualResetEvent(false);
                Installer installer = new Installer(command);
                installer.InstallComplete += new EventHandler(installer_InstallComplete);
                installer.Install(clientStream);

                installWaitEvent.WaitOne();

                clientStream.WriteString("[InstallComplete]");

                pipeClient.WaitForPipeDrain();
                pipeClient.Close();

                System.Environment.Exit(0);
            } else {
                // There are no special command line arguments, run the installer in install mode
                // Let's check if we elevated ourselves
                if (!Globals.CommandLine.ContainsCommandArg("/skipwelcome") || !VistaSecurity.IsAdmin()) {
                    // Show the welcome page
                    PageManager.ActivePage = new Pages.pgeWelcome();
                } else {
                    // Show the license page
                    PageManager.ActivePage = new Pages.pgeLicense();
                }
            }
        }
Ejemplo n.º 7
0
 public void Run(Installer main)
 {
     main.DisableButtons();
     main.SetProgress(0);
     main.SetProgressVisible(true);
     result = null;
     BackgroundWorker background = new BackgroundWorker();
     background.WorkerReportsProgress = true;
     background.DoWork += DoWork;
     background.ProgressChanged += ProgressChanged;
     background.RunWorkerCompleted += RunWorkerCompleted;
     DoWorkArgs args = new DoWorkArgs();
     args.background = background;
     args.main = main;
     background.RunWorkerAsync(args);
     while (!result.HasValue)
     {
         Application.DoEvents();
     }
     main.SetProgressVisible(false);
     main.SetHeader("");
     main.SetMessage("");
     main.ReenableButtons();
 }
Ejemplo n.º 8
0
        protected override bool DoTask(DoWorkArgs args)
        {
            string file = Installer.GetPath();

            if (!File.Exists(file))
            {
                MessageBox.Show("The file " + file + " does not exist.", "Installation Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            ProgressChangedArgs pass = new ProgressChangedArgs();

            pass.main        = args.main;
            pass.header      = "";
            pass.maxProgress = 6;
            if (Installer.platform == Platform.WINDOWS)
            {
                pass.maxProgress += 5;
            }
            else
            {
                pass.maxProgress += 10;
            }
            pass.message = "Backing up Terraria";
            ReportProgress(args.background, 0, pass);
            string directory  = Path.GetDirectoryName(file) + Path.DirectorySeparatorChar;
            string backupFile = directory + "Terraria_" + Installer.version + ".exe";

            if (!File.Exists(backupFile))
            {
                File.Copy(file, backupFile);
            }
            pass.message = "Backing up Terraria even more";
            ReportProgress(args.background, -1, pass);
            Directory.CreateDirectory("Resources");
            ZipFile zip = new ZipFile("Resources" + Path.DirectorySeparatorChar + "Backups");

            zip["Vanilla"] = File.ReadAllBytes(file);
            pass.header    = "Reading Install resources";
            string resourceFile = "Resources" + Path.DirectorySeparatorChar + "Install";

            if (!File.Exists(resourceFile))
            {
                MessageBox.Show("Could not find installation resource file", "Installation Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            ZipFile resources = ZipFile.Read(resourceFile, this, args, pass);

            pass.header  = " ";
            pass.message = "Installing...";
            ReportProgress(args.background, -1, pass);
            if (!HasAllFiles(Installer.platform, resources))
            {
                return(false);
            }
            string contentFolder = directory + "Content" + Path.DirectorySeparatorChar + "ModLoader";

            Directory.CreateDirectory(contentFolder);
            contentFolder += Path.DirectorySeparatorChar;
            if (Installer.platform == Platform.WINDOWS)
            {
                File.WriteAllBytes(file, resources["Windows.exe"]);
                ReportProgress(args.background, -1, pass);
                File.WriteAllBytes(contentFolder + "MysteryItem.png", resources["Content/MysteryItem.png"]);
            }
            else if (Installer.platform == Platform.MAC)
            {
                File.WriteAllBytes(file, resources["Mac.exe"]);
                ReportProgress(args.background, -1, pass);
                File.WriteAllBytes(directory, resources["MP3Sharp.dll"]);
                ReportProgress(args.background, -1, pass);
                File.WriteAllBytes(contentFolder + "MysteryItem.png", resources["Content/MysteryItem.png"]);
            }
            else if (Installer.platform == Platform.LINUX)
            {
                File.WriteAllBytes(file, resources["Linux.exe"]);
                ReportProgress(args.background, -1, pass);
                File.WriteAllBytes(directory, resources["MP3Sharp.dll"]);
                ReportProgress(args.background, -1, pass);
                File.WriteAllBytes(contentFolder + "MysteryItem.png", resources["Content/MysteryItem.png"]);
            }
            pass.message = "Backing up tModLoader";
            ReportProgress(args.background, -1, pass);
            pass.header       = "Saving backups";
            zip["tModLoader"] = File.ReadAllBytes(file);
            zip.Write(this, args, pass);
            MessageBox.Show("Success!", "Install", MessageBoxButtons.OK, MessageBoxIcon.Information);
            return(true);
        }
Ejemplo n.º 9
0
        protected override bool DoTask(DoWorkArgs args)
        {
            string file = Installer.GetPath();

            if (!File.Exists(file))
            {
                MessageBox.Show("The file " + file + " does not exist.", "Installation Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            ProgressChangedArgs pass = new ProgressChangedArgs();

            pass.main        = args.main;
            pass.header      = "Reading Install resources";
            pass.maxProgress = 2;
            if (Installer.platform == Platform.WINDOWS)
            {
                pass.maxProgress += 5;
            }
            else
            {
                pass.maxProgress += 12;
            }
            pass.message = "";
            ReportProgress(args.background, 0, pass);
            string resourceFile = "Resources" + Path.DirectorySeparatorChar + "Install";

            if (!File.Exists(resourceFile))
            {
                MessageBox.Show("Could not find installation resource file", "Installation Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            ZipFile resources = ZipFile.Read(resourceFile, this, args, pass);

            pass.header  = " ";
            pass.message = "Installing";
            ReportProgress(args.background, -1, pass);
            if (!HasAllFiles(Installer.platform, resources))
            {
                return(false);
            }
            string directory = Path.GetDirectoryName(file) + Path.DirectorySeparatorChar;

            if (Installer.platform == Platform.WINDOWS)
            {
                File.WriteAllBytes(directory + "TerrariaMac.exe", resources["Mac.exe"]);
                ReportProgress(args.background, -1, pass);
                File.WriteAllBytes(directory + "FNA.dll", resources["FNA.dll"]);
            }
            else
            {
                File.WriteAllBytes(directory + "TerrariaWindows.exe", resources["Windows.exe"]);
                ReportProgress(args.background, -1, pass);
                string fileToWrite = "Microsoft.Xna.Framework.dll";
                File.WriteAllBytes(directory + fileToWrite, resources[fileToWrite]);
                ReportProgress(args.background, -1, pass);
                fileToWrite = "Microsoft.Xna.Framework.Game.dll";
                File.WriteAllBytes(directory + fileToWrite, resources[fileToWrite]);
                ReportProgress(args.background, -1, pass);
                fileToWrite = "Microsoft.Xna.Framework.Graphics.dll";
                File.WriteAllBytes(directory + fileToWrite, resources[fileToWrite]);
                ReportProgress(args.background, -1, pass);
                fileToWrite = "Microsoft.Xna.Framework.Xact.dll";
                File.WriteAllBytes(directory + fileToWrite, resources[fileToWrite]);
            }
            pass.message = "Done";
            ReportProgress(args.background, -1, pass);
            MessageBox.Show("Success!", "Install", MessageBoxButtons.OK, MessageBoxIcon.Information);
            return(true);
        }
Ejemplo n.º 10
0
 private void Installer_Load(object sender, EventArgs e)
 {
     var ME = new Installer();
     Console.WriteLine("Installing Pass Tools.");
     string installPath = "C:\\PassTools";
     string installerPath = Directory.GetCurrentDirectory();
     Console.WriteLine(installerPath.ToString());
     string executablePath = installerPath + "\\PassTools.exe";
     string iconPath = installerPath + "\\Icon.ico";
     string passtoolsPath = "C:\\PassTools\\PassTools.exe";
     string desktopDir = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
     string startDir = Environment.GetFolderPath(Environment.SpecialFolder.StartMenu);
     string shortcutStartLocation = System.IO.Path.Combine(startDir, "Pass Tools" + ".lnk");
     string shortcutDesktopLocation = System.IO.Path.Combine(desktopDir, "Pass Tools" + ".lnk");
     pbProgress.Value = 10;
     //Check if PassTools exists
     if (System.IO.File.Exists(executablePath) == false)
     {
         string reason = "Executable is missing!";
         MessageBox.Show(reason, "Installation Failed");
         installFailed(reason);
         return;
     }
     //Checks if there is a previous installation
     pbProgress.Value = 20;
     if (Directory.Exists(installPath) == true)
     {
         DialogResult deleteOld;
         deleteOld = MessageBox.Show("Remove previous Pass Tools installation?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk);
         if (deleteOld == DialogResult.No)
         {
             string reason = "Installation aborted.";
             MessageBox.Show(reason, "Installation Failed");
             installFailed(reason);
             return;
         }
         else
         {
             Directory.Delete(installPath, true);
             Directory.CreateDirectory(installPath);
         }
     }
     else
     {
         Directory.CreateDirectory(installPath);
     }
     //Install!
     pbProgress.Value = 30;
     System.IO.File.Copy(executablePath, passtoolsPath);
     WshShell startShell = new WshShell();
     pbProgress.Value = 40;
     try
     {
         IWshShortcut startShortcut = (IWshShortcut)startShell.CreateShortcut(shortcutStartLocation);
         startShortcut.Description = "Pass Tools";
         startShortcut.IconLocation = iconPath;
         startShortcut.TargetPath = passtoolsPath;
         startShortcut.Save();
         pbProgress.Value = 50;
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
     try
     {
         IWshShortcut desktopShortcut = (IWshShortcut)startShell.CreateShortcut(shortcutDesktopLocation);
         desktopShortcut.Description = "Pass Tools";
         desktopShortcut.IconLocation = iconPath;
         desktopShortcut.TargetPath = passtoolsPath;
         desktopShortcut.Save();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
     txtInstall.Text = "Installation succeded";
     pbProgress.Value = 100;
 }