Пример #1
0
        private static void AddEntryToXml(XmlNode parent, NodeSearchElement entry)
        {
            var element = XmlHelper.AddNode(parent, entry.GetType().ToString());

            XmlHelper.AddNode(element, "FullCategoryName", entry.FullCategoryName);
            XmlHelper.AddNode(element, "Name", entry.Name);
            XmlHelper.AddNode(element, "Group", entry.Group.ToString());
            XmlHelper.AddNode(element, "Description", entry.Description);

            // If entry has input parameters.
            if (entry.InputParameters.First().Item2 != Properties.Resources.NoneString)
            {
                var inputNode = XmlHelper.AddNode(element, "Inputs");
                foreach (var parameter in entry.InputParameters)
                {
                    var parameterNode = XmlHelper.AddNode(inputNode, "InputParameter");
                    XmlHelper.AddAttribute(parameterNode, "Name", parameter.Item1);
                    XmlHelper.AddAttribute(parameterNode, "Type", parameter.Item2);
                }
            }

            // If entry has output parameters.
            if (entry.OutputParameters.First() != Properties.Resources.NoneString)
            {
                var inputNode = XmlHelper.AddNode(element, "Outputs");
                foreach (var parameter in entry.OutputParameters)
                {
                    var parameterNode = XmlHelper.AddNode(inputNode, "OutputParameter");
                    XmlHelper.AddAttribute(parameterNode, "Type", parameter);
                }
            }
        }
Пример #2
0
 public override void AttachToXmlNode(ref XmlElement node)
 {
     XmlHelper.AddNode((object)this.PlayerSlot, "PlayerSlot", ref node);
     XmlHelper.AddNode((object)this.FleetName, "FleetName", ref node);
     XmlHelper.AddNode((object)this.SystemId, "SystemId", ref node);
     XmlHelper.AddNode((IXmlLoadSave)this.ShipToAdd, "ShipToAdd", ref node);
 }
Пример #3
0
        private void FillResultNode(XmlNode resultNode, DbAccessCommand dbCommand, DbExcuteType exeType)
        {
            object result = null;

            switch (exeType)
            {
            case DbExcuteType.ExecuteNonQuery:
                result = this.DbCommand.ExecuteNonQuery();
                break;

            case DbExcuteType.ExecuteReader:
                result = this.DbCommand.ExecuteDataSet();
                break;

            case DbExcuteType.ExecuteScalar:
                result = this.DbCommand.ExecuteScalar();
                break;

            case DbExcuteType.ExecuteXmlReader:
            {
                XmlDocument tempDoc = new XmlDocument();
                tempDoc.Load(this.DbCommand.ExecuteXmlReader());
                result = tempDoc.DocumentElement;
                break;
            }

            case DbExcuteType.ExecuteSchemaTable:
                result = this.DbCommand.ExecuteSchemaTable();
                break;

            case DbExcuteType.ExecuteDataTable:
                result = this.DbCommand.ExecuteDataTable();
                break;

            case DbExcuteType.ExecuteDataRow:
                result = this.DbCommand.ExecuteDataRow().Table;
                break;

            case DbExcuteType.ExecuteTableSchema:
                result = this.DbCommand.ExecuteTableSchema();
                break;

            case DbExcuteType.ExecuteDataSet:
                result = this.DbCommand.ExecuteDataSet();
                break;

            case DbExcuteType.ExecuteSetSchema:
                result = this.DbCommand.ExecuteSetSchema();
                break;
            }
            if (result is XmlNode)
            {
                XmlHelper.AddNode(resultNode, result as XmlNode);
            }
            else if (result != null)
            {
                XmlHelper.AddNode(resultNode, SerializeHelper.XmlSerialize(result));
            }
        }
