Пример #1
1
        public static MusicInfo FromXml(XElement musicNode, string basePath)
        {
            MusicInfo music = new MusicInfo();

            var introNode = musicNode.Element("Intro");
            var loopNode = musicNode.Element("Loop");

            XAttribute trackAttr = musicNode.Attribute("nsftrack");

            if (introNode != null || loopNode != null)
            {
                music.Type = AudioType.Wav;
                if (introNode != null) music.IntroPath = FilePath.FromRelative(introNode.Value, basePath);
                if (loopNode != null) music.LoopPath = FilePath.FromRelative(loopNode.Value, basePath);
            }
            else if (trackAttr != null)
            {
                music.Type = AudioType.NSF;

                int track;
                if (!trackAttr.Value.TryParse(out track) || track <= 0) throw new GameXmlException(trackAttr, "Sound track attribute must be an integer greater than zero.");
                music.NsfTrack = track;
            }
            else
            {
                music.Type = AudioType.Unknown;
            }

            return music;
        }
Пример #2
0
        public virtual void ReadXml(System.Xml.Linq.XElement element)
        {
            //CurrentID
            Question.CurrentID = element.ReadInt("QuCurrentID");
            Answer.CurrentID   = element.ReadInt("AnCurrentID");
            //qustions
            XElement elem = element.Element("Questions");

            Questions.Clear();
            foreach (XElement e in elem.Elements())
            {
                Question qustion = new Question(true);

                qustion.ReadXml(e);


                Questions.Add(qustion);
            }
            //answers
            elem = element.Element("Answers");
            Answers.Clear();
            foreach (XElement e in elem.Elements())
            {
                Answer answer = new Answer(true);
                answer.ReadXml(e);
                Answers.Add(answer);
            }
        }
        /// <summary>
        /// Initializes a new instance of the EnumDefinition class
        /// Populates this object with information extracted from the XML
        /// </summary>
        /// <param name="theNode">XML node describing the Enum object</param>
        /// <param name="manager">The data dictionary manager constructing this type.</param>
        public EnumDefinition(XElement theNode, DictionaryManager manager)
            : base(theNode, TypeId.EnumType)
        {
            // ByteSize may be set either directly as an integer or by inference from the Type field.
            // If no Type field is present then the type is assumed to be 'int'
            if (theNode.Element("ByteSize") != null)
            {
                SetByteSize(theNode.Element("ByteSize").Value);
            }
            else
            {
                string baseTypeName = theNode.Element("Type") != null ? theNode.Element("Type").Value : "int";

                BaseType = manager.GetElementType(baseTypeName);
                BaseType = DictionaryManager.DereferenceTypeDef(BaseType);

                FixedSizeBytes = BaseType.FixedSizeBytes.Value;
            }

            // Common properties are parsed by the base class.
            // Remaining properties are the Name/Value Literal elements
            List<LiteralDefinition> theLiterals = new List<LiteralDefinition>();
            foreach (var literalNode in theNode.Elements("Literal"))
            {
                theLiterals.Add(new LiteralDefinition(literalNode));
            }

            m_Literals = new ReadOnlyCollection<LiteralDefinition>(theLiterals);

            // Check the name. If it's null then make one up
            if (theNode.Element("Name") == null)
            {
                Name = String.Format("Enum_{0}", Ref);
            }
        }
Пример #4
0
 public Request(XElement root)
 {
     Root = root;
     Type = RequestFactory.GetAttributeValue(Root, "type");
     RequestRoot = Root.Element("request");
     ResponseRoot = Root.Element("response");
 }
Пример #5
0
 public static string AuthName(XElement n)
 {
     string authName = "";
     if (n.Element("LocalAuthorityName") != null)
         authName = (string)n.Element("LocalAuthorityName");
     return authName;
 }
Пример #6
0
 public static string Addr3(XElement n)
 {
     string addre3 = "";
     if (n.Element("AddressLine3") != null)
         addre3 = (string)n.Element("AddressLine3");
     return addre3;
 }
Пример #7
0
 public static string Addr2(XElement n)
 {
     string addre2 = "";
     if (n.Element("AddressLine2") != null)
         addre2 = (string)n.Element("AddressLine2");
     return addre2;
 }
        /// <summary>
        /// Imports the <see cref="ManagedAuthenticatedEncryptorDescriptor"/> from serialized XML.
        /// </summary>
        public IAuthenticatedEncryptorDescriptor ImportFromXml(XElement element)
        {
            if (element == null)
            {
                throw new ArgumentNullException(nameof(element));
            }

            // <descriptor>
            //   <!-- managed implementations -->
            //   <encryption algorithm="..." keyLength="..." />
            //   <validation algorithm="..." />
            //   <masterKey>...</masterKey>
            // </descriptor>

            var settings = new ManagedAuthenticatedEncryptionSettings();

            var encryptionElement = element.Element("encryption");
            settings.EncryptionAlgorithmType = FriendlyNameToType((string)encryptionElement.Attribute("algorithm"));
            settings.EncryptionAlgorithmKeySize = (int)encryptionElement.Attribute("keyLength");

            var validationElement = element.Element("validation");
            settings.ValidationAlgorithmType = FriendlyNameToType((string)validationElement.Attribute("algorithm"));

            Secret masterKey = ((string)element.Element("masterKey")).ToSecret();

            return new ManagedAuthenticatedEncryptorDescriptor(settings, masterKey, _services);
        }
Пример #9
0
		    // ReSharper disable once MemberHidesStaticFromOuterClass
		    public static YesNoQuestion ReadXml(XElement e)
		    {
		        var i = new YesNoQuestion();
		        i.Question = e.Element("Question")?.Value;
		        i.SmallGroup = e.Element("SmallGroup")?.Value ?? i.Question;
		        return i;
		    }
Пример #10
0
        private static void ParseSettings(System.Xml.Linq.XElement xml)
        {
            cpu.SimulationMultiplier = double.Parse(System.Convert.ToString(cpu.SimulationMultiplier));

            cpu.Clock = double.Parse(System.Convert.ToString(cpu.Clock));

            for (int i = 0; i <= 512 - 1; i++)
            {
                if (cpu.FloppyContoller.get_DiskImage(i) != null)
                {
                    cpu.FloppyContoller.get_DiskImage(i).Close();
                }
            }

            foreach (var f in xml.Element("floppies").Elements("floppy"))
            {
                int    index = (char)(System.Convert.ToChar(f.Element("letter").Value)) - 65;
                string image = System.Convert.ToString(f.Element("image").Value);
                bool   ro    = bool.Parse(System.Convert.ToString(f.Element("readOnly").Value));

                cpu.FloppyContoller.set_DiskImage(index, new DiskImage(image, ro));
            }

            foreach (var d in xml.Element("disks").Elements("disk"))
            {
                int    index = (char)(System.Convert.ToChar(d.Element("letter").Value)) - 67 + 128;
                string image = System.Convert.ToString(d.Element("image").Value);
                bool   ro    = bool.Parse(System.Convert.ToString(d.Element("readOnly").Value));

                cpu.FloppyContoller.set_DiskImage(index, new DiskImage(image, ro, true));
            }
        }
