상속: IEnumerable
예제 #1
0
        /*	public void HTMLNodeObject(string argFirst,int argSecond)
         *  {
         *  string tagName = argFirst;//arguments[0];
         *  //int one = 1;
         *  //int two = 2;
         *  System.Xml.XmlNodeList nodeList=null;
         *
         *  if (tagName==FRAMESET || tagName==FRAME)
         *          nodeList = framesetdoc.GetElementsByTagName(tagName);
         *  else
         *          nodeList = testdoc.GetElementsByTagName(tagName);
         *
         *  if (argFirst != "") //if (arguments.length == one)
         *          this.node = nodeList.Item(util.FIRST);
         *  if (argSecond != -1) //else if (arguments.length == two)
         *          this.node = nodeList.Item(argSecond);//arguments[SECOND]);
         *  }
         *
         *  public System.Xml.XmlNode originalHTMLDocument(string arg)
         *  {
         *          string tagName = arg;
         *          //int one = 1;
         *          //int two = 2;
         *
         *          System.Xml.XmlNodeList nodeList = originaldoc.GetElementsByTagName(tagName);
         *          this.node = nodeList.Item(util.FIRST).CloneNode(true);
         *          return this.node;
         *  }
         */

//	public string getTableCaption(object table)
//	{
//		return table.caption;
//	}
//
//	public void getTableHead(object table)
//	{
//		return table.tHead;
//	}
//
//	public void getTableFoot(object table)
//	{
//	return table.tFoot;
//	}

        public static System.Xml.XmlNode nodeObject(int argFirst, int argSecond)//args)
        {
            string tagName = employee;

            System.Xml.XmlNodeList nodeList = null;
            System.Xml.XmlNode     _node    = null;

            nodeList = getRootNode().GetElementsByTagName(tagName);
            System.Xml.XmlElement parentNode = (System.Xml.XmlElement)nodeList.Item(argFirst); //arguments[FIRST]);

            if (argFirst != -1)                                                                //if (arguments.length == one)
            {
                _node = parentNode;
            }

            if (argSecond != -1)//else if (arguments.length == two)
            {
                System.Xml.XmlNodeList list = getSubNodes(parentNode);
                _node = getElement(getSubNodes(parentNode), argSecond);//arguments[SECOND]);
                //_node = getElement((System.Xml.XmlNodeList)getSubNodes(parentNode), argSecond);//arguments[SECOND]);
            }

            //_attributes = getAttributes(_node);
            //_subNodes = getSubNodes((System.Xml.XmlElement)_node);

            return(_node);
        }
예제 #2
0
        //public bool SameCustomField(string customKey, System.Guid customFieldID)
        //{
        //    if (m_customFieldsByGUID.ContainsKey(customFieldID.ToString()))
        //    {
        //        if (m_customFieldsByGUID[customFieldID.ToString()] == customKey)
        //            return true;
        //    }
        //    return false;
        //}

        /// <summary>
        /// read the passed in path and file and pull out the classes and fields
        /// </summary>
        /// <param name="xmlFileName"></param>
        /// <returns>true if successfull</returns>
        public bool ReadLexImportFields(string xmlFileName)
        {
            bool success = true;

            System.Xml.XmlDocument xmlMap = new System.Xml.XmlDocument();
            try
            {
                xmlMap.Load(xmlFileName);
                System.Xml.XmlNode abbrSignatures = xmlMap.SelectSingleNode("ImportFields/AbbreviationSignatures");
                ReadSignatureNode(abbrSignatures);

                System.Xml.XmlNodeList classList = xmlMap.SelectNodes("ImportFields/Class");
                foreach (System.Xml.XmlNode classNode in classList)
                {
                    if (!ReadAClassNode(classNode))
                    {
                        success = false;
                    }
                }
                success = Initialize();

                // 6/2/08  Now add in any custom fields that are currently defined in the database
            }
            catch (System.Xml.XmlException)
            {
//				string ErrMsg = "Error: invalid mapping file '" + xmlFileName + "' : " + e.Message;
                success = false;
            }
            return(success);
        }
예제 #3
0
        private System.Xml.XmlNodeList getSourceFieldNodes()
        {
            System.Xml.XmlNodeList nodes = null;
            if (FieldGrid.SelectedIndex == -1)
            {
                return(nodes);
            }
            int fieldnum = FieldGrid.SelectedIndex + 1;

            System.Xml.XmlNodeList fnodes = getFieldNodes(fieldnum);
            string sname = "";

            try
            {
                sname = fnodes.Item(0).SelectSingleNode("SourceName").InnerText;
            }
            catch
            {
                ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Could not find SourceName element for field (row) number " + fieldnum.ToString());
                return(nodes);
            }
            string xpath = "//SourceField[@Name='" + sname + "']"; // Source field values

            System.Xml.XmlNodeList nodelist = _xml.SelectNodes(xpath);
            if (nodelist != null && nodelist.Count == 1)
            {
                return(nodelist);
            }
            else
            {
                return(nodes);
            }
        }
예제 #4
0
        private static void FillInCandidates(Dictionary<string, UserInfo> candidates, XmlNodeList nodes, StreamWriter writer)
        {
            foreach (XmlNode userNode in nodes)
            {
                string userName = userNode.Attributes["name"].Value;
                int edits = int.Parse(userNode.Attributes["editcount"].Value);

                XmlNode editorNode = userNode.SelectSingleNode("//user[@name=" + EscapeXPathQuery(userName) + "]/groups[g='editor' or g='autoeditor' or g='sysop']/g");
                if (editorNode != null)
                {
                    writer.WriteLine(userName);
                }
                else if (edits > 500 && !candidates.ContainsKey(userName))
                {
                    UserInfo userInfo = new UserInfo();
                    userInfo.User = userName;
                    userInfo.Edits = edits;
                    if (!string.IsNullOrEmpty(userNode.Attributes["registration"].Value))
                    {
                        userInfo.Registration = DateTime.Parse(userNode.Attributes["registration"].Value,
                            null,
                            System.Globalization.DateTimeStyles.AssumeUniversal);
                    }
                    candidates.Add(userName, userInfo);
                }
            }
        }
예제 #5
0
        private void ReadTraceLogConfig()
        {
            System.Xml.XmlNode udp = this.xmlNode.SelectSingleNode("//Trace");
            if (udp != null)
            {
                System.Xml.XmlNodeList configs = udp.SelectNodes("Config");
                foreach (System.Xml.XmlNode config in configs)
                {
                    //id="capture" category="" level="DEBUG" module="capture"
                    System.Xml.XmlAttribute id       = config.Attributes["id"];
                    System.Xml.XmlAttribute category = config.Attributes["category"];
                    System.Xml.XmlAttribute level    = config.Attributes["level"];
                    System.Xml.XmlAttribute module   = config.Attributes["module"];
                    if (id == null)
                    {
                        throw new StackException("config error: console config should have id.");
                    }

                    // create a config instance
                    TraceLogConfig traceLogConfig = new TraceLogConfig();
                    traceLogConfig.Category = category.Value;
                    traceLogConfig.Level    = (LogLevel)Enum.Parse(typeof(LogLevel), level.Value);
                    traceLogConfig.Module   = module.Value;

                    if (this.logConfigs.ContainsKey(id.Value))
                    {
                        throw new StackException("the id of config must be unique.");
                    }
                    this.logConfigs.Add(id.Value, traceLogConfig);
                }
            }
        }
예제 #6
0
        private void BindHeaderMenu()
        {
            string filename = System.Web.HttpContext.Current.Request.MapPath(Globals.ApplicationPath + string.Format("/Templates/sites/" + Hidistro.Membership.Context.HiContext.Current.User.UserId.ToString() + "/{0}/config/HeaderMenu.xml", this.themName));

            System.Xml.XmlDocument xmlDocument = new System.Xml.XmlDocument();
            xmlDocument.Load(filename);
            System.Data.DataTable dataTable = new System.Data.DataTable();
            dataTable.Columns.Add("Id", typeof(int));
            dataTable.Columns.Add("Title");
            dataTable.Columns.Add("DisplaySequence", typeof(int));
            dataTable.Columns.Add("Url");
            dataTable.Columns.Add("Category");
            dataTable.Columns.Add("Visible");
            System.Xml.XmlNode xmlNode = xmlDocument.SelectSingleNode("root");
            this.txtCategoryNum.Text = xmlNode.Attributes["CategoryNum"].Value;
            System.Xml.XmlNodeList childNodes = xmlNode.ChildNodes;
            foreach (System.Xml.XmlNode xmlNode2 in childNodes)
            {
                System.Data.DataRow dataRow = dataTable.NewRow();
                dataRow["Id"]              = int.Parse(xmlNode2.Attributes["Id"].Value);
                dataRow["Title"]           = xmlNode2.Attributes["Title"].Value;
                dataRow["DisplaySequence"] = int.Parse(xmlNode2.Attributes["DisplaySequence"].Value);
                dataRow["Category"]        = xmlNode2.Attributes["Category"].Value;
                dataRow["Url"]             = xmlNode2.Attributes["Url"].Value;
                dataRow["Visible"]         = xmlNode2.Attributes["Visible"].Value;
                dataTable.Rows.Add(dataRow);
            }
            dataTable.DefaultView.Sort      = "DisplaySequence ASC";
            this.grdMyHeaderMenu.DataSource = dataTable;
            this.grdMyHeaderMenu.DataBind();
        }
