当前位置: 首页>>代码示例>>C#>>正文


C# SafeDictionary.Add方法代码示例

本文整理汇总了C#中SafeDictionary.Add方法的典型用法代码示例。如果您正苦于以下问题:C# SafeDictionary.Add方法的具体用法?C# SafeDictionary.Add怎么用?C# SafeDictionary.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SafeDictionary的用法示例。


在下文中一共展示了SafeDictionary.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetRefinements

        protected SafeDictionary<string> GetRefinements()
        {
            var refinements = new SafeDictionary<string>();

             if (!FieldName1TextBox.Text.IsNullOrEmpty() && !FieldValue1TextBox.Text.IsNullOrEmpty())
            refinements.Add(FieldName1TextBox.Text, FieldValue1TextBox.Text);

             if (!FieldName2TextBox.Text.IsNullOrEmpty() && !FieldValue2TextBox.Text.IsNullOrEmpty())
            refinements.Add(FieldName2TextBox.Text, FieldValue2TextBox.Text);

             return refinements;
        }
开发者ID:jon-mcmr,项目名称:Virgin-Tds,代码行数:12,代码来源:DemoPage3.aspx.cs

示例2: RunEnumeration

        /// <summary>
        /// Reflect the Class Name in the Source
        /// </summary>
        /// <param name="templateSource">
        /// The template source.
        /// </param>
        /// <returns>
        /// </returns>
        private static Item[] RunEnumeration(string templateSource, Item sourceItem)
        {
            templateSource = templateSource.Replace("lucene:", string.Empty);
            var commands = templateSource.Split(';');
            var refinements = new SafeDictionary<string>();

            foreach (var command in commands)
            {
                if (!command.IsNullOrEmpty())
                {
                    var commandSplit = command.Split(':');
                    if (commandSplit.Length == 2)
                    {
                        refinements.Add(commandSplit[0], commandSplit[1]);
                    }
                }
            }

            if (refinements.ContainsKey("location"))
            {
                int hitsCount;
                var items = Context.ContentDatabase.GetItem(refinements["location"]).Search(refinements, out hitsCount);
                return items.ToList().Select(x => x.GetItem()).ToArray();
            }
            else
            {
                int hitsCount;
                var items = sourceItem.Search(refinements, out hitsCount);
                return items.ToList().Select(x => x.GetItem()).ToArray();
            }
        }
开发者ID:udt1106,项目名称:Sitecore-Item-Buckets,代码行数:39,代码来源:LuceneQuery.cs

示例3: Rendered

 public string Rendered(int? maxWidth, int? maxHeight)
 {
     SafeDictionary<string> parameters = new SafeDictionary<string>();
     if (maxWidth.HasValue)
     {
         parameters.Add("mw", maxWidth.Value.ToString());
     }
     if (maxHeight.HasValue)
     {
         parameters.Add("mh", maxHeight.Value.ToString());
     }
     if (this.field == null)
     {
         return string.Empty;
     }
     return FieldRenderer.Render(this.item, this.field.InnerField.Name, WebUtil.BuildQueryString(parameters, false));
 }
开发者ID:sitecorian,项目名称:pageeditor-unleashed,代码行数:17,代码来源:ExtendedCustomImageField.cs

