public RatingsDefinition(string file) { Logging.Logger.ReportInfo("Loading Certification Ratings from file " + file); this.file = file; Init(); this.settings = XmlSettings <RatingsDefinition> .Bind(this, file); }
public void NestedObjectTypeTest() { ClearConfig(); var account = new Account(); var settings = XmlSettings <Account> .Bind(account, CONFIG_FILE); var person = new Person(); person.Age = 3; person.Name = "Sam"; person.Happy = false; person.Birthdate = DateTime.Today; account.Person = person; account.Balance = 999; settings.Write(); account = new Account(); settings = XmlSettings <Account> .Bind(account, CONFIG_FILE); person = account.Person; Assert.AreEqual(account.Balance, 999); Assert.AreEqual(person.Age, 3); Assert.AreEqual(person.Name, "Sam"); Assert.AreEqual(person.Happy, false); Assert.AreEqual(person.Birthdate, DateTime.Today); }
public ConfigData(string file) { this.showInfoIcons = true; this.showInfoIconsBackground = true; this.useSeasonPoster = true; this.enableVideoBackdrop = true; this.showconfig = true; this.npvAR = "Normal"; this.themeCustomFont = "Default"; this.shownowplayingicon = true; this.showcoverflowtitle = true; this.showcoverflowdetails = true; this.disableehsmovietitle = true; this.showcoverflowlogos = false; this.showlistlogos = true; this.showposterlogos = true; this.showthumblogos = true; this.showstriplogos = true; this.showcoverflowendtime = true; this.showlistendtime = true; this.showposterendtime = true; this.showthumbendtime = true; this.showcoverflowindicator = true; this.showcoverflowposteroverlay = true; this.showcoverflowtotalnumber = true; useCustomTvView = true; this.file = file; this.ChocolateSettings = XmlSettings <ConfigData> .Bind(this, file); }
public void Load() { if (!Directory.Exists(initialPath)) { Directory.CreateDirectory(initialPath); } _instance = new T(); settings = XmlSettings <T> .Bind(Instance, configFile); }
// for our reset routine public ConfigData() { try { File.Delete(ApplicationPaths.ConfigFile); } catch (Exception e) { MediaBrowser.Library.Logging.Logger.ReportException("Unable to delete config file " + ApplicationPaths.ConfigFile, e); } //continue anyway this.file = ApplicationPaths.ConfigFile; this.settings = XmlSettings <ConfigData> .Bind(this, file); }
public void TestEnum() { ClearConfig(); Farter farter = new Farter(); XmlSettings <Farter> settings = XmlSettings <Farter> .Bind(farter, CONFIG_FILE); farter.Smell = Farts.SilentButDeadly; settings.Write(); farter = new Farter(); settings = XmlSettings <Farter> .Bind(farter, CONFIG_FILE); Assert.AreEqual(farter.Smell, Farts.SilentButDeadly); }
public void TestProperty() { ClearConfig(); Monster monster = new Monster(); XmlSettings <Monster> settings = XmlSettings <Monster> .Bind(monster, CONFIG_FILE); monster.Weapon = new Weapon(); monster.Weapon.LaserCount = 99; settings.Write(); monster = new Monster(); settings = XmlSettings <Monster> .Bind(monster, CONFIG_FILE); Assert.AreEqual(monster.Weapon.LaserCount, 99); }
public static MyStrings FromFile(string file) { MyStrings s = new MyStrings(); XmlSettings <MyStrings> settings = XmlSettings <MyStrings> .Bind(s, file); Logger.ReportInfo("Using String Data from " + file); if (VERSION != s.Version) { File.Delete(file); s = new MyStrings(); settings = XmlSettings <MyStrings> .Bind(s, file); } return(s); }
public static MyStrings FromFile(string file) { MyStrings strings = new MyStrings(); XmlSettings <MyStrings> .Bind(strings, file); Logger.ReportInfo("Using String Data from " + file); if ("1.0001" != strings.Version) { File.Delete(file); strings = new MyStrings(); XmlSettings <MyStrings> .Bind(strings, file); } return(strings); }
public static BaseStrings FromFile(string file) { BaseStrings s = new BaseStrings(); XmlSettings <BaseStrings> settings = XmlSettings <BaseStrings> .Bind(s, file); Logger.ReportInfo("Using String Data from " + file); if (VERSION != s.Version && Path.GetFileName(file).ToLower() == ENFILE) { //only re-save the english version as that is the one defined internally File.Delete(file); s = new BaseStrings(); settings = XmlSettings <BaseStrings> .Bind(s, file); } return(s); }
public void TestList() { ClearConfig(); Group group = new Group(); group.People = new List <Person>(); group.People.Add(new Person()); group.People.Add(new Person()); XmlSettings <Group> settings = XmlSettings <Group> .Bind(group, CONFIG_FILE); settings.Write(); group = new Group(); settings = XmlSettings <Group> .Bind(group, CONFIG_FILE); Assert.AreEqual(group.People.Count, 2); }
public void BasicValueTypeTest() { ClearConfig(); var person = new Person(); XmlSettings <Person> settings = XmlSettings <Person> .Bind(person, CONFIG_FILE); person.Age = 3; person.Name = "Sam"; person.Happy = false; person.Birthdate = DateTime.Today; settings.Write(); person = new Person(); settings = XmlSettings <Person> .Bind(person, CONFIG_FILE); Assert.AreEqual(person.Age, 3); Assert.AreEqual(person.Name, "Sam"); Assert.AreEqual(person.Happy, false); Assert.AreEqual(person.Birthdate, DateTime.Today); }
public MyConfigData(string file) { this.file = file; this.settings = XmlSettings <MyConfigData> .Bind(this, file); bool changed = false; //translate defintions to actual profiles foreach (ProfileDefinition def in ProfileDefs) { changed = changed | Migrate(def); Profiles.Add(def.Directory.ToLower(), new Profile(def.MovieLocation, def.SeriesLocation, def.SeasonLocation, def.EpisodeLocation, def.RemoteLocation, def.ThumbLocation, def.AlbumLocation, def.FolderLocation, def.CoverByDefinition, def.TypeMap)); } //and add in default if not already there if (!Profiles.ContainsKey("default")) { Profiles.Add("default", new Profile()); } if (changed) { this.Save(); } }
public ConfigData(string file) { this.file = file; this.settings = XmlSettings <ConfigData> .Bind(this, file); }
protected void Load() { if (String.IsNullOrEmpty(directory)) { directory = "CoverArtCase"; } switch (directory) { case "CoverArtCase": //Internal Case Is3D = false; FrameOnTop = false; RootPosition = caseRectangle; Overlay = StdOverlay; Frames = InternalCase; break; case "CoverArtOpenCase": //Internal OpenCase Is3D = true; Skew = new SkewRatios(0, .144, 1, 0, .2, 1, .95, .75); FrameOnTop = true; RootPosition = new Rectangle(70, 72, 510, 767); Overlay = BlankOverlay; RoundCorners = true; Frames = InternalOpenCase; break; //case "CoverArtCaseBD": // //Internal Case // Is3D = false; // FrameOnTop = false; // RootPosition = caseRectangle; // Overlay = StdOverlay; // Frames = new Dictionary<string, Image>() { // {"default", BDCase}, // }; // break; //case "CoverArtCaseDVD": // //Internal Case // Is3D = false; // FrameOnTop = false; // RootPosition = caseRectangle; // Overlay = StdOverlay; // Frames = new Dictionary<string, Image>() { // {"default", DVDCase}, // }; // break; //case "CoverArtCaseMinimal": // //Just the big 3 // Is3D = false; // FrameOnTop = false; // RootPosition = caseRectangle; // Overlay = StdOverlay; // Frames = new Dictionary<string, Image>() { // {"default", StdCase}, // {"DVD",DVDCase}, // {"BD",BDCase}, // {"HDDVD",HDDVDCase}, // {"SD",DVDCase}, // {"HD",BDCase} // }; // break; case "CoverArtCase3D": //Internal 3D Case Is3D = true; FrameOnTop = true; RootPosition = caseRectangle3D; Overlay = BlankOverlay; Frames = InternalCase3D; break; case "CoverArtTV": //Internal TV //Is3D = false; //FrameOnTop = false; //RootPosition = new Rectangle(45, 35, 645, 345); //Overlay = TVOverlay; //Frames = new Dictionary<string, Image>() { // {"default", TV}, //}; //break; case "CoverArtTVMB": //Internal TV with MB logo Is3D = false; FrameOnTop = true; //RoundCorners = true; RootPosition = new Rectangle(38, 38, 665, 380); Overlay = BlankOverlay; Frames = new Dictionary <string, Image>() { { "default", TVMB }, }; break; case "CoverArtTVMB3D": //Internal TV with MB logo Is3D = true; FrameOnTop = true; //RoundCorners = true; RootPosition = new Rectangle(38, 42, 585, 378); Skew = new SkewRatios(0, 0, 1, .130, 0, 1, 1, .910); Overlay = BlankOverlay; Frames = new Dictionary <string, Image>() { { "default", TVMB3D }, }; break; case "CoverArtCD": //Internal CD Is3D = false; FrameOnTop = true; RootPosition = new Rectangle(70, 15, 470, 465); Overlay = BlankOverlay; Frames = new Dictionary <string, Image>() { { "default", CD }, }; break; case "CoverArtFilm": //Internal Film Is3D = false; FrameOnTop = false; RootPosition = new Rectangle(95, 32, 553, 348); Overlay = FilmOverlay; Frames = new Dictionary <string, Image>() { { "default", Film }, }; break; case "CoverArtFilm3D": //Internal Film Is3D = true; FrameOnTop = true; RootPosition = new Rectangle(95, 30, 485, 355); Skew = new SkewRatios(0, 0, 1, .115, 0, 1, 1, .910); Overlay = BlankOverlay; Frames = new Dictionary <string, Image>() { { "default", Film3D }, }; break; case "CoverArtBorder": //Internal Film Is3D = false; FrameOnTop = false; RootPosition = new Rectangle(13, 18, 554, 351); Overlay = FilmOverlay; Frames = new Dictionary <string, Image>() { { "default", Border }, }; break; case "CoverArtFolder": //Internal Folder break; case "CoverArtClearCase": //Internal ClearCase Is3D = false; FrameOnTop = true; RoundCorners = true; RootPosition = new Rectangle(75, 25, 470, 668); Overlay = BlankOverlay; Frames = InternalClearCase; break; case "CoverArtClearCase3D": //Internal 3D ClearCase Is3D = true; FrameOnTop = true; RoundCorners = true; RootPosition = new Rectangle(72, 19, 434, 667); Overlay = BlankOverlay; Frames = InternalClearCase3D; break; //case "CoverArtClearCaseMinimal": // //Internal ClearCase // Is3D = false; // FrameOnTop = true; // RoundCorners = true; // RootPosition = new Rectangle(75, 25, 470, 668); // Overlay = BlankOverlay; // Frames = new Dictionary<string, Image>() { // {"default",ClearCase}, // {"DVD",ClearCaseDVD}, // {"BD",ClearCaseBD}, // {"HDDVD",ClearCaseHDDVD}, // {"HD",ClearCaseBD}, // {"SD",ClearCaseDVD} // }; // break; //case "CoverArtClearCasePlain": // //Internal ClearCase with just the plain one // Is3D = false; // FrameOnTop = true; // RoundCorners = true; // RootPosition = new Rectangle(75, 25, 470, 668); // Overlay = BlankOverlay; // Frames = new Dictionary<string, Image>() { // {"default",ClearCase} // }; // break; //case "CoverArtClearCaseBD": // //Internal ClearCase with just the plain one // Is3D = false; // FrameOnTop = true; // RoundCorners = true; // RootPosition = new Rectangle(75, 25, 470, 668); // Overlay = BlankOverlay; // Frames = new Dictionary<string, Image>() { // {"default",ClearCaseBD} // }; // break; //case "CoverArtClearCaseDVD": // //Internal ClearCase just DVD cover // Is3D = false; // FrameOnTop = true; // RoundCorners = true; // RootPosition = new Rectangle(75, 25, 470, 668); // Overlay = BlankOverlay; // Frames = new Dictionary<string, Image>() { // {"default", ClearCaseDVD} // }; // break; case "CoverArtRounded": //Internal Rounded Corners - only the overlay will be used JustRoundCorners = true; RootPosition = new Rectangle(0, 0, 0, 0); Overlay = GlossOverlay; Frames = new Dictionary <string, Image>() { { "default", BlankOverlay } }; break; case "CoverArtDiamond": //Internal Rounded Corners - only the overlay will be used RoundCorners = true; FrameOnTop = true; RootPosition = new Rectangle(26, 25, 470, 665); Overlay = BlankOverlay; Frames = new Dictionary <string, Image>() { { "default", Diamond }, }; break; case "CoverArtDiamondThumb": //Landscape version RoundCorners = true; FrameOnTop = true; RootPosition = new Rectangle(35, 15, 640, 370); Overlay = BlankOverlay; Frames = new Dictionary <string, Image>() { { "default", DiamondThumb }, }; break; case "CoverArtPlaque": //A glass plaque effect (good for people) RoundCorners = false; FrameOnTop = true; RootPosition = new Rectangle(83, 83, 382, 585); Overlay = BlankOverlay; Frames = new Dictionary <string, Image>() { { "default", GlassPlaque } }; break; case "Ignore": //Ignore this cover RootPosition = new Rectangle(0, 0, 0, 0); Overlay = BlankOverlay; Frames = new Dictionary <string, Image>() { { "default", BlankImage } }; break; default: //Load from directory //first get our attributes from xml string fullName = Path.Combine(directory, file); //if (!File.Exists(fullName)) //{ // //can't find xml file - either directory not valid or file not there // Logger.ReportError("CoverArt cannot find required xml definition file 'CoverArt.xml' in directory " + directory + ". Using default."); // //Use default // Is3D = false; // FrameOnTop = false; // RootPosition = new Rectangle(15, 90, 585, 750); // Overlay = Resources.Overlay; // Frames = new Dictionary<string, Image>() { // {"default", Resources.Case}, // {"BD",Resources.BD}, // {"DVD",Resources.DVD}, // {"MKV",Resources.Mkv}, // {"WMV",Resources.Wmv}, // {"AVI",Resources.Avi}, // {"HDDVD",Resources.HDDVD} // }; //} else if (Directory.Exists(directory)) { //read in settings this.settings = XmlSettings <ImageSet> .Bind(this, fullName); string filename; //look for images and read those in //first the frames foreach (string frame in FrameTypes) { filename = Path.Combine(directory, frame + ".png"); if (File.Exists(filename)) { Frames.Add(frame, Image.FromFile(filename)); } } //be sure we got at least a default if (!Frames.ContainsKey("default")) { Logger.ReportError("CoverArt - No default frame found in " + directory); Frames.Add("default", StdCase); } //now the overlay filename = Path.Combine(directory, "overlay.png"); if (File.Exists(filename)) { Overlay = Image.FromFile(filename); } else { Overlay = BlankOverlay; } } else { Logger.ReportError("CoverArt ImageSet does not exist: " + directory); //Ignore RootPosition = new Rectangle(0, 0, 0, 0); Overlay = BlankOverlay; Frames = new Dictionary <string, Image>() { { "default", BlankImage } }; } break; } //add in the special folder frame if not there if (!Frames.ContainsKey("Folder")) { Frames.Add("Folder", Frames["default"]); } }
public KeyFile(string file) { this.file = file; this.settings = XmlSettings <KeyFile> .Bind(this, file); }