Пример #11
0
        private static EDM Read(XElement edmx, Action<XElement> readMoreAction)
        {
            XElement edmxRuntime = edmx.Element(XName.Get("Runtime", edmxNamespace.NamespaceName));

            SSDLContainer ssdlContainer = SSDLIO.ReadXElement(edmxRuntime);
            CSDLContainer csdlContainer = CSDLIO.ReadXElement(edmxRuntime);
            XElement edmxDesigner = edmx.Element(XName.Get("Designer", edmxNamespace.NamespaceName));
            
            if (ssdlContainer == null && csdlContainer == null)
            	return new EDM();

            EDM edm = new EDM()
            {
                SSDLContainer = ssdlContainer,
                CSDLContainer = MSLIO.IntegrateMSLInCSDLContainer(csdlContainer, ssdlContainer, edmxRuntime),
            };

            if (edmxDesigner != null)
            {
                if (edmxDesigner.Element(XName.Get("Connection", edmxNamespace.NamespaceName)) != null)
                    edm.DesignerProperties = edmxDesigner.Element(XName.Get("Connection", edmxNamespace.NamespaceName)).Element(XName.Get("DesignerInfoPropertySet", edmxNamespace.NamespaceName)).Elements(XName.Get("DesignerProperty", edmxNamespace.NamespaceName)).Select(e => new DesignerProperty { Name = e.Attribute("Name").Value, Value = e.Attribute("Value").Value });

                if (edmxDesigner.Element(XName.Get("Options", edmxNamespace.NamespaceName)) != null)
                    edm.EDMXDesignerDesignerProperties = edmxDesigner.Element(XName.Get("Options", edmxNamespace.NamespaceName)).Element(XName.Get("DesignerInfoPropertySet", edmxNamespace.NamespaceName)).Elements(XName.Get("DesignerProperty", edmxNamespace.NamespaceName)).Select(e => new DesignerProperty { Name = e.Attribute("Name").Value, Value = e.Attribute("Value").Value });

                if (edmxDesigner.Element(XName.Get("Diagrams", edmxNamespace.NamespaceName)) != null)
                    edm.EDMXDesignerDiagrams = edmxDesigner.Element(XName.Get("Diagrams", edmxNamespace.NamespaceName)).Elements(XName.Get("Diagram", edmxNamespace.NamespaceName));
            }

            readMoreAction(edmx);
            return edm;
        }
Пример #12
0
        public static IEnumerable<RssItem> ConvertXmlToRss(XElement feed, int count)
        {
            XNamespace ns = "http://www.w3.org/2005/Atom";

            // see if RSS or Atom

            // RSS
            if (feed.Element("channel") != null)
                return (from item in feed.Element("channel").Elements("item")
                        select new RssItem
                        {
                            Title = StripTags(item.Element("title").Value, 200),
                            Link = item.Element("link").Value,
                            Description = StripTags(item.Element("description").Value, 200)
                        }).Take(count);

            // Atom
            else if (feed.Element(ns + "entry") != null)
                return (from item in feed.Elements(ns + "entry")
                        select new RssItem
                        {
                            Title = StripTags(item.Element(ns + "title").Value, 200),
                            Link = item.Element(ns + "link").Attribute("href").Value,
                            Description = StripTags(item.Element(ns + "content").Value, 200)
                        }).Take(count);

            // Invalid
            else
                return null;
        }
Пример #13
0
 public void Load(System.Xml.Linq.XElement parentNode)
 {
     ProteinFileName        = parentNode.Element("ProteinFileName").Value;
     QuanPeptideFileName    = parentNode.Element("QuanPeptideFileName").Value;
     ExpermentalDesignFile  = parentNode.Element("ExpermentalDesignFile").Value;
     PeptideToProteinMethod = parentNode.Element("PeptideToProteinMethod").Value;
 }
Пример #14
0
        // TMX tileset element constructor
        public TmxTileset(XElement xTileset, string tmxDir = "")
        {
            var xFirstGid = xTileset.Attribute("firstgid");
            var source = (string) xTileset.Attribute("source");

            if (source != null)
            {
                // Prepend the parent TMX directory if necessary
                source = Path.Combine(tmxDir, source);

                // source is always preceded by firstgid
                FirstGid = (int) xFirstGid;

                // Everything else is in the TSX file
                var xDocTileset = ReadXml(source);
                var ts = new TmxTileset(xDocTileset, TmxDirectory);
                Name = ts.Name;
                TileWidth = ts.TileWidth;
                TileHeight = ts.TileHeight;
                Spacing = ts.Spacing;
                Margin = ts.Margin;
                TileCount = ts.TileCount;
                TileOffset = ts.TileOffset;
                Image = ts.Image;
                Terrains = ts.Terrains;
                Tiles = ts.Tiles;
                Properties = ts.Properties;
            }
            else
            {
                // firstgid is always in TMX, but not TSX
                if (xFirstGid != null)
                    FirstGid = (int) xFirstGid;

                Name = (string) xTileset.Attribute("name");
                TileWidth = (int) xTileset.Attribute("tilewidth");
                TileHeight = (int) xTileset.Attribute("tileheight");
                Spacing = (int?) xTileset.Attribute("spacing") ?? 0;
                Margin = (int?) xTileset.Attribute("margin") ?? 0;
                TileCount = (int?) xTileset.Attribute("tilecount");
                TileOffset = new TmxTileOffset(xTileset.Element("tileoffset"));
                Image = new TmxImage(xTileset.Element("image"), tmxDir);

                Terrains = new TmxList<TmxTerrain>();
                var xTerrainType = xTileset.Element("terraintypes");
                if (xTerrainType != null) {
                    foreach (var e in xTerrainType.Elements("terrain"))
                        Terrains.Add(new TmxTerrain(e));
                }

                Tiles = new Collection<TmxTilesetTile>();
                foreach (var xTile in xTileset.Elements("tile"))
                {
                    var tile = new TmxTilesetTile(xTile, Terrains, tmxDir);
                    Tiles.Add(tile);
                }

                Properties = new PropertyDict(xTileset.Element("properties"));
            }
        }
Пример #15
0
        private static IEnumerable<IDictionary<string, object>> GetData(XElement feed)
        {
            bool mediaStream = feed.Element(null, "entry") != null &&
                               feed.Element(null, "entry").Descendants(null, "link").Attributes("rel").Any(
                                   x => x.Value == "edit-media");

            var entryElements = feed.Name.LocalName == "feed"
                              ? feed.Elements(null, "entry")
                              : new[] { feed };

            foreach (var entry in entryElements)
            {
                var entryData = new Dictionary<string, object>();

                var linkElements = entry.Elements(null, "link").Where(x => x.Descendants("m", "inline").Any());
                foreach (var linkElement in linkElements)
                {
                    var linkData = GetLinks(linkElement);
                    entryData.Add(linkElement.Attribute("title").Value, linkData);
                }

                var entityElement = mediaStream ? entry : entry.Element(null, "content");
                var properties = GetProperties(entityElement).ToIDictionary();
                properties.ToList().ForEach(x => entryData.Add(x.Key, x.Value));

                yield return entryData;
            }
        }
