public void Set(HaveSufferStateStore haveSufferStateStore) { Array values = Enum.GetValues(typeof(SufferStateProperty.SufferType)); IEnumerator enumerator = values.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; SufferStateProperty.SufferType key = (SufferStateProperty.SufferType)obj; HaveSufferStateStore.Data data = haveSufferStateStore.sufferStatePropertys.Where((HaveSufferStateStore.Data item) => item.key == key).SingleOrDefault <HaveSufferStateStore.Data>(); if (data != null) { if (!this.sufferStatePropertyDictionary.ContainsKey(key)) { this.sufferStatePropertyDictionary.Add(key, new SufferStateProperty(key)); } this.sufferStatePropertyDictionary[key].Set(data.values); } } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } }
public HaveSufferStateStore Get() { HaveSufferStateStore haveSufferStateStore = new HaveSufferStateStore(); List <HaveSufferStateStore.Data> list = new List <HaveSufferStateStore.Data>(); Array values = Enum.GetValues(typeof(SufferStateProperty.SufferType)); IEnumerator enumerator = values.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; SufferStateProperty.SufferType key = (SufferStateProperty.SufferType)obj; if (this.sufferStatePropertyDictionary.ContainsKey(key)) { list.Add(new HaveSufferStateStore.Data { key = key, values = this.sufferStatePropertyDictionary[key].Get() }); } } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } haveSufferStateStore.sufferStatePropertys = list.ToArray(); return(haveSufferStateStore); }