示例#1
0
 static void Main(string[] args)
 {
     bool force = false;
     if (args.Length > 0 && args[0] == "-f")
     {
         force = true;
     }
     Updater u = new Updater(force);
     string binZipPath = GetCurrentPath() + "\\update\\bin.zip";
     KillProcesses();
     bool r = u.UnzipProgramFiles(binZipPath, GetCurrentPath());
     if (!r)
     {
         Console.WriteLine("Failed to update!");
     }
     RestoreProcesses();
 }
示例#2
0
文件: Program.cs 项目: oisy/scada
        static void Main(string[] args)
        {
            // Debug.Assert(false);
            if (args.Length == 0)
                return;

            string binZipPath = args[0];



            Updater u = new Updater();
            u.ForceReplaceConfigFiles = false;
            u.NeedUpdateConfigFiles = false;

            if (args.Length > 1)
            {
                string opt = args[1];
                if (opt.StartsWith("--"))
                {
                    if (opt.IndexOf('w') > 0)
                    {
                        u.UpdateByWatch = true;
                    }
                }
                
            }
            
            
            // TODO:
            KillProcesses();
            


            bool r = u.UnzipProgramFiles(binZipPath, Path.GetDirectoryName(GetCurrentPath()));
            if (!r)
            {
                Console.WriteLine("Failed to update!");
            }
            // TODO:
            RestoreProcesses();
        }
示例#3
0
        // Start the Install process
        private bool StartInstallProcess()
        {
            if (!CreateFolders())
            {
                return false;
            }

            Updater u = new Updater(true);
            // If Put the bin.zip @ Install Path, the Installer would unzip it into InstallPath.
            // If Put the bin.zip @ Update Path, The Update Program would update using this zip file.
            string binZipFilePath = this.GetInstallerPath() + "\\bin.zip";
            if (!u.UnzipProgramFiles(binZipFilePath, this.installPath.Text))
            {
                return false;
            }

            if (Directory.Exists(this.installPath.Text + "\\Debug"))
            {
                this.binPath = "Debug";
            }
            else if (Directory.Exists(this.installPath.Text + "\\Release"))
            {
                this.binPath = "Release";
            }

            if (!CreateTables())
            {
                return false;
            }

            if (!CreateStartupMenu())
            {
                return false;
            }

            if (CreateDesktopIcons("Scada.Main.exe", "系统设备管理器") &&
                CreateDesktopIcons("Scada.MainVision.exe", "Nuclover - SCADA"))
            {
                if (this.installMode)
                {
                    this.AddLog("安装成功!");
                    LaunchMainSettings();
                }
                else
                {
                    this.AddLog("更新成功!");
                    LaunchMainSettings();
                }

                this.Invoke(new MyInvoke((object sender, string p) =>
                {
                    this.buttonInstall.Enabled = true;
                    this.buttonInstall.Text = "关闭";
                }), null, "");

                this.finished = true;
                return true;
            }
            else
            {
                this.AddLog("安装未完成!");
                return false;
            }
        }