Пример #16
0
        public PauseScreen(XElement reader, string basePath)
        {
            weapons = new List<PauseWeaponInfo>();
            inventory = new List<InventoryInfo>();

            XElement changeNode = reader.Element("ChangeSound");
            if (changeNode != null) ChangeSound = SoundInfo.FromXml(changeNode, basePath);

            XElement soundNode = reader.Element("PauseSound");
            if (soundNode != null) PauseSound = SoundInfo.FromXml(soundNode, basePath);

            XElement backgroundNode = reader.Element("Background");
            if (backgroundNode != null) Background = FilePath.FromRelative(backgroundNode.Value, basePath);

            foreach (XElement weapon in reader.Elements("Weapon"))
                weapons.Add(PauseWeaponInfo.FromXml(weapon, basePath));

            XElement livesNode = reader.Element("Lives");
            if (livesNode != null)
            {
                LivesPosition = new Point(livesNode.GetInteger("x"), livesNode.GetInteger("y"));
            }

            foreach (XElement inventoryNode in reader.Elements("Inventory"))
            {
                inventory.Add(InventoryInfo.FromXml(inventoryNode, basePath));
            }
        }
Пример #17
0
        private void ParseCommand(System.Xml.Linq.XElement commandElement)
        {
            // Wrap a big, OMG, what have I done ???, undo around the whole thing !!!

            int undoScope = Globals.ThisAddIn.Application.BeginUndoScope("ParseCommand");

            // These are the top level elements that can appear in a command.
            // A command can contain more than one.

            if (commandElement.Elements("Documents").Any())
            {
                ProcessCommand_Documents(commandElement.Element("Documents").Elements());
            }

            if (commandElement.Elements("Layers").Any())
            {
                ProcessCommand_Layers(commandElement.Element("Layers").Elements());
            }

            if (commandElement.Elements("Pages").Any())
            {
                ProcessCommand_Pages(commandElement.Element("Pages").Elements());
            }

            if (commandElement.Elements("Shapes").Any())
            {
                ProcessCommand_Shapes(commandElement.Element("Shapes").Elements());
            }

            Globals.ThisAddIn.Application.EndUndoScope(undoScope, true);
        }
Пример #18
0
        /// <summary>
        /// Gets the method signature from the method definition srcML element.
        /// </summary>
        /// <param name="methodElement">The srcML method element to extract the signature from.</param>
        /// <returns>The method signature</returns>
        public static string GetMethodSignature(XElement methodElement) {
            if(methodElement == null) {
                throw new ArgumentNullException("methodElement");
            }
            if(!(new[] { SRC.Function, SRC.Constructor, SRC.Destructor }).Contains(methodElement.Name)) {
                throw new ArgumentException(string.Format("Not a valid method element: {0}", methodElement.Name), "methodElement");
            }

            var sig = new StringBuilder();
            var lastSigElement = methodElement.Element(SRC.ParameterList);
            if(lastSigElement == null) {
                lastSigElement = methodElement.Element(SRC.Name);
            }
            if(lastSigElement != null) {
                //add all the text and whitespace prior to the last element
                foreach(var n in lastSigElement.NodesBeforeSelf()) {
                    if(n.NodeType == XmlNodeType.Element) {
                        sig.Append(((XElement)n).Value);
                    } else if(n.NodeType == XmlNodeType.Text || n.NodeType == XmlNodeType.Whitespace || n.NodeType == XmlNodeType.SignificantWhitespace) {
                        sig.Append(((XText)n).Value);
                    }
                }
                //add the last element
                sig.Append(lastSigElement.Value);
            } else {
                //no name or parameter list, anonymous method?
            }

            //convert whitespace chars to spaces and condense any consecutive whitespaces.
            return Regex.Replace(sig.ToString().Trim(), @"\s+", " ");
        }
Пример #19
0
        public static Transaction FromXml(XElement tran)
        {
            if (tran == null)
            {
                return null;
            }
            var ret = new Transaction(
                tran.ToString(),
                tran.GetStringChild("amount"),
                tran.GetStringChild("on_test_gateway"),
                tran.GetStringChild("succeeded"),
                tran.GetStringChild("token"),
                tran.Element("payment_method").GetStringChild("number"),
                tran.Element("response").GetStringChild("avs_code"),
                new TransactionErrors(tran)
                );

            ret.GatewayTransactionId = tran.GetStringChild("gateway_transaction_id");
            ret.CreatedAt = DateTime.Parse(tran.GetStringChild("created_at"));
            ret.PaymentMethodToken = tran.Element("payment_method").GetStringChild("token");

            if (ret.Succeeded == false && ret.Errors.Count == 0)
            {
                if (string.Equals(tran.GetStringChild("state"), "gateway_processing_failed",
                                  StringComparison.InvariantCultureIgnoreCase))
                {

                    ret.Errors = new TransactionErrors("",TransactionErrorType.Unknown);
                }
            }
            return ret;
        }
Пример #20
0
        public LanguageModel<T> Load(XElement xLanguageModel)
        {
            var metadata = xLanguageModel.Element(MetadataElement).Elements().ToDictionary(el => el.Name.ToString(), el => el.Value);
            var xLanguage = xLanguageModel.Element(LanguageElement);
            string iso639_2T = null;
            var xIso639_2T = xLanguage.Attribute(LanguageIso639_2T_Attribute);
            if (xIso639_2T != null)
                iso639_2T = xIso639_2T.Value;
            string iso639_3 = null;
            var xIso639_3 = xLanguage.Attribute(LanguageIso639_3_Attribute);
            if (xIso639_3 != null)
                iso639_3 = xIso639_3.Value;
            string englishName = null;
            var xEnglishName = xLanguage.Attribute(LanguageEnglishNameAttribute);
            if (xEnglishName != null)
                englishName = xEnglishName.Value;
            string localName = null;
            var xLocalName = xLanguage.Attribute(LanguageLocalNameAttribute);
            if (xLocalName != null)
                localName = xLocalName.Value;
            var language = new LanguageInfo(iso639_2T, iso639_3, englishName, localName);

            var features = new Distribution<T>(new Bag<T>());
            var xNgramsElement = xLanguageModel.Element(NGramsElement);
            foreach (var xElement in xNgramsElement.Elements(NGramElement))
            {
                features.AddEvent(_deserializeFeature(xElement.Attribute(TextAttribute).Value), long.Parse(xElement.Attribute(CountAttribute).Value));
            }
            features.AddNoise(long.Parse(xNgramsElement.Attribute(TotalNoiseCountAtribute).Value), long.Parse(xNgramsElement.Attribute(DistinctNoiseCountAtribute).Value));
            return new LanguageModel<T>(features, language, metadata);
        }
Пример #21
0
        /// <summary>
        /// Constructs a Pm25RegionalUpdate from an XElement.
        /// Expects the XElement to be a "region" node in the XML response from
        /// NEA's PSI API.
        /// </summary>
        /// <param name="region"></param>
        /// <returns></returns>
        public static Pm25RegionalUpdate FromXElement(XElement region)
        {
            Region ourRegion = RegionUtils.Parse(region.Element("id").Value);

            var readingElement = (from element in region.Descendants("reading")
                                  where (string)element.Attribute("type") == XML_PM25_READING_TYPE
                                  select element).First();
            float readingValue;
            NumberParser.ParseFloatOrThrowException(readingElement.Attribute("value").Value, out readingValue, PARSE_PM25_ERROR);

            float latitude;
            NumberParser.ParseFloatOrThrowException(region.Element("latitude").Value, out latitude, PARSE_LATITUDE_ERROR);

            float longitude;
            NumberParser.ParseFloatOrThrowException(region.Element("longitude").Value, out longitude, PARSE_LONGITUDE_ERROR);

            var rawTimeStamp = region.Element("record").Attribute("timestamp").Value;
            var timestamp = DateParser.Parse(rawTimeStamp);

            return new Pm25RegionalUpdate
            {
                Region = ourRegion,
                Reading = readingValue,
                Latitude = latitude,
                Longitude = longitude,
                TimeStamp = timestamp
            };
        }
     // function to insert into database
 public XElement insert(XElement dbe, DBEngine<int, DBElement<int, string>> db)
 {
     DBElement<int, string> elem = new DBElement<int, string>();
     Console.WriteLine("\n");
     Console.WriteLine("\n----------Insert operation----------");
     elem.name = dbe.Element("name").Value;
     elem.descr = dbe.Element("descr").Value;
     elem.payload = dbe.Element("payload").Value;
     List<int> childrenlist = new List<int>();
     XElement db1 = dbe.Element("children");
     foreach (var v in db1.Elements("dbkey")) childrenlist.Add(Int32.Parse(v.Value));
     elem.children = childrenlist;
     bool result = db.insert(Int32.Parse((dbe.Element("key").Value)), elem);
     db.showDB();
     if (result == true)
     {
         XElement s = new XElement("result", "\n element inserted successfully ");
         return s;
     }
     else
     {
         XElement f = new XElement("result", "Failure");
         return f;
     }
 }
