//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: private ProtectedFiles InitProtectedFiles() { bool debug = true; ProtectedFiles protectedFiles = null; string filePath = SettingsApp.ProtectedFilesFileName; List <string> fileList = SettingsApp.ProtectedFilesList; //ReCreate File MODE if (SettingsApp.ProtectedFilesRecreateCSV) { protectedFiles = new ProtectedFiles(fileList, filePath); string md5FromFile = FrameworkUtils.MD5HashFile(filePath); //End Xpo Create Scheme and Fixtures, Terminate App and Request assign False to Developer Vars //string message = string.Format(@"ProtectedFiles '{1}' re-created with {2} files found! // {0}- Assign false to 'SettingsApp.ProtectedFilesRecreateCsv'. // {0}- Update logicpos.financial.library SettingsApp.ProtectedFilesFileHash with Hash: '{3}.'" // , Environment.NewLine, filePath, fileList.Count, md5FromFile //); //_log.Debug(String.Format("Protected files: [{0}]", message)); string message = string.Format(@"ProtectedFiles '{1}' re-created with {2} files found!{0}{0}Assign false to 'SettingsApp.ProtectedFilesRecreateCsv' and run app again.", Environment.NewLine, filePath, fileList.Count); ExportProtectedFiles(fileList); Utils.ShowMessageTouch(GlobalApp.WindowStartup, DialogFlags.Modal, new System.Drawing.Size(600, 350), MessageType.Info, ButtonsType.Ok, Resx.global_information, message); Environment.Exit(0); } //Dont check changed files if Developer, Uncomment to Enable //else if (SettingsApp.DeveloperMode) //{ // protectedFiles = new ProtectedFiles(filePath); //} //Use File else { protectedFiles = new ProtectedFiles(filePath); foreach (var item in protectedFiles) { if (debug) { _log.Debug(string.Format("Message: [{0}], Valid: [{1}], IsValidFile: [{2}]", item.Key, item.Value.Valid, protectedFiles.IsValidFile(item.Key))); } } List <string> getInvalidAndMissingFiles = protectedFiles.GetInvalidAndMissingFiles(fileList); if (getInvalidAndMissingFiles.Count > 0) { string filesMessage = string.Empty; for (int i = 0; i < getInvalidAndMissingFiles.Count; i++) { if (debug) { _log.Debug(string.Format("InvalidFile: [{0}]", getInvalidAndMissingFiles[i])); } filesMessage += string.Format("{0}{1}", getInvalidAndMissingFiles[i], Environment.NewLine); } //If Not IgnoreProtection, show alert and exit if (!SettingsApp.ProtectedFilesIgnoreProtection) { Utils.ShowMessageTouch(GlobalApp.WindowStartup, DialogFlags.Modal, new Size(800, 400), MessageType.Error, ButtonsType.Close, Resx.global_error, string.Format(Resx.dialog_message_error_protected_files_invalid_files_detected, filesMessage)); Environment.Exit(0); } } } return(protectedFiles); }
public MainWindow() { InitializeComponent(); Title = "Axodox " + UpdaterResources.Title; RUpdater.Text = UpdaterResources.Title; TBProgress.Text = UpdaterResources.Connecting; AnimColors = new Color[] { Colors.White, Color.FromRgb(255, 221, 0), Color.FromRgb(255, 162, 0), Color.FromRgb(238, 19, 23), Color.FromRgb(242, 7, 117), Color.FromRgb(240, 15, 236), Color.FromRgb(154, 15, 240), Color.FromRgb(21, 38, 228), Color.FromRgb(0, 149, 249), Color.FromRgb(0, 249, 187), Color.FromRgb(37, 239, 15), Color.FromRgb(168, 239, 15), Color.FromRgb(255, 221, 0) }; StartAnimation(); ExitTimer = new DispatcherTimer(); ExitTimer.Tick += ExitTimer_Tick; ExitTimer.Interval = new TimeSpan(0, 0, 1); StringDictionary settings = LoadSettings("Updater.ini"); Server = settings["Server"]; Application = settings["Application"]; PostSetupAction = settings["PostSetupAction"]; string excludedFiles = settings["ExcludedFiles"]; if (excludedFiles != null) { string[] files = excludedFiles.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); ProtectedFiles.AddRange(files); } if (Server == null || Application == null || PostSetupAction == null) { ToErrorState(UpdaterResources.UpdaterIniMissingOrCorrupt); return; } ProtectedFiles.Add("AxodoxUpdater.application"); ProtectedFiles.Add("AxodoxUpdater.exe"); ProtectedFiles.Add("AxodoxUpdater.exe.config"); ProtectedFiles.Add("AxodoxUpdater.exe.manifest"); ProtectedFiles.Add("Updater.ini"); ProtectedFiles.Add("hu-HU//AxodoxUpdater.resources.dll"); Success = false; WC = new WebClient(); WC.DownloadStringCompleted += WC_DownloadStringCompleted; UpdateState = UpdateStates.Connecting; SC = SynchronizationContext.Current; Root = Assembly.GetExecutingAssembly().Location; Root = Root.Remove(Root.LastIndexOf('\\')); rootLength = Root.Length; WC.DownloadStringAsync(new Uri(Server + "update.php?app=" + Application, UriKind.Absolute)); WC.DownloadFileCompleted += WC_DownloadFileCompleted; WC.DownloadProgressChanged += WC_DownloadProgressChanged; }