Ejemplo n.º 1
0
 internal static string GetItemErrorInfo(System.Xml.XmlElement xmlItem)
 {
     string s = "";
     if (xmlItem.HasAttribute("assembly"))
         s = s + xmlItem.GetAttribute("assembly");
     if (xmlItem.HasAttribute("class"))
         s = s + xmlItem.GetAttribute("class");
     return s;
 }
Ejemplo n.º 2
0
 public ParsingContext(System.Xml.XmlElement node, ParsingContext parent)
 {
     this.parent = parent;
     if (node.HasAttribute("templateNs"))
         TemplateNamespace = node.GetAttribute("templateNs");
     if (node.HasAttribute("ns"))
         Namespace = node.GetAttribute("ns");
     if (node.HasAttribute("dictionary"))
         Dictionary = node.GetAttribute("dictionary");
     if (node.HasAttribute("name"))
         setName(new QName(node.GetAttribute("name"), Namespace));
 }
        public virtual Field Parse(System.Xml.XmlElement element, ParsingContext context)
        {
            if (element.HasAttribute("name"))
            {
                QName templateName = element.HasAttribute("templateNs") ? new QName(element.GetAttribute("name"), element.GetAttribute("templateNs")) : new QName(element.GetAttribute("name"), "");

                if (context.TemplateRegistry.IsDefined(templateName))
                    return new StaticTemplateReference(context.TemplateRegistry.get_Renamed(templateName));
                context.ErrorHandler.Error(Error.FastConstants.D8_TEMPLATE_NOT_EXIST, "The template \"" + templateName + "\" was not found.");
                return null;
            }
            return DynamicTemplateReference.INSTANCE;
        }
Ejemplo n.º 4
0
        public override void Configure(System.Xml.XmlElement element)
        {
            // Reflect some of the necessary protected methods on the SimpleCache class that are needed
            Type type = typeof(SimpleCache);
            getCachedItemMethod = type.GetMethod("GetCachedItem", BindingFlags.Instance | BindingFlags.NonPublic);
            purgeMethod = type.GetMethod("Purge", BindingFlags.Instance | BindingFlags.NonPublic);

            // Instantiate and configure the SimpleCache instance to be used for the local cache
            cache = new SimpleCache();
            cache.Configure(element);

            // Allow the base CacheBase class to configure itself
            base.Configure(element);

            // Check for and configure the queue
            if (element.HasAttribute("path"))
            {
                string path = element.GetAttribute("path");
                if (MessageQueue.Exists(path))
                {
                    queue = new MessageQueue(path);
                    queue.Formatter = new XmlMessageFormatter(new Type[] { typeof(CachedItem) });

                    // Start the listener thread
                    listen = true;
                    listenThread = new Thread(new ThreadStart(Listen));
                    listenThread.IsBackground = true;
                    listenThread.Start();
                }
                else
                {
                    throw new ConfigurationErrorsException("The specified queue path (" + path + ") does not exist.");
                }
            }
        }
Ejemplo n.º 5
0
 public override Field Parse(System.Xml.XmlElement fieldNode, bool optional, ParsingContext context)
 {
     Operator.Operator operator_Renamed = Operator.Operator.NONE;
     string defaultValue = null;
     string key = null;
     string ns = "";
     System.Xml.XmlElement operatorElement = GetOperatorElement(fieldNode);
     if (operatorElement != null)
     {
         if (operatorElement.HasAttribute("value"))
             defaultValue = operatorElement.GetAttribute("value");
         operator_Renamed = Operator.Operator.GetOperator(operatorElement.Name);
         if (operatorElement.HasAttribute("key"))
             key = operatorElement.GetAttribute("key");
         if (operatorElement.HasAttribute("ns"))
             ns = operatorElement.GetAttribute("ns");
         if (operatorElement.HasAttribute("dictionary"))
             context.Dictionary = operatorElement.GetAttribute("dictionary");
     }
     FASTType type = GetType(fieldNode, context);
     var scalar = new Scalar(GetName(fieldNode, context), type, operator_Renamed, type.GetValue(defaultValue), optional);
     if (fieldNode.HasAttribute("id"))
         scalar.Id = fieldNode.GetAttribute("id");
     if (key != null)
         scalar.Key = new QName(key, ns);
     scalar.Dictionary = context.Dictionary;
     ParseExternalAttributes(fieldNode, scalar);
     return scalar;
 }
Ejemplo n.º 6
0
        public SharingNode(Microsoft.Samples.FeedSync.Feed i_Feed, System.Xml.XmlElement i_SharingXmlElement)
        {
            m_Feed = i_Feed;

            m_XmlElement = i_SharingXmlElement;

            if (m_XmlElement.HasAttribute(Microsoft.Samples.FeedSync.Constants.SINCE_ATTRIBUTE))
                m_Since = m_XmlElement.GetAttribute(Microsoft.Samples.FeedSync.Constants.SINCE_ATTRIBUTE);

            if (m_XmlElement.HasAttribute(Microsoft.Samples.FeedSync.Constants.UNTIL_ATTRIBUTE))
                m_Until = m_XmlElement.GetAttribute(Microsoft.Samples.FeedSync.Constants.SINCE_ATTRIBUTE);

            if (m_XmlElement.HasAttribute(Microsoft.Samples.FeedSync.Constants.EXPIRES_ATTRIBUTE))
            {
                string Expires = m_XmlElement.GetAttribute(Microsoft.Samples.FeedSync.Constants.EXPIRES_ATTRIBUTE);
                System.DateTime ExpiresDateTime;

                if (System.DateTime.TryParse(Expires, out ExpiresDateTime))
                    m_Expires = ExpiresDateTime;
            }

            string XPathQuery = System.String.Format
                (
                "{0}:{1}",
                m_Feed.FeedSyncNamespacePrefix,
                Microsoft.Samples.FeedSync.Constants.RELATED_ELEMENT_NAME
                );

            System.Xml.XmlNodeList RelatedNodeList = i_SharingXmlElement.SelectNodes
                (
                XPathQuery,
                m_Feed.XmlNamespaceManager
                );

            foreach (System.Xml.XmlElement RelatedNodeXmlElement in RelatedNodeList)
            {
                Microsoft.Samples.FeedSync.RelatedNode RelatedNode = Microsoft.Samples.FeedSync.RelatedNode.CreateFromXmlElement
                    (
                    this,
                    RelatedNodeXmlElement
                    );

                m_RelatedNodeList.Add(RelatedNode);
            }
        }