Пример #23
0
		private Broadcast GetBroadcast(XElement xml) {
			DateTime startTime=TimeZoneInfo.ConvertTime(
				DateTime.ParseExact(xml.Element("date_prog").Value, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture),
				timezone, TimeZoneInfo.Local);
			string caption=xml.Element("chanson").Value;
			return new Broadcast(startTime, startTime.AddSeconds(TimerTimeout), allCapsRx.IsMatch(caption) ? caption.ToCapitalized():caption);
		}
 internal override void LoadFromXml(XElement xRoot)
 {
     if (xRoot != null && xRoot.Element(XmlConstants.ReceivedMessage) != null)
     {
         ReceivedMessage = xRoot.Element(XmlConstants.ReceivedMessage).Value;
     }
 }
Пример #25
0
        public static InventoryInfo FromXml(XElement inventoryNode, string basePath)
        {
            InventoryInfo info = new InventoryInfo();
            info.Name = inventoryNode.RequireAttribute("name").Value;

            var useAttr = inventoryNode.Attribute("use");
            if (useAttr != null)
            {
                info.UseFunction = useAttr.Value;
            }

            var iconNode = inventoryNode.Element("Icon");
            if (iconNode != null)
            {
                info.IconOn = FilePath.FromRelative(iconNode.RequireAttribute("on").Value, basePath);
                info.IconOff = FilePath.FromRelative(iconNode.RequireAttribute("off").Value, basePath);
            }

            info.IconLocation = new Point(iconNode.GetInteger("x"), iconNode.GetInteger("y"));

            var numberNode = inventoryNode.Element("Number");
            if (numberNode != null)
            {
                info.NumberLocation = new Point(numberNode.GetInteger("x"), numberNode.GetInteger("y"));
            }

            bool b = true;
            inventoryNode.TryBool("selectable", out b);
            info.Selectable = b;

            return info;
        }
Пример #26
0
        public IEnumerable<Journal> ParseJournal(XElement recordElement)
        {
            var regularJournal = new Journal
            {
                Title = recordElement.Element("Title").Value,
                ISSN = recordElement.Element("ISSN").Value,
                Link = recordElement.Element("JournalWebsiteURL").Value,
                Publisher = ParsePublisher(recordElement),
                Country = ParseCountry(recordElement),
                Languages = this.ParseLanguages(recordElement),
                Subjects = this.ParseSubjects(recordElement),
                DataSource = JournalsImportSource.Ulrichs.ToString(),
                OpenAccess = IsOpenAccessJournal(recordElement)
            };

            yield return regularJournal;

            foreach (var alternateEditionElement in GetAlternateEditionElements(recordElement))
            {
                yield return new Journal
                {
                    Title = regularJournal.Title,
                    ISSN = alternateEditionElement.Element("ISSN").Value,
                    Link = regularJournal.Link,
                    Publisher = ParsePublisher(recordElement),
                    Country = ParseCountry(recordElement),
                    Languages = this.ParseLanguages(recordElement),
                    Subjects = this.ParseSubjects(recordElement),
                    DataSource = JournalsImportSource.Ulrichs.ToString(),
                    OpenAccess = IsOpenAccessJournal(recordElement)
                };
            }
        }
        public static TestConfigurations ReadFromXml(XElement testConfigurationsElement)
        {
            TestConfigurations result = new TestConfigurations();
            result.TargetTenantName = (string)testConfigurationsElement.Element("TargetTestTenant");

            List<TenantConfiguration> tenantConfigurationList = new List<TenantConfiguration>();
            foreach (XElement tenantConfigurationElement in testConfigurationsElement.Element("TenantConfigurations").Elements("TenantConfiguration"))
            {
                TenantConfiguration config = new TenantConfiguration();
                config.TenantName = (string)tenantConfigurationElement.Element("TenantName");
                config.AccountName = (string)tenantConfigurationElement.Element("AccountName");
                config.AccountKey = (string)tenantConfigurationElement.Element("AccountKey");
                config.BlobServiceEndpoint = (string)tenantConfigurationElement.Element("BlobServiceEndpoint");
                config.QueueServiceEndpoint = (string)tenantConfigurationElement.Element("QueueServiceEndpoint");
                config.TableServiceEndpoint = (string)tenantConfigurationElement.Element("TableServiceEndpoint");
                config.BlobServiceSecondaryEndpoint = (string)tenantConfigurationElement.Element("BlobServiceSecondaryEndpoint");
                config.QueueServiceSecondaryEndpoint = (string)tenantConfigurationElement.Element("QueueServiceSecondaryEndpoint");
                config.TableServiceSecondaryEndpoint = (string)tenantConfigurationElement.Element("TableServiceSecondaryEndpoint");
                config.TenantType = (TenantType)Enum.Parse(typeof(TenantType), (string)tenantConfigurationElement.Element("TenantType"), true);
                tenantConfigurationList.Add(config);
            }

            result.TenantConfigurations = tenantConfigurationList;
            return result;
        }
Пример #28
0
        public object ParseArgumentValue(System.Xml.Linq.XElement ele)
        {
            if (ele == null)
            {
                return(null);
            }
            XElement node = ele.Element("outlonMin");

            if (node != null)
            {
                _lonMin = double.Parse(node.Value);
            }
            node = ele.Element("outlonMax");
            if (node != null)
            {
                _lonMax = double.Parse(node.Value);
            }
            node = ele.Element("outlatMin");
            if (node != null)
            {
                _latMin = double.Parse(node.Value);
            }
            node = ele.Element("outlatMax");
            if (node != null)
            {
                _latMax = double.Parse(node.Value);
            }
            SetDefalutValue();
            Dictionary <string, string> dic = GetOutEvenlope();

            return(dic);
        }
Пример #29
0
 public static string Addr4(XElement n)
 {
     string addre4 = "";
     if (n.Element("AddressLine4") != null)
         addre4 = (string)n.Element("AddressLine4");
     return addre4;
 }
