//public public void Connect(IBuilder builder) { string[] p = builder.GetParams(); if (p == null || p.Length != 2) { throw new ArgumentException("params must have a length of 2. Use Egg82LibEnhanced.Reflection.ExceptionHandlers.Builders.GameAnalyticsBuilder"); } api = ServiceLocator.GetService <IGameAnalyticsAPI>(); if (api == null || api.GetGameKey() != p[0]) { api = new GameAnalyticsAPI(); api.SendInit(p[0], p[1], 1); } foreach (Exception ex in exceptions) { api.SendError(ex.ToString()); } exceptions.Clear(); AddDomain(AppDomain.CurrentDomain); resendTimer = new Timer(60.0d * 60.0d * 1000.0d); resendTimer.Elapsed += onResendTimer; resendTimer.AutoReset = true; resendTimer.Start(); }
public void SetUnsentExceptions(List <System.Exception> list) { exceptions.Clear(); if (list == null) { return; } foreach (System.Exception ex in list) { exceptions.Add(ex); } }
private void onConnStateChange(object sender, StateChangeEventArgs e) { if (e.CurrentState == ConnectionState.Open) { _connected = true; backlogTimer.Start(); OnConnect?.Invoke(this, EventArgs.Empty); sendNext(); } else if (e.CurrentState == ConnectionState.Closed || e.CurrentState == ConnectionState.Broken) { backlogTimer.Stop(); string oldDbString = dbString; dbString = null; conn = null; command = null; backlog.Clear(); _connected = false; _busy = false; OnDisconnect?.Invoke(this, EventArgs.Empty); } }
public void Dispose() { lock (_lock) { if (_thread != null) { foreach (Thread q in QueueThread) { q.Join(); q.Abort(); } _thread.Clear(); _thread = null; } if (_queue != null) { _queue = null; } if (_error != null) { _error = null; } _actuator = null; } GC.Collect(); }
protected override void BeforeConnect() { _userCommentCountDict.Clear(); _receivedCommentIds.Clear(); _isDisconnectedExpected = false; base.BeforeConnect(); }
private void ClearLanes() { _laneRows.Clear(); _laneNodes.Clear(); _currentRow.Clear(); foreach (var node in GetLeafNodes()) { Update(node); } return; IEnumerable <Node> GetLeafNodes() { var nodes = new HashSet <Node>(); foreach (var junction in _junctions) { if (junction.Youngest.Descendants.Count == 0) { nodes.Add(junction.Youngest); } } return(nodes); } }
public void Clear() { _nodes.Clear(); _junctions.Clear(); _nodeByObjectId.Clear(); ClearLanes(); Count = 0; }
public static void DismissAllMessages() { foreach (ApiMessage message in messageList) { message.Close(); } currentMessageCount = 0; messageList.Clear(); }
public void Clear() { foreach (var child in Children) { child.Clear(); } Children.Clear(); this.Datum = default; }
public void ClearRecords() { if (IsRecording) { return; } records.Clear(); maxChannelCount = 0; OnRecordCountChanged?.Invoke(); }
public void Clear() { mRouteList.Clear(); mLeftSpeakerToLeftEar.Clear(); mLeftSpeakerToRightEar.Clear(); mRightSpeakerToLeftEar.Clear(); mRightSpeakerToRightEar.Clear(); for (int i = 0; i < mRouteCount.Length; ++i) { mRouteCount[i] = 0; } }
//public public void Disconnect() { if (!IsConnected) { return; } disconnectTimer.Stop(); backlog.Clear(); currentPacket.Clear(); try { socket.Disconnect(false); socket = new Socket(SocketType.Stream, ProtocolType.Tcp); } catch (Exception ex) { Error?.Invoke(this, new ExceptionEventArgs(ex)); return; } Disconnected?.Invoke(this, EventArgs.Empty); }
public async Task Load() { var loader = _injector.GetService <PluginLoader>(); loader.AddPlugin(_pending); _pending.Clear(); await loader.Load(); _ready.AddRange(loader.Success); _failed.AddRange(loader.Failed); }
public void Dispose() { _objList.ForEach(x => { try { x.Dispose(); } catch { } }); _objList.Clear(); }
public override void Clear() { if (PageSelecedStamps != null) { PageSelecedStamps.Clear(); PageSelecedStamps = null; } if (PageStamps != null) { PageStamps.Clear(); PageStamps = null; } IsAnnuled = false; }
public void Stop() { if (pollingThread != null) { pollingThread.Abort(); pollingThread.Join(); pollingThread = null; } workers.AsParallel().ForAll(worker => { worker.Stop(); }); workers.Clear(); }
public async Task TestRefreshCommand_ResetsCredentialsAsync() { _mockedGPlusDataSource = _gPlusDataSourceMock.Object; const string profileName = "NewProfileName"; var getProfileResult = new Person { Emails = new[] { new Person.EmailsData { Value = profileName } }, Image = new Person.ImageData() }; _gPlusDataSourceMock.Setup(ds => ds.GetProfileAsync()).Returns(Task.FromResult(getProfileResult)); _propertiesChanged.Clear(); _objectUnderTest.RefreshCommand.Execute(null); await _objectUnderTest.RefreshCommand.LatestExecution.SafeTask; CollectionAssert.Contains(_propertiesChanged, "ProfileNameAsync"); Assert.AreEqual(profileName, _objectUnderTest.ProfileNameAsync.Value); }
public void Clear() { lock (m_ItemCollection.SyncRoot) { m_CurrentItem = m_PrevItem = null; foreach (var item in new SynchronizedCollection <Item>(m_ItemCollection.SyncRoot, m_ItemCollection)) { foreach (var file in item.FileInfoList) { file.DeleteSafe(); } } m_ItemCollection.Clear(); m_ItemsWithErr = 0; FireItemsCleared(); } }
/// <summary> /// Removes all elements from the System.Collections.ArrayList. /// </summary> public void Clear() { m_list.Clear(); RefreshParent(m_parent); }
// This Unit test is based from full framework test public static void SynchronizedCollectionPublicMembersTest() { SynchronizedCollection<int> coll = new SynchronizedCollection<int>(); int size = 100; for (int i = 0; i < size; i++) coll.Add(i); Assert.True(coll.Count == size, string.Format("collection count was wrong! Expected: {0} got: {1}", size, coll.Count)); for (int i = 0; i < size; i++) { Assert.True(coll[i] == i, string.Format("coll element {0} was wrong! Expected: {1} got: {2} ", i, i, coll[i])); Assert.True(coll.IndexOf(i) == i, string.Format("coll IndexOf wasn't right! Expected: {0} got: {1}" , i, coll.IndexOf(i))); Assert.True(coll.Contains(i), string.Format("coll Contains failed to find the value {0}.", i)); } SynchronizedCollection<int> coll2 = new SynchronizedCollection<int>(new object(), new List<int>(coll)); for (int i = 0; i < size; i++) { Assert.True(coll2[i] == i, string.Format("coll2 element was wrong! expected: {0} got: {1} ", i, coll2[i])); } SynchronizedCollection<int> coll3 = new SynchronizedCollection<int>(new object(), 1, 2, 3, 4, 5 , 6); for (int i = 0; i < 5; i++) { Assert.True(coll3[i] == i + 1, string.Format("coll3 element {0} was wrong! expected: {1} got: {2}", i, i+1, coll3[i])); } int newValue = 80; coll3[5] = newValue; Assert.True(coll3[5] == newValue); IEnumerator <int> e = coll.GetEnumerator(); int n = 0; while (e.MoveNext()) { Assert.True(e.Current.Equals(n++), string.Format("Expected: {0}, got:{1}", n-1, e.Current)); } Assert.True(n == 100, string.Format("Expect number of elements: {0}, got:{1}", 100, n)); int[] array = new int[size + 1]; coll.CopyTo(array, 1); for (int i = 0; i < size; i++) { Assert.True(array[i + 1] == i, string.Format("After CopyTo, Element {0} was wrong! Expected: {1} got: {2}", i, i+1, array[i + 1])); } coll.Add(coll.Count); coll.Insert(0, -1); coll.RemoveAt(0); coll.Remove(coll.Count - 1); Assert.True(coll.Count == size, string.Format("Expect number of elements after modification: {0}, got: {1}", size, coll.Count)); for (int i = 0; i < size; i++) { Assert.True(coll[i] == i, string.Format("coll element was wrong after modification! Expected: {0} got: {1} ", i, coll[i])); } coll.Clear(); Assert.True(coll.Count == 0, string.Format("Clear operation failed!, expected: 0, actual {0}", coll.Count)); // Negative cases Assert.Throws<ArgumentNullException>("syncRoot", () => { new SynchronizedCollection<int>(null); }); Assert.Throws<ArgumentNullException>("list", () => { new SynchronizedCollection<int>(new object(), null); }); Assert.Throws<ArgumentNullException>("syncRoot", () => { new SynchronizedCollection<int>(null, new List<int>()); }); Assert.Throws<ArgumentNullException>("syncRoot", () => { new SynchronizedCollection<int>(null, 1, 2, 3, 4); }); Assert.Throws<ArgumentOutOfRangeException>(() => { coll[1000] = 5; }); Assert.Throws<ArgumentOutOfRangeException>(() => { coll[-1] = 5; }); Assert.Throws<ArgumentOutOfRangeException>(() => { coll.Insert(1000, 5); }); Assert.Throws<ArgumentOutOfRangeException>(() => { coll.Insert(-1, 5); }); Assert.False(coll.Remove(100000)); Assert.Throws<ArgumentOutOfRangeException>(() => { coll.RemoveAt(-1); }); Assert.Throws<ArgumentOutOfRangeException>(() => { coll.RemoveAt(10000); }); }
public void ClearAll() { m_CachedList.Clear(); }
public void Clear() { undoElements.Clear(); redoElements.Clear(); }
/// <summary> /// _commentCollectionの内容をファイルに書き出す /// </summary> public void Write() { if (!Options.IsEnabled || _commentCollection.Count == 0) { return; } //TODO:各ファイルが存在しなかった時のエラー表示 if (string.IsNullOrEmpty(CommentXmlPath) && IsHcgSettingFileExists()) { var hcgPath = GetHcgPath(Options.HcgSettingFilePath); CommentXmlPath = hcgPath + "\\comment.xml"; //TODO:パスがxmlファイルで無かった場合の対応。ディレクトリの可能性も。 } if (!File.Exists(CommentXmlPath)) { var doc = new XmlDocument(); var root = doc.CreateElement("log"); doc.AppendChild(root); doc.Save(CommentXmlPath); } XElement xml; try { xml = XElement.Load(CommentXmlPath); } catch (IOException ex) { //being used in another process Debug.WriteLine(ex.Message); return; } catch (XmlException) { //Root element is missing. xml = new XElement("log"); } lock (_commentCollection) { var arr = _commentCollection.ToArray(); _commentCollection.Clear(); foreach (var data in arr) { var item = new XElement("comment", data.Comment); item.SetAttributeValue("no", "0"); item.SetAttributeValue("time", ToUnixTime(GetCurrentDateTime())); item.SetAttributeValue("owner", 0); item.SetAttributeValue("service", data.SiteName); if (!string.IsNullOrEmpty(data.Nickname)) { item.SetAttributeValue("handle", data.Nickname); } xml.Add(item); } } try { WriteXml(xml, CommentXmlPath); } catch (IOException ex) { //コメントの流れが早すぎるとused in another processが来てしまう。 //この場合、コメントが書き込まれずに消されてしまう。 Debug.WriteLine(ex.Message); } }
public void UnSet() { docIDs.Clear(); tooltip.RemoveAll(); Enabled = false; }
// This Unit test is based from full framework test public static void SynchronizedCollectionPublicMembersTest() { SynchronizedCollection <int> coll = new SynchronizedCollection <int>(); int size = 100; for (int i = 0; i < size; i++) { coll.Add(i); } Assert.True(coll.Count == size, string.Format("collection count was wrong! Expected: {0} got: {1}", size, coll.Count)); for (int i = 0; i < size; i++) { Assert.True(coll[i] == i, string.Format("coll element {0} was wrong! Expected: {1} got: {2} ", i, i, coll[i])); Assert.True(coll.IndexOf(i) == i, string.Format("coll IndexOf wasn't right! Expected: {0} got: {1}", i, coll.IndexOf(i))); Assert.True(coll.Contains(i), string.Format("coll Contains failed to find the value {0}.", i)); } SynchronizedCollection <int> coll2 = new SynchronizedCollection <int>(new object(), new List <int>(coll)); for (int i = 0; i < size; i++) { Assert.True(coll2[i] == i, string.Format("coll2 element was wrong! expected: {0} got: {1} ", i, coll2[i])); } SynchronizedCollection <int> coll3 = new SynchronizedCollection <int>(new object(), 1, 2, 3, 4, 5, 6); for (int i = 0; i < 5; i++) { Assert.True(coll3[i] == i + 1, string.Format("coll3 element {0} was wrong! expected: {1} got: {2}", i, i + 1, coll3[i])); } int newValue = 80; coll3[5] = newValue; Assert.True(coll3[5] == newValue); IEnumerator <int> e = coll.GetEnumerator(); int n = 0; while (e.MoveNext()) { Assert.True(e.Current.Equals(n++), string.Format("Expected: {0}, got:{1}", n - 1, e.Current)); } Assert.True(n == 100, string.Format("Expect number of elements: {0}, got:{1}", 100, n)); int[] array = new int[size + 1]; coll.CopyTo(array, 1); for (int i = 0; i < size; i++) { Assert.True(array[i + 1] == i, string.Format("After CopyTo, Element {0} was wrong! Expected: {1} got: {2}", i, i + 1, array[i + 1])); } coll.Add(coll.Count); coll.Insert(0, -1); coll.RemoveAt(0); coll.Remove(coll.Count - 1); Assert.True(coll.Count == size, string.Format("Expect number of elements after modification: {0}, got: {1}", size, coll.Count)); for (int i = 0; i < size; i++) { Assert.True(coll[i] == i, string.Format("coll element was wrong after modification! Expected: {0} got: {1} ", i, coll[i])); } coll.Clear(); Assert.True(coll.Count == 0, string.Format("Clear operation failed!, expected: 0, actual {0}", coll.Count)); // Negative cases Assert.Throws <ArgumentNullException>("syncRoot", () => { new SynchronizedCollection <int>(null); }); Assert.Throws <ArgumentNullException>("list", () => { new SynchronizedCollection <int>(new object(), null); }); Assert.Throws <ArgumentNullException>("syncRoot", () => { new SynchronizedCollection <int>(null, new List <int>()); }); Assert.Throws <ArgumentNullException>("syncRoot", () => { new SynchronizedCollection <int>(null, 1, 2, 3, 4); }); Assert.Throws <ArgumentOutOfRangeException>(() => { coll[1000] = 5; }); Assert.Throws <ArgumentOutOfRangeException>(() => { coll[-1] = 5; }); Assert.Throws <ArgumentOutOfRangeException>(() => { coll.Insert(1000, 5); }); Assert.Throws <ArgumentOutOfRangeException>(() => { coll.Insert(-1, 5); }); Assert.False(coll.Remove(100000)); Assert.Throws <ArgumentOutOfRangeException>(() => { coll.RemoveAt(-1); }); Assert.Throws <ArgumentOutOfRangeException>(() => { coll.RemoveAt(10000); }); }
/// <summary> /// Clears the internal exception cache. /// </summary> public static void ClearExceptions() { _exceptionList.Clear(); }
public void Clear() { m_ProcessedItems = 0; m_ToDoList.Clear(); m_ActiveList.Clear(); }
private void btCancel_Click(object sender, EventArgs e) { lstSelectedIps.Clear(); this.Close(); }
public void ClearCache() { _checkCache.Clear(); }
public void Clear() { _backingList.Clear(); }
/// <summary> /// Removes all clients from the room /// </summary> public void RemoveAllClients() { _clientList.Clear(); }