Ejemplo n.º 7
0
        public override void Configure(System.Xml.XmlElement element)
        {
            base.Configure(element);

            if (element.HasAttribute("availableMemoryLimit"))
            {
                availableMemoryLimit = Single.Parse(element.GetAttribute("availableMemoryLimit"));
            }
            else
            {
                availableMemoryLimit = 96.0f;
            }

            if (element.HasAttribute("miserInterval"))
            {
                miserInterval = TimeSpan.Parse(element.GetAttribute("miserInterval"));
            }
            else
            {
                miserInterval = TimeSpan.FromMinutes(1);
            }

            XmlElement volatileElement = (XmlElement) element.SelectSingleNode("volatileCache");
            if (volatileElement.HasAttribute("type"))
            {
                Type type = Type.GetType(volatileElement.GetAttribute("type"));
                volatileCache = (CacheBase) type.Assembly.CreateInstance(type.FullName);
                volatileCache.Configure(volatileElement);
            }

            XmlElement persistentElement = (XmlElement) element.SelectSingleNode("persistentCache");
            if (persistentElement.HasAttribute("type"))
            {
                Type type = Type.GetType(persistentElement.GetAttribute("type"));
                persistentCache = (CacheBase) type.Assembly.CreateInstance(type.FullName);
                persistentCache.Configure(persistentElement);
            }

            Type cacheBaseType = typeof(CacheBase);
            getCachedItemMethod = cacheBaseType.GetMethod("GetCachedItem", BindingFlags.Instance | BindingFlags.NonPublic);
            purgeMethod = cacheBaseType.GetMethod("Purge", BindingFlags.Instance | BindingFlags.NonPublic);

            miserTimer = new Timer(new TimerCallback(MiserTimerCallback), null, miserInterval, miserInterval);
        }
Ejemplo n.º 8
0
 public override Field Parse(System.Xml.XmlElement templateElement, bool optional, ParsingContext context)
 {
     var messageTemplate = new MessageTemplate(getTemplateName(templateElement, context), ParseFields(templateElement, context));
     ParseMore(templateElement, messageTemplate, context);
     if (loadTemplateIdFromAuxId && templateElement.HasAttribute("id"))
     {
         try
         {
             int templateId = System.Int32.Parse(templateElement.GetAttribute("id"));
             context.TemplateRegistry.Register(templateId, messageTemplate);
         }
         catch (System.FormatException)
         {
             context.TemplateRegistry.Define(messageTemplate);
         }
     }
     else
         context.TemplateRegistry.Define(messageTemplate);
     return messageTemplate;
 }
Ejemplo n.º 9
0
		/// <summary>
		/// Load state from an XML element
		/// </summary>
		/// <param name="xmlElement">XML element containing new state</param>
		public void LoadXml(System.Xml.XmlElement xmlElement)
		{
			XmlNodeList xmlNodeList;
			
			if (xmlElement == null)
			{
				throw new ArgumentNullException("xmlElement");
			}
			if (xmlElement.HasAttribute("Algorithm"))
			{
				this.algorithm = xmlElement.GetAttribute("Algorithm");
			}
			else
			{
				this.algorithm = "";
			}

			xmlNodeList = xmlElement.SelectNodes("XPath");
			if (xmlNodeList.Count != 0)
			{
				this.xpath = xmlNodeList.Item(0).InnerText;
			}
			else
			{
				this.xpath = "";
			}
		}
Ejemplo n.º 10
0
        /// <summary>
        /// Load state from an XML element
        /// </summary>
        /// <param name="xmlElement">XML element containing new state</param>
        public void LoadXml(System.Xml.XmlElement xmlElement)
        {
            XmlNamespaceManager xmlNamespaceManager;
            XmlNodeList xmlNodeList;

            if (xmlElement == null)
            {
                throw new ArgumentNullException("xmlElement");
            }
            if (xmlElement.HasAttribute("URI"))
            {
                this.uriAttribute = xmlElement.GetAttribute("URI");
            }

            xmlNamespaceManager = new XmlNamespaceManager(xmlElement.OwnerDocument.NameTable);
            xmlNamespaceManager.AddNamespace("xsd", XadesSignedXml.XadesNamespaceUri);

            xmlNodeList = xmlElement.SelectNodes("xsd:Issuer", xmlNamespaceManager);
            if (xmlNodeList.Count != 0)
            {
                this.issuer = xmlNodeList.Item(0).InnerText;
            }

            xmlNodeList = xmlElement.SelectNodes("xsd:IssueTime", xmlNamespaceManager);
            if (xmlNodeList.Count != 0)
            {
                this.issueTime = XmlConvert.ToDateTime(xmlNodeList.Item(0).InnerText, XmlDateTimeSerializationMode.Local);
            }

            xmlNodeList = xmlElement.SelectNodes("xsd:Number", xmlNamespaceManager);
            if (xmlNodeList.Count != 0)
            {
                this.number = long.Parse(xmlNodeList.Item(0).InnerText);
            }
        }
        /// <summary>
        /// Load state from an XML element
        /// </summary>
        /// <param name="xmlElement">XML element containing new state</param>
        public void LoadXml(System.Xml.XmlElement xmlElement)
        {
            XmlNamespaceManager xmlNamespaceManager;
            XmlNodeList xmlNodeList;

            if (xmlElement == null)
            {
                throw new ArgumentNullException("xmlElement");
            }
            if (xmlElement.HasAttribute("Id"))
            {
                this.id = xmlElement.GetAttribute("Id");
            }
            else
            {
                this.id = "";
            }

            xmlNamespaceManager = new XmlNamespaceManager(xmlElement.OwnerDocument.NameTable);
            xmlNamespaceManager.AddNamespace("xsd", XadesSignedXml.XadesNamespaceUri);

            xmlNodeList = xmlElement.SelectNodes("xsd:CertRefs", xmlNamespaceManager);
            if (xmlNodeList.Count != 0)
            {
                this.certRefs = new CertRefs();
                this.certRefs.LoadXml((XmlElement)xmlNodeList.Item(0));
            }
        }
