//This will set the front end version number to zero, thus requiring that it be updated next launch. public static void SetFrontEndVersionToZero() { var doc = GetXmlDoc.GetFrontEndXmlDoc(); doc.SelectSingleNode("//CurrentVersion").InnerText = "0"; doc.Save(GetPath.GetSettingsXMLPath(DTO.Enums.BackEndOrFrontEndEnum.FrontEnd)); }
private static void addSettingsDocToCache(ObjectCache cache, DTO.Enums.BackEndOrFrontEndEnum whichEnd) { CacheItemPolicy policy = createCacheItemPolicy(GetPath.GetSettingsXMLPath(whichEnd)); var doc = new XmlDocument(); try { doc.Load(GetPath.GetSettingsXMLPath(whichEnd)); } catch (FileNotFoundException) { System.Exception newException = null; switch (whichEnd) { case DTO.Enums.BackEndOrFrontEndEnum.BackEnd: newException = new DTO.Exceptions.BackEndSettingsNotFoundException(); break; case DTO.Enums.BackEndOrFrontEndEnum.FrontEnd: newException = new DTO.Exceptions.FrontEndSettingsNotFoundException(); break; } throw newException; } catch (Exception) { throw; } cache.Set(Enum.GetName(typeof(DTO.Enums.BackEndOrFrontEndEnum), whichEnd) + "SettingsDoc", doc, policy); }
//This method will return the back end xml document. internal static XmlDocument GetBackEndXmlDoc(DTO.Enums.BackEndOrFrontEndEnum whichEnd) { var doc = new XmlDocument(); try { doc.Load(GetPath.GetBackEndXMLPath(whichEnd)); } catch (DirectoryNotFoundException) { throw new DTO.Exceptions.CouldNotLocateRolloutDirectoryException(); } catch (FileNotFoundException) { throw new DTO.Exceptions.BackEndNotFoundException(); } catch (Exception) { throw; } return(doc); }
//This is a special method used for saving the Front End Doc, which will raise a special custom //exception if it cannot. internal static void saveFrontEndDoc(XmlDocument doc) { saveDoc(GetPath.GetSettingsXMLPath(DTO.Enums.BackEndOrFrontEndEnum.FrontEnd), new DTO.Exceptions.CouldNotSaveFrontEndXmlDocException(), doc); }
//This is a special method used for saving the backend.xml doc, which will raise a special custom //exception if it cannot. internal static void saveBackEndDoc(XmlDocument Doc) { saveDoc(GetPath.GetBackEndXMLPath(DTO.Enums.BackEndOrFrontEndEnum.BackEnd), new DTO.Exceptions.CouldNotSaveBackEndXmlException(), Doc); }