Пример #30
0
 public TemplateLoader(XElement templatesElement)
 {
     XElement levelTemplateElement = templatesElement.Element("levels");
     XElement scoreTemplateElement = templatesElement.Element("scores");
     _levelTemplateLoader = new LevelTemplateLoader(levelTemplateElement);
     _scoreTemplateLoader = new ScoreTableLoader(scoreTemplateElement);
 }
        /// <summary>
        /// Imports the <see cref="CngCbcAuthenticatedEncryptorDescriptor"/> from serialized XML.
        /// </summary>
        public IAuthenticatedEncryptorDescriptor ImportFromXml(XElement element)
        {
            if (element == null)
            {
                throw new ArgumentNullException(nameof(element));
            }

            // <descriptor>
            //   <!-- Windows CNG-CBC -->
            //   <encryption algorithm="..." keyLength="..." [provider="..."] />
            //   <hash algorithm="..." [provider="..."] />
            //   <masterKey>...</masterKey>
            // </descriptor>

            var settings = new CngCbcAuthenticatedEncryptionSettings();

            var encryptionElement = element.Element("encryption");
            settings.EncryptionAlgorithm = (string)encryptionElement.Attribute("algorithm");
            settings.EncryptionAlgorithmKeySize = (int)encryptionElement.Attribute("keyLength");
            settings.EncryptionAlgorithmProvider = (string)encryptionElement.Attribute("provider"); // could be null

            var hashElement = element.Element("hash");
            settings.HashAlgorithm = (string)hashElement.Attribute("algorithm");
            settings.HashAlgorithmProvider = (string)hashElement.Attribute("provider"); // could be null

            Secret masterKey = ((string)element.Element("masterKey")).ToSecret();

            return new CngCbcAuthenticatedEncryptorDescriptor(settings, masterKey, _services);
        }
		private List<OutputSetting> ParseOutputSetting(XElement outputsElement)
		{
			List<OutputSetting> outputSettings = new List<OutputSetting>();

			FileOutputSetting fileSetting = FileOutputSetting.Create(outputsElement.Element("file"));

			if (fileSetting != null)
			{
				outputSettings.Add(fileSetting);
			}

			ConsoleOutputSetting consoleSetting = ConsoleOutputSetting.Create(outputsElement.Element("console"));

			if (consoleSetting != null)
			{
				outputSettings.Add(consoleSetting);
			}

			EmailOutputSetting emailSetting = EmailOutputSetting.Create(outputsElement.Element("email"));

			if (emailSetting != null)
			{
				outputSettings.Add(emailSetting);
			}
			
			return outputSettings;
		}
        private static void BindCollection(object model, Type modelType, string prefix, XElement properties)
        {
            var element = properties.Element(d + prefix + CountSuffix);

            if (element == null || string.IsNullOrEmpty(element.Value))
            {
                return;
            }

            var count = (int)element;

            for (int i = 0; i < count; i++)
            {
                var value = default(object);

                if (!TypeHelpers.IsComplexType(modelType))
                {
                    var elem = properties.Element(d + prefix + Separator + i);

                    if (elem != null)
                    {
                        value = TypeDescriptor.GetConverter(modelType).ConvertFrom(elem.Value);
                    }
                }
                else
                {
                    value = TypeHelpers.Create(modelType);

                    BindModel(value, modelType, prefix + Separator + i, properties);
                }

                ((IList)model).Add(value);
            }
        }
Пример #34
0
        public RoleConfiguration(XElement data)
        {
            this.Name = data.Attribute("name").Value;
            this.InstanceCount = int.Parse(data.Element(this.ns + "Instances").Attribute("count").Value, CultureInfo.InvariantCulture);

            this.Settings = new Dictionary<string, string>();

            if (data.Element(this.ns + "ConfigurationSettings") != null)
            {
                foreach (var setting in data.Element(this.ns + "ConfigurationSettings").Descendants())
                {
                    this.Settings.Add(setting.Attribute("name").Value, setting.Attribute("value").Value);
                }
            }

            this.Certificates = new Dictionary<string, CertificateConfiguration>();

            if (data.Element(this.ns + "Certificates") != null)
            {
                foreach (var setting in data.Element(this.ns + "Certificates").Descendants())
                {
                    var certificate = new CertificateConfiguration
                    {
                        Thumbprint = setting.Attribute("thumbprint").Value,
                        ThumbprintAlgorithm = setting.Attribute("thumbprintAlgorithm").Value
                    };

                    this.Certificates.Add(setting.Attribute("name").Value, certificate);
                }
            }
        }
Пример #35
0
    public static new FloatStat fromXML(XElement xmlStat)
    {
        if (xmlStat == null)
        {
            return null;
        }

        float min = 0;
        float max = 1;

        if (xmlStat.Element("Min") != null)
        {
            min = (float)xmlStat.Element("Min");
        }
        else
        {
            Debug.Log("No Minimum Specified for float range");  //Comment this out if it gets annoying.
        }

        if (xmlStat.Element("Max") != null)
        {
            max = (float)xmlStat.Element("Max");
        }
        else
        {
            Debug.Log("No Maximum Specified for float range");  //Comment this out if it gets annoying.
        }

        FloatStat newStat = new FloatStatRange(min, max);

        return newStat;
    }
Пример #36
0
 public void Load(System.Xml.Linq.XElement parentNode)
 {
     PeptideFile          = parentNode.Element("PeptideFile").Value;
     DesignFile           = parentNode.Element("DesignFile").Value;
     PerformNormalizition = bool.Parse(parentNode.Element("PerformNormalization").Value);
     Mode = EnumUtils.StringToEnum <QuantifyMode>(parentNode.FindElement("QuantifyMode").Value, QuantifyMode.qmAll);
     ModifiedAminoacids     = parentNode.Element("ModifiedAminoacids").Value;
     MinimumSiteProbability = double.Parse(parentNode.Element("MinimumSiteProbability").Value);
 }
Пример #37
0
        public object ParseArgumentValue(System.Xml.Linq.XElement ele)
        {
            XElement nodea = ele.Element("ValueItemA");
            XElement nodeb = ele.Element("ValueItemB");

            string a = nodea.Attribute("value").Value;
            string b = nodeb.Attribute("value").Value;

            txtpa.Text = a;
            txtpb.Text = b;
            return(null);
        }
        public static void LoadFromXml(this Dictionary <string, List <string> > dic, System.Xml.Linq.XElement option, string nodeName, ref string pattern)
        {
            dic.Clear();

            if (option.Element(nodeName) == null && option.Element("ClassificationSet") != null)
            {
                nodeName = "ClassificationSet";
            }

            var result =
                (from item in option.Descendants(nodeName)
                 select item).FirstOrDefault();

            if (null == result)
            {
                return;
            }

            if (result.Element("Pattern") == null)
            {
                pattern = "(.*)";
            }
            else
            {
                pattern = result.Element("Pattern").Value;
            }

            if (result.Element("ClassificationItem") == null)
            {
                foreach (var node in result.Descendants("Set"))
                {
                    var lst = new List <string>();
                    dic[node.Attribute("Key").Value] = lst;
                    foreach (var subNode in node.Descendants("Value"))
                    {
                        lst.Add(subNode.Value);
                    }
                }
            }
            else
            {
                foreach (var node in result.Descendants("ClassificationItem"))
                {
                    var lst = new List <string>();
                    dic[node.Element("classifiedName").Value] = lst;
                    foreach (var subNode in node.Descendants("experimentName"))
                    {
                        lst.Add(subNode.Value);
                    }
                }
            }
        }