Ejemplo n.º 12
0
        private SyncNode(Microsoft.Samples.FeedSync.FeedItemNode i_FeedItemNode, System.Xml.XmlElement i_SyncNodeXmlElement)
        {
            m_FeedItemNode = i_FeedItemNode;
            m_XmlElement = i_SyncNodeXmlElement;

            m_ID = m_XmlElement.GetAttribute(Microsoft.Samples.FeedSync.Constants.ID_ATTRIBUTE);
            m_Updates = System.Convert.ToInt32(m_XmlElement.GetAttribute(Microsoft.Samples.FeedSync.Constants.UPDATES_ATTRIBUTE));

            if (m_XmlElement.HasAttribute(Microsoft.Samples.FeedSync.Constants.DELETED_ATTRIBUTE))
                m_Deleted = (m_XmlElement.GetAttribute(Microsoft.Samples.FeedSync.Constants.DELETED_ATTRIBUTE) == "true");

            if (m_XmlElement.HasAttribute(Microsoft.Samples.FeedSync.Constants.NO_CONFLICTS_ATTRIBUTE))
                m_NoConflicts = (m_XmlElement.GetAttribute(Microsoft.Samples.FeedSync.Constants.NO_CONFLICTS_ATTRIBUTE) == "true");

            string XPathQuery = System.String.Format
                (
                "{0}:{1}",
                m_FeedItemNode.Feed.FeedSyncNamespacePrefix,
                Microsoft.Samples.FeedSync.Constants.HISTORY_ELEMENT_NAME
                );

            System.Xml.XmlNodeList HistoryNodeList = i_SyncNodeXmlElement.SelectNodes
                (
                XPathQuery, 
                i_FeedItemNode.Feed.XmlNamespaceManager
                );

            foreach (System.Xml.XmlElement HistoryNodeXmlElement in HistoryNodeList)
            {
                Microsoft.Samples.FeedSync.HistoryNode HistoryNode = Microsoft.Samples.FeedSync.HistoryNode.CreateFromXmlElement
                    (
                    this,
                    HistoryNodeXmlElement
                    );

                m_HistoryNodeList.Add(HistoryNode);
            }

            if (!m_NoConflicts)
            {
                XPathQuery = System.String.Format
                    (
                    "{0}:{1}",
                    m_FeedItemNode.Feed.FeedSyncNamespacePrefix,
                    Microsoft.Samples.FeedSync.Constants.CONFLICTS_ELEMENT_NAME
                    );

                m_ConflictsNodeXmlElement = (System.Xml.XmlElement)i_SyncNodeXmlElement.SelectSingleNode
                    (
                    XPathQuery,
                    m_FeedItemNode.Feed.XmlNamespaceManager
                    );

                if (m_ConflictsNodeXmlElement != null)
                {
                    System.Xml.XmlNodeList FeedItemXmlNodeList = m_ConflictsNodeXmlElement.SelectNodes
                        (
                        m_FeedItemNode.Feed.FeedItemXPathQuery,
                        m_FeedItemNode.Feed.XmlNamespaceManager
                        );

                    foreach (System.Xml.XmlElement ConflictFeedItemNodeXmlElement in FeedItemXmlNodeList)
                    {
                        Microsoft.Samples.FeedSync.FeedItemNode ConflictFeedItemNode = this.CreateConflictItemNodeFromXmlElement(ConflictFeedItemNodeXmlElement);

                        string Key = System.String.Format
                            (
                            "{0}{1}{2}",
                            ConflictFeedItemNode.SyncNode.Updates,
                            ConflictFeedItemNode.SyncNode.TopMostHistoryNode.Sequence,
                            ConflictFeedItemNode.SyncNode.TopMostHistoryNode.By
                            );

                        if (ConflictFeedItemNode.SyncNode.TopMostHistoryNode.WhenDateTime != null)
                            Key += ((System.DateTime)ConflictFeedItemNode.SyncNode.TopMostHistoryNode.WhenDateTime);

                        if (!m_ConflictNodeList.ContainsKey(Key))
                            m_ConflictNodeList.Add(Key, ConflictFeedItemNode);
                    }
                }
            }
        }
Ejemplo n.º 13
0
        private RelatedNode(Microsoft.Samples.FeedSync.SharingNode i_SharingNode, System.Xml.XmlElement i_RelatedNodeXmlElement)
        {
            bool InvalidXmlElement =
                (i_RelatedNodeXmlElement.LocalName != Microsoft.Samples.FeedSync.Constants.RELATED_ELEMENT_NAME) ||
                (i_RelatedNodeXmlElement.NamespaceURI != Microsoft.Samples.FeedSync.Constants.FEEDSYNC_XML_NAMESPACE_URI);

            if (InvalidXmlElement)
                throw new System.Exception("Invalid xml element!");

            m_SharingNode = i_SharingNode;
            m_XmlElement = i_RelatedNodeXmlElement;

            string RelatedNodeType = i_RelatedNodeXmlElement.GetAttribute(Microsoft.Samples.FeedSync.Constants.TYPE_ATTRIBUTE);
            switch (RelatedNodeType)
            {
                case Microsoft.Samples.FeedSync.Constants.RELATED_TYPE_AGGREGATED:
                {
                    m_RelatedNodeType = Microsoft.Samples.FeedSync.RelatedNode.RelatedNodeTypes.Aggregated;
                    break;
                }

                case Microsoft.Samples.FeedSync.Constants.RELATED_TYPE_COMPLETE:
                {
                    m_RelatedNodeType = Microsoft.Samples.FeedSync.RelatedNode.RelatedNodeTypes.Complete;
                    break;
                }

                default:
                {
                    throw new System.ArgumentException("Unknown related node type: " + RelatedNodeType);
                }
            }
            
            m_Link = i_RelatedNodeXmlElement.GetAttribute(Microsoft.Samples.FeedSync.Constants.LINK_ATTRIBUTE);

            if (i_RelatedNodeXmlElement.HasAttribute(Microsoft.Samples.FeedSync.Constants.TITLE_ATTRIBUTE))
                m_Title = i_RelatedNodeXmlElement.GetAttribute(Microsoft.Samples.FeedSync.Constants.TITLE_ATTRIBUTE);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Load state from an XML element
        /// </summary>
        /// <param name="xmlElement">XML element containing new state</param>
        public void LoadXml(System.Xml.XmlElement xmlElement)
        {
            XmlNamespaceManager xmlNamespaceManager;
            XmlNodeList xmlNodeList;
            IEnumerator enumerator;
            XmlElement iterationXmlElement;
            HashDataInfo newHashDataInfo;

            if (xmlElement == null)
            {
                throw new ArgumentNullException("xmlElement");
            }

            if (xmlElement.HasAttribute("Id"))
            {
                this.id = xmlElement.GetAttribute("Id");
            }
            else
            {
                this.id = "";
            }

            xmlNamespaceManager = new XmlNamespaceManager(xmlElement.OwnerDocument.NameTable);
            xmlNamespaceManager.AddNamespace("xades", XadesSignedXml.XadesNamespaceUri);

            this.hashDataInfoCollection.Clear();
            xmlNodeList = xmlElement.SelectNodes("xades:HashDataInfo", xmlNamespaceManager);
            enumerator = xmlNodeList.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    iterationXmlElement = enumerator.Current as XmlElement;
                    if (iterationXmlElement != null)
                    {
                        newHashDataInfo = new HashDataInfo();
                        newHashDataInfo.LoadXml(iterationXmlElement);
                        this.hashDataInfoCollection.Add(newHashDataInfo);
                    }
                }
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }

            xmlNodeList = xmlElement.SelectNodes("xades:EncapsulatedTimeStamp", xmlNamespaceManager);
            if (xmlNodeList.Count != 0)
            {
                this.encapsulatedTimeStamp = new EncapsulatedPKIData("EncapsulatedTimeStamp");
                this.encapsulatedTimeStamp.LoadXml((XmlElement)xmlNodeList.Item(0));
                this.xmlTimeStamp = null;
            }
            else
            {
                xmlNodeList = xmlElement.SelectNodes("xades:XMLTimeStamp", xmlNamespaceManager);
                if (xmlNodeList.Count != 0)
                {
                    this.xmlTimeStamp = new XMLTimeStamp();
                    this.xmlTimeStamp.LoadXml((XmlElement)xmlNodeList.Item(0));
                    this.encapsulatedTimeStamp = null;

                }
                else
                {
                    throw new CryptographicException("EncapsulatedTimeStamp or XMLTimeStamp missing");
                }
            }
        }
Ejemplo n.º 15
0
 protected internal static void ParseMore(System.Xml.XmlElement groupElement, Group group, ParsingContext context)
 {
     group.ChildNamespace = context.Namespace;
     if (groupElement.HasAttribute("id"))
         group.Id = groupElement.GetAttribute("id");
     group.TypeReference = GetTypeReference(groupElement);
     ParseExternalAttributes(groupElement, group);
 }
