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


C# SafeDictionary类代码示例

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


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

示例1: LocalCache

		private LocalCache()
		{
            AllSecureCommandVMs = new List<SecureCommandViewModel>();
			AllRoomGroupVMs = new List<RoomGroupViewModel>();
			AllRoomVMs = new List<RoomViewModel>();
			RoomServicePort = int.Parse(ConfigurationManager.AppSettings["RoomServicePort"]);
            RoomAudioServicePort = int.Parse(ConfigurationManager.AppSettings["RoomAudioServicePort"]);
            VideoFps = int.Parse(ConfigurationManager.AppSettings["VideoFps"]);
            VideoQuality = int.Parse(ConfigurationManager.AppSettings["VideoQuality"]);
            PublicChatMessageCount = int.Parse(ConfigurationManager.AppSettings["PublicChatMessageCount"]);
            PrivateChatMessageCount = int.Parse(ConfigurationManager.AppSettings["PrivateChatMessageCount"]);
            MessagePerSecond = int.Parse(ConfigurationManager.AppSettings["MessagePerSecond"]);
            AllImages = new Dictionary<int, Dictionary<int, ImageViewModel>>();
            AllGiftGroupVMs = new List<GiftGroupViewModel>();
            AllGiftVMs = new List<GiftViewModel>();
            AllUserVMs = new SafeDictionary<int, UserViewModel>();
            AllRoleVMs = new List<RoleViewModel>();
            AllCommandVMs = new List<CommandViewModel>();
            AllRoleCommandVMs = new List<RoleCommandViewModel>();
            AllRoomRoleVMs = new List<RoomRoleViewModel>();
            AllExchangeRateVMs = new List<ExchangeRateViewModel>();

            foreach(var imgType in BuiltIns.ImageTypes)
            {
                AllImages.Add(imgType.Id,new Dictionary<int,ImageViewModel>());
            }
		}
开发者ID:wangws556,项目名称:duoduo-chat,代码行数:27,代码来源:LocalCache.cs

示例2: Clans

        public Clans()
        {

            Members = new Dictionary<uint, ClanMembers>();
            Allies = new SafeDictionary<uint, Clans>(10);
            Enemies = new SafeDictionary<uint, Clans>(10);
        }
开发者ID:Mromany,项目名称:Conquista5679-TheHunterSource-,代码行数:7,代码来源:Clans.cs

示例3: Reset

        public static void Reset()
        {
            Scores = new SafeDictionary<uint, Game.Clans>(100);
            ClanFlag.Hitpoints = ClanFlag.MaxHitpoints;

            IsWar = true;
        }
开发者ID:Mromany,项目名称:Conquista5679-TheHunterSource-,代码行数:7,代码来源:ClanWar.cs

示例4: GetFieldCrawlerValues

        /// <summary>
        /// The get field crawler values.
        /// </summary>
        /// <param name="field">
        /// The field.
        /// </param>
        /// <param name="fieldCrawlers">
        /// The field crawlers.
        /// </param>
        /// <returns>
        /// The IEnumerable of field crawler values.
        /// </returns>
        public static IEnumerable<string> GetFieldCrawlerValues(Field field, SafeDictionary<string, string> fieldCrawlers)
        {
            Assert.IsNotNull(field, "Field was not supplied");
            Assert.IsNotNull(fieldCrawlers, "Field Crawler collection is not specified");

            if (fieldCrawlers.ContainsKey(field.TypeKey))
            {
                var fieldCrawlerType = fieldCrawlers[field.TypeKey];

                if (!string.IsNullOrEmpty(fieldCrawlerType))
                {
                    var fieldCrawler = ReflectionUtil.CreateObject(fieldCrawlerType, new object[] { field });

                    if (fieldCrawler is IMultivaluedFieldCrawler)
                    {
                        return (fieldCrawler as IMultivaluedFieldCrawler).GetValues();
                    }

                    if (fieldCrawler is FieldCrawlerBase)
                    {
                        return new[] { (fieldCrawler as FieldCrawlerBase).GetValue() };
                    }
                }
            }

            return new[] { new DefaultFieldCrawler(field).GetValue() };
        }
