Inheritance: XmlLinkedNode
Beispiel #1
1
 public GObjectVM(XmlElement elem, ObjectBase container_type)
     : base(elem, container_type)
 {
     parms.HideData = false;
     this.Protection = "protected";
     class_struct_name = container_type.ClassStructName;
 }
        public virtual Filter GetFilter(XmlElement e)
        {
            string fieldName = DOMUtils.GetAttributeWithInheritanceOrFail(e, "fieldName");
            DuplicateFilter df = new DuplicateFilter(fieldName);

            string keepMode = DOMUtils.GetAttribute(e, "keepMode", "first");
            if (keepMode.Equals("first", StringComparison.OrdinalIgnoreCase))
            {
                df.KeepMode = KeepMode.KM_USE_FIRST_OCCURRENCE;
            }
            else if (keepMode.Equals("last", StringComparison.OrdinalIgnoreCase))
            {
                df.KeepMode = KeepMode.KM_USE_LAST_OCCURRENCE;
            }
            else
            {
                throw new ParserException("Illegal keepMode attribute in DuplicateFilter:" + keepMode);
            }

            string processingMode = DOMUtils.GetAttribute(e, "processingMode", "full");
            if (processingMode.Equals("full", StringComparison.OrdinalIgnoreCase))
            {
                df.ProcessingMode = ProcessingMode.PM_FULL_VALIDATION;
            }
            else if (processingMode.Equals("fast", StringComparison.OrdinalIgnoreCase))
            {
                df.ProcessingMode = ProcessingMode.PM_FAST_INVALIDATION;
            }
            else
            {
                throw new ParserException("Illegal processingMode attribute in DuplicateFilter:" + processingMode);
            }

            return df;
        }
 public static ProjectTemplatePackageReference Create(XmlElement xmlElement)
 {
     return new ProjectTemplatePackageReference {
         Id = GetAttribute (xmlElement, "id"),
         Version = GetAttribute (xmlElement, "version")
     };
 }
		LayoutConfiguration(XmlElement el, bool custom)
		{
			name       = el.GetAttribute("name");
			fileName   = el.GetAttribute("file");
			readOnly   = Boolean.Parse(el.GetAttribute("readonly"));
			this.custom = custom;
		}
Beispiel #5
1
        private string getNodeValue(XmlElement parentElement, string nodeName)
        {
            XmlNode node = XmlHelperFunctions.GetSubNode(parentElement, nodeName);
              if (node == null) return string.Empty;

              return node.InnerText;
        }
Beispiel #6
1
        /// <summary>
        /// 递归函数,根据规则依次调整每个Mind位置
        /// </summary>
        /// <param name="xmle">当前节点</param>
        /// <param name="point">当前节点位置</param>
        /// <returns>调整后当前节点大小和位置</returns>
        private Point Recursion_AdjustMindModel(XmlElement xmle, Point point)
        {
            // 本级区域
            Rectangle rect = new Rectangle(point, new Size(20 * xmle.GetAttribute("key").Length, 20));
            // 下一个子集定位点
            Point nextChildPoint = new Point(rect.Right, rect.Top);
            // 下一个本级定位点
            Point nextPoint = new Point(rect.Left, rect.Bottom);

            if (xmle.HasChildNodes)
            {
                foreach (XmlElement txmle in xmle.ChildNodes)
                {
                    nextChildPoint = Recursion_AdjustMindModel(txmle, nextChildPoint);
                    nextPoint.Y = nextChildPoint.Y;
                }
                Rectangle firstChildRect = MindConvert.StringToRectangle(((XmlElement)xmle.FirstChild).GetAttribute("region"));
                Rectangle lastChildRect = MindConvert.StringToRectangle(((XmlElement)xmle.LastChild).GetAttribute("region"));
                rect.Offset(0, (lastChildRect.Top + firstChildRect.Top) / 2 - rect.Top);
            }

            xmle.SetAttribute("region", MindConvert.RectangleToString(rect));

            return nextPoint;
        }
        protected override void DoParse(XmlElement element, ParserContext parserContext, ObjectDefinitionBuilder builder)
        {

            builder.AddPropertyReference(TxNamespaceUtils.TRANSACTION_MANAGER_PROPERTY,
                GetAttributeValue(element, TxNamespaceUtils.TRANSACTION_MANAGER_ATTRIBUTE));
            XmlNodeList txAttributes = element.SelectNodes("*[local-name()='attributes' and namespace-uri()='" + element.NamespaceURI + "']");
            if (txAttributes.Count > 1 )
            {
                parserContext.ReaderContext.ReportException(element, "tx advice", "Element <attributes> is allowed at most once inside element <advice>");
            }
            else if (txAttributes.Count == 1)
            {
                //using xml defined source
                XmlElement attributeSourceElement = txAttributes[0] as XmlElement;
                AbstractObjectDefinition attributeSourceDefinition =
                    ParseAttributeSource(attributeSourceElement, parserContext);
                builder.AddPropertyValue(TxNamespaceUtils.TRANSACTION_ATTRIBUTE_SOURCE, attributeSourceDefinition);
            }
            else
            {
                //Assume attibutes source
                ObjectDefinitionBuilder txAttributeSourceBuilder = 
                    parserContext.ParserHelper.CreateRootObjectDefinitionBuilder(typeof (AttributesTransactionAttributeSource));

                builder.AddPropertyValue(TxNamespaceUtils.TRANSACTION_ATTRIBUTE_SOURCE,
                                         txAttributeSourceBuilder.ObjectDefinition);

            }
        }
Beispiel #8
1
 // Constructor
 public CssStylesheet(XmlElement htmlElement)
 {
     if (htmlElement != null)
     {
         this.DiscoverStyleDefinitions(htmlElement);
     }
 }
Beispiel #9
1
        protected override void SaveNode(XmlDocument xmlDoc, XmlElement nodeElement, SaveContext context)
        {
            Controller.SaveNode(xmlDoc, nodeElement, context);
            
            var outEl = xmlDoc.CreateElement("Name");
            outEl.SetAttribute("value", NickName);
            nodeElement.AppendChild(outEl);

            outEl = xmlDoc.CreateElement("Description");
            outEl.SetAttribute("value", Description);
            nodeElement.AppendChild(outEl);

            outEl = xmlDoc.CreateElement("Inputs");
            foreach (string input in InPortData.Select(x => x.NickName))
            {
                XmlElement inputEl = xmlDoc.CreateElement("Input");
                inputEl.SetAttribute("value", input);
                outEl.AppendChild(inputEl);
            }
            nodeElement.AppendChild(outEl);

            outEl = xmlDoc.CreateElement("Outputs");
            foreach (string output in OutPortData.Select(x => x.NickName))
            {
                XmlElement outputEl = xmlDoc.CreateElement("Output");
                outputEl.SetAttribute("value", output);
                outEl.AppendChild(outputEl);
            }
            nodeElement.AppendChild(outEl);
        }
        public ManagedProjectReference(XmlElement xmlDefinition, ReferencesResolver referencesResolver, ProjectBase parent, SolutionBase solution, TempFileCollection tfc, GacCache gacCache, DirectoryInfo outputDir)
            : base(referencesResolver, parent)
        {
            if (xmlDefinition == null) {
                throw new ArgumentNullException("xmlDefinition");
            }
            if (solution == null) {
                throw new ArgumentNullException("solution");
            }
            if (tfc == null) {
                throw new ArgumentNullException("tfc");
            }
            if (gacCache == null) {
                throw new ArgumentNullException("gacCache");
            }

            XmlAttribute privateAttribute = xmlDefinition.Attributes["Private"];
            if (privateAttribute != null) {
                _isPrivateSpecified = true;
                _isPrivate = bool.Parse(privateAttribute.Value);
            }

            // determine path of project file
            string projectFile = solution.GetProjectFileFromGuid(
                xmlDefinition.GetAttribute("Project"));

            // load referenced project
            _project = LoadProject(solution, tfc, gacCache, outputDir, projectFile);
        }
 public DocumentXPathNavigator(DocumentXPathNavigator other)
 {
     _document = other._document;
     _source = other._source;
     _attributeIndex = other._attributeIndex;
     _namespaceParent = other._namespaceParent;
 }