Ejemplo n.º 16
0
		/// <summary>
		/// Configure layout from xml
		/// </summary>
		public override void FromXml(System.Xml.XmlElement element, IDictionary typeDictionary)
		{
			base.FromXml (element, typeDictionary);

			if (element.HasAttribute("Alignment"))
				this.Alignment = (ContentAlignment) Enum.Parse(typeof(ContentAlignment), element.GetAttribute("Alignment"));

			// Get border
			XmlElement xmlBorder = element["Border"];

			if (xmlBorder != null)
			{
				this.Border = new Border(this);
				this.border.FromXml(xmlBorder, typeDictionary);
			}

			// Get font
			XmlElement xmlFont  = element["Font"];

			if (xmlFont != null)
				this.font = DocumentLayout.CreateFontFromXml(xmlFont);

			// Get brush
			XmlElement xmlBrush = element["Brush"];

			if (xmlBrush != null)
				this.Brush = DocumentLayout.CreateBrushFromXml(xmlBrush);
		}
Ejemplo n.º 17
0
        private RefactorMePlease.EdgeSkeleton buildEdgeSkeletonFromXmlNode(System.Xml.XmlElement e)
        {
            var result = new RefactorMePlease.EdgeSkeleton();

            if (e.HasAttribute ("to"))
                result.IdTo = System.Convert.ToInt32 (e.Attributes["to"].InnerText);
            else
                throw new System.Exception ("Edge node does not have To attribute!");

            if (e.HasAttribute ("weight"))
                result.Weight = System.Convert.ToInt32 (e.Attributes["weight"].InnerText);
            else
                throw new System.Exception ("Edge node does not have Weight attribute!");

            return result;
        }
        private new void LoadFromXml(System.Xml.XmlElement xmlEl)
        {
            base.LoadFromXml (xmlEl);
            if(this.MdxParameters.Count!=2)
                throw new Exception("Number of references expected: 2");

            if (xmlEl.HasAttribute("O")) // backward compat
                _operator = (Operators)System.Enum.Parse(typeof(Operators), xmlEl.GetAttribute("O"));
            _value = xmlEl.GetAttribute("V");

            Initialize(_name);
        }