示例4: GetItems

        /// <summary>
        /// Get Items to be loaded when the Control is loaded on the item
        /// </summary>
        /// <param name="current">
        /// The current.
        /// </param>
        /// <returns>
        /// Array of Item
        /// </returns>
        protected override Item[] GetItems(Item current)
        {
            Assert.ArgumentNotNull(current, "current");
            var values = StringUtil.GetNameValues(Source, '=', '&');
            var refinements = new SafeDictionary<string>();
            if (values["FieldsFilter"] != null)
            {
                var splittedFields = StringUtil.GetNameValues(values["FieldsFilter"], ':', ',');
                foreach (string key in splittedFields.Keys)
                {
                    refinements.Add(key, splittedFields[key]);
                }
            }

            var locationFilter = values["StartSearchLocation"];
            locationFilter = MakeFilterQuerable(locationFilter);

            var templateFilter = values["TemplateFilter"];
            templateFilter = MakeTemplateFilterQuerable(templateFilter);

            var pageSize = values["PageSize"];
            var searchParam = new DateRangeSearchParam
            {
                Refinements = refinements,
                LocationIds = locationFilter.IsNullOrEmpty() ? Sitecore.Context.ContentDatabase.GetItem(this.ItemID).GetParentBucketItemOrRootOrSelf().ID.ToString() : locationFilter,
                TemplateIds = templateFilter,
                FullTextQuery = values["FullTextQuery"],
                Language = values["Language"],
                PageSize = pageSize.IsEmpty() ? 10 : int.Parse(pageSize),
                PageNumber = this.pageNumber,
                SortByField = values["SortField"],
                SortDirection = values["SortDirection"]
            };

            this.filter = "&location=" + (locationFilter.IsNullOrEmpty() ? Sitecore.Context.ContentDatabase.GetItem(this.ItemID).GetParentBucketItemOrRootOrSelf().ID.ToString() : locationFilter) +
                     "&filterText=" + values["FullTextQuery"] +
                     "&language=" + values["Language"] +
                     "&pageSize=" + (pageSize.IsEmpty() ? 10 : int.Parse(pageSize)) +
                     "&sort=" + values["SortField"];

            if (values["TemplateFilter"].IsNotNull())
            {
                this.filter += "&template=" + templateFilter;
            }

            using (var searcher = new IndexSearcher(Constants.Index.Name))
            {
                var keyValuePair = searcher.GetItems(searchParam);
                var items = keyValuePair.Value;
                this.pageNumber = keyValuePair.Key / searchParam.PageSize;
                if (this.pageNumber <= 0)
                {
                    this.pageNumber = 1;
                }
                return items.Select(sitecoreItem => sitecoreItem.GetItem()).Where(i => i != null).ToArray();
            }
        }
开发者ID:katebutenko,项目名称:Sitecore-Item-Buckets-6.6-NET4,代码行数:66,代码来源:BucketList.cs

示例5: ToSafeDictionary

        public static SafeDictionary<string> ToSafeDictionary(this NameValueCollection collection)
        {
            var safeDictionary = new SafeDictionary<string>();
            
            if (collection != null)
            {
                foreach (var key in collection.AllKeys)
                {
                    safeDictionary.Add(key, collection[key]);
                }
            }

            return safeDictionary;
        }
开发者ID:kgkostadinov,项目名称:TdsTesting,代码行数:14,代码来源:ExtensionMethods.cs

示例6: CreateRefinements

      public static SafeDictionary<string> CreateRefinements(string fieldName, string fieldValue)
      {
         var refinements = new SafeDictionary<string>();

         if (!String.IsNullOrEmpty(fieldValue) && !String.IsNullOrEmpty(fieldValue))
         {
            if (fieldName.Contains("|"))
            {
               var fieldNames = fieldName.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);

               foreach (var name in fieldNames)
               {
                  refinements.Add(name, fieldValue);
               }
            }
            else
            {
               refinements.Add(fieldName, fieldValue);
            }
         }

         return refinements;
      }
开发者ID:aqueduct,项目名称:Aqueduct.SitecoreLib,代码行数:23,代码来源:SearchHelper.cs

示例7: Initialize

        private static void Initialize()
        {
            TemplateDateFieldCollection = new SafeDictionary<ID, string>();
            Database masterDB = Sitecore.Context.ContentDatabase ?? Sitecore.Configuration.Factory.GetDatabase("master");
            Assert.IsNotNull(masterDB, "content database is not defined");

            Item[] blogPostTemplates = masterDB.SelectItems("fast:/sitecore/templates//*[@@name = 'Blog Post']");

            foreach (Item blogItem in blogPostTemplates)
            {
                if (blogItem != null)
                {
                    TemplateDateFieldCollection.Add(blogItem.ID, "Publish Date");
                }
            }
        }
开发者ID:zmalmquist,项目名称:XBlog,代码行数:16,代码来源:BucketFolderConfigurationManager.cs

