internal static IList<Test> LoadAll() { var file = new FileInfo("tests.xml"); if (!file.Exists) return new Test[0]; XmlDocument xml = new XmlDocument(); using (var fs = file.OpenRead()) xml.Load(fs); var ret = new List<Test>(); foreach (XmlNode node in xml.SelectNodes("/Tests/*")) { var n = node.SelectSingleNode("./Type"); if (n == null) throw new InvalidOperationException("Test Type must be informed."); var typeName = n.InnerText; var type = FindType(typeName); if (type == null) throw new InvalidOperationException(string.Format("'{0}' is not a valid Test.", typeName)); var obj = (Test)Activator.CreateInstance(type); node.ToEntity(obj); ret.Add(obj); } return ret; }
void addConfigFile(string configFilename) { var dirName = Utils.getDirName(Utils.getFullPath(configFilename)); addAssemblySearchPath(dirName); try { using (var xmlStream = new FileStream(configFilename, FileMode.Open, FileAccess.Read, FileShare.Read)) { var doc = new XmlDocument(); doc.Load(XmlReader.Create(xmlStream)); foreach (var tmp in doc.GetElementsByTagName("probing")) { var probingElem = tmp as XmlElement; if (probingElem == null) continue; var privatePath = probingElem.GetAttribute("privatePath"); if (string.IsNullOrEmpty(privatePath)) continue; foreach (var path in privatePath.Split(';')) addAssemblySearchPath(Path.Combine(dirName, path)); } } } catch (IOException) { } catch (XmlException) { } }
private void buttonRegister_Click(object sender, EventArgs e) { if (this.textBoxForLogin.Text.Any() == false || this.textBoxForName.Text.Any() == false || this.textBoxForSurname.Text.Any() == false || this.textBoxForPassword.Text.Any() == false) { MessageBox.Show("You didn't fill all fields!", "Error", MessageBoxButtons.OK); } else { XmlDocument xmlDocument = new XmlDocument(); xmlDocument.Load(Data.teachersLocation); XmlNode root = xmlDocument.SelectSingleNode("root"); var existing = root.SelectSingleNode("teacher[login='******' and password='******']"); if (existing != null) { MessageBox.Show("This users already exists!", "Error", MessageBoxButtons.OK); } else { var newTeacher = new Teacher(textBoxForName.Text, textBoxForSurname.Text, textBoxForLogin.Text, textBoxForPassword.Text.GetHashCode().ToString()); newTeacher.AddNewTeacher(); MessageBox.Show("Вы успешно зарегистрировали нового учителя", "Создан", MessageBoxButtons.OK); this.Close(); } } }
/// <summary> /// loads a xml from the web server /// </summary> /// <param name="_url">URL of the XML file</param> /// <returns>A XmlDocument object of the XML file</returns> public static XmlDocument LoadXml(string _url) { var xmlDoc = new XmlDocument(); try { while (Helper.pingForum("forum.mods.de", 10000) == false) { Console.WriteLine("Can't reach forum.mods.de right now, try again in 15 seconds..."); System.Threading.Thread.Sleep(15000); } xmlDoc.Load(_url); } catch (XmlException) { while (Helper.pingForum("forum.mods.de", 100000) == false) { Console.WriteLine("Can't reach forum.mods.de right now, try again in 15 seconds..."); System.Threading.Thread.Sleep(15000); } WebClient client = new WebClient(); ; Stream stream = client.OpenRead(_url); StreamReader reader = new StreamReader(stream); string content = reader.ReadToEnd(); content = RemoveTroublesomeCharacters(content); xmlDoc.LoadXml(content); } return xmlDoc; }
public void Save(string path) { XmlDocument doc = new XmlDocument(); XmlElement root = doc.CreateElement("Resources"); doc.AppendChild(root); XmlElement sheetsElem = doc.CreateElement("SpriteSheets"); foreach (KeyValuePair<string, SpriteSheet> pair in SpriteSheets) { XmlElement elem = doc.CreateElement(pair.Key); pair.Value.Save(doc, elem); sheetsElem.AppendChild(elem); } root.AppendChild(sheetsElem); XmlElement spritesElem = doc.CreateElement("Sprites"); foreach (KeyValuePair<string, Sprite> pair in Sprites) { XmlElement elem = doc.CreateElement(pair.Key); pair.Value.Save(doc, elem); spritesElem.AppendChild(elem); } root.AppendChild(spritesElem); XmlElement animsElem = doc.CreateElement("Animations"); foreach (KeyValuePair<string, Animation> pair in Animations) { XmlElement elem = doc.CreateElement(pair.Key); pair.Value.Save(doc, elem); animsElem.AppendChild(elem); } root.AppendChild(animsElem); doc.Save(path); }
/// <summary> /// 设置流程文件缓存 /// </summary> /// <param name="processGUID"></param> /// <param name="xmlDoc"></param> /// <returns></returns> internal static XmlDocument SetXpdlCache(string processGUID, string version, XmlDocument xmlDoc) { var str = processGUID + version; var strMD5 = MD5Helper.GetMD5(str); return _xpdlCache.GetOrAdd(strMD5, xmlDoc); }
internal XmlAttributeCollection (XmlNode parent) : base (parent) { ownerElement = parent as XmlElement; ownerDocument = parent.OwnerDocument; if(ownerElement == null) throw new XmlException ("invalid construction for XmlAttributeCollection."); }
public WMIBMySQL() { string file = Variables.ConfigurationDirectory + Path.DirectorySeparatorChar + "unwrittensql.xml"; Core.RecoverFile(file); if (File.Exists(file)) { Syslog.WarningLog("There is a mysql dump file from previous run containing mysql rows that were never successfuly inserted, trying to recover them"); XmlDocument document = new XmlDocument(); using (TextReader sr = new StreamReader(file)) { document.Load(sr); using (XmlNodeReader reader = new XmlNodeReader(document.DocumentElement)) { XmlSerializer xs = new XmlSerializer(typeof(Unwritten)); Unwritten un = (Unwritten)xs.Deserialize(reader); lock (unwritten.PendingRows) { unwritten.PendingRows.AddRange(un.PendingRows); } } } } Thread reco = new Thread(Exec) {Name = "MySQL/Recovery"}; Core.ThreadManager.RegisterThread(reco); reco.Start(); }
public StudyDeleteRecord( String _studyInstanceUid_ ,DateTime _timestamp_ ,String _serverPartitionAE_ ,ServerEntityKey _filesystemKey_ ,String _backupPath_ ,String _reason_ ,String _accessionNumber_ ,String _patientId_ ,String _patientsName_ ,String _studyId_ ,String _studyDescription_ ,String _studyDate_ ,String _studyTime_ ,XmlDocument _archiveInfo_ ,String _extendedInfo_ ):base("StudyDeleteRecord") { StudyInstanceUid = _studyInstanceUid_; Timestamp = _timestamp_; ServerPartitionAE = _serverPartitionAE_; FilesystemKey = _filesystemKey_; BackupPath = _backupPath_; Reason = _reason_; AccessionNumber = _accessionNumber_; PatientId = _patientId_; PatientsName = _patientsName_; StudyId = _studyId_; StudyDescription = _studyDescription_; StudyDate = _studyDate_; StudyTime = _studyTime_; ArchiveInfo = _archiveInfo_; ExtendedInfo = _extendedInfo_; }
private void DlgTips_Load(object sender, EventArgs e) { try { string strxml = ""; using (StreamReader streamReader = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("Johnny.Kaixin.WinUI.Resources.Versions.config"))) { strxml = streamReader.ReadToEnd(); } XmlDocument objXmlDoc = new XmlDocument(); objXmlDoc.LoadXml(strxml); if (objXmlDoc == null) return; DataView dv = GetData(objXmlDoc, "ZrAssistant/Versions"); for (int ix = 0; ix < dv.Table.Rows.Count; ix++) { _versionList.Add(dv.Table.Rows[ix][0].ToString(), dv.Table.Rows[ix][1].ToString()); cmbVersion.Items.Add(dv.Table.Rows[ix][0].ToString()); } chkNeverDisplay.Checked = Properties.Settings.Default.NeverDisplay; cmbVersion.SelectedIndex = 0; SetTextValue(); btnOk.Select(); } catch (Exception ex) { Program.ShowMessageBox("DlgTips", ex); } }
public string GetSchema() { var schema = getMainSchema(); XmlDocument doc = new XmlDocument(); doc.Load(schema); return doc.OuterXml; }
public static string UpdateSagaXMLFile(ref DataTable _XMLDt, string XMLpath) { try { XmlDocument xmldoc = new XmlDocument(); xmldoc.Load(XMLpath); XmlNode xmlnode = xmldoc.DocumentElement.ChildNodes[0]; xmlnode["ODBCDriverName"].InnerText = _XMLDt.Rows[0]["ODBCDriverName"].ToString(); xmlnode["HostName"].InnerText = _XMLDt.Rows[0]["HostName"].ToString(); xmlnode["ServerName"].InnerText = _XMLDt.Rows[0]["ServerName"].ToString(); xmlnode["ServiceName"].InnerText = _XMLDt.Rows[0]["ServiceName"].ToString(); xmlnode["Protocol"].InnerText = _XMLDt.Rows[0]["Protocol"].ToString(); xmlnode["DatabaseName"].InnerText = _XMLDt.Rows[0]["DatabaseName"].ToString(); xmlnode["UserId"].InnerText = _XMLDt.Rows[0]["UserId"].ToString(); xmlnode["Password"].InnerText = _XMLDt.Rows[0]["Password"].ToString(); xmlnode["ClientLocale"].InnerText = _XMLDt.Rows[0]["ClientLocale"].ToString(); xmlnode["DatabaseLocale"].InnerText = _XMLDt.Rows[0]["DatabaseLocale"].ToString(); xmldoc.Save(XMLpath); return ""; } catch (Exception err) { return err.Message; } }
public static List<Structure> LoadXmlFile(string filename) { XmlDocument document = new XmlDocument(); document.Load(filename); ProfileReader reader = new ProfileReader(); return reader.Read(document); }
private bool OverWriting() { //private async Task<bool> OverWriting() { if (ListingQueue.Any()) { XmlDocument xmlDoc; XmlElement xmlEle; XmlNode newNode; xmlDoc = new XmlDocument(); xmlDoc.Load("ImageData.xml"); // XML문서 로딩 newNode = xmlDoc.SelectSingleNode("Images"); // 추가할 부모 Node 찾기 xmlEle = xmlDoc.CreateElement("Image"); newNode.AppendChild(xmlEle); newNode = newNode.LastChild; xmlEle = xmlDoc.CreateElement("ImagePath"); // 추가할 Node 생성 xmlEle.InnerText = ListingQueue.Peek(); ListingQueue.Dequeue(); newNode.AppendChild(xmlEle); // 위에서 찾은 부모 Node에 자식 노드로 추가.. xmlDoc.Save("ImageData.xml"); // XML문서 저장.. xmlDoc = null; return true; } return false; }
/// <summary> /// Define o valor de uma configuração /// </summary> /// <param name="file">Caminho do arquivo (ex: c:\program.exe.config)</param> /// <param name="key">Nome da configuração</param> /// <param name="value">Valor a ser salvo</param> /// <returns></returns> public static bool SetValue(string file, string key, string value) { var fileDocument = new XmlDocument(); fileDocument.Load(file); var nodes = fileDocument.GetElementsByTagName(AddElementName); if (nodes.Count == 0) { return false; } for (var i = 0; i < nodes.Count; i++) { var node = nodes.Item(i); if (node == null || node.Attributes == null || node.Attributes.GetNamedItem(KeyPropertyName) == null) continue; if (node.Attributes.GetNamedItem(KeyPropertyName).Value == key) { node.Attributes.GetNamedItem(ValuePropertyName).Value = value; } } var writer = new XmlTextWriter(file, null) { Formatting = Formatting.Indented }; fileDocument.WriteTo(writer); writer.Flush(); writer.Close(); return true; }
private void saveXml() { string error = String.Empty; XmlDocument modifiedXml = new XmlDocument(); modifiedXml.LoadXml(txtXml.Text); pageNode.SetPersonalizationFromXml(HttpContext.Current, modifiedXml, out error); }
//Appends the any xml file/folder nodes onto the folder private void AddXmlNodes(FolderCompareObject folder, int numOfPaths, XmlDocument xmlDoc) { List<XMLCompareObject> xmlObjList = new List<XMLCompareObject>(); List<string> xmlFolderList = new List<string>(); for (int i = 0; i < numOfPaths; i++) { string path = Path.Combine(folder.GetSmartParentPath(i), folder.Name); if (Directory.Exists(path)) { DirectoryInfo dirInfo = new DirectoryInfo(path); FileInfo[] fileList = dirInfo.GetFiles(); DirectoryInfo[] dirInfoList = dirInfo.GetDirectories(); string xmlPath = Path.Combine(path, CommonXMLConstants.MetadataPath); if (!File.Exists(xmlPath)) continue; CommonMethods.LoadXML(ref xmlDoc, xmlPath); xmlObjList = GetAllFilesInXML(xmlDoc); xmlFolderList = GetAllFoldersInXML(xmlDoc); RemoveSimilarFiles(xmlObjList, fileList); RemoveSimilarFolders(xmlFolderList, dirInfoList); } AddFileToChild(xmlObjList, folder, i, numOfPaths); AddFolderToChild(xmlFolderList, folder, i, numOfPaths); xmlObjList.Clear(); xmlFolderList.Clear(); } }
private void Page_Load(object sender, EventArgs e) { XmlDocument configDoc = new XmlDocument(); configDoc.Load(Server.MapPath(Configuration.ConfigFile)); Configuration configuration = new Configuration(configDoc); treeNavigator.ContentFile = configuration.ExamplesDataFile; }
public AvatarAnimations() { using (XmlTextReader reader = new XmlTextReader("data/avataranimations.xml")) { XmlDocument doc = new XmlDocument(); doc.Load(reader); foreach (XmlNode nod in doc.DocumentElement.ChildNodes) { if (nod.Attributes["name"] != null) { string name = nod.Attributes["name"].Value; UUID id = (UUID) nod.InnerText; string animState = nod.Attributes["state"].Value; try { AnimsUUID.Add(name, id); if (animState != "" && !AnimStateNames.ContainsKey(id)) AnimStateNames.Add(id, animState); } catch { } } } } }
/// <summary> /// Load the style from assmebly resource. /// </summary> public virtual void New() { Assembly ass = Assembly.GetExecutingAssembly(); Stream str = ass.GetManifestResourceStream("AODL.Resources.OD.manifest.xml"); this.Manifest = new XmlDocument(); this.Manifest.Load(str); }
public GeoIP() { try { HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://freegeoip.net/xml/"); request.Proxy = null; HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream dataStream = response.GetResponseStream(); StreamReader reader = new StreamReader(dataStream); string responseString = reader.ReadToEnd(); reader.Close(); dataStream.Close(); response.Close(); XmlDocument doc = new XmlDocument(); doc.LoadXml(responseString); WANIP = doc.SelectSingleNode("Response//Ip").InnerXml.ToString(); Country = (!string.IsNullOrEmpty(doc.SelectSingleNode("Response//CountryName").InnerXml.ToString())) ? doc.SelectSingleNode("Response//CountryName").InnerXml.ToString() : "Unknown"; CountryCode = (!string.IsNullOrEmpty(doc.SelectSingleNode("Response//CountryCode").InnerXml.ToString())) ? doc.SelectSingleNode("Response//CountryCode").InnerXml.ToString() : "-"; Region = (!string.IsNullOrEmpty(doc.SelectSingleNode("Response//RegionName").InnerXml.ToString())) ? doc.SelectSingleNode("Response//RegionName").InnerXml.ToString() : "Unknown"; City = (!string.IsNullOrEmpty(doc.SelectSingleNode("Response//City").InnerXml.ToString())) ? doc.SelectSingleNode("Response//City").InnerXml.ToString() : "Unknown"; } catch { WANIP = "-"; Country = "Unknown"; CountryCode = "-"; Region = "Unknown"; City = "Unknown"; } }
public override object[] CreateMapping(params object[] initParams) { XmlDocument document = (XmlDocument) initParams[0]; string str = (string) initParams[1]; DataSet mappingSet = this.GetMappingSet(); XmlDocument indexesDoc = new XmlDocument(); indexesDoc.Load(Path.Combine(str, "indexes.xml")); foreach (XmlNode node in document.DocumentElement.SelectNodes("//type")) { DataRow row = mappingSet.Tables["types"].NewRow(); int mappedTypeId = int.Parse(node.Attributes["mappedTypeId"].Value); int num2 = int.Parse(node.Attributes["selectedTypeId"].Value); row["MappedTypeId"] = mappedTypeId; row["SelectedTypeId"] = num2; if (num2 == 0) { XmlNode node2 = indexesDoc.SelectSingleNode("//type[typeId[text()='" + mappedTypeId + "']]"); row["TypeName"] = node2.SelectSingleNode("typeName").InnerText; row["Remark"] = node2.SelectSingleNode("remark").InnerText; } mappingSet.Tables["types"].Rows.Add(row); XmlNodeList attributeNodeList = node.SelectNodes("attributes/attribute"); this.MappingAttributes(mappedTypeId, mappingSet, attributeNodeList, indexesDoc, str); } mappingSet.AcceptChanges(); return new object[] { mappingSet }; }
private static XmlElement GetRootNodeXmlDocument(string path) { var doc = new XmlDocument(); doc.Load(path); return doc.DocumentElement; }
public override string ToText(Subtitle subtitle, string title) { string xmlStructure = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + Environment.NewLine + "<EEG708Captions/>"; XmlDocument xml = new XmlDocument(); xml.LoadXml(xmlStructure); foreach (Paragraph p in subtitle.Paragraphs) { XmlNode paragraph = xml.CreateElement("Caption"); XmlAttribute start = xml.CreateAttribute("timecode"); start.InnerText = EncodeTimeCode(p.StartTime); paragraph.Attributes.Append(start); XmlNode text = xml.CreateElement("Text"); text.InnerText = p.Text; paragraph.AppendChild(text); xml.DocumentElement.AppendChild(paragraph); paragraph = xml.CreateElement("Caption"); start = xml.CreateAttribute("timecode"); start.InnerText = EncodeTimeCode(p.EndTime); paragraph.Attributes.Append(start); xml.DocumentElement.AppendChild(paragraph); } return ToUtf8XmlString(xml); }
public override bool InitOne(ContentManager content, int id) { XmlDocument _doc = new XmlDocument(); _doc.Load(_xmlInfo); XmlNode _gameTitle = _doc.SelectSingleNode(@"//GameTitle[@id = '" + id.ToString() + "']"); _prototype[id] = new GameTitle(); XmlNodeList _listOfTitle = _gameTitle.SelectNodes(@"//Title"); _prototype[id]._nsprite = _listOfTitle.Count; _prototype[id]._sprite = new GameSprite[_prototype[id]._nsprite]; for (int i = 0; i < _prototype[id]._nsprite; i++) { int _numofframe = int.Parse(_listOfTitle[i].SelectSingleNode(@"NumOfFrames").InnerText); string _contentname = _listOfTitle[i].SelectSingleNode(@"ContentName").InnerText; Texture2D[] _textures = new Texture2D[_numofframe]; for (int j = 0; j < _numofframe; ++j) { _textures[j] = content.Load<Texture2D>(_contentname + j.ToString("00")); } _prototype[id]._sprite[i] = new GameSprite(_textures, 0, 0); } _prototype[id].X = float.Parse(_gameTitle.SelectSingleNode(@"X").InnerText); _prototype[id].Y = float.Parse(_gameTitle.SelectSingleNode(@"Y").InnerText); ((GameTitle)_prototype[id]).DelayTime = int.Parse((_gameTitle.SelectSingleNode(@"DelayTime").InnerText)); return true; }
public void SetUp() { TestHelper.SetupLog4NetForTests(); Umbraco.Core.Configuration.UmbracoSettings.UseLegacyXmlSchema = false; _httpContextFactory = new FakeHttpContextFactory("~/Home"); //ensure the StateHelper is using our custom context StateHelper.HttpContext = _httpContextFactory.HttpContext; _umbracoContext = new UmbracoContext(_httpContextFactory.HttpContext, new ApplicationContext(), new DefaultRoutesCache(false)); _umbracoContext.GetXmlDelegate = () => { var xDoc = new XmlDocument(); //create a custom xml structure to return xDoc.LoadXml(GetXml()); //return the custom x doc return xDoc; }; _publishedContentStore = new DefaultPublishedContentStore(); }
/// <summary> /// Changes the name of an analyzer setting property, if it exists. /// </summary> /// <param name="document"> /// The settings document. /// </param> /// <param name="analyzerName"> /// The analyzer name. /// </param> /// <param name="legacyPropertyName"> /// The legacy name of the property. /// </param> /// <param name="newPropertyName"> /// The new name of the property. /// </param> public static void ChangeAnalyzerSettingName(XmlDocument document, string analyzerName, string legacyPropertyName, string newPropertyName) { Param.AssertNotNull(document, "document"); Param.AssertValidString(analyzerName, "analyzerName"); Param.AssertValidString(legacyPropertyName, "legacyPropertyName"); Param.AssertValidString(newPropertyName, "newPropertyName"); XmlNode analyzersNode = document.DocumentElement.SelectSingleNode("Analyzers"); if (analyzersNode != null) { XmlNode analyzerNode = analyzersNode.SelectSingleNode("Analyzer[@AnalyzerId=\"" + analyzerName + "\"]"); if (analyzerNode != null) { XmlNode analyzerSettingsNode = analyzerNode.SelectSingleNode("AnalyzerSettings"); if (analyzerSettingsNode != null) { // This rule node must be moved under the new analyzer section. // Check whether this section already exists. XmlNode propertyNode = analyzerSettingsNode.SelectSingleNode("*[@Name=\"" + legacyPropertyName + "\"]"); if (propertyNode != null) { XmlAttribute attribute = propertyNode.Attributes["Name"]; if (attribute != null) { attribute.Value = newPropertyName; } } } } } }
private static void ProcessSearchQueries(XmlTextWriter writer) { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load("..\\..\\performance-test.xml"); foreach (XmlNode query in xmlDoc.SelectNodes("review-queries/query")) { SaveQueryToLog(query.OuterXml); var type = query.Attributes.GetNamedItem("type"); switch (type.Value) { case "by-period": // Start date and end date are mandatory. DateTime startDate = DateTime.Parse(query.GetChildText("start-date")); DateTime endDate = DateTime.Parse(query.GetChildText("end-date")); var reviewsByPeriod = BookstoreDAL.FindReviewsByPeriod(startDate, endDate); WriteReviews(writer, reviewsByPeriod); break; case "by-author": string authorName = query.GetChildText("author-name"); var reviewsByAuthor = BookstoreDAL.FindReviewsByAuthor(authorName); WriteReviews(writer, reviewsByAuthor); break; default: throw new ArgumentException("Type not supported!"); } } }
public void ConfigurationMessagesTest() { try { LogLog.EmitInternalMessages = false; LogLog.InternalDebugging = true; XmlDocument log4netConfig = new XmlDocument(); log4netConfig.LoadXml(@" <log4net> <appender name=""LogLogAppender"" type=""log4net.Tests.LoggerRepository.LogLogAppender, log4net.Tests""> <layout type=""log4net.Layout.SimpleLayout"" /> </appender> <appender name=""MemoryAppender"" type=""log4net.Appender.MemoryAppender""> <layout type=""log4net.Layout.SimpleLayout"" /> </appender> <root> <level value=""ALL"" /> <appender-ref ref=""LogLogAppender"" /> <appender-ref ref=""MemoryAppender"" /> </root> </log4net>"); ILoggerRepository rep = LogManager.CreateRepository(Guid.NewGuid().ToString()); rep.ConfigurationChanged += new LoggerRepositoryConfigurationChangedEventHandler(rep_ConfigurationChanged); ICollection configurationMessages = XmlConfigurator.Configure(rep, log4netConfig["log4net"]); Assert.IsTrue(configurationMessages.Count > 0); } finally { LogLog.EmitInternalMessages = true; LogLog.InternalDebugging = false; } }
public string GetXml() { // <?xml version="1.0" encoding="UTF-8" ?> // <gateways ua="Example 1.0"> // <merchant> // <account>10011001</account> // <site_id>1234</site_id> // <site_secure_code>123456</site_secure_code> // </merchant> // <customer> // <country>NL</country> // </customer> // </gateways> var xmlDoc = new XmlDocument(); var gatewaysNode = (XmlElement) xmlDoc.AppendChild(xmlDoc.CreateElement("gateways")); gatewaysNode.SetAttribute("ua", "Example 1.0"); var merchantNode = (XmlElement) gatewaysNode.AppendChild(xmlDoc.CreateElement("merchant")); merchantNode.AppendChild(xmlDoc.CreateElement("account")).InnerText = AccountId.ToString(); merchantNode.AppendChild(xmlDoc.CreateElement("site_id")).InnerText = SiteId.ToString(); merchantNode.AppendChild(xmlDoc.CreateElement("site_secure_code")).InnerText = SiteSecureId.ToString(); var customerNode = (XmlElement) gatewaysNode.AppendChild(xmlDoc.CreateElement("customer")); customerNode.AppendChild(xmlDoc.CreateElement("country")).InnerText = Country; return xmlDoc.OuterXml; }
protected void actualizarDatosNoAcademicos() { if (Session["CVAR"].ToString() == "S") { DataSet ds = new DataSet(); System.Xml.XmlDocument CVAR = sgwFunciones.CONEAU.Docentes.cvarLeerXML(Session["CUIT"].ToString(), "antecedentes/otrasActividades/ejercicioProfesional"); ds.ReadXml(new XmlNodeReader(CVAR)); if (ds.Tables.Count == 0) { return; } if (ds.Tables[0].Columns.IndexOf("organizacion") < 0) { ds.Tables[0].Columns.Add("organizacion"); } if (ds.Tables[0].Columns.IndexOf("tipoFuncionActividad") < 0) { ds.Tables[0].Columns.Add("tipoFuncionActividad"); } if (ds.Tables[0].Columns.IndexOf("fechaInicio") < 0) { ds.Tables[0].Columns.Add("fechaInicio"); } if (ds.Tables[0].Columns.IndexOf("fechaFin") < 0) { ds.Tables[0].Columns.Add("fechaFin"); } if (ds.Tables[0].Columns.IndexOf("areaEjercicio") < 0) { ds.Tables[0].Columns.Add("areaEjercicio"); } for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { // if ((ds.Tables[0].ChildRelations.Count > 0)) //try //{ // if (ds.Tables[0].Rows[i].GetChildRows(ds.Tables[0].ChildRelations[ds.Tables[0].ChildRelations.Count - 1]).Length > 0) // ds.Tables[0].Rows[i].SetField("organizacion", // ds.Tables[0].Rows[i].GetChildRows(ds.Tables[0].ChildRelations[ds.Tables[0].ChildRelations.Count - 1])[0].ItemArray[0].ToString()); // else ds.Tables[0].Rows[i].SetField("organizacion", // ds.Tables[0].Rows[i].GetChildRows(ds.Tables[0].ChildRelations[0])[0].ItemArray[0].ToString()); //} //catch //{ if (ds.Tables[0].Rows[i].GetChildRows(ds.Tables[0].ChildRelations[0]).Length > 0) { ds.Tables[0].Rows[i].SetField("organizacion", ds.Tables[0].Rows[i].GetChildRows(ds.Tables[0].ChildRelations[0])[0].ItemArray[0].ToString()); } // } //ds.Tables[0].Rows[i].SetField(ds.Tables[0].Columns.Count - 1, // ds.Tables[0].Rows[i].GetChildRows(ds.Tables[0].ChildRelations[0])[0].ItemArray[0].ToString()); DateTime DT; if (ds.Tables[0].Rows[i]["fechaInicio"].ToString() != "") { DT = Convert.ToDateTime(ds.Tables[0].Rows[i].ItemArray[0].ToString().Substring(0, 10)); ds.Tables[0].Rows[i].SetField("fechaInicio", DT.Day.ToString() + "/" + DT.Month.ToString() + "/" + DT.Year.ToString()); } if (ds.Tables[0].Rows[i]["fechaFin"].ToString() != "") { DT = Convert.ToDateTime(ds.Tables[0].Rows[i].ItemArray[1].ToString().Substring(0, 10)); ds.Tables[0].Rows[i].SetField("fechaFin", DT.Day.ToString() + "/" + DT.Month.ToString() + "/" + DT.Year.ToString()); } } grdCargosNoAcademicos.KeyFieldName = ds.Tables[0].PrimaryKey[0].Caption; grdCargosNoAcademicos.DataSource = ds; grdCargosNoAcademicos.DataBind(); return; } grdCargosNoAcademicos.DataBind(); }
/// <summary> /// Load all wiring documents in a *.phon file. /// </summary> /// <param name="doc">The XML document in a phon format.</param> /// <param name="wdActive">The active found document.</param> /// <returns>True if the load was successful, else false.</returns> public bool LoadDocument(System.Xml.XmlDocument doc, bool clearFirst) { if (clearFirst == true) { this.Clear(); } System.Xml.XmlElement root = doc.DocumentElement; // We have a seperate copy of what's loaded because if we're appending // (if clearFirst is false) we could have other stuff in there. We need // a list of only what was created from this load. List <WiringDocument> loaded = new List <WiringDocument>(); // Dictionary <string, WiringDocument> loadedByID = new Dictionary <string, WiringDocument>(); foreach (System.Xml.XmlElement ele in root) { if (ele.Name == "message") { this.documentMessages.Add(ele.InnerText); } else if (ele.Name == WiringDocument.xmlName) { string guid = string.Empty; System.Xml.XmlAttribute attrGUID = ele.Attributes["id"]; if (attrGUID != null) { guid = attrGUID.Value; } WiringDocument wd = new WiringDocument(false, guid); if (wd.LoadXML(ele) == false) { continue; } loaded.Add(wd); loadedByID.Add(wd.guid, wd); this.AddDocument(wd); } } foreach (WiringDocument wd in loaded) { Dictionary <string, LLDNBase> dirLocal = new Dictionary <string, LLDNBase>(); foreach (LLDNBase gb in wd.Generators) { dirLocal.Add(gb.GUID, gb); } foreach (LLDNBase gb in wd.Generators) { gb.PostLoadXML(dirLocal, loadedByID); } } System.Xml.XmlAttribute attrActive = root.Attributes["active"]; if (attrActive != null) { string activeGUID = attrActive.Value; foreach (WiringDocument wd in loaded) { if (wd.guid == activeGUID) { this.activeDocument = wd; break; } } } this.EnsureActive(); return(true); }
private static System.Collections.Generic.HashSet <AkPluginInfo> ParsePluginsXML(string platform, System.Collections.Generic.List <string> in_pluginFiles) { var newPlugins = new System.Collections.Generic.HashSet <AkPluginInfo>(); foreach (var pluginFile in in_pluginFiles) { if (!System.IO.File.Exists(pluginFile)) { continue; } try { var doc = new System.Xml.XmlDocument(); doc.Load(pluginFile); var Navigator = doc.CreateNavigator(); var pluginInfoNode = Navigator.SelectSingleNode("//PluginInfo"); var boolMotion = pluginInfoNode.GetAttribute("Motion", ""); var it = Navigator.Select("//Plugin"); if (boolMotion == "true") { AkPluginInfo motionPluginInfo = new AkPluginInfo(); motionPluginInfo.DllName = "AkMotion"; newPlugins.Add(motionPluginInfo); } foreach (System.Xml.XPath.XPathNavigator node in it) { var rawPluginID = uint.Parse(node.GetAttribute("ID", "")); if (rawPluginID == 0) { continue; } PluginID pluginID = (PluginID)rawPluginID; if (alwaysSkipPluginsIDs.Contains(pluginID)) { continue; } var dll = string.Empty; if (platform == "Switch") { if (pluginID == PluginID.AkMeter) { dll = "AkMeter"; } } else if (builtInPluginIDs.Contains(pluginID)) { continue; } if (string.IsNullOrEmpty(dll)) { dll = node.GetAttribute("DLL", ""); } AkPluginInfo newPluginInfo = new AkPluginInfo(); newPluginInfo.PluginID = rawPluginID; newPluginInfo.DllName = dll; if (!PluginIDToStaticLibName.TryGetValue(pluginID, out newPluginInfo.StaticLibName)) { newPluginInfo.StaticLibName = dll; } newPlugins.Add(newPluginInfo); } } catch (System.Exception ex) { UnityEngine.Debug.LogError("WwiseUnity: " + pluginFile + " could not be parsed. " + ex.Message); } } return(newPlugins); }
protected internal XmlText(string strData, XmlDocument doc) : base(strData, doc) { }
public static XmlName Create(string prefix, string localName, string ns, int hashCode, XmlDocument ownerDoc, XmlName next, IXmlSchemaInfo schemaInfo) { if (schemaInfo == null) { return(new XmlName(prefix, localName, ns, hashCode, ownerDoc, next)); } else { return(new XmlNameEx(prefix, localName, ns, hashCode, ownerDoc, next, schemaInfo)); } }
private static System.Xml.XmlElement CreateO6Element(Strukturekennzeichen kennzeichen, ref System.Xml.XmlDocument xDoc) { System.Xml.XmlElement element_O6 = xDoc.CreateElement("O6"); System.Xml.XmlAttribute attr_Build = xDoc.CreateAttribute("Build"); attr_Build.Value = "6360"; element_O6.Attributes.Append(attr_Build); System.Xml.XmlAttribute attr_A1 = xDoc.CreateAttribute("A1"); attr_A1.Value = "6/2"; element_O6.Attributes.Append(attr_A1); System.Xml.XmlAttribute attr_A3 = xDoc.CreateAttribute("A3"); attr_A3.Value = "0"; element_O6.Attributes.Append(attr_A3); System.Xml.XmlAttribute attr_A13 = xDoc.CreateAttribute("A13"); attr_A13.Value = "0"; element_O6.Attributes.Append(attr_A13); System.Xml.XmlAttribute attr_A14 = xDoc.CreateAttribute("A14"); attr_A14.Value = "0"; element_O6.Attributes.Append(attr_A14); System.Xml.XmlAttribute attr_A81 = xDoc.CreateAttribute("A81"); attr_A81.Value = "1100"; element_O6.Attributes.Append(attr_A81); System.Xml.XmlAttribute attr_A82 = xDoc.CreateAttribute("A82"); attr_A82.Value = kennzeichen.Bezeichnung; element_O6.Attributes.Append(attr_A82); System.Xml.XmlAttribute attr_A85 = xDoc.CreateAttribute("A85"); attr_A85.Value = "10002"; element_O6.Attributes.Append(attr_A85); System.Xml.XmlElement element_P11 = xDoc.CreateElement("P11"); System.Xml.XmlAttribute attr_P10002 = xDoc.CreateAttribute("P1002"); attr_P10002.Value = kennzeichen.Beschreibung1.GetAsString(); element_P11.Attributes.Append(attr_P10002); System.Xml.XmlAttribute attr_P10007 = xDoc.CreateAttribute("P1007"); attr_P10007.Value = kennzeichen.Beschreibung2.GetAsString(); element_P11.Attributes.Append(attr_P10007); System.Xml.XmlAttribute attr_P10008 = xDoc.CreateAttribute("P1008"); attr_P10008.Value = kennzeichen.Beschreibung3.GetAsString(); element_P11.Attributes.Append(attr_P10008); System.Xml.XmlAttribute attr_P10009_1 = xDoc.CreateAttribute("P1009_1"); attr_P10009_1.Value = kennzeichen.BeschreibungZusatzfeld1.GetAsString(); element_P11.Attributes.Append(attr_P10009_1); System.Xml.XmlAttribute attr_P10009_2 = xDoc.CreateAttribute("P1009_2"); attr_P10009_2.Value = kennzeichen.BeschreibungZusatzfeld2.GetAsString(); element_P11.Attributes.Append(attr_P10009_2); System.Xml.XmlAttribute attr_P10009_3 = xDoc.CreateAttribute("P1009_3"); attr_P10009_3.Value = kennzeichen.BeschreibungZusatzfeld3.GetAsString(); element_P11.Attributes.Append(attr_P10009_3); System.Xml.XmlAttribute attr_P10009_4 = xDoc.CreateAttribute("P1009_4"); attr_P10009_4.Value = kennzeichen.BeschreibungZusatzfeld4.GetAsString(); element_P11.Attributes.Append(attr_P10009_4); System.Xml.XmlAttribute attr_P10009_5 = xDoc.CreateAttribute("P1009_5"); attr_P10009_5.Value = kennzeichen.BeschreibungZusatzfeld5.GetAsString(); element_P11.Attributes.Append(attr_P10009_5); System.Xml.XmlAttribute attr_P10009_6 = xDoc.CreateAttribute("P1009_6"); attr_P10009_6.Value = kennzeichen.BeschreibungZusatzfeld6.GetAsString(); element_P11.Attributes.Append(attr_P10009_6); System.Xml.XmlAttribute attr_P10009_7 = xDoc.CreateAttribute("P1009_7"); attr_P10009_7.Value = kennzeichen.BeschreibungZusatzfeld7.GetAsString(); element_P11.Attributes.Append(attr_P10009_7); System.Xml.XmlAttribute attr_P10009_8 = xDoc.CreateAttribute("P1009_8"); attr_P10009_8.Value = kennzeichen.BeschreibungZusatzfeld8.GetAsString(); element_P11.Attributes.Append(attr_P10009_8); System.Xml.XmlAttribute attr_P10009_9 = xDoc.CreateAttribute("P1009_9"); attr_P10009_9.Value = kennzeichen.BeschreibungZusatzfeld9.GetAsString(); element_P11.Attributes.Append(attr_P10009_9); System.Xml.XmlAttribute attr_P10009_10 = xDoc.CreateAttribute("P1009_10"); attr_P10009_10.Value = kennzeichen.BeschreibungZusatzfeld10.GetAsString(); element_P11.Attributes.Append(attr_P10009_10); element_O6.InnerXml = element_P11.OuterXml; return(element_O6); }
private void createFieldElement(ref System.Xml.XmlDocument pdoc, string pid, string pname, string pcore, string KolonneType) { System.Xml.XmlElement field = pdoc.CreateElement("", "Field", ns); field.SetAttribute("ID", pid); field.SetAttribute("Name", pname); field.SetAttribute("DisplayName", "$Resources:" + pcore + "," + pname + ";"); switch (KolonneType) { case "Text": field.SetAttribute("Type", "Text"); field.SetAttribute("MaxLength", "255"); break; case "Note": field.SetAttribute("Type", "Note"); field.SetAttribute("NumLines", "3"); field.SetAttribute("RichText", "TRUE"); break; case "Choice": field.SetAttribute("Type", "Choice"); break; case "Number": field.SetAttribute("Type", "Number"); field.SetAttribute("Decimals", "0"); break; case "Percentage": field.SetAttribute("Type", "Number"); field.SetAttribute("Percentage", "TRUE"); field.SetAttribute("Min", "0"); field.SetAttribute("Max", "1"); break; case "Currency": field.SetAttribute("Type", "Currency"); field.SetAttribute("Decimals", "2"); break; case "DateOnly": field.SetAttribute("Type", "DateTime"); field.SetAttribute("Format", "DateOnly"); break; case "DateTime": field.SetAttribute("Type", "DateTime"); break; case "Boolean": field.SetAttribute("Type", "Boolean"); break; default: break; } field.SetAttribute("Group", "$Resources:" + pcore + ",FieldsGroupName;"); System.Xml.XmlNode elements = pdoc.SelectSingleNode("//mha:Elements", nsMgr); string filter = "//mha:Field[@ID=\"" + pid + "\"]"; System.Xml.XmlNode old_field = elements.SelectSingleNode(filter, nsMgr); if (old_field == null) { elements.AppendChild(field); } else { elements.ReplaceChild(field, old_field); } }
protected void Page_Load(object sender, EventArgs e) { //处理ajax请求 string ajaxrun = ""; if (Request["ajaxrun"] == null || Request["ajaxrun"].ToString().Trim() == "") { return; } if (Request["jkname"] == null || Request["jkname"].ToString().Trim() == "") { return; } string jkname = Request["jkname"].ToString(); ajaxrun = Request["ajaxrun"].ToString(); if (ajaxrun == "save") {/* * string show = "<br>Form:<br>"; * for (int i = 0; i < Request.Form.Count; i++) * { * * show = show + Request.Form.Keys[i].ToString() + " = " + Request.Form[i].ToString() + "<br>"; * } * show = show + "<br>QueryString:<br>"; * for (int i = 0; i < Request.QueryString.Count; i++) * { * * show = show + Request.QueryString.Keys[i].ToString() + " = " + Request.QueryString[i].ToString() + "<br>"; * } * * Response.Write(show);//向客户端输出字符串 */ //调用执行方法获取数据 DataTable dt_request = RequestForUI.Get_parameter_forUI(Request); object[] re_dsi = IPC.Call(jkname, new object[] { dt_request }); if (re_dsi[0].ToString() == "ok") { //这个就是得到远程方法真正的返回值,不同类型的,自行进行强制转换即可。 DataSet dsreturn = (DataSet)re_dsi[1]; Response.Write(dsreturn.Tables["返回值单条"].Rows[0]["提示文本"].ToString()); } else { Response.Write(re_dsi[1].ToString());//向客户端输出错误字符串 } } if (ajaxrun == "del") { //调用执行方法获取数据 DataTable dt_request = RequestForUI.Get_parameter_forUI(Request); object[] re_dsi = IPC.Call(jkname, new object[] { dt_request }); if (re_dsi[0].ToString() == "ok") { ; } else { Response.Write(re_dsi[1].ToString());//向客户端输出错误字符串 } } if (ajaxrun == "info") { string idforedit = ""; if (Request["idforedit"] != null && Request["idforedit"].ToString().Trim() != "") { idforedit = Request["idforedit"].ToString(); } else { //没有id传进来返回空内容 Response.Write(""); return; } //调用执行方法获取数据 DataTable dt_request = RequestForUI.Get_parameter_forUI(Request); object[] re_dsi = IPC.Call(jkname, new object[] { dt_request }); if (re_dsi[0].ToString() == "ok") { //这个就是得到远程方法真正的返回值,不同类型的,自行进行强制转换即可。 DataSet dsreturn = (DataSet)re_dsi[1]; //转换xml TextWriter tw = new StringWriter(); dsreturn.WriteXml(tw); string twstr = tw.ToString(); StringWriter writer = new StringWriter(); string xmlstr = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + twstr; Response.ContentType = "text/xml"; Response.Charset = "UTF-8"; System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); doc.LoadXml(xmlstr); doc.Save(Response.OutputStream); Response.End(); } else { Response.Write(""); return; } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { string sessionId = GetRequestParameters(Request)["SESSION"]; string mapName = GetRequestParameters(Request)["MAPNAME"]; string locale = GetRequestParameters(Request)["LOCALE"]; if (string.IsNullOrEmpty(sessionId)) { Response.Clear(); Response.End(); return; } if (string.IsNullOrEmpty(mapName)) { Response.Clear(); Response.End(); return; } MgResourceService resourceSrvc = GetMgResurceService(sessionId); MgFeatureService featureSrvc = GetMgFeatureService(sessionId); MgMap map = new MgMap(); map.Open(resourceSrvc, mapName); string layernames = GetRequestParameters(Request)["LAYERNAMES"]; string GEOMETRY = GetRequestParameters(Request)["GEOMETRY"]; string selVar = GetRequestParameters(Request)["SELECTIONVARIANT"]; string type = GetRequestParameters(Request)["tp"]; string inputSel = GetRequestParameters(Request)["SELECTION"]; bool hasInputGeom = false; if (!string.IsNullOrEmpty(GEOMETRY)) { hasInputGeom = true; } //selection ima prednost pred podano geometrijo ... MgWktReaderWriter wktrw = new MgWktReaderWriter(); if (!string.IsNullOrEmpty(inputSel)) { MgGeometry inputGeom = MultiGeometryFromSelection(featureSrvc, map, inputSel); GEOMETRY = wktrw.Write(inputGeom); } MgAgfReaderWriter agfRW = new MgAgfReaderWriter(); int nLayer = 0; // pobrišem in zgradim na novo samo tiste, ki imajo zadetke ... int nSloj = 0; string filter = ""; StringBuilder sbOut = new StringBuilder(); sbOut.Append("<table width=\"100%\" class=\"results\">"); sbOut.Append("<tr><td class='header'></td><td class='header'>" + "Layer" + "</td><td class='header' align=\"center\">" + "Select" + "</td><td class='header' align=\"center\">" + "Report" + "</td></tr>"); MgSelection selAll = new MgSelection(map); foreach (MgLayer layer in map.GetLayers()) { if (type != "2") { if (!layer.IsVisible()) { goto nextlay; } } if (layer.LegendLabel == "") { goto nextlay; } try { nLayer++; filter = String.Format("{0} {1} GeomFromText('{2}')", layer.GetFeatureGeometryName(), selVar, GEOMETRY); //preveriti še filter na Layerju. Ker ne gre drugače, je potrebno pogledati v XML MgResourceIdentifier layerDefResId = layer.GetLayerDefinition(); MgByteReader byteReader = resourceSrvc.GetResourceContent(layerDefResId); System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); String xmlLayerDef = byteReader.ToString(); doc.LoadXml(xmlLayerDef); KALI.MGE.Objects.KALILayerDefinition.LayerDefinition ld = KALI.MGE.Objects.KALILayerDefinition.LayerDefinition.Parse(xmlLayerDef); if (!string.IsNullOrEmpty(ld.VectorLayerDefinition.Filter)) { filter += " AND (" + ld.VectorLayerDefinition.Filter + ")"; } //query the features MgFeatureQueryOptions opts = new MgFeatureQueryOptions(); opts.SetFilter(filter); String featureClassName = layer.GetFeatureClassName(); MgResourceIdentifier srcId = new MgResourceIdentifier(layer.GetFeatureSourceId()); MgFeatureReader features = featureSrvc.SelectFeatures(srcId, featureClassName, opts); bool hasResult = features.ReadNext(); if (hasResult) { nSloj++; int n = 0; MgClassDefinition classDef = features.GetClassDefinition(); MgPropertyDefinitionCollection classDefProps = classDef.GetIdentityProperties(); ArrayList idPropNames = new ArrayList(classDefProps.GetCount()); for (int j = 0; j < classDefProps.GetCount(); j++) { MgPropertyDefinition idProp = classDefProps.GetItem(j); idPropNames.Add(idProp.GetName()); } MgSelection sel = new MgSelection(map); do { // Generate XML to selection this feature MgPropertyCollection idProps = new MgPropertyCollection(); foreach (string id in idPropNames) { int idPropType = features.GetPropertyType(id); switch (idPropType) { case MgPropertyType.Int32: idProps.Add(new MgInt32Property(id, features.GetInt32(id))); break; case MgPropertyType.String: idProps.Add(new MgStringProperty(id, features.GetString(id))); break; case MgPropertyType.Int64: idProps.Add(new MgInt64Property(id, features.GetInt64(id))); break; case MgPropertyType.Double: idProps.Add(new MgDoubleProperty(id, features.GetDouble(id))); break; case MgPropertyType.Single: idProps.Add(new MgSingleProperty(id, features.GetSingle(id))); break; case MgPropertyType.DateTime: idProps.Add(new MgDateTimeProperty(id, features.GetDateTime(id))); break; default: //throw new SearchError(String.Format(MgLocalizer.GetString("SEARCHTYYPENOTSUP", locale), new Object[] { idPropType.ToString() }), searchError); break; } } sel.AddFeatureIds(layer, featureClassName, idProps); selAll.AddFeatureIds(layer, featureClassName, idProps); n++; //if (n > 1000) break; } while (features.ReadNext()); features.Close(); features.Dispose(); string selText = EscapeForHtml(sel.ToXml()); string seljs = "<div class=\"allLay\" onclick=\"parent.SetSelectionXML('" + selText + "');\"><img width=\"16\" height=\"16\" style=\"border:0\" src=\"images/mActionZoomToSelected.png\"/></div>"; string seljs3 = "<div class=\"allLay\" onclick=\"parent.MultiGridShow('" + selText + "');\"><img width=\"16\" height=\"16\" style=\"border:0\" src=\"images/mActionOpenTable.png\"/></div>"; string linfo = "<b>" + layer.LegendLabel + "</b><br />" + n.ToString() + " " + "Hits"; sbOut.Append("<tr><td class=\"results\">" + nSloj.ToString() + "</td><td class=\"results\">" + linfo + "</td><td align=\"center\" class=\"results\">" + seljs + "</td><td align=\"center\" class=\"results\">" + seljs3 + "</td></tr>"); } } catch (Exception) { continue; } nextlay: continue; } sbOut.Append("</table>"); string selAllText = EscapeForHtml(selAll.ToXml()); string seljsAll = "<div class=\"allLay\" onclick=\"parent.SetSelectionXML('" + selAllText + "');\"><img width=\"16\" height=\"16\" style=\"border:0\" src=\"images/mActionZoomToSelected.png\"/>" + "Select All" + "</div>"; string seljsAll3 = "<div class=\"allLay\" onclick=\"parent.MultiGridShow('" + selAllText + "');\"><img width=\"16\" height=\"16\" style=\"border:0\" src=\"images/mActionOpenTable.png\"/>" + "Report All" + "</div>"; sbOut.Append(string.Format("<br /><table width=\"100%\" class=\"results\"><tr><td class=\"results\">{0}</td><td class=\"results\">{1}</td></tr></table>", seljsAll, seljsAll3)); featureSrvc.Dispose(); resourceSrvc.Dispose(); if (nSloj > 0) { litPrebodi.Text = sbOut.ToString(); } else { litPrebodiTitle.Visible = false; litPrebodi.Text = "<b>" + "None layer lies below the selected item/area!" + "</b>"; } MgGeometry inGeom = wktrw.Read(GEOMETRY); double rw = map.ViewScale / Math.Sqrt(inGeom.Area); //koordinate if (hasInputGeom & rw > 400) { string output = ""; output = pointTransformAndWriteZ(GEOMETRY, map); litKoordinate.Text = output; litKoordinateTitle.Text = "Coordinates of selected points:"; } } }
internal xmlData(string xmlString) { xmlDocument = new System.Xml.XmlDocument(); xmlDocument.LoadXml(xmlString); }
protected void OnServerResponse(string raw, string apicall, IRequestCallback cb) { var uc = apicall.Split("/"[0]); var controller = uc[0]; var action = uc[1]; if (Debug.isDebugBuild) { Debug.Log(raw); } // Fire call complete event RoarManager.OnRoarNetworkEnd("no id"); // -- Parse the Roar response // Unexpected server response if (raw == null || raw.Length == 0 || raw[0] != '<') { // Error: fire the error callback System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); System.Xml.XmlElement error = doc.CreateElement("error"); doc.AppendChild(error); error.AppendChild(doc.CreateTextNode(raw)); if (cb != null) { cb.OnRequest( new Roar.RequestResult( RoarExtensions.CreateXmlElement("error", raw), IWebAPI.INVALID_XML_ERROR, "Invalid server response" )); } return; } System.Xml.XmlElement root = null; try { root = RoarExtensions.CreateXmlElement(raw); if (root == null) { throw new System.Xml.XmlException("CreateXmlElement returned null"); } } catch (System.Xml.XmlException e) { if (cb != null) { cb.OnRequest( new Roar.RequestResult( RoarExtensions.CreateXmlElement("error", raw), IWebAPI.INVALID_XML_ERROR, e.ToString() )); } return; } System.Xml.XmlElement io = root.SelectSingleNode("/roar/io") as System.Xml.XmlElement; if (io != null) { if (cb != null) { cb.OnRequest( new Roar.RequestResult( root, IWebAPI.IO_ERROR, io.InnerText )); } return; } int callback_code; string callback_msg = ""; System.Xml.XmlElement actionElement = root.SelectSingleNode("/roar/" + controller + "/" + action) as System.Xml.XmlElement; if (actionElement == null) { if (cb != null) { cb.OnRequest( new Roar.RequestResult( RoarExtensions.CreateXmlElement("error", raw), IWebAPI.INVALID_XML_ERROR, "Incorrect XML response" )); } return; } // Pre-process <server> block if any and attach any processed data System.Xml.XmlElement serverElement = root.SelectSingleNode("/roar/server") as System.Xml.XmlElement; RoarManager.NotifyOfServerChanges(serverElement); // Status on Server returned an error. Action did not succeed. string status = actionElement.GetAttribute("status"); if (status == "error") { callback_code = IWebAPI.UNKNOWN_ERR; callback_msg = actionElement.SelectSingleNode("error").InnerText; string server_error = (actionElement.SelectSingleNode("error") as System.Xml.XmlElement).GetAttribute("type"); if (server_error == "0") { if (callback_msg == "Must be logged in") { callback_code = IWebAPI.UNAUTHORIZED; } if (callback_msg == "Invalid auth_token") { callback_code = IWebAPI.UNAUTHORIZED; } if (callback_msg == "Must specify auth_token") { callback_code = IWebAPI.BAD_INPUTS; } if (callback_msg == "Must specify name and hash") { callback_code = IWebAPI.BAD_INPUTS; } if (callback_msg == "Invalid name or password") { callback_code = IWebAPI.DISALLOWED; } if (callback_msg == "Player already exists") { callback_code = IWebAPI.DISALLOWED; } logger.DebugLog(string.Format("[roar] -- response error: {0} (api call = {1})", callback_msg, apicall)); } // Error: fire the callback // NOTE: The Unity version ASSUMES callback = errorCallback if (cb != null) { cb.OnRequest(new Roar.RequestResult(root, callback_code, callback_msg)); } } // No error - pre-process the result else { System.Xml.XmlElement auth_token = actionElement.SelectSingleNode(".//auth_token") as System.Xml.XmlElement; if (auth_token != null && !string.IsNullOrEmpty(auth_token.InnerText)) { RoarAuthToken = auth_token.InnerText; } callback_code = IWebAPI.OK; if (cb != null) { cb.OnRequest(new Roar.RequestResult(root, callback_code, callback_msg)); } } RoarManager.OnCallComplete(new RoarManager.CallInfo(root, callback_code, callback_msg, "no id")); }
private void GetFaultsTree() { Response.Charset = "utf-8"; Response.Expires = -1; string ids = Request.QueryString["id"] != null ? Request.QueryString["id"].ToString() : string.Empty; string output = Request.QueryString["out"] != null ? Request.QueryString["out"].ToString() : "xml"; if (ids == "undefined") { Response.End(); } int n = 0; if (ids == string.Empty) ///建立树的根节点。 { this.thesql = "select distinct t.fault_group_code as id,a.fault_group_name as name from rmes_rel_station_faultgroup t left join code_fault_group a on a.fault_group_code = t.fault_group_code where t.company_code='C2' order by a.fault_group_name"; } else { char[] sep1 = { '_' }; string[] arr = ids.Split(sep1); n = arr.Length; switch (n) { case 1: //strSQL = "select "; this.thesql = "select t.fault_place_code as id,a.fault_place_name as name from rmes_rel_group_faultplace t left join code_fault_place a on a.fault_place_code = t.fault_place_code where t.company_code='C2' and t.fault_group_code='" + arr[0] + "' order by a.fault_place_name"; break; case 2: this.thesql = "select t.fault_part_code as id,a.fault_part_name as name from rmes_rel_faultplace_faultpart t left join code_fault_part a on a.fault_part_code = t.fault_part_code where t.company_code='C2' and t.pline_type_code in (select x.pline_type_code from code_fault_group x where x.fault_group_code='" + arr[0] + "') and t.fault_group_code='" + arr[0] + "' and t.fault_place_code='" + arr[1] + "' order by a.fault_part_name"; break; case 3: this.thesql = "select t.fault_code as id,a.fault_name as name from rmes_rel_faultpart_fault t left join code_fault a on a.fault_code = t.fault_code where t.company_code='C2' and t.pline_type_code in (select x.pline_type_code from code_fault_group x where x.fault_group_code='" + arr[0] + "') and t.fault_group_code='" + arr[0] + "' and t.fault_place_code='" + arr[1] + "' and t.fault_part_code = '" + arr[2] + "' order by a.fault_name"; break; default: this.thesql = ""; break; } } string retStr = ""; if (this.thesql != string.Empty) { dataConn dc = new dataConn(); dc.OpenConn(); dc.theComd.CommandType = CommandType.Text; dc.theComd.CommandText = thesql; OracleDataReader dr = dc.theComd.ExecuteReader(); string prefix = (ids == string.Empty) ? "" : (ids + "_"); if (output == "xml") { Response.ContentType = "text/xml"; System.Xml.XmlDocument docXML = new System.Xml.XmlDocument(); System.Xml.XmlElement allnode = docXML.CreateElement("root"); while (dr.Read()) { System.Xml.XmlElement emper = docXML.CreateElement("item"); emper = docXML.CreateElement("item"); emper.SetAttribute("id", prefix + dr["id"].ToString()); emper.InnerXml = "<content><name id=\"" + prefix + dr["id"].ToString() + "\">" + dr["name"].ToString() + "</name></content>"; if (n != 3) { emper.SetAttribute("state", "closed"); } allnode.AppendChild(emper); } if (allnode != null && allnode.ChildNodes.Count > 0) { docXML.AppendChild(allnode); retStr = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + docXML.InnerXml; docXML.RemoveAll(); docXML = null; } } if (output == "json") { Response.ContentType = "text/html"; string name = "", id = ""; retStr = ""; while (dr.Read()) { id = dr["id"].ToString(); name = dr["name"].ToString(); retStr += "{ \"attr\":{\"id\":\"" + prefix + id + "\"},\"data\":{\"title\":\"" + name + "\"} },\r\n"; } //if (retStr.EndsWith(",")) retStr = retStr.Substring(0, retStr.Length - 1); retStr = "[ \r\n" + retStr + " ]"; } dc.theConn.Close(); } Response.Write(retStr); Response.End(); }
public override void Serialize(AnnSerializeOptions options, System.Xml.XmlNode parentNode, System.Xml.XmlDocument document) { base.Serialize(options, parentNode, document); XmlNode element = document.CreateElement("AnglePrecision"); element.InnerText = AnglePrecision.ToString(); parentNode.AppendChild(element); }
/// <summary> /// Search the XMP metadata /// </summary> /// <param name="doc">A open PdfDocument</param> private void ReadXMPMetadata(PdfDocument doc) { if (doc.Internals.Catalog.Elements.ContainsKey("/Metadata")) { PdfItem pi = doc.Internals.Catalog.Elements["/Metadata"]; //doc.Internals.Catalog.Elements.Remove("/Metadata"); if (pi is PdfSharp.Pdf.Advanced.PdfReference) { int intXMPObjectNumber = (pi as PdfSharp.Pdf.Advanced.PdfReference).ObjectNumber; PdfDictionary pDic = (PdfDictionary)doc.Internals.GetObject(new PdfObjectID(intXMPObjectNumber)); string xmp = pDic.Stream.ToString(); if (xmp != string.Empty) { System.Xml.XmlDocument xDoc = new System.Xml.XmlDocument(); xDoc.XmlResolver = null; xDoc.LoadXml(xmp); #region Metadatos como atributos XmlNodeList xnl = xDoc.GetElementsByTagName("rdf:Description"); foreach (XmlNode xn in xnl) { XmlAttribute xa = xn.Attributes["pdf:Creator"]; if (xa != null && !string.IsNullOrEmpty(xa.Value)) { string strValue = Analysis.ApplicationAnalysis.GetApplicationsFromString(xa.Value); if (strValue.Trim() != string.Empty) { if (!FoundMetaData.Applications.Items.Any(A => A.Name == strValue.Trim())) { FoundMetaData.Applications.Items.Add(new ApplicationsItem(strValue.Trim())); } } //No se ha localizado ninguna aplicación conocida, aun así mostrar la aplicación encontrada else { if (xa.Value.Trim() != string.Empty && !FoundMetaData.Applications.Items.Any(A => A.Name == xa.Value.Trim())) { FoundMetaData.Applications.Items.Add(new ApplicationsItem(xa.Value.Trim())); } } } xa = xn.Attributes["pdf:CreationDate"]; if (xa != null && !string.IsNullOrEmpty(xa.Value)) { string strValue = xa.Value; DateTime d; if (DateTime.TryParse(strValue.Replace('T', ' ').Replace('Z', ' '), out d)) { //Si existe una fecha de creación anterior, sobreescribir if (!FoundDates.CreationDateSpecified || FoundDates.CreationDate > d) { FoundDates.CreationDateSpecified = true; FoundDates.CreationDate = d; } } } xa = xn.Attributes["pdf:Title"]; if (xa != null && !string.IsNullOrEmpty(xa.Value)) { string strValue = xa.Value; if (string.IsNullOrEmpty(FoundMetaData.Title) || FoundMetaData.Title.Length < strValue.Length) { FoundMetaData.Title = strValue; } } xa = xn.Attributes["pdf:Author"]; if (xa != null && !string.IsNullOrEmpty(xa.Value)) { FoundUsers.AddUniqueItem(xa.Value, true); } xa = xn.Attributes["pdf:Producer"]; if (xa != null && !string.IsNullOrEmpty(xa.Value)) { string strValue = Analysis.ApplicationAnalysis.GetApplicationsFromString(xa.Value); if (strValue.Trim() != string.Empty) { if (!FoundMetaData.Applications.Items.Any(A => A.Name == strValue.Trim())) { FoundMetaData.Applications.Items.Add(new ApplicationsItem(strValue.Trim())); } } //No se ha localizado ninguna aplicación conocida, aun así mostrar la aplicación encontrada else { if (xa.Value.Trim() != string.Empty && !FoundMetaData.Applications.Items.Any(A => A.Name == xa.Value.Trim())) { FoundMetaData.Applications.Items.Add(new ApplicationsItem(xa.Value.Trim())); } } } xa = xn.Attributes["pdf:ModDate"]; if (xa != null && !string.IsNullOrEmpty(xa.Value)) { string strValue = xa.Value; DateTime d; if (DateTime.TryParse(strValue.Replace('T', ' ').Replace('Z', ' '), out d)) { FoundDates.ModificationDateSpecified = true; FoundDates.ModificationDate = d; } } xa = xn.Attributes["xap:CreateDate"]; if (xa != null && !string.IsNullOrEmpty(xa.Value)) { string strValue = xa.Value; DateTime d; if (DateTime.TryParse(strValue.Replace('T', ' ').Replace('Z', ' '), out d)) { //Si existe una fecha de creación anterior, sobreescribir if (!FoundDates.CreationDateSpecified || FoundDates.CreationDate > d) { //Si existe una fecha de modificación posterior, sobreescribir if (!FoundDates.ModificationDateSpecified || FoundDates.ModificationDate < d) { FoundDates.CreationDateSpecified = true; FoundDates.CreationDate = d; } } } } xa = xn.Attributes["xap:Title"]; if (xa != null && !string.IsNullOrEmpty(xa.Value)) { string strValue = xa.Value; //Si ya existe un título y es mas pequeño, sobreescribirle. if ((string.IsNullOrEmpty(FoundMetaData.Title) || FoundMetaData.Title.Length < strValue.Length)) { FoundMetaData.Title = strValue; } } xa = xn.Attributes["xap:Author"]; if (xa != null && !string.IsNullOrEmpty(xa.Value)) { FoundUsers.AddUniqueItem(xa.Value, true); } xa = xn.Attributes["xap:ModifyDate"]; if (xa != null && !string.IsNullOrEmpty(xa.Value)) { string strValue = xa.Value; DateTime d; if (DateTime.TryParse(strValue.Replace('T', ' ').Replace('Z', ' '), out d)) { //Si existe una fecha de modificación posterior, sobreescribir if (!FoundDates.ModificationDateSpecified || FoundDates.ModificationDate < d) { FoundDates.ModificationDateSpecified = true; FoundDates.ModificationDate = d; } } } xa = xn.Attributes["xap:CreatorTool"]; if (xa != null && !string.IsNullOrEmpty(xa.Value)) { string strValue = Analysis.ApplicationAnalysis.GetApplicationsFromString(xa.Value); if (strValue.Trim() != string.Empty) { if (!FoundMetaData.Applications.Items.Any(A => A.Name == strValue.Trim())) { FoundMetaData.Applications.Items.Add(new ApplicationsItem(strValue.Trim())); } } //No se ha localizado ninguna aplicación conocida, aun así mostrar la aplicación encontrada else { if (xa.Value.Trim() != string.Empty && !FoundMetaData.Applications.Items.Any(A => A.Name == xa.Value.Trim())) { FoundMetaData.Applications.Items.Add(new ApplicationsItem(xa.Value.Trim())); } } } //xap:MetadataDate, fecha en la que se añadieron los metadatos xa = xn.Attributes["dc:title"]; if (xa != null && !string.IsNullOrEmpty(xa.Value)) { string strValue = xa.Value; //Si ya existe un título y es mas pequeño, sobreescribirle. if (string.IsNullOrEmpty(FoundMetaData.Title) || FoundMetaData.Title.Length < strValue.Length) { FoundMetaData.Title = strValue; } } xa = xn.Attributes["dc:creator"]; if (xa != null && !string.IsNullOrEmpty(xa.Value)) { string strValue = xa.Value; if (!string.IsNullOrEmpty(strValue)) { FoundUsers.AddUniqueItem(strValue, true); } } } #endregion #region Metadatos como nodos independientes xnl = xDoc.GetElementsByTagName("pdf:Creator"); if (xnl != null && xnl.Count != 0 && xnl[0].HasChildNodes && !string.IsNullOrEmpty(xnl[0].FirstChild.Value)) { string strValue = Analysis.ApplicationAnalysis.GetApplicationsFromString(xnl[0].FirstChild.Value); if (strValue.Trim() != string.Empty) { if (!FoundMetaData.Applications.Items.Any(A => A.Name == strValue.Trim())) { FoundMetaData.Applications.Items.Add(new ApplicationsItem(strValue.Trim())); } } //No se ha localizado ninguna aplicación conocida, aun así mostrar la aplicación encontrada else { if (xnl[0].FirstChild.Value.Trim() != string.Empty && !FoundMetaData.Applications.Items.Any(A => A.Name == xnl[0].FirstChild.Value.Trim())) { FoundMetaData.Applications.Items.Add(new ApplicationsItem(xnl[0].FirstChild.Value.Trim())); } } } xnl = xDoc.GetElementsByTagName("pdf:CreationDate"); if (xnl != null && xnl.Count != 0 && xnl[0].HasChildNodes && !string.IsNullOrEmpty(xnl[0].FirstChild.Value)) { string strValue = xnl[0].FirstChild.Value; DateTime d; if (DateTime.TryParse(strValue.Replace('T', ' ').Replace('Z', ' '), out d)) { //Si existe una fecha de creación anterior, sobreescribir if (!FoundDates.CreationDateSpecified || FoundDates.CreationDate > d) { FoundDates.CreationDateSpecified = true; FoundDates.CreationDate = d; } } } xnl = xDoc.GetElementsByTagName("pdf:Title"); if (xnl != null && xnl.Count != 0 && xnl[0].HasChildNodes && !string.IsNullOrEmpty(xnl[0].FirstChild.Value)) { string strValue = xnl[0].FirstChild.Value; if ((string.IsNullOrEmpty(FoundMetaData.Title) || FoundMetaData.Title.Length < strValue.Length)) { FoundMetaData.Title = strValue; } } xnl = xDoc.GetElementsByTagName("pdf:Author"); if (xnl != null && xnl.Count != 0 && xnl[0].HasChildNodes && !string.IsNullOrEmpty(xnl[0].FirstChild.Value)) { FoundUsers.AddUniqueItem(xnl[0].FirstChild.Value, true); } xnl = xDoc.GetElementsByTagName("pdf:Producer"); if (xnl != null && xnl.Count != 0 && xnl[0].HasChildNodes && !string.IsNullOrEmpty(xnl[0].FirstChild.Value)) { string strValue = Analysis.ApplicationAnalysis.GetApplicationsFromString(xnl[0].FirstChild.Value); if (strValue.Trim() != string.Empty) { if (!FoundMetaData.Applications.Items.Any(A => A.Name == strValue.Trim())) { FoundMetaData.Applications.Items.Add(new ApplicationsItem(strValue.Trim())); } } //No se ha localizado ninguna aplicación conocida, aun así mostrar la aplicación encontrada else { if (xnl[0].FirstChild.Value.Trim() != string.Empty && !FoundMetaData.Applications.Items.Any(A => A.Name == xnl[0].FirstChild.Value.Trim())) { FoundMetaData.Applications.Items.Add(new ApplicationsItem(xnl[0].FirstChild.Value.Trim())); } } } xnl = xDoc.GetElementsByTagName("pdf:ModDate"); if (xnl != null && xnl.Count != 0 && xnl[0].HasChildNodes && !string.IsNullOrEmpty(xnl[0].FirstChild.Value)) { string strValue = xnl[0].FirstChild.Value; DateTime d; if (DateTime.TryParse(strValue.Replace('T', ' ').Replace('Z', ' '), out d)) { FoundDates.ModificationDateSpecified = true; FoundDates.ModificationDate = d; } } xnl = xDoc.GetElementsByTagName("xap:CreateDate"); if (xnl != null && xnl.Count != 0 && xnl[0].HasChildNodes && !string.IsNullOrEmpty(xnl[0].FirstChild.Value)) { string strValue = xnl[0].FirstChild.Value; DateTime d; if (DateTime.TryParse(strValue.Replace('T', ' ').Replace('Z', ' '), out d)) { //Si existe una fecha de creación anterior, sobreescribir if (!FoundDates.CreationDateSpecified || FoundDates.CreationDate > d) { //Si existe una fecha de modificación posterior, sobreescribir if (!FoundDates.ModificationDateSpecified || FoundDates.ModificationDate < d) { FoundDates.CreationDateSpecified = true; FoundDates.CreationDate = d; } } } } xnl = xDoc.GetElementsByTagName("xap:Title"); if (xnl != null && xnl.Count != 0 && xnl[0].HasChildNodes) { XmlNode xn = xnl[0].FirstChild; //Busca el primer subnodo con valor while (xn.Value == null && xn.HasChildNodes) { xn = xn.FirstChild; } if (!string.IsNullOrEmpty(xn.Value)) { string strValue = xn.Value; //Si ya existe un título y es mas pequeño, sobreescribirle. if ((string.IsNullOrEmpty(FoundMetaData.Title) || FoundMetaData.Title.Length < strValue.Length)) { FoundMetaData.Title = strValue; } } } xnl = xDoc.GetElementsByTagName("xap:Author"); if (xnl != null && xnl.Count != 0 && xnl[0].HasChildNodes && !string.IsNullOrEmpty(xnl[0].FirstChild.Value)) { FoundUsers.AddUniqueItem(xnl[0].FirstChild.Value, true); } xnl = xDoc.GetElementsByTagName("xap:ModifyDate"); if (xnl != null && xnl.Count != 0 && xnl[0].HasChildNodes && !string.IsNullOrEmpty(xnl[0].FirstChild.Value)) { string strValue = xnl[0].FirstChild.Value; DateTime d; if (DateTime.TryParse(strValue.Replace('T', ' ').Replace('Z', ' '), out d)) { //Si existe una fecha de modificación posterior, sobreescribir if (!FoundDates.ModificationDateSpecified || FoundDates.ModificationDate < d) { FoundDates.ModificationDateSpecified = true; FoundDates.ModificationDate = d; } } } xnl = xDoc.GetElementsByTagName("xap:CreatorTool"); if (xnl != null && xnl.Count != 0 && xnl[0].HasChildNodes && !string.IsNullOrEmpty(xnl[0].FirstChild.Value)) { string strValue = Analysis.ApplicationAnalysis.GetApplicationsFromString(xnl[0].FirstChild.Value); if (strValue.Trim() != string.Empty) { if (!FoundMetaData.Applications.Items.Any(A => A.Name == strValue.Trim())) { FoundMetaData.Applications.Items.Add(new ApplicationsItem(strValue.Trim())); } } //No se ha localizado ninguna aplicación conocida, aun así mostrar la aplicación encontrada else { if (xnl[0].FirstChild.Value.Trim() != string.Empty && !FoundMetaData.Applications.Items.Any(A => A.Name == xnl[0].FirstChild.Value.Trim())) { FoundMetaData.Applications.Items.Add(new ApplicationsItem(xnl[0].FirstChild.Value.Trim())); } } } //xap:MetadataDate, fecha en la que se añadieron los metadatos xnl = xDoc.GetElementsByTagName("dc:title"); if (xnl != null && xnl.Count != 0 && xnl[0].HasChildNodes) { XmlNode xn = xnl[0].FirstChild; //Busca el primer subnodo con valor while (xn.Value == null && xn.HasChildNodes) { xn = xn.FirstChild; } if (!string.IsNullOrEmpty(xn.Value)) { string strValue = xn.Value; //Si ya existe un título y es mas pequeño, sobreescribirle. if ((string.IsNullOrEmpty(FoundMetaData.Title) || FoundMetaData.Title.Length < strValue.Length)) { FoundMetaData.Title = strValue; } } } //if (xnl != null && xnl.Count != 0 && xnl[0].HasChildNodes && !string.IsNullOrEmpty(xnl[0].FirstChild.Value)) //FoundUsers.AddUniqueItem(xnl[0].FirstChild.Value, true); #endregion } } } }
/// <summary> /// DataTable转换JSON DataTime类型列转换为String类型 /// </summary> /// <param name="Table"></param> /// <param name="TableName"></param> /// <param name="Sort"></param> /// <returns></returns> public static string ToJson(this DataTable Table, string Sort) { string Result = string.Empty; try { if (Table.Rows.Count <= 0) { throw new Exception(); } string XML = string.Empty; bool IsHasDatac = false; #region 检查是否存在日期格式 foreach (DataColumn Dc in Table.Columns) { if (Dc.DataType == typeof(System.DateTime)) { IsHasDatac = true; break; } } #endregion #region 生成XML if (IsHasDatac) { DataTable T = Table.Clone(); foreach (DataColumn Dc in T.Columns) { if (Dc.DataType == typeof(System.DateTime)) { Dc.DataType = typeof(String); } } T.Load(Table.CreateDataReader()); System.IO.StringWriter W = new System.IO.StringWriter(); if (!string.IsNullOrEmpty(Sort) && Table.Rows.Count > 0) { T.DefaultView.Sort = Sort; } T.TableName = T.TableName.IsNullOrEmpty() ? "Temp" : T.TableName; T.DefaultView.ToTable().WriteXml(W); XML = W.ToString(); W.Close(); W.Dispose(); T.Clear(); T.Dispose(); } else { System.IO.StringWriter W = new System.IO.StringWriter(); if (!string.IsNullOrEmpty(Sort) && Table.Rows.Count > 0) { Table.DefaultView.Sort = Sort; } Table.TableName = Table.TableName.IsNullOrEmpty() ? "Temp" : Table.TableName; Table.DefaultView.ToTable().WriteXml(W); XML = W.ToString(); W.Close(); W.Dispose(); } #endregion #region 替换 格式 XML = XML.Replace("<DocumentElement>", "<data>") .Replace("</DocumentElement>", "</data>") .Replace("<DocumentElement />", ""); XML = XML.Replace("<Table>", String.Concat("<rows>")).Replace("</Table>", String.Concat("</rows>")); System.Xml.XmlDocument XMLD = new System.Xml.XmlDocument(); XMLD.LoadXml(XML); Result = XmlToJSONParser.XmlToJSON(XMLD); Result = Result.Replace(@"\", @"\\"); #endregion } catch { } return(Result); }
internal void ProcessRequest(HttpContext context) { _isRefreshRequest = false; var response = context.Response; if (context.Request.HttpMethod.ToLower() == "post") { var request = context.Request; var clientId = request.Form["req"]; if (clientId == "0") { _isRefreshRequest = true; } if (clientId != "0" && _requestId.ToString() != clientId) { response.Write("window.location.reload();\n"); return; } foreach (var k in request.Form.AllKeys) { switch (k) { case "req": continue; case "ev": var evData = request.Form[k]; var evXML = new System.Xml.XmlDocument(); try { evXML.LoadXml(evData); } catch { // invalid input data? Get out! break; } if (evXML.ChildNodes.Count > 0) { var eventsToInvoke = new List <Pair <Core.Object, string> >(); foreach (XmlElement node in evXML.ChildNodes[0].ChildNodes) { var sid = node.GetAttribute("_id"); var sev = node.GetAttribute("_n"); if (sid != null && sev != null) { long id; if (long.TryParse(sid, out id)) { if (_registeredControls.ContainsKey(id)) { var control = (_registeredControls[id].Target as Core.Object); if (control != null) { eventsToInvoke.Add(new Pair <Core.Object, string>(control, sev)); foreach (XmlAttribute item in node.Attributes) { if (item.LocalName != "_id" && item.LocalName != "_n") { control.SetPropertyValue(item.LocalName, decodeXMLAttribute(item.Value)); } } } } } } } foreach (var item in eventsToInvoke) { item.LeftPair.InvokeEvent(item.RightPair); } } break; } } } else { _isRefreshRequest = true; } _app.ProcessRequest(); response.Write("var App = qx.core.Init.getApplication();\n"); response.Write("var ctr = App.getControls();\n"); response.Write("var root = App.getRoot();\n"); _createdControls = new List <qxDotNet.Core.Object>(); CreateRecursive(_app, context.Response); _createdControls = null; _renderedControls = new List <qxDotNet.Core.Object>(); RenderRecursive(_app, context.Response); _renderedControls = null; if (!_isRefreshRequest) { _requestId++; } response.Write("App.requestCounter = \"" + _requestId.ToString() + "\";\n"); }
protected void btnPubMedSearch_OnClick(object sender, EventArgs e) { string value = ""; if (rdoPubMedKeyword.Checked) { string andString = ""; value = "("; if (txtSearchAuthor.Text.Length > 0) { string inputString = txtSearchAuthor.Text.Trim(); inputString = inputString.Replace("\r\n", "|"); // Added line to handle multiple authors for Firefox inputString = inputString.Replace("\n", "|"); string[] split = inputString.Split('|'); for (int i = 0; i < split.Length; i++) { value = value + andString + "(" + split[i] + "[Author])"; andString = " AND "; } } if (txtSearchAffiliation.Text.Length > 0) { value = value + andString + "(" + txtSearchAffiliation.Text + "[Affiliation])"; andString = " AND "; } if (txtSearchKeyword.Text.Length > 0) { value = value + andString + "((" + txtSearchKeyword.Text + "[Title/Abstract]) OR (" + txtSearchKeyword.Text + "[MeSH Terms]))"; } value = value + ")"; } else if (rdoPubMedQuery.Checked) { value = txtPubMedQuery.Text; } string orString = ""; string idValues = ""; //if (chkPubMedExclude.Checked) //{ // if (grdEditPublications.Rows.Count > 0) // { // value = value + " not ("; // foreach (GridViewRow gvr in grdEditPublications.Rows) // { // value = value + orString + (string)grdEditPublications.DataKeys[gvr.RowIndex]["PubID"]) + "[uid]"; // orString = " OR "; // } // value = value + ")"; // } //} if (chkPubMedExclude.Checked) { foreach (GridViewRow gvr in grdEditPublications.Rows) { HiddenField hdn = (HiddenField)gvr.FindControl("hdnPMID"); idValues = idValues + orString + hdn.Value; orString = ","; } } Hashtable MyParameters = new Hashtable(); string uri = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&usehistory=y&retmax=100&retmode=xml&term=" + value; System.Xml.XmlDocument myXml = new System.Xml.XmlDocument(); myXml.LoadXml(this.HttpPost(uri, "Catalyst", "text/plain")); XmlNodeList xnList; string queryKey = ""; string webEnv = ""; xnList = myXml.SelectNodes("/eSearchResult"); foreach (XmlNode xn in xnList) { // if (xn["QueryKey"] != null) queryKey = xn["QueryKey"].InnerText; //if(xn["WebEnv"] !=null) webEnv = xn["WebEnv"].InnerText; } //string queryKey = MyGetXmlNodeValue(myXml, "QueryKey", ""); //string webEnv = MyGetXmlNodeValue(myXml, "WebEnv", ""); uri = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?retmin=0&retmax=100&retmode=xml&db=Pubmed&query_key=" + queryKey + "&webenv=" + webEnv; myXml.LoadXml(this.HttpPost(uri, "Catalyst", "text/plain")); string pubMedAuthors = ""; string pubMedTitle = ""; string pubMedSO = ""; string pubMedID = ""; string seperator = ""; PubMedResults.Tables.Clear(); PubMedResults.Tables.Add("Results"); PubMedResults.Tables["Results"].Columns.Add(new System.Data.DataColumn("pmid")); PubMedResults.Tables["Results"].Columns.Add(new System.Data.DataColumn("citation")); PubMedResults.Tables["Results"].Columns.Add(new System.Data.DataColumn("checked")); XmlNodeList docSums = myXml.SelectNodes("eSummaryResult/DocSum"); foreach (XmlNode docSum in docSums) { pubMedAuthors = ""; pubMedTitle = ""; pubMedSO = ""; pubMedID = ""; seperator = ""; XmlNodeList authors = docSum.SelectNodes("Item[@Name='AuthorList']/Item[@Name='Author']"); foreach (XmlNode author in authors) { pubMedAuthors = pubMedAuthors + seperator + author.InnerText; seperator = ", "; } pubMedTitle = docSum.SelectSingleNode("Item[@Name='Title']").InnerText; pubMedSO = docSum.SelectSingleNode("Item[@Name='SO']").InnerText; pubMedID = docSum.SelectSingleNode("Id").InnerText; if (!idValues.Contains(pubMedID)) { DataRow myDataRow = PubMedResults.Tables["Results"].NewRow(); myDataRow["pmid"] = pubMedID; myDataRow["checked"] = "0"; myDataRow["citation"] = pubMedAuthors + "; " + pubMedTitle + "; " + pubMedSO; PubMedResults.Tables["Results"].Rows.Add(myDataRow); PubMedResults.AcceptChanges(); } } grdPubMedSearchResults.DataSource = PubMedResults; grdPubMedSearchResults.DataBind(); lblPubMedResultsHeader.Text = "PubMed Results (" + PubMedResults.Tables["Results"].Rows.Count.ToString() + ")"; if (PubMedResults.Tables[0].Rows.Count == 0) { lnkUpdatePubMed.Visible = false; pnlAddAll.Visible = false; } pnlAddPubMedResults.Visible = true; upnlEditSection.Update(); }
public void LoadEngineCnf(out string sErrorMsg) { // 絶対ファイルパス string sFpatha = this.GetEngineCnf(); System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); Exception error_excp; try { // ファイルの読込み doc.Load(sFpatha); } catch (System.ArgumentException ex) { // エラー goto error_filePath; } catch (System.Exception ex) { // エラー error_excp = ex; goto error_read; } // ルート要素 XmlElement root = doc.DocumentElement; // target-tagノード { XmlNodeList nl10 = root.GetElementsByTagName("target-tag"); for (int i = 0; i < nl10.Count; i++) { XmlNode nd10 = nl10.Item(i); if (XmlNodeType.Element == nd10.NodeType) { // // <target-tag> // XmlElement elm10 = (XmlElement)nd10; // tag XmlNodeList nl11 = elm10.GetElementsByTagName("tag"); for (int j = 0; j < nl11.Count; j++) { XmlNode nd11 = nl11.Item(j); if (XmlNodeType.Element == nd11.NodeType) { // // <tag> // XmlElement elm11 = (XmlElement)nd11; TagElmImpl tag = new TagElmImpl(); tag.SValue = elm11.GetAttribute("value"); tag.SDisplay = elm11.GetAttribute("display"); tag.SDescription = elm11.GetAttribute("description"); this.TargetTagList.Add(tag); } } // 最初の1個で終了。 break; } } } // status-tagノード { XmlNodeList nl10 = root.GetElementsByTagName("status-tag"); for (int i = 0; i < nl10.Count; i++) { XmlNode nd10 = nl10.Item(i); if (XmlNodeType.Element == nd10.NodeType) { // // <target-tag> // XmlElement elm10 = (XmlElement)nd10; // tag XmlNodeList nl11 = elm10.GetElementsByTagName("tag"); for (int j = 0; j < nl11.Count; j++) { XmlNode nd11 = nl11.Item(j); if (XmlNodeType.Element == nd11.NodeType) { // // <tag> // XmlElement elm11 = (XmlElement)nd11; TagElmImpl tag = new TagElmImpl(); tag.SValue = elm11.GetAttribute("value"); tag.SDisplay = elm11.GetAttribute("display"); tag.SDescription = elm11.GetAttribute("description"); this.StatusTagList.Add(tag); } } // 最初の1個で終了。 break; } } } sErrorMsg = ""; goto process_end; // // error_filePath: { StringBuilder t = new StringBuilder(); t.Append("エラー:エンジン設定ファイルパス=["); t.Append(sFpatha); t.Append("]"); sErrorMsg = t.ToString(); } goto process_end; // // error_read: { StringBuilder t = new StringBuilder(); t.Append("エラー:エンジン設定ファイルパス読取失敗=["); t.Append(error_excp.Message); t.Append("]"); sErrorMsg = t.ToString(); } goto process_end; // // // // process_end: return; }
public static XmlNode Serialize(System.Xml.XmlDocument doc, ChoroplethLayerProvider provider, string dataKey, string shapeKey, string value, string legacyClassCountIndex, SolidColorBrush highColor, SolidColorBrush lowColor, SolidColorBrush missingColor, string uniqueXmlString, DashboardHelper dashboardHelper, XmlAttribute type, double opacity) { Epi.ApplicationIdentity appId = new Epi.ApplicationIdentity(typeof(Configuration).Assembly); try { string classTitles = "<classTitles>" + Environment.NewLine; long classTitleCount = 0; string classTitleTagName = ""; foreach (KeyValuePair <string, string> entry in provider.ListLegendText.Dict) { classTitleTagName = entry.Key; classTitles += string.Format("<{1}>{0}</{1}>", entry.Value, classTitleTagName) + Environment.NewLine; classTitleCount++; } classTitles += "</classTitles>" + Environment.NewLine; string customColors = ""; if (provider.CustomColorsDictionary != null) { customColors = "<customColors>" + Environment.NewLine; foreach (KeyValuePair <string, Color> keyValuePair in provider.CustomColorsDictionary.Dict) { string customColor = "<" + keyValuePair.Key + ">"; string color = keyValuePair.Value.R + "," + keyValuePair.Value.G + "," + keyValuePair.Value.B; customColor += color + "</" + keyValuePair.Key + ">" + Environment.NewLine; customColors += customColor; } customColors += "</customColors>" + Environment.NewLine; } string useCustomColorsTag = "<useCustomColors>" + provider.UseCustomColors + "</useCustomColors>" + Environment.NewLine; string asQuintileTag = "<partitionUsingQuantiles>" + provider.UseQuantiles + "</partitionUsingQuantiles>" + Environment.NewLine; string classRanges = ""; string resolution = "<resolution>" + provider.ArcGIS_Map.Resolution.ToString() + "</resolution>" + Environment.NewLine; string centerPoint_X = "<centerPoint_X>" + provider.ArcGIS_Map.Extent.GetCenter().X.ToString() + "</centerPoint_X>" + Environment.NewLine; string centerPoint_Y = "<centerPoint_Y>" + provider.ArcGIS_Map.Extent.GetCenter().Y.ToString() + "</centerPoint_Y>" + Environment.NewLine; string spatialRef = "<spatialRef>" + provider.ArcGIS_Map.Extent.SpatialReference.WKID.ToString() + "</spatialRef>" + Environment.NewLine; //string spatialRef = "<spatialRef>" + provider.ArcGIS_Map.SpatialReference.WKID.ToString() + "</spatialRef>" + Environment.NewLine; string envMinX = "<envMinX>" + provider.ArcGIS_Map.Extent.XMin + "</envMinX>" + Environment.NewLine; string envMinY = "<envMinY>" + provider.ArcGIS_Map.Extent.YMin + "</envMinY>" + Environment.NewLine; string envMaxX = "<envMaxX>" + provider.ArcGIS_Map.Extent.XMax + "</envMaxX>" + Environment.NewLine; string envMaxY = "<envMaxY>" + provider.ArcGIS_Map.Extent.YMax + "</envMaxY>" + Environment.NewLine; if (provider.UseQuantiles == false) { if (provider.ClassRangesDictionary != null) { classRanges = "<classRanges>" + Environment.NewLine; foreach (KeyValuePair <string, string> keyValuePair in provider.ClassRangesDictionary.RangeDictionary) { string rangeName = "<" + keyValuePair.Key + ">"; string rangeValue = keyValuePair.Value; rangeName += rangeValue + "</" + keyValuePair.Key + ">" + Environment.NewLine; classRanges += rangeName; } classRanges += "</classRanges>" + Environment.NewLine; } } string xmlString = uniqueXmlString + "<highColor>" + highColor.Color.ToString() + "</highColor>" + Environment.NewLine + "<legTitle>" + provider.LegendText + "</legTitle>" + Environment.NewLine + "<showPolyLabels>" + provider.ShowPolyLabels + "</showPolyLabels>" + Environment.NewLine + classTitles + classRanges + useCustomColorsTag + resolution + centerPoint_X + centerPoint_Y + spatialRef + envMinX + envMinY + envMaxX + envMaxY + asQuintileTag + customColors + "<lowColor>" + lowColor.Color.ToString() + "</lowColor>" + Environment.NewLine + "<missingColor>" + missingColor.Color.ToString() + "</missingColor>" + Environment.NewLine + "<classes>" + legacyClassCountIndex + "</classes>" + Environment.NewLine + "<dataKey>" + dataKey + "</dataKey>" + Environment.NewLine + "<shapeKey>" + shapeKey + "</shapeKey>" + Environment.NewLine + "<value>" + value + "</value>" + Environment.NewLine + "<opacity>" + opacity + "</opacity>" + Environment.NewLine + "<versionTag>" + appId.Version.ToString() + "</versionTag>" + Environment.NewLine; doc.PreserveWhitespace = true; XmlElement element = doc.CreateElement("dataLayer"); element.InnerXml = xmlString; element.AppendChild(dashboardHelper.Serialize(doc)); element.Attributes.Append(type); return(element); } catch (Exception e) { throw new Exception(e.Message); } }
public override bool Update(System.Xml.XmlDocument document) { var proceduralElement = document["EffekseerProject"]["ProcedualModel"]; if (proceduralElement != null) { document["EffekseerProject"].RemoveChild(proceduralElement); var newNode = document.CreateElement("ProceduralModel"); var newNode2 = document.CreateElement("ProceduralModels"); newNode.AppendChild(newNode2); List <XmlNode> children = new List <XmlNode>(); for (int i = 0; i < proceduralElement.FirstChild.ChildNodes.Count; i++) { children.Add(proceduralElement.FirstChild.ChildNodes[i]); } foreach (var child in children) { Action <XmlNode, XmlNode, string> moveElement = (XmlNode dst, XmlNode src, string name) => { var node = src[name]; if (node != null) { dst.AppendChild(node); } }; Action <XmlNode, XmlNode, string, string> moveAndRenameElement = (XmlNode dst, XmlNode src, string newName, string name) => { var node = src[name]; if (node != null) { src.RemoveChild(node); var nn = document.CreateElement(newName); while (node.ChildNodes.Count > 0) { nn.AppendChild(node.FirstChild); } dst.AppendChild(nn); } }; var mesh = document.CreateElement("Mesh"); var ribbon = document.CreateElement("Ribbon"); var shape = document.CreateElement("Shape"); var shapeNoise = document.CreateElement("ShapeNoise"); var vertexColor = document.CreateElement("VertexColor"); moveElement(mesh, child, "AngleBeginEnd"); moveElement(mesh, child, "Divisions"); moveElement(ribbon, child, "CrossSection"); moveElement(ribbon, child, "Rotate"); moveElement(ribbon, child, "Vertices"); moveElement(ribbon, child, "RibbonScales"); moveElement(ribbon, child, "RibbonAngles"); moveElement(ribbon, child, "RibbonNoises"); moveElement(ribbon, child, "Count"); moveElement(shape, child, "PrimitiveType"); moveElement(shape, child, "Radius"); moveElement(shape, child, "Radius2"); moveElement(shape, child, "Depth"); moveElement(shape, child, "DepthMin"); moveElement(shape, child, "DepthMax"); moveElement(shape, child, "Point1"); moveElement(shape, child, "Point2"); moveElement(shape, child, "Point3"); moveElement(shape, child, "Point4"); moveElement(shape, child, "AxisType"); moveElement(shapeNoise, child, "TiltNoiseFrequency"); moveElement(shapeNoise, child, "TiltNoiseOffset"); moveElement(shapeNoise, child, "TiltNoisePower"); moveElement(shapeNoise, child, "WaveNoiseFrequency"); moveElement(shapeNoise, child, "WaveNoiseOffset"); moveElement(shapeNoise, child, "WaveNoisePower"); moveElement(shapeNoise, child, "CurlNoiseFrequency"); moveElement(shapeNoise, child, "CurlNoiseOffset"); moveElement(shapeNoise, child, "CurlNoisePower"); moveAndRenameElement(vertexColor, child, "ColorUpperLeft", "ColorLeft"); moveAndRenameElement(vertexColor, child, "ColorUpperCenter", "ColorCenter"); moveAndRenameElement(vertexColor, child, "ColorUpperRight", "ColorRight"); moveAndRenameElement(vertexColor, child, "ColorMiddleLeft", "ColorLeftMiddle"); moveAndRenameElement(vertexColor, child, "ColorMiddleCenter", "ColorCenterMiddle"); moveAndRenameElement(vertexColor, child, "ColorMiddleRight", "ColorRightMiddle"); moveElement(vertexColor, child, "ColorCenterArea"); child.AppendChild(mesh); child.AppendChild(ribbon); child.AppendChild(shape); child.AppendChild(shapeNoise); child.AppendChild(vertexColor); newNode2.AppendChild(child); } document["EffekseerProject"].AppendChild(newNode); } return(true); }
public static IEnumerable <ServerSideEvent> GetEvents() { string eventLogXmlFile = ""; string aspnet_rcFile = ""; string pwrshmsgFile = ""; if (Utils.IsRunningInMAWS()) { eventLogXmlFile = Environment.ExpandEnvironmentVariables(@"%HOME%\LogFiles\eventlog.xml"); } else { eventLogXmlFile = HttpContext.Current.Server.MapPath("~/App_Data/eventlog.xml"); } aspnet_rcFile = Environment.ExpandEnvironmentVariables(@"%SystemRoot%\Microsoft.NET\Framework64\v4.0.30319\aspnet_rc.dll"); pwrshmsgFile = Environment.ExpandEnvironmentVariables(@"%SystemRoot%\system32\WindowsPowerShell\v1.0\pwrshmsg.dll"); IntPtr g_hResourcesASPNET = IntPtr.Zero; IntPtr g_hResourcesPowerShell = IntPtr.Zero; // As per http://msdn.microsoft.com/en-us/library/windows/desktop/ms684179(v=vs.85).aspx // If LoadLibraryEx is called twice for the same file with LOAD_LIBRARY_AS_DATAFILE, LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE, // or LOAD_LIBRARY_AS_IMAGE_RESOURCE, two separate mappings are created for the file // I realize that if I don't cache the handle the MappedFile portion under !address -summary increases // Not really sure on the after effects of storing the handle pointer somewhere. if (HttpContext.Current.Cache["g_hResourcesASPNET"] != null) { g_hResourcesASPNET = (IntPtr)HttpContext.Current.Cache["g_hResourcesASPNET"]; } else { g_hResourcesASPNET = Utils.GetMessageResources(aspnet_rcFile); HttpContext.Current.Cache["g_hResourcesASPNET"] = g_hResourcesASPNET; } if (HttpContext.Current.Cache["g_hResourcesPowerShell"] != null) { g_hResourcesPowerShell = (IntPtr)HttpContext.Current.Cache["g_hResourcesPowerShell"]; } else { g_hResourcesPowerShell = Utils.GetMessageResources(pwrshmsgFile); HttpContext.Current.Cache["g_hResourcesPowerShell"] = g_hResourcesPowerShell; } g_hResourcesASPNET = Utils.GetMessageResources(aspnet_rcFile); g_hResourcesPowerShell = Utils.GetMessageResources(pwrshmsgFile); if (!File.Exists(eventLogXmlFile)) { yield break; } System.Xml.XmlDocument dom = new System.Xml.XmlDocument(); dom.Load(eventLogXmlFile); System.Xml.XmlNodeList xmlList = dom.SelectNodes("/Events/Event"); for (int i = (xmlList.Count - 1); i >= 0; i--) { XmlNode EventNode = xmlList[i]; var node = EventNode.SelectSingleNode("System"); var EventDataNode = EventNode.SelectSingleNode("EventData"); var evt = new ServerSideEvent(); string strProvider = node["Provider"].GetAttribute("Name"); evt.Source = strProvider; string dateTimeString = node["TimeCreated"].GetAttribute("SystemTime"); bool booValidDateFound = false; if (dateTimeString.Contains("T") && dateTimeString.Contains("Z")) { //So we have the full date and time here...Parse it using TryParse. DateTime resultDateTime; if (DateTime.TryParse(dateTimeString, out resultDateTime)) { evt.DateAndTime = resultDateTime.ToString(); booValidDateFound = true; } else { booValidDateFound = false; evt.DateAndTime = node["TimeCreated"].GetAttribute("SystemTime"); } } else { evt.DateAndTime = node["TimeCreated"].GetAttribute("SystemTime"); } evt.EventID = node["EventID"].InnerText; evt.TaskCategory = node["Task"].InnerText; evt.EventRecordID = node["EventRecordID"].InnerText; evt.Computer = node["Computer"].InnerText; List <string> arrayOfdata = new List <string>(); foreach (XmlNode datanode in EventDataNode.ChildNodes) { arrayOfdata.Add(datanode.InnerText); } string[] args = arrayOfdata.ToArray(); int MessageId = Convert.ToInt32(node["EventID"].InnerText); string strLevel = node["Level"].InnerText; if (strProvider.StartsWith("ASP.NET")) { string formatEventMessage = ""; long longHexEventId = Utils.GenerateHexEventIdFromDecimalEventId(MessageId, strLevel); formatEventMessage = Utils.UnsafeTryFormatMessage(g_hResourcesASPNET, Convert.ToUInt32(longHexEventId), args); if (!booValidDateFound) { DateTime parsedDateTime; if (ExtractDateTimeFromFormattedEvent(formatEventMessage, out parsedDateTime)) { evt.DateAndTime = parsedDateTime.ToString(); } else { evt.DateAndTime = node["TimeCreated"].GetAttribute("SystemTime"); } } if (formatEventMessage.StartsWith("FormatMessage Failed with error")) { formatEventMessage = "<b>" + formatEventMessage + "</b>\n DLL = " + aspnet_rcFile + " \n Showing Raw Event\n\n" + EventDataNode.InnerXml; } evt.Description = formatEventMessage; } else if (strProvider.StartsWith("PowerShell")) { string formatEventMessage = ""; long longHexEventId = Utils.GenerateHexEventIdFromDecimalEventId(MessageId, strLevel); formatEventMessage = Utils.UnsafeTryFormatMessage(g_hResourcesPowerShell, Convert.ToUInt32(longHexEventId), args); if (formatEventMessage.StartsWith("FormatMessage Failed with error")) { formatEventMessage = "<b>" + formatEventMessage + "</b>\n DLL = " + pwrshmsgFile + " \n Showing Raw Event\n\n" + EventDataNode.InnerXml; } evt.Description = formatEventMessage; } else { evt.Description = string.Join(Environment.NewLine, args); } evt.Level = node["Level"].InnerText; yield return(evt); } }
protected void Page_Load(object sender, EventArgs e) { Response.ContentType = "text/xml"; Response.Charset = "UTF-8"; if (Request["R_PageNumber"] == null || Request["R_PageNumber"].ToString().Trim() == "") { Response.Write(geterrmod("获取数据失败!")); return; } if (Request["R_PageSize"] == null || Request["R_PageSize"].ToString().Trim() == "") { Response.Write(geterrmod("获取数据失败!")); return; } if (Request["jkname"] == null || Request["jkname"].ToString().Trim() == "") { Response.Write(geterrmod("获取数据失败!")); return; } string jkname = Request["jkname"].ToString(); jkname = HttpUtility.UrlDecode(jkname, System.Text.Encoding.UTF8); string currentpage = Request["R_PageNumber"].ToString(); string PageSize = Request["R_PageSize"].ToString(); try { DataSet dsjieguo = new DataSet(); DataTable dt_request = RequestForUI.Get_parameter_forUI(Request); object[] re_ds = IPC.Call(jkname, new object[] { dt_request }); if (re_ds[0].ToString() == "ok") { //这个就是得到远程方法真正的返回值,不同类型的,自行进行强制转换即可。 dsjieguo = (DataSet)re_ds[1]; } else { Response.Write(geterrmod(re_ds[1].ToString())); return; } //转换xml System.IO.StringWriter writer = new System.IO.StringWriter(); if (!dsjieguo.Tables.Contains("主要数据")) { Response.Write(geterrmod("没有主要数据!")); return; } dsjieguo.Tables["主要数据"].WriteXml(writer); //为图表增加新的解析 string fujaitubiao_str = "<chartYHB>"; if (dsjieguo.Tables.Contains("饼图数据")) { System.IO.StringWriter writer_bing = new System.IO.StringWriter(); dsjieguo.Tables["饼图数据"].WriteXml(writer_bing); fujaitubiao_str = fujaitubiao_str + writer_bing; } for (int t = 0; t < dsjieguo.Tables.Count; t++) { if (dsjieguo.Tables[t].TableName.IndexOf("曲线图数据") >= 0) { System.IO.StringWriter writer_quxian = new System.IO.StringWriter(); dsjieguo.Tables[t].WriteXml(writer_quxian); fujaitubiao_str = fujaitubiao_str + writer_quxian; } } fujaitubiao_str = fujaitubiao_str + "</chartYHB>"; string xmlstr = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + "<invoices>" + fujaitubiao_str + "<request>true</request><currentpage>" + currentpage + "</currentpage><totalpages>" + dsjieguo.Tables["附加数据"].Rows[0]["分页数"].ToString() + "</totalpages><totalrecords>" + dsjieguo.Tables["附加数据"].Rows[0]["记录数"].ToString() + "</totalrecords>" + writer.ToString() + "</invoices>"; System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); doc.LoadXml(xmlstr); doc.Save(Response.OutputStream); } catch (Exception ex) { Response.Write(geterrmod("获取数据失败,执行错误!")); return; } }
public static void PopulaTreeView(System.Xml.XmlDocument xmlDoc, System.Windows.Forms.TreeView TreeXML) { PopulaTreeView(xmlDoc, TreeXML, false); }
public override bool Update(System.Xml.XmlDocument document) { List <System.Xml.XmlNode> nodes = new List <System.Xml.XmlNode>(); Action <System.Xml.XmlNode> collectNodes = null; collectNodes = (node) => { if (node.Name == "Node") { nodes.Add(node); } for (int i = 0; i < node.ChildNodes.Count; i++) { collectNodes(node.ChildNodes[i]); } }; collectNodes((XmlNode)document); foreach (var node in nodes) { var rcv1 = node["AdvancedRendererCommonValuesValues"]; if (rcv1 != null) { var enableAlphaTexture = rcv1["EnableAlphaTexture"]; if (enableAlphaTexture != null) { var alphaTextureParam = rcv1["AlphaTextureParam"] as XmlNode; alphaTextureParam?.PrependChild(document.CreateTextElement("Enabled", enableAlphaTexture.InnerText)); } var enableUVDistortion = rcv1["EnableUVDistortion"]; if (enableUVDistortion != null) { var uvDistortionParam = rcv1["UVDistortionParam"] as XmlNode; uvDistortionParam?.PrependChild(document.CreateTextElement("Enabled", enableUVDistortion.InnerText)); } var alphaCutoffParam = rcv1["AlphaCutoffParam"] as XmlNode; if (alphaCutoffParam != null) { var typeNode = alphaCutoffParam["Type"]; var fixedNode = alphaCutoffParam["Fixed"]; bool enableAlphaCutoff = (typeNode != null && int.Parse(typeNode.InnerText) != 0) || (fixedNode != null && float.Parse(fixedNode["Threshold"].InnerText) != 0.0f); alphaCutoffParam.PrependChild(document.CreateTextElement("Enabled", enableAlphaCutoff.ToString())); } var enableFalloff = rcv1["EnableFalloff"]; if (enableFalloff != null) { var falloffParam = rcv1["FalloffParam"] as XmlNode; falloffParam.PrependChild(document.CreateTextElement("Enabled", enableFalloff.InnerText)); } var softParticleDistance = rcv1["SoftParticleDistance"]; var softParticleDistanceNear = rcv1["SoftParticleDistanceNear"]; var softParticleDistanceNearOffset = rcv1["SoftParticleDistanceNearOffset"]; if (softParticleDistance != null || softParticleDistanceNear != null || softParticleDistanceNearOffset != null) { var softParticleParams = document.CreateElement("SoftParticleParams"); if (softParticleDistance != null) { softParticleParams.AppendChild(document.CreateTextElement("Enabled", (softParticleDistance.GetTextAsFloat() != 0.0f).ToString())); softParticleParams.AppendChild(document.CreateTextElement("Distance", softParticleDistance.InnerText)); } if (softParticleDistanceNear != null) { softParticleParams.AppendChild(document.CreateTextElement("DistanceNear", softParticleDistanceNear.InnerText)); } if (softParticleDistanceNearOffset != null) { softParticleParams.AppendChild(document.CreateTextElement("DistanceNearOffset", softParticleDistanceNearOffset.InnerText)); } rcv1.AppendChild(softParticleParams); } } var rcv2 = node["AdvancedRendererCommonValues2Values"]; if (rcv2 != null) { node.RemoveChild(rcv2); if (rcv1 == null) { rcv1 = document.CreateElement("AdvancedRendererCommonValuesValues"); node.AppendChild(rcv1); } var blendTextureParams = rcv2["BlendTextureParams"]; var enableBlendTexture = rcv2["EnableBlendTexture"]; if (enableBlendTexture != null && blendTextureParams != null) { rcv2.RemoveChild(blendTextureParams); rcv2.RemoveChild(enableBlendTexture); blendTextureParams.AppendChild(document.CreateTextElement("Enabled", enableBlendTexture.InnerText)); rcv1.AppendChild(blendTextureParams); } } } return(true); }
/// <summary> /// Update data /// </summary> /// <param name="document"></param> /// <returns></returns> public virtual bool Update(System.Xml.XmlDocument document) { return(true); }
protected void btnSubmit_Click(object sender, EventArgs e) { #region initialiseVariables int intProcessSerialId = 0; string strProcessId = Guid.NewGuid().ToString().ToUpper(); string strPageName = "ProcessLogin"; string strResultCode = string.Empty; string strResultDetail = string.Empty; string strErrorCode = string.Empty; string strErrorDetail = string.Empty; string strProcessRemark = string.Empty; bool isProcessAbort = false; bool isSystemError = false; long lngOperatorId = long.MinValue; string strMemberCode = string.Empty; string strPassword = string.Empty; string strSiteURL = string.Empty; string strLoginIp = string.Empty; string strDeviceId = string.Empty; string strVCode = string.Empty; string strSVCode = string.Empty; //string strProcessCode = string.Empty; //string strProcessMessage = string.Empty; string strCountryCode = string.Empty; string strLastLoginIP = string.Empty; string strPermission = string.Empty; bool runIovation = false; System.Xml.XmlDocument xdResponse = new System.Xml.XmlDocument(); #endregion #region populateVariables lngOperatorId = long.Parse(commonVariables.OperatorId); strMemberCode = txtUsername.Value; strPassword = txtPassword.Value; strVCode = txtCaptcha.Value; strSVCode = commonVariables.GetSessionVariable("vCode"); strLoginIp = string.IsNullOrEmpty(Request.Form.Get("txtIPAddress")) ? commonIp.UserIP : Request.Form.Get("txtIPAddress"); strDeviceId = HttpContext.Current.Request.UserAgent; strSiteURL = commonVariables.SiteUrl; #endregion #region parametersValidation if (string.IsNullOrEmpty(strMemberCode)) { strProcessCode = "-1"; strProcessMessage = commonCulture.ElementValues.getResourceXPathString("Login/MissingUsername", xeErrors); isProcessAbort = true; } else if (string.IsNullOrEmpty(strPassword)) { strProcessCode = "-1"; strProcessMessage = commonCulture.ElementValues.getResourceXPathString("Login/MissingPassword", xeErrors); isProcessAbort = true; } else if (string.IsNullOrEmpty(strVCode)) { strProcessCode = "-1"; strProcessMessage = commonCulture.ElementValues.getResourceString("MissingVCode", xeErrors); isProcessAbort = true; } else if (commonValidation.isInjection(strMemberCode)) { strProcessCode = "-1"; strProcessMessage = commonCulture.ElementValues.getResourceXPathString("Login/InvalidUsername", xeErrors); isProcessAbort = true; } else if (commonValidation.isInjection(strPassword)) { strProcessCode = "-1"; strProcessMessage = commonCulture.ElementValues.getResourceXPathString("Login/InvalidPassword", xeErrors); isProcessAbort = true; } else if (commonValidation.isInjection(strVCode)) { strProcessCode = "-1"; strProcessMessage = commonCulture.ElementValues.getResourceString("IncorrectVCode", xeErrors); isProcessAbort = true; } else if (string.Compare(commonEncryption.encrypting(strVCode), strSVCode, true) != 0) { strProcessCode = "-1"; strProcessMessage = commonCulture.ElementValues.getResourceString("IncorrectVCode", xeErrors); isProcessAbort = true; } else { strPassword = commonEncryption.Encrypt(strPassword); } strProcessRemark = string.Format("MemberCode: {0} | Password: {1} | VCode: {2} | SVCode: {3} | IP: {4} | Country: {5}", strMemberCode, strPassword, strVCode, strSVCode, strLoginIp, strCountryCode); intProcessSerialId += 1; commonAuditTrail.appendLog("system", strPageName, "ParameterValidation", "DataBaseManager.DLL", strResultCode, strResultDetail, strErrorCode, strErrorDetail, strProcessRemark, Convert.ToString(intProcessSerialId), strProcessId, isSystemError); #endregion #region initiateLogin if (!isProcessAbort) { try { using (wsMemberMS1.memberWSSoapClient svcInstance = new wsMemberMS1.memberWSSoapClient()) { System.Data.DataSet dsSignin = null; dsSignin = svcInstance.MemberSignin(lngOperatorId, strMemberCode, strPassword, strSiteURL, strLoginIp, strDeviceId); if (dsSignin.Tables[0].Rows.Count > 0) { strProcessCode = Convert.ToString(dsSignin.Tables[0].Rows[0]["RETURN_VALUE"]); switch (strProcessCode) { case "0": strProcessMessage = commonCulture.ElementValues.getResourceString("Exception", xeErrors); break; case "1": string strMemberSessionId = Convert.ToString(dsSignin.Tables[0].Rows[0]["memberSessionId"]); HttpContext.Current.Session.Add("MemberSessionId", Convert.ToString(dsSignin.Tables[0].Rows[0]["memberSessionId"])); HttpContext.Current.Session.Add("MemberId", Convert.ToString(dsSignin.Tables[0].Rows[0]["memberId"])); HttpContext.Current.Session.Add("MemberCode", Convert.ToString(dsSignin.Tables[0].Rows[0]["memberCode"])); HttpContext.Current.Session.Add("CountryCode", Convert.ToString(dsSignin.Tables[0].Rows[0]["countryCode"])); HttpContext.Current.Session.Add("CurrencyCode", Convert.ToString(dsSignin.Tables[0].Rows[0]["currency"])); HttpContext.Current.Session.Add("LanguageCode", Convert.ToString(dsSignin.Tables[0].Rows[0]["languageCode"])); HttpContext.Current.Session.Add("RiskId", Convert.ToString(dsSignin.Tables[0].Rows[0]["riskId"])); //HttpContext.Current.Session.Add("PaymentGroup", "A"); //Convert.ToString(dsSignin.Tables[0].Rows[0]["paymentGroup"])); HttpContext.Current.Session.Add("PartialSignup", Convert.ToString(dsSignin.Tables[0].Rows[0]["partialSignup"])); HttpContext.Current.Session.Add("ResetPassword", Convert.ToString(dsSignin.Tables[0].Rows[0]["resetPassword"])); commonCookie.CookieS = strMemberSessionId; commonCookie.CookieG = strMemberSessionId; HttpContext.Current.Session.Add("LoginStatus", "success"); strLastLoginIP = Convert.ToString(dsSignin.Tables[0].Rows[0]["lastLoginIP"]); if (HttpContext.Current.Request.Cookies[strMemberCode] == null) { runIovation = true; } else if (HttpContext.Current.Request.Cookies[strMemberCode] != null && string.Compare(strLastLoginIP, strLoginIp, true) != 0) { runIovation = true; } if (runIovation) { this.IovationSubmit(ref intProcessSerialId, strProcessId, strPageName, strMemberCode, strLoginIp, strPermission); } Response.Redirect("/Index"); break; case "21": strProcessMessage = commonCulture.ElementValues.getResourceXPathString("Login/InvalidUsername", xeErrors); break; case "22": strProcessMessage = commonCulture.ElementValues.getResourceXPathString("Login/InactiveAccount", xeErrors); break; case "23": strProcessMessage = commonCulture.ElementValues.getResourceXPathString("Login/InvalidPassword", xeErrors); break; } } } } catch (Exception ex) { strProcessCode = "0"; strProcessMessage = commonCulture.ElementValues.getResourceString("Exception", xeErrors); strProcessRemark = string.Format("{0} | Message: {1}", strProcessRemark, ex.Message); } strProcessRemark = string.Format("{0} | strProcessCode: {1}", strProcessRemark, strProcessCode); intProcessSerialId += 1; commonAuditTrail.appendLog("system", strPageName, "MemberSignin", "DataBaseManager.DLL", strResultCode, strResultDetail, strErrorCode, strErrorDetail, strProcessRemark, Convert.ToString(intProcessSerialId), strProcessId, isSystemError); } #endregion #region Response txtMessage.InnerText = strProcessMessage; #endregion }
public override bool Update(System.Xml.XmlDocument document) { List <System.Xml.XmlNode> nodes = new List <System.Xml.XmlNode>(); Action <System.Xml.XmlNode> collectNodes = null; collectNodes = (node) => { if (node.Name == "Node") { nodes.Add(node); } for (int i = 0; i < node.ChildNodes.Count; i++) { collectNodes(node.ChildNodes[i]); } }; collectNodes((XmlNode)document); foreach (var node in nodes) { var labs = node["LocationAbsValues"]; if (labs != null) { // old gravity and attractive force to new if (labs["Type"] != null && labs["Type"].GetTextAsInt() != 0) { var lff = document.CreateElement("LocalForceField4"); var type = labs["Type"].GetTextAsInt(); if (type == 1) { lff.AppendChild(document.CreateTextElement("Type", (int)LocalForceFieldType.Gravity)); } else if (type == 2) { lff.AppendChild(document.CreateTextElement("Type", (int)LocalForceFieldType.AttractiveForce)); } if (labs["Gravity"] != null) { lff.AppendChild(labs["Gravity"]); } if (labs["AttractiveForce"] != null) { lff.AppendChild(labs["AttractiveForce"]); if (lff["AttractiveForce"]["Force"] != null) { var force = lff["AttractiveForce"]["Force"].GetTextAsFloat(); lff.AppendChild(document.CreateTextElement("Power", force.ToString())); } } labs.AppendChild(lff); } Action <XmlElement> convert = (elm) => { if (elm == null) { return; } var typeInt = elm["Type"]?.GetTextAsInt(); var type = typeInt.HasValue ? (Data.LocalForceFieldType)(typeInt.Value) : Data.LocalForceFieldType.None; if (type == LocalForceFieldType.Turbulence) { if (elm["Turbulence"] != null && elm["Turbulence"]["Strength"] != null) { var strength = elm["Turbulence"]["Strength"].GetTextAsFloat(); elm.AppendChild(document.CreateTextElement("Power", strength.ToString())); } } float defaultPower = 1.0f; if (type == LocalForceFieldType.Turbulence) { defaultPower = 0.1f; } if (elm["Power"] != null) { defaultPower = elm["Power"].GetTextAsFloat(); } if (type == LocalForceFieldType.Turbulence) { defaultPower *= 10.0f; } if (type == LocalForceFieldType.Vortex) { defaultPower /= 5.0f; } if (elm["Power"] != null) { elm.RemoveChild(elm["Power"]); } elm.AppendChild(document.CreateTextElement("Power", defaultPower.ToString())); if (type == LocalForceFieldType.Vortex) { if (elm["Vortex"] == null) { elm.AppendChild(document.CreateElement("Vortex")); } elm["Vortex"].AppendChild(document.CreateTextElement("VortexType", ((int)ForceFieldVortexType.ConstantSpeed).ToString())); } if (type == LocalForceFieldType.Turbulence) { if (elm["Turbulence"] == null) { elm.AppendChild(document.CreateElement("Turbulence")); } elm["Turbulence"].AppendChild(document.CreateTextElement("TurbulenceType", ((int)ForceFieldTurbulenceType.Complicated).ToString())); } }; convert(labs["LocalForceField1"]); convert(labs["LocalForceField2"]); convert(labs["LocalForceField3"]); } } return(true); }
private void BatchPushNotice(List <string> targetIDList) { //必須要使用greening帳號登入才能用 System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); XmlElement root = doc.CreateElement("Request"); //標題 var eleTitle = doc.CreateElement("Title"); eleTitle.InnerText = msgTitle; root.AppendChild(eleTitle); //發送人員 var eleDisplaySender = doc.CreateElement("DisplaySender"); eleDisplaySender.InnerText = displaySender; root.AppendChild(eleDisplaySender); string webContentText = ""; //訊息內容 //var eleMessage = doc.CreateElement("Message"); //eleMessage.InnerText = tbMessageContent.Text; //root.AppendChild(eleMessage); //訊息內容 var eleMessage = doc.CreateElement("Message"); eleMessage.InnerText = msgText; root.AppendChild(eleMessage); //選取學生 if (_Type == Type.Student) { { //StudentVisible var ele = doc.CreateElement("StudentVisible"); //ele.InnerText = "true"; // 學生_依使用者選項發送 ele.InnerText = checkBoxX1.Checked ? "true" : "false"; root.AppendChild(ele); } { //ParentVisible var ele = doc.CreateElement("ParentVisible"); //ele.InnerText = "true"; // 家長_依使用者選項發送 ele.InnerText = checkBoxX2.Checked ? "true" : "false"; root.AppendChild(ele); } foreach (string each in targetIDList) { //發送對象 var eleTargetStudent = doc.CreateElement("TargetStudent"); eleTargetStudent.InnerText = each; root.AppendChild(eleTargetStudent); } } //選取教師 if (_Type == Type.Teacher) { foreach (string each in targetIDList) { //發送對象 var eleTarget = doc.CreateElement("TargetTeacher"); eleTarget.InnerText = each; root.AppendChild(eleTarget); } } //送出 try { FISCA.DSAClient.XmlHelper xmlHelper = new FISCA.DSAClient.XmlHelper(root); var conn = new FISCA.DSAClient.Connection(); conn.Connect(FISCA.Authentication.DSAServices.AccessPoint, "1campus.notice.admin.v17", FISCA.Authentication.DSAServices.PassportToken); var resp = conn.SendRequest("PostNotice", xmlHelper); StringBuilder sb_log = new StringBuilder(); string Byto = ""; List <string> byAction = new List <string>(); if (_Type == Type.Student) { if (checkBoxX1.Checked) { byAction.Add("學生"); } if (checkBoxX2.Checked) { byAction.Add("家長"); } } else if (_Type == Type.Teacher) { byAction.Add("老師"); } sb_log.AppendLine(string.Format("發送對象「{0}」", string.Join(",", byAction))); sb_log.AppendLine(string.Format("發送標題「{0}」", msgTitle)); sb_log.AppendLine(string.Format("發送單位「{0}」", displaySender)); sb_log.AppendLine(string.Format("發送內容「{0}」", msgText)); if (IsLimit) { sb_log.AppendLine(string.Format("對象清單「{0}」", string.Join(",", userLimitList) + "\n等..." + userNameList.Count + "人")); } else { sb_log.AppendLine(string.Format("對象清單「{0}」", string.Join(",", userLimitList))); } FISCA.LogAgent.ApplicationLog.Log("智慧簡訊", "發送", sb_log.ToString()); } catch { Console.WriteLine("對象系統編號:" + string.Join(",", targetIDList) + "。發送失敗"); //FISCA.Presentation.Controls.MsgBox.Show("對象系統編號:" + string.Join(",", targetIDList) +"。發送失敗"); } }
private void mAudioEncoderComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { do { mAudioBitRateComboBox.Items.Clear(); var lSourceNode = mAudioSourcesComboBox.SelectedItem as XmlNode; if (lSourceNode == null) { break; } var lNode = lSourceNode.SelectSingleNode("Source.Attributes/Attribute[@Name='MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_AUDCAP_SYMBOLIC_LINK']/SingleValue/@Value"); if (lNode == null) { break; } string lSymbolicLink = lNode.Value; lSourceNode = mAudioStreamsComboBox.SelectedItem as XmlNode; if (lSourceNode == null) { break; } lNode = lSourceNode.SelectSingleNode("@Index"); if (lNode == null) { break; } uint lStreamIndex = 0; if (!uint.TryParse(lNode.Value, out lStreamIndex)) { break; } lSourceNode = mAudioMediaTypesComboBox.SelectedItem as XmlNode; if (lSourceNode == null) { break; } lNode = lSourceNode.SelectSingleNode("@Index"); if (lNode == null) { break; } uint lMediaTypeIndex = 0; if (!uint.TryParse(lNode.Value, out lMediaTypeIndex)) { break; } object lAudioSourceOutputMediaType; if (mSourceControl == null) { break; } mSourceControl.getSourceOutputMediaType( lSymbolicLink, lStreamIndex, lMediaTypeIndex, out lAudioSourceOutputMediaType); var lAudioEncoderNode = mAudioEncoderComboBox.SelectedItem as XmlNode; if (lAudioEncoderNode == null) { break; } lNode = lAudioEncoderNode.SelectSingleNode("@CLSID"); if (lNode == null) { break; } Guid lCLSIDEncoder; if (!Guid.TryParse(lNode.Value, out lCLSIDEncoder)) { break; } string lxmlDoc; mEncoderControl.getMediaTypeCollectionOfEncoder( lAudioSourceOutputMediaType, lCLSIDEncoder, out lxmlDoc); var lXmlDataProvider = (XmlDataProvider)this.Resources["XmlAudioCompressedMediaTypesProvider"]; if (lXmlDataProvider == null) { return; } var doc = new System.Xml.XmlDocument(); doc.LoadXml(lxmlDoc); lXmlDataProvider.Document = doc; var lGroup = doc.SelectSingleNode("EncoderMediaTypes/Group[@GUID='{8F6FF1B6-534E-49C0-B2A8-16D534EAF135}']"); if (lGroup != null) { uint lMaxBitRate = 0; uint lMinBitRate = 0; var lAttr = lGroup.SelectSingleNode("@MaxBitRate"); if (lAttr != null) { if (uint.TryParse(lAttr.Value, out lMaxBitRate)) { } } lAttr = lGroup.SelectSingleNode("@MinBitRate"); if (lAttr != null) { if (uint.TryParse(lAttr.Value, out lMinBitRate)) { } } for (uint i = lMaxBitRate; i >= lMinBitRate; i >>= 1) { mAudioBitRateComboBox.Items.Add(i); } } } while (false); }
protected internal XmlProcessingInstruction(string target, string data, XmlDocument doc) : base(doc) { _target = target; _data = data; }