public void InitNewFile() { Properties = new DocumentProperties { NameOfPart = "Document Properties" }; TitlePage = new DocumentTitlePage { NameOfPart = "Document Title Page" }; Introduction = new DocumentIntroduction { NameOfPart = "Document Introduction" }; Summary = new DocumentSummary { NameOfPart = "Document Summary" }; Bibliography = new DocumentBibliography { NameOfPart = "Document Bibliography" }; Sections = new List <DocumentSection>(); }
public void LoadDocument(string filePath) { if (File.Exists(filePath)) { using var zip = new ZipFile(filePath); FileName = filePath; foreach (var fileName in zip.EntryFileNames) { if (fileName == "Properties.xml") { Properties = GetFile <DocumentProperties>(zip, fileName); } else if (fileName == "TitlePage.xml") { TitlePage = GetFile <DocumentTitlePage>(zip, fileName); } else if (fileName == "Introduction.xml") { Introduction = GetFile <DocumentIntroduction>(zip, fileName); } else if (fileName == "Summary.xml") { Summary = GetFile <DocumentSummary>(zip, fileName); } else if (fileName == "Bibliography.xml") { Bibliography = GetFile <DocumentBibliography>(zip, fileName); } else { if (Sections == null) { Sections = new List <DocumentSection>(); } Sections.Add(GetFile <DocumentSection>(zip, fileName)); } } } }