Inheritance: ICloneable, IEnumerable, IXPathNavigable
Exemplo n.º 1
1
		Field _lField;			// resolved label name
		internal DataSetReference(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p)
		{
			_DataSetName=null;
			_ValueField=null;
			_LabelField=null;

			// Loop thru all the child nodes
			foreach(XmlNode xNodeLoop in xNode.ChildNodes)
			{
				if (xNodeLoop.NodeType != XmlNodeType.Element)
					continue;
				switch (xNodeLoop.Name)
				{
					case "DataSetName":
						_DataSetName = xNodeLoop.InnerText;
						break;
					case "ValueField":
						_ValueField = xNodeLoop.InnerText;
						break;
					case "LabelField":
						_LabelField = xNodeLoop.InnerText;
						break;
					default:
						// don't know this element - log it
						OwnerReport.rl.LogError(4, "Unknown DataSetReference element '" + xNodeLoop.Name + "' ignored.");
						break;
				}
			}
			if (_DataSetName == null)
				OwnerReport.rl.LogError(8, "DataSetReference DataSetName is required but not specified.");
			if (_ValueField == null)
				OwnerReport.rl.LogError(8, "DataSetReference ValueField is required but not specified for" + _DataSetName==null? "<unknown name>": _DataSetName);
		}
Exemplo n.º 2
1
 public static void SetAttribute( XmlNode node, string attributeName, string attributeValue )
 {
     if ( node.Attributes[ attributeName ] != null )
         node.Attributes[ attributeName ].Value = attributeValue ;
     else
         node.Attributes.Append( CreateAttribute( node.OwnerDocument, attributeName, attributeValue ) ) ;
 }
Exemplo n.º 3
1
		/// <summary>
		/// Get protected and user-stored dictionary configurations to load into the dialog.
		/// Tests will override this to load the manager in their own fashion.
		/// </summary>
		private void LoadDataFromInventory(XmlNode current)
		{
			// Tuples are <uniqueCode, dispName, IsProtected>
			var configList = new List<Tuple<string, string, bool>>();

			// put them in configList and feed them into the Manager's dictionary.
			foreach (var xnView in m_originalViewConfigNodes)
			{
				var sLabel = XmlUtils.GetManditoryAttributeValue(xnView, "label");
				var sLayout = XmlUtils.GetManditoryAttributeValue(xnView, "layout");
				var fProtected = !sLayout.Contains(Inventory.kcMarkLayoutCopy);
				configList.Add(new Tuple<string, string, bool>(sLayout, sLabel, fProtected));
			}

			LoadInternalDictionary(configList);

			var sLayoutCurrent = XmlUtils.GetManditoryAttributeValue(current, "layout");
			m_originalView = sLayoutCurrent;
			m_currentView = m_originalView;

			if (m_configList.Count == 0)
				return;

			// Now set up the actual dialog's contents
			RefreshView();
		}
 public ClearQueue(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNode actionTypeNode = xmlNode.SelectSingleNode("actionType");
     
     if (actionTypeNode != null)
     {
         if (actionTypeNode.Attributes["href"] != null || actionTypeNode.Attributes["id"] != null) 
         {
             if (actionTypeNode.Attributes["id"] != null) 
             {
                 actionTypeIDRef_ = actionTypeNode.Attributes["id"].Value;
                 XsdTypeToken ob = new XsdTypeToken(actionTypeNode);
                 IDManager.SetID(actionTypeIDRef_, ob);
             }
             else if (actionTypeNode.Attributes["href"] != null)
             {
                 actionTypeIDRef_ = actionTypeNode.Attributes["href"].Value;
             }
             else
             {
                 actionType_ = new XsdTypeToken(actionTypeNode);
             }
         }
         else
         {
             actionType_ = new XsdTypeToken(actionTypeNode);
         }
     }
     
 
 }
 public Variable(XmlNode xmlNode)
 {
     XmlNodeList symbolNameNodeList = xmlNode.SelectNodes("symbolName");
     if (symbolNameNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in symbolNameNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 symbolNameIDRef = item.Attributes["id"].Name;
                 XsdTypeToken ob = XsdTypeToken();
                 IDManager.SetID(symbolNameIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 symbolNameIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 symbolName = new XsdTypeToken(item);
             }
         }
     }
     
 
 }
Exemplo n.º 6
1
		bool _FixedHeader=false;	// Header of this column should be display even when scrolled
	
		internal TableColumn(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p)
		{
			_Width=null;
			_Visibility=null;

			// Loop thru all the child nodes
			foreach(XmlNode xNodeLoop in xNode.ChildNodes)
			{
				if (xNodeLoop.NodeType != XmlNodeType.Element)
					continue;
				switch (xNodeLoop.Name)
				{
					case "Width":
						_Width = new RSize(r, xNodeLoop);
						break;
					case "Visibility":
						_Visibility = new Visibility(r, this, xNodeLoop);
						break;
					case "FixedHeader":
						_FixedHeader = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl);
						break;
					default:
						// don't know this element - log it
						OwnerReport.rl.LogError(4, "Unknown TableColumn element '" + xNodeLoop.Name + "' ignored.");
						break;
				}
			}
			if (_Width == null)
				OwnerReport.rl.LogError(8, "TableColumn requires the Width element.");
		}
Exemplo n.º 7
1
		/// <summary>
		/// Deserializes the specified section.
		/// </summary>
		/// <param name="section">The section.</param>
		public void Deserialize(XmlNode section)
		{
			var customFactoryNode = section.SelectSingleNode("customControllerFactory");
			
			if (customFactoryNode != null)
			{
				var typeAtt = customFactoryNode.Attributes["type"];
				
				if (typeAtt == null || typeAtt.Value == String.Empty)
				{
					var message = "If the node customControllerFactory is " + 
						"present, you must specify the 'type' attribute";
					throw new ConfigurationErrorsException(message);
				}
				
				var typeName = typeAtt.Value;
				
				customControllerFactory = TypeLoadUtil.GetType(typeName);
			}
			
			var nodeList = section.SelectNodes("controllers/assembly");
			
			foreach(XmlNode node in nodeList)
			{
				if (node.HasChildNodes)
				{
					assemblies.Add(node.ChildNodes[0].Value);
				}
			}
		}
        protected override void ParseItem(XmlNode item)
        {
            Status status = new Status(item);
            this.statuses.Add(status);

            base.ParseItem(item);
        }
Exemplo n.º 9
1
        public new void fromXml(XmlNode node)
        {
            base.fromXml(node);

            XmlNode variableNameNode = ((XmlElement)node).GetElementsByTagName("Variable_Name").Item(0);
            this.variableName = variableNameNode.InnerText;
        }
Exemplo n.º 10
1
        List<ParameterValue> _Items; // list of ParameterValue

        #endregion Fields

        #region Constructors

        internal ParameterValues(ReportDefn r, ReportLink p, XmlNode xNode)
            : base(r, p)
        {
            ParameterValue pv;
            _Items = new List<ParameterValue>();
            // Loop thru all the child nodes
            foreach(XmlNode xNodeLoop in xNode.ChildNodes)
            {
                if (xNodeLoop.NodeType != XmlNodeType.Element)
                    continue;
                switch (xNodeLoop.Name)
                {
                    case "ParameterValue":
                        pv = new ParameterValue(r, this, xNodeLoop);
                        break;
                    default:
                        pv=null;		// don't know what this is
                        // don't know this element - log it
                        OwnerReport.rl.LogError(4, "Unknown ParameterValues element '" + xNodeLoop.Name + "' ignored.");
                        break;
                }
                if (pv != null)
                    _Items.Add(pv);
            }

            if (_Items.Count == 0)
                OwnerReport.rl.LogError(8, "For ParameterValues at least one ParameterValue is required.");
            else
                _Items.TrimExcess();
        }
Exemplo n.º 11
1
		internal XmlAttributeCollection (XmlNode parent) : base (parent)
		{
			ownerElement = parent as XmlElement;
			ownerDocument = parent.OwnerDocument;
			if(ownerElement == null)
				throw new XmlException ("invalid construction for XmlAttributeCollection.");
		}
 public CreditDefaultSwapOption(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNode strikeNode = xmlNode.SelectSingleNode("strike");
     
     if (strikeNode != null)
     {
         if (strikeNode.Attributes["href"] != null || strikeNode.Attributes["id"] != null) 
         {
             if (strikeNode.Attributes["id"] != null) 
             {
                 strikeIDRef_ = strikeNode.Attributes["id"].Value;
                 CreditOptionStrike ob = new CreditOptionStrike(strikeNode);
                 IDManager.SetID(strikeIDRef_, ob);
             }
             else if (strikeNode.Attributes["href"] != null)
             {
                 strikeIDRef_ = strikeNode.Attributes["href"].Value;
             }
             else
             {
                 strike_ = new CreditOptionStrike(strikeNode);
             }
         }
         else
         {
             strike_ = new CreditOptionStrike(strikeNode);
         }
     }
     
 
     XmlNode creditDefaultSwapNode = xmlNode.SelectSingleNode("creditDefaultSwap");
     
     if (creditDefaultSwapNode != null)
     {
         if (creditDefaultSwapNode.Attributes["href"] != null || creditDefaultSwapNode.Attributes["id"] != null) 
         {
             if (creditDefaultSwapNode.Attributes["id"] != null) 
             {
                 creditDefaultSwapIDRef_ = creditDefaultSwapNode.Attributes["id"].Value;
                 CreditDefaultSwap ob = new CreditDefaultSwap(creditDefaultSwapNode);
                 IDManager.SetID(creditDefaultSwapIDRef_, ob);
             }
             else if (creditDefaultSwapNode.Attributes["href"] != null)
             {
                 creditDefaultSwapIDRef_ = creditDefaultSwapNode.Attributes["href"].Value;
             }
             else
             {
                 creditDefaultSwap_ = new CreditDefaultSwap(creditDefaultSwapNode);
             }
         }
         else
         {
             creditDefaultSwap_ = new CreditDefaultSwap(creditDefaultSwapNode);
         }
     }
     
 
 }