Beispiel #12
1
 protected ContentControl(GuiSystem guiSystem, XmlElement element) : base(guiSystem, element)
 {
     if (element.HasChildNodes)
     {
         Child = CreateFromXmlType(guiSystem, (XmlElement)element.FirstChild);
     }
 }
Beispiel #13
1
		internal XmlAttributeCollection (XmlNode parent) : base (parent)
		{
			ownerElement = parent as XmlElement;
			ownerDocument = parent.OwnerDocument;
			if(ownerElement == null)
				throw new XmlException ("invalid construction for XmlAttributeCollection.");
		}
		internal XmlElementEventArgs(XmlElement attr, int lineNum, int linePos, object source)
		{
			this.attr		= attr;
			this.lineNumber = lineNum;
			this.linePosition = linePos;
			this.obj		= source;
		}
        protected override void AddCompositeIdGenerator(XmlDocument xmldoc, XmlElement idElement, List<ColumnDetail> compositeKey, ApplicationPreferences applicationPreferences)
        {
            foreach (ColumnDetail column in compositeKey)
            {
                var keyElement = xmldoc.CreateElement("key-property");
                string propertyName =
                    column.ColumnName.GetPreferenceFormattedText(applicationPreferences);

                if (applicationPreferences.FieldGenerationConvention == FieldGenerationConvention.Property)
                {
                    idElement.SetAttribute("name", propertyName.MakeFirstCharLowerCase());
                }
                else
                {
                    if (applicationPreferences.FieldGenerationConvention == FieldGenerationConvention.AutoProperty)
                    {
                        propertyName = column.ColumnName.GetFormattedText();
                    }

                    keyElement.SetAttribute("name", propertyName);
                }
                var mapper = new DataTypeMapper();
                Type mapFromDbType = mapper.MapFromDBType(column.DataType, column.DataLength,
                                                          column.DataPrecision,
                                                          column.DataScale);
                keyElement.SetAttribute("type", mapFromDbType.Name);
                keyElement.SetAttribute("column", column.ColumnName);
                if (applicationPreferences.FieldGenerationConvention != FieldGenerationConvention.AutoProperty)
                {
                    keyElement.SetAttribute("access", "field");
                }
                idElement.AppendChild(keyElement);
            }
        }
Beispiel #16
1
		internal BuildItemGroup (XmlElement xmlElement, Project project, ImportedProject importedProject, bool readOnly, bool dynamic)
		{
			this.buildItems = new List <BuildItem> ();
			this.importedProject = importedProject;
			this.itemGroupElement = xmlElement;
			this.parentProject = project;
			this.read_only = readOnly;
			this.isDynamic = dynamic;
			
			if (!FromXml)
				return;

			foreach (XmlNode xn in xmlElement.ChildNodes) {
				if (!(xn is XmlElement))
					continue;
					
				XmlElement xe = (XmlElement) xn;
				BuildItem bi = CreateItem (project, xe);
				buildItems.Add (bi);
				project.LastItemGroupContaining [bi.Name] = this;
			}

			DefinedInFileName = importedProject != null ? importedProject.FullFileName :
						project != null ? project.FullFileName : null;
		}
Beispiel #17
1
        public static void Load( XmlElement xml )
        {
            DisableAll();

            if ( xml == null )
                return;

            foreach( XmlElement el in xml.GetElementsByTagName( "filter" ) )
            {
                try
                {
                    LocString name = (LocString)Convert.ToInt32( el.GetAttribute( "name" ) );
                    string enable = el.GetAttribute( "enable" );

                    for(int i=0;i<m_Filters.Count;i++)
                    {
                        Filter f = (Filter)m_Filters[i];
                        if ( f.Name == name )
                        {
                            if ( Convert.ToBoolean( enable ) )
                                f.OnEnable();
                            break;
                        }
                    }
                }
                catch
                {
                }
            }
        }
Beispiel #18
1
        public static void Config(XmlElement
		    xmlElement, ref LogConfig logConfig, bool compulsory)
        {
            uint uintValue = new uint();
            int intValue = new int();

            Configuration.ConfigBool(xmlElement, "AutoRemove",
                ref logConfig.AutoRemove, compulsory);
            if (Configuration.ConfigUint(xmlElement, "BufferSize",
                ref uintValue, compulsory))
                logConfig.BufferSize = uintValue;
            Configuration.ConfigString(xmlElement, "Dir",
                ref logConfig.Dir, compulsory);
            if (Configuration.ConfigInt(xmlElement, "FileMode",
                ref intValue, compulsory))
                logConfig.FileMode = intValue;
            Configuration.ConfigBool(xmlElement, "ForceSync",
                ref logConfig.ForceSync, compulsory);
            Configuration.ConfigBool(xmlElement, "InMemory",
                ref logConfig.InMemory, compulsory);
            if (Configuration.ConfigUint(xmlElement, "MaxFileSize",
                ref uintValue, compulsory))
                logConfig.MaxFileSize = uintValue;
            Configuration.ConfigBool(xmlElement, "NoBuffer",
                ref logConfig.NoBuffer, compulsory);
            if (Configuration.ConfigUint(xmlElement, "RegionSize",
                ref uintValue, compulsory))
                logConfig.RegionSize = uintValue;
            Configuration.ConfigBool(xmlElement, "ZeroOnCreate",
                ref logConfig.ZeroOnCreate, compulsory);
        }
 internal ProjectHandler(string name, DevSiteLoginInfo info)
 {
     this.Name = name;
     DevConnection = info.TryConnect();
     DevSite = info;
     Preference = GetProjectPreference();
 }
 public void CreateXmlElement()
 {
     XmlDocument xmlDoc = new XmlDocument();
     string xmlData = "<objects xmlns=\"http://www.springframework.net\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.springframework.net http://www.springframework.net/xsd/spring-objects.xsd\"><object name=\"TestVersion\"  type=\"System.Version, Mscorlib\"></object></objects>";
     xmlDoc.Load(new StringReader(xmlData));
     _xmlElement = xmlDoc.DocumentElement;
 }
Beispiel #21
1
 //Initialize task from Weak variables
 public Task(XmlElement Element)
 {
     if (Element.Name != "Task")
         throw new Exception("Incorrect XML markup");
     this.Name = Element.GetElementsByTagName("Name")[0].InnerText;
     this.GroupName = Element.GetElementsByTagName("GroupName")[0].InnerText;
     this.Description = Element.GetElementsByTagName("Description")[0].InnerText;
     this.Active = Element.GetElementsByTagName("Active")[0].InnerText == "1";
     XmlElement TriggersElement = (XmlElement)Element.GetElementsByTagName("Triggers")[0];
     foreach (XmlElement TriggerElement in TriggersElement.ChildNodes)
     {
         Trigger Trigger = new Trigger(TriggerElement);
         Triggers.Add(Trigger);
         Trigger.AssignTask(this);
     }
     XmlElement ConditionsElement = (XmlElement)Element.GetElementsByTagName("Conditions")[0];
     foreach (XmlElement ConditionElement in ConditionsElement.ChildNodes)
     {
         Condition Condition = new Condition(ConditionElement);
         Conditions.Add(Condition);
         Condition.AssignTask(this);
     }
     XmlElement ActionsElement = (XmlElement)Element.GetElementsByTagName("Actions")[0];
     foreach (XmlElement ActionElement in ActionsElement.ChildNodes)
     {
         Actions.Action Action = new Actions.Action(ActionElement);
         Actions.Add(Action);
         Action.AssignTask(this);
     }
 }