Пример #4
0
 public void AttachToXmlNode(ref XmlElement node)
 {
     XmlHelper.AddNode((object)this.Name, "Name", ref node);
     XmlHelper.AddNode((object)this.IsRecurring, "IsRecurring", ref node);
     XmlHelper.AddObjectNode((IXmlLoadSave)this.Context, "Context", ref node);
     XmlHelper.AddObjectCollectionNode((IEnumerable <IXmlLoadSave>) this.Conditions, "Conditions", ref node);
     XmlHelper.AddObjectCollectionNode((IEnumerable <IXmlLoadSave>) this.Actions, "Actions", ref node);
 }
Пример #5
0
 public void AttachToXmlNode(ref XmlElement node)
 {
     XmlHelper.AddNode((object)this.GUID, "GUID", ref node);
     XmlHelper.AddNode((object)this.Name, "Name", ref node);
     XmlHelper.AddNode((object)this.MountSize, "MountSize", ref node);
     XmlHelper.AddNode((object)this.MountClass, "MountClass", ref node);
     XmlHelper.AddNode((object)this.Weapon, "Weapon", ref node);
 }
Пример #6
0
 public void AttachToXmlNode(ref XmlElement node)
 {
     XmlHelper.AddNode((object)this.Name, "Name", ref node);
     XmlHelper.AddNode((object)this.Admiral, "Admiral", ref node);
     XmlHelper.AddNode((object)this.SupportingStation, "SupportingStation", ref node);
     XmlHelper.AddNode((object)this.Location, "Location", ref node);
     XmlHelper.AddObjectCollectionNode((IEnumerable <IXmlLoadSave>) this.Ships, "Ships", ref node);
 }
Пример #7
0
        private static void AddEntryToXml(XmlNode parent, NodeSearchElement entry)
        {
            var element = XmlHelper.AddNode(parent, entry.GetType().ToString());

            XmlHelper.AddNode(element, "FullCategoryName", entry.FullCategoryName);
            XmlHelper.AddNode(element, "Name", entry.Name);
            XmlHelper.AddNode(element, "Description", entry.Description);
        }
Пример #8
0
 public void AttachToXmlNode(ref XmlElement node)
 {
     XmlHelper.AddNode((object)this.Name, "Name", ref node);
     XmlHelper.AddNode((object)this.Class, "Class", ref node);
     XmlHelper.AddNode((object)this.Faction, "Faction", ref node);
     XmlHelper.AddNode((object)this.AvailableToPlayer, "AvailableToPlayer", ref node);
     XmlHelper.AddObjectCollectionNode((IEnumerable <IXmlLoadSave>) this.Sections, "Sections", "Section", ref node);
 }
Пример #9
0
        private void PopulateControls()
        {
            XmlDocument doc = new XmlDocument();

            doc.LoadXml("<ProductList></ProductList>");
            XmlElement root = doc.DocumentElement;

            XmlHelper.AddNode(doc, root, "ModuleTitle", this.Title);
            XmlHelper.AddNode(doc, root, "ZoneTitle", CurrentZone.Name);
            XmlHelper.AddNode(doc, root, "ViewMore", ProductResources.ViewMoreLabel);

            if (ModuleConfiguration.ResourceFileDef.Length > 0 && ModuleConfiguration.ResourceKeyDef.Length > 0)
            {
                List <string> lstResourceKeys = ModuleConfiguration.ResourceKeyDef.SplitOnCharAndTrim(';');

                foreach (string item in lstResourceKeys)
                {
                    XmlHelper.AddNode(doc, root, item, ResourceHelper.GetResourceString(ModuleConfiguration.ResourceFileDef, item));
                }
            }

            CmsBasePage basePage      = Page as CmsBasePage;
            bool        userCanUpdate = ProductPermission.CanUpdate;
            SiteUser    currentUser   = SiteUtils.GetCurrentSiteUser();

            List <Product> lstProducts = new List <Product>();

            if (ProductConfiguration.RecentlyViewedProductsEnabled && config.Position == 0)
            {
                lstProducts = ProductHelper.GetRecentlyViewedProducts(config.MaxProductsToGet);
            }
            else if (config.ZoneId > -1)
            {
                int zoneId = config.ZoneId;
                if (zoneId == 0)
                {
                    zoneId = CurrentZone.ZoneId;
                }

                string zoneRangeIds = ProductHelper.GetRangeZoneIdsToSemiColonSeparatedString(siteSettings.SiteId, zoneId);
                lstProducts = Product.GetPageBySearch(1, config.MaxProductsToGet, siteSettings.SiteId, zoneRangeIds, 1, WorkingCulture.LanguageId, -1, -1, null, null, config.Position);
            }
            else
            {
                lstProducts = Product.GetPage(SiteId, -1, WorkingCulture.LanguageId, config.Position, 1, config.MaxProductsToGet);
            }

            foreach (Product product in lstProducts)
            {
                XmlElement productXml = doc.CreateElement("Product");
                root.AppendChild(productXml);

                ProductHelper.BuildProductDataXml(doc, productXml, product, timeZone, timeOffset, ProductHelper.BuildEditLink(product, basePage, userCanUpdate, currentUser));
            }

            XmlHelper.XMLTransform(xmlTransformer, SiteUtils.GetXsltBasePath("product", ModuleConfiguration.XsltFileName), doc);
        }
