public bool Open(XRegistry ZDef) { IsLoading = true; try { XParameter Param = ZDef.Parameter("Procedures"); PM = new ProcManager(Param); NotifyChanged("ProcList"); SetBanner(); return(true); } catch (InvalidFIleException) { ProcManager.PanelMessage(ID, Res.RSTR("InvalidXML"), LogType.ERROR); } catch (Exception ex) { Logger.Log(ID, ex.Message, LogType.ERROR); } finally { IsLoading = false; } return(false); }
private void SetGranted(string Id) { RequestsSource.Any(x => { if (x.Id == Id) { x.Granted = true; return(true); } return(false); }); XParameter XParam = XGrant.Parameter(BindItem.Id); XParam.SetParameter(new XParameter(Id)); XGrant.SetParameter(XParam); XGrant.Save(); }
public void ClearTileStatus(string Id) { XParameter TileParam = XReg.Parameter(Id); if (TileParam == null) { return; } string TileId = TileParam.GetValue("tileId"); try { TileUpdater Updater = TileUpdateManager.CreateTileUpdaterForSecondaryTile(TileId); Updater.Clear(); Updater.EnableNotificationQueue(false); } catch (Exception) { } }
private void MigrateContentReaderLayout() { Shared.Storage.DeleteFile(FileLinks.ROOT_SETTING + "Layout_MainPage.xml"); Shared.Storage.DeleteFile(FileLinks.ROOT_SETTING + "Layout_NavLPage.xml"); Shared.Storage.DeleteFile(FileLinks.ROOT_SETTING + "Layout_StaffPicks.xml"); Shared.Storage.DeleteFile(FileLinks.ROOT_SETTING + "Deathblow.xml"); Shared.Storage.DeleteFile(FileLinks.ROOT_SETTING + "ReadingHistory.xml"); Shared.Storage.DeleteFile(FileLinks.ROOT_SETTING + "LocalBookStorage.xml"); Shared.Storage.DeleteFile(FileLinks.ROOT_WTEXT + "SpecialTopics.xml"); Shared.Storage.DeleteFile(FileLinks.ROOT_WTEXT + "SpecialTopics.lat"); Shared.Storage.DeleteFile(FileLinks.ROOT_WTEXT + "presslist.xml"); XRegistry XReg = new XRegistry("<xml />", FileLinks.ROOT_SETTING + "Layout_BookInfoView.xml"); GRConfig.System.TwitterConfirmed = XReg.Parameter("TwitterConfirmed")?.GetBool("val", false) == true; XParameter BgConf = XReg.Parameter("INFO_VIEW"); if (BgConf != null) { GRConfig.BookInfoView.BgContext.BgType = BgConf.GetValue("type"); GRConfig.BookInfoView.BgContext.BgValue = BgConf.GetValue("value"); } Shared.Storage.DeleteFile(XReg.Location); XReg = new XRegistry("<xml />", FileLinks.ROOT_SETTING + "Layout_ContentReader.xml"); GRConfig.ContentReader.IsRightToLeft = XReg.Parameter("IsRightToLeft")?.GetBool("enable", false) == true; GRConfig.ContentReader.IsHorizontal = XReg.Parameter("IsHorizontal")?.GetBool("enable", false) == true; BgConf = XReg.Parameter("CONTENT_READER"); if (BgConf != null) { GRConfig.BookInfoView.BgContext.BgType = BgConf.GetValue("type"); GRConfig.BookInfoView.BgContext.BgValue = BgConf.GetValue("value"); } Shared.Storage.DeleteFile(XReg.Location); }
public KeyboardController(string Name) { this.Name = Name; RegKeys = new List <Action>(); KeyDesc = new Dictionary <string, List <string> >(); XReg = new XRegistry("<help />", FileLinks.ROOT_SETTING + FileLinks.HELP); Settings = XReg.Parameter("Keyboard"); if (Settings == null) { Settings = new XParameter("Keyboard"); } AddCombo("Help", ShowHelp, VirtualKey.F1); AddCombo("Help", ShowHelp, VirtualKey.Shift, ( VirtualKey )191); }
private async Task <Book> MigrateBookSpider(string SRoot, string ZoneId, string ZItemId) { if (!Shared.Storage.FileExists(SRoot + "METADATA.xml")) { return(null); } XRegistry MetaDefs = new XRegistry("<metadata />", SRoot + "METADATA.xml"); XParameter MetaParam = MetaDefs.Parameter("METADATA"); BookInstruction BkInst = new BookInstruction(ZoneId, ZItemId); BkInst.Title = MetaParam.GetValue("Title"); BkInst.Info.Author = MetaParam.GetValue("Author"); BkInst.Info.Press = MetaParam.GetValue("Press"); BkInst.Info.LastUpdateDate = MetaParam.GetValue("LastUpdateDate"); BkInst.Info.TotalHitCount = MetaParam.GetValue("TotalHitCount"); BkInst.Info.DailyHitCount = MetaParam.GetValue("TodayHitCount"); BkInst.Info.PushCount = MetaParam.GetValue("PushCount"); BkInst.Info.FavCount = MetaParam.GetValue("FavCount"); BkInst.Info.Length = MetaParam.GetValue("Length"); BkInst.Info.LatestSection = MetaParam.GetValue("LatestSection"); BkInst.Info.LongDescription = MetaParam.GetValue("Intro"); Book Entry = BkInst.Entry; await Shared.BooksDb.LoadCollectionAsync(Entry, x => x.Volumes, x => x.Index); Entry.Volumes.Clear(); XRegistry TOCDefs = new XRegistry("<metadata />", SRoot + "/" + "toc.txt"); int vi = 0; XParameter VolParam = TOCDefs.Parameter("VolInst" + vi); while (VolParam != null) { Volume Vol = new Volume() { Book = Entry, Title = VolParam.GetValue("Title"), Index = VolParam.GetSaveInt("Index"), Chapters = new List <Chapter>() }; Vol.Meta["ProcId"] = VolParam.GetValue("ProcId"); Vol.Meta[AppKeys.GLOBAL_VID] = Utils.Md5(Vol.Title); XParameter PParam = VolParam.Parameter("0"); for (int p = 1; PParam != null; p++) { Vol.Meta["P" + PParam.Id] = PParam.GetValue("Value"); PParam = VolParam.Parameter(p.ToString()); } string MVolHash = Utils.Md5(Vol.Title); int ei = 0; XParameter ChParam = VolParam.Parameter("EpInst" + ei); while (ChParam != null) { Chapter Ch = new Chapter() { Book = Entry, Volume = Vol, Title = ChParam.GetValue("Title"), Index = ChParam.GetSaveInt("Index") }; Ch.Meta["ProcId"] = ChParam.GetValue("ProcId"); Ch.Meta[AppKeys.GLOBAL_CID] = Utils.Md5(Ch.Title); string MChHash = Utils.Md5(Ch.Title); PParam = ChParam.Parameter("0"); for (int p = 1; PParam != null; p++) { Ch.Meta["P" + PParam.Id] = PParam.GetValue("Value"); PParam = ChParam.Parameter(p.ToString()); } Vol.Chapters.Add(Ch); string ChLocation = SRoot + MVolHash + "/" + MChHash + ".txt"; if (Shared.Storage.FileExists(ChLocation)) { ChapterContent ChCont = new ChapterContent() { Chapter = Ch, }; ChCont.Data.BytesValue = Shared.Storage.GetBytes(ChLocation); Shared.BooksDb.ChapterContents.Add(ChCont); } ChParam = VolParam.Parameter("EpInst" + (++ei)); } Entry.Volumes.Add(Vol); VolParam = TOCDefs.Parameter("VolInst" + (++vi)); } SpiderBook SBk = await SpiderBook.CreateSAsync(ZoneId, ZItemId, MetaDefs.Parameter("Procedures")); // Preserve the process state XParameter ProcState = MetaDefs.Parameter("ProcessState"); if (ProcState != null) { SBk.PSettings.SetParameter(ProcState); } SBk.PSettings.Save(); return(Entry); }