示例8: Arsenals

 public Arsenals()
 {
     Inscribed = new SafeDictionary<ArsenalType, SafeDictionary<uint, ArsenalSingle>>(1000);
     Donation = new Dictionary<ArsenalType, ulong>(1000);
     Inscribed.Add(ArsenalType.Headgear, new SafeDictionary<uint, ArsenalSingle>(1000));
     Inscribed.Add(ArsenalType.Armor, new SafeDictionary<uint, ArsenalSingle>(1000));
     Inscribed.Add(ArsenalType.Weapon, new SafeDictionary<uint, ArsenalSingle>(1000));
     Inscribed.Add(ArsenalType.Ring, new SafeDictionary<uint, ArsenalSingle>(1000));
     Inscribed.Add(ArsenalType.Boots, new SafeDictionary<uint, ArsenalSingle>(1000));
     Inscribed.Add(ArsenalType.Necklace, new SafeDictionary<uint, ArsenalSingle>(1000));
     Inscribed.Add(ArsenalType.Fan, new SafeDictionary<uint, ArsenalSingle>(1000));
     Inscribed.Add(ArsenalType.Tower, new SafeDictionary<uint, ArsenalSingle>(1000));
     Donation.Add(ArsenalType.Headgear, 0);
     Donation.Add(ArsenalType.Armor, 0);
     Donation.Add(ArsenalType.Weapon, 0);
     Donation.Add(ArsenalType.Ring, 0);
     Donation.Add(ArsenalType.Boots, 0);
     Donation.Add(ArsenalType.Necklace, 0);
     Donation.Add(ArsenalType.Fan, 0);
     Donation.Add(ArsenalType.Tower, 0);
 }
开发者ID:AiiMz,项目名称:PserverWork,代码行数:21,代码来源:Arsenals.cs

示例9: Initialize

        private static void Initialize()
        {
            TemplateDateFieldCollection = new SafeDictionary<ID, string>();
            var masterDb = Context.ContentDatabase ?? Factory.GetDatabase("master");
            Assert.IsNotNull(masterDb, "content database is not defined");
            foreach (XmlNode node in Factory.GetConfigNodes("wacomBucketConfiguration/dateFieldMappings/mapping"))
            {

                var templateName = XmlUtil.GetAttribute("template", node);
                var fieldName = XmlUtil.GetAttribute("field", node);
                var template = masterDb.Templates[templateName];
                if (template != null && !string.IsNullOrEmpty(fieldName))
                {
                    TemplateDateFieldCollection.Add(template.ID, fieldName);
                }
                else
                {
                    Log.Info(string.Format("Could not find template : {0}", templateName), new object());
                }

            }
        }
开发者ID:unstab1e,项目名称:TomGrableWebsite,代码行数:22,代码来源:FolderPathConfigurationManager.cs