Пример #10
0
 public void AttachToXmlNode(ref XmlElement node)
 {
     XmlHelper.AddNode((object)this.Name, "Name", ref node);
     XmlHelper.AddNode((object)this.Type, "Type", ref node);
     XmlHelper.AddNode((object)this.Stage, "Stage", ref node);
     XmlHelper.AddNode((object)this.Location, "Location", ref node);
     XmlHelper.AddNode((object)this.Orbit, "Orbit", ref node);
     XmlHelper.AddObjectCollectionNode((IEnumerable <IXmlLoadSave>) this.Modules, "Modules", "Module", ref node);
 }
Пример #11
0
 public void AttachToXmlNode(ref XmlElement node)
 {
     XmlHelper.AddNode((object)this.SystemId, "SystemId", ref node);
     XmlHelper.AddNode((object)this.OrbitId, "OrbitId", ref node);
     XmlHelper.AddNode((object)this.ImperialPopulation, "ImperialPopulation", ref node);
     XmlHelper.AddNode((object)this.Infrastructure, "Infrastructure", ref node);
     XmlHelper.AddNode((object)this.IsIdealColony, "IsIdealColony", ref node);
     XmlHelper.AddObjectCollectionNode((IEnumerable <IXmlLoadSave>) this.CivilianPopulations, "CivilianPopulations", "CivilianPopulation", ref node);
 }
Пример #12
0
 public virtual void AttachToXmlNode(ref XmlElement node)
 {
     XmlHelper.AddNode((object)this.Name, "Name", ref node);
     XmlHelper.AddNode((object)this.Type, "Type", ref node);
     XmlHelper.AddNode((object)this.Parent, "Parent", ref node);
     XmlHelper.AddNode((object)this.Eccentricity, "Eccentricity", ref node);
     XmlHelper.AddNode((object)this.Inclination, "Inclination", ref node);
     XmlHelper.AddNode((object)this.OrbitNumber, "OrbitNumber", ref node);
 }
