Ejemplo n.º 1
0
        static public CHECK_FILE_EXISTENCE_RESULTS CheckFileExistence()
        {
            CHECK_FILE_EXISTENCE_RESULTS results;

            results.Bible = results.VersionFile = results.Walkthroughs = true;

            if (!File.Exists(FileNames.PermVersionFile))
            {
                results.VersionFile = false;
                WriteXMLFile.CreateFile(FileNames.PermVersionFile);
            }
            if (File.Exists(FileNames.tempBible))
            {
                if (File.Exists(FileNames.Bible))
                {
                    File.Delete(FileNames.Bible);
                }
                File.Move(FileNames.tempBible, FileNames.Bible);
            }
            if (!File.Exists(FileNames.Bible))
            {
                results.Bible = false;
            }
            if (!Directory.Exists(FileNames.WalkthroughsDirectory))
            {
                results.Walkthroughs = false;
            }

            return(results);
        }
Ejemplo n.º 2
0
 public static void InitialChecks()
 {
     if (File.Exists(FileNames.tempBible))
     {
         if (File.Exists(FileNames.Bible))
         {
             File.Delete(FileNames.Bible);
         }
         File.Move(FileNames.tempBible, FileNames.Bible);
     }
     if (!File.Exists(FileNames.PermVersionFile))
     {
         WriteXMLFile.CreateFile(FileNames.PermVersionFile);
     }
 }
Ejemplo n.º 3
0
        private static void Update()
        {
            try
            {
                if (DownloadLatestVersionFile())
                {
                    ReadXMLFile  oldVersion    = new ReadXMLFile(PermVersionInfoFile);
                    ReadXMLFile  latestVersion = new ReadXMLFile(TempVersionInfoFile);
                    WriteXMLFile writeVersion  = new WriteXMLFile(PermVersionInfoFile);

                    if (ShouldDownload(oldVersion.AppVersion, latestVersion.AppVersion, shouldPromptForUpgrade))
                    {
                        try
                        {
                            if (DownloadLatestAssembly())
                            {
                                writeVersion.AppGuid    = latestVersion.AppGuid;
                                writeVersion.AppVersion = latestVersion.AppVersion;
                            }
                        }
                        catch
                        {
                            writeVersion.AppGuid    = oldVersion.AppGuid;
                            writeVersion.AppVersion = oldVersion.AppVersion;
                            MessageBox.Show("Update cancelled.");
                        }
                    }
                    if (oldVersion.BibleGuid != latestVersion.BibleGuid)
                    {
                        if (DownloadBible())
                        {
                            writeVersion.BibleGuid = latestVersion.BibleGuid;
                        }
                        else
                        {
                            writeVersion.BibleGuid = oldVersion.BibleGuid;
                        }
                    }
                    if (oldVersion.DocsGuid != latestVersion.DocsGuid)
                    {
                        if (DownloadDocs())
                        {
                            writeVersion.DocsGuid = latestVersion.DocsGuid;
                        }
                        else
                        {
                            writeVersion.DocsGuid = oldVersion.DocsGuid;
                        }
                    }
                    writeVersion.Save(PermVersionInfoFile);
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message, "Error updating", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                check = true;
            }
        }