Example #1
0
        public void LaunchProcess()
        {
            ProcessStartInfo startInfo = new ProcessStartInfo();

            startInfo.FileName = RuntimeHelper.MapToCurrentLocation("Updater.exe");

            startInfo.Arguments += StartUp.defaultSettingFileOnGit + "=\"" + DefaultSettingFileOnGit + "\"";

            Process.Start(startInfo);
        }
Example #2
0
        private string GetCurrentVersion()
        {
            var localVersionFile = RuntimeHelper.MapToCurrentLocation(Constants.VersionFileName);

            var currentVersion = string.Empty;

            if (File.Exists(localVersionFile))
            {
                currentVersion = File.ReadAllText(localVersionFile);
            }

            return(currentVersion);
        }
Example #3
0
        public void StartUpdate(string[] args)
        {
            _args = args;

            settingFilePRovider.SettingFilePathOnGitHub = GetParameterValue(defaultSettingFileOnGit);

            var setting            = settingFilePRovider.GetUpdaterSettingsJason();
            var appToUpdateExeName = RuntimeHelper.GetParentProcessName();

            RuntimeHelper.KillAllProcess(appToUpdateExeName);
            var app = new AppUdaterExecuter(GetCurrentVersion(), new AppUpdaterFactory().GetAppUpdaters(setting));

            app.Execute();

            Process.Start(RuntimeHelper.MapToCurrentLocation(appToUpdateExeName));
        }
Example #4
0
        private string GetSettingFilePathFromGitHub()
        {
            GitHub gitHub = new GitHub(new HttpEngine());
            var    json   = gitHub.ReadAllText(appUpdateSettingMappingFilePath);

            var serializer = new JavaScriptSerializer();
            var lst        = serializer.Deserialize <IEnumerable <AppUpdateSettingMapping> >(json);

            var appToUpdateName = Path.GetFileNameWithoutExtension(RuntimeHelper.GetParentProcessName());

            foreach (var mapping in lst)
            {
                if (mapping.AppName.Equals(appToUpdateName, StringComparison.OrdinalIgnoreCase))
                {
                    return(mapping.SettingFile);
                }
            }

            throw new Exception("GetSettingFilePathFromGitHub Failed");
        }