Exemplo n.º 13
1
        public virtual object Create(object parent, object configContext, XmlNode section)
        {
            if (section == null)
                throw new ArgumentNullException("section");

            IList list = CreateList(parent);

            string itemName = ElementName;

            foreach (XmlNode childNode in section.ChildNodes)
            {
                if (childNode.NodeType == XmlNodeType.Comment ||
                    childNode.NodeType == XmlNodeType.Whitespace)
                {
                    continue;
                }

                if (childNode.NodeType != XmlNodeType.Element)
                {
                    throw new ConfigurationErrorsException(string.Format("Unexpected type of node ({0}) in configuration.", 
                        childNode.NodeType.ToString()), childNode);
                }

                if (childNode.Name != itemName)
                {
                    throw new ConfigurationErrorsException(string.Format("Element <{0}> is not valid here in configuration. Use <{1}> elements only.", 
                        childNode.Name, itemName), childNode);
                }

                list.Add(GetItem((XmlElement) childNode));
            }
            
            return list;
        }
Exemplo n.º 14
1
        /// <summary>
        /// 通过xml找到其中的版本信息
        /// </summary>
        /// <param name="xmlNode"></param>
        /// <returns></returns>
        public static string FindXmlNode(XmlNode xmlNode)
        {
            string version = string.Empty;
            if (xmlNode.Name == "ArchitectureToolsVersion")
            {
                version = xmlNode.Value;
            }
            else
            {
                if (xmlNode.HasChildNodes)
                {
                    foreach (XmlNode xn in xmlNode.ChildNodes)
                    {
                        if (xn.Name == "ArchitectureToolsVersion")
                        {
                            version = xn.InnerText;
                            break;
                        }
                        else
                        {
                            version = FindXmlNode(xn);
                            if (!string.IsNullOrEmpty(version))
                                break;
                        }
                    }
                }
            }

            return version;
        }
Exemplo n.º 15
1
	public static string GetDisplayName (XmlNode type)
	{
		if (type.Attributes ["DisplayName"] != null) {
			return type.Attributes ["DisplayName"].Value;
		}
		return type.Attributes ["Name"].Value;
	}
        private static SortedDictionary<string, int> GetArtists(XmlNode rootNode)
        {
            var artists = new SortedDictionary<string, int>();

            if (rootNode == null)
            {
                throw new ArgumentNullException("rootNode" + "is empty");
            }

            foreach (var artistName in from XmlNode node in rootNode.ChildNodes
                                       select node["artist"] into xmlElement
                                       where xmlElement != null
                                       select xmlElement.InnerText)
            {
                if (artists.ContainsKey(artistName))
                {
                    artists[artistName]++;
                }
                else
                {
                    artists.Add(artistName, 1);
                }
            }

            return artists;
        }
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="context"/>
		/// <param name="location"/>
		public InflAffixTemplateEventArgs(Control context, XmlNode node, Point location, int tag)
		{
			m_location = location;
			m_node = node;
			m_contextControl = context;
			m_tag = tag;
		}
Exemplo n.º 18
1
 /// <summary>
 /// constructor
 /// </summary>
 public TaskListCheck(XmlNode Node, Ict.Common.Controls.TVisualStylesEnum Style)
 {
     //
     // The InitializeComponent() call is required for Windows Forms designer support.
     //
     InitializeComponent(Node, Style);
 }
Exemplo n.º 19
1
        public void AddNodeArgumentsRecursive(XmlNode node, string subName, Dictionary<string, string> inputDic, string inputType, bool recursive)
        {
            if (node == null)
            {
                return;
            }

            foreach (XmlAttribute attr in node.Attributes)
            {
                string key = attr.LocalName;
                if (subName != "")
                {
                    key = subName + "." + attr.LocalName;
                }
                AddToArgDic(inputDic, key, attr.Value, inputType);
            }
            foreach (XmlNode childNode in node.ChildNodes)
            {
                string childName = childNode.LocalName;
                if (childNode.NodeType == XmlNodeType.Text)
                {
                    AddToArgDic(inputDic, subName, childNode.Value, inputType);
                }
                if (childNode.NodeType == XmlNodeType.Element && recursive)
                {
                    if (subName != "")
                    {
                        childName = subName + "." + childName;
                    }
                    AddNodeArgumentsRecursive(childNode, childName, inputDic, inputType, true);
                }
            }
        }
Exemplo n.º 20
1
 public DocumentXPathNavigator(DocumentXPathNavigator other)
 {
     _document = other._document;
     _source = other._source;
     _attributeIndex = other._attributeIndex;
     _namespaceParent = other._namespaceParent;
 }
Exemplo n.º 21
1
        /// <summary>
        /// Reads a URI.
        /// </summary>
        /// <param name="node">The node containing the URI.</param>
        /// <param name="table">The serialiser table.</param>
        /// <returns>A new instance of a <see cref="Uri"/> if the node is valid; null otherwise.</returns>
        public override object Read(XmlNode node, NetReflectorTypeTable table)
        {
            if (node == null)
            {
                // NetReflector should do this check, but doesn't
                if (this.Attribute.Required)
                {
                    throw new NetReflectorItemRequiredException(Attribute.Name + " is required");
                }
                else
                {
                    return null;
                }
            }

            Uri ret;
            if (node is XmlAttribute)
            {
                ret = new Uri(node.Value);
            }
            else
            {
                ret = new Uri(node.InnerText);
            }

            return ret;
        }
Exemplo n.º 22
1
        public string DownloadLrc(string singer, string title)
        {
            this.currentSong = null;
            XmlDocument xml = SearchLrc(singer, title);
            string retStr = "û���ҵ��ø��";
            if (xml == null)
                return retStr;

            XmlNodeList list = xml.SelectNodes("/result/lrc");
            if (list.Count > 0) {
                this.OnSelectSong(list);
                if (this.currentSong == null)
                    this.currentSong = list[0];
            } else if (list.Count == 1) {
                this.currentSong = list[0];
            } else {
                return retStr;
            }
            if (this.currentSong == null)
                return retStr;

            XmlNode node = this.currentSong;
            int lrcId = -1;
            if (node != null && node.Attributes != null && node.Attributes["id"] != null) {
                string sLrcId = node.Attributes["id"].Value;
                if (int.TryParse(sLrcId, out lrcId)) {
                    string xSinger = node.Attributes["artist"].Value;
                    string xTitle = node.Attributes["title"].Value;
                    retStr = RequestALink(string.Format(DownloadPath, lrcId,
                        EncodeHelper.CreateQianQianCode(xSinger, xTitle, lrcId)));
                }
            }
            return retStr;
        }
Exemplo n.º 23
1
		public APIVariable(APIPage InParent, XmlNode InNode)
			: base(InParent, InNode.SelectSingleNode("name").InnerText)
		{
			Node = InNode;
			Protection = ParseProtection(Node);
			AddRefLink(Node.Attributes["id"].InnerText, this);
		}
Exemplo n.º 24
1
        public void from(XmlNode node, XmlNamespaceManager xnm, string prefix, string subfix)
        {
            Type type = this.GetType();
            FieldInfo[] fields = type.GetFields(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public);

            foreach (FieldInfo field in fields)
            {
                string query = prefix +ObjectUtil.GetSimpleName(field) + subfix;
                try
                {
                    string value = null;
                    XmlNode tempNode;
                    if (xnm != null)
                    {
                        tempNode = node.SelectSingleNode(query, xnm);
                    }
                    else
                    {
                        tempNode = node.SelectSingleNode(query);
                    }
                    if (tempNode == null) {
                        field.SetValue(this,XML_NULL);
                        continue;
                    }
                    value = tempNode.InnerText;
                    field.SetValue(this, value);
                }
                catch (Exception ex) { }
            }
        }
 public RefVariable_returnValue(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNode variableInfoNode = xmlNode.SelectSingleNode("variableInfo");
     
     if (variableInfoNode != null)
     {
         if (variableInfoNode.Attributes["href"] != null || variableInfoNode.Attributes["id"] != null) 
         {
             if (variableInfoNode.Attributes["id"] != null) 
             {
                 variableInfoIDRef_ = variableInfoNode.Attributes["id"].Value;
                 VariableInfo ob = new VariableInfo(variableInfoNode);
                 IDManager.SetID(variableInfoIDRef_, ob);
             }
             else if (variableInfoNode.Attributes["href"] != null)
             {
                 variableInfoIDRef_ = variableInfoNode.Attributes["href"].Value;
             }
             else
             {
                 variableInfo_ = new VariableInfo(variableInfoNode);
             }
         }
         else
         {
             variableInfo_ = new VariableInfo(variableInfoNode);
         }
     }
     
 
 }
