Beispiel #1
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));
        }
Beispiel #2
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");
        }