示例10: GetBaseQuery

        public static DateRangeSearchParam GetBaseQuery(List<SearchStringModel> _searchQuery, string locationFilter)
        {
            var startDate = DateTime.Now;
            var endDate = DateTime.Now.AddDays(1);
            var locationSearch = locationFilter;
            var refinements = new SafeDictionary<string>();
            var searchStringModels = GetTags(_searchQuery);

            if (searchStringModels.Count > 0)
            {
                foreach (var ss in searchStringModels)
                {
                    var query = ss.Value;
                    if (query.Contains("tagid="))
                    {
                        query = query.Split('|')[1].Replace("tagid=", string.Empty);
                    }
                    var db = Context.ContentDatabase ?? Context.Database;
                    refinements.Add("_tags", db.GetItem(query).ID.ToString());
                }
            }

            var author = GetAuthor(_searchQuery);
            var languages = GetLanguages(_searchQuery);
            if (languages.Length > 0)
            {
                refinements.Add("_language", languages);
            }

            var references = GetReferences(_searchQuery);

            var custom = GetCustom(_searchQuery);
            if (custom.Length > 0)
            {
                var customSearch = custom.Split('|');
                if (customSearch.Length > 0)
                {
                    try
                    {
                        refinements.Add(customSearch[0], customSearch[1]);
                    }
                    catch (Exception exc)
                    {
                        Log.Error("Could not parse the custom search query", exc);
                    }
                }
            }

            var search = GetField(_searchQuery);
            if (search.Length > 0)
            {
                var customSearch = search;
                refinements.Add(customSearch, GetText(_searchQuery));
            }

            var fileTypes = GetFileTypes(_searchQuery);
            if (fileTypes.Length > 0)
            {
                refinements.Add("extension", GetFileTypes(_searchQuery));
            }

            var s = GetSite(_searchQuery);
            if (s.Length > 0)
            {
                var siteContext = SiteContextFactory.GetSiteContext(SiteManager.GetSite(s).Name);
                var db = Context.ContentDatabase ?? Context.Database;
                var startItemId = db.GetItem(siteContext.StartPath);
                locationSearch = startItemId.ID.ToString();
            }

            var culture = CultureInfo.CreateSpecificCulture("en-US");
            var startFlag = true;
            var endFlag = true;
            if (GetStartDate(_searchQuery).Any())
            {
                if (!DateTime.TryParse(GetStartDate(_searchQuery), culture, DateTimeStyles.None, out startDate))
                {
                    startDate = DateTime.Now;
                }

                startFlag = false;
            }

            if (GetEndDate(_searchQuery).Any())
            {
                if (!DateTime.TryParse(GetEndDate(_searchQuery), culture, DateTimeStyles.None, out endDate))
                {
                    endDate = DateTime.Now.AddDays(1);
                }

                endFlag = false;
            }

            var returnResult = new DateRangeSearchParam
            {
                ID = GetID(_searchQuery),
                ShowAllVersions = false,
                FullTextQuery = GetText(_searchQuery),
                Refinements = refinements,
                RelatedIds = references.Any() ? IdHelper.ParseId(references) : null,
//.........这里部分代码省略.........
开发者ID:csteeg,项目名称:Sitecore-Item-Buckets,代码行数:101,代码来源:SearchHelper.cs

示例11: YesterdaySort

        public static void YesterdaySort()
        {
            SortedDictionary<ulong, SortEntry<uint, ArenaStatistic>> sortDictionary = new SortedDictionary<ulong, SortEntry<uint, ArenaStatistic>>();
            foreach (ArenaStatistic info in ArenaStatistics.Values)
            {
                if (sortDictionary.ContainsKey(info.LastSeasonArenaPoints))
                {
                    SortEntry<uint, ArenaStatistic> entry = sortDictionary[info.LastSeasonArenaPoints];
                    entry.Values.Add(info.EntityID, info);
                }
                else
                {
                    SortEntry<uint, ArenaStatistic> entry = new SortEntry<uint, ArenaStatistic>();
                    entry.Values = new Dictionary<uint, ArenaStatistic>();
                    entry.Values.Add(info.EntityID, info);
                    sortDictionary.Add(info.LastSeasonArenaPoints, entry);
                }
            }
            SafeDictionary<uint, ArenaStatistic> toReplace = new SafeDictionary<uint, ArenaStatistic>(10000);

            uint Place = 1;
            foreach (KeyValuePair<ulong, SortEntry<uint, ArenaStatistic>> entries in sortDictionary.Reverse())
            {
                foreach (uint e in entries.Value.Values.Keys)
                {
                    if (ArenaStatistics[e].YesterdayTotal != 0)
                    {
                        ArenaStatistics[e].LastSeasonRank = Place;
                        Place++;
                        toReplace.Add(e, ArenaStatistics[e]);
                    }
                }
            }

            YesterdayArenaStatistics = toReplace;
        }
开发者ID:faresali,项目名称:co-pserver,代码行数:36,代码来源:Arena.cs

示例12: PrintPitchBook

        /// <summary>
        /// Prints the pitch book.
        /// </summary>
        /// <param name="biographyIds">The biographyIds.</param>
        /// <param name="projectId">The project id.</param>
        /// <param name="username">The username.</param>
        /// <returns></returns>
        public static string PrintPitchBook(string projectId, string biographyIds = null, string articleIds = null, string serviceIds = null, string relatedContentIds = null, string username = null, string resultFileName = null, string publishingFolder = null)
        {
            if (string.IsNullOrEmpty(projectId))
            {
                projectId = defaultProjectId;
            }

            var db = Sitecore.Context.ContentDatabase ??
                     Sitecore.Context.Database;

            var manager = new Sitecore.PrintStudio.PublishingEngine.PrintManager(db, Sitecore.Context.Language);

            var parameters = new SafeDictionary<string, object>();

            if (!string.IsNullOrEmpty(biographyIds))
            {
                parameters.Add("BiographyIds", biographyIds);
            }

            if (!string.IsNullOrEmpty(username))
            {
                parameters.Add("Weil_Username", username);
            }

            if (!string.IsNullOrEmpty(articleIds))
            {
                parameters.Add("ArticleIds", articleIds);
            }

            if (!string.IsNullOrEmpty(serviceIds))
            {
                parameters.Add("ServiceIds", serviceIds);
            }

            if (!string.IsNullOrEmpty(relatedContentIds))
            {
                parameters.Add("relatedContentIds", relatedContentIds);
            }

            var printOptions = new PrintOptions
            {
                PrintExportType = PrintExportType.Pdf,
                UseHighRes = true,
                Parameters = parameters,
                ResultFolder = publishingFolder ?? PublisherFolder
            };
            if (string.IsNullOrEmpty(resultFileName))
            {
                printOptions.ResultFileName = String.Format(fileNameFormat, "PitchBook", db.GetItem(projectId).Name.Replace(" ", "_"), DateTime.Now.Ticks, printOptions.ResultExtension, username);
            }
            else
            {
                printOptions.ResultFileName = resultFileName;
            }
            return manager.Print(projectId, printOptions);
        }
开发者ID:jcore,项目名称:JCore.SitecoreAPS.PrintStudio,代码行数:63,代码来源:PrintManager.cs

示例13: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var indexOfRo = System.Web.HttpContext.Current.Request.UrlReferrer.Query.IndexOf("fo=");
                var requestString =
                    System.Web.HttpUtility.ParseQueryString(
                        System.Web.HttpContext.Current.Request.UrlReferrer.Query.Substring(indexOfRo));
                //requestString = StringUtil.GetNameValues(requestString[0], '=', '&');
                var refinements = new SafeDictionary<string>();
                if (requestString["FieldsFilter"] != null)
                {
                    var splittedFields = StringUtil.GetNameValues(requestString["FieldsFilter"], ':', ',');
                    foreach (string key in splittedFields.Keys)
                    {
                        refinements.Add(key, splittedFields[key]);
                    }
                }

                var locationFilter = requestString["StartSearchLocation"];
                if (locationFilter.IsNotNull())
                {
                    if (locationFilter.StartsWith("query:"))
                    {
                        locationFilter = locationFilter.Replace("->", "=");
                        Item itemArray;
                        string query = locationFilter.Substring(6);
                        bool flag = query.StartsWith("fast:");
                        Opcode opcode = null;
                        if (!flag)
                        {
                            QueryParser.Parse(query);
                        }
                        if (flag || (opcode is Root))
                        {
                            itemArray =
                                Sitecore.Context.Item.Database.SelectSingleItem(query);
                        }
                        else
                        {
                            itemArray = Sitecore.Context.Item.Axes.SelectSingleItem(query);
                        }

                        locationFilter = itemArray.ID.ToString();

                    }
                }

                var pageSize = requestString["PageSize"];

                var locationFinal = (locationFilter.IsNullOrEmpty() ? Sitecore.Context.ContentDatabase.GetItem(requestString["id"]).GetParentBucketItemOrRootOrSelf().ID.ToString() : locationFilter);
                _ID = locationFinal;
                Filter = "location=" +
                         locationFinal +

                         "&text=" + requestString["FullTextQuery"] +
                         "&language=" + requestString["Language"] +
                         "&pageSize=" + (pageSize.IsNullOrEmpty() ? 20 : Int32.Parse(pageSize)) +

                         "&sort=" + requestString["SortField"];

                if (requestString["TemplateFilter"].IsNotNull())
                {

                    Filter += "&template=" + requestString["TemplateFilter"];
                }

            }
            catch(Exception exc)
            {
                Log.Error("Failed to Resolve Rich Text Editor Source", exc, this);

            }
            finally
            {
                if (!Id.IsNullOrEmpty())
                {
                    Page.Response.Write(
                        "<style>.token-input-list-facebook.boxme {background-image: url(/temp/IconCache/" +
                        Sitecore.Context.ContentDatabase.GetItem(Id).Appearance.Icon +
                        ");background-size:16px 16px;background-position: 2% 50%;background-repeat: no-repeat;}</style>");
                }
                var script = "<script type='text/javascript' language='javascript'>var filterForSearch='" + Filter +
                             "';</script>";
                Page.Response.Write(script);
            }
        }