Exemplo n.º 26
1
	// Constructor.
	internal XmlElement(XmlNode parent, NameCache.NameInfo name)
			: base(parent)
			{
				this.name = name;
				this.attributes = null;
				this.isEmpty = true;
			}
 public Excel_cds(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNode excel_swapLegNode = xmlNode.SelectSingleNode("excel_swapLeg");
     
     if (excel_swapLegNode != null)
     {
         if (excel_swapLegNode.Attributes["href"] != null || excel_swapLegNode.Attributes["id"] != null) 
         {
             if (excel_swapLegNode.Attributes["id"] != null) 
             {
                 excel_swapLegIDRef_ = excel_swapLegNode.Attributes["id"].Value;
                 Excel_swapLeg ob = new Excel_swapLeg(excel_swapLegNode);
                 IDManager.SetID(excel_swapLegIDRef_, ob);
             }
             else if (excel_swapLegNode.Attributes["href"] != null)
             {
                 excel_swapLegIDRef_ = excel_swapLegNode.Attributes["href"].Value;
             }
             else
             {
                 excel_swapLeg_ = new Excel_swapLeg(excel_swapLegNode);
             }
         }
         else
         {
             excel_swapLeg_ = new Excel_swapLeg(excel_swapLegNode);
         }
     }
     
 
     XmlNode excel_creditEventSwapLegNode = xmlNode.SelectSingleNode("excel_creditEventSwapLeg");
     
     if (excel_creditEventSwapLegNode != null)
     {
         if (excel_creditEventSwapLegNode.Attributes["href"] != null || excel_creditEventSwapLegNode.Attributes["id"] != null) 
         {
             if (excel_creditEventSwapLegNode.Attributes["id"] != null) 
             {
                 excel_creditEventSwapLegIDRef_ = excel_creditEventSwapLegNode.Attributes["id"].Value;
                 Excel_creditEventSwapLeg ob = new Excel_creditEventSwapLeg(excel_creditEventSwapLegNode);
                 IDManager.SetID(excel_creditEventSwapLegIDRef_, ob);
             }
             else if (excel_creditEventSwapLegNode.Attributes["href"] != null)
             {
                 excel_creditEventSwapLegIDRef_ = excel_creditEventSwapLegNode.Attributes["href"].Value;
             }
             else
             {
                 excel_creditEventSwapLeg_ = new Excel_creditEventSwapLeg(excel_creditEventSwapLegNode);
             }
         }
         else
         {
             excel_creditEventSwapLeg_ = new Excel_creditEventSwapLeg(excel_creditEventSwapLegNode);
         }
     }
     
 
 }
Exemplo n.º 28
1
        List<TableGroup> _Items;			// list of TableGroup entries

		internal TableGroups(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p)
		{
			TableGroup tg;
            _Items = new List<TableGroup>();
			// Loop thru all the child nodes
			foreach(XmlNode xNodeLoop in xNode.ChildNodes)
			{
				if (xNodeLoop.NodeType != XmlNodeType.Element)
					continue;
				switch (xNodeLoop.Name)
				{
					case "TableGroup":
						tg = new TableGroup(r, this, xNodeLoop);
						break;
					default:	
						tg=null;		// don't know what this is
						// don't know this element - log it
						OwnerReport.rl.LogError(4, "Unknown TableGroups element '" + xNodeLoop.Name + "' ignored.");
						break;
				}
				if (tg != null)
					_Items.Add(tg);
			}
			if (_Items.Count == 0)
				OwnerReport.rl.LogError(8, "For TableGroups at least one TableGroup is required.");
			else
                _Items.TrimExcess();
		}
Exemplo n.º 29
1
 public void ParseNode(XmlNode n)
 {
     _BaseCharge = XmlHelper.ParseDecimal(n, "BaseCharge");
     if (n != null)
     {
         XmlNode sn = n.SelectSingleNode("Surcharges");
         if (sn != null)
         {
             foreach (XmlNode snn in sn.ChildNodes)
             {
                 string description = snn.Name;
                 string tempAmount = snn.InnerText;
                 decimal amount = 0m;
                 decimal.TryParse(tempAmount, System.Globalization.NumberStyles.Float, 
                     System.Globalization.CultureInfo.InvariantCulture,out amount);
                 Surcharges.Add(new Surcharge(description, amount));
             }
         }
     }
     _TotalSurcharge = XmlHelper.ParseDecimal(n, "TotalSurcharge");
     _NetCharge = XmlHelper.ParseDecimal(n, "NetCharge");
     _ShipmentNetCharge = XmlHelper.ParseDecimal(n, "ShipmentNetCharge");
     _TotalRebate = XmlHelper.ParseDecimal(n, "TotalRebate");
     _TotalDiscount = XmlHelper.ParseDecimal(n, "TotalDiscount");
 }
Exemplo n.º 30
0
        public CustomXmlNodeList(XmlNode[] elements)
        {
            if (elements == null)
                throw new ArgumentException();

            this._elements = elements;
        }
Exemplo n.º 31
0
 internal TreeIterator(XmlNode nodeTop) : base(((XmlDataDocument)(nodeTop.OwnerDocument)).Mapper)
 {
     Debug.Assert(nodeTop != null);
     _nodeTop     = nodeTop;
     _currentNode = nodeTop;
 }
