bool ReadInternal() { bool result = true; if (ProgressOutput != null) { ProgressOutput.WriteLine("Trying to read source listing {0}...", mSourceFile); } if (!File.Exists(mSourceFile)) { result = false; } else { mPkgFile = new CaPackageFile(); using (var xml = new IO.XmlElementStream(mSourceFile, FileAccess.Read, this)) { xml.InitializeAtRootElement(); PkgDefinition.Serialize(xml); } } if (result == false) { if (ProgressOutput != null) { ProgressOutput.WriteLine("\tFailed!"); } } return(result); }
void SaveListing(string workPath, string listingName) { string listing_filename = Path.Combine(workPath, listingName); using (var xml = IO.XmlElementStream.CreateForWrite("PkgFile", this)) { xml.InitializeAtRootElement(); xml.StreamMode = FileAccess.Write; PkgDefinition.Serialize(xml); xml.Document.Save(listing_filename + CaPackageFileDefinition.kFileExtension); } }