Пример #13
0
        public static XmlDocument BuildNewsDataXml(XmlDocument doc, XmlElement newsXml, News news, TimeZoneInfo timeZone, double timeOffset, string editLink)
        {
            XmlHelper.AddNode(doc, newsXml, "Title", news.Title);
            XmlHelper.AddNode(doc, newsXml, "SubTitle", news.SubTitle);
            XmlHelper.AddNode(doc, newsXml, "Url", NewsHelper.FormatNewsUrl(news.Url, news.NewsID, news.ZoneID));
            XmlHelper.AddNode(doc, newsXml, "Target", NewsHelper.GetNewsTarget(news.OpenInNewWindow));
            XmlHelper.AddNode(doc, newsXml, "ShowOption", news.ShowOption.ToString());
            XmlHelper.AddNode(doc, newsXml, "NewsId", news.NewsID.ToString()); //2016-08-11

            string imageFolderPath          = NewsHelper.MediaFolderPath(news.SiteId, news.NewsID);
            string thumbnailImageFolderPath = imageFolderPath + "thumbs/";

            if (news.ImageFile.Length > 0)
            {
                XmlHelper.AddNode(doc, newsXml, "ImageUrl", VirtualPathUtility.ToAbsolute(imageFolderPath + news.ImageFile));
            }
            if (news.ThumbnailFile.Length > 0)
            {
                XmlHelper.AddNode(doc, newsXml, "ThumbnailUrl", VirtualPathUtility.ToAbsolute(thumbnailImageFolderPath + news.ThumbnailFile));
            }

            XmlHelper.AddNode(doc, newsXml, "EditLink", editLink);

            XmlHelper.AddNode(doc, newsXml, "BriefContent", news.BriefContent);
            XmlHelper.AddNode(doc, newsXml, "FullContent", news.FullContent);
            XmlHelper.AddNode(doc, newsXml, "ViewCount", news.Viewed.ToString());
            XmlHelper.AddNode(doc, newsXml, "CommentCount", news.CommentCount.ToString());
            XmlHelper.AddNode(doc, newsXml, "FileUrl", news.FileAttachment);

            object startDate = news.StartDate;

            XmlHelper.AddNode(doc, newsXml, "CreatedDate", FormatDate(startDate, timeZone, timeOffset, ResourceHelper.GetResourceString("NewsResources", "NewsDateFormat")));
            XmlHelper.AddNode(doc, newsXml, "CreatedTime", FormatDate(startDate, timeZone, timeOffset, ResourceHelper.GetResourceString("NewsResources", "NewsTimeFormat")));
            XmlHelper.AddNode(doc, newsXml, "CreatedDD", FormatDate(startDate, timeZone, timeOffset, "dd"));
            XmlHelper.AddNode(doc, newsXml, "CreatedYY", FormatDate(startDate, timeZone, timeOffset, "yy"));
            XmlHelper.AddNode(doc, newsXml, "CreatedYYYY", FormatDate(startDate, timeZone, timeOffset, "yyyy"));
            XmlHelper.AddNode(doc, newsXml, "CreatedMM", FormatDate(startDate, timeZone, timeOffset, "MM"));
            if (System.Globalization.CultureInfo.CurrentCulture.Name.ToLower() == "vi-vn")
            {
                string monthVI = "Tháng " + FormatDate(startDate, timeZone, timeOffset, "MM");
                XmlHelper.AddNode(doc, newsXml, "CreatedMMM", monthVI);
                XmlHelper.AddNode(doc, newsXml, "CreatedMMMM", monthVI);
            }
            else
            {
                XmlHelper.AddNode(doc, newsXml, "CreatedMMM", FormatDate(startDate, timeZone, timeOffset, "MMM"));
                XmlHelper.AddNode(doc, newsXml, "CreatedMMMM", FormatDate(startDate, timeZone, timeOffset, "MMMM"));
            }

            if (news.EndDate != DateTime.MaxValue)
            {
                XmlHelper.AddNode(doc, newsXml, "EndDate", FormatDate(news.EndDate, timeZone, timeOffset, ResourceHelper.GetResourceString("NewsResources", "NewsDateFormat")));
            }

            return(doc);
        }
Пример #14
0
 public void AttachToXmlNode(ref XmlElement node)
 {
     XmlHelper.AddNode((object)this.Id, ModuleMount.XmlIdName, ref node);
     XmlHelper.AddNode((object)this.AssignedModuleName, ModuleMount.XmlAssignedModuleName, ref node);
     XmlHelper.AddNode((object)this.NodeName, ModuleMount.XmlNodeNameName, ref node);
     XmlHelper.AddNode((object)this.Size, ModuleMount.XmlSizeName, ref node);
     XmlHelper.AddNode((object)this.Type, ModuleMount.XmlTypeName, ref node);
     XmlHelper.AddNode((object)this.FrameX, ModuleMount.XmlFrameXName, ref node);
     XmlHelper.AddNode((object)this.FrameY, ModuleMount.XmlFrameYName, ref node);
 }