Exemplo n.º 32
0
        public static void ExtractResourcesFromResx(string projectPath)
        {
            if (File.Exists(projectPath))
            {
                System.Xml.XmlDocument project = new System.Xml.XmlDocument();
                project.Load(projectPath);

                string assemblyExtension = string.Empty;

                if (project.GetElementsByTagName("OutputType")[0].InnerText.ToUpper().Contains("EXE"))
                {
                    assemblyExtension = ".exe";
                }
                else if (project.GetElementsByTagName("OutputType")[0].InnerText.ToUpper() == "LIBRARY")
                {
                    assemblyExtension = ".dll";
                }

                string assemblyName      = project.GetElementsByTagName("AssemblyName")[0].InnerText + assemblyExtension;
                string assemblyNameSpace = project.GetElementsByTagName("RootNamespace")[0].InnerText;

                List <string>          files    = new List <string>();
                System.Xml.XmlNodeList nodeList = project.GetElementsByTagName("EmbeddedResource");

                foreach (System.Xml.XmlNode node in nodeList)
                {
                    if (node.Attributes["Include"].Value.EndsWith(".resx"))
                    {
                        string resxFilePath = Path.Combine(Path.GetDirectoryName(projectPath), node.Attributes["Include"].Value);

                        string resourceNamespace = assemblyNameSpace;

                        if (node.Attributes["Include"].Value.Contains(@"\"))
                        {
                            resourceNamespace = assemblyNameSpace + "." + node.Attributes["Include"].Value.Substring(0, node.Attributes["Include"].Value.LastIndexOf(@"\")).Replace(@"\", ".");
                        }

                        if (File.Exists(resxFilePath))
                        {
                            files.Add(resxFilePath + "|" + resourceNamespace);
                        }
                    }
                }

                foreach (string file in files)
                {
                    string filePath      = file.Split('|')[0];
                    string fileNamespace = file.Split('|')[1];

                    if (verbose)
                    {
                        Console.WriteLine("Processing file \"{0}\"...", filePath);
                    }

                    if (!File.Exists(filePath))
                    {
                        continue;
                    }

                    string tmpFileName = Guid.NewGuid().ToString() + ".resxextract";

                    System.Xml.XmlDocument tmpDoc = new System.Xml.XmlDocument();

                    tmpDoc.LoadXml("<Resources></Resources>");

                    System.Xml.XmlNode rootNode = tmpDoc.FirstChild;

                    string resxName = fileNamespace + "." + Path.GetFileName(filePath);

                    using (ResXResourceReader reader = new ResXResourceReader(filePath))
                    {
                        foreach (DictionaryEntry entry in reader)
                        {
                            System.Xml.XmlElement newElement = tmpDoc.CreateElement("ResourceEntry");
                            newElement.SetAttribute("ResxName", resxName);
                            newElement.SetAttribute("AssemblyName", assemblyName);
                            newElement.SetAttribute("Key", entry.Key.ToString());
                            newElement.SetAttribute("Text", entry.Value.ToString());

                            rootNode.AppendChild(newElement);
                        }
                    }

                    tmpDoc.Save(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), tmpFileName));
                }
            }
        }
Exemplo n.º 33
0
 internal Resource LoadResource(System.Xml.XmlNode node)
 {
     return(LoadResource(node, null));
 }
Exemplo n.º 34
0
 public nfeInutilizacaoNF2Request(nfeCabecMsg nfeCabecMsg, System.Xml.XmlNode nfeDadosMsg)
 {
     this.nfeCabecMsg = nfeCabecMsg;
     this.nfeDadosMsg = nfeDadosMsg;
 }
Exemplo n.º 35
0
 public nfeInutilizacaoNF2Response(nfeCabecMsg nfeCabecMsg, System.Xml.XmlNode nfeInutilizacaoNF2Result)
 {
     this.nfeCabecMsg = nfeCabecMsg;
     this.nfeInutilizacaoNF2Result = nfeInutilizacaoNF2Result;
 }
Exemplo n.º 36
0
 public object Create(object parent, object configContext, System.Xml.XmlNode section)
 {
     _ncsection = section;
     return(section);
 }
Exemplo n.º 37
0
        public object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            var loadErrors = new CacheConfigLoadErrorsException();

            var assemblies    = new Dictionary <string, Assembly>();
            var configuration = new List <ConfigNode>();

            foreach (XmlNode child in section.ChildNodes)
            {
                if (child.NodeType != XmlNodeType.Element)
                {
                    continue;
                }

                var actionName = child.Name;

                if (!Enum.TryParse(actionName, true, out ConfigAction action))
                {
                    LogConfigError(loadErrors, $"Unrecognized {typeof(ConfigAction).FullName}: {child.Name}");
                    continue;
                }

                var nameNode = child.Attributes?["name"];
                if (string.IsNullOrWhiteSpace(nameNode?.Value))
                {
                    LogConfigError(loadErrors, "Attribute 'name' is missing for one or more config nodes");
                    continue;
                }

                if (action == ConfigAction.Remove)
                {
                    configuration.Add(new RemoveConfig {
                        Action = ConfigAction.Remove, Name = nameNode.Value
                    });
                    continue;
                }

                var assemblyNode = child.Attributes["assembly"];
                if (string.IsNullOrWhiteSpace(assemblyNode?.Value))
                {
                    LogConfigError(loadErrors, $"Attribute 'assembly' is missing for {child.Name}");
                    continue;
                }

                var typeNode = child.Attributes["type"];
                if (string.IsNullOrWhiteSpace(typeNode?.Value))
                {
                    LogConfigError(loadErrors, $"Attribute 'type' is missing for {child.Name}");
                    continue;
                }

                var typeName = typeNode.Value + "Config";

                if (!assemblies.TryGetValue(assemblyNode.Value, out var assembly))
                {
                    try
                    {
                        assembly = Assembly.Load(assemblyNode.Value);
                    }
                    catch (Exception ex) when(ex is FileLoadException ||
                                              ex is FileNotFoundException ||
                                              ex is BadImageFormatException)
                    {
                        LogConfigError(loadErrors, $"Could not load assembly {assemblyNode.Value}", ex);
                        continue;
                    }

                    assemblies.Add(assemblyNode.Value, assembly);
                }

                var configType = assembly.GetType(typeName, false, false);
                if (configType == null)
                {
                    configType = assembly.GetType(assemblyNode.Value + '.' + typeName, false, false);
                }

                if (configType == null)
                {
                    LogConfigError(loadErrors, $"Could not load type {typeName} from assembly {assemblyNode.Value}");
                    continue;
                }

                if (configType.IsSubclassOf(typeof(ConfigNode)) == false)
                {
                    LogConfigError(loadErrors, $"{configType.FullName} is not a sub class of {typeof(ConfigNode).FullName}");
                    continue;
                }

                var node = configType.GetConstructor(new Type[0])?.Invoke(new object[0]);
                if (node == null)
                {
                    LogConfigError(loadErrors, $"Failed to create an instance of type {configType.FullName} using default constructor");
                    continue;
                }

                if (!(node is ConfigNode configNode))
                {
                    LogConfigError(loadErrors, $"{node.GetType().FullName} is not a sub class of {typeof(ConfigNode).FullName}");
                    continue;
                }

                ApplyConfig(configuration, child.Attributes, configType, action, configNode, loadErrors);
            }

            if (!loadErrors.IsEmpty())
            {
                throw loadErrors;
            }

            return(configuration);
        }
Exemplo n.º 38
0
 public nfeRecepcaoEvento4Response(System.Xml.XmlNode nfeResultMsg)
 {
     this.nfeResultMsg = nfeResultMsg;
 }
Exemplo n.º 39
0
 public nfeRecepcaoEvento4Request(System.Xml.XmlNode nfeDadosMsg)
 {
     this.nfeDadosMsg = nfeDadosMsg;
 }
Exemplo n.º 40
0
 // Imports a node from another document to this document.
 public virtual XmlNode ImportNode(XmlNode node, bool deep)
 {
     return(ImportNodeInternal(node, deep));
 }
Exemplo n.º 41
0
        internal override XmlNodeChangedEventArgs GetEventArgs(XmlNode node, XmlNode oldParent, XmlNode newParent, string oldValue, string newValue, XmlNodeChangedAction action)
        {
            switch (action)
            {
            case XmlNodeChangedAction.Insert:
                if (_onNodeInsertingDelegate == null && _onNodeInsertedDelegate == null)
                {
                    return(null);
                }
                break;

            case XmlNodeChangedAction.Remove:
                if (_onNodeRemovingDelegate == null && _onNodeRemovedDelegate == null)
                {
                    return(null);
                }
                break;

            case XmlNodeChangedAction.Change:
                if (_onNodeChangingDelegate == null && _onNodeChangedDelegate == null)
                {
                    return(null);
                }
                break;
            }
            return(new XmlNodeChangedEventArgs(node, oldParent, newParent, oldValue, newValue, action));
        }
Exemplo n.º 42
0
        private XmlNode ImportNodeInternal(XmlNode node, bool deep)
        {
            XmlNode newNode = null;

            if (node == null)
            {
                throw new InvalidOperationException(SR.Xdom_Import_NullNode);
            }
            else
            {
                switch (node.NodeType)
                {
                case XmlNodeType.Element:
                    newNode = CreateElement(node.Prefix, node.LocalName, node.NamespaceURI);
                    ImportAttributes(node, newNode);
                    if (deep)
                    {
                        ImportChildren(node, newNode, deep);
                    }
                    break;

                case XmlNodeType.Attribute:
                    Debug.Assert(((XmlAttribute)node).Specified);
                    newNode = CreateAttribute(node.Prefix, node.LocalName, node.NamespaceURI);
                    ImportChildren(node, newNode, true);
                    break;

                case XmlNodeType.Text:
                    newNode = CreateTextNode(node.Value);
                    break;

                case XmlNodeType.Comment:
                    newNode = CreateComment(node.Value);
                    break;

                case XmlNodeType.ProcessingInstruction:
                    newNode = CreateProcessingInstruction(node.Name, node.Value);
                    break;

                case XmlNodeType.XmlDeclaration:
                    XmlDeclaration decl = (XmlDeclaration)node;
                    newNode = CreateXmlDeclaration(decl.Version, decl.Encoding, decl.Standalone);
                    break;

                case XmlNodeType.CDATA:
                    newNode = CreateCDataSection(node.Value);
                    break;

                case XmlNodeType.DocumentType:
                    XmlDocumentType docType = (XmlDocumentType)node;
                    newNode = CreateDocumentType(docType.Name, docType.PublicId, docType.SystemId, docType.InternalSubset);
                    break;

                case XmlNodeType.DocumentFragment:
                    newNode = CreateDocumentFragment();
                    if (deep)
                    {
                        ImportChildren(node, newNode, deep);
                    }
                    break;

                case XmlNodeType.EntityReference:
                    newNode = CreateEntityReference(node.Name);
                    // we don't import the children of entity reference because they might result in different
                    // children nodes given different namespace context in the new document.
                    break;

                case XmlNodeType.Whitespace:
                    newNode = CreateWhitespace(node.Value);
                    break;

                case XmlNodeType.SignificantWhitespace:
                    newNode = CreateSignificantWhitespace(node.Value);
                    break;

                default:
                    throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, SR.Xdom_Import, node.NodeType.ToString()));
                }
            }

            return(newNode);
        }
Exemplo n.º 43
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="rank"></param>
    /// <param name="node"></param>
    /// <returns></returns>
    string Parser(int rank, System.Xml.XmlNode node)
    {
        string res = "";

        if (node.ChildNodes.Count == 0 ||
            (node.ChildNodes.Count == 1 && node.ChildNodes[0] is System.Xml.XmlText))
        {
            // if value
            if (node.InnerText == "")
            {
                // node null -> no message
                return("");
            }
            else
            {
                // format message
                if (rank == 0)
                {
                    res += "{ \"" + node.Name + "\" : \"" + node.InnerText + "\" },";
                }
                else
                {
                    res += Rank(rank + 1) + "\"" + node.Name + "\" : \"" + node.InnerText + "\",\n";
                }
            }
            return(res);
        }
        else
        {
            // multi node
            if (rank == 0)
            {
                res += Rank(rank) + "{\n";
            }
            res += Rank(rank + 1) + "\"" + node.Name + "\" : {\n";

            // list sub node
            foreach (System.Xml.XmlNode item in node.ChildNodes)
            {
                res += Parser(rank + 1, item);
            }

            // remove last ","
            if (res[res.Length - 1] == ',')
            {
                res = res.Substring(0, res.Length - 1);
            }
            if (res[res.Length - 2] == ',' && res[res.Length - 1] == '\n')
            {
                res = res.Substring(0, res.Length - 2) + "\n";
            }

            if (rank == 0)
            {
                res += Rank(rank + 1) + "}\n";
                res += Rank(rank) + "}";
            }
            else
            {
                res += Rank(rank + 1) + "},\n";
            }
        }

        return(res);
    }
Exemplo n.º 44
0
 internal RegionIterator(XmlBoundElement rowElement) : base(((XmlDataDocument)(rowElement.OwnerDocument)).Mapper)
 {
     Debug.Assert(rowElement != null && rowElement.Row != null);
     _rowElement  = rowElement;
     _currentNode = rowElement;
 }
Exemplo n.º 45
0
 public abstract void setFromXml(System.Xml.XmlNode node);
 public override void setFromXml(System.Xml.XmlNode node)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 47
