void ISaveAndLoad.Load() { string path = System.IO.Path.Combine(EbookSplited.Directory, VersionPath); if (File.Exists(path)) { Version = EbookSplited.GetEbookSplited(System.IO.File.ReadAllBytes(path)); } if (!Equals(ReferencePath, default)) { path = System.IO.Path.Combine(EbookStandaritzed.Directory, ReferencePath); if (File.Exists(path)) { Reference = EbookStandaritzed.GetEbookStandaritzed(System.IO.File.ReadAllBytes(path)); } else { Reference = new EbookStandaritzed() { Version = this.Version } }; } else { Reference = new EbookStandaritzed() { Version = this.Version }; } }
public override bool Equals(object obj) { EbookStandaritzed other = obj as EbookStandaritzed; bool equals = !Equals(other, default); if (equals) { equals = Equals(Version, other.Version); } return(equals); }
public EbookStandaritzed(EbookSplited ebookSplitedVersion, EbookSplited ebookSplitedReference = default) { if (Equals(ebookSplitedVersion, default)) { throw new NullReferenceException("se requiere un ebook splited!"); } if (Equals(ebookSplitedReference, default)) { ebookSplitedReference = ebookSplitedVersion; } Version = ebookSplitedVersion; Reference = new EbookStandaritzed() { Version = ebookSplitedReference }; CapitulosEditados = new Capitulo[Version.TotalChapters]; }
public bool IsParentValid(EbookStandaritzed parent) { bool hasParent = false; //si el parent tiene referencia a este ebook no es valido while (!hasParent && !Equals(parent.Reference, default) && !Equals(parent, parent.Reference)) { hasParent = Equals(SavePath, parent.Reference.SavePath); if (!hasParent) { parent = parent.Reference; } } return(!hasParent); }
public bool Finished(EbookStandaritzed original, EbookSplited version, int chapter) { return(GetParrafos(version, chapter).ToArray().Length == original.Version.GetContentElementsArray(chapter).Length); }