Пример #15
0
 public void AttachToXmlNode(ref XmlElement node)
 {
     XmlHelper.AddNode((object)this.Name, "Name", ref node);
     XmlHelper.AddNode((object)this.Starmap, "Starmap", ref node);
     XmlHelper.AddNode((object)this.EconomicEfficiency, "EconomicEfficiency", ref node);
     XmlHelper.AddNode((object)this.ResearchEfficiency, "ResearchEfficiency", ref node);
     XmlHelper.AddObjectCollectionNode((IEnumerable <IXmlLoadSave>) this.PlayerStartConditions, "PlayerStartConditions", ref node);
     XmlHelper.AddObjectCollectionNode((IEnumerable <IXmlLoadSave>) this.DiplomacyRules, "DiplomacyRules", ref node);
     XmlHelper.AddObjectCollectionNode((IEnumerable <IXmlLoadSave>) this.Triggers, "Triggers", ref node);
 }
Пример #16
0
 public void AttachToXmlNode(ref XmlElement node)
 {
     XmlHelper.AddNode((object)this.Hiver, "HiverAICostFactor", ref node);
     XmlHelper.AddNode((object)this.Human, "HumanAICostFactor", ref node);
     XmlHelper.AddNode((object)this.LiirZuul, "LiirZuulAICostFactor", ref node);
     XmlHelper.AddNode((object)this.Morrigi, "MorrigiAICostFactor", ref node);
     XmlHelper.AddNode((object)this.Tarka, "TarkaAICostFactor", ref node);
     XmlHelper.AddNode((object)this.Zuul, "ZuulAICostFactor", ref node);
     XmlHelper.AddNode((object)this.Loa, "LoaAICostFactor", ref node);
 }
Пример #17
0
 public void AttachToXmlNode(ref XmlElement node)
 {
     XmlHelper.AddNode((object)this.NumPlayers, "NumPlayers", ref node);
     XmlHelper.AddNode((object)this.PreviewTexture, "PreviewTexture", ref node);
     XmlHelper.AddObjectCollectionNode((IEnumerable <IXmlLoadSave>) this.Features, "Features", ref node);
     XmlHelper.AddObjectCollectionNode((IEnumerable <IXmlLoadSave>) this.NodeLines, "NodeLines", "NodeLine", ref node);
     XmlHelper.AddObjectCollectionNode((IEnumerable <IXmlLoadSave>) this.Provinces, "Provinces", "Province", ref node);
     XmlHelper.AddNode((object)this.Title, "Title", ref node);
     XmlHelper.AddNode((object)this.Description, "Description", ref node);
 }
Пример #18
0
 public override void AttachToXmlNode(ref XmlElement node)
 {
     base.AttachToXmlNode(ref node);
     XmlHelper.AddNode((object)this.Size, "Size", ref node);
     XmlHelper.AddNode((object)this.Suitability, "Suitability", ref node);
     XmlHelper.AddNode((object)this.Resources, "Resources", ref node);
     XmlHelper.AddNode((object)this.PlanetType, "PlanetType", ref node);
     XmlHelper.AddNode((object)this.InhabitedByPlayer, "InhabitedByPlayer", ref node);
     XmlHelper.AddNode((object)this.CapitalOrbit, "CapitalOrbit", ref node);
     XmlHelper.AddNode((object)this.Biosphere, "Biosphere", ref node);
     XmlHelper.AddNode((object)this.MaterialName, "MaterialName", ref node);
 }
