private void parseReps(Segment segmentObject, System.Xml.XmlElement segmentElement, System.String fieldName, int fieldNum) { System.Xml.XmlNodeList reps = segmentElement.GetElementsByTagName(fieldName); for (int i = 0; i < reps.Count; i++) { parse(segmentObject.getField(fieldNum, i), (System.Xml.XmlElement)reps.Item(i)); } }
public static GradientStopCollection ToGradientStops(System.Xml.XmlNodeList stops) { int itemCount = stops.Count; GradientStopCollection gradientStops = new GradientStopCollection(itemCount); double lastOffset = 0; for (int i = 0; i < itemCount; i++) { SvgStopElement stop = (SvgStopElement)stops.Item(i); string prop = stop.GetAttribute("stop-color"); string style = stop.GetAttribute("style"); Color color = Colors.Transparent; // no auto-inherited... if (!string.IsNullOrWhiteSpace(prop) || !string.IsNullOrWhiteSpace(style)) { SvgColor svgColor = new SvgColor(stop.GetComputedStyle(string.Empty).GetPropertyValue("stop-color")); if (svgColor.ColorType == SvgColorType.CurrentColor) { string sCurColor = stop.GetComputedStyle(string.Empty).GetPropertyValue(CssConstants.PropColor); svgColor = new SvgColor(sCurColor); } TryConvertColor(svgColor.RgbColor, out color); } else { color = Colors.Black; // the default color... } double alpha = 255; string opacity; opacity = stop.GetAttribute("stop-opacity"); // no auto-inherit if (opacity == "inherit") // if explicitly defined... { opacity = stop.GetPropertyValue("stop-opacity"); } if (!string.IsNullOrWhiteSpace(opacity)) { alpha *= SvgNumber.ParseNumber(opacity); } alpha = Math.Min(alpha, 255); alpha = Math.Max(alpha, 0); color = Color.FromArgb((byte)Convert.ToInt32(alpha), color.R, color.G, color.B); double offset = stop.Offset.AnimVal; offset /= 100; offset = Math.Max(lastOffset, offset); gradientStops.Add(new GradientStop(color, offset)); lastOffset = offset; } return(gradientStops); }
static void CheckXML(string file, string elementName) { if (System.IO.File.Exists(file)) { System.Xml.XmlDocument xmlfile = new System.Xml.XmlDocument(); xmlfile.Load(file); System.Xml.XmlNodeList XMLData = xmlfile.GetElementsByTagName(elementName); } }
public void ParseFromXml(System.Xml.XmlNodeList xmlNodeList) { System.Xml.XmlNode node = xmlNodeList[0]; if (node == null) { return; } comboBox.Text = node.Attributes[XmlAttrDic.tValue.ToString()].Value; }
public static IEnumerable <System.Xml.XmlNode> AsEnumerable(this System.Xml.XmlNodeList source) { if (source == null) { return(new System.Xml.XmlNode[0]); } TypeCheckEnumerable(source, s => s.AsEnumerable(), (s) => s[0]); return(source.Cast <System.Xml.XmlNode>()); }
public static void FilterDocOnXPath(System.Xml.XmlDocument sourceDoc, string xPathRemove) { System.Xml.XmlNodeList mismatches = sourceDoc.SelectNodes(xPathRemove); //RestNet.Logging.Debug(string.Format("SqlXpathSearch.FilterDocOnXPath - Removing {0} records from {1} with removal XPath [{2}]", mismatches.Count, sourceDoc.DocumentElement.ChildNodes.Count, xPathRemove)); for (int x = 0; x < mismatches.Count; x++) { mismatches[x].ParentNode.RemoveChild(mismatches[x]); } }
private void addNode(System.Xml.XmlNodeList nodes, string name, string value) { if (nodes != null && value != null) { System.Xml.XmlNode nodenew = _xml.CreateElement(name); nodenew.InnerText = value; nodes[0].AppendChild(nodenew); } }
} // End Function SanitizeXml // <text x="20" y="105" style="fill:#FF0064;font-family:Times New Roman;" font-size="56"> // Evaluation Only. Created with Aspose.Pdf. Copyright 2002-2014 Aspose Pty Ltd. // </text> public static string RemoveEvalString(string FileName, string URL) { System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument(); xmlDoc.XmlResolver = null; xmlDoc.PreserveWhitespace = true; // xmlDoc.Load(FileName); string sanitizedContent = SanitizeXml(FileName); try { xmlDoc.LoadXml(sanitizedContent); } catch (System.Exception ex) { System.Windows.Forms.Clipboard.SetText(sanitizedContent); System.Console.WriteLine(URL); System.Windows.Forms.MessageBox.Show(ex.Message); throw; } System.Xml.XmlAttribute attr = xmlDoc.DocumentElement.Attributes["xmlns"]; string strDefaultNamespace = null; if (attr != null) { strDefaultNamespace = attr.Value; } if (string.IsNullOrEmpty(strDefaultNamespace)) { strDefaultNamespace = "http://www.w3.org/2000/svg"; } System.Xml.XmlNamespaceManager nsmgr = new System.Xml.XmlNamespaceManager(xmlDoc.NameTable); nsmgr.AddNamespace("dft", strDefaultNamespace); System.Xml.XmlNodeList EvalVersionTags = xmlDoc.SelectNodes("//dft:text[contains(translate(text(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÜÉÈÊÀÁÂÒÓÔÙÚÛÇÅÏÕÑŒ', 'abcdefghijklmnopqrstuvwxyzäöüéèêàáâòóôùúûçåïõñœ'),'aspose')]", nsmgr); //System.Xml.XmlNodeList EvalVersionTags = xmlDoc.SelectNodes("//dft:text[contains(text(),'Aspose')]", nsmgr); foreach (System.Xml.XmlNode EvalVersionTag in EvalVersionTags) { if (EvalVersionTag.ParentNode != null) { EvalVersionTag.ParentNode.RemoveChild(EvalVersionTag); } } // Next EvalVersionTag // string str = xmlDoc.OuterXml; string str = BeautifyXML(xmlDoc); xmlDoc = null; return(str); } // End Sub RemoveEvalString
public virtual void parseElement(System.Xml.XmlNode oldEl, System.Xml.XmlNode newEl) { System.Xml.XmlNamedNodeMap nl = (System.Xml.XmlAttributeCollection)oldEl.Attributes; if (nl != null) { for (int i = 0; i < nl.Count; i++) { if (((System.Xml.XmlAttributeCollection)newEl.Attributes).GetNamedItem(nl.Item(i).Name) == null) { //System.out.println(nl.item(i).getNodeName()+" attribute not present, adding the attribute"); //UPGRADE_TODO: Method 'org.w3c.dom.Element.setAttribute' was converted to 'System.Xml.XmlElement.SetAttribute' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_orgw3cdomElementsetAttribute_javalangString_javalangString'" ((System.Xml.XmlElement)newEl).SetAttribute(nl.Item(i).Name, nl.Item(i).Value); } } } //UPGRADE_TODO: Method 'org.w3c.dom.Node.getChildNodes' was converted to 'System.Xml.XmlNode.ChildNodes' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'" System.Xml.XmlNodeList oldNodes = oldEl.ChildNodes; //UPGRADE_TODO: Method 'org.w3c.dom.Node.getChildNodes' was converted to 'System.Xml.XmlNode.ChildNodes' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'" System.Xml.XmlNodeList newNodes = newEl.ChildNodes; int i2 = 0; int j = 0; while (oldNodes.Item(i2) != null) { if (newNodes.Item(j) == null) { //System.out.println(oldNodes.item(i)+" not present, adding the whole element"); if (!ignoreList.Contains(oldNodes.Item(i2).Name)) { System.Xml.XmlNode n = newEl.OwnerDocument.ImportNode(oldNodes.Item(i2), true); newEl.AppendChild(n); } i2++; j++; } else { if ((System.Object)oldNodes.Item(i2).Name != (System.Object)newNodes.Item(j).Name) { if (!ignoreList.Contains(oldNodes.Item(i2).Name)) { //System.out.println(oldNodes.item(i)+" not present, adding the whole element"); System.Xml.XmlNode n = newEl.OwnerDocument.ImportNode(oldNodes.Item(i2), true); newEl.AppendChild(n); } i2++; } else { parseElement(oldNodes.Item(i2), newNodes.Item(j)); i2++; j++; } } } }
private System.Collections.IDictionary SetUpEngines(System.Xml.XmlNode section) { System.Xml.XmlNodeList list = section.SelectNodes("engines/add"); System.Collections.Hashtable engines = new System.Collections.Hashtable(list.Count); foreach (System.Xml.XmlElement item in list) { SetUpEngine(engines, item); } return(engines); }
public static string[] StringArrayFromNodeList(System.Xml.XmlNodeList nodeList, string attrName) { string[] ret; ret = new string[nodeList.Count]; for (int i = 0; i <= ret.GetUpperBound(0); i++) { ret[i] = GetAttributeOrEmpty(nodeList[i], attrName); } return(ret); }
public void CreateForumForGroup(int PortalId, int ModuleId, int SocialGroupId, string Config) { var xDoc = new System.Xml.XmlDocument(); xDoc.LoadXml(Config); { System.Xml.XmlNode xRoot = xDoc.DocumentElement; System.Xml.XmlNodeList xNodeList = xRoot.SelectNodes("//defaultforums/groups/group"); } }
public LuceneSearchService(string Searchterm) { System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); string xpath = "[@name='MyArticles']"; this._searchterm = Searchterm; doc.Load(HttpRuntime.AppDomainAppPath + "/App_Data/xml/indexConfig.xml"); this._indexConfigNodes = doc.SelectNodes("/indexConfiguration/*" + xpath); if (Searchterm.StartsWith("§§INDEX§§")) this.IndexFiles(); else this.SearchIndex(); }
private void trimNodes(System.Xml.XmlNodeList nodes, int trimval) { if (nodes != null && nodes[0] != null) { while (nodes[0].ChildNodes.Count > trimval) { nodes[0].RemoveChild(nodes[0].LastChild); } } }
void UpdateUserList() { lstUserList.Items.Clear(); System.Xml.XmlNodeList UserList = ApplicationSettings.GetUserList(); foreach (System.Xml.XmlNode User in UserList) { ListViewItem UserItem = new ListViewItem(new string[] { User.Attributes[0].Value, User.Attributes[1].Value, User.Attributes[2].Value }); lstUserList.Items.Add(UserItem); } }
public void ParseFromXml(System.Xml.XmlNodeList xmlNodeList) { System.Xml.XmlNodeList nodeList = xmlNodeList; fpConditionTypeElement_Sheet1.RowCount = nodeList.Count; for (int i = 0; i < nodeList.Count; i++) { fpConditionTypeElement_Sheet1.Cells[i, 0].Value = Managers.Functions.GetNodeAttrValue(nodeList[i], XmlAttrDic.tCode.ToString(), string.Empty); fpConditionTypeElement_Sheet1.Cells[i, 1].Value = Managers.Functions.GetNodeAttrValue(nodeList[i], XmlAttrDic.tName.ToString(), string.Empty); } }
internal static string getResponseElementAsString(System.Xml.XmlDocument doc, string path) { System.Xml.XmlNodeList nodeList = doc.SelectNodes(stringHelper.AppendUrl("/methodCallResult/", path, false)); System.Xml.XmlNode node = nodeList.Item(0); if (node != null) { return(node.InnerText); } return(null); }
public static IEnumerable <System.Xml.XmlNode> GetElementsByName(System.Xml.XmlNodeList list, string name) { foreach (System.Xml.XmlNode subnode in list) { if (subnode.Name == name) { yield return(subnode); } } }
/// <summary> /// Get currency exchange rate in euro's /// </summary> public static float GetCurrencyRate(string currency) { if (currency.ToLower() == "") { throw new ArgumentException("Invalid Argument! currency parameter cannot be empty!"); } try { // Create valid RSS url to european central bank string rssUrl = string.Concat("http://www.ecb.int/rss/fxref-", currency.ToLower() + ".html"); // Create & Load New Xml Document System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); doc.Load(rssUrl); // Create XmlNamespaceManager for handling XML namespaces. System.Xml.XmlNamespaceManager nsmgr = new System.Xml.XmlNamespaceManager(doc.NameTable); nsmgr.AddNamespace("rdf", "http://purl.org/rss/1.0/"); nsmgr.AddNamespace("cb", "http://www.cbwiki.net/wiki/index.php/Specification_1.1"); // Get list of daily currency exchange rate between selected "currency" and the EURO System.Xml.XmlNodeList nodeList = doc.SelectNodes("//rdf:item", nsmgr); // Loop Through all XMLNODES with daily exchange rates foreach (System.Xml.XmlNode node in nodeList) { // Create a CultureInfo, this is because EU and USA use different sepperators in float (, or .) CultureInfo ci = (CultureInfo)CultureInfo.CurrentCulture.Clone(); ci.NumberFormat.CurrencyDecimalSeparator = "."; try { // Get currency exchange rate with EURO from XMLNODE float exchangeRate = float.Parse( node.SelectSingleNode("//cb:statistics//cb:exchangeRate//cb:value", nsmgr).InnerText, NumberStyles.Any, ci); return(exchangeRate); } catch { } } // currency not parsed!! // return default value return(0); } catch { // currency not parsed!! // return default value return(0); } }
protected void AddCostsOrModifiers(System.Xml.XmlNodeList cost_or_modifier_nodes) { foreach (System.Xml.XmlElement cost_or_modifier_node in cost_or_modifier_nodes) { string ikey = cost_or_modifier_node.GetAttribute("ikey"); int value = 0; switch (cost_or_modifier_node.GetAttribute("type")) { case "stat_change": System.Int32.TryParse(cost_or_modifier_node.GetAttribute("value"), out value); if (stat_change.ContainsKey(ikey)) { stat_change[ikey] += value; } else { stat_change.Add(ikey, value); } break; case "removed_items": System.Int32.TryParse(cost_or_modifier_node.GetAttribute("count"), out value); if (removed_items.ContainsKey(ikey)) { removed_items[ikey] += value; } else { removed_items.Add(ikey, value); } break; case "add_xp": System.Int32.TryParse(cost_or_modifier_node.GetAttribute("value"), out value); add_xp += value; break; case "add_item": if (add_item.ContainsKey(ikey)) { add_item[ikey].Add(cost_or_modifier_node.GetAttribute("item_id")); } else { IList <string> list = new List <string>(); list.Add(cost_or_modifier_node.GetAttribute("item_id")); add_item.Add(ikey, list); } break; default: break; } } }
private void saveM10() { // ConditionalValue System.Xml.XmlNodeList nodes = getFieldNodes(this.FieldGrid.SelectedIndex + 1); if (nodes != null) { try { nodes[0].SelectSingleNode("Method").InnerText = getMethodVal(); System.Xml.XmlNode node = nodes[0].LastChild.SelectSingleNode("Oper"); trimNodes(nodes, 3); if (node != null) { node.InnerText = Method10Value.Text; } else { addNode(nodes, "Oper", Method10Value.Text); } node = nodes[0].LastChild.SelectSingleNode("If"); if (node != null) { node.InnerText = Method101Value.Text; } else { addNode(nodes, "If", Method101Value.Text); } node = nodes[0].LastChild.SelectSingleNode("Then"); if (node != null) { node.InnerText = Method102Value.Text; } else { addNode(nodes, "Then", Method102Value.Text); } node = nodes[0].LastChild.SelectSingleNode("Else"); if (node != null) { node.InnerText = Method103Value.Text; } else { addNode(nodes, "Else", Method103Value.Text); } saveFieldGrid(); } catch { } } }
/// <summary> /// 设置菜单项所属的菜单组。 /// </summary> /// <param name="MenuItemID">菜单项 ID。</param> /// <param name="MenuGroupID">新的菜单组 ID。</param> /// <exception cref="Thinksea.NotFoundException">没有找到指定的记录。</exception> public void MoveMenuItem(string MenuItemID, string MenuGroupID) { System.Xml.XmlNode MenuItemNode = null; System.Xml.XmlNode OldMenuGroupNode = null; #region 获取当前所在的菜单组。 { System.Xml.XmlNodeList xnl = this.xmlDocument.SelectNodes("/Menu/MenuGroup/MenuItem"); foreach (System.Xml.XmlNode tmp in xnl) { if (tmp.Attributes["ID"] != null && tmp.Attributes["ID"].Value == MenuItemID) { MenuItemNode = tmp; OldMenuGroupNode = tmp.ParentNode; } } if (OldMenuGroupNode == null || MenuItemNode == null) { throw new Thinksea.NotFoundException("没有找到指定的记录。"); } } #endregion System.Xml.XmlNode NewMenuGroupNode = null; #region 获取新的菜单组。 { System.Xml.XmlNodeList xnl = this.xmlDocument.SelectNodes("/Menu/MenuGroup"); foreach (System.Xml.XmlNode tmp in xnl) { if (tmp.Attributes["ID"] != null && tmp.Attributes["ID"].Value == MenuGroupID) { NewMenuGroupNode = tmp; break; } } if (NewMenuGroupNode == null) { throw new Thinksea.NotFoundException("没有找到指定的菜单组。"); } } #endregion #region 排出所设置的菜单组 ID 与当前所属的菜单组 ID 相同的情况。 { if (OldMenuGroupNode.Attributes["ID"] != null && OldMenuGroupNode.Attributes["ID"].Value == MenuGroupID) { return; } } #endregion OldMenuGroupNode.RemoveChild(MenuItemNode); NewMenuGroupNode.AppendChild(MenuItemNode); }
} // End Sub btnPost_Click /* * <form id="download-form" method="post" action="/download-icon"> * <input type="hidden" id="icon_id" name="icon_id" value="118260" /> * <input type="hidden" id="author" name="author" value="137" /> * <input type="hidden" id="team" name="team" value="137" /> * <input type="hidden" id="keyword" name="keyword" value="pen" /> * <input type="hidden" id="pack" name="pack" value="118131" /> * <input type="hidden" id="style" name="style" value="3" /> * <input type="hidden" id="format" name="format" /> * <input type="hidden" id="color" name="color" /> * <input type="hidden" id="colored" name="colored" value="1" /> * <input type="hidden" id="size" name="size" /> * <input type="hidden" id="selection" name="selection" value="1" /> * <!--<input type="hidden" id="svg_content" name="svg_content" />--> * </form> */ // https://stackoverflow.com/questions/4015324/http-request-with-post public static void PostRequest() { using (System.Net.WebClient client = new System.Net.WebClient()) { System.Collections.Specialized.NameValueCollection values = new System.Collections.Specialized.NameValueCollection(); values["icon_id"] = "109737"; values["author"] = "1"; values["team"] = "1"; values["keyword"] = "buildings"; values["pack"] = "112154"; values["style"] = "3"; values["format"] = "svg"; values["color"] = "#D80027"; values["colored"] = "1"; values["size"] = "512"; values["selection"] = "1"; byte[] response = client.UploadValues("http://www.flaticon.com/download-icon", values); using (System.IO.MemoryStream ms = new System.IO.MemoryStream(response)) { System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); doc.XmlResolver = null; doc.PreserveWhitespace = false; doc.Load(ms); System.Xml.XmlNamespaceManager nsmgr = GetReportNamespaceManager(doc); System.Xml.XmlNodeList nl = doc.SelectNodes("//dft:g", nsmgr); if (nl != null) { System.Console.WriteLine(nl.Count); foreach (System.Xml.XmlNode nd in nl) { System.Console.WriteLine(nd.InnerXml); string strContent = nd.InnerXml.Trim(new char[] { '\r', '\n', ' ', '\t', '\v' }); if (string.IsNullOrEmpty(strContent)) { nd.ParentNode.RemoveChild(nd); } } // Next nd } // End if (nl != null) System.Console.WriteLine(doc.OuterXml); SaveDocument(doc, @"d:\mytestfile.svg"); } string responseString = System.Text.Encoding.Default.GetString(response); } } // End Sub PostRequest
private static bool CheckUniqueId(System.Xml.XmlNodeList nodes, string id) { foreach (System.Xml.XmlNode node in nodes) { if (node.InnerText == id) { return(false); } } return(true); }
static void ReadXmlData() { System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); doc.Load("c:\\allfiles\\data.xml"); System.Xml.XmlNodeList people = doc.SelectNodes("//person"); foreach (System.Xml.XmlNode person in people) { Console.WriteLine(person.InnerText); } Console.ReadLine(); }
/// <summary> /// 删除菜单项。 /// </summary> /// <param name="ID">菜单项 ID。</param> public void RemoveMenuItem(string ID) { System.Xml.XmlNodeList xnl = this.xmlDocument.SelectNodes("/Menu/MenuGroup/MenuItem"); foreach (System.Xml.XmlNode tmp in xnl) { if (tmp.Attributes["ID"] != null && tmp.Attributes["ID"].Value == ID) { tmp.ParentNode.RemoveChild(tmp); } } }
/******************************/ /* Menu Events */ /******************************/ #region Menu Events #endregion /******************************/ /* Other Events */ /******************************/ #region Other Events #endregion /******************************/ /* Other Functions */ /******************************/ #region Other Functions /// <summary> /// CheckIfUpdateIsAvailable /// </summary> /// <returns></returns> private bool CheckIfUpdateIsAvailable() { try { string URL = Properties.Settings.Default.UpdateURL; System.Net.HttpWebRequest myRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(URL); myRequest.Method = "GET"; System.Net.WebResponse myResponse = myRequest.GetResponse(); StreamReader sr = new StreamReader(myResponse.GetResponseStream(), System.Text.Encoding.UTF8); string result = sr.ReadToEnd(); System.Diagnostics.Debug.WriteLine(result); result = result.Replace('\n', ' '); sr.Close(); myResponse.Close(); System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument(); xmlDoc.LoadXml(result); System.Xml.XmlNodeList parentNode = xmlDoc.GetElementsByTagName("Version"); string remoteVersion = parentNode[0].InnerXml.ToString(); string remoteVersionAddition = ""; int countOfDots = System.Text.RegularExpressions.Regex.Matches(remoteVersion, "[.]").Count; if (countOfDots == 1) { remoteVersionAddition = ".0.0"; } else { remoteVersionAddition = ".0"; } Version sVersionToDownload = new Version(parentNode[0].InnerXml.ToString() + remoteVersionAddition); Version sCurrentVersion = new Version(System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()); var vResult = sVersionToDownload.CompareTo(sCurrentVersion); if (vResult > 0) { return(true); } else if (vResult < 0) { return(false); } else if (vResult == 0) { return(false); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); return(false); } return(true); }
public static void LoadHashTables(string xmlPath) { VBTypes.Clear(); CSharpTypes.Clear(); JavaTypes.Clear(); DotNetTypes.Clear(); libraryTypes.Clear(); langSpecificTypes.Clear(); calculateLengths.Clear(); if (System.IO.File.Exists(xmlPath)) { System.Xml.XmlDocument document = new System.Xml.XmlDocument(); document.Load(xmlPath); System.Xml.XmlNodeList nodeList = document.GetElementsByTagName("*"); foreach (System.Xml.XmlNode node in nodeList) { if (node.Attributes["VBType"] != null && node.Attributes["name"] != null) { VBTypes.Add(node.Attributes["name"].Value, node.Attributes["VBType"].Value); } if (node.Attributes["CSharpType"] != null && node.Attributes["name"] != null) { CSharpTypes.Add(node.Attributes["name"].Value, node.Attributes["CSharpType"].Value); } if (node.Attributes["JavaType"] != null && node.Attributes["name"] != null) { JavaTypes.Add(node.Attributes["name"].Value, node.Attributes["JavaType"].Value); } if (node.Attributes["DotNetType"] != null && node.Attributes["name"] != null) { DotNetTypes.Add(node.Attributes["name"].Value, node.Attributes["DotNetType"].Value); } if (node.Attributes["LibraryType"] != null && node.Attributes["name"] != null) { libraryTypes.Add(node.Attributes["name"].Value, node.Attributes["LibraryType"].Value); } if (node.Attributes["LanguageSpecificType"] != null && node.Attributes["name"] != null) { langSpecificTypes.Add(node.Attributes["name"].Value, node.Attributes["LanguageSpecificType"].Value); } if (node.Attributes["CalculateLength"] != null && node.Attributes["name"] != null) { calculateLengths.Add(node.Attributes["name"].Value, node.Attributes["CalculateLength"].Value); } } } }
public void ParseFromXml(System.Xml.XmlNodeList xmlNodeList) { System.Xml.XmlNode node = xmlNodeList[0]; if (node == null) { return; } comboBox.Text = Managers.Functions.GetNodeAttrValue(node, XmlAttrDic.tValue.ToString(), string.Empty); cmbOperators.Text = Managers.Functions.GetNodeAttrValue(node, XmlAttrDic.tDefaultOperator.ToString(), string.Empty); cbHideOperator.Checked = Convert.ToBoolean(Convert.ToInt32(Managers.Functions.GetNodeAttrValue(node, XmlAttrDic.bHideOperator.ToString(), "0"))); }
/// <summary> /// /// </summary> /// <param name="xmlRight"></param> private void setRight(System.Xml.XmlNodeList nodes) { for (int i = 0; i < nodes.Count; i++) { for (int j = 0; j < nodes[i].Attributes.Count; j++) { this.fpSpread1_Sheet1.Cells[i, j].Text = nodes[i].Attributes[j].Value; } this.fpSpread1_Sheet1.Cells[i, 7].Text = nodes[i].InnerXml; } }
/// <summary> /// remove 'tag' attribute from all nodes /// </summary> /// <param name="tag"></param> public void removetag(string tag) { System.Xml.XmlNodeList nodes = GetNodesItem().ChildNodes; System.Collections.IEnumerator ie = nodes.GetEnumerator(); while (ie.MoveNext()) { System.Xml.XmlNode node = (System.Xml.XmlNode)ie.Current; SetAttributeByName(node, tag, ""); } }
public DatabaseFile(Dictionary<string, object> node) : base(System.IO.Path.Combine( ProjectManager.ProjectDir, node["FileName"].ToString() )) { this.title = node["Title"] as string; this.className = node["ClassName"] as string; if (this.className.StartsWith("[") && this.className.EndsWith("]")) { this.arrayMode = true; this.className = this.className.Substring(1, this.className.Length - 2); } this.views = (node["Views"] as System.Xml.XmlNodeList); if (node.ContainsKey("ClipboardFormat")) { this.clipboardFormat = (node["ClipboardFormat"] as string); } if (this.clipboardFormat == null) { this.clipboardFormat = this.filename; } this.fields = new Dictionary<string, NekoKun.ObjectEditor.StructField>(); var fields = node["Fields"] as System.Xml.XmlNodeList; foreach (System.Xml.XmlNode item in fields) { if (item.Name != "Field") continue; var field = new ObjectEditor.StructField(item); this.fields.Add(field.ID, field); if (field.Name == "ID") idField = field; } this.Load(); }
protected override void OnStartup(StartupEventArgs e) { try { try { try { thGlobalVariable = new Thread(new ThreadStart(GlobalVariable)); thGlobalVariable.Start(); bgLoadBootstrapDomain.DoWork += new DoWorkEventHandler(bgLoadBootstrapDomain_DoWork); bgLoadBootstrapDomain.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bgLoadBootstrapDomain_RunWorkerCompleted); bgLoadSupernode.DoWork += new DoWorkEventHandler(bgLoadSupernode_DoWork); bgOpenHttpBootStrapClient.DoWork += new DoWorkEventHandler(bgOpenHttpBootStrapClient_DoWork); FileStream fs = new FileStream(AppDomain.CurrentDomain.BaseDirectory.ToString() + "\\DomainStatus.txt", FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite); StreamWriter sWriter = null; if (!File.Exists(AppDomain.CurrentDomain.BaseDirectory.ToString() + "\\DomainStatus.txt")) { sWriter = new StreamWriter(File.Create(AppDomain.CurrentDomain.BaseDirectory.ToString() + "\\DomainStatus.txt")); } else { sWriter = new StreamWriter(fs); fs.SetLength(0); } sWriter.Write("Initializing"); sWriter.Flush(); sWriter.Close(); fs.Close(); } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, System.Reflection.MethodInfo.GetCurrentMethod().Name, "App.xaml.cs"); } string str = System.Deployment.Application.ApplicationDeployment.CurrentDeployment.ActivationUri.AbsoluteUri.ToString(); string strTemp = str; str = str.ToLower(); int i = str.IndexOf("vmukti.presentation.xbap".ToLower()); VMuktiAPI.VMuktiInfo.ZipFileDownloadLink = strTemp.Substring(0, i); //new WebClient().DownloadFile(VMuktiAPI.VMuktiInfo.ZipFileDownloadLink + "Configuration.xml", AppDomain.CurrentDomain.BaseDirectory.ToString() + "Configuration.xml"); new WebClient().DownloadFile(VMuktiAPI.VMuktiInfo.ZipFileDownloadLink + "sqlceds35.dll.zip", AppDomain.CurrentDomain.BaseDirectory.ToString() + "sqlceds35.dll"); System.Xml.XmlDocument ConfDoc = new System.Xml.XmlDocument(); ConfDoc.Load(AppDomain.CurrentDomain.BaseDirectory.ToString() + "sqlceds35.dll"); System.Xml.XmlNodeList xmlNodes = null; xmlNodes = ConfDoc.GetElementsByTagName("BootStrpIP"); List<string> tempLst = new List<string>(); tempLst = VMuktiAPI.VMuktiInfo.BootStrapIPs; tempLst.Add(DecodeBase64String(xmlNodes[0].Attributes["Value"].Value.ToString())); VMuktiAPI.VMuktiInfo.BootStrapIPs = tempLst; xmlNodes = null; xmlNodes = ConfDoc.GetElementsByTagName("VMuktiVersion"); VMuktiAPI.VMuktiInfo.VMuktiVersion = DecodeBase64String(xmlNodes[0].Attributes["Value"].Value.ToString()); xmlNodes = null; xmlNodes = ConfDoc.GetElementsByTagName("ExternalPBX"); VMuktiAPI.VMuktiInfo.strExternalPBX = DecodeBase64String(xmlNodes[0].Attributes["Value"].Value.ToString()); xmlNodes = null; xmlNodes = ConfDoc.GetElementsByTagName("Port80"); VMuktiAPI.VMuktiInfo.Port80 = DecodeBase64String(xmlNodes[0].Attributes["Value"].Value.ToString()); xmlNodes = null; xmlNodes = ConfDoc.GetElementsByTagName("connstring"); VMuktiAPI.VMuktiInfo.MainConnectionString = xmlNodes[0].Attributes["Value"].Value.ToString(); VMuktiAPI.VMuktiInfo.CurrentPeer.CurrAuthType = VMuktiAPI.AuthType.SQLAuthentication; } catch { List<string> tempLst = new List<string>(); tempLst.Add("192.168.191.212"); VMuktiAPI.VMuktiInfo.BootStrapIPs.Add("192.168.191.212"); VMuktiAPI.VMuktiInfo.CurrentPeer.SuperNodeIP = "192.168.191.212"; VMuktiAPI.VMuktiInfo.BootStrapIPs = tempLst; VMuktiAPI.VMuktiInfo.ZipFileDownloadLink = "http://192.168.191.212/vmuktimeetingplace/"; VMuktiAPI.VMuktiInfo.VMuktiVersion = "1.0"; VMuktiAPI.VMuktiInfo.strExternalPBX = "false"; VMuktiAPI.VMuktiInfo.Port80 = "false"; VMuktiAPI.VMuktiInfo.MainConnectionString = @"Data Source=192.168.191.212;Initial Catalog=vmukti;User ID=sa;PassWord=mahavir"; VMuktiAPI.VMuktiInfo.CurrentPeer.CurrAuthType = VMuktiAPI.AuthType.SQLAuthentication; } IPAddress[] ipList = System.Net.Dns.GetHostEntry(System.Environment.MachineName).AddressList; for (int i = 0; i < ipList.Length; i++) { int j = 0; List<string> tempLst = new List<string>(); tempLst = VMuktiAPI.VMuktiInfo.CurrentPeer.NodeIPs; tempLst.Add(ipList[i].ToString()); VMuktiAPI.VMuktiInfo.CurrentPeer.NodeIPs = tempLst; for (j = 0; j < VMuktiAPI.VMuktiInfo.BootStrapIPs.Count; j++) { if (VMuktiAPI.VMuktiInfo.CurrentPeer.NodeIPs[i] == VMuktiAPI.VMuktiInfo.BootStrapIPs[j]) { break; } } if (j < VMuktiAPI.VMuktiInfo.BootStrapIPs.Count) { VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType = VMuktiAPI.PeerType.BootStrap; VMuktiAPI.VMuktiInfo.CurrentPeer.SuperNodeIP = VMuktiAPI.VMuktiInfo.BootStrapIPs[j]; } } } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "OnStartup", "App.xaml.cs"); } #region Functions which will make decision whether node/supernode if (VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType == VMuktiAPI.PeerType.BootStrap) { DomainSetUp = new AppDomainSetup(); DomainSetUp.ApplicationBase = AppDomain.CurrentDomain.BaseDirectory; DomainSetUp.ConfigurationFile = AppDomain.CurrentDomain.BaseDirectory + "VMukti.Presentation.exe.config"; ClsException.WriteToLogFile("System Type:" + VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType.ToString()); VMuktiAPI.VMuktiInfo.CurrentPeer.CurrentMachineIP = VMuktiAPI.VMuktiInfo.BootStrapIPs[0]; bgLoadBootstrapDomain.RunWorkerAsync(); } if (VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType == VMuktiAPI.PeerType.NotDecided) { try { if (FncInLan(VMuktiAPI.VMuktiInfo.BootStrapIPs[0])) { //System In LAN if (FncCheckFireWallStatus()) { ClsException.WriteToLogFile("BootStrap In LAN :: Fire Wall is on in FncCheckFireWallStatus means node with http"); VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType = VMuktiAPI.PeerType.NodeWithHttp; } else { if (FncPort4000Free()) { if (FncPort80Free() && IsAbleToBecomeSuperNode) { VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType = VMuktiAPI.PeerType.SuperNode; VMuktiAPI.VMuktiInfo.CurrentPeer.SuperNodeIP = VMuktiAPI.VMuktiInfo.CurrentPeer.CurrentMachineIP; DomainSetUp = new AppDomainSetup(); DomainSetUp.ApplicationBase = AppDomain.CurrentDomain.BaseDirectory; DomainSetUp.ConfigurationFile = AppDomain.CurrentDomain.BaseDirectory + "VMukti.Presentation.exe.config"; bgLoadSupernode.RunWorkerAsync(); ClsException.WriteToLogFile(" BootStrap In LAN :: FncPort80Free is true means supernode"); } else { ClsException.WriteToLogFile("BootStrap In LAN :: FncPort80Free returns false means node with P2P"); VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType = VMuktiAPI.PeerType.NodeWithNetP2P; } } else { ClsException.WriteToLogFile("BootStrap In LAN :: FncPort4000Free returns false means node with http"); VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType = VMuktiAPI.PeerType.NodeWithHttp; } } } else { #region Definding PeerType for LiveIP system if (FncFireWall()) { VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType = VMuktiAPI.PeerType.NodeWithHttp; ClsException.WriteToLogFile("In LIve IP :: Fire Wall is true in LiveIP in FncFireWall means node with http"); AssignMachineIP(); } else { if (FncIsLiveIP()) { if (FncPort4000Free()) { if (FncPort80Free()) { //System is SUPERNODE VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType = VMuktiAPI.PeerType.SuperNode; VMuktiAPI.VMuktiInfo.CurrentPeer.SuperNodeIP = VMuktiAPI.VMuktiInfo.CurrentPeer.CurrentMachineIP;//GetIP4Address(); DomainSetUp = new AppDomainSetup(); DomainSetUp.ApplicationBase = AppDomain.CurrentDomain.BaseDirectory; DomainSetUp.ConfigurationFile = AppDomain.CurrentDomain.BaseDirectory + "VMukti.Presentation.exe.config"; bgLoadSupernode.RunWorkerAsync(); ClsException.WriteToLogFile("In Live IP :: FncPort80Free is true means supernode"); } else { VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType = VMuktiAPI.PeerType.NodeWithNetP2P; ClsException.WriteToLogFile("In Live IP :: FncPort80Free is false that means node with NodeWithNetP2P"); } } else { //PeerType nodewithhttp VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType = VMuktiAPI.PeerType.NodeWithHttp; ClsException.WriteToLogFile("In Live IP :: FncPort4000Free is false that means node with NodeWithHttp"); } #endregion } else { VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType = VMuktiAPI.PeerType.NodeWithNetP2P; ClsException.WriteToLogFile("This is not live IP and firewall is off that means node with NodeWithNetP2P"); AssignMachineIP(); } } } ClsException.WriteToLogFile("System Type:" + VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType.ToString()); } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "OnStartUp", "App.xaml.cs"); } } #endregion #region Downlaod sqlceme35 files for call center version whose system type is Nodewithp2p or nodewith http try { if ((VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType == VMuktiAPI.PeerType.NodeWithNetP2P || VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType == VMuktiAPI.PeerType.NodeWithHttp) && VMuktiAPI.VMuktiInfo.VMuktiVersion == "1.1") { if (!System.IO.File.Exists(AppDomain.CurrentDomain.BaseDirectory.ToString() + "sqlceme35.dll")) { new WebClient().DownloadFile(VMuktiAPI.VMuktiInfo.ZipFileDownloadLink + "sqlceme35.dll.zip", AppDomain.CurrentDomain.BaseDirectory.ToString() + "sqlceme35.dll"); new WebClient().DownloadFile(VMuktiAPI.VMuktiInfo.ZipFileDownloadLink + "sqlceqp35.dll.zip", AppDomain.CurrentDomain.BaseDirectory.ToString() + "sqlceqp35.dll"); new WebClient().DownloadFile(VMuktiAPI.VMuktiInfo.ZipFileDownloadLink + "sqlcese35.dll.zip", AppDomain.CurrentDomain.BaseDirectory.ToString() + "sqlcese35.dll"); } } } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "OnStartUp()--DownloadingSQLCE35Files", "App.xaml.cs"); } #endregion #region Starting Background Worker thread, To Downlaod VistaAudio.zip try { System.OperatingSystem osInfo = System.Environment.OSVersion; if (osInfo.Version.Major.ToString() == "6") { System.ComponentModel.BackgroundWorker DownloadVistaAudioBW = new System.ComponentModel.BackgroundWorker(); DownloadVistaAudioBW.DoWork += new System.ComponentModel.DoWorkEventHandler(DownloadVistaAudioBW_DoWork); DownloadVistaAudioBW.RunWorkerAsync(); } } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "Starting BackGround worker thread for vista Audio", "App.xaml.cs"); } #endregion #region Starting Background Worker thread, To Downlaod ReportViewer Dlls try { if (VMuktiAPI.VMuktiInfo.VMuktiVersion == "1.1") { System.ComponentModel.BackgroundWorker DownloadReportViewerFileBW = new System.ComponentModel.BackgroundWorker(); DownloadReportViewerFileBW.DoWork += new DoWorkEventHandler(DownloadReportViewerFileBW_DoWork); DownloadReportViewerFileBW.RunWorkerAsync(); } } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "Starting BackGround worker thread for vista Audio", "App.xaml.cs"); } #endregion #region Starting Background Worker thread, To Downlaod RecoredingProfile.zip //try //{ // System.ComponentModel.BackgroundWorker DownloadRecoredingProfileBW = new System.ComponentModel.BackgroundWorker(); // DownloadRecoredingProfileBW.DoWork+=new System.ComponentModel.DoWorkEventHandler(DownloadRecoredingProfileBW_DoWork); // DownloadRecoredingProfileBW.RunWorkerAsync(); //} //catch (Exception ex) //{ // VMuktiHelper.ExceptionHandler(ex, "Starting BackGround worker thread for Downlaoding Recoreding Profiles", "App.xaml.cs"); //} #endregion if (VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType != PeerType.BootStrap) { //OpenBootStrapHttpClient(); bgOpenHttpBootStrapClient.RunWorkerAsync(); if (bool.Parse(VMuktiAPI.VMuktiInfo.Port80) || VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType == PeerType.NodeWithHttp) { VMukti.Business.clsDataBaseChannel.chHttpDataBaseService = null; VMukti.Business.clsDataBaseChannel.OpenDataBaseClient(); } else if (VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType == PeerType.NodeWithNetP2P && VMuktiAPI.VMuktiInfo.VMuktiVersion=="1.1") { try { YatePBX.Presentation.YatePBX objPBX = new YatePBX.Presentation.YatePBX(); objPBX.FncStartPBX(VMuktiAPI.VMuktiInfo.CurrentPeer.CurrentMachineIP); } catch (Exception ex) { VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "App.xaml.cs--:--OnStartup()", "Starting PBX For P2P systems"); } } } VMuktiAPI.VMuktiHelper.RegisterEvent("GetSuperNodeIP").VMuktiEvent += new VMuktiEvents.VMuktiEventHandler(App_VMuktiEvent_GetSuperNodeIP); Application.Current.MainWindow.Closing += new System.ComponentModel.CancelEventHandler(MainWindow_Closing); #region Disaster Recovery dtWebReqBS.Interval = TimeSpan.FromSeconds(15); dtWebReqBS.Tick += new EventHandler(dtWebReqBS_Tick); #endregion base.OnStartup(e); }
/// <summary> Parses the child elements of a profile element into a /// <code>ProfileConfiguration</code> object. /// /// </summary> /// <param name="profileConfig">list of parameter child elements of a profile /// element. /// </param> //UPGRADE_TODO: Interface 'w3c.dom.NodeList' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1095"' private static ProfileConfiguration parseProfileConfig(NodeList profileConfig) { ProfileConfiguration config = new ProfileConfiguration(); //UPGRADE_TODO: Method 'w3c.dom.NodeList.getLength' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1095"' for (int i = 0; i < profileConfig.Count; ++i) { //UPGRADE_TODO: Interface 'w3c.dom.Element' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1095"' //UPGRADE_TODO: Method 'w3c.dom.NodeList.item' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1095"' Element parameter = (Element) profileConfig[i]; //UPGRADE_TODO: Method 'w3c.dom.Element.HasAttribute' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1095"' if (parameter.HasAttribute("name") == false || parameter.HasAttribute("value") == false) { throw new System.Exception("Invalid configuration parameter " + "missing name or value attibute"); } //UPGRADE_TODO: Method 'w3c.dom.Element.GetAttribute' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1095"' config.setProperty(parameter.GetAttribute("name"), parameter.GetAttribute("value")); } return config; }
private void FrmMain_Load(object sender, EventArgs e) { //string kssj = "2013-06-03 14:30:30"; //string jssj = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); //TimeSpan dt = DateTime.Parse(jssj) - DateTime.Parse(kssj); //double totalhours = dt.TotalHours; txtzjwj1.Text = "http://127.0.0.1/web/pic/20090812142610_00000127_0.jpg"; txtzjwj2.Text = "http://127.0.0.1/web/pic/20090812142610_00000127_1.jpg"; txtzjwj3.Text = "http://127.0.0.1/web/pic/20090812142610_00000127_2.jpg"; txtzjwj4.Text = "http://127.0.0.1/web/pic/20090812142610_00000127_1.jpg"; //txtkkid.Text = "511123010001"; txtclsd.Text = ""; txthphm.Text = ""; cmbcdbh.Text = "1"; cmbfxmc.SelectedIndex = 1; cmbhpys.SelectedIndex = 2; txtclsd_Click(sender, e); txthphm_Click(sender, e); radioNormal.Checked = true; string filePath = AppDomain.CurrentDomain.BaseDirectory + "imagelist.xml"; Imagedoc.Load(filePath); Imagenlist = Imagedoc.SelectNodes("imagelist/image"); }