Beispiel #22
0
 public CssAbsValue(CssValue cssValue, string propertyName, XmlElement element)
     : base()
 {
     _cssValue = cssValue;
     _propertyName = propertyName;
     _element = element;
 }
Beispiel #23
0
 public xmlTreeNode(XmlElement element, string text, int imageindex, int selectedimageindex)
     : base(text, imageindex, selectedimageindex)
 {
     if (element == null)//es root de una imagen.
         IsRoot = true;
     this._element = element;
 }
Beispiel #24
0
		internal static List<XmlElement> GetPolicyElements (XmlElement root, out bool error)
		{
			XmlElement policy = null;
			var list = new List<XmlElement> ();

			foreach (var node in root.ChildNodes) {
				var e = node as XmlElement;
				if (e == null)
					continue;
				if (!PolicyNS.Equals (e.NamespaceURI) || !e.LocalName.Equals ("Policy")) {
					error = true;
					return list;
				}
				if (policy != null) {
					error = true;
					return list;
				}
				policy = e;
			}

			if (policy == null) {
				error = true;
				return list;
			}

			foreach (var node in policy.ChildNodes) {
				var e = node as XmlElement;
				if (e != null)
					list.Add (e);
			}

			error = false;
			return list;
		}
Beispiel #25
0
		internal Target (XmlElement targetElement, Project project, ImportedProject importedProject)
		{
			if (project == null)
				throw new ArgumentNullException ("project");
			if (targetElement == null)
				throw new ArgumentNullException ("targetElement");

			this.targetElement = targetElement;
			this.name = targetElement.GetAttribute ("Name");

			this.project = project;
			this.engine = project.ParentEngine;
			this.importedProject = importedProject;

			this.onErrorElements  = new List <XmlElement> ();
			this.buildState = BuildState.NotStarted;
			this.buildTasks = new List <BuildTask> ();
			this.batchingImpl = new TargetBatchingImpl (project, this.targetElement);

			bool onErrorFound = false;
			foreach (XmlNode xn in targetElement.ChildNodes) {
				if (xn is XmlElement) {
					XmlElement xe = (XmlElement) xn;
					if (xe.Name == "OnError") {
						onErrorElements.Add (xe);
						onErrorFound = true;
					} else if (onErrorFound)
						throw new InvalidProjectFileException (
							"The element <OnError> must be last under element <Target>. Found element <Error> instead.");
					else
						buildTasks.Add (new BuildTask (xe, this));
				}
			}
		}
		public BuildChoose (XmlElement xmlElement, Project project)
		{
			this.xmlElement = xmlElement;
			this.project = project;
			this.whens = new List <BuildWhen> ();

			foreach (XmlNode xn in xmlElement.ChildNodes) {
				if (!(xn is XmlElement))
					continue;

				XmlElement xe = (XmlElement)xn;

				if (xe.Name == "When") {
					if (otherwise != null)
						throw new InvalidProjectFileException ("The 'Otherwise' element must be last in a 'Choose' element.");
					if (xe.Attributes.GetNamedItem ("Condition") == null)
						throw new InvalidProjectFileException ("The 'When' element requires a 'Condition' attribute.");
					BuildWhen bw = new BuildWhen (xe, project);
					whens.Add (bw);
				} else if (xe.Name == "Otherwise") {
					if (this.whens.Count == 0)
						throw new InvalidProjectFileException ("At least one 'When' element must occur in a 'Choose' element.");
					
					otherwise = new BuildWhen (xe, project);
				}
			}
		}
Beispiel #27
0
 protected override void SerializeCore(XmlElement element, SaveContext context)
 {
     base.SerializeCore(element, context); //Base implementation must be called
     var formStringNode = element.OwnerDocument.CreateElement("FormulaText");
     formStringNode.InnerText = FormulaString;
     element.AppendChild(formStringNode);
 }
Beispiel #28
0
		internal static void AssertAttributeExists(XmlElement element, string attributeName)
		{
			if (string.IsNullOrEmpty(element.GetAttribute(attributeName))) {
				throw new TemplateLoadException("Error in template on node '" + element.Name + "':\n" +
				                                   "The attribute '" + attributeName + "' is required.");
			}
		}
 public NAntProperty(XmlElement element)
     : this(element.GetAttribute("name"),
          element.GetAttribute("value"),
          GetCategory(element),
          GetReadonly(element))
 {
 }
		/// <summary>
		///   Initializes a new instance of the <see cref = "MonobjcProject" /> class.
		/// </summary>
		/// <param name = "language">The language.</param>
		/// <param name = "info">The info.</param>
		/// <param name = "projectOptions">The project options.</param>
		public MonobjcProject (String language, ProjectCreateInformation info, XmlElement projectOptions) : base(language, info, projectOptions)
		{
			IDELogger.Log ("MonobjcProject::ctor3");

			this.ApplicationType = GetNodeValue (projectOptions, "MacOSApplicationType", MonobjcProjectType.CocoaApplication);
			this.ApplicationCategory = GetNodeValue (projectOptions, "MacOSApplicationCategory", String.Empty);
			this.BundleId = GetNodeValue (projectOptions, "BundleId", "net.monobjc.application.Test");
			this.BundleVersion = GetNodeValue (projectOptions, "BundleVersion", "1.0");
			this.MainNibFile = GetNodeValue (projectOptions, "MainNibFile", null);
			this.BundleIcon = GetNodeValue (projectOptions, "BundleIcon", null);
			this.TargetOSVersion = GetNodeValue (projectOptions, "MacOSVersion", MacOSVersion.MacOS106);
			this.Signing = Boolean.Parse (GetNodeValue (projectOptions, "Signing", "false"));
			this.SigningIdentity = GetNodeValue (projectOptions, "SigningIdentity", String.Empty);
			this.UseEntitlements = Boolean.Parse (GetNodeValue (projectOptions, "UseEntitlements", "false"));
			this.OSFrameworks = GetNodeValue (projectOptions, "MacOSFrameworks", String.Empty);

			this.TargetOSArch = GetNodeValue (projectOptions, "MacOSArch", MacOSArchitecture.X86);
			this.EmbeddedFrameworks = GetNodeValue (projectOptions, "EmbeddedFrameworks", String.Empty);
			this.AdditionalAssemblies = GetNodeValue (projectOptions, "AdditionalAssemblies", String.Empty);
			this.ExcludedAssemblies = GetNodeValue (projectOptions, "ExcludedAssemblies", String.Empty);
			this.AdditionalLibraries = GetNodeValue (projectOptions, "AdditionalLibraries", String.Empty);

			this.Archive = Boolean.Parse (GetNodeValue (projectOptions, "Archive", "false"));
			this.ArchiveIdentity = GetNodeValue (projectOptions, "ArchiveIdentity", String.Empty);

			this.DevelopmentRegion = GetNodeValue (projectOptions, "MacOSDevelopmentRegion", "en");
			this.CombineArtwork = Boolean.Parse (GetNodeValue (projectOptions, "CombineArtwork", "false"));

			this.Initialize ();
		}