예제 #7
0
 public void ParseXML(XmlNodeList node)
 {
     foreach (XmlNode node2 in node)
     {
         //Debug.WriteLine("\tService Node >" + node2.Value + " : " + node2.Name);
         switch (node2.Name)
         {
             case ("Name"):
                 {
                     name = node2.FirstChild.Value;
                     break;
                 }
             case ("Port"):
                 {
                     port = Convert.ToInt32(node2.FirstChild.Value);
                     break;
                 }
             case ("Status"):
                 {
                     status = node2.FirstChild.Value;
                     break;
                 }
         }
     }
 }
예제 #8
0
        private void AddSubMenusToMainMenuConfiguration(XmlNode mainMenuNode, XmlDocument userPermission)
        {
            try
            {
                System.Xml.XmlNodeList wizardNodeList = GetWizardNodesFromSiteConfigXML();
                int intWizStep = 0;
                if (wizardNodeList != null)
                {
                    foreach (System.Xml.XmlNode wizardNode in wizardNodeList)
                    {
                        XmlElement xmlelem = userPermission.CreateElement("subMenuItem");
                        xmlelem.SetAttribute("displayText", wizardNode.SelectSingleNode("wizardname").InnerText);

                        //This is used if From ViewStyle.aspx, if Edit link is clicked,
                        // and then if user clicks on 'Menu' link on submenu, the querystring Edit=1 should be appended
                        // This querystring is neccessary, to display if ChangeStyle is to be seen in edit mode or add mode
                        string editQuery = string.Empty;
                        if (!string.IsNullOrEmpty(Convert.ToString(Request.QueryString["Edit"])))
                        {
                            editQuery = "&Edit=" + Convert.ToString(Request.QueryString["Edit"]);
                        }
                        xmlelem.SetAttribute("link", "~/Pages/SiteConfig/ChangeStyle.aspx?WizardActiveIndex=" + intWizStep + editQuery);
                        xmlelem.SetAttribute("users", "1");
                        xmlelem.SetAttribute("enabled", "true");
                        xmlelem.SetAttribute("display", "true");
                        mainMenuNode.AppendChild(xmlelem);
                        intWizStep += 1;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #9
0
        /// <summary>Parses a segment profile </summary>
        private Seg parseSegmentProfile(System.Xml.XmlElement elem)
        {
            Seg segment = new Seg();

            parseProfileStuctureData(segment, elem);

            int childIndex = 1;

            System.Xml.XmlNodeList children = elem.ChildNodes;
            for (int i = 0; i < children.Count; i++)
            {
                System.Xml.XmlNode n = children.Item(i);
                if (System.Convert.ToInt16(n.NodeType) == (short)System.Xml.XmlNodeType.Element)
                {
                    System.Xml.XmlElement child = (System.Xml.XmlElement)n;
                    if (child.Name.ToUpper().Equals("Field".ToUpper()))
                    {
                        Field field = parseFieldProfile(child);
                        segment.setField(childIndex++, field);
                    }
                }
            }

            return(segment);
        }
예제 #10
0
        private static Stream SaveDAPImage(System.Xml.XmlDocument hDoc, string strFile)
        {
            System.Xml.XmlNodeList hNodeList = hDoc.SelectNodes("/" + Geosoft.Dap.Xml.Common.Constant.Tag.GEO_XML_TAG + "/" + Geosoft.Dap.Xml.Common.Constant.Tag.RESPONSE_TAG + "/" + Geosoft.Dap.Xml.Common.Constant.Tag.IMAGE_TAG + "/" + Geosoft.Dap.Xml.Common.Constant.Tag.PICTURE_TAG);
            if (hNodeList.Count == 0)
            {
                hNodeList = hDoc.SelectNodes("/" + Geosoft.Dap.Xml.Common.Constant.Tag.GEO_XML_TAG + "/" + Geosoft.Dap.Xml.Common.Constant.Tag.RESPONSE_TAG + "/" + Geosoft.Dap.Xml.Common.Constant.Tag.TILE_TAG);
            }
            System.IO.FileStream   fs = new System.IO.FileStream(strFile, System.IO.FileMode.Create);
            System.IO.BinaryWriter bs = new System.IO.BinaryWriter(fs);

            foreach (System.Xml.XmlNode hNode in hNodeList)
            {
                System.Xml.XmlNode hN1       = hNode.FirstChild;
                string             jpegImage = hN1.Value;

                if (jpegImage != null)
                {
                    byte[] jpegRawImage = Convert.FromBase64String(jpegImage);

                    bs.Write(jpegRawImage);
                }
            }
            bs.Flush();
            bs.Close();
            fs.Close();
            return(fs);
        }
예제 #11
0
        protected override void ExecuteTask()
        {
            if (srcurl.EndsWith("/") == false)
            {
                srcurl += "/";
            }

            if (destdir.EndsWith("\\") == false)
            {
                destdir += "\\";
            }


            if (oldrev == "0")
            {
                NoshellProcess.Execute("svn", string.Format("export --force -r {0} {1} {2}", newrev, srcurl, destdir));
            }
            else
            {
                System.Xml.XmlDocument xml = NoshellProcess.ExcuteXML("svn",
                                                                      string.Format("diff -r {0}:{1} --summarize --xml {2}", oldrev, newrev, srcurl));

                System.Xml.XmlNodeList nodes = xml.SelectNodes("/diff/paths/path");

                for (int i = 0; i < nodes.Count; i++)
                {
                    XmlNode node = nodes.Item(i);

                    string kind  = node.Attributes["kind"].Value;
                    string props = node.Attributes["props"].Value;
                    string item  = node.Attributes["item"].Value;
                    string path  = node.InnerXml.Replace(srcurl, "").Replace("/", "\\");

                    if (item == "none" && props != "none")
                    {
                        item = props;
                    }

                    if (kind == "file")
                    {
                        string destfilename = System.IO.Path.Combine(destdir, path);

                        if (System.IO.Directory.Exists(System.IO.Path.GetDirectoryName(destfilename)) == false)
                        {
                            System.IO.Directory.CreateDirectory(System.IO.Path.GetDirectoryName(destfilename));
                        }

                        System.Console.WriteLine(string.Format("Export {0}", path));
                        NoshellProcess.Execute("svn", string.Format("export --force -r {0} {1} {2}", newrev, node.InnerXml, destfilename));
                    }
                }
            }

            // 마지막으로 익스포트 된 파일을 전부 소문자로 변환한다.
            // 안하면 문제의 여지가 있다
            ConvertLowerCase(destdir);

            AddPatchInfo(System.IO.Path.Combine(destdir, "patchinfo.xml"), "PatcherFiles", patcherfiles);
            AddPatchInfo(System.IO.Path.Combine(destdir, "patchinfo.xml"), "VerifyFiles", verifyfiles);
        }
예제 #12
0
        void ICustomIdentityConfiguration.LoadCustomConfiguration(System.Xml.XmlNodeList nodeList)
        {
            // Retrieve the endpoint address of the centralized session security token cache service running in the web farm
            XmlElement cacheServiceAddressElement = nodeList.GetFirst("No child config element found under <tokenReplayCache>.");

            if (cacheServiceAddressElement?.LocalName != "distributedReplayCacheConfiguration")
            {
                throw new ConfigurationErrorsException("First child config element under <tokenReplayCache> is expected to be <distributedReplayCacheConfiguration>.");
            }

            string cacheServiceAddress = cacheServiceAddressElement.GetStringAttribute("url");

            if (!cacheServiceAddress.EndsWith("/"))
            {
                cacheServiceAddress = cacheServiceAddress + "/";
            }

            int maxCacheSize  = cacheServiceAddressElement.GetIntAttribute("maxCacheSize");
            int purgeInterval = cacheServiceAddressElement.GetIntAttribute("purgeInterval");

            int servicePointConnectionLimit = cacheServiceAddressElement.GetIntAttribute("servicePointConnectionLimit");
            int httpClientTimeoutMsecs      = cacheServiceAddressElement.GetIntAttribute("httpClientTimeoutMsecs");

            // Initialize the proxy to the WebFarmSessionSecurityTokenCacheService
            Initialize(cacheServiceAddress, maxCacheSize, purgeInterval, servicePointConnectionLimit, httpClientTimeoutMsecs);
        }
예제 #13
0
    public IEnumerator loaddata()
    {
        string url = npclistname;
        WWW    www = new WWW(url);

        yield return(www);

        if (www.error == null)
        {
            //Debug.LogError("loading npclist");
            //no error occured
            string xml = www.data;
            //	Debug.Log(xml);
            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.LoadXml(xml);

            System.Xml.XmlNodeList NpcListNodes = xmlDoc.GetElementsByTagName("Npcs");
            if (NpcListNodes.Count > 0)
            {
                XmlElement coun = (XmlElement)NpcListNodes.Item(0);
                ReadNpcList(coun);
            }
        }
        www.Dispose();
        www = null;
    }
예제 #14
0
        object IConfigurationSectionHandler.Create(object parent, object configContext, XmlNode section)
        {
            MailConfig mailConfig = new MailConfig();

            mailConfig.host = section.SelectSingleNode("host").Attributes["value"].InnerText;

            Email sender = new Email(section.SelectSingleNode("sender").Attributes["email"].InnerText,
                                     section.SelectSingleNode("sender").Attributes["name"].InnerText);

            mailConfig.sender = sender;

            List <Email> to = new List <Email>();

            System.Xml.XmlNodeList processesNodes = section.SelectNodes("to");

            foreach (XmlNode processNode in processesNodes)
            {
                Email email = new Email(processNode.Attributes["email"].InnerText, processNode.Attributes["name"].InnerText);
                to.Add(email);
            }

            mailConfig.to      = to;
            mailConfig.subject = section.SelectSingleNode("subject").Attributes["value"].InnerText;
            mailConfig.message = section.SelectSingleNode("message").Attributes["value"].InnerText;

            return(mailConfig);
        }
예제 #15
0
        public Dictionary<string, string> GetPrice(XmlNodeList listp)
        {
            Dictionary<string, string> prices = new Dictionary<string, string>();

            foreach (XmlNode p in listp)
            {

                foreach (XmlNode node in p.ChildNodes)
                {

                    try
                    {
                        string text = node.InnerText;

                        decimal price = Decimal.Parse(text.Replace("$", ""));

                        if (node.Name != "Amount")
                        {
                        text ="$"+(price).ToString("F");
                         }

                        prices.Add(node.Name, text);

                    }
                    catch (Exception ex)
                    {
                        prices.Add(node.Name, node.InnerText);
                    }
                }

            }

            return prices;
        }
예제 #16
0
        /// <summary>Parses a component profile </summary>
        private AbstractComponent parseComponentProfile(System.Xml.XmlElement elem, bool isSubComponent)
        {
            AbstractComponent comp = null;

            if (isSubComponent)
            {
                comp = new SubComponent();
            }
            else
            {
                comp = new Component();

                int childIndex = 1;
                System.Xml.XmlNodeList children = elem.ChildNodes;
                for (int i = 0; i < children.Count; i++)
                {
                    System.Xml.XmlNode n = children.Item(i);
                    if (System.Convert.ToInt16(n.NodeType) == (short)System.Xml.XmlNodeType.Element)
                    {
                        System.Xml.XmlElement child = (System.Xml.XmlElement)n;
                        if (child.Name.ToUpper().Equals("SubComponent".ToUpper()))
                        {
                            SubComponent subcomp = (SubComponent)parseComponentProfile(child, true);
                            ((Component)comp).setSubComponent(childIndex++, subcomp);
                        }
                    }
                }
            }

            parseAbstractComponentData(comp, elem);

            return(comp);
        }
예제 #17
0
 public static void AreEqual(XmlNodeList ctpNodes, List<Crop> crops, Catalog catalog, Dictionary<string, List<UniqueId>> linkList)
 {
     for (var i = 0; i < ctpNodes.Count; i++)
     {
         AreEqual(ctpNodes[i], crops[i], catalog, linkList);
     }
 }
예제 #18
0
        public object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            List <SyncConfigurationSection> items = new List <SyncConfigurationSection>();

            System.Xml.XmlNodeList processesNodes = section.SelectNodes("SyncSection");
            foreach (XmlNode processNode in processesNodes)
            {
                // only keep section that has the correct mode
                if (processNode.Attributes["Mode"].InnerText != SyncProvisionMode.ToString())
                {
                    continue;
                }

                var syncScopeNodes = processNode.SelectNodes("SyncScope");
                foreach (XmlNode syncScopeNode in syncScopeNodes)
                {
                    SyncConfigurationSection item = new SyncConfigurationSection();
                    item.ScopeName = syncScopeNode.Attributes["ScopeName"].InnerText;
                    var tableNames = syncScopeNode.Attributes["Tables"].InnerText;
                    if (String.IsNullOrEmpty(tableNames))
                    {
                        throw new InvalidOperationException("Tables Attribute Missing");
                    }
                    item.Tables = tableNames.Split(new Char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
                    items.Add(item);
                }
                break;  // we are done
            }
            return(items);
        }
        private static void ProcessItemGroups(XmlNodeList itemGroups, Project project)
        {
            project.References = new List<Reference>();
            project.SourceFiles = new List<SourceCodeFile>();
            project.ProjectReferences = new List<ProjectReference>();
            foreach (XmlNode itemGroup in itemGroups){
                var childNodes = itemGroup.ChildNodes;
                if (childNodes.Count > 0){
                    switch (childNodes[0].Name){
                        case Constants.ITEM_GROUP_CPPINCLUDE:
                            ProcessSourceItems(childNodes, project, Constants.ITEM_GROUP_CPPINCLUDE);
                            break;
                        case Constants.ITEM_GROUP_CPPCOMPILE:
                            ProcessSourceItems(childNodes, project, Constants.ITEM_GROUP_CPPCOMPILE);
                            break;
                        case Constants.ITEM_GROUP_RESOURCECOMPILE:
                            ProcessSourceItems(childNodes, project, Constants.ITEM_GROUP_RESOURCECOMPILE);
                            break;

                        //case Constants.ITEM_GROUP_PROJECTREFERENCE:
                        //    ProcessProjectReferenceItems(childNodes, project);
                        //    break;
                        //case Constants.ITEM_GROUP_BOOTSTRAPPERPACKAGE:
                        //    break;
                        //case Constants.ITEM_GROUP_REFERENCE:
                        //    ProcessReferenceItems(childNodes, project);
                        //    break;
                    }
                }
            }
        }
예제 #20
0
		/// <summary>
		/// Adds appsettings lines to web.config file to control pooling, statemanagement, and workspace loading.
		/// </summary>
		/// <param name="xmlDoc">Document pointing to the web.config file.</param>
		internal static bool AddAppSettings(XmlDocument xmlDoc) 
		{
			bool updated = false;
			XmlNode appSettingsNode = xmlDoc.SelectSingleNode("//appSettings");
			if(appSettingsNode == null) {
				appSettingsNode = xmlDoc.CreateNode(XmlNodeType.Element, "appSettings", "");
				System.Xml.XmlNodeList compNode = xmlDoc.GetElementsByTagName("configuration");
				compNode.Item(0).InsertBefore(appSettingsNode, compNode.Item(0).FirstChild);
				updated = true;
			}
			if(appSettingsNode.SelectSingleNode("add[@key='MapInfo.Engine.Session.Pooled']") == null) {
				updated |= AddCommentNode(xmlDoc, appSettingsNode, L10NUtils.Resources.GetString("PooledSetting"));
				updated |= AddCommentNode(xmlDoc, appSettingsNode, "<add key=\"MapInfo.Engine.Session.Pooled\" value=\"false\" />");
			}
			if(appSettingsNode.SelectSingleNode("add[@key='MapInfo.Engine.Session.State']") == null) {
				updated |= AddCommentNode(xmlDoc, appSettingsNode, L10NUtils.Resources.GetString("StateSetting"));
				updated |= AddCommentNode(xmlDoc, appSettingsNode, "<add key=\"MapInfo.Engine.Session.State\" value=\"HttpSessionState\" />");
			}
			if(appSettingsNode.SelectSingleNode("add[@key='MapInfo.Engine.Session.Workspace']") == null) {
				updated |= AddCommentNode(xmlDoc, appSettingsNode, L10NUtils.Resources.GetString("WorkspaceSetting"));
				updated |= AddCommentNode(xmlDoc, appSettingsNode, "<add key=\"MapInfo.Engine.Session.Workspace\" value=\"c:\\my workspace.mws\" />");
			}
			if(appSettingsNode.SelectSingleNode("add[@key='MapInfo.Engine.Session.UseCallContext']") == null) 
			{
				updated |= AddCommentNode(xmlDoc, appSettingsNode, L10NUtils.Resources.GetString("UseCallContextSetting"));
				updated |= AddCommentNode(xmlDoc, appSettingsNode, "<add key=\"MapInfo.Engine.Session.UseCallContext\" value=\"true\" />");
			}
			if(appSettingsNode.SelectSingleNode("add[@key='MapInfo.Engine.Session.RestoreWithinCallContext']") == null) {
				updated |= AddCommentNode(xmlDoc, appSettingsNode, L10NUtils.Resources.GetString("RestoreWithinCallContextSetting"));
				updated |= AddCommentNode(xmlDoc, appSettingsNode, "<add key=\"MapInfo.Engine.Session.RestoreWithinCallContext\" value=\"true\" />");
			}
			return updated;
		}
예제 #21
0
 public static void AreEqual(XmlNodeList prnNodes, List<ProductComponent> productComponents, XmlNodeList productNodes, Catalog catalog, Dictionary<string, List<UniqueId>> linkList)
 {
     for (int i = 0; i < prnNodes.Count; i++)
     {
         AreEqual(prnNodes[i], productComponents[i], productNodes, catalog, linkList);
     }
 }
예제 #22
0
		/// <summary>
		/// Adds lines containing httpmodules to web.config file. 
		/// </summary>
		/// <param name="xmlDoc">Document pointing to web.config file.</param>
		/// <remarks>This module handles the MapInfo session creation.</remarks>
		internal static bool AddHttpModules(XmlDocument xmlDoc) 
		{
			bool updated = false;
			// Now create httphandler node
			XmlNode httpNode = xmlDoc.SelectSingleNode("//httpModules");
			if (httpNode == null) {
				httpNode = xmlDoc.CreateNode(XmlNodeType.Element, "httpModules", "");
			}

			string searchStr = string.Format("//add[contains(@type, '{0}')]", "MapInfo.Engine.WebSessionActivator");
			XmlNode node = xmlDoc.SelectSingleNode(searchStr);
			AssemblyName coreEngineAssembly = typeof(MapInfo.Engine.WebSessionActivator).Assembly.GetName();
			if (RemoveEntry(node, coreEngineAssembly, "type")) {
				XmlNode addNode = xmlDoc.CreateNode(XmlNodeType.Element, "add", "");
				
				System.Xml.XmlAttribute addAttrib1 = xmlDoc.CreateAttribute("type");
				addAttrib1.Value = string.Format("{0}, {1}", "MapInfo.Engine.WebSessionActivator", coreEngineAssembly.FullName);
				addNode.Attributes.Append(addAttrib1);

				System.Xml.XmlAttribute addAttrib2 = xmlDoc.CreateAttribute("name");
				addAttrib2.Value = "WebSessionActivator";
				addNode.Attributes.Append(addAttrib2);

				httpNode.AppendChild(addNode);
				updated = true;
			}

			// Now insert this information into system.web node in the file
			if (updated) {
				System.Xml.XmlNodeList sysNode = xmlDoc.GetElementsByTagName("system.web");
				sysNode.Item(0).AppendChild(httpNode);
			}
			return updated;
		}
예제 #23
0
 private static bool IsIndexColumn(string name, XmlNodeList indexes)
 {
     foreach (XmlNode index in indexes)
         if (index["primary"].InnerText == name)
             return true;
     return false;
 }
예제 #24
0
		internal static bool AddSessionState(XmlDocument xmlDoc)
		{
			bool updated = false;
			XmlNode sessStateNode = xmlDoc.SelectSingleNode("//sessionState");
			if (sessStateNode == null) {
				sessStateNode = xmlDoc.CreateNode(XmlNodeType.Element, "sessionState", "");

				System.Xml.XmlAttribute addAttrib1 = xmlDoc.CreateAttribute("mode");
				addAttrib1.Value = "StateServer";
				sessStateNode.Attributes.Append(addAttrib1);

				System.Xml.XmlAttribute addAttrib2 = xmlDoc.CreateAttribute("stateConnectionString");
				addAttrib2.Value = "tcpip=127.0.0.1:42424";
				sessStateNode.Attributes.Append(addAttrib2);

				System.Xml.XmlAttribute addAttrib3 = xmlDoc.CreateAttribute("sqlConnectionString");
				addAttrib3.Value = "data source=127.0.0.1;user	id=sa;password="******"cookieless");
				addAttrib4.Value = "false";
				sessStateNode.Attributes.Append(addAttrib4);

				System.Xml.XmlAttribute addAttrib5 = xmlDoc.CreateAttribute("timeout");
				addAttrib5.Value = "20";
				sessStateNode.Attributes.Append(addAttrib5);
				
				System.Xml.XmlNodeList sysNode = xmlDoc.GetElementsByTagName("system.web");
				sysNode.Item(0).AppendChild(sessStateNode);

				updated = true;
			}

			return updated;
		}
예제 #25
0
 // ==================== METHODS ============================================
 public bool getInformation(String sId, ref XmlNodeList ndList, ref XmlNode ndMovie)
 {
     try {
     // Check if we currently have information on this movie
     if (sId != this.idMovie) {
       int iWaitTime = 1;    // Number of seconds to wait
       // Try get information
       String sUrl = sBaseUrl + "idmovie-" + sId + "/xml";
       String sContent = WebRequestGetData(sUrl);
       while (!sContent.StartsWith ("<") ) {
     // Try again
     sContent = WebRequestGetData(sUrl);
     // Check what we receive back
     if (sContent == null) {
       // Indicate that this is a premature end
       errHandle.Status("getInformation: webrequest time-out");
       return false;
     }
       }
       // Read as XmlDocument
       pdxMovie.LoadXml(sContent);
       // Set the currnet idmovie
       this.idMovie = sId;
     }
     // Set the list of nodes for this move
     ndList = pdxMovie.SelectNodes("./descendant::subtitle");
     ndMovie = pdxMovie.SelectSingleNode("./descendant::Movie");
     return true;
       } catch (Exception ex) {
     errHandle.DoError("osrMoview/getInformation", ex);
     return false;
       }
 }
예제 #26
0
        private bool LoadXML(XmlNodeList xnl)
        {
            m_fFoundSpritePalettes = false;
            m_fFoundSprites = false;
            m_fFoundBackgroundPalettes = false;
            m_fFoundBackgroundSprites = false;
            m_fFoundBackgroundMap = false;

            foreach (XmlNode xn in xnl)
            {
                // Old version 1 file format.
                if (xn.Name == "gba_tileset"
                    // Obsolete name for gba_tileset.
                    // No longer used - included for backwards compatibility.
                    || xn.Name == "gba_sprite_collection"
                    )
                {
                    if (!LoadXML_OLD_gba_tileset(xn.ChildNodes))
                        return false;
                }

                // Version 2 files.
                if (xn.Name == "spritely")
                {
                    if (!LoadXML_spritely(xn))
                        return false;
                }
            }

            if (!m_fFoundSpritePalettes)
            {
                Palette16 pal = m_doc.Palettes.AddPalette16(Options.DefaultPaletteName, 0, "");
                pal.SetDefaultPalette();
            }
            if (!m_fFoundSprites)
            {
                Palette pal = m_doc.Palettes.GetPalette(0);
                m_doc.Spritesets.AddSpriteset(Options.DefaultSpritesetName, Options.DefaultPaletteId, "", pal);
            }
            if (!m_fFoundBackgroundPalettes)
            {
                Palette16 bgpal = m_doc.BackgroundPalettes.AddPalette16(Options.DefaultBgPaletteName, 0, "");
                bgpal.SetDefaultPalette();
            }
            if (!m_fFoundBackgroundSprites)
            {
                Palette bgpal = m_doc.BackgroundPalettes.GetPalette(0);
                m_doc.BackgroundSpritesets.AddSpriteset(Options.DefaultBgPaletteName, Options.DefaultBgPaletteId, "", bgpal);
                m_doc.BackgroundSpritesets.Current.AddSprite(1, 1, "", -1, "", 0, null);
            }
            if (!m_fFoundBackgroundMap)
            {
                m_doc.BackgroundMaps.AddMap("map", 0, "", m_doc.BackgroundSpritesets.Current);
            }

            // Remove any UndoActions since we just loaded from a file.
            m_doc.Owner.ClearUndo();
            m_doc.RecordSnapshot();
            return true;
        }
		public Stream Canonicalize (XmlNodeList nodes)
		{
			xnl = nodes;
			if (nodes == null || nodes.Count < 1)
				return new MemoryStream ();
			return Canonicalize (nodes[0].OwnerDocument);
		}		
예제 #28
0
파일: Editors.cs 프로젝트: u89012/Bootpad
        private void WalkAddingMenuItems(XmlNodeList nodes, ToolStripMenuItem parent)
        {
            if (nodes != null) {
                foreach (XmlNode n in nodes) {
                    ToolStripMenuItem curItem = null;

                    if (parent == null) {
                        curItem = ContextMenuStrip.Items.Add(n.Attributes["name"].Value) as ToolStripMenuItem;
                    } else {
                        curItem = parent.DropDownItems.Add(n.Attributes["name"].Value) as ToolStripMenuItem;
                    }

                    curItem.Name = n.Attributes["name"].Value;

                    var snippets = n.SelectNodes("snip");
                    foreach (XmlNode snippet in snippets) {
                        curItem.DropDownItems.Add(snippet.Attributes["name"].Value, null, delegate {
                            var sel = Environment.NewLine + SelectedText.Trim() + Environment.NewLine;
                            SelectedText = string.Format(snippet.InnerText.Trim(), sel) + Environment.NewLine;
                        });
                    }

                    WalkAddingMenuItems(n.SelectNodes("node"), curItem);
                }
            }
        }
예제 #29
0
 public void ParseXML(XmlNodeList node)
 {
     foreach (XmlNode node2 in node)
     {
         //Debug.WriteLine("\tConnection Node >" + node2.Value + " : " + node2.Name);
         //Debug.WriteLine("\tConnection Node >" + node2.FirstChild.Value + " : " + node2.FirstChild.Name);
         switch (node2.Name)
         {
             case ("Type"):
                 {
                     type = node2.FirstChild.Value;
                     break;
                 }
             case("URL"):
                 {
                     url = node2.FirstChild.Value;
                     break;
                 }
             case("Metric"):
                 {
                     metric = Convert.ToInt32(node2.FirstChild.Value);
                     break;
                 }
         }
     }
 }
        public SimpleWebTokenTrustedIssuersRegistry(XmlNodeList customConfiguration)
        {
            this.configuredTrustedIssuers = new Dictionary<string, string>();
            if (customConfiguration == null)
            {
                throw new ArgumentNullException("customConfiguration");
            }

            List<XmlElement> xmlElements = GetXmlElements(customConfiguration);
            if (xmlElements.Count != 1)
            {
                throw new InvalidOperationException("There should be only one xml element as the configuration of this class");
            }

            XmlElement element = xmlElements[0];
            if (!StringComparer.Ordinal.Equals(element.LocalName, "trustedIssuers"))
            {
                throw new InvalidOperationException("The top element of the configuration should be named 'trustedIssuers'");
            }

            foreach (XmlNode node in element.ChildNodes)
            {
                XmlElement addRemoveNode = node as XmlElement;
                if (addRemoveNode != null)
                {
                    if (StringComparer.Ordinal.Equals(addRemoveNode.LocalName, "add"))
                    {
                        XmlNode issuerIdentifierNode = addRemoveNode.Attributes.GetNamedItem("issuerIdentifier");
                        XmlNode nameNode = addRemoveNode.Attributes.GetNamedItem("name");
                        if (((addRemoveNode.Attributes.Count != 2) || (issuerIdentifierNode == null)) || ((nameNode == null) || string.IsNullOrEmpty(nameNode.Value)))
                        {
                            throw new InvalidOperationException("The <add> element is malformed. The right format is: <add issuerIdentifier=\"issuer identifier\" name=\"issuer friendly name\"");
                        }

                        string issuerIdentifier = issuerIdentifierNode.Value.ToLowerInvariant();
                        string name = string.Intern(nameNode.Value);
                        this.configuredTrustedIssuers.Add(issuerIdentifier, name);
                    }
                    else if (StringComparer.Ordinal.Equals(addRemoveNode.LocalName, "remove"))
                    {
                        if ((addRemoveNode.Attributes.Count != 1) || !StringComparer.Ordinal.Equals(addRemoveNode.Attributes[0].LocalName, "issuerIdentifier"))
                        {
                            throw new InvalidOperationException("The <remove> node should have a issuerIdentifier attribute");
                        }

                        string issuerIdentifier = addRemoveNode.Attributes.GetNamedItem("issuerIdentifier").Value;
                        this.configuredTrustedIssuers.Remove(issuerIdentifier);
                    }
                    else
                    {
                        if (!StringComparer.Ordinal.Equals(addRemoveNode.LocalName, "clear"))
                        {
                            throw new InvalidOperationException(string.Format("Invalid element: {0}", addRemoveNode.LocalName));
                        }

                        this.configuredTrustedIssuers.Clear();
                    }
                }
            }
        }
예제 #31
0
		private void DeserializeGroupPresets(PresetVoiLutCollection presets, XmlNodeList presetNodes)
		{
			foreach (XmlElement presetNode in presetNodes)
			{
				string keyStrokeAttribute = presetNode.GetAttribute("keystroke");
				XKeys keyStroke = XKeys.None;
				if (!String.IsNullOrEmpty(keyStrokeAttribute))
					keyStroke = (XKeys)_xkeysConverter.ConvertFromInvariantString(keyStrokeAttribute);

				string factoryName = presetNode.GetAttribute("factory");

				IPresetVoiLutOperationFactory factory = PresetVoiLutOperationFactories.GetFactory(factoryName);
				if (factory == null)
					continue;

				PresetVoiLutConfiguration configuration = PresetVoiLutConfiguration.FromFactory(factory);

				XmlNodeList configurationItems = presetNode.SelectNodes("configuration/item");
				foreach (XmlElement configurationItem in configurationItems)
					configuration[configurationItem.GetAttribute("key")] = configurationItem.GetAttribute("value");

				try 
				{
					IPresetVoiLutOperation operation = factory.Create(configuration);
					PresetVoiLut preset = new PresetVoiLut(operation);
					preset.KeyStroke = keyStroke;
					presets.Add(preset);
				}
				catch(Exception e)
				{
					Platform.Log(LogLevel.Error, e);
					continue;
				}
			}
		}
예제 #32
0
        public static string ToString(XmlNodeList nodes)
        {
            StringBuilder sb = new StringBuilder();

            try
            {
                foreach (XmlNode node in nodes)
                {
                    sb.AppendLine(node.OuterXml);
                }

                string s = "<Root>" + sb.ToString() + "</Root>";

                s = Indent(s);

                s = UStr.TrimStart(s, "<Root>");

                s = UStr.TrimEnd(s, "</Root>");

                return s;
            }
            catch
            {
                return "";
            }
        }
        private static void MarkInclusionStateForNodes(XmlNodeList nodeList, XmlDocument inputRoot, XmlDocument root) {
            CanonicalXmlNodeList elementList = new CanonicalXmlNodeList();
            CanonicalXmlNodeList elementListCanonical = new CanonicalXmlNodeList();
            elementList.Add(inputRoot);
            elementListCanonical.Add(root);
            int index = 0;

            do {
                XmlNode currentNode = (XmlNode) elementList[index];
                XmlNode currentNodeCanonical = (XmlNode) elementListCanonical[index];
                XmlNodeList childNodes = currentNode.ChildNodes;
                XmlNodeList childNodesCanonical = currentNodeCanonical.ChildNodes;
                for (int i = 0; i < childNodes.Count; i++) {
                    elementList.Add(childNodes[i]);
                    elementListCanonical.Add(childNodesCanonical[i]);

                    if (Utils.NodeInList(childNodes[i], nodeList)) {
                        MarkNodeAsIncluded(childNodesCanonical[i]);
                    }

                    XmlAttributeCollection attribNodes = childNodes[i].Attributes;
                    if (attribNodes != null) {
                        for (int j = 0; j < attribNodes.Count; j++) {
                            if (Utils.NodeInList(attribNodes[j], nodeList)) {
                                MarkNodeAsIncluded(childNodesCanonical[i].Attributes.Item(j));
                            }
                        }
                    }
                }
                index++;
            } while (index < elementList.Count);
        }
예제 #34
0
    //对投注结果进行处理(暂未用)
    private void Concentration(string TransMessage)
    {
        System.Xml.XmlDocument XmlDoc = new XmlDocument();
        XmlDoc.Load(new StringReader(TransMessage));

        System.Xml.XmlNodeList nodes = XmlDoc.GetElementsByTagName("*");

        string Status      = "";
        string Message     = "";
        string messengerID = "";
        string SendID      = "";

        if (nodes != null)
        {
            for (int i = 0; i < nodes.Count; i++)
            {
                if (nodes[i].Name.ToUpper() == "MESSAGE")
                {
                    SendID      = nodes[i].Attributes["id"].Value.Substring(nodes[i].Attributes["id"].Value.Length, 8);
                    messengerID = nodes[i].FirstChild.FirstChild["messengerID"].Value;
                }

                if (nodes[i].Name.ToUpper() == "RESPONSE")
                {
                    Status = nodes[i].FirstChild.Attributes["code"].Value;

                    if (Status == "0000")
                    {
                        Message = nodes[i].FirstChild.Attributes["message"].Value;
                    }
                }
            }
        }
    }
예제 #35
0
        private void XMLToTreeview(TreeNodeCollection treeRootNodes, XmlNode xmlRootNode)
        {
            TreeNode treeNode = new TreeNode();

            if (xmlRootNode.Attributes != null && xmlRootNode.Attributes.Count > 0)
            {
                StringBuilder sb = new StringBuilder(xmlRootNode.Name);
                foreach (System.Xml.XmlAttribute item in xmlRootNode.Attributes)
                {
                    sb.Append(" ").Append(item.Name).Append("=").Append(item.Value);
                }
                treeNode = treeRootNodes.Add(sb.ToString());
            }
            else
            {
                if (xmlRootNode.NodeType != XmlNodeType.Text)
                {
                    treeNode = treeRootNodes.Add(xmlRootNode.Name);
                }
            }
            if (xmlRootNode.Value != null)
            {
                treeNode = treeRootNodes.Add(string.Format("Value:{0}", xmlRootNode.Value));
            }
            if (!xmlRootNode.HasChildNodes)
            {
                return;
            }

            System.Xml.XmlNodeList xmlNodeList = xmlRootNode.ChildNodes;
            foreach (System.Xml.XmlNode xmlnode in xmlNodeList)
            {
                XMLToTreeview(treeNode.Nodes, xmlnode);
            }
        }
예제 #36
0
    //返奖查询
    private void SalesVolumeInquiry(string Transmessage)
    {
        System.Xml.XmlDocument XmlDoc = new XmlDocument();
        XmlDoc.Load(new StringReader(TransMessage));

        System.Xml.XmlNodeList nodes = XmlDoc.GetElementsByTagName("body");

        string Status     = "";
        string SalesMoney = "";
        string BonusMoney = "";
        string GameName   = "";
        string Number     = "";

        if (nodes != null)
        {
            if (nodes[0].Name.ToUpper() == "RESPONSE")
            {
                Status = nodes[0].FirstChild.Attributes["code"].Value;

                if (Status == "0000" && nodes[0].FirstChild.FirstChild.Name.ToUpper() == "BALANCEQUERYRESULT")
                {
                    SalesMoney = nodes[0].FirstChild.FirstChild.Attributes["salesMoney"].Value;        //销量
                    BonusMoney = nodes[0].FirstChild.FirstChild.Attributes["bonusMoney"].Value;        //返奖

                    GameName = nodes[0].FirstChild.FirstChild.FirstChild.Attributes["gameName"].Value; //彩种
                    Number   = nodes[0].FirstChild.FirstChild.FirstChild.Attributes["number"].Value;   //期号
                }
            }
        }
    }
예제 #37
0
 private void grdHeaderMenu_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
 {
     if (e.CommandName == "SetYesOrNo")
     {
         int    rowIndex = ((System.Web.UI.WebControls.GridViewRow)((System.Web.UI.Control)e.CommandSource).NamingContainer).RowIndex;
         int    num      = (int)this.grdMyHeaderMenu.DataKeys[rowIndex].Value;
         string filename = System.Web.HttpContext.Current.Request.MapPath(Globals.ApplicationPath + string.Format("/Templates/sites/" + Hidistro.Membership.Context.HiContext.Current.User.UserId.ToString() + "/{0}/config/HeaderMenu.xml", this.themName));
         System.Xml.XmlDocument xmlDocument = new System.Xml.XmlDocument();
         xmlDocument.Load(filename);
         System.Xml.XmlNodeList childNodes = xmlDocument.SelectSingleNode("root").ChildNodes;
         foreach (System.Xml.XmlNode xmlNode in childNodes)
         {
             if (xmlNode.Attributes["Id"].Value == num.ToString())
             {
                 if (xmlNode.Attributes["Visible"].Value == "true")
                 {
                     xmlNode.Attributes["Visible"].Value = "false";
                 }
                 else
                 {
                     xmlNode.Attributes["Visible"].Value = "true";
                 }
                 break;
             }
         }
         xmlDocument.Save(filename);
         this.BindHeaderMenu();
     }
 }
예제 #38
0
        public static GuidanceShift Load(XmlNodeList inputNode, TaskDataDocument taskDataDocument)
        {
            var loader = new GuidanceShiftLoader(taskDataDocument);

            var node = inputNode.Item(0);
            return loader.Load(node);
        }
예제 #39
0
 public ProgressTextElementAdapter(XmlNodeList progressTextNodes, WixFiles wixFiles)
     : base(wixFiles)
 {
     foreach (object o in progressTextNodes) {
         this.progressTextNodes.Add(o);
     }
 }
예제 #40
0
        public void showASpecPodcast(string rss, string xmlCate, string XmlUpdate)
        {
            System.Net.WebRequest  myRequest  = System.Net.WebRequest.Create(rss);
            System.Net.WebResponse myResponse = myRequest.GetResponse();

            System.IO.Stream       rssStream = myResponse.GetResponseStream();
            System.Xml.XmlDocument rssDoc    = new System.Xml.XmlDocument();

            rssDoc.Load(rssStream);
            rssStream.Close();
            System.Xml.XmlNode rssName = rssDoc.SelectSingleNode("rss/channel");
            var podcastName            = rssName.InnerText;

            System.Xml.XmlNodeList xx = rssDoc.SelectNodes("rss/channel/item");
            int antalEpisoder         = xx.Count;

            int.TryParse(XmlUpdate, out int XmlUpdateint);
            string frekvens = source.FirstOrDefault(x => x.Value == XmlUpdateint).Key;

            string[] RowPodCast = { antalEpisoder.ToString(), podcastName, frekvens, xmlCate, rss };
            var      listItem   = new ListViewItem(RowPodCast);

            lbEpisode.Items.Clear();
            lvPodcast.Items.Add(listItem);
        }
예제 #41
0
파일: TopAlbum.cs 프로젝트: gsterjov/fusemc
        public TopAlbum(XmlNodeList list)
        {
            foreach (XmlNode node in list)
            {
                switch (node.LocalName)
                {
                    case "name":
                        this.name = node.InnerText;
                        break;

                    case "reach":
                        this.reach = node.InnerText;
                        break;

                    case "url":
                        this.url = node.InnerText;
                        break;

                    case "image":
                        foreach (XmlNode image_node in node.ChildNodes)
                            if (image_node.LocalName == "large")
                                image = image_node.InnerText;
                        break;
                }
            }
        }
예제 #42
0
        public void loadPodCast(string url)
        {
            XmlDocument doc = new XmlDocument();

            doc.Load("Feeds.xml");

            System.Xml.XmlNodeList rssItems = doc.SelectNodes("ArrayOfRssFeed/RssFeed");
            foreach (XmlNode RssFeed in rssItems)
            {
                var UrlRss = RssFeed.SelectSingleNode("Url").InnerText;

                int.TryParse(RssFeed.SelectSingleNode("Updating").InnerText, out int UpdatingRss);
                var CateRss = RssFeed.SelectSingleNode("Category").InnerText;
                System.Net.WebRequest  myRequest  = System.Net.WebRequest.Create(UrlRss);
                System.Net.WebResponse myResponse = myRequest.GetResponse();
                System.IO.Stream       rssStream  = myResponse.GetResponseStream();
                System.Xml.XmlDocument rssDoc     = new System.Xml.XmlDocument();
                rssDoc.Load(rssStream);
                rssStream.Close();
                System.Xml.XmlNode rssName = rssDoc.SelectSingleNode("rss/channel");
                var podcastName            = rssName.InnerText;
                System.Xml.XmlNodeList xx  = rssDoc.SelectNodes("rss/channel/item");
                int antalEpisoder          = xx.Count;

                string   frekvens   = source.FirstOrDefault(x => x.Value == UpdatingRss).Key;
                string[] RowPodCast = { antalEpisoder.ToString(), podcastName, frekvens, CateRss, UrlRss };
                var      listItem   = new ListViewItem(RowPodCast);

                lvPodcast.Items.Add(listItem);
            }
        }
예제 #43
0
        /// <summary>
        /// get araylist of named element values from an xml file
        /// </summary>
        /// <param name="xmlfile">path to xml file</param>
        /// <param name="filter">row filter e.g. elementname ='value'</param>
        /// <param name="returnelement">name of element from which to return values</param>
        /// <returns></returns>
        public static IList <string> array_from_xml(string xmlfile, string nodepath)
        {
            IList <string> _results = new List <string>();

            try
            {
                string _path = AppDomain.CurrentDomain.BaseDirectory;
                _path += xmlfile;

                System.Xml.XmlDocument _xdoc = new System.Xml.XmlDocument();
                _xdoc.Load(_path);

                System.Xml.XmlNodeList _nodes = _xdoc.SelectNodes(nodepath);

                foreach (System.Xml.XmlNode _n in _nodes)
                {
                    string _text = _n.InnerText.ToString();
                    if (!string.IsNullOrEmpty(_text))
                    {
                        _results.Add(_text);
                    }
                }
            }
            catch (Exception ex)
            {
                _results.Add(ex.Message.ToString());
            }

            return(_results);
        }
예제 #44
0
        protected override IDictionary<string, IMemberAttribute> ParserMembers(string typeFullName,
            XmlNodeList memberNodes)
        {
            if (string.IsNullOrEmpty(typeFullName))
            {
                throw new ArgumentNullException("typeFullName");
            }
            object target = MemberCache.Get(typeFullName);
            if (null == memberNodes || 0 == memberNodes.Count)
            {
                if (null == target)
                {
                    return null;
                }
                return (IDictionary<string, IMemberAttribute>) target;
            }

            foreach (XmlNode node in memberNodes)
            {
                ParserMember(typeFullName, node);
            }

            if (null == target)
            {
                throw new Exception("Get the members attribute is error.");
            }
            return (IDictionary<string, IMemberAttribute>) target;
        }
        /// <summary> 
        /// Overloads  the base class method to load the custom policies from the config file 
        /// </summary> 
        /// <param name="nodelist">XmlNodeList containing the policy information read from the config file</param> 
        public override void LoadCustomConfiguration(XmlNodeList nodelist) 
        {
            foreach (XmlNode node in nodelist) 
            { 
                // 
                // Initialize the policy cache 
                // 
                var rdr = XmlDictionaryReader.CreateDictionaryReader(new XmlTextReader(new StringReader(node.OuterXml))); 
                rdr.MoveToContent(); 
 
                var resource = rdr.GetAttribute("resource"); 
                var action = rdr.GetAttribute("action"); 
 
                Expression<Func<ClaimsPrincipal, bool>> policyExpression = _policyReader.ReadPolicy(rdr); 
 
                // 
                // Compile the policy expression into a function 
                // 
                Func<ClaimsPrincipal, bool> policy = policyExpression.Compile(); 
 
                // 
                // Insert the policy function into the policy cache 
                // 
                _policies[new ResourceAction(resource, action)] = policy; 
            } 
        } 
예제 #46
0
파일: XMLWR.cs 프로젝트: zymITsky/Medical
        public bool UpdateXML(string FileName, string name, string value)
        {
            try
            {
                //初始化XML文档操作类
                XmlDocument myDoc = new XmlDocument();
                //加载XML文件
                myDoc.Load(FileName);

                //搜索指定的节点
                System.Xml.XmlNodeList nodes = myDoc.SelectNodes("//User");

                if (nodes != null)
                {
                    foreach (System.Xml.XmlNode xn in nodes)
                    {
                        xn.SelectSingleNode(name).InnerText = value;
                    }
                }
                myDoc.Save(FileName);
            }
            catch (Exception exp)
            {
                return(false);
            }
            return(true);
        }
예제 #47
0
        private void ReadFileLogConfig()
        {
            System.Xml.XmlNode file = this.xmlNode.SelectSingleNode("//File");
            if (file != null)
            {
                System.Xml.XmlNodeList configs = file.SelectNodes("Config");
                foreach (System.Xml.XmlNode config in configs)
                {
                    //id="stack" category="" level="DEBUG" module="stack" fileName="stack.log"
                    System.Xml.XmlAttribute id       = config.Attributes["id"];
                    System.Xml.XmlAttribute category = config.Attributes["category"];
                    System.Xml.XmlAttribute level    = config.Attributes["level"];
                    System.Xml.XmlAttribute module   = config.Attributes["module"];
                    System.Xml.XmlAttribute fileName = config.Attributes["fileName"];
                    if (id == null || fileName == null)
                    {
                        throw new StackException("config error: file config should have id and fileName.");
                    }

                    // create a config instance
                    FileLogConfig fileLogConfig = new FileLogConfig();
                    fileLogConfig.Category = category.Value;
                    fileLogConfig.Level    = (LogLevel)Enum.Parse(typeof(LogLevel), level.Value);
                    fileLogConfig.Module   = module.Value;
                    fileLogConfig.FileName = fileName.Value;
                    if (this.logConfigs.ContainsKey(id.Value))
                    {
                        throw new StackException("the id of config must be unique.");
                    }
                    this.logConfigs.Add(id.Value, fileLogConfig);
                }
            }
        }
예제 #48
0
 public ErrorElementAdapter(XmlNodeList errorNodes, WixFiles wixFiles)
     : base(wixFiles)
 {
     foreach (object o in errorNodes) {
         this.errorNodes.Add(o);
     }
 }
예제 #49
0
        private void ResolveMenu(ControlBase btn, XmlNodeList nodes)
        {
            //FineUI.Menu menu = new Menu();
            //// 通过反射获取属性Menus
            //PropertyInfo info = btn.GetType().GetProperty("Menus");
            //(info.GetValue(btn, null) as MenuCollection).Add(menu);

            PropertyInfo menuInfo = btn.GetType().GetProperty("Menu");
            Menu menu = menuInfo.GetValue(btn, null) as Menu;

            foreach (XmlNode node in nodes)
            {
                XmlAttribute attrURL = node.Attributes["navigateurl"];
                if (attrURL != null)
                {
                    FineUI.MenuHyperLink lnk = new FineUI.MenuHyperLink();
                    lnk.Text = node.Attributes["text"].Value;
                    lnk.NavigateUrl = attrURL.Value;
                    lnk.Target = "_blank";

                    menu.Items.Add(lnk);

                    if (node.ChildNodes.Count > 0)
                    {
                        ResolveMenu(lnk, node.ChildNodes);
                    }
                }

            }
        }
예제 #50
0
 public LectorQuiniela(String ruta, String torneo)
 {
     this.torneo = torneo;
     documentoXml = new XmlDocument();
     documentoXml.Load(ruta);
     quinielaUsuario = documentoXml.GetElementsByTagName("QuinielaUsuario");
 }
예제 #51
0
        internal static void WarnIfMultipleTargets(XmlTransformationLogger log, string transformName, XmlNodeList targetNodes, bool applyTransformToAllTargets) {
            Debug.Assert(applyTransformToAllTargets == false);

            if (targetNodes.Count > 1) {
                log.LogWarning(SR.XMLTRANSFORMATION_TransformOnlyAppliesOnce, transformName);
            }
        }
        /// <summary>
        /// Load custom configuration from Xml
        /// </summary>
        /// <param name="customConfigElements">SAML token authentication requirements.</param>
        /// <exception cref="ArgumentNullException">Input parameter 'customConfigElements' is null.</exception>
        /// <exception cref="InvalidOperationException">Custom configuration specified was invalid.</exception>
        public override void LoadCustomConfiguration(XmlNodeList customConfigElements)
        {
            if (customConfigElements == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("customConfigElements");
            }

            List<XmlElement> configNodes = XmlUtil.GetXmlElements(customConfigElements);

            bool foundValidConfig = false;

            foreach (XmlElement configElement in configNodes)
            {
                if (configElement.LocalName != ConfigurationStrings.SamlSecurityTokenRequirement)
                {
                    continue;
                }

                if (foundValidConfig)
                {
                    throw DiagnosticUtility.ThrowHelperInvalidOperation(SR.GetString(SR.ID7026, ConfigurationStrings.SamlSecurityTokenRequirement));
                }

                this.samlSecurityTokenRequirement = new SamlSecurityTokenRequirement(configElement);

                foundValidConfig = true;
            }

            if (!foundValidConfig)
            {
                this.samlSecurityTokenRequirement = new SamlSecurityTokenRequirement();
            }
        }
예제 #53
0
 public static void AreEqual(XmlNodeList ctrNodes, List<Grower> growers, Dictionary<string, List<UniqueId>> linkList)
 {
     for (var i = 0; i < ctrNodes.Count; i++)
     {
         AreEqual(ctrNodes[i], growers[i], linkList);
     }
 }
예제 #54
0
        public List<AvinodeMenuItem> UnfurlNodes(XmlNodeList xmlNodes)
        {
            var avinodeMenuItems = new List<AvinodeMenuItem>();
            foreach (XmlNode node in xmlNodes)
            {
                var displayName = node["displayName"];
                var nodePath = node["path"];
                var subMenu = node.SelectNodes("subMenu/item");

                if (displayName != null && nodePath != null)
                {
                    var uriPath = new Uri(nodePath.Attributes["value"].Value, UriKind.Relative);
                    var subMenuItem = subMenu != null && subMenu.Count > 0 ? UnfurlNodes(subMenu) : null;
                    var isActive = RelativeUri == uriPath || (subMenuItem != null && subMenuItem.Any(menuItem => menuItem.Active));

                    avinodeMenuItems.Add(new AvinodeMenuItem
                    {
                        DisplayName = displayName.InnerText,
                        Path = uriPath,
                        Active = isActive,
                        SubMenuItem = subMenuItem
                    });
                }
            }
            return avinodeMenuItems;
        }
예제 #55
0
        static Setting()
        {
            m_settingsPath  = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
            m_settingsPath += @"\Setting.xml";

            if (!File.Exists(m_settingsPath))
            {
                throw new FileNotFoundException(m_settingsPath + " could not be found.");
            }

            System.Xml.XmlDocument xdoc = new XmlDocument();
            xdoc.Load(m_settingsPath);
            XmlElement root = xdoc.DocumentElement;

            System.Xml.XmlNodeList nodeList = root.ChildNodes.Item(0).ChildNodes;

            // Add settings to the NameValueCollection.
            m_settings = new NameValueCollection();
            for (int i = 0; i < nodeList.Count; i++)
            {
                m_settings.Add(nodeList.Item(i).Attributes["key"].Value, nodeList.Item(i).Attributes["value"].Value);
            }

            /* m_settings.Add("Index", nodeList.Item(0).Attributes["value"].Value);
             * m_settings.Add("Login", nodeList.Item(1).Attributes["value"].Value);
             *           m_settings.Add("Password", nodeList.Item(2).Attributes["value"].Value);
             *
             * m_settings.Add("ServerIP", nodeList.Item(3).Attributes["value"].Value);
             *           m_settings.Add("UserName", nodeList.Item(4).Attributes["value"].Value);
             *           m_settings.Add("PhoneNumber", nodeList.Item(5).Attributes["value"].Value);
             *           m_settings.Add("TimeOut", nodeList.Item(6).Attributes["value"].Value);
             *           m_settings.Add("LastTransmit", nodeList.Item(7).Attributes["value"].Value);
             *           m_settings.Add("DatabasePath", nodeList.Item(8).Attributes["value"].Value);*/
        }
예제 #56
0
 protected System.Collections.Generic.Dictionary <int, System.Collections.Generic.IList <int> > GetAttributes(string attributesXml)
 {
     System.Xml.XmlDocument xmlDocument = new System.Xml.XmlDocument();
     System.Collections.Generic.Dictionary <int, System.Collections.Generic.IList <int> > dictionary = null;
     try
     {
         xmlDocument.LoadXml(attributesXml);
         System.Xml.XmlNodeList xmlNodeList = xmlDocument.SelectNodes("//item");
         if (xmlNodeList == null || xmlNodeList.Count == 0)
         {
             return(null);
         }
         dictionary = new System.Collections.Generic.Dictionary <int, System.Collections.Generic.IList <int> >();
         foreach (System.Xml.XmlNode xmlNode in xmlNodeList)
         {
             int key = int.Parse(xmlNode.Attributes["attributeId"].Value);
             System.Collections.Generic.IList <int> list = new System.Collections.Generic.List <int>();
             foreach (System.Xml.XmlNode xmlNode2 in xmlNode.ChildNodes)
             {
                 if (xmlNode2.Attributes["valueId"].Value != "")
                 {
                     list.Add(int.Parse(xmlNode2.Attributes["valueId"].Value));
                 }
             }
             if (list.Count > 0)
             {
                 dictionary.Add(key, list);
             }
         }
     }
     catch
     {
     }
     return(dictionary);
 }
예제 #57
0
        private System.Xml.XmlNodeList getSourceFields()
        {
            string xpath = "//SourceField"; // Source field values

            System.Xml.XmlNodeList nodelist = _xml.SelectNodes(xpath);
            return(nodelist);
        }
예제 #58
0
 private static List<ExchangeItem> ParseDestinations(XmlNodeList nodelist)
 {
     var items = new List<ExchangeItem>();
     foreach (XmlNode node in nodelist)
     {
         var ei = new ExchangeItem();
         items.Add(ei);
         foreach (XmlNode childNode in node.ChildNodes)
         {
             switch (childNode.Name)
             {
                 case "enabled":
                     ei.Enabled = string.IsNullOrEmpty(childNode.InnerText) ? false : bool.Parse(childNode.InnerText);
                     break;
                 case "last-upload-failed":
                     ei.LastUploadFailed = string.IsNullOrEmpty(childNode.InnerText) ? false : bool.Parse(childNode.InnerText);
                     break;
                 case "exchange-name":
                     ei.ExchangeName = string.IsNullOrEmpty(childNode.InnerText) ? string.Empty : childNode.InnerText;
                     break;
                 case "last-upload-at":
                     ei.LastUploadAt = string.IsNullOrEmpty(childNode.InnerText) ? new DateTime?() : DateTime.Parse(childNode.InnerText);
                     break;
                 default:
                     break;
             }
         }
     }
     return items;
 }
예제 #59
0
 /// <summary>
 /// Displays the Select Organization dialog.
 /// This dialog is designed to only come up once, when the user first runs Pathway. The
 /// Organization value in this case is assumed to be empty, since they haven't specified
 /// their organization yet.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void SelectOrganizationDialog_Load(object sender, EventArgs e)
 {
     // Do we want to show all orgs?
     _showAllOrgs = (File.Exists(Common.FromRegistry("ScriptureStyleSettings.xml")));
     // Load User Interface Collection Parameters
     Param.LoadSettings();
     string inputType = Param.InputType;
     _organizations = Param.GetItems("//stylePick/Organizations/Organization");
     foreach (var org in _organizations)
     {
         var node = (XmlNode)org;
         if (node.FirstChild == null) continue;
         if ((_inputType == "Dictionary") && (node.FirstChild.Value.Contains("Bible")))
         {
             // UBS, PBT - don't display in SE version
             continue;
         }
         ddlOrganization.Items.Add(node.FirstChild.Value);
     }
     // select the first item in the list
     if (ddlOrganization.Items.Count > 0)
     {
         ddlOrganization.SelectedIndex = 0;
     }
 }
예제 #60
0
        public void LoadCustomConfiguration(System.Xml.XmlNodeList nodeList)
        {
            if (nodeList == null || nodeList.Count == 0)
            {
                throw new ConfigurationErrorsException("No configuration provided.");
            }

            var node = nodeList.Cast <XmlNode>().FirstOrDefault(x => x.LocalName == "file");

            if (node == null)
            {
                throw new ConfigurationErrorsException("Expected 'file' element.");
            }

            var elem = node as XmlElement;

            var path = elem.Attributes["path"];

            if (path == null || String.IsNullOrWhiteSpace(path.Value))
            {
                throw new ConfigurationErrorsException("Expected 'path' attribute.");
            }

            this.filename = path.Value;
        }