0
        public void Execute(System.Xml.XmlNode node)
        {
            ErrorLog.Write("执行了OrderSendJob");
            pageIndex = 1;
            flag      = false;
            if (null != node)
            {
                //暂停开始时间
                DateTime stopBeginDatetime = DateTime.Now;
                //暂停结束时间
                DateTime stopEndDatetime = DateTime.Now;

                XmlAttribute urlAttribute                = node.Attributes["apiurl"];
                XmlAttribute customeridAttribute         = node.Attributes["client_customerid"];
                XmlAttribute apptokenAttribute           = node.Attributes["apptoken"];
                XmlAttribute appkeyAttribute             = node.Attributes["appkey"];
                XmlAttribute appSecretAttribute          = node.Attributes["appSecret"];
                XmlAttribute dateContrastTypeAttribute   = node.Attributes["DateContrastType"];
                XmlAttribute dateContrastValueAttribute  = node.Attributes["DateContrastValue"];
                XmlAttribute clientdbAttribute           = node.Attributes["client_db"];
                XmlAttribute sendWMSCountAttribute       = node.Attributes["SendWMSCount"];
                XmlAttribute stopBeginDatetimeAttribute  = node.Attributes["stopBeginDatetime"];
                XmlAttribute stopEndDatetimeAttribute    = node.Attributes["stopEndDatetime"];
                XmlAttribute expressCompanyCodeAttribute = node.Attributes["expressCompanyCode"];
                XmlAttribute mobilesAttribute            = node.Attributes["mobiles"];

                if (dateContrastTypeAttribute != null)
                {
                    try
                    {
                        this.dateContrastType = int.Parse(dateContrastTypeAttribute.Value, CultureInfo.InvariantCulture);
                    }
                    catch
                    {
                        this.dateContrastType = 0;
                    }
                }
                if (dateContrastValueAttribute != null)
                {
                    try
                    {
                        this.dateContrastValue = int.Parse(dateContrastValueAttribute.Value, CultureInfo.InvariantCulture);
                    }
                    catch
                    {
                        this.dateContrastValue = 1;
                    }
                }
                if (sendWMSCountAttribute != null)
                {
                    try
                    {
                        this.sendWMSCount = int.Parse(sendWMSCountAttribute.Value, CultureInfo.InvariantCulture);
                    }
                    catch
                    {
                        this.sendWMSCount = 10;
                    }
                }


                if (urlAttribute != null)
                {
                    url = urlAttribute.Value;
                }
                if (customeridAttribute != null)
                {
                    customerid = customeridAttribute.Value;
                }
                if (apptokenAttribute != null)
                {
                    apptoken = apptokenAttribute.Value;
                }
                if (appkeyAttribute != null)
                {
                    appkey = appkeyAttribute.Value;
                }
                if (appSecretAttribute != null)
                {
                    appSecret = appSecretAttribute.Value;
                }
                if (clientdbAttribute != null)
                {
                    client_db = clientdbAttribute.Value;
                }

                if (expressCompanyCodeAttribute != null)
                {
                    expressCompanyCode = expressCompanyCodeAttribute.Value;
                }

                if (mobilesAttribute != null)
                {
                    mobiles = mobilesAttribute.InnerText.Split(new char[] { ',' });
                }

                //暂停开始时间
                if (stopBeginDatetimeAttribute != null)
                {
                    try
                    {
                        stopBeginDatetime = DateTime.Parse(stopBeginDatetimeAttribute.Value, CultureInfo.InvariantCulture);
                    }
                    catch
                    {
                    }
                }

                //暂停结束时间
                if (stopEndDatetimeAttribute != null)
                {
                    try
                    {
                        stopEndDatetime = DateTime.Parse(stopEndDatetimeAttribute.Value, CultureInfo.InvariantCulture);
                    }
                    catch
                    {
                    }
                }
                //当前时间
                DateTime tempTime = DateTime.Now;
                if (tempTime < stopBeginDatetime || tempTime > stopEndDatetime)
                {
                    this.SendOrderData();
                }
                else
                {
                    ErrorLog.Write("暂停执行OrderSendJob");
                }
            }
        }
        /// <summary>
        /// Parses a section of the configuration file for information about the persistent stores.
        /// </summary>
        /// <param name="parent">The configuration settings in a corresponding parent configuration section.</param>
        /// <param name="configContext">An HttpConfigurationContext when Create is called from the ASP.NET configuration system.
        /// Otherwise, this parameter is reserved and is a null reference.</param>
        /// <param name="section">The XmlNode that contains the configuration information from the configuration file. Provides direct access to the XML contents of the configuration section.</param>
        /// <returns>A ToolSection object created from the data in the configuration file.</returns>
        public object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            // Create an object to hold the data from the 'tool' section of the application configuration file.
            ToolSection toolSection = new ToolSection();

            try
            {
                // Read each of the nodes that contain information about the persistent stores and place them in the table.
                foreach (XmlNode xmlNode in section.SelectNodes("add"))
                {
                    // The 'type' section of the configuration file is modeled after other places in the OS where the type and
                    // assembly information are combined in the same string.  A simpler method might have been to break aprart the
                    // type string from the assembly string, but it's also a good idea to use standards where you find them.  In
                    // any event, when the 'type' specification is done this way, the padded spaces need to be removed from the
                    // values onced they're broken out from the original string.
                    XmlAttribute keyAttribute = xmlNode.Attributes["key"];
                    if (keyAttribute == null)
                    {
                        throw new Exception("Syntax error in configuration file section 'tools'.");
                    }
                    string name = keyAttribute.Value;

                    // The text appears in the 'Tools' menu.
                    XmlAttribute textAttribute = xmlNode.Attributes["text"];
                    if (textAttribute == null)
                    {
                        throw new Exception("Syntax error in configuration file section 'tools'.");
                    }
                    string text = textAttribute.Value;

                    // Pull apart the tool specification from the attributes.
                    XmlAttribute toolSpecificationAttribute = xmlNode.Attributes["tool"];
                    if (toolSpecificationAttribute == null)
                    {
                        throw new Exception("Syntax error in configuration file section 'tools'.");
                    }
                    string[] toolParts = toolSpecificationAttribute.Value.Split(new char[] { ',' });
                    if (toolParts.Length != 2)
                    {
                        throw new Exception("Syntax error in configuration file section 'tools'.");
                    }

                    // Attempt to load the tool into memory and find the type used to instantiate the tool.
                    Assembly    toolAssembly = Assembly.Load(toolParts[ToolSectionHandler.AssemblyIndex].Trim());
                    System.Type toolType     = toolAssembly.GetType(toolParts[ToolSectionHandler.TypeIndex]);

                    // Add the tool information to the section.  Each of these ToolInfo items describes what kind of object the
                    // tool is associated with and where to find the tool.
                    toolSection.Add(new ToolInfo(name, text, toolType));
                }
            }
            catch (Exception exception)
            {
                // Make sure that any errors caught while trying to load the tool info is recorded in the log.  A system
                // administrator can look through these to figure out why the tool information isn't formatted correctly.
                EventLog.Error("{0}, {1}", exception.Message, exception.StackTrace);
            }

            // This object can be used to find a persistent store by nane and connect to it.
            return(toolSection);
        }
Exemplo n.º 49
0
 protected override void ImportData(System.Xml.XmlNode fieldNode, ImportContext context)
 {
     this.SetData(new List <string>(new string[] { fieldNode.InnerXml }));
 }
Exemplo n.º 50
0
        public System.Threading.Tasks.Task <nfeRecepcaoEventoSVANResponse> nfeRecepcaoEventoAsync(System.Xml.XmlNode nfeDadosMsg)
        {
            nfeRecepcaoEventoSVANRequest inValue = new nfeRecepcaoEventoSVANRequest();

            inValue.nfeDadosMsg = nfeDadosMsg;
            return(this.Channel.nfeRecepcaoEventoAsync(inValue));
        }