Пример #19
0
        public void AddNodeElementOnlyTest()
        {
            var document = XmlHelper.CreateDocument("TreeLibrary");

            var node = XmlHelper.AddNode(document.DocumentElement, "Nam1");

            Assert.IsNotNull(node);

            Assert.AreEqual(document, node.OwnerDocument);
            Assert.AreEqual(document.DocumentElement, node.ParentNode);
            Assert.AreEqual("Nam1", node.Name);
        }
Пример #20
0
 public void AttachToXmlNode(ref XmlElement node)
 {
     XmlHelper.AddNode((object)this.Name, "Name", ref node);
     XmlHelper.AddNode((object)this.Portrait, "Portrait", ref node);
     XmlHelper.AddNode((object)this.Age, "Age", ref node);
     XmlHelper.AddNode((object)this.Faction, "Faction", ref node);
     XmlHelper.AddNode((object)this.Gender, "Gender", ref node);
     XmlHelper.AddNode((object)this.HomePlanet, "HomePlanet", ref node);
     XmlHelper.AddNode((object)this.ReactionRating, "ReactionRating", ref node);
     XmlHelper.AddNode((object)this.EvasionRating, "EvasionRating", ref node);
     XmlHelper.AddCollectionNode <SpecialCharacteristic>((IEnumerable <SpecialCharacteristic>) this.SpecialCharacteristics, "SpecialCharacteristics", "Characteristic", ref node);
 }
Пример #21
0
 public void AttachToXmlNode(ref XmlElement node)
 {
     XmlHelper.AddNode((object)this.NodeName, Mount.XmlNameNodeName, ref node);
     XmlHelper.AddNode((object)this.TurretOverload, Mount.XmlNameTurretOverloadName, ref node);
     XmlHelper.AddNode((object)this.BarrelOverload, Mount.XmlNameBarrelOverloadName, ref node);
     XmlHelper.AddNode((object)this.BaseOverload, Mount.XmlNameBaseOverloadName, ref node);
     XmlHelper.AddNode((object)this.YawMin, Mount.XmlNameYawMin, ref node);
     XmlHelper.AddNode((object)this.YawMax, Mount.XmlNameYawMax, ref node);
     XmlHelper.AddNode((object)this.PitchMin, Mount.XmlNamePitchMin, ref node);
     XmlHelper.AddNode((object)this.PitchMax, Mount.XmlNamePitchMax, ref node);
     XmlHelper.AddNode((object)this.SectionFireAnimation, Mount.XmlNameSectionFireAnimation, ref node);
     XmlHelper.AddNode((object)this.SectionReloadAnimation, Mount.XmlNameSectionReloadAnimation, ref node);
 }
Пример #22
0
 public void AttachToXmlNode(ref XmlElement node)
 {
     XmlHelper.AddNode((object)this.PbRange, "PbRange", ref node);
     XmlHelper.AddNode((object)this.PbDeviation, "PbDeviation", ref node);
     XmlHelper.AddNode((object)this.PbDamage, "PbDamage", ref node);
     XmlHelper.AddNode((object)this.EffectiveRange, "EffectiveRange", ref node);
     XmlHelper.AddNode((object)this.EffectiveDeviation, "EffectiveDeviation", ref node);
     XmlHelper.AddNode((object)this.EffectiveDamage, "EffectiveDamage", ref node);
     XmlHelper.AddNode((object)this.MaxRange, "MaxRange", ref node);
     XmlHelper.AddNode((object)this.MaxDeviation, "MaxDeviation", ref node);
     XmlHelper.AddNode((object)this.MaxDamage, "MaxDamage", ref node);
     XmlHelper.AddNode((object)this.PlanetRange, "PlanetRange", ref node);
 }
