Esempio n. 1
0
        public GeneralDocumentFuture(MashupParseContext context, string pathBase)
        {
            XMLTagReader xMLTagReader = context.NewTagReader(GeneralDocumentFuture.GetXMLTag());

            while (xMLTagReader.FindNextStartTag())
            {
                if (xMLTagReader.TagIs(FutureDocumentFromFilesystem.GetXMLTag()))
                {
                    if (this._documentFuture != null)
                    {
                        throw new InvalidMashupFile(context, "Too many specs in " + GeneralDocumentFuture.GetXMLTag());
                    }
                    this._documentFuture = new FutureDocumentFromFilesystem(context, pathBase);
                }
                else
                {
                    if (xMLTagReader.TagIs(FutureDocumentFromUri.GetXMLTag()))
                    {
                        if (this._documentFuture != null)
                        {
                            throw new InvalidMashupFile(context, "Too many specs in " + GeneralDocumentFuture.GetXMLTag());
                        }
                        this._documentFuture = new FutureDocumentFromUri(context);
                    }
                }
            }
            if (this._documentFuture == null)
            {
                throw new InvalidMashupFile(context, "No spec in " + GeneralDocumentFuture.GetXMLTag());
            }
        }
        public void WriteXML(MashupWriteContext context, string pathBase)
        {
            string value = FutureDocumentFromFilesystem.MakeRelativePath(pathBase, this.path);

            context.writer.WriteStartElement(FutureDocumentFromFilesystem.GetXMLTag());
            context.writer.WriteAttributeString(FutureDocumentFromFilesystem.FilenameAttr, value);
            context.writer.WriteAttributeString(FutureDocumentFromFilesystem.PageNumberAttr, this.pageNumber.ToString(CultureInfo.InvariantCulture));
            context.writer.WriteEndElement();
        }
        public FutureDocumentFromFilesystem(MashupParseContext context, string pathBase)
        {
            XMLTagReader xMLTagReader      = context.NewTagReader(FutureDocumentFromFilesystem.GetXMLTag());
            string       requiredAttribute = context.GetRequiredAttribute(FutureDocumentFromFilesystem.FilenameAttr);

            this.path       = Path.Combine(pathBase, requiredAttribute);
            this.pageNumber = context.GetRequiredAttributeInt(FutureDocumentFromFilesystem.PageNumberAttr);
            xMLTagReader.SkipAllSubTags();
            this.ValidateFilename();
        }