开发者ID:NetworkTen,项目名称:SitecoreSearchContrib,代码行数:39,代码来源:ExtendedFieldCrawlerFactory.cs

示例5: 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

示例6: InitializeSites

        private void InitializeSites()
        {
            Database database = Factory.GetDatabase(DatabaseName, false);
            if (database == null)
                return;

            if (_siteDictionary != null && _siteDictionary.Any())
                return;

            lock (_lock)
            {
                if (_siteDictionary != null && _siteDictionary.Any())
                    return;

                var sitesCollection = new SiteCollection();
                var siteDictionary = new SafeDictionary<string, Site>(StringComparer.InvariantCultureIgnoreCase);

                foreach (Item siteItem in GetSiteDeinitionItems(database))
                {
                    Site site = ResolveSite(siteItem);

                    if (site != null)
                    {
                        siteDictionary[site.Name] = site;
                        sitesCollection.Add(site);
                    }
                }

                _sitesCollection = sitesCollection;
                _siteDictionary = siteDictionary;
            }
        }
开发者ID:islaytitans,项目名称:HabitatMicrositeKit,代码行数:32,代码来源:DynamicMicrositesProvider.cs

示例7: Filter

        public List<FacetReturn> Filter(Query query, List<SearchStringModel> searchQuery, string locationFilter, BitArray baseQuery)
        {
            var refinement = new SafeDictionary<string> { { "is facet", "1" } };

            int hitsCount;
            var facetFields =
                Context.ContentDatabase.GetItem(ItemIDs.TemplateRoot)
                    .Search(refinement, out hitsCount, location: ItemIDs.TemplateRoot.ToString(),
                            numberOfItemsToReturn: 2000, pageNumber: 1)
                    .ToList()
                    .Select((item, sitecoreItem) =>
                            new
                                {
                                    FieldId = item.ItemId,
                                    Facet = new Facet(item.Name)
                                })

                    .ToList();
            facetFields.Sort((f1, f2) => System.String.Compare(f1.Facet.FieldName, f2.Facet.FieldName, System.StringComparison.Ordinal));

            var returnFacets = (from facetField in facetFields
                                from facet in facetField.Facet.GetValues(query, locationFilter, baseQuery).Select(facet => new FacetReturn
                                    {
                                        KeyName = facet.Key,
                                        Value = facet.Value.ToString(),
                                        Type = facetField.Facet.FieldName.ToLower(),
                                        ID = facetField.FieldId + "|" + facet.Key
                                    })
                                select facet).ToList();

            return returnFacets.ToList();
        }
开发者ID:csteeg,项目名称:Sitecore-Item-Buckets,代码行数:32,代码来源:FieldFacet.cs

示例8: InventoryComponent

		internal InventoryComponent(uint UserId, GameClient Client, UserData UserData)
		{
			this.mClient = Client;
			this.UserId = UserId;
			this.floorItems = new HybridDictionary();
			this.wallItems = new HybridDictionary();
			this.discs = new HybridDictionary();
			foreach (UserItem current in UserData.inventory)
			{
				if (current.GetBaseItem().InteractionType == InteractionType.musicdisc)
				{
					this.discs.Add(current.Id, current);
				}
				if (current.isWallItem)
				{
					this.wallItems.Add(current.Id, current);
				}
				else
				{
					this.floorItems.Add(current.Id, current);
				}
			}
			this.InventoryPets = new SafeDictionary<uint, Pet>(UserData.pets);
			this.InventoryBots = new SafeDictionary<uint, RoomBot>(UserData.Botinv);
			this.mAddedItems = new HybridDictionary();
			this.mRemovedItems = new HybridDictionary();
			this.isUpdated = false;
		}