Exemplo n.º 51
0
        public static T FromXML <T>(XmlNode Xml, IFormatProvider Provider) where T : new()
        {
            Type TypeEntity = typeof(T);

            T Entity = new T();


            //List<> of Types
            if (TypeEntity.IsGenericType && typeof(System.Collections.IList).IsAssignableFrom(TypeEntity.GetGenericTypeDefinition()))
            {
                foreach (XmlNode node in Xml.ChildNodes)
                {
                    object ret = node.InnerXml;
                    if (node.NodeType != XmlNodeType.XmlDeclaration)
                    {
                        Type UnderlyingType = TypeEntity.GetGenericArguments()[0];

                        Type[] BasicTypes = { typeof(String), typeof(Int16), typeof(Int32), typeof(Int64), typeof(Boolean), typeof(DateTime), typeof(System.Char), typeof(System.Decimal), typeof(System.Double), typeof(System.Single), typeof(System.TimeSpan), typeof(System.Byte) };


                        //If not a basic Type , try to deep more in the dom tree deserializing the inner XML Value
                        if (BasicTypes.SingleOrDefault((t) => { return(t == UnderlyingType); }) == null)
                        {
                            //Otherwise of arrays convert to XML to send
                            var fromXMLMethods = typeof(Gale.Serialization).GetMethods(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);
                            System.Reflection.MethodInfo fromXMLMethodInfo = fromXMLMethods.FirstOrDefault(mi => mi.Name == "FromXML" && mi.GetGenericArguments().Count() == 1 && mi.GetParameters()[0].ParameterType == typeof(XmlNode));

                            System.Reflection.MethodInfo method = fromXMLMethodInfo.MakeGenericMethod(new Type[] { UnderlyingType });
                            ret = method.Invoke(null, new object[] { node });
                        }

                        (Entity as System.Collections.IList).Add(Convert.ChangeType(ret, UnderlyingType));
                    }
                }
                return((T)Entity);
            }

            List <PropertyInfo> setterProperties = (from PropertyInfo p in TypeEntity.GetProperties() where p.GetIndexParameters().Count() == 0 select p).ToList();

            //Delegate
            Action <PropertyInfo, object> setValue = (Property, Value) =>
            {
                try
                {
                    Property.SetValue(Entity, Value, null);
                }
                catch
                {
                    throw new Gale.Exception.GaleException("InvalidSetValueInXMLDeserialization", Value.ToString(), Property.Name, Property.PropertyType.ToString());
                }
            };

            //For Each
            setterProperties.ForEach((prop) =>
            {
                if (object.ReferenceEquals(prop.DeclaringType, TypeEntity))
                {
                    System.Xml.Serialization.XmlAttributeAttribute customAttribute = (System.Xml.Serialization.XmlAttributeAttribute)prop.GetCustomAttributes(typeof(System.Xml.Serialization.XmlAttributeAttribute), false).FirstOrDefault();
                    Type propertyType          = prop.PropertyType;
                    string nodeValue           = null;
                    System.Xml.XmlNode noderef = null;

                    if (customAttribute != null)
                    {
                        XmlAttribute attrib = Xml.Attributes[customAttribute.AttributeName];
                        if (attrib != null)
                        {
                            nodeValue = attrib.InnerXml;
                        }
                    }
                    else
                    {
                        System.Xml.Serialization.XmlElementAttribute xmlattrib = (System.Xml.Serialization.XmlElementAttribute)prop.GetCustomAttributes(typeof(System.Xml.Serialization.XmlElementAttribute), false).FirstOrDefault();
                        XmlNode propertyNode = Xml.SelectSingleNode((xmlattrib != null) ? xmlattrib.ElementName : prop.Name);
                        if (propertyNode != null)
                        {
                            noderef   = propertyNode;
                            nodeValue = propertyNode.InnerXml;
                        }
                    }

                    if (nodeValue != null && nodeValue != String.Empty)
                    {
                        if (Type.Equals(propertyType, typeof(decimal)))
                        {
                            setValue(prop, System.Convert.ToDecimal(nodeValue, Provider));
                        }
                        else if (Type.Equals(propertyType, typeof(double)))
                        {
                            setValue(prop, System.Convert.ToDouble(nodeValue, Provider));
                        }
                        else if (Type.Equals(propertyType, typeof(Int16)))
                        {
                            setValue(prop, System.Convert.ToInt16(nodeValue, Provider));
                        }
                        else if (Type.Equals(propertyType, typeof(Int32)))
                        {
                            setValue(prop, System.Convert.ToInt32(nodeValue, Provider));
                        }
                        else if (Type.Equals(propertyType, typeof(Int64)))
                        {
                            setValue(prop, System.Convert.ToInt64(nodeValue, Provider));
                        }
                        else if (Type.Equals(propertyType, typeof(bool)))
                        {
                            setValue(prop, System.Convert.ToBoolean(nodeValue, Provider));
                        }
                        else if (Type.Equals(propertyType, typeof(DateTime)))
                        {
                            setValue(prop, System.Convert.ToDateTime(nodeValue, Provider));
                        }
                        else if (Type.Equals(propertyType, typeof(string)))
                        {
                            setValue(prop, System.Convert.ToString(nodeValue, Provider));
                        }
                        else if (propertyType.IsArray)
                        {
                            if (nodeValue != string.Empty)
                            {
                                Type UnderlyingType = propertyType.GetElementType();  //Array or a Generic List (Almost the same things)
                                // Creates and initializes a new Array of type Int32.
                                Array typedArray = Array.CreateInstance(UnderlyingType, noderef.ChildNodes.Count);

                                int arrayIndex = 0;
                                foreach (XmlNode node in noderef.ChildNodes)
                                {
                                    object ret = node.InnerXml;
                                    if (node.NodeType != XmlNodeType.XmlDeclaration)
                                    {
                                        //If not a basic Type , try to deep more in the dom tree deserializing the inner XML Value
                                        Type[] BasicTypes = { typeof(String), typeof(Int16), typeof(Int32), typeof(Int64), typeof(Boolean), typeof(DateTime), typeof(System.Char), typeof(System.Decimal), typeof(System.Double), typeof(System.Single), typeof(System.TimeSpan), typeof(System.Byte) };
                                        if (BasicTypes.SingleOrDefault((t) => { return(t == UnderlyingType); }) == null)
                                        {
                                            //Otherwise of arrays convert to XML to send
                                            var fromXMLMethods = typeof(Gale.Serialization).GetMethods(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);
                                            System.Reflection.MethodInfo fromXMLMethodInfo = fromXMLMethods.FirstOrDefault(mi => mi.Name == "FromXML" && mi.GetGenericArguments().Count() == 1 && mi.GetParameters()[0].ParameterType == typeof(XmlNode));

                                            System.Reflection.MethodInfo method = fromXMLMethodInfo.MakeGenericMethod(new Type[] { UnderlyingType });
                                            ret = method.Invoke(null, new object[] { node });
                                        }

                                        typedArray.SetValue(Convert.ChangeType(ret, UnderlyingType), arrayIndex);
                                    }
                                    arrayIndex++;
                                }

                                setValue(prop, typedArray);
                            }
                        }
                        else if (propertyType.IsGenericType)
                        {
                            //If a Parameter Type is Nullable, create the nullable type dinamycally and set it's value
                            Type UnderlyingType    = propertyType.GetGenericArguments()[0];
                            Type GenericDefinition = propertyType.GetGenericTypeDefinition();

                            Type GenericType = GenericDefinition.MakeGenericType(new Type[] { UnderlyingType });

                            object value = null;
                            if (nodeValue != string.Empty)
                            {
                                if (GenericDefinition == typeof(System.Nullable <>))
                                {
                                    value = Convert.ChangeType(nodeValue, UnderlyingType);
                                }
                                else
                                {
                                    //Complex Node Type, (Maybe it's a List of Other Complex Type and go on in the deepest level
                                    //So call the fromXML itself, again and again

                                    //Otherwise of arrays convert to XML to send
                                    var fromXMLMethods = typeof(Gale.Serialization).GetMethods(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);
                                    System.Reflection.MethodInfo fromXMLMethodInfo = fromXMLMethods.FirstOrDefault(mi => mi.Name == "FromXML" && mi.GetGenericArguments().Count() == 1 && mi.GetParameters()[0].ParameterType == typeof(XmlNode));

                                    System.Reflection.MethodInfo method = fromXMLMethodInfo.MakeGenericMethod(new Type[] { GenericType });

                                    value = method.Invoke(null, new object[] { noderef });
                                }
                                setValue(prop, Activator.CreateInstance(GenericType, new object[] { value }));
                            }
                        }
                        else
                        {
                            try
                            {
                                //Its a more complex type ( not generic but yes a object with properties and setter's)
                                if (noderef.ChildNodes.Count > 0)
                                {
                                    //Otherwise of arrays convert to XML to send
                                    var fromXMLMethods = typeof(Gale.Serialization).GetMethods(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);
                                    System.Reflection.MethodInfo fromXMLMethodInfo = fromXMLMethods.FirstOrDefault(mi => mi.Name == "FromXML" && mi.GetGenericArguments().Count() == 1 && mi.GetParameters()[0].ParameterType == typeof(XmlNode));

                                    System.Reflection.MethodInfo method = fromXMLMethodInfo.MakeGenericMethod(new Type[] { propertyType });

                                    var value = method.Invoke(null, new object[] { noderef });

                                    setValue(prop, Convert.ChangeType(value, propertyType));  //try to set into the variable anyways , if throw error then throw invalid cast exception
                                }
                                else
                                {
                                    setValue(prop, Convert.ChangeType(nodeValue, propertyType));  //try to set into the variable anyways , if throw error then throw invalid cast exception
                                }
                            }
                            catch
                            {
                                //TODO: Perform this Section, To Support Non Primitive Object Type
                                throw new Gale.Exception.GaleException("InvalidCastInXMLDeserialization", prop.Name);
                            }
                        }
                    }
                }
            });

            return((T)(Entity));
        }
Exemplo n.º 52
0
 public nfeRecepcaoEventoSVANResponse(System.Xml.XmlNode nfeRecepcaoEventoResult)
 {
     this.nfeRecepcaoEventoResult = nfeRecepcaoEventoResult;
 }
Exemplo n.º 53
0
        public System.Threading.Tasks.Task <nfeInutilizacaoNF2Response> nfeInutilizacaoNF2Async(nfeCabecMsg nfeCabecMsg, System.Xml.XmlNode nfeDadosMsg)
        {
            nfeInutilizacaoNF2Request inValue = new nfeInutilizacaoNF2Request();

            inValue.nfeCabecMsg = nfeCabecMsg;
            inValue.nfeDadosMsg = nfeDadosMsg;
            return(((NfeInutilizacao2Soap12)(this.Channel)).nfeInutilizacaoNF2Async(inValue));
        }
Exemplo n.º 54
0
        public void Execute(System.Xml.XmlNode node)
        {
            ErrorLog.Write("执行了DeclareStatusJob");
            if (null != node)
            {
                XmlAttribute urlAttribute               = node.Attributes["apiurl"];
                XmlAttribute customeridAttribute        = node.Attributes["client_customerid"];
                XmlAttribute apptokenAttribute          = node.Attributes["apptoken"];
                XmlAttribute appkeyAttribute            = node.Attributes["appkey"];
                XmlAttribute appSecretAttribute         = node.Attributes["appSecret"];
                XmlAttribute dateContrastTypeAttribute  = node.Attributes["DateContrastType"];
                XmlAttribute dateContrastValueAttribute = node.Attributes["DateContrastValue"];
                XmlAttribute clientdbAttribute          = node.Attributes["client_db"];


                //if (dateContrastTypeAttribute != null)
                //{
                //    try
                //    {
                //        this.dateContrastType = int.Parse(dateContrastTypeAttribute.Value, CultureInfo.InvariantCulture);
                //    }
                //    catch
                //    {
                //        this.dateContrastType = 0;
                //    }
                //}
                //if (dateContrastValueAttribute != null)
                //{
                //    try
                //    {
                //        this.dateContrastValue = int.Parse(dateContrastValueAttribute.Value, CultureInfo.InvariantCulture);
                //    }
                //    catch
                //    {
                //        this.dateContrastValue = 1;
                //    }
                //}

                if (urlAttribute != null)
                {
                    url = urlAttribute.Value;
                }
                if (customeridAttribute != null)
                {
                    customerid = customeridAttribute.Value;
                }
                if (apptokenAttribute != null)
                {
                    apptoken = apptokenAttribute.Value;
                }
                if (appkeyAttribute != null)
                {
                    appkey = appkeyAttribute.Value;
                }
                if (appSecretAttribute != null)
                {
                    appSecret = appSecretAttribute.Value;
                }
                if (clientdbAttribute != null)
                {
                    client_db = clientdbAttribute.Value;
                }

                Database database = DatabaseFactory.CreateDatabase();

                System.Data.Common.DbCommand sqlStringCommand = database.GetSqlStringCommand("exec cp_HSDocking_GetDeclareStatus");

                DataTable dt = database.ExecuteDataSet(sqlStringCommand).Tables[0];
                this.SendDeclareStatusData(dt);
            }
        }
