void SaveListing(string workPath, string listingName)
        {
            string listing_filename = Path.Combine(workPath, listingName);

            using (var xml = IO.XmlElementStream.CreateForWrite("EcfFile", this))
            {
                xml.InitializeAtRootElement();
                xml.StreamMode = FileAccess.Write;

                EcfDefinition.Serialize(xml);

                xml.Document.Save(listing_filename + EcfFileDefinition.kFileExtension);
            }
        }
Ejemplo n.º 2
0
        bool ReadInternal()
        {
            bool result = true;

            if (ProgressOutput != null)
            {
                ProgressOutput.WriteLine("Trying to read source listing {0}...", mSourceFile);
            }

            if (!File.Exists(mSourceFile))
            {
                result = false;
            }
            else
            {
                using (var xml = new IO.XmlElementStream(mSourceFile, FA.Read, this))
                {
                    xml.InitializeAtRootElement();
                    EcfDefinition.Serialize(xml);
                }

                EcfDefinition.CullChunksPossiblyWithoutFileData((chunkIndex, chunk) =>
                {
                    if (VerboseOutput != null)
                    {
                        VerboseOutput.WriteLine("\t\tCulling chunk #{0} since it has no associated file data",
                                                chunkIndex);
                    }
                });
            }

            if (result == false)
            {
                if (ProgressOutput != null)
                {
                    ProgressOutput.WriteLine("\tFailed!");
                }
            }

            return(result);
        }