Пример #23
0
 public override void AttachToXmlNode(ref XmlElement node)
 {
     base.AttachToXmlNode(ref node);
     XmlHelper.AddNode((object)this.ProvinceId, "ProvinceId", ref node);
     XmlHelper.AddNode((object)this.Guid, "Guid", ref node);
     XmlHelper.AddNode((object)this.isRandom, "Randomize", ref node);
     XmlHelper.AddNode((object)this.isStartLocation, "IsStartLocation", ref node);
     XmlHelper.AddNode((object)this.PlayerSlot, "PlayerSlot", ref node);
     XmlHelper.AddNode((object)this.Type, "Type", ref node);
     XmlHelper.AddNode((object)this.SubType, "SubType", ref node);
     XmlHelper.AddNode((object)this.Size, "Size", ref node);
     XmlHelper.AddObjectCollectionNode((IEnumerable <IXmlLoadSave>) this.Orbits, "Orbits", ref node);
 }
Пример #24
0
 public void AttachToXmlNode(ref XmlElement node)
 {
     XmlHelper.AddNode((object)this.Id, "Id", ref node);
     XmlHelper.AddNode((object)this.IsPermanent, "IsPermanent", ref node);
     XmlHelper.AddNode((object)this.HiverPercent, "HiverPercent", ref node);
     XmlHelper.AddNode((object)this.HumanPercent, "HumanPercent", ref node);
     XmlHelper.AddNode((object)this.LiirZuulPercent, "LiirZuulPercent", ref node);
     XmlHelper.AddNode((object)this.MorrigiPercent, "MorrigiPercent", ref node);
     XmlHelper.AddNode((object)this.TarkaPercent, "TarkaPercent", ref node);
     XmlHelper.AddNode((object)this.ZuulPercent, "ZuulPercent", ref node);
     XmlHelper.AddNode((object)this.LoaPercent, "LoaPercent", ref node);
     XmlHelper.AddNode((object)this.ResearchPoints, "ResearchPoints", ref node);
 }
Пример #25
0
        public void BuildNewsImagesXml(
            XmlDocument doc,
            XmlElement root)
        {
            string imageFolderPath          = NewsHelper.MediaFolderPath(basePage.SiteId, news.NewsID);
            string thumbnailImageFolderPath = imageFolderPath + "thumbs/";
            string siteRoot = WebUtils.GetSiteRoot();

            int    defaultLanguageId = -1;
            string defaultCulture    = WebConfigSettings.DefaultLanguageCulture;

            if (defaultCulture.Length > 0)
            {
                defaultLanguageId = LanguageHelper.GetLanguageIdByCulture(defaultCulture);
            }

            List <int>          listDisplayOrder = new List <int>();
            List <ContentMedia> listMedia        = ContentMedia.GetByContentDesc(news.NewsGuid);

            foreach (ContentMedia media in listMedia)
            {
                if (media.LanguageId == -1 || media.LanguageId == languageId || (languageId == -1 && media.LanguageId == defaultLanguageId))
                {
                    BuildNewsImagesXml(doc, root, media, imageFolderPath, thumbnailImageFolderPath);

                    if (displaySettings.ShowGroupImages)
                    {
                        if (!listDisplayOrder.Contains(media.DisplayOrder))
                        {
                            listDisplayOrder.Add(media.DisplayOrder);
                            XmlElement groupImages = doc.CreateElement("GroupImages");
                            root.AppendChild(groupImages);
                            XmlHelper.AddNode(doc, groupImages, "DisplayOrder", media.DisplayOrder.ToString());

                            foreach (ContentMedia media2 in listMedia)
                            {
                                if ((media2.LanguageId == -1 || media2.LanguageId == languageId || (languageId == -1 && media2.LanguageId == defaultLanguageId)) &&
                                    (media2.DisplayOrder == media.DisplayOrder))
                                {
                                    BuildNewsImagesXml(doc, groupImages, media2, imageFolderPath, thumbnailImageFolderPath);
                                }
                            }
                        }
                    }

                    string relativePath = siteRoot + Page.ResolveUrl(imageFolderPath + media.MediaFile);
                    basePage.AdditionalMetaMarkup += "\n<meta property=\"og:image\" content=\"" + relativePath + "\" />";
                    basePage.AdditionalMetaMarkup += "\n<meta itemprop=\"image\" content=\"" + relativePath + "\" />";
                }
            }
        }