Beispiel #31
0
        public XmlNode Serialize(XmlDocument doc)
        {
            string data = string.Empty;

            if (standardImage.Source is BitmapImage && imageBytes != null)
            {
                data = Convert.ToBase64String(imageBytes);
            }

            //string xmlString =
            //"<filePath>" + this.standardImage.Source.ToString() + "</filePath>";

            string xmlString =
                "<imageData>" + data + "</imageData>";

            System.Xml.XmlElement element = doc.CreateElement("standardImageReportGadget");
            element.InnerXml = xmlString;

            System.Xml.XmlAttribute locationY = doc.CreateAttribute("top");
            System.Xml.XmlAttribute locationX = doc.CreateAttribute("left");

            System.Xml.XmlAttribute width  = doc.CreateAttribute("width");
            System.Xml.XmlAttribute height = doc.CreateAttribute("height");

            System.Xml.XmlAttribute collapsed = doc.CreateAttribute("collapsed");
            System.Xml.XmlAttribute type      = doc.CreateAttribute("gadgetType");

            locationY.Value = Canvas.GetTop(this).ToString("F0");
            locationX.Value = Canvas.GetLeft(this).ToString("F0");

            width.Value  = this.ActualWidth.ToString("F0");
            height.Value = this.ActualHeight.ToString("F0");

            collapsed.Value = "false"; // currently no way to collapse the gadget, so leave this 'false' for now
            type.Value      = "EpiDashboard.Gadgets.Reporting.StandardImageControl";

            element.Attributes.Append(locationY);
            element.Attributes.Append(locationX);

            element.Attributes.Append(width);
            element.Attributes.Append(height);

            element.Attributes.Append(collapsed);
            element.Attributes.Append(type);

            return(element);
        }
Beispiel #32
0
 public void SaveRuleList(List <RewriterRule> ruleList)
 {
     System.Xml.XmlDocument    xml = new System.Xml.XmlDocument();
     System.Xml.XmlDeclaration xmldecl;
     xmldecl = xml.CreateXmlDeclaration("1.0", "utf-8", null);
     xml.AppendChild(xmldecl);
     System.Xml.XmlElement xmlelem = xml.CreateElement("", "rewrite", "");
     foreach (RewriterRule rule in ruleList)
     {
         System.Xml.XmlElement e = xml.CreateElement("", "item", "");
         e.SetAttribute("lookfor", rule.LookFor);
         e.SetAttribute("sendto", rule.SendTo);
         xmlelem.AppendChild(e);
     }
     xml.AppendChild(xmlelem);
     xml.Save(HttpContext.Current.Server.MapPath(string.Format("//config/rewrite.config", "/")));
 }
Beispiel #33
0
        protected override void Build(System.Xml.XmlElement source, string location)
        {
            if (JHSchool.Permrec.Program.ModuleType == JHSchool.Permrec.Program.ModuleFlag.HsinChu)
            {
                ProcessHsinChu(source, location);
            }

            if (JHSchool.Permrec.Program.ModuleType == JHSchool.Permrec.Program.ModuleFlag.KaoHsiung)
            {
                ProcessKaoHsiung(source, location);
            }

            if (JHSchool.Permrec.Program.ModuleType == JHSchool.Permrec.Program.ModuleFlag.TaiChung)
            {
                ProcessTaiChung(source, location);
            }
        }