开发者ID:udt1106,项目名称:Sitecore-Item-Buckets,代码行数:87,代码来源:MiniResults.aspx.cs

示例14: ReadyToPlay

 public void ReadyToPlay()
 {
     try
     {
         Screen = new Game.Screen(this);
         Inventory = new Game.ConquerStructures.Inventory(this);
         Equipment = new Game.ConquerStructures.Equipment(this);
         WarehouseOpen = false;
         WarehouseOpenTries = 0;
         TempPassword = "";
         Warehouses = new SafeDictionary<PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID, PhoenixProject.Game.ConquerStructures.Warehouse>(20);
         Warehouses.Add(PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.TwinCity, new PhoenixProject.Game.ConquerStructures.Warehouse(this, PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.TwinCity));
         Warehouses.Add(PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.PhoenixCity, new PhoenixProject.Game.ConquerStructures.Warehouse(this, PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.PhoenixCity));
         Warehouses.Add(PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.ApeCity, new PhoenixProject.Game.ConquerStructures.Warehouse(this, PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.ApeCity));
         Warehouses.Add(PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.DesertCity, new PhoenixProject.Game.ConquerStructures.Warehouse(this, PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.DesertCity));
         Warehouses.Add(PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.BirdCity, new PhoenixProject.Game.ConquerStructures.Warehouse(this, PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.BirdCity));
         Warehouses.Add(PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.StoneCity, new PhoenixProject.Game.ConquerStructures.Warehouse(this, PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.StoneCity));
         Warehouses.Add(PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.Market, new PhoenixProject.Game.ConquerStructures.Warehouse(this, PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.Market));
         Warehouses.Add(PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.House, new PhoenixProject.Game.ConquerStructures.Warehouse(this, PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.House));
         Warehouses.Add(PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.poker1, new PhoenixProject.Game.ConquerStructures.Warehouse(this, PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.poker1));
         Warehouses.Add(PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.poker2, new PhoenixProject.Game.ConquerStructures.Warehouse(this, PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.poker2));
         Warehouses.Add(PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.House2, new PhoenixProject.Game.ConquerStructures.Warehouse(this, PhoenixProject.Game.ConquerStructures.Warehouse.WarehouseID.House2));
         Trade = new Game.ConquerStructures.Trade();
         ArenaStatistic = new ArenaStatistic(true);
         Prayers = new List<GameState>();
         MagicDef = new List<GameState>();
         map = null;
     }
     catch (Exception e)
     {
         Program.SaveException(e);
     }
 }