Пример #26
0
        public void AddNodeWithInvalidInputTest()
        {
            var document = XmlHelper.CreateDocument("TreeLibrary");

            var node = XmlHelper.AddNode(document, null, "");

            Assert.IsNull(node);

            node = XmlHelper.AddNode(document, "", null);
            Assert.IsNull(node);

            node = XmlHelper.AddNode(null, null, null);
            Assert.IsNull(node);
        }
Пример #27
0
        public void BuildNewsAttributesXml(
            XmlDocument doc,
            XmlElement root, int languageId)
        {
            List <ContentAttribute> listAttributes = ContentAttribute.GetByContentAsc(news.NewsGuid, languageId);

            foreach (ContentAttribute attribute in listAttributes)
            {
                XmlElement element = doc.CreateElement("NewsAttributes");
                root.AppendChild(element);

                XmlHelper.AddNode(doc, element, "Title", attribute.Title);
                XmlHelper.AddNode(doc, element, "Content", attribute.ContentText);
            }
        }
Пример #28
0
 public void AttachToXmlNode(ref XmlElement node)
 {
     XmlHelper.AddNode((object)this.Name, "Name", ref node);
     XmlHelper.AddNode((object)this.Id, "Id", ref node);
     XmlHelper.AddNode((object)this.Family, "Family", ref node);
     XmlHelper.AddObjectCollectionNode((IEnumerable <IXmlLoadSave>) this.Requires, "Requires", "RequiredTech", ref node);
     XmlHelper.AddObjectCollectionNode((IEnumerable <IXmlLoadSave>) this.Allows, "Allowables", "AllowedTech", ref node);
     XmlHelper.AddNode((object)this.Icon, "Icon", ref node);
     XmlHelper.AddNode((object)this.Group, "Group", ref node);
     XmlHelper.AddNode((object)this.Value, "Value", ref node);
     XmlHelper.AddNode((object)this.CostMultiplier, "CostMultiplier", ref node);
     XmlHelper.AddNode((object)this.DangerLevel, "DangerLevel", ref node);
     XmlHelper.AddNode((object)this.AllowAIRebellion, "AllowAIRebellion", ref node);
     this.AICostFactors.AttachToXmlNode(ref node);
     XmlHelper.AddObjectCollectionNode((IEnumerable <IXmlLoadSave>) this.AIResearchModes, "AIResearchModes", "AIResearchMode", ref node);
 }
Пример #29
0
        public void BuildNewsImagesXml(
            XmlDocument doc,
            XmlElement root,
            ContentMedia media,
            string imageFolderPath,
            string thumbnailImageFolderPath)
        {
            XmlElement element = doc.CreateElement("NewsImages");

            root.AppendChild(element);

            XmlHelper.AddNode(doc, element, "Title", media.Title);
            XmlHelper.AddNode(doc, element, "DisplayOrder", media.DisplayOrder.ToString());
            XmlHelper.AddNode(doc, element, "ImageUrl", Page.ResolveUrl(imageFolderPath + media.MediaFile));
            XmlHelper.AddNode(doc, element, "ThumbnailUrl", Page.ResolveUrl(thumbnailImageFolderPath + media.ThumbnailFile));
        }
Пример #30
0
        private static void AddCategoryToXml(
            XmlNode parent, ISearchCategory <NodeSearchElement> category)
        {
            var element = XmlHelper.AddNode(parent, "Category");

            XmlHelper.AddAttribute(element, "Name", category.Name);

            foreach (var subCategory in category.SubCategories)
            {
                AddCategoryToXml(element, subCategory);
            }

            foreach (var entry in category.Entries)
            {
                AddEntryToXml(element, entry);
            }
        }