public static void loadGuides() { //Extract the Guides file resource if theres no file //if (!System.IO.File.Exists(PathPlugin + "/Guides.cfg")) System.IO.File.WriteAllBytes(PathPlugin + "/Guides.cfg", Properties.Resources.Guides); lstGuides = new List <Guide>(); lstGuidePages = new List <GuidePage>(); LogFormatted(PathPlugin + "/Guides.cfg"); ConfigNode cnToLoad = ConfigNode.Load(PathPlugin + "/Guides.cfg"); LogFormatted_DebugOnly("Guides in file={0}", cnToLoad.GetNodes("GUIDE").Length); foreach (ConfigNode itemG in cnToLoad.GetNodes("GUIDE")) { Guide newGuide = new Guide(); newGuide.Title = itemG.GetValue("Title"); newGuide.Folder = itemG.GetValue("Folder"); newGuide.TargetScene = itemG.GetValue("TargetScene"); lstGuides.Add(newGuide); LogFormatted_DebugOnly("Pages in Guide={0}", itemG.GetNodes("PAGE").Length); foreach (ConfigNode itemP in itemG.GetNodes("PAGE")) { GuidePage tmp = new GuidePage(); tmp.guide = newGuide; tmp.Title = itemP.GetValue("Title"); tmp.Image = itemP.GetValue("Image"); lstGuidePages.Add(tmp); } } }
public static void loadGuides() { //Extract the Guides file resource if theres no file //if (!System.IO.File.Exists(PathPlugin + "/Guides.cfg")) System.IO.File.WriteAllBytes(PathPlugin + "/Guides.cfg", Properties.Resources.Guides); lstGuides = new List<Guide>(); lstGuidePages = new List<GuidePage>(); LogFormatted(PathPlugin + "/Guides.cfg"); ConfigNode cnToLoad = ConfigNode.Load(PathPlugin + "/Guides.cfg"); LogFormatted_DebugOnly("Guides in file={0}", cnToLoad.GetNodes("GUIDE").Length); foreach (ConfigNode itemG in cnToLoad.GetNodes("GUIDE")) { Guide newGuide = new Guide(); newGuide.Title = itemG.GetValue("Title"); newGuide.Folder = itemG.GetValue("Folder"); newGuide.TargetScene = itemG.GetValue("TargetScene"); lstGuides.Add(newGuide); LogFormatted_DebugOnly("Pages in Guide={0}", itemG.GetNodes("PAGE").Length); foreach (ConfigNode itemP in itemG.GetNodes("PAGE")) { GuidePage tmp = new GuidePage(); tmp.guide = newGuide; tmp.Title= itemP.GetValue("Title"); tmp.Image = itemP.GetValue("Image"); lstGuidePages.Add(tmp); } } }