protected override bool FilterStatus(Dulcet.Twitter.TwitterStatusBase status) { bool init = Interlocked.Exchange(ref initCheckFlag, 1) == 0; if (ListStorage.IsListMemberCached(this.listUser, this.listName)) { var ids = ListStorage.GetListMembers(this.listUser, this.listName) .Select(u => u.TwitterUser.ScreenName).ToArray(); return(ids.Contains(status.User.ScreenName) && (!(status is TwitterStatus) || String.IsNullOrEmpty(((TwitterStatus)status).InReplyToUserScreenName) || ids.Contains(((TwitterStatus)status).InReplyToUserScreenName))); } else { if (init) { Task.Factory.StartNew(() => { try { ListStorage.GetListMembers(this.listUser, this.listName).ToArray(); this.RaiseRequireReaccept(); } catch { } }); } return(false); } }
public void ListStorageEmptyEntriesDefault() { var storage = new ListStorage(); Assert.That(storage.Count, Is.Zero); Assert.That(storage.Entries, IsEx.ExEmpty); }
/// <summary> /// 按组名查询全部的Storage信息 /// </summary> /// <param name="groupName">组名</param> /// <param name="clusterName">集群名称</param> /// <returns></returns> public async ValueTask <List <StorageInfo> > ListStorageInfosAsync(string groupName, string clusterName = "") { var request = new ListStorage(groupName); var response = await _executer.Execute(request, clusterName); return(response.StorageInfos); }
/// <summary>按组名查询全部的Storage信息 /// </summary> /// <param name="groupName">组名</param> /// <returns></returns> public async Task <List <StorageInfo> > ListStorageInfosAsync(string groupName) { var request = new ListStorage(groupName); var response = await _executer.Execute(request); return(response.StorageInfos); }
// Common function for add and set operations. private void SetOrAdd(Object key, Object value, bool set) { if (key == null) { throw new ArgumentNullException("key"); } ListStorage current = list; ListStorage prev = null; while (current != null) { if (comparer.Compare(current.key, key) == 0) { if (set) { return; } throw new ArgumentException(S._("Arg_ExistingEntry")); } prev = current; current = current.next; } if (prev != null) { prev.next = new ListStorage(key, value); } else { list = new ListStorage(key, value); } ++count; ++generation; }
// Constructor. public ListEnumerator(ListDictionary list) { this.list = list; this.generation = list.generation; this.current = null; this.atEnd = false; }
public void Remove(Object key) { ListStorage current = list; ListStorage prev = null; while (current != null) { if (comparer.Compare(current.key, key) == 0) { if (prev != null) { prev.next = current.next; } else { list = current.next; } --count; ++generation; return; } prev = current; current = current.next; } }
// Implement the ICollection interface. public void CopyTo(Array array, int index) { if (array == null) { throw new ArgumentNullException("array"); } else if (array.Rank != 1) { throw new ArgumentException(S._("Arg_RankMustBe1")); } else if (index < array.GetLowerBound(0)) { throw new ArgumentOutOfRangeException ("index", S._("Arg_InvalidArrayIndex")); } else if (index > (array.GetLength(0) - count)) { throw new ArgumentException(S._("Arg_InvalidArrayRange")); } else { ListStorage current = list; while (current != null) { array.SetValue (new DictionaryEntry(current.key, current.value), index++); current = current.next; } } }
public static void RunStoreToConverters() { PoolGenerator gs = new PoolGenerator("GeneratorS"); PoolGenerator gc1 = new PoolGenerator("GeneratorC1"); PoolGenerator gc2 = new PoolGenerator("GeneratorC2"); ListStorage s = new ListStorage(); s.Enable(); s.Name = "Store"; MathConverter c1 = new MathConverter(); c1.Enable(); c1.Name = "Calculator1"; MathConverter c2 = new MathConverter(); c2.Enable(); c2.Name = "Calculator2"; Builder.DataConnect(s, c1); Builder.DataConnect(s, c2); Builder.ActivationConnect(gs, s); Builder.ActivationConnect(gc2, c1); Builder.ActivationConnect(gc2, c2); gs.Enable(); gc1.Enable(); gc2.Enable(); }
protected BaseAnalyzerTests() { ListStorage = new ListStorage <FlashObservation>(); ListStorage.AddRange(FlashObservationBaseData.InitializeFlashObservations()); _analyzer = this.GetAnalyzer(); }
// Implement the IDictionary interface. public void Add(Object key, Object value) { if(key == null) { throw new ArgumentNullException("key"); } ListStorage current = list; ListStorage prev = null; while(current != null) { if(comparer.Compare(current.key, key) == 0) { throw new ArgumentException(S._("Arg_ExistingEntry")); } prev = current; current = current.next; } if(prev != null) { prev.next = new ListStorage(key, value); } else { list = new ListStorage(key, value); } ++count; ++generation; }
static void Main(string[] args) { var storage = new ListStorage(); new SearchByLastName(storage).Search(); new SearchByFirstName(storage).Search(); new SearchByAge(storage).Search(); }
public override void Upgrade(ref Storage storage) { storage = new ListStorage(Count); for (var i = 0; i < _properties.Length; i++) { var property = _properties[i]; storage.TrySetValue(property.Name, property.GetValue(_value)); } }
public void RegisterFollowingList(TwitterList list) { if (this.followingLists.FirstOrDefault(l => l.User.ScreenName == list.User.ScreenName && l.Name == list.Name) != null) { return; } this.followingLists.AddLast(list); ListStorage.Register(list); }
public ListStorage(ListStorage other) { // Perf: Don't call the copy constructor, that would box the enumerator. _inner = new List <KeyValuePair <string, object> >(other._inner.Capacity); for (var i = 0; i < other._inner.Count; i++) { _inner.Add(other._inner[i]); } }
public void Reset() { if (generation != this.generation) { throw new InvalidOperationException (S._("Invalid_CollectionModified")); } current = null; atEnd = false; }
/// <summary> /// Creates a <see cref="RouteValueDictionary"/> initialized with the specified <paramref name="values"/>. /// </summary> /// <param name="values">An object to initialize the dictionary. The value can be of type /// <see cref="IDictionary{TKey, TValue}"/> or <see cref="IReadOnlyDictionary{TKey, TValue}"/> /// or an object with public properties as key-value pairs. /// </param> /// <remarks> /// If the value is a dictionary or other <see cref="IEnumerable{T}"/> of <see cref="KeyValuePair{String, Object}"/>, /// then its entries are copied. Otherwise the object is interpreted as a set of key-value pairs where the /// property names are keys, and property values are the values, and copied into the dictionary. /// Only public instance non-index properties are considered. /// </remarks> public RouteValueDictionary(object values) { var dictionary = values as RouteValueDictionary; if (dictionary != null) { var listStorage = dictionary._storage as ListStorage; if (listStorage != null) { _storage = new ListStorage(listStorage); return; } var propertyStorage = dictionary._storage as PropertyStorage; if (propertyStorage != null) { // PropertyStorage is immutable so we can just copy it. _storage = dictionary._storage; return; } // If we get here, it's an EmptyStorage. _storage = EmptyStorage.Instance; return; } var keyValueEnumerable = values as IEnumerable <KeyValuePair <string, object> >; if (keyValueEnumerable != null) { var listStorage = new ListStorage(); _storage = listStorage; foreach (var kvp in keyValueEnumerable) { if (listStorage.ContainsKey(kvp.Key)) { var message = Resources.FormatRouteValueDictionary_DuplicateKey(kvp.Key, nameof(RouteValueDictionary)); throw new ArgumentException(message, nameof(values)); } listStorage._inner.Add(kvp); } return; } if (values != null) { _storage = new PropertyStorage(values); return; } _storage = EmptyStorage.Instance; }
public void ListStorageAddLogSorted() { var storage = new ListStorage(); Assert.That(storage.Count, Is.Zero); // Technically, various values should be set... but unless we throw an error, it should still work storage.AddLogSorted(logEntry); Assert.That(storage.Count, Is.EqualTo(1)); Assert.That(storage.Entries, Is.Not.ExEmpty()); }
public ListDictionary(IComparer comparer) { if(comparer != null) { this.comparer = comparer; } else { this.comparer = Comparer.Default; } this.list = null; this.count = 0; this.generation = 0; }
public ListDictionary(IComparer comparer) { if (comparer != null) { this.comparer = comparer; } else { this.comparer = Comparer.Default; } this.list = null; this.count = 0; this.generation = 0; }
public void ListStorageAddLogSortedUnsupported() { var storage = new ListStorage(); Assert.That(storage.Count, Is.Zero); // May seem weird, but for now we don't support arbitary ILogEntry var unsupportedLogEntry = Substitute.For <ILogEntry>(); Assert.Throws <ArgumentException>(() => { storage.AddLogSorted(unsupportedLogEntry); }); }
public bool Contains(Object key) { ListStorage current = list; while (current != null) { if (comparer.Compare(current.key, key) == 0) { return(true); } current = current.next; } return(false); }
public ListStorage(ListStorage other) { if (other.Count == 0) { _items = _emptyArray; } else { _items = new KeyValuePair <string, object> [other.Count]; for (var i = 0; i < other.Count; i++) { this.Add(other[i]); } } }
public static void RunStoreToConvertersToStore() { PoolGenerator gs1 = new PoolGenerator("GeneratorS1"); PoolGenerator gc1 = new PoolGenerator("GeneratorC1"); PoolGenerator gc2 = new PoolGenerator("GeneratorC2"); PoolGenerator gs2 = new PoolGenerator("GeneratorS2"); ListStorage s1 = new ListStorage(); s1.Enable(); s1.Name = "Store1"; MathConverter c1 = new MathConverter(); c1.Enable(); c1.Name = "Calculator1"; MathConverter c2 = new MathConverter(); c2.Enable(); c2.Name = "Calculator2"; ListStorage s2 = new ListStorage(); s2.Enable(); s2.Name = "Store2"; Builder.DataConnect(s1, c1); Builder.DataConnect(s1, c2); Builder.DataConnect(c1, s2); Builder.DataConnect(c2, s2); Builder.ActivationConnect(gs1, s1); Builder.ActivationConnect(gs2, s2); Builder.ActivationConnect(gc1, c1); Builder.ActivationConnect(gc2, c2); gc1.Enable(); gc2.Enable(); gs1.Enable(); gs2.Enable(); }
public Object this[Object key] { get { ListStorage current = list; while (current != null) { if (comparer.Compare(current.key, key) == 0) { return(current.value); } current = current.next; } return(null); } set { SetOrAdd(key, value, true); } }
// Implement the IEnumerator interface. public bool MoveNext() { if (generation != this.generation) { throw new InvalidOperationException (S._("Invalid_CollectionModified")); } if (atEnd) { return(false); } else if (current == null) { current = list.list; } else { current = current.next; } atEnd = (current == null); return(!atEnd); }
public static void RunStoreToConverter() { PoolGenerator gs = new PoolGenerator("GeneratorS"); PoolGenerator gc = new PoolGenerator("GeneratorC"); ListStorage s = new ListStorage(); s.Enable(); s.Name = "Store"; MathConverter c = new MathConverter(); c.Enable(); c.Name = "Calculator"; Builder.DataConnect(s, c); Builder.ActivationConnect(gs, s); Builder.ActivationConnect(gc, c); gs.Enable(); gc.Enable(); }
public static void RegisterReceive(string listUser, string listName) { System.Diagnostics.Debug.WriteLine("** LIST LISTEN START:@" + listUser + "/" + listName); listName = NormalizeListName(listName); var fullname = BuildListName(listUser, listName); lock (rcLocker) { if (referenceCount.ContainsKey(fullname)) { referenceCount[fullname]++; } else { var target = AccountStorage.Get(listUser); if (target == null) { target = AccountStorage.GetRandom(ai => ai.IsFollowingList(listUser, listName), true); } var tscheduler = target != null?AutoCruiseSchedulerManager.GetScheduler(target) : null; if (tscheduler == null) { // スケジューラがまだない // スケジューラが更新されるまで待つ waitings.Add(new Tuple <string, string>(listUser, listName)); return; } var task = new ListReceiveTask(target, listUser, listName); receivers.Add(fullname, task); tscheduler.AddSchedule(task); Task.Factory.StartNew(() => ListStorage.Get(listUser, listName)); referenceCount.Add(fullname, 1); } } }
public override void Upgrade(ref Storage storage) { storage = new ListStorage(); }
public void Remove(Object key) { ListStorage current = list; ListStorage prev = null; while(current != null) { if(comparer.Compare(current.key, key) == 0) { if(prev != null) { prev.next = current.next; } else { list = current.next; } --count; ++generation; return; } prev = current; current = current.next; } }
// Constructor. public ListStorage(Object key, Object value) { this.next = null; this.key = key; this.value = value; }
public ListContext() { Storage = new ListStorage(); }
// Implement the IEnumerator interface. public bool MoveNext() { if(generation != this.generation) { throw new InvalidOperationException (S._("Invalid_CollectionModified")); } if(atEnd) { return false; } else if(current == null) { current = list.list; } else { current = current.next; } atEnd = (current == null); return !atEnd; }
/// <summary> /// Creates a <see cref="DispatcherValueCollection"/> initialized with the specified <paramref name="values"/>. /// </summary> /// <param name="values">An object to initialize the dictionary. The value can be of type /// <see cref="IDictionary{TKey, TValue}"/> or <see cref="IReadOnlyDictionary{TKey, TValue}"/> /// or an object with public properties as key-value pairs. /// </param> /// <remarks> /// If the value is a dictionary or other <see cref="IEnumerable{T}"/> of <see cref="KeyValuePair{String, Object}"/>, /// then its entries are copied. Otherwise the object is interpreted as a set of key-value pairs where the /// property names are keys, and property values are the values, and copied into the dictionary. /// Only public instance non-index properties are considered. /// </remarks> public DispatcherValueCollection(object values) { var dictionary = values as DispatcherValueCollection; if (dictionary != null) { var listStorage = dictionary._storage as ListStorage; if (listStorage != null) { _storage = new ListStorage(listStorage); return; } var propertyStorage = dictionary._storage as PropertyStorage; if (propertyStorage != null) { // PropertyStorage is immutable so we can just copy it. _storage = dictionary._storage; return; } // If we get here, it's an EmptyStorage. _storage = EmptyStorage.Instance; return; } var keyValueEnumerable = values as IEnumerable <KeyValuePair <string, object> >; if (keyValueEnumerable != null) { var listStorage = new ListStorage(); _storage = listStorage; foreach (var kvp in keyValueEnumerable) { if (listStorage.ContainsKey(kvp.Key)) { var message = "duplicate key"; throw new ArgumentException(message, nameof(values)); } listStorage.Add(kvp); } return; } var stringValueEnumerable = values as IEnumerable <KeyValuePair <string, string> >; if (stringValueEnumerable != null) { var listStorage = new ListStorage(); _storage = listStorage; foreach (var kvp in stringValueEnumerable) { if (listStorage.ContainsKey(kvp.Key)) { var message = "duplicate key"; throw new ArgumentException(message, nameof(values)); } listStorage.Add(new KeyValuePair <string, object>(kvp.Key, kvp.Value)); } return; } if (values != null) { _storage = new PropertyStorage(values); return; } _storage = EmptyStorage.Instance; }
/// <summary> /// /// </summary> public bool LoadData() { bool l_bIsReturn = false; Session l_Session = new Session(BaseDatabase.Domain); l_Session.BeginTransaction(); { do { // 读取人物的详细信息 Query l_QueryCharacters = new Query(l_Session, "Select Characters instances where {CharacterName}=@CharacterName"); l_QueryCharacters.Parameters.Add("@CharacterName", m_ROSEMobile.CharacterName); QueryResult l_CharactersResult = l_QueryCharacters.Execute(); if (l_CharactersResult == null) { Debug.WriteLine("WorldServerExtendData.LoadData(...) - l_CharactersResult == null error!"); l_bIsReturn = true; break; } if (l_CharactersResult.Count != 1) { Debug.WriteLine("WorldServerExtendData.LoadData(...) - l_CharactersResult.Count != 1 error!"); l_bIsReturn = true; break; } Characters l_Characters = l_CharactersResult[0] as Characters; if (l_Characters == null) { Debug.WriteLine("WorldServerExtendData.LoadData(...) - l_Characters == null error!"); l_bIsReturn = true; break; } m_ROSEMobile.m_strCharacter = l_Characters.CharacterName; m_ROSEMobile.m_iLevel = l_Characters.Level; m_ROSEMobile.m_iFace = l_Characters.Face; m_ROSEMobile.m_iHairStyle = l_Characters.HairStyle; m_ROSEMobile.m_iSex = l_Characters.Sex; m_ROSEMobile.m_iClassID = l_Characters.ClassID; m_ROSEMobile.m_iZuly = l_Characters.Zuly; m_ROSEMobile.m_iStrength = l_Characters.Strength; m_ROSEMobile.m_iDexterity = l_Characters.Dexterity; m_ROSEMobile.m_iIntellect = l_Characters.Intellect; m_ROSEMobile.m_iConvergence = l_Characters.Convergence; m_ROSEMobile.m_iCharm = l_Characters.Charm; m_ROSEMobile.m_iSense = l_Characters.Sense; m_ROSEMobile.m_iCurrentHP = l_Characters.CurrentHP; m_ROSEMobile.m_iCurrentMP = l_Characters.CurrentMP; m_ROSEMobile.m_iCharacterGuid = l_Characters.CharacterGuid; m_ROSEMobile.m_iStatusPoint = l_Characters.StatusPoint; m_ROSEMobile.m_iSkillPoint = l_Characters.SkillPoint; m_ROSEMobile.m_iExperience = l_Characters.Experience; m_ROSEMobile.m_iStamina = l_Characters.Stamina; m_ROSEMobile.m_iClanGuid = l_Characters.ClanGuid; m_ROSEMobile.m_iClanRank = l_Characters.ClanRank; m_ROSEMobile.X = 5300; m_ROSEMobile.Y = 5200; m_ROSEMobile.m_posMapID = 2; m_ROSEMobile.m_iRespawnGuid = l_Characters.RespawnZoneGuid; Regex l_Regex = new Regex(@"(\d+)+", RegexOptions.Compiled); // 分析 QuickBar "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" MatchCollection l_MatchCollectionQuickBar = l_Regex.Matches(l_Characters.QuickBar); if (l_MatchCollectionQuickBar == null) { Debug.WriteLine("WorldServerExtendData.LoadData(...) - l_MatchCollectionQuickBar == null error!"); l_bIsReturn = true; break; } if (l_MatchCollectionQuickBar.Count != m_ROSEMobile.m_iQuickBar.Length) { Debug.WriteLine(string.Format("WorldServerExtendData.LoadData(...) - l_MatchCollectionQuickBar.Count != m_CharacterInfo.m_iQuickBar.Length error{0}-{1}!", l_MatchCollectionQuickBar.Count, m_ROSEMobile.m_iQuickBar.Length)); l_bIsReturn = true; break; } for (int iIndex = 0; iIndex < l_MatchCollectionQuickBar.Count; iIndex++) { Match l_Match = l_MatchCollectionQuickBar[iIndex]; Group l_Group = l_Match.Groups[1]; int l_iResult = 0; Int32.TryParse(l_Group.ToString(), out l_iResult); m_ROSEMobile.m_iQuickBar[iIndex] = l_iResult; } // 分析 BasicSkills "11,12,13,14,15,16,17,18,19,20,21,22,25,5000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" MatchCollection l_MatchCollectionBasicSkills = l_Regex.Matches(l_Characters.BasicSkills); if (l_MatchCollectionBasicSkills == null) { Debug.WriteLine("WorldServerExtendData.LoadData(...) - l_MatchCollectionBasicSkills == null error!"); l_bIsReturn = true; break; } if (l_MatchCollectionBasicSkills.Count != m_ROSEMobile.m_iBasicSkills.Length) { Debug.WriteLine("WorldServerExtendData.LoadData(...) - l_MatchCollectionBasicSkills.Count != 42 error!"); l_bIsReturn = true; break; } for (int iIndex = 0; iIndex < l_MatchCollectionBasicSkills.Count; iIndex++) { Match l_Match = l_MatchCollectionBasicSkills[iIndex]; Group l_Group = l_Match.Groups[1]; int l_iResult = 0; Int32.TryParse(l_Group.ToString(), out l_iResult); m_ROSEMobile.m_iBasicSkills[iIndex] = l_iResult; } // 分析 ClassSkills "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" MatchCollection l_MatchCollectionClassSkills = l_Regex.Matches(l_Characters.ClassSkills); if (l_MatchCollectionClassSkills == null) { Debug.WriteLine("WorldServerExtendData.LoadData(...) - l_MatchCollectionClassSkills == null error!"); l_bIsReturn = true; break; } if (l_MatchCollectionClassSkills.Count != m_ROSEMobile.m_iClassSkills.Length) { Debug.WriteLine(string.Format("WorldServerExtendData.LoadData(...) - l_MatchCollectionClassSkills.Count != m_CharacterInfo.m_iClassSkills.Length error{0}-{1}!", l_MatchCollectionClassSkills.Count, m_ROSEMobile.m_iClassSkills.Length)); l_bIsReturn = true; break; } // 初始化人物的技能 for (int iIndex = 0; iIndex < m_ROSEMobile.m_iClassSkills.Length; iIndex++) { m_ROSEMobile.m_iClassSkills[iIndex] = new CSkill(); } for (int iIndex = 0; iIndex < l_MatchCollectionClassSkills.Count; iIndex++) { Match l_Match = l_MatchCollectionClassSkills[iIndex]; Group l_Group = l_Match.Groups[1]; int l_iResult = 0; Int32.TryParse(l_Group.ToString(), out l_iResult); m_ROSEMobile.m_iClassSkills[iIndex].m_iClassSkillID = l_iResult; } // 分析 ClassSkillsLevel "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1" MatchCollection l_MatchCollectionClassSkillsLevel = l_Regex.Matches(l_Characters.ClassSkillsLevel); if (l_MatchCollectionClassSkillsLevel == null) { Debug.WriteLine("WorldServerExtendData.LoadData(...) - l_MatchCollectionClassSkillsLevel == null error!"); l_bIsReturn = true; break; } if (l_MatchCollectionClassSkillsLevel.Count != m_ROSEMobile.m_iClassSkills.Length) { Debug.WriteLine("WorldServerExtendData.LoadData(...) - l_MatchCollectionClassSkillsLevel.Count != 40 error!"); l_bIsReturn = true; break; } for (int iIndex = 0; iIndex < l_MatchCollectionClassSkillsLevel.Count; iIndex++) { Match l_Match = l_MatchCollectionClassSkillsLevel[iIndex]; Group l_Group = l_Match.Groups[1]; int l_iResult = 0; Int32.TryParse(l_Group.ToString(), out l_iResult); m_ROSEMobile.m_iClassSkills[iIndex].m_iLevel = l_iResult; } do { // 初始化人物身上道具 for (int iIndex = 0; iIndex < m_ROSEMobile.m_Items.Length; iIndex++) { m_ROSEMobile.m_Items[iIndex] = new CItem(); } // 读取人物身上的道具 Query l_QueryItems = new Query(l_Session, "Select Items instances where {CharacterGuid}=@CharacterGuid"); l_QueryItems.Parameters.Add("@CharacterGuid", l_Characters.CharacterGuid); QueryResult l_ItemResult = l_QueryItems.Execute(); if (l_ItemResult == null) { Debug.WriteLine("WorldServerExtendData.LoadData(...) - l_ItemResult == null error!"); break; } // 人物身上道具不存在 if (l_ItemResult.Count <= 0) { break; } for (int iIndex = 0; iIndex < l_ItemResult.Count; iIndex++) { Items l_Items = l_ItemResult[0] as Items; if (l_Items == null) { Debug.WriteLine("WorldServerExtendData.LoadData(...) - l_Items == null error!"); l_bIsReturn = true; break; } if (l_Items.SlotNumber >= m_ROSEMobile.m_Items.Length) { continue; } m_ROSEMobile.m_Items[l_Items.SlotNumber].m_iItemID = l_Items.ItemID; m_ROSEMobile.m_Items[l_Items.SlotNumber].m_iItemtype = l_Items.ItemType; m_ROSEMobile.m_Items[l_Items.SlotNumber].m_iRefine = l_Items.Refine; m_ROSEMobile.m_Items[l_Items.SlotNumber].m_iDurability = l_Items.Durability; m_ROSEMobile.m_Items[l_Items.SlotNumber].m_iLifespan = l_Items.Lifespan; m_ROSEMobile.m_Items[l_Items.SlotNumber].m_iCount = l_Items.Count; m_ROSEMobile.m_Items[l_Items.SlotNumber].m_iStats = l_Items.Stats; m_ROSEMobile.m_Items[l_Items.SlotNumber].m_bSocketed = l_Items.Socketed; m_ROSEMobile.m_Items[l_Items.SlotNumber].m_bAppraised = l_Items.Appraised; m_ROSEMobile.m_Items[l_Items.SlotNumber].m_iGemID = l_Items.GemID; } } while (false); // 如果错误则返回 if (l_bIsReturn == true) { break; } do { //初始化贮藏库道具 for (int iIndex = 0; iIndex < m_ROSEMobile.m_Storage.m_Items.Length; iIndex++) { m_ROSEMobile.m_Storage.m_Items[iIndex] = new CItem(); } // 读取贮藏库的内容 Query l_QueryStorage = new Query(l_Session, "Select ListStorage instances where {AccountGuid}=@AccountGuid"); l_QueryStorage.Parameters.Add("@AccountGuid", m_ROSEMobile.AccountGuid); QueryResult l_StorageResult = l_QueryStorage.Execute(); if (l_StorageResult == null) { Debug.WriteLine("WorldServerExtendData.LoadData(...) - l_StorageResult == null error!"); break; } // 贮藏库道具不存在 if (l_StorageResult.Count <= 0) { break; } for (int iIndex = 0; iIndex < l_StorageResult.Count; iIndex++) { ListStorage l_Storage = l_StorageResult[0] as ListStorage; if (l_Storage == null) { Debug.WriteLine("WorldServerExtendData.LoadData(...) - l_Storage == null error!"); l_bIsReturn = true; break; } if (l_Storage.SlotNumber >= m_ROSEMobile.m_Storage.m_Items.Length) { continue; } m_ROSEMobile.m_Storage.m_Items[l_Storage.SlotNumber].m_iItemID = l_Storage.ItemID; m_ROSEMobile.m_Storage.m_Items[l_Storage.SlotNumber].m_iItemtype = l_Storage.ItemType; m_ROSEMobile.m_Storage.m_Items[l_Storage.SlotNumber].m_iRefine = l_Storage.Refine; m_ROSEMobile.m_Storage.m_Items[l_Storage.SlotNumber].m_iDurability = l_Storage.Durability; m_ROSEMobile.m_Storage.m_Items[l_Storage.SlotNumber].m_iLifespan = l_Storage.Lifespan; m_ROSEMobile.m_Storage.m_Items[l_Storage.SlotNumber].m_iCount = l_Storage.Count; m_ROSEMobile.m_Storage.m_Items[l_Storage.SlotNumber].m_iStats = l_Storage.Stats; m_ROSEMobile.m_Storage.m_Items[l_Storage.SlotNumber].m_bSocketed = l_Storage.Socketed; m_ROSEMobile.m_Storage.m_Items[l_Storage.SlotNumber].m_bAppraised = l_Storage.Appraised; m_ROSEMobile.m_Storage.m_Items[l_Storage.SlotNumber].m_iGemID = l_Storage.GemID; } } while (false); // 如果错误则返回 if (l_bIsReturn == true) { break; } // 读取部落信息 if (m_ROSEMobile.m_iClanGuid > 0) { do { Query l_QueryListClan = new Query(l_Session, "Select ListClan instances where {ClanGuid}=@ClanGuid"); l_QueryListClan.Parameters.Add("@ClanGuid", l_Characters.ClanGuid); QueryResult l_ListClanResult = l_QueryListClan.Execute(); if (l_ListClanResult == null) { Debug.WriteLine("WorldServerExtendData.LoadData(...) - l_ListClanResult == null error!"); break; } // 部落信息不存在 if (l_ListClanResult.Count <= 0) { break; } if (l_ListClanResult.Count != 1) { Debug.WriteLine("WorldServerExtendData.LoadData(...) - l_ListClanResult == null error!"); l_bIsReturn = true; break; } ListClan l_ListClan = l_ListClanResult[0] as ListClan; if (l_ListClan == null) { Debug.WriteLine("WorldServerExtendData.LoadData(...) - l_ListClan == null error!"); l_bIsReturn = true; break; } m_ROSEMobile.m_iGrade = l_ListClan.Grade; m_ROSEMobile.m_iBack = l_ListClan.Back; m_ROSEMobile.m_iLogo = l_ListClan.Logo; m_ROSEMobile.m_strClanName = l_ListClan.ClanName; } while (false); // 如果错误则返回 if (l_bIsReturn == true) { break; } } // 读取人物的任务列表 Query l_QueryListQuest = new Query(l_Session, "Select ListQuest instances where {CharacterGuid}=@CharacterGuid"); l_QueryListQuest.Parameters.Add("@CharacterGuid", l_Characters.CharacterGuid); QueryResult l_ListQuestResult = l_QueryListQuest.Execute(); // 人物的任务信息不存在 if (l_ListQuestResult == null) { Debug.WriteLine("WorldServerExtendData.LoadData(...) - l_ListQuestResult == null error!"); break; } // 人物的任务信息不存在 if (l_ListQuestResult.Count <= 0) { break; } for (int iIndex = 0; iIndex < l_ListQuestResult.Count; iIndex++) { ListQuest l_ListQuest = l_ListQuestResult[iIndex] as ListQuest; if (l_ListQuest == null) { Debug.WriteLine("WorldServerExtendData.LoadData(...) - l_ListQuest == null error!"); l_bIsReturn = true; break; } CMyQuest l_thisQuest = new CMyQuest(); l_thisQuest.m_iQuestGuid = l_ListQuest.QuestGuid; //l_CMyQuest.thisquest = ; l_thisQuest.m_bActive = l_ListQuest.Active; // 分析 QuestItems MatchCollection l_MatchCollectionQuestItems = l_Regex.Matches(l_ListQuest.QuestItems); if (l_MatchCollectionQuestItems == null) { Debug.WriteLine("WorldServerExtendData.LoadData(...) - l_MatchCollectionQuestItems == null error!"); l_bIsReturn = true; break; } if (l_MatchCollectionQuestItems.Count != l_thisQuest.m_iItems.Length) { Debug.WriteLine("WorldServerExtendData.LoadData(...) - l_MatchCollectionQuestItems.Count != 5 error!"); l_bIsReturn = true; break; } for (int iIndex2 = 0; iIndex2 < l_MatchCollectionQuestItems.Count; iIndex2++) { Match l_Match = l_MatchCollectionQuestItems[iIndex2]; Group l_Group = l_Match.Groups[1]; int l_iResult = 0; Int32.TryParse(l_Group.ToString(), out l_iResult); l_thisQuest.m_iItems[iIndex2] = l_iResult; } m_ROSEMobile.MyQuestList.Add(l_thisQuest); } } while (false); } l_Session.Commit(); if (l_bIsReturn == true) { return(false); } else { return(true); } }
public void Reset() { if(generation != this.generation) { throw new InvalidOperationException (S._("Invalid_CollectionModified")); } current = null; atEnd = false; }
public void Clear() { list = null; count = 0; ++generation; }