//! initializes from passed-in xml element, in format <someelement x="..." y="..." z="..." s="..."/> public Rot( XmlElement xmlelement ) { x = Convert.ToDouble( xmlelement.GetAttribute( "x" ) ); y = Convert.ToDouble( xmlelement.GetAttribute( "y" ) ); z = Convert.ToDouble( xmlelement.GetAttribute( "z" ) ); s = Convert.ToDouble( xmlelement.GetAttribute( "s" ) ); }
public NAntProperty(XmlElement element) : this(element.GetAttribute("name"), element.GetAttribute("value"), GetCategory(element), GetReadonly(element)) { }
public void ParseAttributes(XmlElement element) { Name = element.GetAttribute("name"); Description = element.GetAttribute("description"); string depends = element.GetAttribute("depends"); Depends = SplitDepends(depends); }
public static IUnitTestElement ReadFromXml(XmlElement parent, IUnitTestElement parentElement, MSpecUnitTestProvider provider, ISolution solution #if RESHARPER_61 , IUnitTestElementManager manager, PsiModuleManager psiModuleManager, CacheManager cacheManager #endif ) { var projectId = parent.GetAttribute("projectId"); var project = ProjectUtil.FindProjectElementByPersistentID(solution, projectId) as IProject; if (project == null) { return null; } var behavior = parentElement as BehaviorElement; if (behavior == null) { return null; } var typeName = parent.GetAttribute("typeName"); var methodName = parent.GetAttribute("methodName"); var isIgnored = bool.Parse(parent.GetAttribute("isIgnored")); return BehaviorSpecificationFactory.GetOrCreateBehaviorSpecification(provider, #if RESHARPER_61 manager, psiModuleManager, cacheManager, #endif project, behavior, ProjectModelElementEnvoy.Create(project), typeName, methodName, isIgnored); }
public static new Inform Parse(XmlElement inform) { if (inform == null) { throw new Exception("parameter can't be null!"); } string type = string.Empty; string operation = string.Empty; if (inform.HasAttribute("Type")) { type = inform.GetAttribute("Type"); } else { throw new Exception("load hasn't type attribute!"); } if (inform.HasAttribute("Operation")) { operation = inform.GetAttribute("Operation"); } else { throw new Exception("parameter hasn't Operation attribute!"); } Operation enumOperation = (Operation)Enum.Parse(typeof(Operation), operation); Inform result = new Inform(enumOperation, inform.Name, type, inform.InnerText); return result; }
public static IUnitTestElement ReadFromXml(XmlElement parent, IUnitTestElement parentElement, MSpecUnitTestProvider provider, ISolution solution #if RESHARPER_61 , IUnitTestElementManager manager, PsiModuleManager psiModuleManager, CacheManager cacheManager #endif ) { var projectId = parent.GetAttribute("projectId"); var project = ProjectUtil.FindProjectElementByPersistentID(solution, projectId) as IProject; if (project == null) { return null; } var context = parentElement as ContextElement; if (context == null) { return null; } var typeName = parent.GetAttribute("typeName"); var methodName = parent.GetAttribute("methodName"); var isIgnored = bool.Parse(parent.GetAttribute("isIgnored")); return ContextSpecificationFactory.GetOrCreateContextSpecification(provider, #if RESHARPER_61 manager, psiModuleManager, cacheManager, #endif project, context, ProjectModelElementEnvoy.Create(project), new ClrTypeName(typeName), methodName, EmptyArray<string>.Instance, isIgnored); }
public Field(XmlElement elField) { String typeName = elField.GetAttribute("type"); string lbStr = elField.GetAttribute("lower-bound"); string ubStr = elField.GetAttribute("upper-bound"); string fieldTypeStr = elField.GetAttribute("fieldtype"); string valueStr = elField.InnerText; type = ClassTypes.GetType(typeName); fieldType = ParseTypeString(fieldTypeStr); if (!Formal) { value = ParseFieldValue(type, valueStr); } else { if (lbStr != null) { lowerBound = (IComparable) ParseFieldValue(type, lbStr); } if (ubStr != null) { upperBound = (IComparable) ParseFieldValue(type, ubStr); } } }
protected bool ProcessStatement(XmlElement element, IXmlProcessorEngine engine) { if (!element.HasAttribute(DefinedAttrName) && !element.HasAttribute(NotDefinedAttrName)) { throw new XmlProcessorException("'if' elements expects a non empty defined or not-defined attribute"); } if (element.HasAttribute(DefinedAttrName) && element.HasAttribute(NotDefinedAttrName)) { throw new XmlProcessorException("'if' elements expects a non empty defined or not-defined attribute"); } bool processContents = false; if (element.HasAttribute(DefinedAttrName)) { processContents = engine.HasFlag(element.GetAttribute(DefinedAttrName)); } else { processContents = !engine.HasFlag(element.GetAttribute(NotDefinedAttrName)); } return processContents; }
protected override ObjectDefinitionBuilder ParseHandler(XmlElement element, ParserContext parserContext) { ObjectDefinitionBuilder builder = ObjectDefinitionBuilder.GenericObjectDefinition(IntegrationNamespaceUtils.AGGREGATOR_PACKAGE + ".MethodInvokingAggregator"); string refatr = element.GetAttribute(RefAttribute); if(!StringUtils.HasText(refatr)) { parserContext.ReaderContext.ReportException(element, element.Name, "The '" + RefAttribute + "' attribute is required."); } builder.AddConstructorArgReference(refatr); if(StringUtils.HasText(element.GetAttribute(MethodAttribute))) { string method = element.GetAttribute(MethodAttribute); builder.AddConstructorArg(method); } IntegrationNamespaceUtils.SetReferenceIfAttributeDefined(builder, element, DiscardChannelAttribute); IntegrationNamespaceUtils.SetValueIfAttributeDefined(builder, element, SendTimeoutAttribute); IntegrationNamespaceUtils.SetValueIfAttributeDefined(builder, element, SendPartialResultOnTimeoutAttribute); IntegrationNamespaceUtils.SetValueIfAttributeDefined(builder, element, ReaperIntervalAttribute); IntegrationNamespaceUtils.SetValueIfAttributeDefined(builder, element, TrackedCorrelationIdCapacityAttribute); IntegrationNamespaceUtils.SetValueIfAttributeDefined(builder, element, "auto-startup"); IntegrationNamespaceUtils.SetValueIfAttributeDefined(builder, element, TimeoutAttribute); string completionStrategyRef = element.GetAttribute(CompletionStrategyRefAttribute); string completionStrategyMethod = element.GetAttribute(CompletionStrategyMethodAttribute); if(StringUtils.HasText(completionStrategyRef)) { if(StringUtils.HasText(completionStrategyMethod)) { string adapterBeanName = CreateCompletionStrategyAdapter( completionStrategyRef, completionStrategyMethod, parserContext); builder.AddPropertyReference(CompletionStrategyProperty, adapterBeanName); } else { builder.AddPropertyReference(CompletionStrategyProperty, completionStrategyRef); } } return builder; }
public CecilPropertyDescriptor (CecilWidgetLibrary lib, XmlElement elem, Stetic.ItemGroup group, Stetic.ClassDescriptor klass, PropertyDefinition pinfo): base (elem, group, klass) { string tname; if (pinfo != null) { name = pinfo.Name; tname = pinfo.PropertyType.FullName; canWrite = pinfo.SetMethod != null; } else { name = elem.GetAttribute ("name"); tname = elem.GetAttribute ("type"); canWrite = elem.Attributes ["canWrite"] == null; } Load (elem); type = Stetic.Registry.GetType (tname, false); if (type == null) { Console.WriteLine ("Could not find type: " + tname); type = typeof(string); } if (type.IsValueType) initialValue = Activator.CreateInstance (type); // Consider all properties runtime-properties, since they have been created // from class properties. isRuntimeProperty = true; if (pinfo != null) SaveCecilXml (elem); }
/// <summary> /// Run a Smoke unit test. /// </summary> /// <param name="element">The unit test element.</param> /// <param name="previousUnitResults">The previous unit test results.</param> /// <param name="args">The command arguments passed to WixUnit.</param> public static void RunUnitTest(XmlElement element, UnitResults previousUnitResults, ICommandArgs args) { string arguments = element.GetAttribute("Arguments"); string expectedErrors = element.GetAttribute("ExpectedErrors"); string expectedWarnings = element.GetAttribute("ExpectedWarnings"); string extensions = element.GetAttribute("Extensions"); string toolsDirectory = element.GetAttribute("ToolsDirectory"); string toolFile = Path.Combine(toolsDirectory, "Smoke.exe"); StringBuilder commandLine = new StringBuilder(arguments); // handle extensions if (!String.IsNullOrEmpty(extensions)) { foreach (string extension in extensions.Split(';')) { commandLine.AppendFormat(" -ext \"{0}\"", extension); } } // run the tool ArrayList output = ToolUtility.RunTool(toolFile, commandLine.ToString()); previousUnitResults.Errors.AddRange(ToolUtility.GetErrors(output, expectedErrors, expectedWarnings)); previousUnitResults.Output.AddRange(output); }
public override void LoadConditionFromXml(ICondition condition, XmlElement conditionElement) { var c = condition as TimeOfDayCondition; c.StartTime = TimeSpan.Parse(conditionElement.GetAttribute("start")); c.EndTime = TimeSpan.Parse(conditionElement.GetAttribute("end")); c.ShouldBeWithin = bool.Parse(conditionElement.GetAttribute("shouldBeWithin")); }
private void ProcessIndex(XmlElement indexElement, IDictionary<string, Table> tables) { var tableName = indexElement.GetAttribute("table"); var columnNames = CollectionUtils.Map(indexElement.GetAttribute("columns").Split(','), (string s) => s.Trim()); if (string.IsNullOrEmpty(tableName) || columnNames.Count <= 0) return; // get table by name Table table; if (!tables.TryGetValue(tableName, out table)) throw new DdlException( string.Format("An additional index refers to a table ({0}) that does not exist.", table.Name), null); // get columns by name var columns = new List<Column>(); foreach (var columnName in columnNames) { var column = CollectionUtils.SelectFirst(table.ColumnIterator, col => col.Name == columnName); // bug #6994: could be that the index file specifies a column name that does not actually exist, so we need to check for nulls if (column == null) throw new DdlException( string.Format("An additional index on table {0} refers to a column ({1}) that does not exist.", table.Name, columnName), null); columns.Add(column); } // create index CreateIndex(table, columns); }
protected override ObjectDefinitionBuilder ParseHandler(XmlElement element, ParserContext parserContext) { ObjectDefinitionBuilder builder = ObjectDefinitionBuilder.GenericObjectDefinition(typeof(NmsOutboundGateway)); builder.AddPropertyReference("connectionFactory", element.GetAttribute("connection-factory")); String requestDestination = element.GetAttribute("request-destination"); String requestDestinationName = element.GetAttribute("request-destination-name"); if (!(StringUtils.HasText(requestDestination) ^ StringUtils.HasText(requestDestinationName))) { parserContext.ReaderContext.ReportException(element, "request-destination or request-destination-name", "Exactly one of the 'request-destination' or 'request-destination-name' attributes is required."); } if (StringUtils.HasText(requestDestination)) { builder.AddPropertyReference("requestDestination", requestDestination); } else if (StringUtils.HasText(requestDestinationName)) { builder.AddPropertyValue("requestDestinationName", requestDestinationName); } IntegrationNamespaceUtils.SetReferenceIfAttributeDefined(builder, element, "reply-destination"); IntegrationNamespaceUtils.SetValueIfAttributeDefined(builder, element, "reply-destination-name"); IntegrationNamespaceUtils.SetReferenceIfAttributeDefined(builder, element, "reply-channel"); IntegrationNamespaceUtils.SetReferenceIfAttributeDefined(builder, element, "message-converter"); IntegrationNamespaceUtils.SetReferenceIfAttributeDefined(builder, element, "header-mapper"); IntegrationNamespaceUtils.SetValueIfAttributeDefined(builder, element, "extract-request-payload"); IntegrationNamespaceUtils.SetValueIfAttributeDefined(builder, element, "extract-reply-payload"); IntegrationNamespaceUtils.SetValueIfAttributeDefined(builder, element, "receive-timeout"); IntegrationNamespaceUtils.SetValueIfAttributeDefined(builder, element, "pub-sub-domain"); IntegrationNamespaceUtils.SetValueIfAttributeDefined(builder, element, "delivery-mode"); IntegrationNamespaceUtils.SetValueIfAttributeDefined(builder, element, "time-to-live"); IntegrationNamespaceUtils.SetValueIfAttributeDefined(builder, element, "priority"); return builder; }
/// <summary> /// Erzeugt ein neues Schnittelement. /// </summary> /// <param name="element">Die Rohdaten aus der Projektdatei.</param> public CutElement( XmlElement element ) { // Load all VideoIndex = int.Parse( element.GetAttribute( "refVideoFile" ) ); Start = long.Parse( element.GetAttribute( "StartPosition" ) ); End = long.Parse( element.GetAttribute( "EndPosition" ) ); }
public override void LoadNotificationFromXml(INotification notification, XmlElement notificationElement) { var n = notification as PopupNotification; n.NotificationText = notificationElement.GetAttribute("notificationText"); n.Caption = notificationElement.GetAttribute("caption"); n.Icon = (ToolTipIcon)Enum.Parse(typeof(ToolTipIcon), notificationElement.GetAttribute("icon")); }
protected SolutionItemDescriptor (XmlElement element) { name = element.GetAttribute ("name"); // relativePath = element.GetAttribute ("directory"); typeName = element.GetAttribute ("type"); template = element; }
protected string GetAddinTextFromUrl (XmlElement addin, string addinId, string fileId) { if (addin == null) return "<html>Add-in not found: " + addinId + "</html>"; StringBuilder sb = new StringBuilder ("<html>"); sb.Append ("<h1>").Append (addin.GetAttribute ("name")).Append ("</h1>"); XmlElement docs = (XmlElement) addin.SelectSingleNode ("Description"); if (docs != null) sb.Append (docs.InnerText); sb.Append ("<p><table border=\"1\" cellpadding=\"4\" cellspacing=\"0\">"); sb.AppendFormat ("<tr><td><b>Id</b></td><td>{0}</td></tr>", addin.GetAttribute ("addinId")); sb.AppendFormat ("<tr><td><b>Namespace</b></td><td>{0}</td></tr>", addin.GetAttribute ("namespace")); sb.AppendFormat ("<tr><td><b>Version</b></td><td>{0}</td></tr>", addin.GetAttribute ("version")); sb.Append ("</table></p>"); sb.Append ("<p><b>Extension Points</b>:</p>"); sb.Append ("<ul>"); foreach (XmlElement ep in addin.SelectNodes ("ExtensionPoint")) { sb.AppendFormat ("<li><a href=\"extension-point:{0}#{1}#{2}\">{3}</li>", fileId, addinId, ep.GetAttribute ("path"), ep.GetAttribute ("name")); } sb.Append ("</ul>"); sb.Append ("</html>"); return sb.ToString (); }
/// <summary> /// Initializes a particular property of the current instance based /// on the given XML. /// </summary> /// <param name="element">The XML element.</param> internal virtual void Init(XmlElement element) { string name = element.Name; if (name.Equals("id")) { this.Id = element.InnerText; } else if (name.Equals("link")) { string rel = element.GetAttribute("rel"); string href = element.GetAttribute("href"); this.Links.Add(rel, href); } else if (name.Equals("title")) { this.Title = element.InnerText; } else if (name.Equals("updated")) { this.Updated = element.InnerText; } else if (name.Equals("author") || name.Equals("generator")) { // Ignore } else { // Ignore } }
/// <summary> /// Initializes a new instance of the <see cref="PropertyConfigurationType"/> class. /// </summary> /// <param name="el">The el.</param> public PropertyConfigurationType(XmlElement el) { Name = el.GetAttribute(NameAttr); Value = el.GetAttribute(ValueAttr); Ref = el.GetAttribute(RefAttr); Type = el.GetAttribute(TypeAttr); }
public override void LoadData(System.Xml.XmlElement element) { base.LoadData(element); m_object_url = element.GetAttribute("ObjectURL"); m_object_value = GameConvert.BoolConvert(element.GetAttribute("ObjectValue")); m_is_return = GameConvert.BoolConvert(element.GetAttribute("IsReturn")); }
internal ClientInfoVariable(XmlElement varElement) { ClientInfoVariableEditor e = new ClientInfoVariableEditor(); e.VariableName = varElement.GetAttribute("Name"); e.VariableKey = varElement.GetAttribute("Key"); this.Editor = e; }
public static Level fromXML(XmlElement node, Game gameref, String campaignPath) { Level newLvl = new Level(); newLvl.number = int.Parse(node.GetElementsByTagName("number")[0].FirstChild.Value); if (node.HasAttribute("autoProgress")) newLvl.autoProgress = bool.Parse(node.GetAttribute("autoProgress")); newLvl.name = node.GetAttribute("name"); foreach (string singleAdj in node.GetElementsByTagName("adj")[0].FirstChild.Value.Split(',')) newLvl.adjacent.Add(Int32.Parse(singleAdj)); XmlNodeList list = node.GetElementsByTagName("prereq"); if (list.Count > 0 && list[0].FirstChild != null) foreach (string singlePrereq in node.GetElementsByTagName("prereq")[0].FirstChild.Value.Split(',')) newLvl.prereq.Add(Int32.Parse(singlePrereq)); newLvl.loc = XMLUtil.fromXMLVector2(node.GetElementsByTagName("location")[0]); if (node.GetElementsByTagName("horizonPath").Count > 0) newLvl.horizon = node.GetElementsByTagName("horizonPath")[0].FirstChild.Value; if (node.GetElementsByTagName("items").Count > 0) foreach (XmlElement item in node.GetElementsByTagName("items")[0].ChildNodes) newLvl.items.Add(GameItem.fromXML(item)); if (node.GetElementsByTagName("spawns").Count > 0) foreach (XmlElement item in node.GetElementsByTagName("spawns")[0].ChildNodes) newLvl.spawns.Add(SpawnPoint.fromXML(item)); /*XmlNodeList storyNodes = node.GetElementsByTagName("story"); if (storyNodes.Count > 0 && storyNodes[0].ChildNodes.Count > 0) foreach (XmlNode item in storyNodes[0].ChildNodes) newLvl.storyElements.Add(StoryElement.fromXML(item, gameref));*/ newLvl.levelLength = int.Parse(node.GetAttribute("length")); foreach (XmlElement graphic in node.GetElementsByTagName("graphic")) newLvl.backgroundItems.Add(BackgroundItemStruct.fromXML(graphic)); return newLvl; }
public static CauHoiTuLuanDto Khoi_tao(XmlElement Nut) { CauHoiTuLuanDto kq = new CauHoiTuLuanDto(); kq.SoTT = int.Parse(Nut.GetAttribute("SoThuTu")); kq.NoiDung = Nut.GetAttribute("NoiDung"); return kq; }
public MapInfo(XmlElement iXml) { this.m_Name = iXml.GetAttribute("Name"); this.m_Num = ByteType.FromString(iXml.GetAttribute("Num")); this.m_XSize = IntegerType.FromString(iXml.GetAttribute("XSize")); this.m_YSize = IntegerType.FromString(iXml.GetAttribute("YSize")); }
internal RuntimeLicensedProduct(XmlElement el) { _assemblyName = el.GetAttribute("AssemblyName"); _version = el.GetAttribute("Version"); _licenseUrl = el.GetAttribute("LicenseUrl"); try { _expirationDate = DateTime.Parse(el.GetAttribute("ExpirationDate")); } catch { _expirationDate = DateTime.MaxValue; } try { _type = (LicenseType)Enum.Parse(typeof(LicenseType), el.GetAttribute("Type")); } catch { _type = LicenseType.Evaluation; } try { _scope = (LicenseScope)Enum.Parse(typeof(LicenseScope), el.GetAttribute("Scope")); } catch { _scope = LicenseScope.WebSite; } }
internal ResourceVariable(XmlElement varElement) { ResourceVariableEditor e = new ResourceVariableEditor(); e.VariableName = varElement.GetAttribute("Name"); e.VariableKey = varElement.GetAttribute("Key"); this.Editor = e; }
/// <summary> /// Creates a project descriptor for the project node specified by the xml element. /// </summary> /// <param name="element">The <Project> node of the xml template file.</param> /// <param name="hintPath">The directory on which relative paths (e.g. for referenced files) are based.</param> public ProjectDescriptor(XmlElement element, string hintPath) { if (element == null) throw new ArgumentNullException("element"); if (hintPath == null) throw new ArgumentNullException("hintPath"); if (element.HasAttribute("name")) { name = element.GetAttribute("name"); } else { name = "${ProjectName}"; } if (element.HasAttribute("directory")) { relativePath = element.GetAttribute("directory"); } else { relativePath = "."; } languageName = element.GetAttribute("language"); if (string.IsNullOrEmpty(languageName)) { ProjectTemplate.WarnAttributeMissing(element, "language"); } defaultPlatform = element.GetAttribute("defaultPlatform"); LoadElementChildren(element, hintPath); }
public ItemGroup (XmlElement elem, ClassDescriptor klass) { declaringType = klass; label = elem.GetAttribute ("label"); name = elem.GetAttribute ("name"); XmlNodeList nodes = elem.SelectNodes ("property | command | signal"); for (int i = 0; i < nodes.Count; i++) { XmlElement item = (XmlElement)nodes[i]; string refname = item.GetAttribute ("ref"); if (refname != "") { if (refname.IndexOf ('.') != -1) { ItemDescriptor desc = (ItemDescriptor) Registry.LookupItem (refname); items [desc.Name] = desc; } else { ItemDescriptor desc = (ItemDescriptor) klass[refname]; items [desc.Name] = desc; } continue; } ItemDescriptor idesc = klass.CreateItemDescriptor ((XmlElement)item, this); if (idesc != null) items [idesc.Name] = idesc; } }
public Map(XmlElement map) { Row = int.Parse(map.GetAttribute("row")); Col = int.Parse(map.GetAttribute("col")); Places = new Place[Row, Col]; PlaceIdToCoordinate = new Dictionary<int, Tuple<int, int>>(); _MaxId = 0; for (int r = 0; r < Row; r++) { for (int c = 0; c < Col; c++) { Places[r, c] = new None(0); } } foreach (XmlNode item in map.ChildNodes) { int r = int.Parse((item as XmlElement).GetAttribute("row")); int c = int.Parse((item as XmlElement).GetAttribute("col")); int id = int.Parse((item as XmlElement).GetAttribute("id")); NewInstanceFromXml(item, ref Places[r, c], id); PlaceIdToCoordinate.Add(id, new Tuple<int, int>(r, c)); if (id > _MaxId) { _MaxId = id; } } }
public static IUnitTestElement ReadFromXml(XmlElement parent, IUnitTestElement parentElement, MSpecUnitTestProvider provider) { var projectId = parent.GetAttribute("projectId"); var project = ProjectUtil.FindProjectElementByPersistentID(provider.Solution, projectId) as IProject; if (project == null) { return null; } var context = parentElement as ContextElement; if (context == null) { return null; } var typeName = parent.GetAttribute("typeName"); var methodName = parent.GetAttribute("methodName"); var isIgnored = bool.Parse(parent.GetAttribute("isIgnored")); var fullyQualifiedTypeName = parent.GetAttribute("typeFQN"); return Factories.BehaviorFactory.GetOrCreateBehavior(provider, project, ProjectModelElementEnvoy.Create(project), context, typeName, methodName, isIgnored, fullyQualifiedTypeName); }
public SettingConfigEntity XmlToObject(System.Xml.XmlElement element) { Id = element.GetAttribute("Id"); key = element.GetAttribute("key"); value = element.GetAttribute("value"); desc = element.GetAttribute("desc"); return(this); }
public CreateFileConfigsEntity XmlElementToObject(System.Xml.XmlElement element) { id = element.GetAttribute("id"); entityBaseName = element.GetAttribute("entityBaseName"); dbModelBaseName = element.GetAttribute("dbModelBaseName"); isCreateReadXmlFun = bool.Parse(element.GetAttribute("isCreateReadXmlFun")); isCreateReadJsonFun = bool.Parse(element.GetAttribute("isCreateReadJsonFun")); isCreateXmlFile = bool.Parse(element.GetAttribute("isCreateXmlFile")); isCreateJsonFile = bool.Parse(element.GetAttribute("isCreateJsonFile")); isCreateEntityFile = bool.Parse(element.GetAttribute("isCreateEntityFile")); isCreateDBModelFile = bool.Parse(element.GetAttribute("isCreateDBModelFile")); isCreateByteFile = bool.Parse(element.GetAttribute("isCreateByteFile")); return(this); }
/// <summary> /// 读取自定义视频窗口位置 /// </summary> private void ReadConfig() { System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); doc.Load(Application.dataPath + "/YF_Config/PatrolConfig.xml"); System.Xml.XmlElement el = (System.Xml.XmlElement)doc.SelectSingleNode("config"); posValue = el.GetAttribute("videoPos"); if (posValue == string.Empty) { posValue = "0"; } Debug.Log("配置文件读取的视频窗口位置配置参数videoPos:" + posValue); UIPanel spr = gameObject.GetComponent <UIPanel>(); switch (posValue) { case "1": spr.SetAnchor(transform.parent.gameObject, (int)videoPos[1].x, (int)videoPos[1].z, (int)videoPos[1].y, (int)videoPos[1].w); spr.leftAnchor.relative = 0; spr.rightAnchor.relative = 0; spr.topAnchor.relative = 0; spr.bottomAnchor.relative = 0; break; case "2": spr.SetAnchor(transform.parent.gameObject, (int)videoPos[2].x, (int)videoPos[2].z, (int)videoPos[2].y, (int)videoPos[2].w); spr.leftAnchor.relative = 1; spr.rightAnchor.relative = 1; spr.topAnchor.relative = 1; spr.bottomAnchor.relative = 1; break; case "3": spr.SetAnchor(transform.parent.gameObject, (int)videoPos[3].x, (int)videoPos[3].z, (int)videoPos[3].y, (int)videoPos[3].w); spr.leftAnchor.relative = 1; spr.rightAnchor.relative = 1; spr.topAnchor.relative = 0; spr.bottomAnchor.relative = 0; break; default: spr.SetAnchor(transform.parent.gameObject, (int)videoPos[0].x, (int)videoPos[0].z, (int)videoPos[0].y, (int)videoPos[0].w); spr.leftAnchor.relative = 0; spr.rightAnchor.relative = 0; spr.topAnchor.relative = 1; spr.bottomAnchor.relative = 1; break; } }
/// <summary> /// 开发使用自动跳过下一个按键的XML读取配置函数 /// </summary> /// <param name="plan"></param> private void ConstomNext(PlayVideoPatrolPlan plan) { System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); doc.Load(Application.dataPath + "/YF_Config/PatrolConfig.xml"); System.Xml.XmlElement el = (System.Xml.XmlElement)doc.SelectSingleNode("config"); string value = el.GetAttribute("next"); if (value == "0") { plan.constomNext = false; } else { plan.constomNext = true; } }
public comptConfigEntity XmlToObject(System.Xml.XmlElement element) { if (element.HasAttribute("id") && !string.IsNullOrEmpty(element.GetAttribute("id"))) { id = element.GetAttribute("id"); } if (element.HasAttribute("english") && !string.IsNullOrEmpty(element.GetAttribute("english"))) { english = element.GetAttribute("english"); } if (element.HasAttribute("china") && !string.IsNullOrEmpty(element.GetAttribute("china"))) { china = element.GetAttribute("china"); } if (element.HasAttribute("type") && !string.IsNullOrEmpty(element.GetAttribute("type"))) { type = element.GetAttribute("type"); } return(this); }
public SettingConfigEntity XmlToObject(System.Xml.XmlElement element) { if (element.HasAttribute("id") && !string.IsNullOrEmpty(element.GetAttribute("id"))) { id = element.GetAttribute("id"); } if (element.HasAttribute("key") && !string.IsNullOrEmpty(element.GetAttribute("key"))) { key = element.GetAttribute("key"); } if (element.HasAttribute("value") && !string.IsNullOrEmpty(element.GetAttribute("value"))) { value = element.GetAttribute("value"); } if (element.HasAttribute("desc") && !string.IsNullOrEmpty(element.GetAttribute("desc"))) { desc = element.GetAttribute("desc"); } return(this); }
public GradeStudentEntity XmlToObject(System.Xml.XmlElement element) { if (element.HasAttribute("id") && !string.IsNullOrEmpty(element.GetAttribute("id"))) { id = element.GetAttribute("id"); } if (element.HasAttribute("grade") && !string.IsNullOrEmpty(element.GetAttribute("grade"))) { grade = element.GetAttribute("grade"); } if (element.HasAttribute("studentId") && !string.IsNullOrEmpty(element.GetAttribute("studentId"))) { studentId = element.GetAttribute("studentId"); } if (element.HasAttribute("studentName") && !string.IsNullOrEmpty(element.GetAttribute("studentName"))) { studentName = element.GetAttribute("studentName"); } return(this); }
private static void SetPic(TreeNode pNode, System.Xml.XmlDocument xmlDoc) { try { string strCode = null; System.Xml.XmlElement vNode = null; TreeNode pNode1 = default(TreeNode); int i = 0; vNode = (XmlElement)xmlDoc.GetElementsByTagName(pNode.Name).Item(0); switch (pNode.Tag.ToString()) { case "ROOT": pNode.Expand(); break; case "SDE": pNode.Expand(); break; case "SCALE": pNode.Expand(); break; case "STYLE": pNode.Expand(); break; } if (pNode.Nodes.Count == 0) { strCode = vNode.GetAttribute("CODE"); if (Strings.InStr(strCode, "PT", CompareMethod.Text) != 0) { pNode.SelectedImageKey = "Point"; pNode.ImageKey = "Point"; } else if (Strings.InStr(strCode, "LN", CompareMethod.Text) != 0) { pNode.SelectedImageKey = "Polyline"; pNode.ImageKey = "Polyline"; } else if (Strings.InStr(strCode, "PY", CompareMethod.Text) != 0) { pNode.SelectedImageKey = "Polygon"; pNode.ImageKey = "Polygon"; } else if (Strings.InStr(strCode, "AN", CompareMethod.Text) != 0) { pNode.SelectedImageKey = "AN"; pNode.ImageKey = "AN"; } else { pNode.SelectedImageKey = pNode.Tag.ToString(); pNode.ImageKey = pNode.Tag.ToString(); } } else { pNode.SelectedImageKey = pNode.Tag.ToString(); pNode.ImageKey = pNode.Tag.ToString(); } if (pNode.Nodes.Count != 0) { for (i = 0; i <= pNode.Nodes.Count - 1; i++) { pNode1 = pNode.Nodes[i]; SetPic(pNode1, xmlDoc); } } } catch (Exception) { } }
/// <summary> /// Loads settings from XML. /// </summary> /// <param name="node">The node.</param> /// <param name="infoEvents">The info events.</param> /// <exception cref="System.Exception"></exception> void IDTSComponentPersist.LoadFromXML(System.Xml.XmlElement node, IDTSInfoEvents infoEvents) { //TaskProperties prop = this.Properties; try { // This might occur if the task's XML has been modified outside of the Business Intelligence // Or SQL Server Workbenches. if (node.Name != "SFTPTask") { throw new Exception(string.Format("Unexpected task element when loading task - {0}.", "SFTPTask")); } else { // let error bubble up // populate the private property variables with values from the DTS node. this.localFile = node.GetAttribute(CONSTANTS.SFTPLOCALFILE, String.Empty); this.remoteFile = node.GetAttribute(CONSTANTS.SFTPREMOTEFILE, String.Empty); this.fileAction = (SFTPFileAction)Enum.Parse(typeof(SFTPFileAction), node.GetAttribute(CONSTANTS.SFTPFILEACTION, String.Empty)); this.fileInfo = node.GetAttribute(CONSTANTS.SFTPFILEINFO, String.Empty); this.overwriteDest = Convert.ToBoolean(node.GetAttribute(CONSTANTS.SFTPOVERWRITEDEST, String.Empty)); this.removeSource = Convert.ToBoolean(node.GetAttribute(CONSTANTS.SFTPREMOVESOURCE, String.Empty)); this.isRecursive = Convert.ToBoolean(node.GetAttribute(CONSTANTS.SFTPISRECURSIVE, String.Empty)); this.fileFilter = node.GetAttribute(CONSTANTS.SFTPFILEFILTER, String.Empty); //this.reTries = Convert.ToInt32(node.GetAttribute(CONSTANTS.SFTPRETRIES, String.Empty)); this.hostName = node.GetAttribute(CONSTANTS.SFTPHOST, String.Empty); this.portNumber = node.GetAttribute(CONSTANTS.SFTPPORT, String.Empty); this.userName = node.GetAttribute(CONSTANTS.SFTPUSER, String.Empty); this.passWord = node.GetAttribute(CONSTANTS.SFTPPASSWORD, String.Empty); this.stopOnFailure = Convert.ToBoolean(node.GetAttribute(CONSTANTS.SFTPSTOPONFAILURE, String.Empty)); this.remoteFileListVariable = node.GetAttribute(CONSTANTS.SFTPREMOTEFILELISTVAR, String.Empty); this.logLevel = (LogLevel)Enum.Parse(typeof(LogLevel), node.GetAttribute(CONSTANTS.SFTPLOGLEVEL, String.Empty)); } } catch (Exception ex) { infoEvents.FireError(0, "Load From XML: ", ex.Message + Environment.NewLine + ex.StackTrace, "", 0); } }
public override void OnClick() { Exception eError = null; FolderBrowserDialog pFolderBrowserDialog = new FolderBrowserDialog(); if (pFolderBrowserDialog.ShowDialog() == DialogResult.OK) { ///获得树图上选择的工程节点 #region 获得工程树图上的参数信息 ///获得树图上选择的工程节点 //cyf 20110626 modify DevComponents.AdvTree.Node pCurNode = m_Hook.ProjectTree.SelectedNode; //当前树节点,栅格数据节点 DevComponents.AdvTree.Node pDBProNode = m_Hook.ProjectTree.SelectedNode; //获得工程树图节点 while (pDBProNode.Parent != null) { pDBProNode = pDBProNode.Parent; } if (pDBProNode.DataKeyString != "project") { SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "获取工程树图节点失败!"); return; } //end //cyf 20110609 modify: //string pProjectname = pCurNode.Name; string pProjectname = pDBProNode.Text; //end System.Xml.XmlNode Projectnode = m_Hook.DBXmlDocument.SelectSingleNode("工程管理/工程[@名称='" + pProjectname + "']"); //cyf if (Projectnode == null) { return; } //end //cyf 20110626 modify:获取栅格数据图层的存储类型 //获得栅格数据库类型 //System.Xml.XmlElement DbTypeElem = Projectnode.SelectSingleNode(".//内容//栅格数据库") as System.Xml.XmlElement; //string dbType = DbTypeElem.GetAttribute("存储类型"); //栅格编目、栅格数据集 XmlElement pCurElem = null; //图层xml节点 try { pCurElem = pCurNode.Tag as XmlElement; } catch { } if (pCurElem == null) { SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "获取图层xml节点失败!"); return; } string dbType = pCurElem.GetAttribute("存储类型").Trim(); //栅格数据存储类型 string pDesRasterCollName = pCurElem.GetAttribute("名称").Trim(); //栅格数据名称 //获得栅格目录,栅格数据集名称 //System.Xml.XmlElement DbcataLogNameElem = Projectnode.SelectSingleNode(".//栅格数据库/连接信息/库体") as System.Xml.XmlElement; //if (DbcataLogNameElem == null) return; //string pDesRasterCollName = DbcataLogNameElem.GetAttribute("名称"); //栅格数据名称 //if (pDesRasterCollName == "") return; //end //获得连接信息 System.Xml.XmlElement DbConnElem = Projectnode.SelectSingleNode(".//栅格数据库/连接信息") as System.Xml.XmlElement; string pType = DbConnElem.GetAttribute("类型"); string pServer = DbConnElem.GetAttribute("服务器"); string pInstance = DbConnElem.GetAttribute("服务名"); string pDataBase = DbConnElem.GetAttribute("数据库"); string pUser = DbConnElem.GetAttribute("用户"); string pPassword = DbConnElem.GetAttribute("密码"); string pVersion = DbConnElem.GetAttribute("版本"); //cyf 20110609 add string pConnectInfo = ""; //连接信息字符串 pConnectInfo = pType + "," + pServer + "," + pInstance + "," + pDataBase + "," + pUser + "," + pPassword + "," + pVersion; //end #endregion #region 设置数据库连接信息 SysCommon.Gis.SysGisDataSet pSysDt = new SysCommon.Gis.SysGisDataSet(); if (pType.ToUpper() == "PDB") { pSysDt.SetWorkspace(pDataBase, SysCommon.enumWSType.PDB, out eError); } else if (pType.ToUpper() == "GDB") { pSysDt.SetWorkspace(pDataBase, SysCommon.enumWSType.GDB, out eError); } else if (pType.ToUpper() == "SDE") { pSysDt.SetWorkspace(pServer, pInstance, "", pUser, pPassword, pVersion, out eError); pDesRasterCollName = pUser + "." + pDesRasterCollName; } if (eError != null) { SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "连接数据库失败!"); return; } #endregion //cyf 20110609 add:读取栅格数据入库日志, #region 检查是否存在已经入库的数据 SysCommon.DataBase.SysTable pSysTable = null; Dictionary <string, string> DicbeInDb = new Dictionary <string, string>(); //用来已经入库的栅格数据的源路径和目标连接信息 if (File.Exists(ModData.RasterInDBLog)) { //若存在栅格数据入库日志,则将入库过的数据的路径保存起来 pSysTable = new SysCommon.DataBase.SysTable(); pSysTable.SetDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + ModData.RasterInDBLog + ";Persist Security Info=True", SysCommon.enumDBConType.OLEDB, SysCommon.enumDBType.ACCESS, out eError); if (eError != null) { SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "连接栅格入库日志表失败!"); return; } //获得栅格入库日志表 DataTable pTable = pSysTable.GetTable("rasterfileinfo", out eError); if (eError != null) { SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "获取栅格入库日志表失败!"); pSysTable.CloseDbConnection(); return; } for (int i = 0; i < pTable.Rows.Count; i++) { string pFileName = pTable.Rows[i][0].ToString(); string pDesPath = pTable.Rows[i][2].ToString(); if (!DicbeInDb.ContainsKey(pFileName)) { DicbeInDb.Add(pFileName, pDesPath); } } //关闭连接 pSysTable.CloseDbConnection(); //cyf 20110610 modify if (pTable.Rows.Count > 0) { //存在已经入库的数据 RasterErrInfoFrm pRasterErrInfoFrm = new RasterErrInfoFrm(pTable); if (pRasterErrInfoFrm.ShowDialog() != DialogResult.OK) { //若不继续入库,则返回 return; } } //end } #endregion //end //cyf 20110609 //连接栅格数据入库日志表 if (!File.Exists(ModData.RasterInDBLog)) { if (File.Exists(ModData.RasterInDBTemp)) { File.Copy(ModData.RasterInDBTemp, ModData.RasterInDBLog); } SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "没有找到日志表模板:" + ModData.RasterInDBTemp); return; } pSysTable = new SysCommon.DataBase.SysTable(); pSysTable.SetDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + ModData.RasterInDBLog + ";Persist Security Info=True", SysCommon.enumDBConType.OLEDB, SysCommon.enumDBType.ACCESS, out eError); if (eError != null) { SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "连接栅格入库日志表失败!"); return; } //获得文件夹下面所有的子文件 string pRootFile = pFolderBrowserDialog.SelectedPath;// 选择的文件夹路径 DirectoryInfo pDirectoryInfo = new DirectoryInfo(pRootFile); //FileInfo[] pFileInfoArr = pDirectoryInfo.GetFiles("*.tif", SearchOption.AllDirectories); FileInfo[] pFileInfoArr = pDirectoryInfo.GetFiles("*.*", SearchOption.AllDirectories); //添加进度条 if (pAppFormRef.ProgressBar != null) { pAppFormRef.ProgressBar.Visible = true; pAppFormRef.ProgressBar.Maximum = pFileInfoArr.Length; pAppFormRef.ProgressBar.Minimum = 0; pAppFormRef.ProgressBar.Value = 0; Application.DoEvents(); } //end for (int i = 0; i < pFileInfoArr.Length; i++) { FileInfo pFileInfo = pFileInfoArr[i]; string pFileName = pFileInfo.FullName; //文件名 if (!pFileName.ToLower().EndsWith("tif") && !pFileName.ToLower().EndsWith("img")) { //如果不是TIF文件和IMG文件则不参与检查 //进度条加1 if (pAppFormRef.ProgressBar != null) { pAppFormRef.ProgressBar.Value++; Application.DoEvents(); } continue; } //cyf 20110609 add:对入库过的数据进行判断和筛选 if (DicbeInDb.ContainsKey(pFileName)) { //已经进行入库 if (DicbeInDb[pFileName] == pConnectInfo) { //如果源的路径与目标的路径都相同,则说明已经入库了 //进度条加1 if (pAppFormRef.ProgressBar != null) { pAppFormRef.ProgressBar.Value++; Application.DoEvents(); } continue; } } //end //cyf 20110610 add:文字提示 if (pAppFormRef != null) { pAppFormRef.OperatorTips = "正在进行数据" + pFileName + "入库..."; Application.DoEvents(); } //end //cyf 20110610 adds string Starime = DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString(); //开始时间 //end //进行数据入库 string fileFullName = pFileName; if (dbType == "栅格数据集") { //栅格数据集入库 InputRasterDataset(pDesRasterCollName, fileFullName, pSysDt.WorkSpace, out eError); } else if (dbType == "栅格编目") { //栅格编目数据入库 InputRasterCatalogData(pDesRasterCollName, fileFullName, pSysDt.WorkSpace, out eError); } if (eError != null) { SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("错误", "栅格数据入库出错!\n" + eError.Message); return; } //若入库成功,则将入库成功的数据添加到栅格数据日志表中 //cyf 20110609 插入栅格数据日志表中 string insertStr = "insert into rasterfileinfo values('" + pFileName + "','" + Starime + "','" + DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString() + "','" + pConnectInfo + "')"; pSysTable.UpdateTable(insertStr, out eError); if (eError != null) { SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "插入栅格入库日志表失败!"); continue; } //进度条加1 if (pAppFormRef.ProgressBar != null) { pAppFormRef.ProgressBar.Value++; Application.DoEvents(); } //end } //cyf 20110609 add: //关闭连接 pSysTable.CloseDbConnection(); //end //if (dbType == "栅格编目") //{ // InputRasterCatalogData(pDesRasterCollName, fileList, pSysDt.WorkSpace, out eError); //} SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "栅格数据入库完成!"); //cyf 20110609 add if (pAppFormRef.ProgressBar != null) { pAppFormRef.ProgressBar.Visible = false; //cyf 20110610 add:清空文字提示 pAppFormRef.OperatorTips = ""; //end } //end //cyf 20110610 add:栅格正常结束的日志 if (File.Exists(ModData.RasterInDBLog)) { File.Delete(ModData.RasterInDBLog); } //end } }
/// <summary> /// Deserializes the specified element. /// </summary> /// <param name="element">The element.</param> public override void Deserialize(System.Xml.XmlElement element) { this.BuildNumberScheme = null; this.MajorNumber = null; this.MinorNumber = null; this.Prefix = string.Empty; this.ReleaseStartDate = null; this.RevisionNumberScheme = null; this.VersionFilePath = string.Empty; if (string.Compare(element.GetAttribute("type"), this.TypeName, false) != 0) { throw new InvalidCastException(string.Format("Unable to convert {0} to a {1}", element.GetAttribute("type"), this.TypeName)); } DateTime dt = DateTime.Now; string s = Util.GetElementOrAttributeValue("ReleaseStartDate", element); if (!string.IsNullOrEmpty(s)) { DateTime.TryParse(s, out dt); } this.ReleaseStartDate = dt; s = Util.GetElementOrAttributeValue("Prefix", element); if (!string.IsNullOrEmpty(s)) { this.Prefix = s; } int val = 0; s = Util.GetElementOrAttributeValue("MajorNumber", element); if (int.TryParse(s, out val)) { this.MajorNumber = val; } s = Util.GetElementOrAttributeValue("MinorNumber", element); if (int.TryParse(s, out val)) { this.MinorNumber = val; } s = Util.GetElementOrAttributeValue("VersionFilePath", element); if (!string.IsNullOrEmpty(s)) { this.VersionFilePath = s; } s = Util.GetElementOrAttributeValue("BuildNumberScheme", element); if (!string.IsNullOrEmpty(s)) { this.BuildNumberScheme = (BrekiLabeller.BuildNumberSchemeType)Enum.Parse(typeof(BrekiLabeller.BuildNumberSchemeType), s); } s = Util.GetElementOrAttributeValue("RevisionNumberScheme", element); if (!string.IsNullOrEmpty(s)) { this.RevisionNumberScheme = (BrekiLabeller.RevisionNumberSchemeType)Enum.Parse(typeof(BrekiLabeller.RevisionNumberSchemeType), s); } }
public Project CreateProject(ProjectCreateInformation info, System.Xml.XmlElement projectOptions) { string languageName = projectOptions.GetAttribute("language"); return(new PortableDotNetProject(languageName, info, projectOptions)); }
// This method takes the XmlElement from the configuration file and sets the values of the object. /// <summary> /// Deserializes the specified element. /// </summary> /// <param name="element">The element.</param> public override void Deserialize(System.Xml.XmlElement element) { // first we want to reset the values of the instance to ensure they do not contain old values. // since this property is required we want to set the private field and not the public property // or it will throw an exception. this._svnExecutable = null; // the rest we can just reset the public property. this.WorkingDirectory = null; this.MajorVersion = null; this.MinorVersion = null; this.BuildNumber = null; // here we check that the element type value == the type name specified in the constructor. if (string.Compare(element.GetAttribute("type"), base.TypeName, false) != 0) { throw new InvalidCastException(string.Format("Unable to convert {0} to a {1}", element.GetAttribute("type"), base.TypeName)); } // since CC.NET configuration values can either be an element or an attribute of the // base element, we use the Util.GetElementOrAttributeValue to find the value of // the property. The first argument is the property name, the second is the // base element, in this case the labeller element. string s = Util.GetElementOrAttributeValue("executable", element); // since this is a required proeprty, we don't check the results of // what the method returned. We let the CheckRequired do that in the // property setter. this.Executable = s; s = Util.GetElementOrAttributeValue("workingDirectory", element); // check if there is a value, if so set it. if (!string.IsNullOrEmpty(s)) { this.WorkingDirectory = s; } // get the minor version value s = Util.GetElementOrAttributeValue("MinorVersion", element); if (!string.IsNullOrEmpty(s)) { int i = 0; // since this property expects an integer, we try to parse the string if (int.TryParse(s, out i)) { this.MinorVersion = i; } } // get the major version value s = Util.GetElementOrAttributeValue("MajorVersion", element); if (!string.IsNullOrEmpty(s)) { int i = 0; if (int.TryParse(s, out i)) { this.MajorVersion = i; } } // get the build number value s = Util.GetElementOrAttributeValue("BuildNumber", element); if (!string.IsNullOrEmpty(s)) { int i = 0; if (int.TryParse(s, out i)) { this.BuildNumber = i; } } }
public override void Deserialize(Version documentVersion, System.Xml.XmlElement node) { base.Deserialize(documentVersion, node); Hyperlink = node.GetAttribute("hyperlink"); Folded = ST.GetBoolDefault(node.GetAttribute("folded")); // if (documentVersion >= Document.DV_3) // 新 { CustomWidth = ST.GetInt(node.GetAttribute("custom_width")); CustomHeight = ST.GetInt(node.GetAttribute("custom_height")); } else { CustomWidth = ST.GetInt(node.GetAttribute("width")); CustomHeight = ST.GetInt(node.GetAttribute("height")); } TextBounds = ST.GetRectangle(node.GetAttribute("text_b"), TextBounds); RemarkIconBounds = ST.GetRectangle(node.GetAttribute("remark_b"), RemarkIconBounds); FoldingButton = ST.GetRectangle(node.GetAttribute("fold_btn_b"), FoldingButton); XmlElement styleNode = node.SelectSingleNode("style") as XmlElement; if (styleNode != null) { Style.Deserialize(documentVersion, styleNode); } // var linkNodes = node.SelectNodes("links/link"); foreach (XmlElement linkNode in linkNodes) { Link link = new Link(); link.Deserialize(documentVersion, linkNode); Links.Add(link); } // var widgetNodes = node.SelectNodes("widgets/widget"); foreach (XmlElement widgetNode in widgetNodes) { var widget = Widget.DeserializeWidget(documentVersion, widgetNode); if (widget != null) { Widgets.Add(widget); } } // XmlNodeList nodes = node.SelectNodes("nodes/node"); foreach (XmlElement subNode in nodes) { Topic subTopic = new Topic(); subTopic.Deserialize(documentVersion, subNode); Children.Add(subTopic); } // if (!Children.IsNullOrEmpty()) { XmlNodeList lines = node.SelectNodes("lines/line"); foreach (XmlElement lineNode in lines) { var line = new TopicLine(); line.Deserialize(documentVersion, lineNode); var targetID = lineNode.GetAttribute("target"); var target = Children.Find(c => StringComparer.OrdinalIgnoreCase.Equals(c.ID, targetID)); if (target != null) { line.SetTarget(target); Lines.Add(line); } } } // }
private static void WriteDeclareParametersToFile(Utilities.TaskLoggingHelper loggingHelper, Framework.ITaskItem[] parameters, string[] parameterAttributes, string outputFileName, bool foptimisticParameterDefaultValue, string optimisticParameterMetadata) { Xml.XmlDocument document = new System.Xml.XmlDocument(); Xml.XmlElement parametersElement = document.CreateElement("parameters"); document.AppendChild(parametersElement); if (parameters != null) { System.Collections.Generic.Dictionary <string, Xml.XmlElement> dictionaryLookup = new System.Collections.Generic.Dictionary <string, Xml.XmlElement>(parameters.GetLength(0), System.StringComparer.OrdinalIgnoreCase); // we are on purpose to keep the order without optimistic change the Value/Default base on the non-null optimistic System.Collections.Generic.IList <Framework.ITaskItem> items = Utility.SortParametersTaskItems(parameters, foptimisticParameterDefaultValue, optimisticParameterMetadata); foreach (Framework.ITaskItem item in items) { string name = item.ItemSpec; Xml.XmlElement parameterElement = null; bool fCreateNew = false; if (!dictionaryLookup.TryGetValue(name, out parameterElement)) { fCreateNew = true; parameterElement = document.CreateElement("parameter"); parameterElement.SetAttribute("name", name); foreach (string attributeName in parameterAttributes) { string value = item.GetMetadata(attributeName); parameterElement.SetAttribute(attributeName, value); } dictionaryLookup.Add(name, parameterElement); parametersElement.AppendChild(parameterElement); } if (parameterElement != null) { string elementValue = item.GetMetadata(ExistingParameterValiationMetadata.Element.ToString()); if (string.IsNullOrEmpty(elementValue)) { elementValue = "parameterEntry"; } string[] parameterIdentities = s_parameterEntryIdentities; if (string.Compare(elementValue, "parameterEntry", System.StringComparison.OrdinalIgnoreCase) == 0) { parameterIdentities = s_parameterEntryIdentities; } else if (string.Compare(elementValue, "parameterValidation", System.StringComparison.OrdinalIgnoreCase) == 0) { parameterIdentities = s_parameterValidationIdentities; } // from all existing node, if the parameter Entry is identical, we should not create a new one int parameterIdentitiesCount = parameterIdentities.GetLength(0); string[] identityValues = new string[parameterIdentitiesCount]; identityValues[0] = elementValue; for (int i = 1; i < parameterIdentitiesCount; i++) { identityValues[i] = item.GetMetadata(parameterIdentities[i]); if (string.Equals(parameterIdentities[i], ExistingDeclareParameterMetadata.Match.ToString().ToLowerInvariant())) { string metadataValue = item.GetMetadata(parameterIdentities[i]); if (!string.IsNullOrEmpty(metadataValue) && (Directory.Exists(metadataValue) || File.Exists(metadataValue))) { metadataValue = $"^{Regex.Escape(metadataValue)}$"; } identityValues[i] = metadataValue; } } if (!fCreateNew) { bool fIdentical = false; foreach (Xml.XmlNode childNode in parameterElement.ChildNodes) { Xml.XmlElement childElement = childNode as Xml.XmlElement; if (childElement != null) { if (string.Compare(childElement.Name, identityValues[0], System.StringComparison.OrdinalIgnoreCase) == 0) { fIdentical = true; for (int i = 1; i < parameterIdentitiesCount; i++) { // case sensitive comparesion should be O.K. if (string.CompareOrdinal(identityValues[i], childElement.GetAttribute(parameterIdentities[i])) != 0) { fIdentical = false; break; } } if (fIdentical) { break; } } } } if (fIdentical) { // same ParameterEntry, skip this item continue; } } bool fAddEntry = false; for (int i = 1; i < parameterIdentitiesCount; i++) { fAddEntry |= !string.IsNullOrEmpty(identityValues[i]); } if (fAddEntry) { Xml.XmlElement parameterEntry = document.CreateElement(identityValues[0]); for (int i = 1; i < parameterIdentitiesCount; i++) { string attributeName = parameterIdentities[i]; string value = identityValues[i]; if (!string.IsNullOrEmpty(value)) { parameterEntry.SetAttribute(attributeName, value); } } parameterElement.AppendChild(parameterEntry); } } } } // Save the UTF8 and Indented Utility.SaveDocument(document, outputFileName, System.Text.Encoding.UTF8); }
/// <summary> /// Deserializes the specified element. /// </summary> /// <param name="element">The element.</param> public override void Deserialize(System.Xml.XmlElement element) { this.AutoGetSource = null; this.Executable = string.Empty; this.HomeDirectory = string.Empty; this.LabelOnSuccess = null; this.Login = null; this.Password = new HiddenPassword(); this.Principal = string.Empty; this.Timeout = new Timeout(); this.Workspace = string.Empty; if (string.Compare(element.GetAttribute("type"), this.TypeName, false) != 0) { throw new InvalidCastException(string.Format("Unable to convert {0} to a {1}", element.GetAttribute("type"), this.TypeName)); } string s = Util.GetElementOrAttributeValue("autoGetSource", element); if (!string.IsNullOrEmpty(s)) { this.AutoGetSource = string.Compare(s, bool.TrueString, true) == 0; } s = Util.GetElementOrAttributeValue("executable", element); if (!string.IsNullOrEmpty(s)) { this.Executable = s; } s = Util.GetElementOrAttributeValue("homeDir", element); if (!string.IsNullOrEmpty(s)) { this.HomeDirectory = s; } s = Util.GetElementOrAttributeValue("labelOnSuccess", element); if (!string.IsNullOrEmpty(s)) { this.LabelOnSuccess = string.Compare(s, bool.TrueString, true) == 0; } s = Util.GetElementOrAttributeValue("login", element); if (!string.IsNullOrEmpty(s)) { this.Login = string.Compare(s, bool.TrueString, true) == 0; } this.Password.Password = Util.GetElementOrAttributeValue("password", element); s = Util.GetElementOrAttributeValue("principal", element); if (!string.IsNullOrEmpty(s)) { this.Principal = s; } XmlElement ele = (XmlElement)element.SelectSingleNode("timeout"); if (ele != null) { this.Timeout.Deserialize(ele); } s = Util.GetElementOrAttributeValue("workspace", element); if (!string.IsNullOrEmpty(s)) { this.Workspace = s; } }
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")); }
/// <summary> /// Load state from an XML element /// </summary> /// <param name="xmlElement">XML element containing new state</param> public void LoadXml(System.Xml.XmlElement xmlElement) { XmlNamespaceManager xmlNamespaceManager; XmlNodeList xmlNodeList; IEnumerator enumerator; XmlElement iterationXmlElement; HashDataInfo newHashDataInfo; if (xmlElement == null) { throw new ArgumentNullException(nameof(xmlElement)); } if (xmlElement.HasAttribute("Id")) { this.id = xmlElement.GetAttribute("Id"); } else { this.id = ""; } xmlNamespaceManager = new XmlNamespaceManager(xmlElement.OwnerDocument.NameTable); xmlNamespaceManager.AddNamespace("xades", XadesSignedXml.XadesNamespaceUri); this.hashDataInfoCollection.Clear(); xmlNodeList = xmlElement.SelectNodes("xades:HashDataInfo", xmlNamespaceManager); enumerator = xmlNodeList.GetEnumerator(); try { while (enumerator.MoveNext()) { iterationXmlElement = enumerator.Current as XmlElement; if (iterationXmlElement != null) { newHashDataInfo = new HashDataInfo(); newHashDataInfo.LoadXml(iterationXmlElement); this.hashDataInfoCollection.Add(newHashDataInfo); } } } finally { if (enumerator is IDisposable disposable) { disposable.Dispose(); } } xmlNodeList = xmlElement.SelectNodes("xades:EncapsulatedTimeStamp", xmlNamespaceManager); if (xmlNodeList.Count != 0) { this.encapsulatedTimeStamp = new EncapsulatedPKIData("EncapsulatedTimeStamp"); this.encapsulatedTimeStamp.LoadXml((XmlElement)xmlNodeList.Item(0)); this.xmlTimeStamp = null; } else { XmlNode nodeEncapsulatedTimeStamp = null; foreach (XmlNode node in xmlElement.ChildNodes) { if (node.Name == "EncapsulatedTimeStamp") { nodeEncapsulatedTimeStamp = node; break; } } if (nodeEncapsulatedTimeStamp != null) { this.encapsulatedTimeStamp = new EncapsulatedPKIData("EncapsulatedTimeStamp"); this.encapsulatedTimeStamp.LoadXml((XmlElement)nodeEncapsulatedTimeStamp); this.xmlTimeStamp = null; } else { xmlNodeList = xmlElement.SelectNodes("xades:XMLTimeStamp", xmlNamespaceManager); if (xmlNodeList.Count != 0) { this.xmlTimeStamp = new XMLTimeStamp(); this.xmlTimeStamp.LoadXml((XmlElement)xmlNodeList.Item(0)); this.encapsulatedTimeStamp = null; } else { throw new CryptographicException("EncapsulatedTimeStamp or XMLTimeStamp element is missing"); } } } }
public QuestionEntity XmlToObject(System.Xml.XmlElement element) { if (element.HasAttribute("id") && !string.IsNullOrEmpty(element.GetAttribute("id"))) { id = element.GetAttribute("id"); } if (element.HasAttribute("answer") && !string.IsNullOrEmpty(element.GetAttribute("answer"))) { answer = element.GetAttribute("answer"); } if (element.HasAttribute("A") && !string.IsNullOrEmpty(element.GetAttribute("A"))) { A = element.GetAttribute("A"); } if (element.HasAttribute("B") && !string.IsNullOrEmpty(element.GetAttribute("B"))) { B = element.GetAttribute("B"); } if (element.HasAttribute("C") && !string.IsNullOrEmpty(element.GetAttribute("C"))) { C = element.GetAttribute("C"); } if (element.HasAttribute("D") && !string.IsNullOrEmpty(element.GetAttribute("D"))) { D = element.GetAttribute("D"); } if (element.HasAttribute("question") && !string.IsNullOrEmpty(element.GetAttribute("question"))) { question = element.GetAttribute("question"); } return(this); }
// called when we need to update the config // currently it only saves options void cfgUpdate() { //make reference ConfigReader xmlGame = new ConfigReader(); xmlGame.LoadXml(Resources.Load <TextAsset>(configFileName).text); //copy options to xmlGame string[] optionList = new string[4]; Xml.XmlNodeList optionNodes = xmlResult.GetElementsByTagName("Option"); foreach (Xml.XmlElement nodes in optionNodes) { string attributeName = nodes.GetAttribute("optionName"); switch (attributeName) { case "SoundVolume": optionList[0] = nodes.GetAttribute("value"); break; case "MusicVolume": optionList[1] = nodes.GetAttribute("value"); break; case "SoundIsOn": optionList[2] = nodes.GetAttribute("value"); break; case "MusicIsOn": optionList[3] = nodes.GetAttribute("value"); break; } } optionNodes = xmlGame.GetElementsByTagName("Option"); foreach (Xml.XmlElement nodes in optionNodes) { string attributeName = nodes.GetAttribute("optionName"); switch (attributeName) { case "SoundVolume": nodes.SetAttribute("value", optionList[0]); break; case "MusicVolume": nodes.SetAttribute("value", optionList[1]); break; case "SoundIsOn": nodes.SetAttribute("value", optionList[2]); break; case "MusicIsOn": nodes.SetAttribute("value", optionList[3]); break; } } // copy playername, hostname and NATmode to xmlGame if they exist if (xmlResult.GetElementsByTagName("ServerInfo").Count != 0) { Xml.XmlElement sevInfo = xmlResult.GetElementsByTagName("ServerInfo")[0] as Xml.XmlElement; Xml.XmlElement sevInfoGame = xmlGame.GetElementsByTagName("ServerInfo")[0] as Xml.XmlElement; if (sevInfo.GetAttribute("playername") != null) { sevInfoGame.SetAttribute("playername", sevInfo.GetAttribute("playername")); } if (sevInfo.GetAttribute("hostname") != null) { sevInfoGame.SetAttribute("hostname", sevInfo.GetAttribute("hostname")); } if (sevInfo.GetAttribute("NATmode") != null) { sevInfoGame.SetAttribute("NATmode", sevInfo.GetAttribute("NATmode")); } } // set xmlResult as xmlGame xmlResult = xmlGame; }
//──────────────────────────────────────── #endregion #region アクション //──────────────────────────────────────── /// <summary> /// Rfrファイル読取。 /// /// 呼び出し元で、memoryApplicationに Stg をセットする。 /// </summary> public Configurationtree_Node XmlToConfigurationtree( string sFpatha,//絶対ファイルパス MemoryApplication memoryApplication, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_XmlToConf.Name_Library, this, "XmlToConfigurationtree", log_Reports); // // // リローディング設定。 Configurationtree_Node sTg_Cnf = new Configurationtree_NodeImpl(NamesNode.S_CODEFILE_TOGETHERS, new Configurationtree_NodeImpl(sFpatha, null)); System.Xml.XmlDocument xDoc = new System.Xml.XmlDocument(); XmlElement err_XTop; Exception err_Excp; try { xDoc.Load(sFpatha); // ルート要素を取得 System.Xml.XmlElement xRoot = xDoc.DocumentElement; // スクリプトファイルのバージョンチェック。(関数登録ファイル) ValuesAttr.Test_Codefileversion( xRoot.GetAttribute(PmNames.S_CODEFILE_VERSION.Name_Attribute), log_Reports, new Configurationtree_NodeImpl(sFpatha, null), NamesNode.S_CODEFILE_TOGETHERS ); if (log_Reports.Successful) { XmlNodeList xTopNL = xRoot.ChildNodes; foreach (XmlNode xTopNode in xTopNL) { if (XmlNodeType.Element == xTopNode.NodeType) { XmlElement xTop = (XmlElement)xTopNode; if (NamesNode.S_TOGETHER == xTop.Name) { XmlToConfigurationtree_C15_Elm to = XmlToConfigurationtree_Collection.GetTranslatorByNodeName(NamesNode.S_TOGETHER, log_Reports); to.XmlToConfigurationtree( xTop, sTg_Cnf, memoryApplication, log_Reports ); } else { err_XTop = xTop; goto gt_Error_NotSupportedChild; } } } } } catch (System.IO.IOException ex) { err_Excp = ex; goto gt_Error_IOException; } catch (Exception ex) { err_Excp = ex; goto gt_Error_Exception; } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_NotSupportedChild: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー387!", log_Method); StringBuilder t = new StringBuilder(); t.Append("トゥゲザー登録ファイルに、<" + NamesNode.S_TOGETHER + ">要素以外の要素["); t.Append(err_XTop.Name); t.Append("]が含まれていました。"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); // ヒント t.Append(r.Message_Configuration(sTg_Cnf)); r.Message = t.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_IOException: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー388!", log_Method); StringBuilder t = new StringBuilder(); t.Append("ファイルが見つかりません。"); t.Append(Environment.NewLine); t.Append("absoluteFilePath=["); t.Append(sFpatha); t.Append("]"); t.Append(Environment.NewLine); t.Append(Environment.NewLine); // ヒント t.Append(r.Message_Configuration(sTg_Cnf)); t.Append(r.Message_SException(err_Excp)); r.Message = t.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_Exception: if (log_Reports.CanCreateReport) { Log_RecordReports r = log_Reports.BeginCreateReport(EnumReport.Error); r.SetTitle("▲エラー344!", log_Method); StringBuilder t = new StringBuilder(); t.Append("読み込むファイルを間違えているかも?"); t.Append(Environment.NewLine); t.Append("トゥゲザー登録ファイル(絶対パス)=[" + sFpatha + "]"); t.Append(Environment.NewLine); t.Append("ex.Message=[" + err_Excp.Message + "]"); t.Append(Environment.NewLine); t.Append("ex.GetType().Name=[" + err_Excp.GetType().Name + "]"); // ヒント t.Append(r.Message_Configuration(sTg_Cnf)); t.Append(r.Message_SException(err_Excp)); r.Message = t.ToString(); log_Reports.EndCreateReport(); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); return(sTg_Cnf); }
//──────────────────────────────────────── /// <summary> /// コントロール名と、設定ファイルパスが指定されるので、 /// 検索して、設定。 /// </summary> /// <param name="sFcName"></param> /// <param name="sFpathH_F">絶対ファイルパス(F)手入力</param> /// <param name="sFpatha_F">絶対ファイルパス(F)</param> /// <param name="s_FcConfig"></param> /// <param name="oFormsFolderPath"></param> /// <param name="owner_MemoryApplication"></param> /// <param name="log_Reports"></param> public void XmlToConfigurationtree( string sName_Control, string sFpathH_F, string sFpatha_F, Configurationtree_Node cf_ControlConfig, Expression_Node_Filepath ec_Fopath_Forms, MemoryApplication owner_MemoryApplication, Log_Reports log_Reports ) { Log_Method log_Method = new Log_MethodImpl(0, Log_ReportsImpl.BDebugmode_Static); log_Method.BeginMethod(Info_XmlToConf.Name_Library, this, "XToCf", log_Reports); // // System.Xml.XmlDocument xDoc = null; Exception err_Excp = null; if (log_Reports.Successful) { // 正常時 xDoc = new System.Xml.XmlDocument(); if (System.IO.File.Exists(sFpatha_F)) { try { xDoc.Load(sFpatha_F); } catch (System.IO.IOException ex) { // // エラー。 err_Excp = ex; goto gt_Error_IoException; } catch (System.Xml.XmlException ex) { // // エラー。 err_Excp = ex; goto gt_Error_XmlException; } catch (Exception ex) { // // エラー。 err_Excp = ex; goto gt_Error_Exception01; } } else { // エラー。 goto gt_Error_NotFoundFile; } } // // コントロール自体は、Aa_Forms.csvを読み取って // 既に追加済みです。 XmlElement err_XElm = null; if (log_Reports.Successful) { // 正常時 XmlToConfigurationtree_C12_ControlImpl_ to = new XmlToConfigurationtree_C12_ControlImpl_(); try { // ルート要素を取得 System.Xml.XmlElement xRoot = xDoc.DocumentElement; // <scriptfile-controls scriptfile-version=”1.0”> を期待。 if (NamesNode.S_CODEFILE_CONTROLS != xRoot.Name) { //エラー err_XElm = xRoot; goto gt_Error_Root; } // スクリプトファイルのバージョンチェック。(コントロール設定ファイル) ValuesAttr.Test_Codefileversion( xRoot.GetAttribute(PmNames.S_CODEFILE_VERSION.Name_Attribute), log_Reports, cf_ControlConfig, NamesNode.S_CODEFILE_CONTROLS ); // ルート要素の下の子<control>要素 XmlNodeList xNl_Top = xRoot.ChildNodes; foreach (XmlNode xTopNode in xNl_Top) { if (XmlNodeType.Element == xTopNode.NodeType) { XmlElement xTop = (XmlElement)xTopNode; if (NamesNode.S_CONTROL1 == xTop.Name) { to.XmlToConfigurationtree( sName_Control, cf_ControlConfig, xTop, owner_MemoryApplication, log_Reports ); } else { // // エラー。 err_XElm = xTop; goto gt_Error_UndefinedChildElement; } } } } catch (Exception ex) { // // エラー。 err_Excp = ex; goto gt_Error_Exception02; } } goto gt_EndMethod; // // #region 異常系 //──────────────────────────────────────── gt_Error_Root: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, NamesNode.S_CODEFILE_CONTROLS, log_Reports); //期待したルート要素名 tmpl.SetParameter(2, err_XElm.Name, log_Reports); //実際のルート要素名 tmpl.SetParameter(3, sFpatha_F, log_Reports); //コントロール設定絶対ファイルパス tmpl.SetParameter(4, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports); //例外メッセージ owner_MemoryApplication.CreateErrorReport("Er:8010;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_NotFoundFile: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sName_Control, log_Reports); //コントロール名 tmpl.SetParameter(2, ec_Fopath_Forms.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports), log_Reports); //Formsフォルダーパス tmpl.SetParameter(3, sFpathH_F, log_Reports); //コントロール設定ファイル(入力ママ) tmpl.SetParameter(4, sFpatha_F, log_Reports); //コントロール設定ファイル絶対パス(Formsフォルダーと結合後) tmpl.SetParameter(5, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports); //例外メッセージ owner_MemoryApplication.CreateErrorReport("Er:8011;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_IoException: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sName_Control, log_Reports); //コントロール名 tmpl.SetParameter(2, ec_Fopath_Forms.Execute4_OnExpressionString(EnumHitcount.Unconstraint, log_Reports), log_Reports); //Formsフォルダーパス tmpl.SetParameter(3, sFpathH_F, log_Reports); //コントロール設定ファイル(入力ママ) tmpl.SetParameter(4, sFpatha_F, log_Reports); //コントロール設定ファイル絶対パス(Formsフォルダーと結合後) tmpl.SetParameter(5, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports); //例外メッセージ owner_MemoryApplication.CreateErrorReport("Er:8012;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_XmlException: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, sFpatha_F, log_Reports); //コントロール設定ファイル絶対パス(Formsフォルダーと結合後) tmpl.SetParameter(2, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports); //例外メッセージ owner_MemoryApplication.CreateErrorReport("Er:8013;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_Exception01: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports);//例外メッセージ owner_MemoryApplication.CreateErrorReport("Er:8014;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_Exception02: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, Log_RecordReportsImpl.ToText_Exception(err_Excp), log_Reports);//例外メッセージ owner_MemoryApplication.CreateErrorReport("Er:8015;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── gt_Error_UndefinedChildElement: { Builder_TexttemplateP1p tmpl = new Builder_TexttemplateP1pImpl(); tmpl.SetParameter(1, NamesNode.S_CONTROL1, log_Reports); //期待するノード名 tmpl.SetParameter(2, err_XElm.Name, log_Reports); //実際のノード名 owner_MemoryApplication.CreateErrorReport("Er:8016;", tmpl, log_Reports); } goto gt_EndMethod; //──────────────────────────────────────── #endregion // // gt_EndMethod: log_Method.EndMethod(log_Reports); }
/// <summary> /// Load state from an XML element /// </summary> /// <param name="xmlElement">XML element containing new state</param> public void LoadXml(System.Xml.XmlElement xmlElement) { XmlNamespaceManager xmlNamespaceManager; XmlNodeList xmlNodeList; IEnumerator enumerator; XmlElement iterationXmlElement; EncapsulatedX509Certificate newEncapsulatedX509Certificate; OtherCertificate newOtherCertificate; if (xmlElement == null) { throw new ArgumentNullException("xmlElement"); } if (xmlElement.HasAttribute("Id")) { this.id = xmlElement.GetAttribute("Id"); } else { this.id = ""; } xmlNamespaceManager = new XmlNamespaceManager(xmlElement.OwnerDocument.NameTable); xmlNamespaceManager.AddNamespace("xades", XadesSignedXml.XadesNamespaceUri); this.encapsulatedX509CertificateCollection.Clear(); this.otherCertificateCollection.Clear(); xmlNodeList = xmlElement.SelectNodes("xades:EncapsulatedX509Certificate", xmlNamespaceManager); enumerator = xmlNodeList.GetEnumerator(); try { while (enumerator.MoveNext()) { iterationXmlElement = enumerator.Current as XmlElement; if (iterationXmlElement != null) { newEncapsulatedX509Certificate = new EncapsulatedX509Certificate(); newEncapsulatedX509Certificate.LoadXml(iterationXmlElement); this.encapsulatedX509CertificateCollection.Add(newEncapsulatedX509Certificate); } } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } xmlNodeList = xmlElement.SelectNodes("xades:OtherCertificate", xmlNamespaceManager); enumerator = xmlNodeList.GetEnumerator(); try { while (enumerator.MoveNext()) { iterationXmlElement = enumerator.Current as XmlElement; if (iterationXmlElement != null) { newOtherCertificate = new OtherCertificate(); newOtherCertificate.LoadXml(iterationXmlElement); this.otherCertificateCollection.Add(newOtherCertificate); } } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } }
/// <summary> /// Deserializes teh WaitForFile settings from XML /// </summary> /// <param name="node"></param> /// <param name="infoEvents"></param> void IDTSComponentPersist.LoadFromXML(System.Xml.XmlElement node, IDTSInfoEvents infoEvents) { if (node.Name == "WaitForFilesData") { if (node.HasAttributes) // new Format; { WaitForFile.ChekFileType chType; if (Enum.TryParse <WaitForFile.ChekFileType>(node.GetAttribute("checkType"), out chType)) { this.CheckType = chType; } else { infoEvents.FireError(0, Resources.WaitForFileTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "CheckType", node.GetAttribute("checkType")), string.Empty, 0); } WaitForFile.FileExistenceType existenceType; if (Enum.TryParse <WaitForFile.FileExistenceType>(node.GetAttribute("existenceType"), out existenceType)) { this.ExistenceType = existenceType; } else { infoEvents.FireError(0, Resources.WaitForFileTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "ExistenceType", node.GetAttribute("existenceType")), string.Empty, 0); } TimeSpan ts; if (TimeSpan.TryParse(node.GetAttribute("checkTimeoutInterval"), out ts)) { this.checkTimeoutInterval = ts; } else { infoEvents.FireError(0, Resources.WaitForFileTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "CheckTimeout", node.GetAttribute("checkTimeoutInterval")), string.Empty, 0); } TimeSpan tst; if (TimeSpan.TryParse(node.GetAttribute("checkTimeoutTime"), out tst)) { this.checkTimeoutTime = tst; } else { infoEvents.FireError(0, Resources.WaitForFileTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "CheckTimeout", node.GetAttribute("checkTimeoutTime")), string.Empty, 0); } int chkInterval; if (int.TryParse(node.GetAttribute("checkInterval"), out chkInterval)) { this.CheckInterval = chkInterval; } else { infoEvents.FireError(0, Resources.WaitForFileTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "CheckInterval", node.GetAttribute("checkInterval")), string.Empty, 0); } bool timeoutNextDay; if (bool.TryParse(node.GetAttribute("timeoutNextDayIfTimePassed"), out timeoutNextDay)) { this.TimeoutNextDayIfTimePassed = timeoutNextDay; } else { infoEvents.FireError(0, Resources.WaitForFileTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "TimeoutNextDayIfTimePassed", node.GetAttribute("timeoutNextDayIfTimePassed")), string.Empty, 0); } foreach (XmlElement nodeData in node.ChildNodes) { if (nodeData.Name == "checkFiles") { List <string> fls = new List <string>(); foreach (XmlElement nd in nodeData.ChildNodes) { if (nd.Name == "file") { fls.Add(nd.GetAttribute("name")); } } FilesToCheck = string.Join <string>("|", fls); } } } else //old format { foreach (XmlNode nodeData in node.ChildNodes) { switch (nodeData.Name) { case "checkType": WaitForFile.ChekFileType chType; if (Enum.TryParse <WaitForFile.ChekFileType>(nodeData.InnerText, out chType)) { this.CheckType = chType; } else { infoEvents.FireError(0, Resources.WaitForFileTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "CheckType", node.InnerText), string.Empty, 0); } break; case "existenceType": WaitForFile.FileExistenceType existenceType; if (Enum.TryParse <WaitForFile.FileExistenceType>(nodeData.InnerText, out existenceType)) { this.ExistenceType = existenceType; } else { infoEvents.FireError(0, Resources.WaitForFileTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "ExistenceType", node.InnerText), string.Empty, 0); } break; case "checkTimeoutInterval": TimeSpan ts; if (TimeSpan.TryParse(nodeData.InnerText, out ts)) { this.checkTimeoutInterval = ts; } else { infoEvents.FireError(0, Resources.WaitForFileTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "CheckTimeout", node.InnerText), string.Empty, 0); } break; case "checkTimeoutTime": TimeSpan tst; if (TimeSpan.TryParse(nodeData.InnerText, out tst)) { this.checkTimeoutTime = tst; } else { infoEvents.FireError(0, Resources.WaitForFileTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "CheckTimeout", node.InnerText), string.Empty, 0); } break; case "checkInterval": int chkInterval; if (int.TryParse(nodeData.InnerText, out chkInterval)) { this.CheckInterval = chkInterval; } else { infoEvents.FireError(0, Resources.WaitForFileTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "CheckInterval", node.InnerText), string.Empty, 0); } break; case "timeoutNextDayIfTimePassed": bool timeoutNextDay; if (bool.TryParse(nodeData.InnerText, out timeoutNextDay)) { this.TimeoutNextDayIfTimePassed = timeoutNextDay; } else { infoEvents.FireError(0, Resources.WaitForFileTaskName, string.Format(Resources.ErrorCouldNotDeserializeProperty, "TimeoutNextDayIfTimePassed", node.InnerText), string.Empty, 0); } break; case "checkFiles": List <string> fls = new List <string>(); foreach (XmlNode nd in nodeData.ChildNodes) { if (nd.Name == "file") { fls.Add(nd.InnerText); } } FilesToCheck = string.Join <string>("|", fls); break; } } } } }
/// <summary> /// Loads settings from XML. /// </summary> /// <param name="node">The node.</param> /// <param name="infoEvents">The info events.</param> /// <exception cref="System.Exception"></exception> void IDTSComponentPersist.LoadFromXML(System.Xml.XmlElement node, IDTSInfoEvents infoEvents) { try { // This might occur if the task's XML has been modified outside of the Business Intelligence // Or SQL Server Workbenches. if (node.Name != "ZipTask") { throw new Exception(string.Format("Unexpected task element when loading task - {0}.", "ZipTask")); } else { // let error bubble up // populate the private property variables with values from the DTS node. this.fileAction = (ZipFileAction)Enum.Parse(typeof(ZipFileAction), node.Attributes.GetNamedItem(CONSTANTS.ZIPFILEACTION).Value); this.compressionType = (CompressionType)Enum.Parse(typeof(CompressionType), node.Attributes.GetNamedItem(CONSTANTS.ZIPCOMPRESSIONTYPE).Value); this.zipCompressionLevel = (ZipCompressionLevel)Enum.Parse(typeof(ZipCompressionLevel), node.Attributes.GetNamedItem(CONSTANTS.ZIPCOMPRESSIONLEVEL).Value); this.tarCompressionLevel = (TarCompressionLevel)Enum.Parse(typeof(TarCompressionLevel), node.Attributes.GetNamedItem(CONSTANTS.TARCOMPRESSIONLEVEL).Value); this.sourceFile = node.Attributes.GetNamedItem(CONSTANTS.ZIPSOURCE).Value; this.zipPassword = node.Attributes.GetNamedItem(CONSTANTS.ZIPPASSWORD).Value; this.targetFile = node.Attributes.GetNamedItem(CONSTANTS.ZIPTARGET).Value; this.removeSource = bool.Parse(node.Attributes.GetNamedItem(CONSTANTS.ZIPREMOVESOURCE).Value); this.recursive = bool.Parse(node.Attributes.GetNamedItem(CONSTANTS.ZIPRECURSIVE).Value); this.overwriteTarget = bool.Parse(node.Attributes.GetNamedItem(CONSTANTS.ZIPOVERWRITE).Value); this.fileFilter = node.Attributes.GetNamedItem(CONSTANTS.ZIPFILEFILTER).Value; this.logLevel = (LogLevel)Enum.Parse(typeof(LogLevel), node.GetAttribute(CONSTANTS.SFTPLOGLEVEL, String.Empty)); } } catch (Exception ex) { infoEvents.FireError(0, "Load From XML: ", ex.Message, "", 0); } }
/// <summary> /// Load state from an XML element /// </summary> /// <param name="xmlElement">XML element containing new state</param> public void LoadXml(System.Xml.XmlElement xmlElement) { if (xmlElement == null) { throw new ArgumentNullException("xmlElement"); } if (xmlElement.HasAttribute("Qualifier")) { this.qualifier = (KnownQualifier)KnownQualifier.Parse(typeof(KnownQualifier), xmlElement.GetAttribute("Qualifier"), true); } else { this.qualifier = KnownQualifier.Uninitalized; } this.identifierUri = xmlElement.InnerText; }
public override void LoadData(System.Xml.XmlElement element) { base.LoadData(element); m_effect_id = GameConvert.IntConvert(element.GetAttribute("EffectID")); m_level_destory = GameConvert.BoolConvert(element.GetAttribute("Desotry")); }
public Project CreateProject(ProjectCreateInformation info, System.Xml.XmlElement projectOptions) { string lang = projectOptions.GetAttribute("language"); return(new MonoGameContentProject(lang, info, projectOptions)); }
public override void OnClick() { Exception eError = null; OpenFileDialog OpenFile = new OpenFileDialog(); OpenFile.CheckFileExists = true; OpenFile.CheckPathExists = true; OpenFile.Title = "选择栅格数据"; OpenFile.Filter = "tif数据(*.tif)|*.tif|img数据(*.img)|*.img"; OpenFile.Multiselect = true; if (OpenFile.ShowDialog() == DialogResult.OK) { string[] fileArr = OpenFile.FileNames; ///获得树图上选择的工程节点 //cyf 20110626 modify DevComponents.AdvTree.Node pCurNode = m_Hook.ProjectTree.SelectedNode; //当前树节点,栅格数据节点 DevComponents.AdvTree.Node pDBProNode = m_Hook.ProjectTree.SelectedNode; //获得工程树图节点 while (pDBProNode.Parent != null) { pDBProNode = pDBProNode.Parent; } if (pDBProNode.DataKeyString != "project") { SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "获取工程树图节点失败!"); return; } //end //cyf 20110609 modify: //string pProjectname = pCurNode.Name; string pProjectname = pDBProNode.Text; //end System.Xml.XmlNode Projectnode = m_Hook.DBXmlDocument.SelectSingleNode("工程管理/工程[@名称='" + pProjectname + "']"); //cyf if (Projectnode == null) { return; } //end //cyf 20110626 modify:获取栅格数据图层的存储类型 //获得栅格数据库类型 //System.Xml.XmlElement DbTypeElem = Projectnode.SelectSingleNode(".//内容//栅格数据库") as System.Xml.XmlElement; //string dbType = DbTypeElem.GetAttribute("存储类型"); //栅格编目、栅格数据集 XmlElement pCurElem = null; //图层xml节点 try { pCurElem = pCurNode.Tag as XmlElement; } catch { } if (pCurElem == null) { SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "获取图层xml节点失败!"); return; } string dbType = pCurElem.GetAttribute("存储类型").Trim(); //栅格数据存储类型 string pDesRasterCollName = pCurElem.GetAttribute("名称").Trim(); //栅格数据名称 //获得栅格目录,栅格数据集名称 //System.Xml.XmlElement DbcataLogNameElem = Projectnode.SelectSingleNode(".//栅格数据库/连接信息/库体") as System.Xml.XmlElement; //if (DbcataLogNameElem == null) return; //string pDesRasterCollName = DbcataLogNameElem.GetAttribute("名称"); //栅格数据名称 //if (pDesRasterCollName == "") return; //end //获得连接信息 System.Xml.XmlElement DbConnElem = Projectnode.SelectSingleNode(".//栅格数据库/连接信息") as System.Xml.XmlElement; string pType = DbConnElem.GetAttribute("类型"); string pServer = DbConnElem.GetAttribute("服务器"); string pInstance = DbConnElem.GetAttribute("服务名"); string pDataBase = DbConnElem.GetAttribute("数据库"); string pUser = DbConnElem.GetAttribute("用户"); string pPassword = DbConnElem.GetAttribute("密码"); string pVersion = DbConnElem.GetAttribute("版本"); //cyf 20110609 add string pConnectInfo = ""; //连接信息字符串 pConnectInfo = pType + "|" + pServer + "|" + pInstance + "|" + pDataBase + "|" + pUser + "|" + pPassword + "|" + pVersion; //end //获得目标数据库的参数 //System.Xml.XmlElement DbParaElem = Projectnode.SelectSingleNode(".//栅格数据库/参数设置") as System.Xml.XmlElement; //string resampleTypeStr = DbParaElem.GetAttribute("重采样类型"); //string compressionTypeStr = DbParaElem.GetAttribute("压缩类型"); //string pyramid = DbParaElem.GetAttribute("金字塔"); //string tileH = DbParaElem.GetAttribute("瓦片高度"); //string tileW = DbParaElem.GetAttribute("瓦片宽度"); //string bandNum = DbParaElem.GetAttribute("波段"); //rstResamplingTypes resampleType = GetResampleTpe(resampleTypeStr); //esriRasterCompressionType compressionType = GetCompression(compressionTypeStr); //if (tileH == "") //{ // tileH = "128"; //} //if (tileW == "") //{ // tileW = "128"; //} //if (pyramid == "") //{ // pyramid = "6"; //} //设置数据库连接信息 SysCommon.Gis.SysGisDataSet pSysDt = new SysCommon.Gis.SysGisDataSet(); if (pType.ToUpper() == "PDB") { pSysDt.SetWorkspace(pDataBase, SysCommon.enumWSType.PDB, out eError); } else if (pType.ToUpper() == "GDB") { pSysDt.SetWorkspace(pDataBase, SysCommon.enumWSType.GDB, out eError); } else if (pType.ToUpper() == "SDE") { pSysDt.SetWorkspace(pServer, pInstance, "", pUser, pPassword, pVersion, out eError); pDesRasterCollName = pUser + "." + pDesRasterCollName; } if (eError != null) { SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "连接数据库失败!"); return; } //Thread aThread = null; //cyf 20110609 add:读取栅格数据入库日志,检查是否存在已经入库的数据 SysCommon.DataBase.SysTable pSysTable = null; Dictionary <string, string> DicbeInDb = new Dictionary <string, string>(); //用来已经入库的栅格数据的源路径和目标连接信息 if (File.Exists(ModData.RasterInDBLog)) { //若存在栅格数据入库日志,则将入库过的数据的路径保存起来 pSysTable = new SysCommon.DataBase.SysTable(); pSysTable.SetDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + ModData.RasterInDBLog + ";Persist Security Info=True", SysCommon.enumDBConType.OLEDB, SysCommon.enumDBType.ACCESS, out eError); if (eError != null) { SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "连接栅格入库日志表失败!"); return; } //获得栅格入库日志表 DataTable pTable = pSysTable.GetTable("rasterfileinfo", out eError); if (eError != null) { SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "获取栅格入库日志表失败!"); pSysTable.CloseDbConnection(); return; } for (int i = 0; i < pTable.Rows.Count; i++) { string pFileName = pTable.Rows[i][0].ToString(); string pDesPath = pTable.Rows[i][3].ToString(); if (!DicbeInDb.ContainsKey(pFileName)) { DicbeInDb.Add(pFileName, pDesPath); } } //关闭连接 pSysTable.CloseDbConnection(); //cyf 20110610 modify if (pTable.Rows.Count > 0) { //存在已经入库的数据 RasterErrInfoFrm pRasterErrInfoFrm = new RasterErrInfoFrm(pTable); if (pRasterErrInfoFrm.ShowDialog() != DialogResult.OK) { //若不继续入库,则返回 return; } } //end } //end ///进行数据入库 //cyf 20110609 //连接栅格数据入库日志表 if (!File.Exists(ModData.RasterInDBLog)) { if (File.Exists(ModData.RasterInDBTemp)) { File.Copy(ModData.RasterInDBTemp, ModData.RasterInDBLog); } SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "没有找到日志表模板:" + ModData.RasterInDBTemp); return; } pSysTable = new SysCommon.DataBase.SysTable(); pSysTable.SetDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + ModData.RasterInDBLog + ";Persist Security Info=True", SysCommon.enumDBConType.OLEDB, SysCommon.enumDBType.ACCESS, out eError); if (eError != null) { SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "连接栅格入库日志表失败!"); return; } //添加进度条 if (pAppFormRef.ProgressBar != null) { pAppFormRef.ProgressBar.Visible = true; pAppFormRef.ProgressBar.Maximum = fileArr.Length; pAppFormRef.ProgressBar.Minimum = 0; pAppFormRef.ProgressBar.Value = 0; Application.DoEvents(); } //end //List<string> fileList = new List<string>(); //要进行入库的文件名 for (int i = 0; i < fileArr.Length; i++) { //if (!fileList.Contains(fileArr[i])) //{ // fileList.Add(fileArr[i]); //} //cyf 20110609 add:对入库过的数据进行判断和筛选 if (DicbeInDb.ContainsKey(fileArr[i])) { //已经进行入库 if (DicbeInDb[fileArr[i]] == pConnectInfo) { //如果源的路径与目标的路径都相同,则说明已经入库了 //进度条加1 if (pAppFormRef.ProgressBar != null) { pAppFormRef.ProgressBar.Value++; Application.DoEvents(); } continue; } } //end //cyf 20110610 add:文字提示 if (pAppFormRef != null) { pAppFormRef.OperatorTips = "正在进行数据" + fileArr[i] + "入库..."; Application.DoEvents(); } //end //cyf 20110610 adds string Starime = DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString(); //开始时间 //end string fileFullName = fileArr[i]; if (dbType == "栅格数据集") { //栅格数据集入库 InputRasterDataset(pDesRasterCollName, fileFullName, pSysDt.WorkSpace, out eError); } else if (dbType == "栅格编目") { //栅格编目数据入库 InputRasterCatalogData(pDesRasterCollName, fileFullName, pSysDt.WorkSpace, out eError); } if (eError != null) { SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("错误", "栅格数据入库出错!\n" + eError.Message); return; } //若入库成功后,更新则将入库成功的数据添加到栅格数据日志表中 //cyf 20110609 插入栅格数据日志表中 string insertStr = "insert into rasterfileinfo values('" + fileArr[i] + "','" + Starime + "','" + DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString() + "','" + pConnectInfo + "')"; pSysTable.UpdateTable(insertStr, out eError); if (eError != null) { SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "插入栅格入库日志表失败!"); continue; } //进度条加1 if (pAppFormRef.ProgressBar != null) { pAppFormRef.ProgressBar.Value++; Application.DoEvents(); } //end } //cyf 20110609 add: //关闭连接 pSysTable.CloseDbConnection(); //end //if (dbType == "栅格编目") //{ // InputRasterCatalogData(pDesRasterCollName, fileList, pSysDt.WorkSpace, out eError); //} SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "栅格数据入库完成!"); //cyf 20110609 add if (pAppFormRef.ProgressBar != null) { pAppFormRef.ProgressBar.Visible = false; //cyf 20110610 add:清空文字提示 pAppFormRef.OperatorTips = ""; //end } //end //cyf 20110610 add:栅格正常结束的日志 if (File.Exists(ModData.RasterInDBLog)) { //File.Delete(ModData.RasterInDBLog); } //end } }