Пример #39
0
 /// <summary>
 /// 返回错误值
 /// </summary>
 /// <param name="result"></param>
 /// <param name="ComID"></param>
 /// <param name="appId"></param>
 /// <param name="appSecret"></param>
 /// <returns></returns>
 public static string GetRrrCode(string result)
 {
     System.Xml.Linq.XDocument doc  = com.weixin.Utility.XmlUtility.ParseJson(result, "root");
     System.Xml.Linq.XElement  root = doc.Root;
     if (root != null)
     {
         if (root.Element("errcode") != null)
         {
             return(root.Element("errcode").Value);
         }
     }
     return(null);
 }
Пример #40
0
 public void Load(System.Xml.Linq.XElement parentNode)
 {
     PlexType     = IsobaricTypeFactory.Find(parentNode.Element("IsobaricType").Value);
     IsobaricFile = parentNode.Element("IsobaricFileName").Value;
     References   = (from reffunc in parentNode.Element("References").Elements("Reference")
                     select new IsobaricIndex(reffunc.Attribute("Name").Value, int.Parse(reffunc.Attribute("Index").Value))).ToList();
     DatasetMap = new Dictionary <string, List <string> >();
     foreach (var ds in parentNode.Element("DatasetMap").Elements("Dataset"))
     {
         var name  = ds.Element("Name").Value;
         var value = (from v in ds.Element("Values").Elements("Value") select v.Value).ToList();
         DatasetMap[name] = value;
     }
 }
Пример #41
0
        public object ParseArgumentValue(System.Xml.Linq.XElement ele)
        {
            XElement nodea      = ele.Element("ValueItemA");
            XElement nodeb      = ele.Element("ValueItemB");
            XElement nodemax    = ele.Element("ValueItemMax");
            string   a          = nodea.Attribute("value").Value;
            string   b          = nodeb.Attribute("value").Value;
            string   maxdefaule = nodemax.Attribute("value").Value;

            txta.Text            = a;
            txtb.Text            = b;
            this.txtndvimax.Text = maxdefaule;
            return(null);
        }
Пример #42
0
        private void ReadLanguage()
        {
            try
            {
                System.Xml.Linq.XElement xml = System.Xml.Linq.XElement.Load(Application.StartupPath + System.IO.Path.DirectorySeparatorChar +
                                                                             "Plugins" + System.IO.Path.DirectorySeparatorChar + "Ninokuni.xml");
                xml = xml.Element(pluginHost.Get_Language()).Element("SQcontrol");

                label1.Text = xml.Element("S00").Value;
                label2.Text = xml.Element("S01").Value;
                //label3.Text = xml.Element("S02").Value;
                btnSave.Text = xml.Element("S03").Value;
            }
            catch { throw new NotSupportedException("There was an error reading the language file"); }
        }
Пример #43
0
        public object ParseArgumentValue(System.Xml.Linq.XElement ele)
        {
            if (ele == null)
            {
                return(null);
            }
            XElement segEle = ele.Element(XName.Get("Segements"));

            if (segEle == null)
            {
                return(null);
            }
            IEnumerable <XElement> segs = segEle.Elements(XName.Get("Segement"));

            if (segs == null || segs.Count() == 0)
            {
                return(null);
            }
            SortedDictionary <float, float> values = new SortedDictionary <float, float>();

            foreach (XElement seg in segs)
            {
                ParseMinMaxValue(seg, ref values);
            }
            return(values.Count != 0 ? values : null);
        }
Пример #44
0
        public override bool BuildCfg(System.Xml.Linq.XElement xe, ref string reStr)
        {
            if (!base.BuildCfg(xe, ref reStr))
            {
                return(false);
            }
            XElement selfDataXE = xe.Element("SelfDatainfo");
            XElement machineXE  = selfDataXE.Element("AircheckMachine");

            this.detectTimeout = int.Parse(machineXE.Attribute("detectTimeOut").Value);
            if (detectTimeout < 1000)
            {
                this.detectTimeout = 1000;
            }
            if (detectTimeout > 60000)
            {
                this.detectTimeout = 60000;
            }
            XElement detectCodeXE = selfDataXE.Element("DeftectCode");

            this.detectCode = detectCodeXE.Value.ToString();

            this.dicCommuDataDB1[1].DataDescription = "1:检查OK,放行,2:读卡/条码失败,未投产,3:NG,4:不需要检测,5:产品未绑定";
            this.dicCommuDataDB1[2].DataDescription = "0:允许流程开始,1:流程锁定";
            for (int i = 0; i < 30; i++)
            {
                this.dicCommuDataDB1[3 + i].DataDescription = string.Format("条码[{0}]", i + 1);
            }

            this.dicCommuDataDB2[1].DataDescription = "0:无板,1:有产品";
            this.dicCommuDataDB2[2].DataDescription = "0:插头未就绪,1:插头就绪 ";
            return(true);
        }
Пример #45
0
        public override bool BuildCfg(System.Xml.Linq.XElement xe, ref string reStr)
        {
            if (!base.BuildCfg(xe, ref reStr))
            {
                return(false);
            }
            XElement selfDataXE = xe.Element("SelfDatainfo");

            if (selfDataXE != null)
            {
                if (selfDataXE.Attribute("transMode") != null)
                {
                    transMode = int.Parse(selfDataXE.Attribute("transMode").Value.ToString());
                }
                if (selfDataXE.Attribute("barcodeCheck") != null)
                {
                    if (selfDataXE.Attribute("barcodeCheck").Value.ToString().ToUpper() == "TRUE")
                    {
                        barcodeCheck = true;
                    }
                    else
                    {
                        barcodeCheck = false;
                    }
                }
            }

            return(true);
        }
Пример #46
0
        public override bool BuildCfg(System.Xml.Linq.XElement xe, ref string reStr)
        {
            ocvSeqDic[1] = "PS-40";
            ocvSeqDic[2] = "PS-70";
            ocvSeqDic[3] = "PS-80";
            ocvSeqDic[4] = "PS-90";
            ocvSeqDic[5] = "PS-110";
            if (!base.BuildCfg(xe, ref reStr))
            {
                return(false);
            }
            XElement selfDataXE = xe.Element("SelfDatainfo");

            if (selfDataXE.Attribute("targetPorts") != null)
            {
                string[] portIDS = selfDataXE.Attribute("targetPorts").Value.ToString().Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                if (portIDS != null && portIDS.Count() > 0)
                {
                    this.targetPortIDs.Clear();
                    this.targetPortIDs.AddRange(portIDS);
                }
            }
            this.dicCommuDataDB1[1].DataDescription = "0:复位,1:流向C1库,2:流向C2库,3: 等待,4:读卡失败,5: 不可识别的料框托盘号,6:入库申请失败 ";
            this.dicCommuDataDB2[1].DataDescription = "1:无板,2:有板";
            //this.dicCommuDataDB2[1].DataDescription = "1:无请求,2:RFID读取/扫码开始,3:只有一个模组";
            //this.dicCommuDataDB2[2].DataDescription = "1:无请求,2:只有一个模组";
            currentTaskPhase = 0;

            return(true);
        }