开发者ID:Mromany,项目名称:Conquista5679-TheHunterSource-,代码行数:33,代码来源:GameState.cs

示例15: Load

        public static void Load(Game.ConquerStructures.Society.Guild g)
        {
            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
            cmd.Select("guild_arsenalsdonation").Where("guild_uid", g.ID);
            MySqlReader r = new MySqlReader(cmd);
            SafeDictionary<uint, ArsenalSingle> ass = new SafeDictionary<uint, ArsenalSingle>(1000);
            while (r.Read())
            {
                ArsenalSingle s = new ArsenalSingle();
                s.D_UID = r.ReadUInt32("d_uid");
                s.Name = r.ReadString("name");
                s.UID = r.ReadUInt32("item_uid");
                s.Donation = r.ReadUInt32("item_donation");
                s.Type = (ArsenalType)r.ReadByte("item_arsenal_type");
                ass.Add(s.UID, s);
            }
            r.Close();
            foreach (ArsenalSingle s in ass.Values)
            {
                s.Item = ConquerItemTable.GetSingleItem(s.UID);
                g.Arsenal.Inscribe(s.Type, s);
            }
            ass = new SafeDictionary<uint, ArsenalSingle>(1000);
            ass = null;

            cmd = new MySqlCommand(MySqlCommandType.SELECT);
            cmd.Select("guild_arsenals").Where("guild_uid", g.ID);
            r = new MySqlReader(cmd);
            if (r.Read())
            {
                g.A_Packet.Headgear_Avaliable = r.ReadByte("head_allowed") == 1;
                g.A_Packet.Armor_Avaliable = r.ReadByte("armor_allowed") == 1;
                g.A_Packet.Weapon_Avaliable = r.ReadByte("weapon_allowed") == 1;
                g.A_Packet.Ring_Avaliable = r.ReadByte("ring_allowed") == 1;
                g.A_Packet.Boots_Avaliable = r.ReadByte("boots_allowed") == 1;
                g.A_Packet.Necklace_Avaliable = r.ReadByte("neck_allowed") == 1;
                g.A_Packet.Fan_Avaliable = r.ReadByte("fan_allowed") == 1;
                g.A_Packet.Tower_Avaliable = r.ReadByte("tower_allowed") == 1;
            }
            r.Close();
        }
开发者ID:AiiMz,项目名称:PserverWork,代码行数:41,代码来源:ArsenalsTable.cs


注:本文中的SafeDictionary.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。