开发者ID:kessiler,项目名称:habboServer,代码行数:28,代码来源:InventoryComponent.cs

示例9: AddRetweet

 /// <summary>
 /// Retweetしたユーザーとして追加します。
 /// </summary>
 public bool AddRetweet(TwitterUser user, DateTime time)
 {
     if (retweetDict == null)
         retweetDict = new SafeDictionary<TwitterUser, DateTime>();
     var ret = retweetDict.AddOrUpdate(user, time);
     RetweetTableUpdated();
     TweetModel.RaiseExtraDataTableUpdated(this.LinkId);
     return ret;
 }
开发者ID:karno,项目名称:Lycanthrope,代码行数:12,代码来源:TweetExtraData.cs

示例10: 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

示例11: AddCreateInfo

        /// <summary>
        /// 
        /// </summary>
        /// <param name="iRace"></param>
        /// <param name="iClass"></param>
        /// <param name="playerLevelStats"></param>
        public void AddCreateInfo( uint iRace, uint iClass, WowCharacterCreateInfo playerCreateInfo )
        {
            SafeDictionary<uint, WowCharacterCreateInfo> safeWowPlayerCreateInfo = m_PlayerCreateInfo.GetValue( iRace );
            if ( safeWowPlayerCreateInfo == null )
                safeWowPlayerCreateInfo = new SafeDictionary<uint, WowCharacterCreateInfo>();

            safeWowPlayerCreateInfo.Add( iClass, playerCreateInfo );

            m_PlayerCreateInfo.Add( iRace, safeWowPlayerCreateInfo );
        }
开发者ID:andyhebear,项目名称:HappyQ-WowServer,代码行数:16,代码来源:WowCharacterCreateInfoHandler.cs

示例12: Start

 public static void Start()
 {
     Scores = new SafeDictionary<uint, Game.Clans>(100);
     StartTime = DateTime.Now;
     //LeftGate.Mesh = (ushort)(240 + LeftGate.Mesh % 10);
     //RightGate.Mesh = (ushort)(270 + LeftGate.Mesh % 10);
     ServerBase.Kernel.SendWorldMessage(new Message("Clan war has began!", System.Drawing.Color.Red, Message.Center), ServerBase.Kernel.GamePool.Values);
     FirstRound = true;
     IsWar = true;
 }
开发者ID:Mromany,项目名称:Conquista5679-TheHunterSource-,代码行数:10,代码来源:ClanWar.cs

示例13: TestDefaultDefaultString

        public void TestDefaultDefaultString()
        {
            var dic = new SafeDictionary<string, string>();

            dic["A"] = "AA";
            dic["B"] = "BB";

            Assert.AreEqual("AA",dic["A"]);
            Assert.IsNull(dic["C"]);
        }
开发者ID:TheMouster,项目名称:core,代码行数:10,代码来源:SafeDictionaryTest.cs

示例14: TestDefaultDefaultInt

        public void TestDefaultDefaultInt()
        {
            var dic = new SafeDictionary<string, int>();

            dic["A"] = 1;
            dic["B"] = 2;

            Assert.AreEqual(1, dic["A"]);
            Assert.AreEqual(0, dic["C"]);
        }
开发者ID:TheMouster,项目名称:core,代码行数:10,代码来源:SafeDictionaryTest.cs

示例15: ReflectionService

        /// <summary>
        /// Default constructor
        /// </summary>
        public ReflectionService()
        {
            getPropertyAccessors =
                new SafeDictionary<string, GetPropertyDelegate>();

            setPropertyAccessors =
                new SafeDictionary<string, SetPropertyDelegate>();

            callAccessors =
                new SafeDictionary<string, CallMethodDelegate>();
        }
开发者ID:ricardoshimoda,项目名称:Grace,代码行数:14,代码来源:ReflectionService.cs


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