コード例 #1
0
        public void StopFile_Exist()
        {
            _dummies.MoveToSource("_stopn");

            string message = _action.CheckStopFile();

            Assert.AreEqual("App suspended.", message);
        }
コード例 #2
0
        private static void Main_Inner(string[] args)
        {
            // getting target path
            string targetPath = System.Reflection.Assembly.GetExecutingAssembly().Location;

            targetPath = Path.GetDirectoryName(targetPath);

            // reading configuration and arguments
            List <string> argsList     = args.ToList();
            string        sourcePath   = Properties.Settings.Default.DeploymentDirectory;
            string        manifestFile = Properties.Settings.Default.ManifestFile;
            string        startExe     = Properties.Settings.Default.StartupApplicationExe;
            bool          allowOfline  = Properties.Settings.Default.AllowOffline;

            if (string.IsNullOrWhiteSpace(startExe) == false)
            {
                argsList.Insert(0, startExe);
            }

            // ACTION: performing upgrade action
            DeployAction action = new DeployAction(sourcePath, targetPath, manifestFile, argsList, allowOfline);
            int          ix     = action.Act();

            if (ix > 0)
            {
                if (Properties.Settings.Default.ShowUpgradePopup)
                {
                    Application.Run(new UpdatePopup());
                }
            }

            // ACTION: check for stop file
            string message = action.CheckStopFile();

            if (message != null)
            {
                if (message == "")
                {
                    message = "Access to the application '" + ConstantsPR.ApplicationName + "' is temporarily suspended.";
                }
                MessageBox.Show(message, ConstantsPR.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            // ACTION: running post-upgrade commands
            action.ExecuteAfter();
        }