Exemplo n.º 55
0
 public override void OnPostSerialize(XmlSerializer.ObjectIDmap objMap, System.Xml.XmlNode objectNode, bool saved, object serializer)
 {
 }
Exemplo n.º 56
0
        public void SetSettings(System.Xml.XmlNode settings)
        {
            //Settings
            if (settings["UnBet"] != null)
            {
                CanUnBet = bool.Parse(settings["UnBet"].InnerText);
            }
            else
            {
                CanUnBet = true;
            }
            if (settings["UnBetPenalty"] != null)
            {
                UnBetPenalty = int.Parse(settings["UnBetPenalty"].InnerText);
            }
            else
            {
                UnBetPenalty = 50;
            }
            if (settings["MinimumTime"] != null)
            {
                MinimumTime = TimeSpanParser.Parse(settings["MinimumTime"].InnerText);
            }
            else
            {
                MinimumTime = new TimeSpan(0, 0, 1);
            }
            if (settings["NbScores"] != null)
            {
                NbScores = int.Parse(settings["NbScores"].InnerText);
            }
            else
            {
                NbScores = 5;
            }
            if (settings["UseGlobalTime"] != null)
            {
                UseGlobalTime = bool.Parse(settings["UseGlobalTime"].InnerText);
            }
            else
            {
                UseGlobalTime = false;
            }
            if (settings["TimingMethod"] != null)
            {
                Method = settings["TimingMethod"].InnerText;
            }
            else
            {
                Method = "Current Timing Method";
            }
            if (settings["AllowMods"] != null)
            {
                AllowMods = bool.Parse(settings["AllowMods"].InnerText);
            }
            else
            {
                AllowMods = false;
            }
            if (settings["SingleLineScores"] != null)
            {
                SingleLineScores = bool.Parse(settings["SingleLineScores"].InnerText);
            }
            else
            {
                SingleLineScores = false;
            }
            if (settings["TimeToShow"] != null)
            {
                TimeToShow = settings["TimeToShow"].InnerText;
            }
            else
            {
                TimeToShow = "Best Segments";
            }
            if (settings["Delay"] != null)
            {
                Delay = int.Parse(settings["Delay"].InnerText);
            }
            else
            {
                Delay = 0;
            }
            if (settings["ParentSubSplits"] != null)
            {
                ParentSubSplits = bool.Parse(settings["ParentSubSplits"].InnerText);
            }
            else
            {
                ParentSubSplits = false;
            }
            if (settings["ArrayOfString"] != null)
            {
                SelectedSegments = deserialize <List <string> >(settings["ArrayOfString"]);
            }
            else
            {
                SelectedSegments = new List <string>();
            }

            //Bot messages
            if (settings["msgEnable"] != null)
            {
                msgEnable = settings["msgEnable"].InnerText;
            }
            else
            {
                msgEnable = "SplitsBet enabled!";
            }
            if (settings["msgDisable"] != null)
            {
                msgDisable = settings["msgDisable"].InnerText;
            }
            else
            {
                msgDisable = "SplitsBet disabled!";
            }
            if (settings["msgReset"] != null)
            {
                msgReset = settings["msgReset"].InnerText;
            }
            else
            {
                msgReset = "Run is kill. RIP :(";
            }
            if (settings["msgTimerEnded"] != null)
            {
                msgTimerEnded = settings["msgTimerEnded"].InnerText;
            }
            else
            {
                msgTimerEnded = "Run is over; there is nothing to bet on!";
            }
            if (settings["msgTimerNotRunning"] != null)
            {
                msgTimerNotRunning = settings["msgTimerNotRunning"].InnerText;
            }
            else
            {
                msgTimerNotRunning = "Timer is not running; bets are closed;";
            }
            if (settings["msgTimerPaused"] != null)
            {
                msgTimerPaused = settings["msgTimerPaused"].InnerText;
            }
            else
            {
                msgTimerPaused = "Timer is paused; bets are paused too.";
            }
            if (settings["msgNoScore"] != null)
            {
                msgNoScore = settings["msgNoScore"].InnerText;
            }
            else
            {
                msgNoScore = "Timer is not running; no score available.";
            }
            if (settings["msgNoHighscore"] != null)
            {
                msgNoHighscore = settings["msgNoHighscore"].InnerText;
            }
            else
            {
                msgNoHighscore = "No highscore yet!";
            }
            if (settings["msgNoUnbet"] != null)
            {
                msgNoUnbet = settings["msgNoUnbet"].InnerText;
            }
            else
            {
                msgNoUnbet = "You can't unbet :(";
            }
            if (settings["msgUnbetTimerEnd"] != null)
            {
                msgUnbetTimerEnd = settings["msgUnbetTimerEnd"].InnerText;
            }
            else
            {
                msgUnbetTimerEnd = "The run has ended, you can't unbet!";
            }
            if (settings["msgCheckTimerEnd"] != null)
            {
                msgCheckTimerEnd = settings["msgCheckTimerEnd"].InnerText;
            }
            else
            {
                msgCheckTimerEnd = "The run has ended; nothing to check!";
            }
            if (settings["msgTooLateToBet"] != null)
            {
                msgTooLateToBet = settings["msgTooLateToBet"].InnerText;
            }
            else
            {
                msgTooLateToBet = "Too late to bet for this split; wait for the next one!";
            }
        }
Exemplo n.º 57
0
        /// <summary>
        /// Given the path to a units file, loads the file.
        /// </summary>
        /// <param name="filePath">Path to a units file.</param>
        /// <returns>Unit result code.</returns>
        public UnitResult LoadUnitsFile(string filePath)
        {
            string error = "";

            // Make sure the units file exists.
            if (!File.Exists(filePath))
            {
                return(UnitResult.FileNotFound);
            }

            try
            {
                // Attempt to load the unit file...
                m_UnitsFile.Load(filePath);
            }
            catch (XmlException ex)
            {
                // Create the exception string.
                error = "Error parsing '{0}' at line {1}, position {2}.";
                error = String.Format(error, filePath, ex.LineNumber, ex.LinePosition);

                // Throw the exception.
                throw new UnitFileException(error, ex.Message);
            }

            // Reinitialize the data tables.
            InitTables();

            m_CurUnitFileName     = "";
            m_CurUnitsFileVersion = 0.0;

            // Get a reference to a list of the XML data.
            XmlNodeList xmlData = m_UnitsFile.GetElementsByTagName("*");

            // No XML nodes? This is wrong.
            if (xmlData.Count == 0)
            {
                error = "Error parsing units file '{0}' - file contains no data.";
                error = String.Format(error, filePath);
                throw new UnitFileException(error);
            }

            // Get the root node.
            System.Xml.XmlNode root = xmlData[0];

            // Does the file not start with a "UnitFile" node? We have problems.
            if (root.Name.ToLower() != "unitfile")
            {
                error = "Error parsing units file '{0}' - the file appears corrupt or incomplete.";
                error = String.Format(error, filePath);
                throw new UnitFileException(error);
            }

            // Store off the name of the units file if there is one.
            if (root.Attributes["name"] != null)
            {
                m_CurUnitFileName = root.Attributes["name"].Value;
            }
            else
            {
                // Units file has no internal name set on it.
                SendUnitFileWarning("file has no internal units name - using default.", filePath, null);
                m_CurUnitFileName = "Units";
            }

            // Check units file version.
            if (root.Attributes["version"] != null)
            {
                try
                {
                    m_CurUnitsFileVersion = Convert.ToDouble(root.Attributes["version"].Value);
                }
                catch
                {
                    m_CurUnitsFileVersion = 0.0;
                }

                if (m_CurUnitsFileVersion == 0.0)
                {
                    // File version is 0.0, probably failed to convert to a double.
                    error = "Error parsing '{0}' - file has no valid version number.";
                    error = String.Format(error, filePath);
                    throw new UnitFileException(error);
                }

                if (m_CurUnitsFileVersion > UNITFILE_VERSION)
                {
                    // File version is greater than the maximum we support.
                    error = "Error parsing '{0}' - file version indicates it is made for a newer version of the unit conversion library.";
                    error = String.Format(error, filePath);
                    throw new UnitFileException(error);
                }
            }
            else
            {
                // No version information was found at all.
                error = "Error parsing '{0}' - file has no version number specified.";
                error = String.Format(error, filePath);
                throw new UnitFileException(error);
            }

            int i = 0;

            // Parse all the unit groups and add them.
            for (i = 0; i < root.ChildNodes.Count; i++)
            {
                XmlNode groupnode = root.ChildNodes[i];

                // Ignore comments.
                if (groupnode.Name.ToLower() == "#comment")
                {
                    continue;
                }

                if (groupnode.Name.ToLower() != "unitgroup")
                {
                    SendUnitFileWarning("bad tag found while parsing groups (tag was '{0}'), tag ignored.", filePath, new object[] { groupnode.Name });
                }
                else
                {
                    ParseGroupXMLNode(filePath, groupnode);
                }
            }

            // We were successful.
            return(UnitResult.NoError);
        }
Exemplo n.º 58
0
 public static string GetFieldSearchClause(System.Xml.XmlNode field)
 {
     return(GetFieldSearchClause(field.Name, field.InnerText));
 }
