示例#1
0
        public void Copy_Replacing_Old_File()
        {
            /* seed both source and target */
            _pwans.MoveToSource("an", "bn");
            _pwans.MoveToTarget("ao");

            _action.Act();

            /* both files has been replaced*/
            Assert.AreEqual(true, _pwans.TargetIs("an", "bn"));
            Assert.AreEqual(false, _pwans.TargetIs("ao", "bn"));
        }
示例#2
0
        public void Copy_With_Manifest()
        {
            /* seed source */
            _pwans.MoveToSource("an", "bn", "cn", "dn", "en", "fn", "m1n");

            /* trigger update with a.txt as manifest */
            _action = new DeployAction(ConstantsPR.TestSourcePath, ConstantsPR.TestTargetPath, "m1.manifest", null, false);
            _action.Act();

            /* all file has been copied, but not cn which is absent in manifest */
            Assert.AreEqual(true, _pwans.TargetIs("an", "bn", "dn", "en", "fn"));
        }
示例#3
0
        public void PostExecute_Arguments_PassThrough()
        {
            return;

            _dummies.MoveToSource("fn");

            _action = new DeployAction(ConstantsPR.TestSourcePath, ConstantsPR.TestTargetPath, null, new List <string>()
            {
                "f.exe", "a1", "a2", "a3"
            }, false);
            _action.Act();

            /* we expect to see f.exe window with arguments a1, a2 and a3 */
            _action.ExecuteAfter();
        }
示例#4
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();
        }