Пример #47
0
        public override bool BuildCfg(System.Xml.Linq.XElement xe, ref string reStr)
        {
            if (!base.BuildCfg(xe, ref reStr))
            {
                return(false);
            }
            this.dicCommuDataDB1[1].DataDescription = "1:检查OK,放行,2:读卡/条码失败,3:NG,4:不需要检测,5:产品未绑定,6:产品配置信息不存在";
            this.dicCommuDataDB1[2].DataDescription = "0:允许流程开始,1:流程锁定";
            this.dicCommuDataDB1[3].DataDescription = "机器人配方数据";
            for (int i = 0; i < 30; i++)
            {
                this.dicCommuDataDB1[4 + i].DataDescription = string.Format("条码[{0}]", i + 1);
            }
            this.dicCommuDataDB2[1].DataDescription = "0:无产品,1:有产品";
            this.dicCommuDataDB2[2].DataDescription = "0:无板,1:有板";
            this.dicCommuDataDB2[3].DataDescription = "1:检测OK,2:检测NG";
            this.dicCommuDataDB2[4].DataDescription = "不合格项编码";
            XElement selfDataXE = xe.Element("SelfDatainfo");
            XElement machineXE  = selfDataXE.Element("Machine");

            this.time1 = int.Parse(machineXE.Attribute("time1").Value);
            if (time1 > 20000)
            {
                this.time1 = 20000;
            }
            this.time2 = int.Parse(machineXE.Attribute("time2").Value);
            if (time2 > 20000)
            {
                this.time2 = 20000;
            }
            this.aipuMachineID = int.Parse(machineXE.Attribute("id").Value);
            return(true);
        }
Пример #48
0
        public override bool BuildCfg(System.Xml.Linq.XElement xe, ref string reStr)
        {
            if (!base.BuildCfg(xe, ref reStr))
            {
                return(false);
            }

            XElement selfDataXE = xe.Element("SelfDatainfo");

            if (selfDataXE != null)
            {
                if (selfDataXE.Attribute("houseName") != null)
                {
                    this.houseName = selfDataXE.Attribute("houseName").Value.ToString();
                }

                if (selfDataXE.Attribute("snSize") != null)
                {
                    this.goodsSiteName = selfDataXE.Attribute("goodsSiteName").Value.ToString();
                }
            }
            currentTaskPhase = 0;

            return(true);
        }
Пример #49
0
        public override bool BuildCfg(System.Xml.Linq.XElement xe, ref string reStr)
        {
            if (!base.BuildCfg(xe, ref reStr))
            {
                return(false);
            }
            XElement selfDataXE = xe.Element("SelfDatainfo");

            if (selfDataXE != null)
            {
                if (selfDataXE.Attribute("snSize") != null)
                {
                    this.snSize = int.Parse(selfDataXE.Attribute("snSize").Value.ToString());
                }
                if (selfDataXE.Attribute("barcodeSize") != null)
                {
                    this.barcodeSize = int.Parse(selfDataXE.Attribute("barcodeSize").Value.ToString());
                }
                if (selfDataXE.Attribute("barcodeTPSize") != null)
                {
                    this.barcodeTPSize = int.Parse(selfDataXE.Attribute("barcodeTPSize").Value.ToString());
                }
            }
            this.dicCommuDataDB1[1].DataDescription = "第一组模组 1:复位,2:流程已开始,3:正常完成(3秒自复位),4:异常完成(3秒自复位)";
            this.dicCommuDataDB1[2].DataDescription = "第二组模组 1:复位,2:流程已开始,3:正常完成(3秒自复位),4:异常完成(3秒自复位)";

            this.dicCommuDataDB2[1].DataDescription = "第一组模组 1:复位,2:装载完成(正常或异常完成时复位)";
            this.dicCommuDataDB2[2].DataDescription = "第二组模组 1:复位,2:装载完成(正常或异常完成时复位)";
            currentTaskPhase = 0;

            return(true);
        }
Пример #50
0
        public override bool BuildCfg(System.Xml.Linq.XElement xe, ref string reStr)
        {
            if (!base.BuildCfg(xe, ref reStr))
            {
                return(false);
            }
            this.dicCommuDataDB1[1].DataDescription = "1:检查OK,放行,2:读卡/条码失败,3:NG,4:不需要检测,5:产品未绑定,6:产品配置信息不存在";
            this.dicCommuDataDB1[2].DataDescription = "0:允许流程开始,1:流程锁定";
            this.dicCommuDataDB1[3].DataDescription = "机器人配方数据";
            for (int i = 0; i < 30; i++)
            {
                this.dicCommuDataDB1[4 + i].DataDescription = string.Format("条码[{0}]", i + 1);
            }
            this.dicCommuDataDB1[34].DataDescription = "1:人工检测模式,0:自动模式";
            this.dicCommuDataDB2[1].DataDescription  = "0:无产品,1:有产品";
            this.dicCommuDataDB2[2].DataDescription  = "0:无板,1:有板";
            this.dicCommuDataDB2[3].DataDescription  = "1:人工检测完成,0:未完成";
            XElement selfDataXE = xe.Element("SelfDatainfo");
            XElement machineXE  = selfDataXE.Element("Machine");

            this.detectTimeout = int.Parse(machineXE.Attribute("detectTimeOut").Value);
            if (detectTimeout < 1000)
            {
                this.detectTimeout = 1000;
            }
            if (detectTimeout > 60000)
            {
                this.detectTimeout = 60000;
            }
            this.ainuoMachineID = int.Parse(machineXE.Attribute("id").Value);
            return(true);
        }
Пример #51
0
        public Episode(System.Xml.Linq.XElement element, Podcast podcast)
        {
            XNamespace itunes = "http://www.itunes.com/dtds/podcast-1.0.dtd";

            Name      = element.Element("title").Value;
            WebPath   = element.Element("enclosure").Attribute("url").Value;
            Author    = element.Element(itunes + "author").Value;
            Published = ToDateTime(element.Element("pubDate").Value);
            ImageUrl  = element.Element(itunes + "image") != null?element.Element(itunes + "image").Attribute("href").Value : podcast.ImageUrl;

            Summary = element.Element(itunes + "summary") != null?element.Element(itunes + "summary").Value : null;

            Description = element.Element("description") != null?element.Element("description").Value : null;

            Podcast = podcast;
        }
Пример #52
0
        public virtual void ReadXml(System.Xml.Linq.XElement element)
        {
            ID               = element.ReadInt("ID");
            Name             = element.ReadString("Name");
            Player.CurrentID = element.ReadInt("PlayerCurrentID");

            //color
            XElement elem = element.GetChildElement("HelmetColorSet");

            HelmetColorSet.ReadXml(elem);

            elem = element.GetChildElement("HomeJerseyColorSet");
            HomeJerseyColorSet.ReadXml(elem);

            elem = element.GetChildElement("AwayJerseyColorSet");
            AwayJerseyColorSet.ReadXml(elem);

            //players
            elem = element.Element("Players");

            Players.Clear();
            foreach (XElement e in elem.Elements())
            {
                Player player = new Player(true);

                player.ReadXml(e);


                Players.Add(player);
            }
        }
        public override bool BuildCfg(System.Xml.Linq.XElement xe, ref string reStr)
        {
            if (!base.BuildCfg(xe, ref reStr))
            {
                return(false);
            }
            XElement selfDataXE = xe.Element("SelfDatainfo");

            if (selfDataXE != null)
            {
                if (selfDataXE.Attribute("hkServerID") != null)
                {
                    this.hkServerID = int.Parse(selfDataXE.Attribute("hkServerID").Value.ToString());
                }

                if (selfDataXE.Attribute("snSize") != null)
                {
                    this.snSize = int.Parse(selfDataXE.Attribute("snSize").Value.ToString());
                }
            }
            this.dicCommuDataDB1[1].DataDescription = "1:复位,2:装载处理完成,3:撤销完成,4:MES返回装载错误,5:电池为空";
            this.dicCommuDataDB1[2].DataDescription = "1:复位,2:读卡完成,放行空板到装载位置,3:读RFID失败";
            this.dicCommuDataDB2[1].DataDescription = "1:无板,2:有板";
            this.dicCommuDataDB2[2].DataDescription = "1:复位,2:装载完成,3:任务撤销";
            //for (int i = 0; i < 36 * 20;i++ )
            //{
            //    this.dicCommuDataDB2[3+i].DataDescription = "电池条码";
            //}
            currentTaskPhase = 0;

            return(true);
        }