Exemplo n.º 59
0
        /// <summary>
        /// Deserializes the provided xml node.
        /// </summary>
        /// <param name="node">Node to deserialize.</param>
        /// <exception cref="ArgumentNullException">Occurs when the provided <see cref="System.Xml.XmlNode"/> is null.</exception>
        /// <example>This example shows how to use the deserialize method.
        /// <code>
        /// namespace Docunamespace
        /// {
        ///     /// <summary>
        ///     /// Class for the docu.
        ///     /// </summary>
        ///     class DocuClass
        ///     {
        ///         /// <summary>
        ///         /// Xml document that contains all details of a series.
        ///         /// </summary>
        ///         private XmlDocument languageDoc = null;
        ///
        ///         /// <summary>
        ///         /// Initializes a new instance of the DocuClass class.
        ///         /// </summary>
        ///         public DocuClass(string extractionPath)
        ///         {
        ///             // load series xml.
        ///             this.languageDoc = new XmlDocument();
        ///             this.languageDoc.Load(System.IO.Path.Combine(this.extractionPath, string.Format("{0}.xml", this.Language)));
        ///         }
        ///
        ///         /// <summary>
        ///         /// Deserializes all actors of the series.
        ///         /// </summary>
        ///         public Series DeserializeSeries()
        ///         {
        ///             Series series = new Series();
        ///
        ///             // load the xml docs second child.
        ///             XmlNode dataNode = this.languageDoc.ChildNodes[1];
        ///
        ///             // deserialize all episodes and series details.
        ///             foreach (XmlNode currentNode in dataNode.ChildNodes)
        ///             {
        ///                 if (currentNode.Name.Equals("Episode", StringComparison.OrdinalIgnoreCase))
        ///                 {
        ///                     Episode deserialized = new Episode();
        ///                     deserialized.Deserialize(currentNode);
        ///
        ///                     series.AddEpisode(deserialized);
        ///                     continue;
        ///                 }
        ///                 else if (currentNode.Name.Equals("Series", StringComparison.OrdinalIgnoreCase))
        ///                 {
        ///                     series.Deserialize(currentNode);
        ///                     continue;
        ///                 }
        ///             }
        ///         }
        ///     }
        /// }
        /// </code>
        /// </example>
        public void Deserialize(System.Xml.XmlNode node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node", "Provided node must not be null.");
            }

            System.Globalization.CultureInfo cultureInfo = System.Globalization.CultureInfo.CreateSpecificCulture("en-US");

            foreach (XmlNode currentNode in node.ChildNodes)
            {
                if (currentNode.Name.Equals("id", StringComparison.OrdinalIgnoreCase))
                {
                    int result = -1;
                    int.TryParse(currentNode.InnerText, out result);
                    this.Id = result;
                    continue;
                }
                else if (currentNode.Name.Equals("SeriesID", StringComparison.OrdinalIgnoreCase))
                {
                    if (string.IsNullOrEmpty(currentNode.InnerText))
                    {
                        continue;
                    }

                    int result = -1;
                    int.TryParse(currentNode.InnerText, out result);
                    this.SeriesId = result;
                    continue;
                }
                else if (currentNode.Name.Equals("Language", StringComparison.OrdinalIgnoreCase))
                {
                    if (!string.IsNullOrEmpty(currentNode.InnerText))
                    {
                        this.Language = currentNode.InnerText;
                    }
                    continue;
                }
                else if (currentNode.Name.Equals("SeriesName", StringComparison.OrdinalIgnoreCase))
                {
                    if (!string.IsNullOrEmpty(currentNode.InnerText))
                    {
                        this.Name = currentNode.InnerText;
                    }
                    continue;
                }
                else if (currentNode.Name.Equals("banner", StringComparison.OrdinalIgnoreCase))
                {
                    if (!string.IsNullOrEmpty(currentNode.InnerText))
                    {
                        this.Banner = currentNode.InnerText;
                    }
                    continue;
                }
                else if (currentNode.Name.Equals("Overview", StringComparison.OrdinalIgnoreCase))
                {
                    if (!string.IsNullOrEmpty(currentNode.InnerText))
                    {
                        this.Overview = currentNode.InnerText;
                    }
                    continue;
                }
                else if (currentNode.Name.Equals("FirstAired", StringComparison.OrdinalIgnoreCase))
                {
                    if (string.IsNullOrEmpty(currentNode.InnerText))
                    {
                        continue;
                    }

                    this.FirstAired = DateTime.Parse(currentNode.InnerText);
                    continue;
                }
                else if (currentNode.Name.Equals("IMDB_ID", StringComparison.OrdinalIgnoreCase))
                {
                    if (string.IsNullOrEmpty(currentNode.InnerText))
                    {
                        continue;
                    }

                    this.IMDBId = currentNode.InnerText;
                    continue;
                }
                else if (currentNode.Name.Equals("zap2it_id", StringComparison.OrdinalIgnoreCase))
                {
                    if (string.IsNullOrEmpty(currentNode.InnerText))
                    {
                        continue;
                    }

                    this.Zap2ItId = currentNode.InnerText;
                    continue;
                }
                else if (currentNode.Name.Equals("Actors", StringComparison.OrdinalIgnoreCase))
                {
                    if (!string.IsNullOrEmpty(currentNode.InnerText))
                    {
                        this.Actorts = currentNode.InnerText;
                    }
                    continue;
                }
                else if (currentNode.Name.Equals("Airs_DayOfWeek", StringComparison.OrdinalIgnoreCase))
                {
                    if (string.IsNullOrEmpty(currentNode.InnerText))
                    {
                        continue;
                    }

                    this.AirsDayOfWeel = currentNode.InnerText;
                    continue;
                }
                else if (currentNode.Name.Equals("Airs_Time", StringComparison.OrdinalIgnoreCase))
                {
                    if (string.IsNullOrEmpty(currentNode.InnerText))
                    {
                        continue;
                    }

                    this.AirsTime = currentNode.InnerText;
                    continue;
                }
                else if (currentNode.Name.Equals("ContentRating", StringComparison.OrdinalIgnoreCase))
                {
                    if (!string.IsNullOrEmpty(currentNode.InnerText))
                    {
                        this.ContentRating = currentNode.InnerText;
                    }
                    continue;
                }
                else if (currentNode.Name.Equals("Genre", StringComparison.OrdinalIgnoreCase))
                {
                    if (string.IsNullOrEmpty(currentNode.InnerText))
                    {
                        continue;
                    }

                    this.Genre = currentNode.InnerText;
                    continue;
                }
                else if (currentNode.Name.Equals("Network", StringComparison.OrdinalIgnoreCase))
                {
                    if (string.IsNullOrEmpty(currentNode.InnerText))
                    {
                        continue;
                    }

                    this.Network = currentNode.InnerText;
                }
                else if (currentNode.Name.Equals("NetworkID", StringComparison.OrdinalIgnoreCase))
                {
                    int result = -1;
                    int.TryParse(currentNode.InnerText, out result);
                    this.NetworkId = result;
                    continue;
                }
                else if (currentNode.Name.Equals("Rating", StringComparison.OrdinalIgnoreCase))
                {
                    if (string.IsNullOrEmpty(currentNode.InnerText))
                    {
                        continue;
                    }

                    double result = -1.0;
                    double.TryParse(currentNode.InnerText, System.Globalization.NumberStyles.Number, cultureInfo, out result);
                    this.Rating = result;
                    continue;
                }
                else if (currentNode.Name.Equals("RatingCount", StringComparison.OrdinalIgnoreCase))
                {
                    int result = -1;
                    int.TryParse(currentNode.InnerText, out result);
                    this.RatingCount = result;
                    continue;
                }
                else if (currentNode.Name.Equals("Runtime", StringComparison.OrdinalIgnoreCase))
                {
                    if (string.IsNullOrEmpty(currentNode.InnerText))
                    {
                        continue;
                    }

                    double result = -1.0;
                    double.TryParse(currentNode.InnerText, System.Globalization.NumberStyles.Number, cultureInfo, out result);
                    this.Runtime = result;
                    continue;
                }
                else if (currentNode.Name.Equals("Status", StringComparison.OrdinalIgnoreCase))
                {
                    if (string.IsNullOrEmpty(currentNode.InnerText))
                    {
                        continue;
                    }

                    this.Status = currentNode.InnerText;
                    continue;
                }
                else if (currentNode.Name.Equals("added", StringComparison.OrdinalIgnoreCase))
                {
                    if (string.IsNullOrEmpty(currentNode.InnerText))
                    {
                        continue;
                    }

                    this.AddedDate = DateTime.Parse(currentNode.InnerText);
                    continue;
                }
                else if (currentNode.Name.Equals("addedBy", StringComparison.OrdinalIgnoreCase))
                {
                    int result = -1;
                    int.TryParse(currentNode.InnerText, out result);
                    this.AddedByUserId = result;
                    continue;
                }
                else if (currentNode.Name.Equals("fanart", StringComparison.OrdinalIgnoreCase))
                {
                    if (!string.IsNullOrEmpty(currentNode.InnerText))
                    {
                        this.FanArt = currentNode.InnerText;
                    }
                    continue;
                }
                else if (currentNode.Name.Equals("lastupdated", StringComparison.OrdinalIgnoreCase))
                {
                    if (string.IsNullOrEmpty(currentNode.InnerText))
                    {
                        continue;
                    }

                    long result = -1;
                    long.TryParse(currentNode.InnerText, out result);
                    this.LastUpdated = result;
                    continue;
                }
                else if (currentNode.Name.Equals("poster", StringComparison.OrdinalIgnoreCase))
                {
                    if (!string.IsNullOrEmpty(currentNode.InnerText))
                    {
                        this.Poster = currentNode.InnerText;
                    }
                    continue;
                }
                else if (currentNode.Name.Equals("tms_wanted", StringComparison.OrdinalIgnoreCase))
                {
                    int result = -1;
                    int.TryParse(currentNode.InnerText, out result);

                    this.TMSWanted = result > 0 ? true : false;
                    continue;
                }
            }

            this.Initialize();
        }
Exemplo n.º 60
0
 public void LoadFromXML(System.Xml.XmlNode node)
 {
     throw new Exception("The method or operation is not implemented.");
 }