public void NonEmptyDictionary() { Hashtable map = new Hashtable(); map.Add(1, "one"); map.Add(2, "two"); map.Add(3, "three"); ArrayList entryList = new ArrayList(DictionaryHelper.GetEntries(map)); Assert.AreEqual(3, entryList.Count); DictionaryEntry first = Shift(entryList); Assert.AreEqual(first.Value, map[first.Key]); map.Remove(first.Key); DictionaryEntry second = Shift(entryList); Assert.AreEqual(second.Value, map[second.Key]); map.Remove(second.Key); DictionaryEntry third = Shift(entryList); Assert.AreEqual(third.Value, map[third.Key]); map.Remove(third.Key); Assert.AreEqual(0, map.Count); Assert.AreEqual(0, entryList.Count); }
private static Hashtable GetSumPairs0(int[] input, int sum) { Hashtable result = new Hashtable(); foreach (int val in input) { if (!result.Contains(val)) { result.Add(val, sum - val); } } for (int i = 0; i < input.Length - 1; i++) { int numb1 = input[i]; //how to remove dup key? int numb2 = sum - numb1; if (result.Contains(numb1) && result.Contains(numb2)) { result.Remove(numb2); result[numb1] = numb2; } else if (result.Contains(numb1) && !result.Contains(numb2)) { result.Remove(numb1); } } return result; }
static VirtualWebSocketHandler() { new System.Threading.Thread(() => { while (true) { try { foreach (string id in ActivedVirtualWebSocketHandler.Keys) { var handler = (RemotingClientHandler)ActivedVirtualWebSocketHandler[id]; if (handler != null && (DateTime.Now - handler._heartTime).TotalMinutes > 2) { handler.OnDisconnected(); //删除 ActivedVirtualWebSocketHandler.Remove(id); } } } catch { System.Threading.Thread.Sleep(100); continue; } System.Threading.Thread.Sleep(30000); } }).Start(); }
/// <summary> /// Creates a new Voronoi Graph given a set of Points /// </summary> /// <param name="Datapoints">Data points to base the Voronoi Graph around</param> /// <returns></returns> public static VoronoiGraph GenerateGraph(IEnumerable Datapoints) { BinaryPriorityQueue PQ = new BinaryPriorityQueue(); Hashtable CurrentCircles = new Hashtable(); VoronoiGraph Graph = new VoronoiGraph(); VNode RootNode = null; foreach (Vector2 V in Datapoints) { PQ.Push(new VDataEvent(V)); } while (PQ.Count > 0) { VEvent VE = PQ.Pop() as VEvent; VDataNode[] CircleCheckList; if (VE is VDataEvent) { RootNode = VNode.ProcessDataEvent(VE as VDataEvent, RootNode, Graph, VE.Y, out CircleCheckList); } else if (VE is VCircleEvent) { CurrentCircles.Remove(((VCircleEvent)VE).NodeN); if (!((VCircleEvent)VE).Valid) continue; RootNode = VNode.ProcessCircleEvent(VE as VCircleEvent, RootNode, Graph, VE.Y, out CircleCheckList); } else throw new Exception("Got event of type " + VE.GetType().ToString() + "!"); foreach (VDataNode VD in CircleCheckList) { if (CurrentCircles.ContainsKey(VD)) { ((VCircleEvent)CurrentCircles[VD]).Valid = false; CurrentCircles.Remove(VD); } VCircleEvent VCE = VNode.CircleCheckDataNode(VD, VE.Y); if (VCE != null) { PQ.Push(VCE); CurrentCircles[VD] = VCE; } } if (VE is VDataEvent) { Vector2 DP = ((VDataEvent)VE).DataPoint; foreach (VCircleEvent VCE in CurrentCircles.Values) { if (Vector2.Distance(DP, VCE.Center) < VCE.Y - VCE.Center.y && Math.Abs(Vector2.Distance(DP, VCE.Center) - (VCE.Y - VCE.Center.y)) > 1e-10) VCE.Valid = false; } } } return Graph; }
public void RemoveFilesFromUploadQueue(string[] localFileName) { foreach (string s in localFileName) { if (queue.ContainsKey(s)) { queue.Remove(s); } } }
public void A_TestBasicOps() { IDictionary weakHashTable = TestWeakHashTableBehavior.CreateDictionary();// new SupportClass.TjWeakHashTable(); Hashtable realHashTable = new Hashtable(); SmallObject[] so = new SmallObject[100]; for (int i = 0; i < 20000; i++) { SmallObject key = new SmallObject(i); SmallObject value = key; so[i / 200] = key; realHashTable.Add(key, value); weakHashTable.Add(key, value); } Assert.AreEqual(weakHashTable.Count, realHashTable.Count); ICollection keys = (ICollection)realHashTable.Keys; foreach (SmallObject key in keys) { Assert.AreEqual(((SmallObject)realHashTable[key]).i, ((SmallObject)weakHashTable[key]).i); Assert.IsTrue(realHashTable[key].Equals(weakHashTable[key])); } ICollection values1 = (ICollection)weakHashTable.Values; ICollection values2 = (ICollection)realHashTable.Values; Assert.AreEqual(values1.Count, values2.Count); realHashTable.Remove(new SmallObject(10000)); weakHashTable.Remove(new SmallObject(10000)); Assert.AreEqual(weakHashTable.Count, 20000); Assert.AreEqual(realHashTable.Count, 20000); for (int i = 0; i < so.Length; i++) { realHashTable.Remove(so[i]); weakHashTable.Remove(so[i]); Assert.AreEqual(weakHashTable.Count, 20000 - i - 1); Assert.AreEqual(realHashTable.Count, 20000 - i - 1); } //After removals, compare the collections again. ICollection keys2 = (ICollection)realHashTable.Keys; foreach (SmallObject o in keys2) { Assert.AreEqual(((SmallObject)realHashTable[o]).i, ((SmallObject)weakHashTable[o]).i); Assert.IsTrue(realHashTable[o].Equals(weakHashTable[o])); } }
/// <summary> /// Remove dead items from the collection now. This method is also called automatically on Add(), Remove() and Count. /// </summary> public void WeakCleanup() { var keys = container.Keys.Cast <WeakRefHashed>().ToArray(); foreach (var k in keys) { if (!k.IsAlive) { container.Remove(k); } } }
/// <summary> /// 从集合中移除一个元素。 /// </summary> /// <param name="item">要移除的元素。</param> /// <returns></returns> public void Remove(SpeedDataColumn item) { int Index = item.Index; Items.Remove(item); ColumnsHashTable.Remove(item.Name); if (Index < (Items.Count - 1)) { RearrangeColumnIndex(Index + 1); } OnDataColumnRemoved(Index); }
public void deleteTestOfHashtable() { Hashtable oTable = new Hashtable(); oTable.Add("test", "testing"); oTable.Remove("test"); Assert.IsNull(oTable["test"]); }
private void m_CleanupTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { try { System.Collections.ArrayList deletionKeys = new System.Collections.ArrayList(); //lock(m_ImageTileHash.SyncRoot) { foreach (string key in m_ResourceHash.Keys) { ResourceCacheEntry tile = (ResourceCacheEntry)m_ResourceHash[key]; if (System.DateTime.Now.Subtract(tile.LastAccessed) > System.TimeSpan.FromSeconds(30)) { deletionKeys.Add(key); } } } foreach (string key in deletionKeys) { ResourceCacheEntry tile = (ResourceCacheEntry)m_ResourceHash[key]; m_ResourceHash.Remove(key); } } catch {} }
/// <summary> /// 判断某用户是否已经登陆 /// </summary> /// <param name="id">为用户ID或用户名这个必须是用户的唯一标识</param> /// <returns>true为没有登陆 flase为被迫下线</returns> public bool IsLogin(object id) { bool flag = true; string uid = id.ToString(); System.Collections.Hashtable ht = (System.Collections.Hashtable)HttpContext.Current.Application[appKey]; if (ht != null) { System.Collections.IDictionaryEnumerator IDE = ht.GetEnumerator(); while (IDE.MoveNext()) { //找到自己的登陆ID if (IDE.Key.ToString().Equals(HttpContext.Current.Session.SessionID)) { //判断用户是否被注销 if (IDE.Value.ToString().Equals(logout)) { ht.Remove(HttpContext.Current.Session.SessionID); HttpContext.Current.Application.Lock(); HttpContext.Current.Application[appKey] = ht; HttpContext.Current.Application.UnLock(); HttpContext.Current.Session.RemoveAll(); //HttpContext.Current.Response.Write("<script type='text/javascript'>alert('你的帐号已在别处登陆,你被强迫下线!')</script>"); flag = false; } break; } } } return(flag); }
public void TestAddRemoveLargeAmountNumbers() { Hashtable ht = new Hashtable(); //[] Read all of the doubles from the file and store them into the hashtable int count = 0; foreach (var number in s_AddStressInputData) { ht.Add(number, count++); } //[] Read all of the doubles from the file and make sure they exist in the hashtable hashtable count = 0; foreach (var tempLong in s_AddStressInputData) { Assert.Equal((int)ht[tempLong], count); Assert.True(ht.ContainsKey(tempLong)); ++count; } //[] Remove all of the entries foreach (var tempLong in s_AddStressInputData) { ht.Remove(tempLong); } Assert.Equal(0, ht.Count); }
internal override void GetNamespacesToRender(XmlElement element, SortedList attrListToRender, SortedList nsListToRender, Hashtable nsLocallyDeclared) { XmlAttribute a = null; object[] array = new object[nsLocallyDeclared.Count]; nsLocallyDeclared.Values.CopyTo(array, 0); foreach (object obj2 in array) { int num; a = (XmlAttribute) obj2; XmlAttribute nearestRenderedNamespaceWithMatchingPrefix = base.GetNearestRenderedNamespaceWithMatchingPrefix(Utils.GetNamespacePrefix(a), out num); if (Utils.IsNonRedundantNamespaceDecl(a, nearestRenderedNamespaceWithMatchingPrefix)) { nsLocallyDeclared.Remove(Utils.GetNamespacePrefix(a)); if (Utils.IsXmlNamespaceNode(a)) { attrListToRender.Add(a, null); } else { nsListToRender.Add(a, null); } } } for (int i = base.m_ancestorStack.Count - 1; i >= 0; i--) { foreach (object obj3 in base.GetScopeAt(i).GetUnrendered().Values) { a = (XmlAttribute) obj3; if (a != null) { this.GetNamespaceToRender(Utils.GetNamespacePrefix(a), attrListToRender, nsListToRender, nsLocallyDeclared); } } } }
public static TypeConverter GetConverter(Type itemType) { TypeConverter converter = TypeDescriptor.GetConverter(itemType); if (converter == null || converter.GetType() == typeof(TypeConverter)) { // We got an invalid converter. WPF will do this if the converter // is internal, but we use internal converters all over the place // at design time. Detect this and build the converter ourselves. if (converterCache != null) { converter = (TypeConverter)converterCache[itemType]; if (converter != null) { return converter; } } AttributeCollection attrs = TypeDescriptor.GetAttributes(itemType); TypeConverterAttribute tca = attrs[typeof(TypeConverterAttribute)] as TypeConverterAttribute; if (tca != null && tca.ConverterTypeName != null) { Type type = Type.GetType(tca.ConverterTypeName); if (type != null && !type.IsPublic && typeof(TypeConverter).IsAssignableFrom(type)) { ConstructorInfo ctor = type.GetConstructor(new Type[] { typeof(Type) }); if (ctor != null) { converter = (TypeConverter)ctor.Invoke(new object[] { itemType }); } else { converter = (TypeConverter)Activator.CreateInstance(type); } lock (converterCacheSyncObject) { if (converterCache == null) { converterCache = new Hashtable(); // Listen to type changes and clear the cache. // This allows new metadata tables to be installed TypeDescriptor.Refreshed += delegate(RefreshEventArgs args) { converterCache.Remove(args.TypeChanged); }; } converterCache[itemType] = converter; } } } } return converter; }
// private static void FetchSyntax(UriParser syntax, string lwrCaseSchemeName, int defaultPort) { if (syntax.SchemeName.Length != 0) { throw new InvalidOperationException(SR.GetString(SR.net_uri_NeedFreshParser, syntax.SchemeName)); } lock (m_Table) { syntax.m_Flags &= ~UriSyntaxFlags.V1_UnknownUri; UriParser oldSyntax = (UriParser)m_Table[lwrCaseSchemeName]; if (oldSyntax != null) { throw new InvalidOperationException(SR.GetString(SR.net_uri_AlreadyRegistered, oldSyntax.SchemeName)); } oldSyntax = (UriParser)m_TempTable[syntax.SchemeName]; if (oldSyntax != null) { // optimization on schemeName, will try to keep the first reference lwrCaseSchemeName = oldSyntax.m_Scheme; m_TempTable.Remove(lwrCaseSchemeName); } syntax.OnRegister(lwrCaseSchemeName, defaultPort); syntax.m_Scheme = lwrCaseSchemeName; syntax.CheckSetIsSimpleFlag(); syntax.m_Port = defaultPort; m_Table[syntax.SchemeName] = syntax; } }
static void Main(string[] args) { Hashtable openWith = new Hashtable(); String key = " "; while (key != "") { int value = 1; key = Console.ReadLine(); if (openWith.Contains(key)) { int value1 = (int)openWith[key]; openWith[key] = ++value1; } else openWith.Add(key, value); } openWith.Remove(""); PrintValues(openWith); Console.ReadKey(); }
public void WriteParameters() { MethodInformation mi = Procedures[current_method]; if (mi.arg_names != null && mi.arg_names.Length > 0) { indent_level += 3; for (int i = 0; i < mi.arg_names.Length; i++) { Indent(); if (variables.Contains(mi.arg_names[i].ToLower())) { stream.Write(" ??_Variable"); variables.Remove(mi.arg_names[i]); } else if (arrays.Contains(current_method.ToLower())) { stream.Write(" ??_Array"); arrays.Remove(mi.arg_names[i]); } else if (arrays_2d.Contains(current_method.ToLower())) { stream.Write(" ??_Array_2D"); arrays_2d.Remove(mi.arg_names[i]); } else { stream.Write(" ??"); } if (mi.args_are_output[i]) { stream.Write(" *"); } else { stream.Write(" "); } stream.Write(mi.arg_names[i]); if (i < mi.arg_names.Length - 1) { stream.WriteLine(";"); } else { stream.WriteLine(")"); } } indent_level -= 3; indent_level -= 3; Indent(); stream.WriteLine("{"); indent_level += 3; } else { stream.WriteLine(" {"); } }
static void RemoveDup(ref Hashtable target, Hashtable dup) { if (dup.Count == 0) return; ICollection array = target.Keys; int nOldCount = array.Count; ArrayList aWantRemove = new ArrayList(); foreach(object strKey in array) { if (dup.Contains(strKey) == true) { aWantRemove.Add(strKey); } } for(int i=0;i<aWantRemove.Count;i++) { target.Remove(aWantRemove[i]); // Debug.Assert(nOldCount == array.Count, "Hashtable.Keys不是只读的?"); } }
/// <summary> /// remove the data by key /// </summary> /// <param name="key">key</param> public void Remove(string key) { if (ht.Contains(key)) { ht.Remove(key); } }
public void TS_DeleteNode(String NodeName) { if (NodeName == null) { return; } if (!m_FunctionNodeModels.ContainsKey(NodeName)) { return; } Model.TrickerStarFunctionNodeModel node_m = (Model.TrickerStarFunctionNodeModel)m_FunctionNodeModels[NodeName]; TrickerStarFunctionNode node_v = (TrickerStarFunctionNode)m_FunctionNodeViews[NodeName]; foreach (var item in node_m.InputSlot) { DeleteLine(item.LineName); } foreach (var item in node_m.OutputSlot) { DeleteLine(item.LineName); } m_FunctionNodeModels.Remove(NodeName); m_FunctionNodeViews.Remove(NodeName); C_MAIN_CANVAS.Children.Remove(node_v); m_SelectedFunctionNodeModels.Clear(); m_FromSlot = null; m_ToSlot = null; }
public void UpdateFromSelection (Photo [] sel) { Hashtable taghash = new Hashtable (); for (int i = 0; i < sel.Length; i++) { foreach (Tag tag in sel [i].Tags) { int count = 1; if (taghash.Contains (tag)) count = ((int) taghash [tag]) + 1; if (count <= i) taghash.Remove (tag); else taghash [tag] = count; } if (taghash.Count == 0) break; } selected_photos_tagnames = new ArrayList (); foreach (Tag tag in taghash.Keys) if ((int) (taghash [tag]) == sel.Length) selected_photos_tagnames.Add (tag.Name); Update (); }
public override string ToText(Subtitle subtitle, string title) { // timestamp: 00:00:01:401, filepos: 000000000 const string paragraphWriteFormat = "timestamp: {0}, filepos: {1}"; var tempNonTimeCodes = new Hashtable(); foreach (DictionaryEntry de in (subtitle.OriginalFormat as Idx).NonTimeCodes) { tempNonTimeCodes.Add(de.Key, de.Value); } var sb = new StringBuilder(); foreach (Paragraph p in subtitle.Paragraphs) { var removeList = new List<int>(); foreach (DictionaryEntry de in tempNonTimeCodes) { if (Convert.ToInt32(de.Key) < Convert.ToInt32(p.Text)) { sb.AppendLine(de.Value.ToString()); removeList.Add(Convert.ToInt32(de.Key)); } } foreach (int key in removeList) tempNonTimeCodes.Remove(key); sb.AppendLine(string.Format(paragraphWriteFormat, p.StartTime, p.Text)); } foreach (DictionaryEntry de in tempNonTimeCodes) sb.AppendLine(de.Value.ToString()); return sb.ToString().Trim(); }
//Main_7_9_5 public static void Main_7_9_5() { Hashtable ht = new Hashtable(); //��Ӽ���Ԫ�� ht.Add("Name", "С��"); ht.Add("Age", 27); ht.Add("Degree", "˶ʿ"); //�Լ�ֵ���Ҽ��� Console.WriteLine("{0}��������{1}", ht["Name"], ht["Age"]); //���ϱ��� foreach (DictionaryEntry de in ht) { Console.WriteLine("{0}--{1}", de.Key.ToString(), de.Value.ToString()); } //ɾ������Ԫ�� ht.Remove("Age"); //�������� ArrayList als = new ArrayList(ht.Keys); als.Sort(); foreach (string key in als) { Console.WriteLine("{0}--{1}", key, ht[key].ToString()); } //������� ht.Clear(); }
private void GatherNamespaceToRender(string nsPrefix, SortedList nsListToRender, Hashtable nsLocallyDeclared) { int num; foreach (object obj2 in nsListToRender.GetKeyList()) { if (Utils.HasNamespacePrefix((XmlAttribute) obj2, nsPrefix)) { return; } } XmlAttribute a = (XmlAttribute) nsLocallyDeclared[nsPrefix]; XmlAttribute nearestRenderedNamespaceWithMatchingPrefix = base.GetNearestRenderedNamespaceWithMatchingPrefix(nsPrefix, out num); if (a != null) { if (Utils.IsNonRedundantNamespaceDecl(a, nearestRenderedNamespaceWithMatchingPrefix)) { nsLocallyDeclared.Remove(nsPrefix); nsListToRender.Add(a, null); } } else { int num2; XmlAttribute nearestUnrenderedNamespaceWithMatchingPrefix = base.GetNearestUnrenderedNamespaceWithMatchingPrefix(nsPrefix, out num2); if (((nearestUnrenderedNamespaceWithMatchingPrefix != null) && (num2 > num)) && Utils.IsNonRedundantNamespaceDecl(nearestUnrenderedNamespaceWithMatchingPrefix, nearestRenderedNamespaceWithMatchingPrefix)) { nsListToRender.Add(nearestUnrenderedNamespaceWithMatchingPrefix, null); } } }
public static int LinerComplex(string str) { Hashtable T = new Hashtable () ; Hashtable B = new Hashtable () ; Hashtable C = new Hashtable () ; C .Add (0,1) ; B .Add (0,1) ; int m = -1 , N = 0 , L = 0 ; //上述步骤完成初始化 while (N < str.Length ) { //计算离差 int d = str [N ] == '0' ? 0 : 1 ; int i = 1 ; #region while (i <= L ) { if (C .ContainsKey (i )) { if (str [N-i ] == '1') d += 1 ; //则ci = 1 } i++ ; } d = d % 2; if ( d ==1 ) { T = (Hashtable )C.Clone() ; foreach (DictionaryEntry k in B ) { if ((int )k .Value == 1) { int temp = (int )k .Key + N - m ; if (C .ContainsKey (temp )) { C .Remove (temp ) ; } else { C .Add (temp ,1 ) ; } } } if (L <= (int )Math .Floor (N *0.5) ) { L = N +1 -L ; m = N ; B =(Hashtable ) T.Clone() ; } } #endregion // Console.Write("L = {0} ;", L); // foreach (DictionaryEntry j in C ) // { // Console.Write( j.Key +" ;"); // } // Console.WriteLine(); N ++ ; } return L ; }
public static object Deserialize(Hashtable data) { if (data == null) return null; Type type=Type.GetType(data[(byte)255] as string); data.Remove((byte)255); object obj; if(type.IsArray) { obj=Array.CreateInstance(type.GetElementType(),data.Count); for(int i=0;i<data.Count;i++) { object item=data[(byte)i]; if(NeedDeserialize(item)) { item=Deserialize(item as Hashtable); } (obj as Array).SetValue(item,i); } } else { obj=type.Assembly.CreateInstance(type.FullName); if(obj is ICollection) { if(obj is IList) { for (int i = 0; i < data.Count;i++ ) { object item=data[(byte)i]; if(NeedDeserialize(item)) { item=Deserialize(item as Hashtable); } (obj as IList).Add(item); } } } else { PropertyInfo[] propertyInfos=type.GetProperties(); for(int i=0; i<propertyInfos.Length;i++) { if(data.ContainsKey((byte)i)) { object item=data[(byte)i]; if(NeedDeserialize(item)) { item=Deserialize(item as Hashtable); } propertyInfos[i].SetValue(obj,item,null); } } } } return obj; }
/// <summary> /// Parse arguments. /// </summary> /// <param name="args">Argument array from Main() method.</param> /// <returns>Hashtable of parsed arguments.</returns> private static Hashtable ArgumentParse(string[] args) { Hashtable Return = new Hashtable(); string Key; bool ReadPort = false; bool ResetMessage = false; foreach (String arg in args) { if (arg.StartsWith("-") || arg.StartsWith("/")) { Key = arg.Substring(1, arg.Length - 1).ToLower(); if (Key.Equals("on")) { if (!Return.ContainsKey(PARAMETER_BACKLIGHT)) Return.Add(PARAMETER_BACKLIGHT, true); } else if (Key.Equals("off")) { if (!Return.ContainsKey(PARAMETER_BACKLIGHT)) Return.Add(PARAMETER_BACKLIGHT, false); } else if (Key.StartsWith("p")) { if (!Return.ContainsKey(PARAMETER_PORT)) ReadPort = true; } ResetMessage = true; } else if (ReadPort) { Return.Add(PARAMETER_PORT, arg); ReadPort = false; } else { if (ResetMessage) { if (Return.ContainsKey(PARAMETER_TEXT)) Return.Remove(PARAMETER_TEXT); ResetMessage = false; } if (!Return.ContainsKey(PARAMETER_TEXT)) { Return.Add(PARAMETER_TEXT, new StringBuilder(arg)); } else { ((StringBuilder)Return[PARAMETER_TEXT]).Append(" ").Append(arg); } } } return Return; }
public void RemoveXObject(XObject obj) { if (!xObjects.ContainsKey(obj.ID)) { throw new XObjectException("Not registered"); } xObjects.Remove(obj.ID); }
/// <summary> /// Delete the specified attribute from the table. /// </summary> /// <param name="attributeName"></param> public virtual void DeleteAttribute(string attributeName) { if (!Exists(attributeName)) { throw new ArgumentException("Attribute " + attributeName + " not exists!"); } _attributes.Remove(attributeName); }
/// <summary> /// Converts well known properties sent by AS3/Flash clients - from string to byte-keys. /// </summary> /// <remarks> /// Check if peer is a flash (amf3) client because flash clients does not support byte keys in a hastable. /// If a flash client likes to match a game with a specific 'MaxPlayer' value 'MaxPlayer' will be sent /// with the string key "255" and the max player value as int. /// </remarks> /// <param name="gameProps">A game properties hashtable.</param> /// <param name="actorProps">A actor properties hashtable.</param> public static void ConvertAs3WellKnownPropertyKeys(Hashtable gameProps, Hashtable actorProps) { // convert game properties if (gameProps != null && gameProps.Count > 0) { // well known property "is visible" if (gameProps.ContainsKey(amf3IsVisblePropertyKey)) { gameProps[(byte)GameParameter.IsVisible] = gameProps[amf3IsVisblePropertyKey]; gameProps.Remove(amf3IsVisblePropertyKey); } // well known property "is open" if (gameProps.ContainsKey(amf3IsOpenPropertyKey)) { gameProps[(byte)GameParameter.IsOpen] = gameProps[amf3IsOpenPropertyKey]; gameProps.Remove(amf3IsOpenPropertyKey); } // well known property "max players" if (gameProps.ContainsKey(amf3MaxPlayerPropertyKey)) { gameProps[(byte)GameParameter.MaxPlayer] = gameProps[amf3MaxPlayerPropertyKey]; gameProps.Remove(amf3MaxPlayerPropertyKey); } // well known property "props listed in lobby" if (gameProps.ContainsKey(amf3PropertiesPropertyKey)) { gameProps[(byte)GameParameter.Properties] = gameProps[amf3PropertiesPropertyKey]; gameProps.Remove(amf3PropertiesPropertyKey); } } // convert actor properties (if any) if (actorProps != null && actorProps.Count > 0) { // well known property "is visible" if (actorProps.ContainsKey(amf3PlayerNamePropertyKey)) { actorProps[(byte)ActorParameter.PlayerName] = actorProps[amf3PlayerNamePropertyKey]; actorProps.Remove(amf3PlayerNamePropertyKey); } } }
internal override void ProcessMainAttributes (Hashtable atts) { autoEventWireup = GetBool (atts, "AutoEventWireup", PagesConfig.AutoEventWireup); enableViewState = GetBool (atts, "EnableViewState", PagesConfig.EnableViewState); atts.Remove ("TargetSchema"); // Ignored base.ProcessMainAttributes (atts); }
// 'UPGRADE_NOTE: NewEnum property was commented out. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="B3FC1610-34F3-43F5-86B7-16C984F0E88E"' //'Public ReadOnly Property NewEnum() As stdole.IUnknown // 'Get // 'Questa proprietà consente di enumerare l'insieme // 'corrente con la sintassi For...Each. // 'NewEnum = mCol._NewEnum // 'End Get //'End Property //Public Function GetEnumerator() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator // 'UPGRADE_TODO: Uncomment and change the following line to return the collection enumerator. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="95F9AAD0-1319-4921-95F0-B9D3C4FF7F1C"' // 'GetEnumerator = mCol.GetEnumerator //End Function void Remove(int vntIndexKey) { //'Utilizzata per rimuovere un elemento dall'insieme. //'vntIndexKey contiene l'indice o la chiave, e per questo //'motivo viene dichiarata come Variant. //'Sintassi: x.Remove(xyz) mRow.Remove(vntIndexKey); }
public void ResetProperty(string propertyName) { if ((Properties != null) && Properties.Contains(propertyName)) { OnPropertyChanging(propertyName); Properties.Remove(propertyName); OnPropertyChanged(propertyName); } }
public DeviceInformations(Hashtable settings) { // Remember Settings = settings; // Attach to the current application FileInfo exe = new FileInfo(Application.ExecutablePath); // Get the root string root = exe.DirectoryName; // Check for override if (Settings.ContainsKey(PathKey)) { // Merge root = Path.Combine(root, (string)Settings[PathKey]); // Remove Settings.Remove(PathKey); } // Attach to the provider configuration file FileInfo path = new FileInfo(Path.Combine(root, "DVBNetProviders.xml")); // Process if (path.Exists) { // Load the DOM from file m_File.Load(path.FullName); } else { // Me Type me = GetType(); // Load the DOM from resource using (Stream providers = me.Assembly.GetManifestResourceStream(me.Namespace + ".DVBNETProviders.xml")) { // Load m_File.Load(providers); } } // Verify if (!m_File.DocumentElement.Name.Equals("DVBNETProviders")) throw new ArgumentException("bad provider definition", "file"); if (!Equals(m_File.DocumentElement.GetAttribute("SchemaVersion"), "2.6")) throw new ArgumentException("invalid schema version", "file"); // All providers foreach (XmlElement provider in m_File.DocumentElement.SelectNodes("DVBNETProvider")) { // Create new DeviceInformation info = new DeviceInformation(provider); // Register m_Devices[info.UniqueIdentifier] = info; } }
private void _RecurAdd(string[] messageName, string message, int index, ref Hashtable ht) { if (index == messageName.Length-1) { ht.Remove(messageName[index]); ht.Add(messageName[index], message); } else { Hashtable tmp = new Hashtable(); if (ht.ContainsKey(messageName[index])) { tmp = (Hashtable)ht[messageName[index]]; ht.Remove(messageName[index]); } _RecurAdd(messageName, message, index + 1, ref tmp); ht.Add(messageName[index], tmp); } }
public int solution(int[] A) { // write your code in C# 5.0 with .NET 4.5 (Mono) int depth = A.Length; Hashtable ht = new Hashtable(); for (int i = 0; i < A.Length; i++ ) { Node n; if (ht.ContainsKey(A[i])) n = (Node)ht[A[i]]; else { n = new Node(A[i], new List<int>()); ht.Add(A[i], n); } if(i>0) n.childs.Add(A[i-1]); if (i < A.Length-1) n.childs.Add(A[i + 1]); } int lookUp = A[A.Length - 1]; Queue<int> Q = new Queue<int>(); int val = 0; Q.Enqueue(A[val]); ((Node)ht[A[val]]).depth = 1; while (Q.Any()) { val = Q.Dequeue(); if (ht.ContainsKey(val)) { Node n = (Node) ht[val]; if (n.value == lookUp) return n.depth; ht.Remove(val); foreach (int j in n.childs) { if (ht.ContainsKey(j)) { Node x = (Node) ht[j]; if (x.depth == 0) x.depth = n.depth + 1; Q.Enqueue(j); //ht.Remove(j); } } } } return depth; }
public Hashtable ProcessDiagnostics() { Hashtable ret = new Hashtable(); foreach (Type t in Utility.LocateTypeInstances(typeof(IDiagnosable))) { Object obj = null; foreach (MethodInfo mi in t.GetMethods(BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance)) { if (mi.GetCustomAttributes(typeof(DiagnosticFunctionAttribute),false).Length > 0) { DiagnosticFunctionAttribute att = ((DiagnosticFunctionAttribute)mi.GetCustomAttributes(typeof(DiagnosticFunctionAttribute), false)[0]); bool run = true; if (att.RequiredRights != null) { foreach (string str in att.RequiredRights) { if (!User.Current.HasRight(str)) { run = false; break; } } } if (run) { Delegate del = null; if (mi.IsStatic) { del = Delegate.CreateDelegate(typeof(DiagnosticFunctionAttribute.DiagnosticsDelegate), mi); } else { if (obj == null) obj = t.GetConstructor(Type.EmptyTypes).Invoke(null); del = DiagnosticFunctionAttribute.DiagnosticsDelegate.CreateDelegate(t, obj, mi.Name); } List<string> tmp = ((DiagnosticFunctionAttribute.DiagnosticsDelegate)del).Invoke(); if (tmp != null) { string name = att.GroupName; if (ret.ContainsKey(name)) { tmp.AddRange((List<string>)ret[name]); ret.Remove(name); ret.Add(name, tmp); } else ret.Add(name, tmp); } } } } } return ret; }
public Hashtable removeStopWords(Hashtable hashTable) { // Hashtable newTable = new Hashtable(); Hashtable stopWords = getStopWordList(); foreach (DictionaryEntry entry in stopWords) { if (hashTable.ContainsKey(entry.Key)) hashTable.Remove(entry.Key); } return hashTable; }
public void RemoveKey() { System.Collections.Hashtable ht = (System.Collections.Hashtable)HttpContext.Current.Application[appKey]; if (ht != null) { ht.Remove(HttpContext.Current.Session.SessionID); HttpContext.Current.Application.Lock(); HttpContext.Current.Application[appKey] = ht; HttpContext.Current.Application.UnLock(); } }
protected override Hashtable DoExtraProcess(Hashtable h) { string key; decimal value; if (h.ContainsKey("01_FaDian")) { key = "01_YongDianLv"; decimal su = Convert.ToDecimal(h["01_FaDian"]); value = Decimal.Round(GpRawDataProcessor.CalculateSCLv(su) * 100, 3); h.Add(key, value); } if (h.ContainsKey("02_FaDian")) { key = "02_YongDianLv"; decimal su = Convert.ToDecimal(h["02_FaDian"]); value =Decimal.Round(GpRawDataProcessor.CalculateSCLv(su) * 100, 3); h.Add(key,value); } if (h.ContainsKey("03_FaDian") && h.ContainsKey("03_YongDian")) { key = "03_YongDianLv"; decimal su = Convert.ToDecimal(h["03_FaDian"]); decimal sc = Convert.ToDecimal(h["03_YongDian"]); value =Decimal.Round(GpRawDataProcessor.CalculateSCLv(su, sc) * 100, 3); h.Remove("03_YongDian"); h.Add(key, value); } if (h.ContainsKey("04_FaDian") && h.ContainsKey("04_YongDian")) { key = "04_YongDianLv"; decimal su = Convert.ToDecimal(h["04_FaDian"]); decimal sc = Convert.ToDecimal(h["04_YongDian"]); value = Decimal.Round(GpRawDataProcessor.CalculateSCLv(su, sc) * 100, 3); h.Remove("04_YongDian"); h.Add(key, value); } return h; }
public void InitializeFromOtherCopiesValues() { Hashtable ht = new Hashtable(); ht["key"] = "value"; ht["key2"] = "value2"; SynchronizedHashtable st = new SynchronizedHashtable(ht, false); Assert.AreEqual(2, st.Count); ht.Remove("key"); Assert.AreEqual(1, ht.Count); Assert.AreEqual(2, st.Count); }
public void TestContainsBasic() { StringBuilder sblMsg = new StringBuilder(99); Hashtable ht1 = null; string s1 = null; string s2 = null; int i = 0; ht1 = new Hashtable(); //default constructor Assert.False(ht1.Contains("No_Such_Key")); /// [] Testcase: add few key-val pairs ht1 = new Hashtable(); for (i = 0; i < 100; i++) { sblMsg = new StringBuilder(99); sblMsg.Append("key_"); sblMsg.Append(i); s1 = sblMsg.ToString(); sblMsg = new StringBuilder(99); sblMsg.Append("val_"); sblMsg.Append(i); s2 = sblMsg.ToString(); ht1.Add(s1, s2); } for (i = 0; i < ht1.Count; i++) { sblMsg = new StringBuilder(99); sblMsg.Append("key_"); sblMsg.Append(i); s1 = sblMsg.ToString(); Assert.True(ht1.Contains(s1)); } // // Remove a key and then check // sblMsg = new StringBuilder(99); sblMsg.Append("key_50"); s1 = sblMsg.ToString(); ht1.Remove(s1); //removes "Key_50" Assert.False(ht1.Contains(s1)); }
static ImportCommand() { // determine possible types and formats dialogData = new Hashtable (); ICollection modes = ProviderFactory.GetProviderModes (); foreach (ProviderMode mode in modes) { ICollection types = ProviderFactory.GetRegisteredTypes (mode); dialogData[mode] = types; } // remove default (goes through normal Open menu item) dialogData.Remove (ProviderFactory.DefaultMode); }
/// <summary> Removes the message from <code>msgs</code>, removing them also from retransmission. If /// sliding window protocol is used, and was queueing, check whether we can resume adding elements. /// Add all elements. If this goes above window_size, stop adding and back to queueing. Else /// set queueing to false. /// </summary> public virtual void ack(long seqno) { AckSenderWindowEntry entry; lock (msgs.SyncRoot) { msgs.Remove(seqno); retransmitter.remove(seqno); if (use_sliding_window && queueing) { if (msgs.Count < min_threshold) { // we fell below threshold, now we can resume adding msgs if (NCacheLog.IsInfoEnabled) { NCacheLog.Info("number of messages in table fell under min_threshold (" + min_threshold + "): adding " + msg_queue.Count + " messages on queue"); } while (msgs.Count < window_size) { if ((entry = removeFromQueue()) != null) { addMessage(entry.seqno, entry.msg); } else { break; } } if (msgs.Count + 1 > window_size) { if (NCacheLog.IsInfoEnabled) { NCacheLog.Info("exceeded window_size (" + window_size + ") again, will still queue"); } return; // still queueing } else { queueing = false; // allows add() to add messages again } if (NCacheLog.IsInfoEnabled) { NCacheLog.Info("set queueing to false (table size=" + msgs.Count + ')'); } } } } }
/// <summary> /// Sort the passed list of Joints so that parent joints allways come first /// </summary> /// <param name="joints"><see cref="Joints"/></param> /// <param name="relmap"><see cref="LoadJointRelationMap"/></param> /// <returns></returns> public static IntArrayList SortJoints(GmdcJoints joints, System.Collections.Hashtable relmap) { int start = -1; foreach (int k in relmap.Keys) { if ((int)relmap[k] == -1) { start = k; break; } } if (start != -1) { IntArrayList l = new IntArrayList(); SortJointsRec(start, relmap, l); //check if there are some Joint's that were not added so far System.Collections.Hashtable nrelmap = (System.Collections.Hashtable)relmap.Clone(); foreach (int v in l) { if (nrelmap.ContainsKey(v)) { nrelmap.Remove(v); } } //recursivley process remaing joints if (nrelmap.Count > 0) { IntArrayList l2 = SortJoints(joints, nrelmap); foreach (int i in l2) { l.Add(i); } } return(l); } IntArrayList ls = new IntArrayList(); foreach (GmdcJoint j in joints) { ls.Add(j.Index); } return(ls); }
public override void Flush() { lock (Cache.SyncRoot) { IEnumerator e = this.keys.GetEnumerator(); bool found = true; while (found) { found = false; e = this.keys.GetEnumerator(); while (e.MoveNext()) { //if (e.Key.ToString().StartsWith(this.NameSpace, true, System.Globalization.CultureInfo.InvariantCulture)) //{ Cache.Remove(e.Current.ToString()); found = true; break; //} } } } }
/// <summary> /// client should call this before exiting, otherwise other clients will /// try to find them on the port which they are not using anymore. /// </summary> /// <param name="applicationName"></param> /// <param name="port"></param> public void Unregister(string applicationName, int port) { Debug.Assert(PortsForApp(applicationName) != null); PortsForApp(applicationName).Remove(port); //this is important to do, so that we know when we no longer have any //running registered applications, and we can exit this process altogether. if (PortsForApp(applicationName).Count == 0) { m_registeredApplications.Remove(applicationName); } Console.WriteLine("Revoking " + applicationName + " : " + port.ToString()); }
static void playWithHashTable() { Hashtable ht2 = new Hashtable(){ {"key1", "value1"}, {"key2", "value2"} }; Hashtable ht = new Hashtable(); ht.Add("obj1", new Car("diesel",150,120)); ht["toto"]= "toto"; ht.Remove("toto"); foreach (Object obj in ht.Keys) Console.WriteLine(ht[obj]); }
static public int Remove(IntPtr l) { try { System.Collections.Hashtable self = (System.Collections.Hashtable)checkSelf(l); System.Object a1; checkType(l, 2, out a1); self.Remove(a1); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
internal void UnloadHandler(Object sender, EventArgs e) { IDictionaryEnumerator enumerator = m_tokenTable.GetEnumerator(); while (enumerator.MoveNext()) { Type key = (Type)enumerator.Key; if (AppDomain.CurrentDomain.IsTypeUnloading(key)) { m_tokenTable.Remove(key); } } }
public void TestCloneBasic() { Hashtable hsh1; Hashtable hsh2; string strKey; string strValue; //[] empty Hashtable clone hsh1 = new Hashtable(); hsh2 = (Hashtable)hsh1.Clone(); Assert.Equal(0, hsh2.Count); Assert.False(hsh2.IsReadOnly, "Error, Expected value not returned, <<" + hsh1.IsReadOnly + ">> <<" + hsh2.IsReadOnly + ">>"); Assert.False(hsh2.IsSynchronized, "Error, Expected value not returned, <<" + hsh1.IsSynchronized + ">> <<" + hsh2.IsSynchronized + ">>"); //[] Clone should exactly replicate a collection to another object reference //afterwards these 2 should not hold the same object references hsh1 = new Hashtable(); for (int i = 0; i < 10; i++) { strKey = "Key_" + i; strValue = "string_" + i; hsh1.Add(strKey, strValue); } hsh2 = (Hashtable)hsh1.Clone(); for (int i = 0; i < 10; i++) { strValue = "string_" + i; Assert.True(strValue.Equals((string)hsh2["Key_" + i]), "Error, Expected value not returned, " + strValue); } //now we remove an object from the original list hsh1.Remove("Key_9"); Assert.Equal(hsh1["Key_9"], null); strValue = "string_" + 9; Assert.True(strValue.Equals((string)hsh2["Key_9"]), "Error, Expected value not returned, <<" + hsh1[9] + ">>"); //[]now we try other test cases //are all the 'other' properties of the Hashtable the same? hsh1 = new Hashtable(1000); hsh2 = (Hashtable)hsh1.Clone(); Assert.Equal(hsh1.Count, hsh2.Count); Assert.Equal(hsh1.IsReadOnly, hsh2.IsReadOnly); Assert.Equal(hsh1.IsSynchronized, hsh2.IsSynchronized); }
static int Remove(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); System.Collections.Hashtable obj = (System.Collections.Hashtable)ToLua.CheckObject(L, 1, typeof(System.Collections.Hashtable)); object arg0 = ToLua.ToVarObject(L, 2); obj.Remove(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public void TS_UnselectNode(String NodeName) { if (NodeName == null) { return; } if (!m_FunctionNodeModels.ContainsKey(NodeName)) { return; } Model.TrickerStarFunctionNodeModel node_m = (Model.TrickerStarFunctionNodeModel)m_FunctionNodeModels[NodeName]; TrickerStarFunctionNode node_v = (TrickerStarFunctionNode)m_FunctionNodeViews[NodeName]; Canvas.SetZIndex(node_v, 4); m_SelectedFunctionNodeModels.Remove(node_m.NodeName); node_v.Select(false); }
protected override void ProcessResponse(Diacom.AltiGen.AltiLinkPlus.ALPResponse altiResponse) { switch ((ALPCmdID)(altiResponse.CommandId)) { case ALPCmdID.GET_EXTRACALLINFO: CallInfo rInfo = (CallInfo)RingInfo[altiResponse.SequenceId]; RingInfo.Remove(altiResponse.SequenceId); Diacom.ExtensionManager.CallInfoEventArgs RingData = new Diacom.ExtensionManager.CallInfoEventArgs( rInfo.callerName, rInfo.callerID, rInfo.callerPAD, rInfo.callerIPAddress, rInfo.calleeName, rInfo.calleeID, rInfo.calleePAD, rInfo.ANIName, rInfo.ANIID, rInfo.DNISName, rInfo.DNISID, rInfo.StartTime, rInfo.HoldTime, rInfo.CurrentTime, rInfo.WorkGroupNumber, rInfo.OutBoundWorkGroupNumber, rInfo.SessionHandle, rInfo.CallHandle); if (altiResponse.ResponseCode == 0) { int SessionID = altiResponse[0].ReadInt32(); Diacom.ExtensionManager.ExtraCallInfo xci = new Diacom.ExtensionManager.ExtraCallInfo(altiResponse[1].ReadString(), altiResponse[2].ReadString(), altiResponse[3].ReadString(), altiResponse[4].ReadString(), altiResponse[5].ReadString(), altiResponse[6].ReadString()); RingData.ExtraInfo = xci; } Diacom.ExtensionManager.CallEventHandler ehr = this.Ring; if (ehr != null) { SPLine _line = GetLine(rInfo.lineID); _line.CalledNumber = rInfo.callerID; _line.CalledName = rInfo.callerName; _line.DNISNumber = rInfo.DNISID; _line.DNISName = rInfo.DNISName; _line.CIDNumber = rInfo.ANIID; _line.CIDName = rInfo.ANIName; _line.DIDNumber = rInfo.calleeID; _line.DIDName = rInfo.calleeName; ehr(_line, RingData); } break; } base.ProcessResponse(altiResponse); }
void plugin__fireFinished(string sPluginTaskKeyID) { // // Clean up plugin Resources // if (htPlugins.ContainsKey(sPluginTaskKeyID)) { DDoSPluginPlugin plugin = (DDoSPluginPlugin)htPlugins[sPluginTaskKeyID]; // Remove before shutdown incase we are on the thread about to be aborted. htPlugins.Remove(sPluginTaskKeyID); plugin._fireFinished -= plugin__fireFinished; plugin.Shutdown(); } else { Console.WriteLine("Could not find ddos plugin in htPlugins to shutdown"); } }
private void HideMenu(BaseUI bm) { if (mode == Mode.Prefabs) { BaseUI previousBM = createdMenus [bm.state] as BaseUI; if (previousBM != null) { previousBM.MenuWillDisappear(); previousBM.gameObject.SetActive(false); previousBM.MenuDidDisappear(); createdMenus.Remove(bm.state); Destroy(previousBM.gameObject); } } else if (mode == Mode.Objects) { bm.MenuWillDisappear(); bm.gameObject.SetActive(false); bm.MenuDidDisappear(); } }
/// <summary> /// Add segment to HL7 message /// </summary> /// <param name="segment"></param> public void AddSegment(Hl7Segment segment) { ICollection segments = _segments.Values; int nextSequenceNumber = segments.Count; // check if the segment is already present if (_segments.Contains(segment.SegmentId.Id) == true) { // remove the segment Hl7Segment tempSegment = (Hl7Segment)_segments[segment.SegmentId.Id]; _segments.Remove(segment.SegmentId.Id); // use the current sequence number segment.SequenceNumber = tempSegment.SequenceNumber; } else { // check to see if a segment already exists of the same type int existingSequenceNumber = 0; int nextSegmentIndex = 0; if (GetNextSegmentIndex(segment.SegmentId.SegmentName, out existingSequenceNumber, out nextSegmentIndex) == true) { // segment exists - this new one must get the existing sequence number and next segment index segment.SequenceNumber = existingSequenceNumber; segment.SegmentId.SegmentIndex = nextSegmentIndex; } else { // segment does not exist - simply give it the next sequence number and start the segment index at 1. segment.SequenceNumber = nextSequenceNumber; segment.SegmentId.SegmentIndex = 1; } } // add the new segment _segments.Add(segment.SegmentId.Id, segment); }
// 정리된 데이터 분석 및 통계 처리 void DataParse() { lock ( thread ) { System.Threading.Thread.Sleep(100); string [] dirs = new string[Form2.parselist.Count]; int i = 0; foreach (System.Collections.DictionaryEntry d in Form2.parselist) { dirs[i] = "crash\\" + d.Key; i++; } //string [] dirs = System.IO.Directory.GetDirectories("crash\\","*"); foreach (string dir in dirs) { string [] str = dir.Split('\\'); string version = str[str.Length - 1]; string [] dirs2 = System.IO.Directory.GetDirectories(dir, "*"); progressBar1.Maximum = dirs2.Length; progressBar1.Minimum = 0; progressBar1.Value = 0; foreach (string dir2 in dirs2) { label3.Text = dir2 + "\\dmp.html"; // 1. 덤프 로그 분석 ParsDmpLog(dir2 + "\\dmp.html"); progressBar1.Value++; } System.IO.StreamWriter writer = new System.IO.StreamWriter("report\\" + version + "_dmp.html"); writer.WriteLine("<body link=darkgreen vlink=lightgreen><font size=2><p> <b> Total {0} Dump files</b>", dirs2.Length); while (dmp.Count != 0) { int max = 0; string key = ""; foreach (System.Collections.DictionaryEntry d in dmp) { if (((ArrayList)d.Value).Count > max) { key = (string)d.Key; max = (int)((ArrayList)d.Value).Count; } } int unique_file_name = key.GetHashCode(); float freq = max / (float)dirs2.Length * 100.0f; writer.WriteLine("</p><p> <font size=4 color=blue><b>{0:0.##}%</b></font>({1}/{2})", freq, max, dirs2.Length); writer.WriteLine(" <b> - {0} </b><br>", key); ////////////////////////////////////////////////////////////////////////// // 2. 덤프 파일 분석 ParseByDmp((ArrayList)dmp[key]); // writer.WriteLine("<a href='"+version+freq+"uid.html'>[uid]</a>"); System.IO.StreamWriter writer2; // = new System.IO.StreamWriter("report\\"+version+freq+"uid.html"); // writer2.WriteLine("<body link=darkgreen vlink=lightgreen><font size=2><p> <b>{0}<br><br> Total {1} Dmps</b>",key,max); // WriteData(writer2,uid,max); // writer2.Close(); writer.WriteLine("<a href='" + version + unique_file_name + freq + "cpu.html'>[cpu]</a>"); writer2 = new System.IO.StreamWriter("report\\" + version + unique_file_name + freq + "cpu.html"); writer2.WriteLine("<body link=darkgreen vlink=lightgreen><font size=2><p> <b>{0}<br><br> Total {1} Dmps</b>", key, max); WriteData(writer2, cpu, max); writer2.Close(); writer.WriteLine("<a href='" + version + unique_file_name + freq + "ram.html'>[ram]</a>"); writer2 = new System.IO.StreamWriter("report\\" + version + unique_file_name + freq + "ram.html"); writer2.WriteLine("<body link=darkgreen vlink=lightgreen><font size=2><p> <b>{0}<br><br> Total {1} Dmps</b>", key, max); WriteData(writer2, ram, max); writer2.Close(); writer.WriteLine("<a href='" + version + unique_file_name + freq + "vga.html'>[vga]</a>"); writer2 = new System.IO.StreamWriter("report\\" + version + unique_file_name + freq + "vga.html"); writer2.WriteLine("<body link=darkgreen vlink=lightgreen><font size=2><p> <b>{0}<br><br> Total {1} Dmps</b>", key, max); WriteData(writer2, vga, max); writer2.Close(); //{{ dmlee 2008.05.26 OS 통계 writer.WriteLine("<a href='" + version + unique_file_name + freq + "OS.html'>[OS]</a>"); writer2 = new System.IO.StreamWriter("report\\" + version + unique_file_name + freq + "OS.html"); writer2.WriteLine("<body link=darkgreen vlink=lightgreen><font size=2><p> <b>{0}<br><br> Total {1} Dmps</b>", key, max); WriteData(writer2, htOS, max); writer2.Close(); //}} dmlee 2008.05.26 OS 통계 //{{ dmlee 2008.06.05 writer.WriteLine("<a href='" + version + unique_file_name + freq + "ScreenShot.html'>[ScreenShot]</a>"); writer2 = new System.IO.StreamWriter("report\\" + version + unique_file_name + freq + "ScreenShot.html"); //writer2.WriteLine( "<body link=darkgreen vlink=lightgreen><font size=2><p> <b>{0}<br><br> Total {1} Dmps</b>", key, max ); WriteData(writer2, screenShot, max); screenShot.Clear(); writer2.Close(); //}} dmlee 2008.06.05 // TO DO : 로그 링크 추가는 여기서 부터.. // writer.WriteLine("<a href='"+version+freq+"Story.html'>[Story]</a>"); // writer2 = new System.IO.StreamWriter("report\\"+version+freq+"Story.html"); // writer2.WriteLine("<body link=darkgreen vlink=lightgreen><font size=2><p> <b>{0}<br><br> Total {1} Dmps</b>",key,max); // WriteData(writer2,Story,max); // writer2.Close(); // // writer.WriteLine("<a href='"+version+freq+"GameState.html'>[GameState]</a>"); // writer2 = new System.IO.StreamWriter("report\\"+version+freq+"GameState.html"); // writer2.WriteLine("<body link=darkgreen vlink=lightgreen><font size=2><p> <b>{0}<br><br> Total {1} Dmps</b>",key,max); // WriteData(writer2,GameState,max); // writer2.Close(); // // writer.WriteLine("<a href='"+version+freq+"GameModeCategory.html'>[GameModeCategory]</a>"); // writer2 = new System.IO.StreamWriter("report\\"+version+freq+"GameModeCategory.html"); // writer2.WriteLine("<body link=darkgreen vlink=lightgreen><font size=2><p> <b>{0}<br><br> Total {1} Dmps</b>",key,max); // WriteData(writer2,GameModeCategory,max); // writer2.Close(); // // // writer.WriteLine("<a href='"+version+freq+"GameMode.html'>[GameMode]</a>"); // writer2 = new System.IO.StreamWriter("report\\"+version+freq+"GameMode.html"); // writer2.WriteLine("<body link=darkgreen vlink=lightgreen><font size=2><p> <b>{0}<br><br> Total {1} Dmps</b>",key,max); // WriteData(writer2,GameMode,max); // writer2.Close(); // // writer.WriteLine("<a href='"+version+freq+"SubGameMode.html'>[SubGameMode]</a>"); // writer2 = new System.IO.StreamWriter("report\\"+version+freq+"SubGameMode.html"); // writer2.WriteLine("<body link=darkgreen vlink=lightgreen><font size=2><p> <b>{0}<br><br> Total {1} Dmps</b>",key,max); // WriteData(writer2,SubGameMode,max); // writer2.Close(); ////////////////////////////////////////////////////////////////////////// writer.WriteLine("<br><br><font size=1>", key); foreach (string filename in (ArrayList)dmp[key]) { writer.WriteLine("[<a href='..\\" + filename + "'>" + filename.Split('\\')[2] + "</a>]"); } writer.WriteLine("</font>"); dmp.Remove(key); } writer.Close(); } thread = null; } this.Close(); }
private void m_UpdateTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { try { System.DateTime updateStart = System.DateTime.Now; for (int i = 0; i < m_WorldWindow.CurrentWorld.RenderableObjects.Count; i++) { WorldWind.Renderable.RenderableObject curRo = (WorldWind.Renderable.RenderableObject)m_WorldWindow.CurrentWorld.RenderableObjects.ChildObjects[i]; if (i >= this.treeView1.Nodes.Count) { // Add a node TreeNode correctNode = new TreeNode(curRo.Name); RenderableObjectInfo curRoi = new RenderableObjectInfo(); curRoi.Renderable = curRo; correctNode.Tag = curRoi; m_NodeHash.Add(correctNode.Text, correctNode); this.treeView1.BeginInvoke(new AddTableTreeDelegate(this.AddTableTree), new object[] { correctNode }); updateNode(correctNode); } else { //compare nodes TreeNode curTn = this.treeView1.Nodes[i]; RenderableObjectInfo curRoi = (RenderableObjectInfo)curTn.Tag; if (curRoi.Renderable != null && curRoi.Renderable.Name == curRo.Name) { updateNode(curTn); continue; } else { if (!m_NodeHash.Contains(curRo.Name)) { //add it curRoi = new RenderableObjectInfo(); curRoi.Renderable = curRo; curTn = new TreeNode(curRo.Name); curTn.Tag = curRoi; m_NodeHash.Add(curTn.Text, curTn); this.treeView1.BeginInvoke(new InsertTableTreeDelegate(this.InsertTableTree), new object[] { i, curTn }); } else { curTn = (TreeNode)m_NodeHash[curRo.Name]; try { treeView1.BeginInvoke(new RemoveTableTreeDelegate(this.RemoveTableTree), new object[] { curTn }); } catch {} treeView1.BeginInvoke(new InsertTableTreeDelegate(this.InsertTableTree), new object[] { i, curTn }); } } updateNode(curTn); } } for (int i = m_WorldWindow.CurrentWorld.RenderableObjects.Count; i < this.treeView1.Nodes.Count; i++) { this.treeView1.BeginInvoke(new RemoveAtTableTreeDelegate(this.RemoveAtTableTree), new object[] { i }); } System.Collections.ArrayList deletionList = new ArrayList(); foreach (TreeNode tn in m_NodeHash.Values) { RenderableObjectInfo roi = (RenderableObjectInfo)tn.Tag; if (roi == null || roi.Renderable == null || roi.LastSpotted < updateStart) { deletionList.Add(GetAbsoluteRenderableObjectPath(roi.Renderable)); } } foreach (string key in deletionList) { m_NodeHash.Remove(key); } } catch {} }
} // StoreProperty // Remove any property of the given name. It is illegal to call // this method if the object has a property of that name with the // dontDelete attribute set. protected virtual void RemoveProperty(string propName) { props.Remove(propName); } // RemoveProperty