Beispiel #34
0
    private static void AddProjectContent(XmlDocument docPROJECT, string strPath, XmlNamespaceManager nsMgr, string ns)
    {
        string filter = @"//mha:Project/mha:ItemGroup/mha:Content[@Include=""" + strPath + @"""]";

        System.Xml.XmlNode field = docPROJECT.SelectSingleNode(filter, nsMgr);
        if (field == null)
        {
            string             filter2   = @"//mha:Project/mha:ItemGroup";
            System.Xml.XmlNode ItemGroup = docPROJECT.SelectSingleNode(filter2, nsMgr);
            if (ItemGroup != null)
            {
                System.Xml.XmlElement Content = docPROJECT.CreateElement("", "Content", ns);
                Content.SetAttribute("Include", strPath);
                ItemGroup.AppendChild(Content);
            }
        }
    }
Beispiel #35
0
 public void ToXml(Object parent, System.Xml.XmlElement baseElem, String fieldName, int detailLevel)
 {
     System.Xml.XmlElement recordElem = VarValue.AppendChild(baseElem, "Record");
     if (fieldName != null)
     {
         VarValue.AppendAttribute(recordElem, "debug.field", fieldName);
     }
     if (detailLevel > 0)
     {
         ssSTObjectChanged.ToXml(this, recordElem, "ObjectChanged", detailLevel - 1);
         ssSTError.ToXml(this, recordElem, "Error", detailLevel - 1);
     }
     else
     {
         VarValue.AppendDeferredEvaluationElement(recordElem);
     }
 }
        /// <summary>
        /// Deserializes the specified element.
        /// </summary>
        /// <param name="element">The element.</param>
        public override void Deserialize(System.Xml.XmlElement element)
        {
            this.ApplyLabel          = null;
            this.AutoGetSource       = null;
            this.CleanCopy           = null;
            this.Culture             = string.Empty;
            this.Executable          = string.Empty;
            this.Password            = new HiddenPassword();
            this.Project             = string.Empty;
            this.SourceSafeDirectory = string.Empty;
            this.Timeout             = new Timeout();
            this.Username            = string.Empty;
            this.WorkingDirectory    = string.Empty;


            string s = Util.GetElementOrAttributeValue("applyLabel", element);

            if (!string.IsNullOrEmpty(s))
            {
                this.ApplyLabel = string.Compare(s, bool.TrueString, true) == 0;
            }

            s = Util.GetElementOrAttributeValue("autoGetSource", element);
            if (!string.IsNullOrEmpty(s))
            {
                this.AutoGetSource = string.Compare(s, bool.TrueString, true) == 0;
            }

            s = Util.GetElementOrAttributeValue("cleanCopy", element);
            if (!string.IsNullOrEmpty(s))
            {
                this.CleanCopy = string.Compare(s, bool.TrueString, true) == 0;
            }

            this.Culture             = Util.GetElementOrAttributeValue("culture", element);
            this.Executable          = Util.GetElementOrAttributeValue("executable", element);
            this.Password.Password   = Util.GetElementOrAttributeValue("password", element);
            this.Project             = Util.GetElementOrAttributeValue("project", element);
            this.SourceSafeDirectory = Util.GetElementOrAttributeValue("ssdir", element);
            this.Username            = Util.GetElementOrAttributeValue("username", element);
            this.WorkingDirectory    = Util.GetElementOrAttributeValue("workingDirectory", element);

            XmlElement ele = (XmlElement)element.SelectSingleNode("timeout");

            this.Timeout.Deserialize(ele);
        }
        /// <summary> Parses an XML profile string into a RuntimeProfile object.  </summary>
        public virtual RuntimeProfile parse(System.String profileString)
        {
            RuntimeProfile profile = new RuntimeProfile();

            System.Xml.XmlDocument doc = parseIntoDOM(profileString);

            System.Xml.XmlElement root = (System.Xml.XmlElement)doc.DocumentElement;
            profile.setHL7Version(root.GetAttribute("HL7Version"));

            //get static definition
            System.Xml.XmlNodeList nl        = root.GetElementsByTagName("HL7v2xStaticDef");
            System.Xml.XmlElement  staticDef = (System.Xml.XmlElement)nl.Item(0);
            StaticDef sd = parseStaticProfile(staticDef);

            profile.Message = sd;
            return(profile);
        }
Beispiel #38
0
        /// <summary>
        /// Sets the application configuration setting.
        /// </summary>
        /// <param name="setting">Setting to be changed/added.</param>
        /// <param name="val">Value to change/add.</param>
        public static void SetValue(string setting, string val)
        {
            bool changed = false;

            System.Reflection.Assembly asm = System.Reflection.Assembly.GetEntryAssembly();
            System.IO.FileInfo         fi  = new System.IO.FileInfo(asm.Location + ".config");
            System.Xml.XmlDataDocument doc = new System.Xml.XmlDataDocument();
            try
            {
                //Load the XML application configuration file
                doc.Load(fi.FullName);
                //Loops through the nodes to find the target node to change
                foreach (System.Xml.XmlNode node in doc["configuration"]["appSettings"])
                {
                    if (node.Name == "add")
                    {
                        //Set the key and value attributes
                        if (node.Attributes.GetNamedItem("key").Value == setting)
                        {
                            node.Attributes.GetNamedItem("value").Value = val;
                            //Flag the change as complete
                            changed = true;
                        }
                    }
                }
                //If not changed yet then we assume it's a new key to be added
                if (!changed)
                {
                    //create the new node and append it to the collection
                    System.Xml.XmlNode      node    = doc["configuration"]["appSettings"];
                    System.Xml.XmlElement   elem    = doc.CreateElement("add");
                    System.Xml.XmlAttribute attrKey = doc.CreateAttribute("key");
                    System.Xml.XmlAttribute attrVal = doc.CreateAttribute("value");
                    elem.Attributes.SetNamedItem(attrKey).Value = setting;
                    elem.Attributes.SetNamedItem(attrVal).Value = val;
                    node.AppendChild(elem);
                }
                //Save the XML configuration file.
                doc.Save(fi.FullName);
            }
            catch
            {
                //There was an error loading or reading the config file...throw an error.
                throw new Exception("Unable to set the value.  Check that the configuration file exists and contains the appSettings element.");
            }
        }
Beispiel #39
0
        protected internal override void WriteToXml(System.Xml.XmlElement xel)
        {
            xel.RemoveAll();
            XmlElement xch = Write(xel, "session.characters");

            foreach (Character c in characters)
            {
                XmlElement xc = Write(xch, "character");
                c.WriteToXml(xc);
            }
            //WriteCollection<Character>(xel, "session.characters", "character", characters);
            WriteCollection <Map>(xel, "session.maps", "map", maps);
            if (SelectedMap != null)
            {
                WriteAttribute(xel, "selectedMap", SelectedMap.Name);
            }
        }
        /// <summary>
        /// Load state from an XML element
        /// </summary>
        /// <param name="xmlElement">XML element containing new state</param>
        public override void LoadXml(System.Xml.XmlElement xmlElement)
        {
            XmlNamespaceManager xmlNamespaceManager;
            XmlNodeList         xmlNodeList;

            if (xmlElement == null)
            {
                throw new ArgumentNullException("xmlElement");
            }

            xmlNamespaceManager = new XmlNamespaceManager(xmlElement.OwnerDocument.NameTable);
            xmlNamespaceManager.AddNamespace("xsd", XadesSignedXml.XadesNamespaceUri);

            xmlNodeList = xmlElement.SelectNodes("xsd:SPURI", xmlNamespaceManager);

            this.uri = ((XmlElement)xmlNodeList.Item(0)).InnerText;
        }
Beispiel #41
0
        private void readPathInfo()
        {
            XmlDocument docavidconfig = new XmlDocument();

            docavidconfig.Load(Application.StartupPath + "\\pathinfo.xml");
            System.Xml.XmlElement avidconfig = docavidconfig.DocumentElement;

            XmlNodeList relationlists = avidconfig.SelectNodes("//relation");

            htpaths = new Hashtable();  //路径对应关系
            foreach (XmlNode relationNode in relationlists)
            {
                string keyinpath   = relationNode.FirstChild.InnerText;
                string valueinpath = relationNode.FirstChild.NextSibling.InnerText;
                htpaths.Add(keyinpath, valueinpath);
            }
        }
Beispiel #42
0
        internal static Entity Create(MediaLoader loader, string name, System.Xml.XmlElement root, vec3 pos, quat rot)
        {
            Entity ent = new Entity(name);

            XmlElement visual = root["visual"];

            foreach (XmlElement meshel in Xml.ElementsNamed(visual, "mesh"))
            {
                string       meshpath = Xml.GetAttributeString(meshel, "file");
                MeshInstance mesh     = new MeshInstance(loader.fetch <Mesh>(meshpath));
                mesh.pos = pos;
                mesh.rot = rot;
                ent.add(mesh);
            }

            return(ent);
        }
Beispiel #43
0
        private List <Downgrade> CreateDowngrades(System.Xml.XmlElement x, String type)
        {
            List <Downgrade> dgs = new List <Downgrade>();

            XNamespace ns = "http://www.sita.aero/ams6-xml-api-datatypes";
            XElement   el = XDocument.Parse(x.InnerXml).Root;

            IEnumerable <XElement> downs = from n in el.Descendants()
                                           where (n.Name == ns + type)
                                           select n;

            foreach (XElement xl in downs)
            {
                dgs.Add(new Downgrade(xl, ns, type));
            }
            return(dgs);
        }
Beispiel #44
0
        //https://stackoverflow.com/questions/21925935/dyanamically-change-the-database-name-in-sqlmapconfig-xml-file
        public static ISqlMapper CreateMapperFromEmbeddedResource(string resourceSqlMap, string resourceProviders, string resourceQueryRootPath,
                                                                  string connectionString, string providerName)
        {
            // Load the config file (embedded resource in assembly).
            XmlDocument xmlDoc = IBatisNet.Common.Utilities.Resources.GetEmbeddedResourceAsXmlDocument(resourceSqlMap);

            // providers
            if (string.IsNullOrEmpty(resourceProviders) == false)
            {
                xmlDoc["sqlMapConfig"]["providers"].Attributes["embedded"].InnerText = resourceProviders;
            }

            // database(provider)
            if (string.IsNullOrEmpty(providerName) == false)
            {
                xmlDoc["sqlMapConfig"]["database"]["provider"].Attributes["name"].InnerText = providerName;
            }

            // database(connectionString)
            if (string.IsNullOrEmpty(connectionString) == false)
            {
                xmlDoc["sqlMapConfig"]["database"]["dataSource"].Attributes["connectionString"].InnerText = connectionString;
            }

            // sqlMaps
            if (string.IsNullOrEmpty(resourceQueryRootPath) == false)
            {
                var sqlMapsRoot      = xmlDoc["sqlMapConfig"]["sqlMaps"];
                var queryFileNames   = IBatisNetMapperHelper.GetAllQueryXML(resourceQueryRootPath);
                var defaultNamespace = Assembly.GetExecutingAssembly().GetName().Name;
                foreach (var queryFile in queryFileNames)
                {
                    System.Xml.XmlElement elem = xmlDoc.CreateElement("sqlMap", sqlMapsRoot.NamespaceURI);
                    elem.SetAttribute("embedded", $"{queryFile}, {defaultNamespace}");
                    sqlMapsRoot.AppendChild(elem);
                }
            }

            // Instantiate Ibatis mapper using the XmlDocument via a Builder,
            // instead of Ibatis using the config file.
            DomSqlMapBuilder builder        = new DomSqlMapBuilder();
            ISqlMapper       ibatisInstance = builder.Configure(xmlDoc);

            return(ibatisInstance);
        }
    void saveOptions()
    {
        Xml.XmlNodeList optionNodes = xmlResult.GetElementsByTagName("Option");
        foreach (Xml.XmlElement nodes in optionNodes)
        {
            string attributeName = nodes.GetAttribute("optionName");

            switch (attributeName)
            {
            case "SoundVolume":
                nodes.SetAttribute("value", SoundManager.Get().sfxVolume.ToString());
                break;

            case "MusicVolume":
                nodes.SetAttribute("value", SoundManager.Get().musicVolume.ToString());
                break;

            case "SoundIsOn":
                nodes.SetAttribute("value", (!SoundManager.Get().muteSfx).ToString());
                break;

            case "MusicIsOn":
                nodes.SetAttribute("value", (!SoundManager.Get().muteMusic).ToString());
                break;
            }
        }

        // save the server settings
        Xml.XmlElement sevInfo = xmlResult.GetElementsByTagName("ServerInfo")[0] as Xml.XmlElement;
        sevInfo.SetAttribute("playername", nvs.myInfo.name);
        sevInfo.SetAttribute("hostname", nvs.serverName);
        sevInfo.SetAttribute("NATmode", nvs.NATmode.ToString());
        //putting a / after the * here breaks MonoDevelop's tab system - stupid piece of

        /*xmlResult.GetElementById("sih").GetAttribute("
         * Xml.XmlNodeList serverInfo = xmlResult.GetElementsByTagName ("ServerInfo");
         * foreach (Xml.XmlElement node in serverInfo)
         * {
         *      //should only be 1 node so loops fine - also I couldn't find a way to convert between XmlNode and XmlElement
         *      // save player name
         *      node.SetAttribute("playername", nvs.myInfo.name);
         *      // save server name
         *      node.SetAttribute("hostname", nvs.serverName);
         * }*/
    }
Beispiel #46
0
 private void setReplaceValue(ComboBox combo, string theval)
 {
     if (combo != null)
     {
         _skipSelectionChanged = true;
         for (int i = 0; i < combo.Items.Count; i++)
         {
             object       obj  = combo.Items.GetItemAt(i);
             ComboBoxItem item = obj as ComboBoxItem;
             if (item != null)
             {
                 string comp = item.Content.ToString();
                 if (comp == theval)
                 {
                     combo.SelectedIndex = i;
                 }
             }
             else
             {
                 System.Xml.XmlElement elem = obj as System.Xml.XmlElement;
                 if (elem != null)
                 {
                     string comp = elem.InnerText;
                     if (comp == theval)
                     {
                         combo.SelectedIndex = i;
                     }
                 }
                 else
                 {
                     System.Xml.XmlAttribute attr = obj as System.Xml.XmlAttribute;
                     if (attr != null)
                     {
                         string comp = attr.InnerText;
                         if (comp == theval)
                         {
                             combo.SelectedIndex = i;
                         }
                     }
                 }
             }
         }
         _skipSelectionChanged = false;
     }
 }
Beispiel #47
0
        private static void HandleClass(string classPackage, MappingElement me, Hashtable classMappings,
                                        IEnumerator classElements, MultiMap mm, bool extendz)
        {
            while (classElements.MoveNext())
            {
                Element clazz = (Element)classElements.Current;

                if (!extendz)
                {
                    ClassMapping cmap = new ClassMapping(classPackage, clazz, me, mm);
                    SupportClass.PutElement(classMappings, cmap.FullyQualifiedName, cmap);
                    SupportClass.PutElement(allMaps, cmap.FullyQualifiedName, cmap);
                }
                else
                {
                    string ex = clazz.Attributes["extends"] == null ? null : clazz.Attributes["extends"].Value;
                    if ((object)ex == null)
                    {
                        throw new MappingException("Missing extends attribute on <" + clazz.LocalName + " name=" +
                                                   clazz.Attributes["name"].Value + ">");
                    }

                    int commaIndex = ex.IndexOf(',');
                    if (commaIndex > -1)
                    {
                        //suppress the leading AssemblyName
                        ex = ex.Substring(0, commaIndex).Trim();
                    }

                    ClassMapping superclass = (ClassMapping)allMaps[ex];
                    if (superclass == null)
                    {
                        // Haven't seen the superclass yet, so record this and process at the end
                        SubclassMapping orphan = new SubclassMapping(classPackage, me, ex, clazz, mm);
                        children.Add(orphan);
                    }
                    else
                    {
                        ClassMapping subclassMapping = new ClassMapping(classPackage, me, superclass.ClassName, superclass, clazz, mm);
                        superclass.AddSubClass(subclassMapping);
                        SupportClass.PutElement(allMaps, subclassMapping.FullyQualifiedName, subclassMapping);
                    }
                }
            }
        }
Beispiel #48
0
        /// <summary>
        /// Deserializes the specified element.
        /// </summary>
        /// <param name="element">The element.</param>
        public void Deserialize(System.Xml.XmlElement element)
        {
            this.Url  = null;
            this.Type = string.Empty;


            string s = Util.UrlDecode(Util.GetElementOrAttributeValue("url", element));

            if (!string.IsNullOrEmpty(s))
            {
                this.Url = new Uri(s);
            }
            s = Util.GetElementOrAttributeValue("type", element);
            if (!string.IsNullOrEmpty(s))
            {
                this.Type = s;
            }
        }
Beispiel #49
0
    private static void AddManifestContent(XmlDocument docMANIFEST, string strManifestPath, XmlNamespaceManager nsMgr, string ns)
    {
        //manifest-root: TARGET_DIR
        string filter = @"//mha:Solution/mha:FeatureManifests/mha:FeatureManifest[@Location=""" + strManifestPath + @"""]";

        System.Xml.XmlNode field = docMANIFEST.SelectSingleNode(filter, nsMgr);
        if (field == null)
        {
            string             filter2          = @"//mha:Solution/mha:FeatureManifests";
            System.Xml.XmlNode FeatureManifests = docMANIFEST.SelectSingleNode(filter2, nsMgr);
            if (FeatureManifests != null)
            {
                System.Xml.XmlElement FeatureManifest = docMANIFEST.CreateElement("", "FeatureManifest", ns);
                FeatureManifest.SetAttribute("Location", strManifestPath);
                FeatureManifests.AppendChild(FeatureManifest);
            }
        }
    }
        private void chbxPCode_Checked(object sender, RoutedEventArgs e)
        {
            CheckBox cbx = (CheckBox)sender;

            System.Xml.XmlElement xmlCheckBox = (System.Xml.XmlElement)cbx.Content;

            _listPCode.Add(xmlCheckBox.InnerText);
            _listPCode.Sort();
            _listPCode      = _listPCode.Where(s => !string.IsNullOrWhiteSpace(s)).Distinct().ToList();
            tbxMDPCode.Text = "";

            foreach (string s in _listPCode)
            {
                tbxMDPCode.Text += s + System.Environment.NewLine;
            }
            tbxMDPCode.Focus();
            cbx.Focus();
        }
        /// <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(nameof(xmlElement));
            }

            if (xmlElement.HasAttribute("Id"))
            {
                this.id = xmlElement.GetAttribute("Id");
            }
            else
            {
                this.id = "";
            }

            this.pkiData = Convert.FromBase64String(xmlElement.InnerText);
        }
        public void InitFromXMLNode(System.Xml.XmlElement XmlNode)
        {
            _skip_empty = bool.Parse(XmlNode.GetAttribute("SkipEmpty"));

            _activate_validator = false;
            foreach (XmlElement each in XmlNode.SelectNodes("ActivatorField"))
            {
                string fieldName = each.InnerText;
                _activate_validator |= (_context.SelectedFields.Contains(fieldName));
            }

            if (!_activate_validator)
            {
                return;
            }

            _lookup = _context.Extensions[TeacherLookup.Name] as TeacherLookup;
        }
Beispiel #53
0
        /// <summary> Populates the given Element with data from the given Type, by inserting
        /// Elements corresponding to the Type's components and values.  Returns true if
        /// the given type contains a value (i.e. for Primitives, if getValue() doesn't
        /// return null, and for Composites, if at least one underlying Primitive doesn't
        /// return null).
        /// </summary>
        private bool encode(Type datatypeObject, System.Xml.XmlElement datatypeElement)
        {
            bool hasData = false;

            if (datatypeObject is Varies)
            {
                hasData = encodeVaries((Varies)datatypeObject, datatypeElement);
            }
            else if (datatypeObject is Primitive)
            {
                hasData = encodePrimitive((Primitive)datatypeObject, datatypeElement);
            }
            else if (datatypeObject is Composite)
            {
                hasData = encodeComposite((Composite)datatypeObject, datatypeElement);
            }
            return(hasData);
        }
        /// <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;
        }
        private int CreateSettingsNode(System.Xml.XmlDocument document, System.Xml.XmlElement parent)
        {
            return(SettingsHelper.CreateSetting(document, parent, "Version", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version) ^
                   SettingsHelper.CreateSetting(document, parent, "BackgroundColor", BackgroundColor) ^
                   SettingsHelper.CreateSetting(document, parent, "BackgroundColor2", BackgroundColor2) ^
                   CreateSetting(document, parent, nameof(GraphColors), GraphColors) ^
                   SettingsHelper.CreateSetting(document, parent, "MinimumValue", MinimumValue) ^
                   SettingsHelper.CreateSetting(document, parent, "MaximumValue", MaximumValue) ^
                   SettingsHelper.CreateSetting(document, parent, "GraphWidth", GraphWidth) ^
                   SettingsHelper.CreateSetting(document, parent, "GraphHeight", GraphHeight) ^
                   SettingsHelper.CreateSetting(document, parent, "HorizontalMargins", HorizontalMargins) ^
                   SettingsHelper.CreateSetting(document, parent, "VerticalMargins", VerticalMargins) ^
                   SettingsHelper.CreateSetting(document, parent, "GraphStyle", GraphStyle) ^
                   SettingsHelper.CreateSetting(document, parent, "BackgroundGradient", BackgroundGradient) ^
                   SettingsHelper.CreateSetting(document, parent, "GraphGradient", GraphGradient) ^
                   SettingsHelper.CreateSetting(document, parent, "GraphSillyColors", GraphSillyColors) ^
                   SettingsHelper.CreateSetting(document, parent, "ValueTextPosition", ValueTextPosition) ^
                   SettingsHelper.CreateSetting(document, parent, "DescriptiveTextPosition", DescriptiveTextPosition) ^
                   SettingsHelper.CreateSetting(document, parent, "LocalMax", LocalMax) ^
                   SettingsHelper.CreateSetting(document, parent, "ProcessName", ProcessName) ^
                   SettingsHelper.CreateSetting(document, parent, "DescriptiveText", DescriptiveText) ^

                   SettingsHelper.CreateSetting(document, parent, "SelectedGame", ComboBox_ListOfGames.SelectedValue) ^
                   SettingsHelper.CreateSetting(document, parent, "SelectedGameOption", ComboBox_GameOption.SelectedValue) ^

                   SettingsHelper.CreateSetting(document, parent, "Module", txtModule.Text) ^
                   SettingsHelper.CreateSetting(document, parent, "Base", txtBase.Text) ^
                   SettingsHelper.CreateSetting(document, parent, "Offsets", txtOffsets.Text) ^
                   SettingsHelper.CreateSetting(document, parent, "ValueType", ValueType) ^

                   SettingsHelper.CreateSetting(document, parent, "DescriptiveTextColor", DescriptiveTextColor) ^
                   SettingsHelper.CreateSetting(document, parent, "DescriptiveTextFont", DescriptiveTextFont) ^
                   SettingsHelper.CreateSetting(document, parent, "DescriptiveTextOverrideColor", DescriptiveTextOverrideColor) ^
                   SettingsHelper.CreateSetting(document, parent, "DescriptiveTextOverrideFont", DescriptiveTextOverrideFont) ^

                   SettingsHelper.CreateSetting(document, parent, "ValueTextColor", ValueTextColor) ^
                   SettingsHelper.CreateSetting(document, parent, "ValueTextFont", ValueTextFont) ^
                   SettingsHelper.CreateSetting(document, parent, "ValueTextOverrideColor", ValueTextOverrideColor) ^
                   SettingsHelper.CreateSetting(document, parent, "ValueTextOverrideFont", ValueTextOverrideFont) ^
                   SettingsHelper.CreateSetting(document, parent, "ValueTextDecimals", ValueTextDecimals) ^
                   SettingsHelper.CreateSetting(document, parent, "UnitConversionEnabled", UnitsConversionEnabled) ^
                   SettingsHelper.CreateSetting(document, parent, "UnitsUsed", UnitsUsed) ^
                   SettingsHelper.CreateSetting(document, parent, "MeterInGameUnits", MeterInGameUnits));
        }
Beispiel #56
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)
        {
            XmlNamespaceManager xmlNamespaceManager;
            XmlNodeList         xmlNodeList;

            if (xmlElement == null)
            {
                throw new ArgumentNullException("xmlElement");
            }

            xmlNamespaceManager = new XmlNamespaceManager(xmlElement.OwnerDocument.NameTable);
            xmlNamespaceManager.AddNamespace("ds", SignedXml.XmlDsigNamespaceUrl);
            xmlNamespaceManager.AddNamespace("xsd", XadesSignedXml.XadesNamespaceUri);

            xmlNodeList = xmlElement.SelectNodes("xsd:SigPolicyId", xmlNamespaceManager);
            if (xmlNodeList.Count == 0)
            {
                throw new CryptographicException("SigPolicyId missing");
            }
            this.sigPolicyId = new ObjectIdentifier("SigPolicyId");
            this.sigPolicyId.LoadXml((XmlElement)xmlNodeList.Item(0));

            xmlNodeList = xmlElement.SelectNodes("ds:Transforms", xmlNamespaceManager);
            if (xmlNodeList.Count != 0)
            {
                this.transforms = new Transforms();
                this.transforms.LoadXml((XmlElement)xmlNodeList.Item(0));
            }

            xmlNodeList = xmlElement.SelectNodes("xsd:SigPolicyHash", xmlNamespaceManager);
            if (xmlNodeList.Count == 0)
            {
                throw new CryptographicException("SigPolicyHash missing");
            }
            this.sigPolicyHash = new DigestAlgAndValueType("SigPolicyHash");
            this.sigPolicyHash.LoadXml((XmlElement)xmlNodeList.Item(0));

            xmlNodeList = xmlElement.SelectNodes("xsd:SigPolicyQualifiers", xmlNamespaceManager);
            if (xmlNodeList.Count != 0)
            {
                this.sigPolicyQualifiers = new SigPolicyQualifiers();
                this.sigPolicyQualifiers.LoadXml((XmlElement)xmlNodeList.Item(0));
            }
        }
Beispiel #57
0
        private void ReadPrologue(System.Xml.XmlElement element)
        {
            // Look for the config attributes
            this.aircraft.AircraftName = element.GetAttribute(CONFIG_FDM_NAME2);
            this.CFGVersion            = element.GetAttribute(CONFIG_FDM_VERSION2);
            this.release = element.GetAttribute(CONFIG_FDM_RELEASE2);

            if (log.IsDebugEnabled)
            {
                log.Debug("Reading Aircraft Configuration File: " + this.modelName);
                log.Debug("                            Version: " + this.CFGVersion);
            }

            if (log.IsWarnEnabled && this.CFGVersion != neededCfgVersion)
            {
                log.Warn("YOU HAVE AN INCOMPATIBLE CFG FILE FOR THIS AIRCRAFT." +
                         " RESULTS WILL BE UNPREDICTABLE !!");
                log.Warn("Current version needed is: " + neededCfgVersion);
                log.Warn("         You have version: " + this.CFGVersion);
            }

            if (log.IsWarnEnabled && release.Equals("ALPHA"))
            {
                log.Warn("This aircraft model is an " + release + " release!!!");
                log.Warn("This aircraft model may not even properly load, and probably will not fly as expected.");
                log.Warn("Use this model for development purposes ONLY!!!");
            }
            else if (log.IsWarnEnabled && release.Equals("BETA"))
            {
                log.Warn("This aircraft model is an " + release + " release!!!");
                log.Warn("This aircraft model probably will not fly as expected.");
                log.Warn("Use this model for development purposes ONLY!!!");
            }
            else if (log.IsWarnEnabled && release.Equals("PRODUCTION"))
            {
                log.Warn("This aircraft model is an " + release + " release.");
            }
            else if (log.IsWarnEnabled)
            {
                log.Warn("This aircraft model is an " + release + " release!!!");
                log.Warn("This aircraft model may not even properly load, and probably will not fly as expected.");
                log.Warn("Use this model for development purposes ONLY!!!");
            }
        }
Beispiel #58
0
        public void WriteDirectoryXMLFile(string folder, string fnaam)
        {
            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();
            GlobalDataStore.Logger.Debug("Updating " + fnaam + " ...");
            List <LabelX.Toolbox.LabelXItem> items = new List <LabelX.Toolbox.LabelXItem>();
            DirectoryInfo FolderDirectoryInfo      = new DirectoryInfo(folder);

            LabelX.Toolbox.Toolbox.GetFilesFromFolderTree(FolderDirectoryInfo.FullName, ref items);

            //items = alle ingelezen bestanden. Nu gaan wegschrijven.
            System.Xml.XmlDocument doc  = new System.Xml.XmlDocument();
            System.Xml.XmlElement  root = doc.CreateElement("LabelXItems");

            foreach (LabelX.Toolbox.LabelXItem item in items)
            {
                if (getFileExt(item.Name) == ".xml")
                {
                    continue;
                }

                System.Xml.XmlElement itemXML = doc.CreateElement("item");
                itemXML.SetAttribute("name", item.Name);
                itemXML.SetAttribute("hash", item.Hash);

                root.AppendChild(itemXML);
            }

            doc.AppendChild(root);

            MemoryStream ms = new MemoryStream();

            System.Xml.XmlTextWriter tw = new System.Xml.XmlTextWriter(ms, Encoding.UTF8)
            {
                Formatting = System.Xml.Formatting.Indented
            };
            doc.WriteContentTo(tw);
            doc.Save(folder + fnaam);
            tw.Close();

            sw.Stop();
            GlobalDataStore.Logger.Debug("Creating the XML Hash file for the directory took: " + sw.ElapsedMilliseconds + " ms (" + folder + ")");
            sw.Reset();
        }
        public void SetSettings(System.Xml.XmlNode node)
        {
            System.Xml.XmlElement element = (System.Xml.XmlElement)node;

            BackgroundColor         = SettingsHelper.ParseColor(element["BackgroundColor"]);
            BackgroundColor2        = SettingsHelper.ParseColor(element["BackgroundColor2"]);
            GraphColor              = SettingsHelper.ParseColor(element["GraphColor"]);
            GraphColor2             = SettingsHelper.ParseColor(element["GraphColor2"]);
            MinimumValue            = SettingsHelper.ParseFloat(element["MinimumValue"]);
            MaximumValue            = SettingsHelper.ParseFloat(element["MaximumValue"]);
            GraphWidth              = SettingsHelper.ParseInt(element["GraphWidth"]);
            GraphHeight             = SettingsHelper.ParseInt(element["GraphHeight"]);;
            HorizontalMargins       = SettingsHelper.ParseInt(element["HorizontalMargins"]);;
            VerticalMargins         = SettingsHelper.ParseInt(element["VerticalMargins"]);;
            GraphStyle              = SettingsHelper.ParseEnum <GraphStyle>(element["GraphStyle"]);
            BackgroundGradient      = SettingsHelper.ParseEnum <GradientType>(element["BackgroundGradient"]);
            GraphGradient           = SettingsHelper.ParseEnum <GraphGradientType>(element["GraphGradient"]);
            GraphSillyColors        = SettingsHelper.ParseBool(element["GraphSillyColors"]);
            ValueTextPosition       = SettingsHelper.ParseEnum <Position>(element["ValueTextPosition"]);
            DescriptiveTextPosition = SettingsHelper.ParseEnum <Position>(element["DescriptiveTextPosition"]);
            ProcessName             = SettingsHelper.ParseString(element["ProcessName"]);
            DescriptiveText         = SettingsHelper.ParseString(element["DescriptiveText"]);

            txtModule.Text  = SettingsHelper.ParseString(element["Module"]);
            txtBase.Text    = SettingsHelper.ParseString(element["Base"]);
            txtOffsets.Text = SettingsHelper.ParseString(element["Offsets"]);
            ValueType       = SettingsHelper.ParseEnum <MemoryType>(element["ValueType"]);

            DescriptiveTextColor         = SettingsHelper.ParseColor(element["DescriptiveTextColor"]);
            DescriptiveTextFont          = SettingsHelper.GetFontFromElement(element["DescriptiveTextFont"]);
            DescriptiveTextOverrideColor = SettingsHelper.ParseBool(element["DescriptiveTextOverrideColor"]);
            DescriptiveTextOverrideFont  = SettingsHelper.ParseBool(element["DescriptiveTextOverrideFont"]);

            ValueTextColor         = SettingsHelper.ParseColor(element["ValueTextColor"]);
            ValueTextFont          = SettingsHelper.GetFontFromElement(element["ValueTextFont"]);
            ValueTextOverrideColor = SettingsHelper.ParseBool(element["ValueTextOverrideColor"]);
            ValueTextOverrideFont  = SettingsHelper.ParseBool(element["ValueTextOverrideFont"]);
            ValueTextDecimals      = SettingsHelper.ParseInt(element["ValueTextDecimals"]);
            UnitsConversionEnabled = SettingsHelper.ParseBool(element["UnitConversionEnabled"]);
            UnitsUsed        = SettingsHelper.ParseEnum <Units>(element["UnitsUsed"]);
            MeterInGameUnits = CultureSafeFloatParse(SettingsHelper.ParseString(element["MeterInGameUnits"]));

            UpdatePointer(null, null);
        }
Beispiel #60
0
        private void btnAdd_Click(object sender, System.EventArgs e)
        {
            string filename = System.Web.HttpContext.Current.Request.MapPath(Globals.ApplicationPath + string.Format("/Templates/master/{0}/config/HeaderMenu.xml", this.themName));

            System.Xml.XmlDocument xmlDocument = new System.Xml.XmlDocument();
            xmlDocument.Load(filename);
            System.Xml.XmlNode    xmlNode    = xmlDocument.SelectSingleNode("root");
            System.Xml.XmlElement xmlElement = xmlDocument.CreateElement("Menu");
            xmlElement.SetAttribute("Id", this.GetId(xmlNode));
            xmlElement.SetAttribute("Title", this.txtTitle.Text);
            xmlElement.SetAttribute("DisplaySequence", "1");
            xmlElement.SetAttribute("Category", this.txtMenuType.Text);
            xmlElement.SetAttribute("Url", this.GetUrl(this.txtMenuType.Text));
            xmlElement.SetAttribute("Where", this.GetWhere(this.txtMenuType.Text));
            xmlElement.SetAttribute("Visible", "true");
            xmlNode.AppendChild(xmlElement);
            xmlDocument.Save(filename);
            base.Response.Redirect(Globals.GetAdminAbsolutePath("/store/SetHeaderMenu.aspx"));
        }