Ejemplo n.º 19
0
		public void Deserialize(System.Xml.XmlElement xmlElem)
		{
			if(xmlElem.HasAttribute("predefcolorscheme"))
				m_PredefinedColorScheme=(ePredefinedColorScheme)System.Xml.XmlConvert.ToInt32(xmlElem.GetAttribute("predefcolorscheme"));

			this.Refresh();

			if(xmlElem.HasAttribute("barback"))
			{
				m_BarBackground=BarFunctions.ColorFromString(xmlElem.GetAttribute("barback"));
				m_BarBackgroundCustom=true;
			}
			if(xmlElem.HasAttribute("barback2"))
			{
				m_BarBackground2=BarFunctions.ColorFromString(xmlElem.GetAttribute("barback2"));
				m_BarBackground2Custom=true;
			}
			if(xmlElem.HasAttribute("barbackga"))
			{
				m_BarBackgroundGradientAngle=System.Xml.XmlConvert.ToInt32(xmlElem.GetAttribute("barbackga"));
			}
			if(xmlElem.HasAttribute("barstripeclr"))
			{
				m_BarStripeColor=BarFunctions.ColorFromString(xmlElem.GetAttribute("barstripeclr"));
				m_BarStripeColorCustom=true;
			}
			if(xmlElem.HasAttribute("barcapback"))
			{
				m_BarCaptionBackground=BarFunctions.ColorFromString(xmlElem.GetAttribute("barcapback"));
				m_BarCaptionBackgroundCustom=true;
			}
			if(xmlElem.HasAttribute("barcapback2"))
			{
				m_BarCaptionBackground2=BarFunctions.ColorFromString(xmlElem.GetAttribute("barcapback2"));
				m_BarCaptionBackground2Custom=true;
			}
			if(xmlElem.HasAttribute("barcapbackga"))
			{
				m_BarCaptionBackgroundGradientAngle=System.Xml.XmlConvert.ToInt32(xmlElem.GetAttribute("barcapbackga"));
			}
			if(xmlElem.HasAttribute("barcapiback"))
			{
				m_BarCaptionInactiveBackground=BarFunctions.ColorFromString(xmlElem.GetAttribute("barcapiback"));
				m_BarCaptionInactiveBackgroundCustom=true;
			}
			if(xmlElem.HasAttribute("barcapiback2"))
			{
				m_BarCaptionInactiveBackground2=BarFunctions.ColorFromString(xmlElem.GetAttribute("barcapiback2"));
				m_BarCaptionInactiveBackground2Custom=true;
			}
			if(xmlElem.HasAttribute("barcapibackga"))
			{
				m_BarCaptionInactiveBackgroundGAngle=System.Xml.XmlConvert.ToInt32(xmlElem.GetAttribute("barcapibackga"));
			}
			if(xmlElem.HasAttribute("barcapitext"))
			{
				m_BarCaptionInactiveText=BarFunctions.ColorFromString(xmlElem.GetAttribute("barcapitext"));
				m_BarCaptionInactiveTextCustom=true;
			}
			if(xmlElem.HasAttribute("barcaptext"))
			{
				m_BarCaptionText=BarFunctions.ColorFromString(xmlElem.GetAttribute("barcaptext"));
				m_BarCaptionTextCustom=true;
			}
			if(xmlElem.HasAttribute("barfloatb"))
			{
				m_BarFloatingBorder=BarFunctions.ColorFromString(xmlElem.GetAttribute("barfloatb"));
				m_BarFloatingBorderCustom=true;
			}
			if(xmlElem.HasAttribute("bardockborder"))
			{
				m_BarDockedBorder=BarFunctions.ColorFromString(xmlElem.GetAttribute("bardockborder"));
				m_BarDockedBorderCustom=true;
			}
			if(xmlElem.HasAttribute("barpopupback"))
			{
				m_BarPopupBackground=BarFunctions.ColorFromString(xmlElem.GetAttribute("barpopupback"));
				m_BarPopupBackgroundCustom=true;
			}
			if(xmlElem.HasAttribute("barpopupb"))
			{
				m_BarPopupBorder=BarFunctions.ColorFromString(xmlElem.GetAttribute("barpopupb"));
				m_BarPopupBorderCustom=true;
			}
			if(xmlElem.HasAttribute("itemback"))
			{
				m_ItemBackground=BarFunctions.ColorFromString(xmlElem.GetAttribute("itemback"));
				m_ItemBackgroundCustom=true;
			}
			if(xmlElem.HasAttribute("itemback2"))
			{
				m_ItemBackground2=BarFunctions.ColorFromString(xmlElem.GetAttribute("itemback2"));
				m_ItemBackground2Custom=true;
			}
			if(xmlElem.HasAttribute("itembackga"))
			{
				m_ItemBackgroundGradientAngle=System.Xml.XmlConvert.ToInt32(xmlElem.GetAttribute("itembackga"));
			}

			if(xmlElem.HasAttribute("itemchkback"))
			{
				m_ItemCheckedBackground=BarFunctions.ColorFromString(xmlElem.GetAttribute("itemchkback"));
				m_ItemCheckedBackgroundCustom=true;
			}
			if(xmlElem.HasAttribute("itemchkback2"))
			{
				m_ItemCheckedBackground2=BarFunctions.ColorFromString(xmlElem.GetAttribute("itemchkback2"));
				m_ItemCheckedBackground2Custom=true;
			}
			if(xmlElem.HasAttribute("itemchkbackga"))
			{
				m_ItemCheckedBackgroundGradientAngle=System.Xml.XmlConvert.ToInt32(xmlElem.GetAttribute("itemchkbackga"));
			}
			if(xmlElem.HasAttribute("itemchkb"))
			{
				m_ItemCheckedBorder=BarFunctions.ColorFromString(xmlElem.GetAttribute("itemchkb"));
				m_ItemCheckedBorderCustom=true;
			}
			if(xmlElem.HasAttribute("itemchktext"))
			{
				m_ItemCheckedText=BarFunctions.ColorFromString(xmlElem.GetAttribute("itemchktext"));
				m_ItemCheckedTextCustom=true;
			}
			if(xmlElem.HasAttribute("itemdisback"))
			{
				m_ItemDisabledBackground=BarFunctions.ColorFromString(xmlElem.GetAttribute("itemdisback"));
				m_ItemDisabledBackgroundCustom=true;
			}
			if(xmlElem.HasAttribute("itemdistext"))
			{
				m_ItemDisabledText=BarFunctions.ColorFromString(xmlElem.GetAttribute("itemdistext"));
				m_ItemDisabledTextCustom=true;
			}
			if(xmlElem.HasAttribute("itemexpshadow"))
			{
				m_ItemExpandedShadow=BarFunctions.ColorFromString(xmlElem.GetAttribute("itemexpshadow"));
				m_ItemExpandedShadowCustom=true;
			}
			if(xmlElem.HasAttribute("itemexpback"))
			{
				m_ItemExpandedBackground=BarFunctions.ColorFromString(xmlElem.GetAttribute("itemexpback"));
				m_ItemExpandedBackgroundCustom=true;
			}
			if(xmlElem.HasAttribute("itemexpback2"))
			{
				m_ItemExpandedBackground2=BarFunctions.ColorFromString(xmlElem.GetAttribute("itemexpback2"));
				m_ItemExpandedBackground2Custom=true;
			}
			if(xmlElem.HasAttribute("itemexpbackga"))
			{
				m_ItemExpandedBackgroundGradientAngle=System.Xml.XmlConvert.ToInt32(xmlElem.GetAttribute("itemexpbackga"));
			}
			if(xmlElem.HasAttribute("itemexptext"))
			{
				m_ItemExpandedText=BarFunctions.ColorFromString(xmlElem.GetAttribute("itemexptext"));
				m_ItemExpandedTextCustom=true;
			}
			if(xmlElem.HasAttribute("itemexpborder"))
			{
				m_ItemExpandedBorder=BarFunctions.ColorFromString(xmlElem.GetAttribute("itemexpborder"));
				m_ItemExpandedBorderCustom=true;
			}
			if(xmlElem.HasAttribute("itemhotback"))
			{
				m_ItemHotBackground=BarFunctions.ColorFromString(xmlElem.GetAttribute("itemhotback"));
				m_ItemHotBackgroundCustom=true;
			}
			if(xmlElem.HasAttribute("itemhotback2"))
			{
				m_ItemHotBackground2=BarFunctions.ColorFromString(xmlElem.GetAttribute("itemhotback2"));
				m_ItemHotBackground2Custom=true;
			}
			if(xmlElem.HasAttribute("itemhotbackga"))
			{
				m_ItemHotBackgroundGradientAngle=System.Xml.XmlConvert.ToInt32(xmlElem.GetAttribute("itemhotbackga"));
			}
			if(xmlElem.HasAttribute("itemhotb"))
			{
				m_ItemHotBorder=BarFunctions.ColorFromString(xmlElem.GetAttribute("itemhotb"));
				m_ItemHotBorderCustom=true;
			}
			if(xmlElem.HasAttribute("itemhottext"))
			{
				m_ItemHotText=BarFunctions.ColorFromString(xmlElem.GetAttribute("itemhottext"));
				m_ItemHotTextCustom=true;
			}
			if(xmlElem.HasAttribute("itempressback"))
			{
				m_ItemPressedBackground=BarFunctions.ColorFromString(xmlElem.GetAttribute("itempressback"));
				m_ItemPressedBackgroundCustom=true;
			}
			if(xmlElem.HasAttribute("itempressback2"))
			{
				m_ItemPressedBackground2=BarFunctions.ColorFromString(xmlElem.GetAttribute("itempressback2"));
				m_ItemPressedBackground2Custom=true;
			}
			if(xmlElem.HasAttribute("itempressbackga"))
			{
				m_ItemPressedBackgroundGradientAngle=System.Xml.XmlConvert.ToInt32(xmlElem.GetAttribute("itempressbackga"));
			}
			if(xmlElem.HasAttribute("itempressb"))
			{
				m_ItemPressedBorder=BarFunctions.ColorFromString(xmlElem.GetAttribute("itempressb"));
				m_ItemPressedBorderCustom=true;
			}
			if(xmlElem.HasAttribute("itempresstext"))
			{
				m_ItemPressedText=BarFunctions.ColorFromString(xmlElem.GetAttribute("itempresstext"));
				m_ItemPressedTextCustom=true;
			}
			if(xmlElem.HasAttribute("itemsep"))
			{
				m_ItemSeparator=BarFunctions.ColorFromString(xmlElem.GetAttribute("itemsep"));
				m_ItemSeparatorCustom=true;
			}
			if(xmlElem.HasAttribute("itemtext"))
			{
				m_ItemText=BarFunctions.ColorFromString(xmlElem.GetAttribute("itemtext"));
				m_ItemTextCustom=true;
			}
			if(xmlElem.HasAttribute("menuback"))
			{
				m_MenuBackground=BarFunctions.ColorFromString(xmlElem.GetAttribute("menuback"));
				m_MenuBackgroundCustom=true;
			}
			if(xmlElem.HasAttribute("menuback2"))
			{
				m_MenuBackground2=BarFunctions.ColorFromString(xmlElem.GetAttribute("menuback2"));
				m_MenuBackground2Custom=true;
			}
			if(xmlElem.HasAttribute("menubackga"))
			{
				m_MenuBackgroundGradientAngle=System.Xml.XmlConvert.ToInt32(xmlElem.GetAttribute("menubackga"));
			}
			if(xmlElem.HasAttribute("menubarback"))
			{
				m_MenuBarBackground=BarFunctions.ColorFromString(xmlElem.GetAttribute("menubarback"));
				m_MenuBarBackgroundCustom=true;
			}
			if(xmlElem.HasAttribute("menubarback2"))
			{
				m_MenuBarBackground2=BarFunctions.ColorFromString(xmlElem.GetAttribute("menubarback2"));
				m_MenuBarBackground2Custom=true;
			}
			if(xmlElem.HasAttribute("menubarbackga"))
			{
				m_MenuBarBackgroundGradientAngle=System.Xml.XmlConvert.ToInt32(xmlElem.GetAttribute("menubarbackga"));
			}
			else m_MenuBarBackgroundGradientAngle=90;
			if(xmlElem.HasAttribute("menub"))
			{
				m_MenuBorder=BarFunctions.ColorFromString(xmlElem.GetAttribute("menub"));
				m_MenuBorderCustom=true;
			}
			if(xmlElem.HasAttribute("menuside"))
			{
				m_MenuSide=BarFunctions.ColorFromString(xmlElem.GetAttribute("menuside"));
				m_MenuSideCustom=true;
			}
			if(xmlElem.HasAttribute("menuside2"))
			{
				m_MenuSide2=BarFunctions.ColorFromString(xmlElem.GetAttribute("menuside2"));
				m_MenuSide2Custom=true;
			}
			if(xmlElem.HasAttribute("menusidega"))
			{
				m_MenuSideGradientAngle=System.Xml.XmlConvert.ToInt32(xmlElem.GetAttribute("menusidega"));
			}
			if(xmlElem.HasAttribute("menuuback"))
			{
				m_MenuUnusedBackground=BarFunctions.ColorFromString(xmlElem.GetAttribute("menuuback"));
				m_MenuUnusedBackgroundCustom=true;
			}
			if(xmlElem.HasAttribute("menuuside"))
			{
				m_MenuUnusedSide=BarFunctions.ColorFromString(xmlElem.GetAttribute("menuuside"));
				m_MenuUnusedSideCustom=true;
			}
			if(xmlElem.HasAttribute("menuuside2"))
			{
				m_MenuUnusedSide2=BarFunctions.ColorFromString(xmlElem.GetAttribute("menuuside2"));
				m_MenuUnusedSide2Custom=true;
			}
			if(xmlElem.HasAttribute("menuusidega"))
			{
				m_MenuUnusedSideGradientAngle=System.Xml.XmlConvert.ToInt32(xmlElem.GetAttribute("menuusidega"));
			}
			if(xmlElem.HasAttribute("menudtb"))
			{
				m_ItemDesignTimeBorder=BarFunctions.ColorFromString(xmlElem.GetAttribute("menudtb"));
				m_ItemDesignTimeBorderCustom=true;
			}
			if(xmlElem.HasAttribute("customback"))
			{
				m_CustomizeBackground=BarFunctions.ColorFromString(xmlElem.GetAttribute("customback"));
				m_CustomizeBackgroundCustom=true;
			}
			if(xmlElem.HasAttribute("customback2"))
			{
				m_CustomizeBackground2=BarFunctions.ColorFromString(xmlElem.GetAttribute("customback2"));
				m_CustomizeBackground2Custom=true;
			}
			if(xmlElem.HasAttribute("customtext"))
			{
				m_CustomizeText=BarFunctions.ColorFromString(xmlElem.GetAttribute("customtext"));
				m_CustomizeTextCustom=true;
			}
			if(xmlElem.HasAttribute("custombackga"))
			{
				m_CustomizeBackgroundGradientAngle=System.Xml.XmlConvert.ToInt32(xmlElem.GetAttribute("custombackga"));
			}

			// Panel Colors
			if(xmlElem.HasAttribute("panelback"))
			{
				m_PanelBackgroundCustom=true;
				m_PanelBackground=BarFunctions.ColorFromString(xmlElem.GetAttribute("panelback"));
			}
			if(xmlElem.HasAttribute("panelback2"))
			{
				m_PanelBackground2Custom=true;
				m_PanelBackground2=BarFunctions.ColorFromString(xmlElem.GetAttribute("panelback2"));
			}
			if(xmlElem.HasAttribute("panelborder"))
			{
				m_PanelBorderCustom=true;
				m_PanelBorder=BarFunctions.ColorFromString(xmlElem.GetAttribute("panelborder"));
			}
			if(xmlElem.HasAttribute("paneltext"))
			{
				m_PanelTextCustom=true;
				m_PanelText=BarFunctions.ColorFromString(xmlElem.GetAttribute("paneltext"));
			}
			if(xmlElem.HasAttribute("panelbackga"))
			{
				m_PanelBackgroundGradientAngle=System.Xml.XmlConvert.ToInt32(xmlElem.GetAttribute("panelbackga"));
			}

            // Splitter Colors
            if (xmlElem.HasAttribute("splitterback"))
            {
                m_SplitterBackgroundCustom = true;
                m_SplitterBackground = BarFunctions.ColorFromString(xmlElem.GetAttribute("Splitterback"));
            }
            if (xmlElem.HasAttribute("splitterback2"))
            {
                m_SplitterBackground2Custom = true;
                m_SplitterBackground2 = BarFunctions.ColorFromString(xmlElem.GetAttribute("Splitterback2"));
            }
            if (xmlElem.HasAttribute("splitterborder"))
            {
                m_SplitterBorderCustom = true;
                m_SplitterBorder = BarFunctions.ColorFromString(xmlElem.GetAttribute("Splitterborder"));
            }
            if (xmlElem.HasAttribute("splittertext"))
            {
                m_SplitterTextCustom = true;
                m_SplitterText = BarFunctions.ColorFromString(xmlElem.GetAttribute("Splittertext"));
            }
            if (xmlElem.HasAttribute("splitterbackga"))
            {
                m_SplitterBackgroundGradientAngle = System.Xml.XmlConvert.ToInt32(xmlElem.GetAttribute("Splitterbackga"));
            }

			// Explorer Bar Colors
			if(xmlElem.HasAttribute("exbarback"))
			{
				m_ExplorerBarBackgroundCustom=true;
				m_ExplorerBarBackground=BarFunctions.ColorFromString(xmlElem.GetAttribute("exbarback"));
			}
			if(xmlElem.HasAttribute("exbarback2"))
			{
				m_ExplorerBarBackground2Custom=true;
				m_ExplorerBarBackground2=BarFunctions.ColorFromString(xmlElem.GetAttribute("exbarback2"));
			}
			if(xmlElem.HasAttribute("exbarbackga"))
			{
				m_ExplorerBarBackgroundGradientAngle=System.Xml.XmlConvert.ToInt32(xmlElem.GetAttribute("exbarbackga"));
			}

			// Dock Site colors
			// Explorer Bar Colors
			if(xmlElem.HasAttribute("dsback"))
			{
				m_DockSiteBackColorCustom=true;
				m_DockSiteBackColor=BarFunctions.ColorFromString(xmlElem.GetAttribute("dsback"));
			}
			if(xmlElem.HasAttribute("dsback2"))
			{
				m_DockSiteBackColor2Custom=true;
				m_DockSiteBackColor2=BarFunctions.ColorFromString(xmlElem.GetAttribute("dsback2"));
			}
			if(xmlElem.HasAttribute("dsbackga"))
				m_DockSiteBackColorGradientAngle=System.Xml.XmlConvert.ToInt32(xmlElem.GetAttribute("dsbackga"));

            if (xmlElem.HasAttribute("mdisystemitemforeground"))
            {
                m_MdiSystemItemForeground = BarFunctions.ColorFromString(xmlElem.GetAttribute("mdisystemitemforeground"));
            }
            else
                m_MdiSystemItemForeground = Color.Empty;
		}