Пример #54
0
        /// <summary>
        /// 从XLM中还原配置信息
        /// </summary>
        /// <param name="CurrentNode">当前XML节点</param>
        public void DeserializeConfigFromXmlNode(System.Xml.Linq.XElement CurrentNode)
        {
            //清空旧数据
            Menus.Clear();

            XElement xMenus = CurrentNode.Element("Menus");
            var      items  = xMenus.Elements("MenuItem");

            if (items == null)
            {
                throw new Exception("配置数据在外部被修改。");
            }

            //解析菜单配置
            List <DictionaryEntry> result = new List <DictionaryEntry>();

            foreach (XElement item in items)
            {
                result.Add(new DictionaryEntry(item.Element("Text").Value, item.Element("NodeId").Value));
            }
            Menus.AddRange(result);

            //处理状态成员(只关注xeReady)
            this.DeserializeStatusMember(CurrentNode);
        }
Пример #55
0
        public override XmlWfsData GetParcelDataFromXml(System.Xml.Linq.XElement element)
        {
            string        id             = "";
            string        appellation    = "";
            string        affectedSurvey = "";
            string        postString     = "";
            List <string> positionlist   = new List <string>();
            XNamespace    datagovt       = "http://data.linz.govt.nz";
            XNamespace    gml            = "http://www.opengis.net/gml/3.2";

            try
            {
                XElement layerData = element.Element(datagovt + "layer-772");
                id             = layerData.Element(datagovt + "id").Value;
                appellation    = layerData.Element(datagovt + "appellation").Value;
                affectedSurvey = layerData.Element(datagovt + "affected_surveys").Value;
                postString     = layerData.Element(datagovt + "shape")
                                 .Element(gml + "MultiSurface").Element(gml + "surfaceMember").Element(gml + "Polygon")
                                 .Element(gml + "exterior").Element(gml + "LinearRing").Element(gml + "posList").Value;
                positionlist = postString.Split(' ').ToList();
            }
            catch
            {
            }
            XmlWfsData data = new XmlWfsData(id, appellation, affectedSurvey, "", positionlist);

            return(data);
        }
Пример #56
0
        public static SXL.XElement ElementVisioSchema2003(this SXL.XElement el, string name)
        {
            string fullname = string.Format("{0}{1}", Constants.VisioXmlNamespace2003, name);
            var    child_el = el.Element(fullname);

            return(child_el);
        }
Пример #57
0
        public Config()
        {
            InitializeComponent();

            try
            {
                string             s            = System.Reflection.Assembly.GetExecutingAssembly().Location;
                System.IO.FileInfo fileInfo     = new System.IO.FileInfo(s);
                string             startup_path = fileInfo.Directory.FullName;
                string             settingsFile = System.IO.Path.Combine(startup_path, "settings.xml");
                Xml.XDocument      xDocument    = Xml.XDocument.Load(settingsFile);
                Xml.XElement       setting      = xDocument.Element("schLauncherSettings");
                textBoxKiCad.Text = setting.Element("KiCadPath").Value;
                textBoxEagle.Text = setting.Element("EaglePath").Value;
            }
            catch { }
        }
Пример #58
0
        /// <summary>
        /// 从XLM中还原配置信息
        /// </summary>
        /// <param name="CurrentNode">当前XML节点</param>
        public void DeserializeConfigFromXmlNode(System.Xml.Linq.XElement CurrentNode)
        {
            XElement xeTipText = CurrentNode.Element("TipText");
            XElement xeNodeId  = CurrentNode.Element("NodeId");

            //参数检查
            if (xeTipText == null || xeNodeId == null)
            {
                throw new Exception("配置数据在外部被修改。");
            }

            this.TipText = xeTipText.Value;
            this.NodeId  = xeNodeId.Value;

            //处理状态成员
            this.DeserializeStatusMember(CurrentNode);
        }
Пример #59
0
        //
        public static DataStore GetPoco(System.Xml.Linq.XElement e)
        {
            if (e == null || e.Attribute("nm") == null)
            {
                return(null);
            }
            string nm   = (string)e.Attribute("nm");
            string csNm = (string)e.Attribute("csNm") ?? null;

            bool lddo = false;

            if (e.Attribute("lddo") != null)
            {
                bool.TryParse(e.Attribute("lddo").Value, out lddo);
            }

            bool lso = false;

            if (e.Attribute("lso") != null)
            {
                bool.TryParse(e.Attribute("lso").Value, out lso);
            }

            bool wf = false;

            if (e.Attribute("wf") != null)
            {
                bool.TryParse(e.Attribute("wf").Value, out wf);
            }

            string stgDir = e.Element("stgDir") != null?e.Element("stgDir").Value : null;

            //
            DataStore ds = new DataStore()
            {
                Name = nm,
                ConnectionStringName    = csNm,
                LoadDefaultDatabaseOnly = lddo,
                LoadSystemObjects       = lso,
                WithFields   = wf,
                StagePathDir = stgDir
            };

            return(ds);
        }
Пример #60
0
        void ReadCallback(IAsyncResult asynchronousResult)
        {
            try
            {
                HttpWebRequest  request  = (HttpWebRequest)asynchronousResult.AsyncState;
                HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(asynchronousResult);
                using (StreamReader streamReader1 = new StreamReader(response.GetResponseStream()))
                {
                    string resultString = streamReader1.ReadToEnd();

                    System.Xml.Linq.XElement MyXElement = System.Xml.Linq.XElement.Parse(resultString);

                    DataModel = new RijksDataModel
                    {
                        Exension = MyXElement.Element("config").Elements("image").Attributes("extension").First().Value,
                        Path     = MyXElement.Element("config").Elements("image").Attributes("path").First().Value,

                        ArtistId     = MyXElement.Element("artobject").Elements("artist").Attributes("id").First().Value,
                        ArtistName   = MyXElement.Element("artobject").Elements("artist").First().Value,
                        CreationDate = MyXElement.Element("artobject").Elements("creationdate").Attributes("value").First().Value,
                        Description  = MyXElement.Element("artobject").Elements("description").First().Value,
                        Link         = MyXElement.Element("artobject").Elements("link").Attributes("href").First().Value,
                        ObjectId     = MyXElement.Element("artobject").Attributes("id").First().Value,
                        Title        = MyXElement.Element("artobject").Elements("title").First().Value.ToLower(),
                        ReadDate     = DateTime.Now
                    };

                    DataModel.Description = DataModel.Description.Replace("\r", string.Empty).Replace("\n", string.Empty);
                }
            }
            catch (Exception e)
            {
                SmartDispatcher.BeginInvoke(delegate
                {
                    if (ReadError != null)
                    {
                        ReadError(this, null);
                    }
                });
            }


            SmartDispatcher.BeginInvoke(delegate
            {
                if (ReadFinished != null)
                {
                    ReadFinished(this.DataModel);
                }
            });
        }