Ejemplo n.º 20
0
        /// <summary>
        /// Load state from an XML element
        /// </summary>
        /// <param name="xmlElement">XML element containing new state</param>
        public void LoadXml(System.Xml.XmlElement xmlElement)
        {
            XmlNamespaceManager xmlNamespaceManager;
            XmlNodeList xmlNodeList;

            if (xmlElement == null)
            {
                throw new ArgumentNullException("xmlElement");
            }
            if (xmlElement.HasAttribute("URI"))
            {
                this.uriAttribute = xmlElement.GetAttribute("URI");
            }

            xmlNamespaceManager = new XmlNamespaceManager(xmlElement.OwnerDocument.NameTable);
            xmlNamespaceManager.AddNamespace("xades", XadesSignedXml.XadesNamespaceUri);

            xmlNodeList = xmlElement.SelectNodes("xades:ResponderID", xmlNamespaceManager);
            if (xmlNodeList.Count != 0)
            {
                //this.responderID = xmlNodeList.Item(0).InnerText;
                XmlNode child = xmlNodeList.Item(0).ChildNodes.Item(0);

                ByKey = child.Name.Contains("ByKey");
                responderID = child.InnerText;
            }

            xmlNodeList = xmlElement.SelectNodes("xades:ProducedAt", xmlNamespaceManager);
            if (xmlNodeList.Count != 0)
            {
                this.producedAt = XmlConvert.ToDateTime(xmlNodeList.Item(0).InnerText, XmlDateTimeSerializationMode.Local);
            }
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Load state from an XML element
        /// </summary>
        /// <param name="xmlElement">XML element containing new state</param>
        public void LoadXml(System.Xml.XmlElement xmlElement)
        {
            if (xmlElement == null)
            {
                throw new ArgumentNullException("xmlElement");
            }

            if (xmlElement.HasAttribute("Qualifier"))
            {
                this.qualifier = (KnownQualifier)KnownQualifier.Parse(typeof(KnownQualifier), xmlElement.GetAttribute("Qualifier"), true);
            }
            else
            {
                this.qualifier = KnownQualifier.Uninitalized;
            }

            this.identifierUri = xmlElement.InnerText;
        }
Ejemplo n.º 22
0
		/// <summary>
		/// Load state from an XML element
		/// </summary>
		/// <param name="xmlElement">XML element containing new state</param>
		public void LoadXml(System.Xml.XmlElement xmlElement)
		{
			XmlNamespaceManager xmlNamespaceManager;
			XmlNodeList xmlNodeList;
			IEnumerator enumerator;
			XmlElement iterationXmlElement;
			EncapsulatedX509Certificate newEncapsulatedX509Certificate;
			OtherCertificate newOtherCertificate;
			
			if (xmlElement == null)
			{
				throw new ArgumentNullException("xmlElement");
			}
			if (xmlElement.HasAttribute("Id"))
			{
				this.id = xmlElement.GetAttribute("Id");
			}
			else
			{
				this.id = "";
			}

			xmlNamespaceManager = new XmlNamespaceManager(xmlElement.OwnerDocument.NameTable);
			xmlNamespaceManager.AddNamespace("xades", XadesSignedXml.XadesNamespaceUri);

			this.encapsulatedX509CertificateCollection.Clear();
			this.otherCertificateCollection.Clear();

			xmlNodeList = xmlElement.SelectNodes("xades:EncapsulatedX509Certificate", xmlNamespaceManager);
			enumerator = xmlNodeList.GetEnumerator();
			try 
			{
				while (enumerator.MoveNext()) 
				{
					iterationXmlElement = enumerator.Current as XmlElement;
					if (iterationXmlElement != null)
					{
						newEncapsulatedX509Certificate = new EncapsulatedX509Certificate();
						newEncapsulatedX509Certificate.LoadXml(iterationXmlElement);
						this.encapsulatedX509CertificateCollection.Add(newEncapsulatedX509Certificate);
					}
				}
			}
			finally 
			{
				IDisposable disposable = enumerator as IDisposable;
				if (disposable != null)
				{
					disposable.Dispose();
				}
			}

			xmlNodeList = xmlElement.SelectNodes("xades:OtherCertificate", xmlNamespaceManager);
			enumerator = xmlNodeList.GetEnumerator();
			try 
			{
				while (enumerator.MoveNext()) 
				{
					iterationXmlElement = enumerator.Current as XmlElement;
					if (iterationXmlElement != null)
					{
						newOtherCertificate = new OtherCertificate();
						newOtherCertificate.LoadXml(iterationXmlElement);
						this.otherCertificateCollection.Add(newOtherCertificate);
					}
				}
			}
			finally 
			{
				IDisposable disposable = enumerator as IDisposable;
				if (disposable != null)
				{
					disposable.Dispose();
				}
			}
		}
Ejemplo n.º 23
0
 protected internal override string GetTypeName(System.Xml.XmlElement fieldNode)
 {
     if (fieldNode.HasAttribute("charset"))
         return fieldNode.GetAttribute("charset");
     return "ascii";
 }
		private string GetOptionalAttribute(System.Xml.XmlElement element, string name, string defaultValue)
		{
			if (element.HasAttribute(name))
			{
				return element.GetAttribute(name);
			}
			return defaultValue;
		}
Ejemplo n.º 25
0
		/// <summary>
		/// Load state from an XML element
		/// </summary>
		/// <param name="xmlElement">XML element containing new state</param>
		/// <param name="counterSignedXmlElement">Element containing parent signature (needed if there are counter signatures)</param>
		public void LoadXml(System.Xml.XmlElement xmlElement, XmlElement counterSignedXmlElement)
		{
			XmlNamespaceManager xmlNamespaceManager;
			XmlNodeList xmlNodeList;
			
			if (xmlElement == null)
			{
				throw new ArgumentNullException("xmlElement");
			}
			if (xmlElement.HasAttribute("Id"))
			{
				this.id = xmlElement.GetAttribute("Id");
			}
			else
			{
				this.id = "";
			}

			xmlNamespaceManager = new XmlNamespaceManager(xmlElement.OwnerDocument.NameTable);
			xmlNamespaceManager.AddNamespace("xsd", XadesSignedXml.XadesNamespaceUri);

			xmlNodeList = xmlElement.SelectNodes("xsd:UnsignedSignatureProperties", xmlNamespaceManager);
			if (xmlNodeList.Count != 0)
			{
				this.unsignedSignatureProperties = new UnsignedSignatureProperties();
				this.unsignedSignatureProperties.LoadXml((XmlElement)xmlNodeList.Item(0), counterSignedXmlElement);
			}

			xmlNodeList = xmlElement.SelectNodes("xsd:UnsignedDataObjectProperties", xmlNamespaceManager);
			if (xmlNodeList.Count != 0)
			{
				this.unsignedDataObjectProperties = new UnsignedDataObjectProperties();
				this.unsignedDataObjectProperties.LoadXml((XmlElement)xmlNodeList.Item(0));
			}
		}
		private string GetOptionalPrevalenceBase(System.Xml.XmlElement element, string id)
		{
			if (element.HasAttribute("base"))
			{
				return element.GetAttribute("base");
			}
			return Path.Combine(GetPersonalPrevalenceFolder(), id);
		}
Ejemplo n.º 27
0
		/// <summary>
		/// Load state from an XML element
		/// </summary>
		/// <param name="xmlElement">XML element containing new state</param>
		public void LoadXml(System.Xml.XmlElement xmlElement)
		{
			XmlNamespaceManager xmlNamespaceManager;
			XmlNodeList xmlNodeList;
			
			if (xmlElement == null)
			{
				throw new ArgumentNullException("xmlElement");
			}

			if (xmlElement.HasAttribute("ObjectReference"))
			{
				this.objectReferenceAttribute = xmlElement.GetAttribute("ObjectReference");
			}
			else
			{
				this.objectReferenceAttribute = "";
				throw new CryptographicException("ObjectReference attribute missing");
			}

			xmlNamespaceManager = new XmlNamespaceManager(xmlElement.OwnerDocument.NameTable);
			xmlNamespaceManager.AddNamespace("xsd", XadesSignedXml.XadesNamespaceUri);

			xmlNodeList = xmlElement.SelectNodes("xsd:Description", xmlNamespaceManager);
			if (xmlNodeList.Count != 0)
			{
				this.description = xmlNodeList.Item(0).InnerText;
			}

			xmlNodeList = xmlElement.SelectNodes("xsd:ObjectIdentifier", xmlNamespaceManager);
			if (xmlNodeList.Count != 0)
			{
				this.objectIdentifier = new ObjectIdentifier("ObjectIdentifier");
				this.objectIdentifier.LoadXml((XmlElement)xmlNodeList.Item(0));
			}

			xmlNodeList = xmlElement.SelectNodes("xsd:MimeType", xmlNamespaceManager);
			if (xmlNodeList.Count != 0)
			{
				this.mimeType = xmlNodeList.Item(0).InnerText;
			}

			xmlNodeList = xmlElement.SelectNodes("xsd:Encoding", xmlNamespaceManager);
			if (xmlNodeList.Count != 0)
			{
				this.encoding = xmlNodeList.Item(0).InnerText;
			}
		}
        /// <summary>
        /// Load state from an XML element
        /// </summary>
        /// <param name="xmlElement">XML element containing new state</param>
        public void LoadXml(System.Xml.XmlElement xmlElement)
        {
            if (xmlElement == null)
            {
                throw new ArgumentNullException("xmlElement");
            }

            if (xmlElement.HasAttribute("Id"))
            {
                this.id = xmlElement.GetAttribute("Id");
            }
            else
            {
                this.id = "";
            }

            this.pkiData = Convert.FromBase64String(xmlElement.InnerText);
        }
        private static Field createComposedDecimal(System.Xml.XmlElement fieldNode, QName name, bool optional, System.Xml.XmlNode mantissaNode, System.Xml.XmlNode exponentNode, ParsingContext context)
        {
            string mantissaOperator = "none";
            string exponentOperator = "none";
            ScalarValue mantissaDefaultValue = ScalarValue.UNDEFINED;
            ScalarValue exponentDefaultValue = ScalarValue.UNDEFINED;
            QName mantissaKey = null;
            QName exponentKey = null;
            string mantissaDictionary = context.Dictionary;
            string exponentDictionary = context.Dictionary;
            string mantissaNamespace = context.Namespace;
            string exponentNamespace = context.Namespace;

            if ((mantissaNode != null) && mantissaNode.HasChildNodes)
            {
                System.Xml.XmlElement operatorElement = GetElement((System.Xml.XmlElement) mantissaNode, 1);
                mantissaOperator = operatorElement.Name;

                if (operatorElement.HasAttribute("value"))
                    mantissaDefaultValue = FASTType.I64.GetValue(operatorElement.GetAttribute("value"));
                if (operatorElement.HasAttribute("ns"))
                    mantissaNamespace = operatorElement.GetAttribute("ns");
                if (operatorElement.HasAttribute("key"))
                    mantissaKey = new QName(operatorElement.GetAttribute("key"), mantissaNamespace);
                if (operatorElement.HasAttribute("dictionary"))
                    mantissaDictionary = operatorElement.GetAttribute("dictionary");
            }

            if ((exponentNode != null) && exponentNode.HasChildNodes)
            {
                System.Xml.XmlElement operatorElement = GetElement((System.Xml.XmlElement) exponentNode, 1);
                exponentOperator = operatorElement.Name;

                if (operatorElement.HasAttribute("value"))
                    exponentDefaultValue = FASTType.I32.GetValue(operatorElement.GetAttribute("value"));
                if (operatorElement.HasAttribute("ns"))
                    exponentNamespace = operatorElement.GetAttribute("ns");
                if (operatorElement.HasAttribute("key"))
                    exponentKey = new QName(operatorElement.GetAttribute("key"), exponentNamespace);
                if (operatorElement.HasAttribute("dictionary"))
                    exponentDictionary = operatorElement.GetAttribute("dictionary");
            }

            ComposedScalar scalar = Util.ComposedDecimal(name, Operator.Operator.GetOperator(exponentOperator), exponentDefaultValue, Operator.Operator.GetOperator(mantissaOperator), mantissaDefaultValue, optional);

            Scalar exponent = scalar.Fields[0];
            exponent.Dictionary = exponentDictionary;
            if (exponentKey != null)
                exponent.Key = exponentKey;

            Scalar mantissa = scalar.Fields[1];
            mantissa.Dictionary = mantissaDictionary;
            if (mantissaKey != null)
                mantissa.Key = mantissaKey;

            if (fieldNode.HasAttribute("id"))
                scalar.Id = fieldNode.GetAttribute("id");
            return scalar;
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Load state from an XML element
        /// </summary>
        /// <param name="xmlElement">XML element containing new state</param>
        public void LoadXml(System.Xml.XmlElement xmlElement)
        {
            XmlNamespaceManager xmlNamespaceManager;
            XmlNodeList xmlNodeList;

            if (xmlElement == null)
            {
                throw new ArgumentNullException("xmlElement");
            }
            if (xmlElement.HasAttribute("uri"))
            {
                this.uriAttribute = xmlElement.GetAttribute("uri");
            }
            else
            {
                this.uriAttribute = "";
                throw new CryptographicException("uri attribute missing");
            }

            xmlNamespaceManager = new XmlNamespaceManager(xmlElement.OwnerDocument.NameTable);
            xmlNamespaceManager.AddNamespace("xsd", XadesSignedXml.XadesNamespaceUri);

            xmlNodeList = xmlElement.SelectNodes("xsd:Transforms", xmlNamespaceManager);
            if (xmlNodeList.Count != 0)
            {
                this.transforms = new Transforms();
                this.transforms.LoadXml((XmlElement)xmlNodeList.Item(0));
            }
        }