diff --git a/LibreMetaverse/AgentManager.cs b/LibreMetaverse/AgentManager.cs index 0edc46fa..f97286af 100644 --- a/LibreMetaverse/AgentManager.cs +++ b/LibreMetaverse/AgentManager.cs @@ -2723,12 +2723,12 @@ namespace OpenMetaverse { ThreadPool.QueueUserWorkItem(_ => { - // First fetch the guesture + // First fetch the gesture AssetGesture gesture = null; - if (gestureCache.ContainsKey(gestureID)) + if (gestureCache.TryGetValue(gestureID, out var gestureId)) { - gesture = gestureCache[gestureID]; + gesture = gestureId; } else { @@ -2746,7 +2746,7 @@ namespace OpenMetaverse } ); - gotAsset.WaitOne(30 * 1000, false); + gotAsset.WaitOne(TimeSpan.FromSeconds(30), false); if (gesture != null && gesture.Decode()) { @@ -3138,7 +3138,7 @@ namespace OpenMetaverse } Client.Network.EventQueueRunning += queueCallback; - queueEvent.WaitOne(10 * 1000, false); + queueEvent.WaitOne(TimeSpan.FromSeconds(10), false); Client.Network.EventQueueRunning -= queueCallback; } @@ -5027,7 +5027,7 @@ namespace OpenMetaverse Client.Assets.XferReceived += xferCallback; xferID = Client.Assets.RequestAssetXfer(fileName, true, false, UUID.Zero, AssetType.Unknown, true); - if (gotMuteList.WaitOne(60 * 1000, false)) + if (gotMuteList.WaitOne(TimeSpan.FromMinutes(1), false)) { muteList = Utils.BytesToString(assetData); diff --git a/LibreMetaverse/AppearanceManager.cs b/LibreMetaverse/AppearanceManager.cs index 9e23a234..157019f7 100644 --- a/LibreMetaverse/AppearanceManager.cs +++ b/LibreMetaverse/AppearanceManager.cs @@ -141,22 +141,22 @@ namespace OpenMetaverse /// Mapping between BakeType and AvatarTextureIndex public static readonly byte[] BakeIndexToTextureIndex = new byte[BAKED_TEXTURE_COUNT] { 8, 9, 10, 11, 19, 20 }; /// Maximum number of concurrent downloads for wearable assets and textures - const int MAX_CONCURRENT_DOWNLOADS = 5; + private const int MAX_CONCURRENT_DOWNLOADS = 5; /// Maximum number of concurrent uploads for baked textures - const int MAX_CONCURRENT_UPLOADS = 6; + private const int MAX_CONCURRENT_UPLOADS = 6; /// Timeout for fetching inventory listings - const int INVENTORY_TIMEOUT = 1000 * 30; + private readonly TimeSpan INVENTORY_TIMEOUT = TimeSpan.FromSeconds(30); /// Timeout for fetching a single wearable, or receiving a single packet response - const int WEARABLE_TIMEOUT = 1000 * 30; + private readonly TimeSpan WEARABLE_TIMEOUT = TimeSpan.FromSeconds(30); /// Timeout for fetching a single texture - const int TEXTURE_TIMEOUT = 1000 * 120; + private readonly TimeSpan TEXTURE_TIMEOUT = TimeSpan.FromSeconds(120); /// Timeout for uploading a single baked texture - const int UPLOAD_TIMEOUT = 1000 * 90; + private readonly TimeSpan UPLOAD_TIMEOUT = TimeSpan.FromSeconds(90); /// Number of times to retry bake upload - const int UPLOAD_RETRIES = 2; + private const int UPLOAD_RETRIES = 2; /// When changing outfit, kick off rebake after /// 20 seconds has passed since the last change - const int REBAKE_DELAY = 1000 * 5; + private const int REBAKE_DELAY = 1000 * 5; /// Total number of wearables allowed for each avatar public const int WEARABLE_COUNT_MAX = 60; @@ -1347,7 +1347,7 @@ namespace OpenMetaverse } // Otherwise, retrieve the item off the asset server. - var inventoryItem = Client.Inventory.FetchItem(item.Key, Client.Self.AgentID, 1000 * 10); + var inventoryItem = Client.Inventory.FetchItem(item.Key, Client.Self.AgentID, TimeSpan.FromSeconds(10)); attachmentsByPoint.Add(item.Value, inventoryItem); } @@ -1370,7 +1370,7 @@ namespace OpenMetaverse } // Otherwise, retrieve the item off the asset server. - var inventoryItem = Client.Inventory.FetchItem(item.Key, Client.Self.AgentID, 1000 * 10); + var inventoryItem = Client.Inventory.FetchItem(item.Key, Client.Self.AgentID, TimeSpan.FromSeconds(10)); attachmentsByInventoryItem.Add(inventoryItem, item.Value); } @@ -1606,7 +1606,7 @@ namespace OpenMetaverse /// Blocking method to populate the Wearables dictionary /// /// True on success, otherwise false - bool GetAgentWearables() + private bool GetAgentWearables() { var wearablesEvent = new AutoResetEvent(false); EventHandler WearablesCallback = ((s, e) => wearablesEvent.Set()); @@ -1626,7 +1626,7 @@ namespace OpenMetaverse /// Blocking method to populate the Textures array with cached bakes /// /// True on success, otherwise false - bool GetCachedBakes() + private bool GetCachedBakes() { var cacheCheckEvent = new AutoResetEvent(false); EventHandler CacheCallback = (sender, e) => cacheCheckEvent.Set(); @@ -2767,7 +2767,7 @@ namespace OpenMetaverse // If that fails, fetch from server... if (contents == null || contents.Count == 0) { - contents = Client.Inventory.FolderContents(cof.UUID, cof.OwnerID, true, true, InventorySortOrder.ByDate, 60000); + contents = Client.Inventory.FolderContents(cof.UUID, cof.OwnerID, true, true, InventorySortOrder.ByDate, TimeSpan.FromMinutes(1)); } Logger.Log($"{contents.Count} inventory items in 'Current Outfit' folder", Helpers.LogLevel.Info, Client); diff --git a/LibreMetaverse/GridManager.cs b/LibreMetaverse/GridManager.cs index f12347e0..8600a8eb 100644 --- a/LibreMetaverse/GridManager.cs +++ b/LibreMetaverse/GridManager.cs @@ -475,14 +475,14 @@ namespace OpenMetaverse } /// - /// + /// Returns a list of map items /// /// /// /// - /// - /// - public List MapItems(ulong regionHandle, GridItemType item, GridLayerType layer, int timeoutMS) + /// + /// List of Map items + public List MapItems(ulong regionHandle, GridItemType item, GridLayerType layer, TimeSpan timeout) { List itemList = null; AutoResetEvent itemsEvent = new AutoResetEvent(false); @@ -499,7 +499,7 @@ namespace OpenMetaverse GridItems += Callback; RequestMapItems(regionHandle, item, layer); - itemsEvent.WaitOne(timeoutMS, false); + itemsEvent.WaitOne(timeout, false); GridItems -= Callback; diff --git a/LibreMetaverse/InventoryManager.cs b/LibreMetaverse/InventoryManager.cs index 79dcea1c..d48d32ab 100644 --- a/LibreMetaverse/InventoryManager.cs +++ b/LibreMetaverse/InventoryManager.cs @@ -27,6 +27,7 @@ using System; using System.Collections.Generic; +using System.Configuration; using System.Linq; using System.Net; using System.Threading; @@ -497,10 +498,10 @@ namespace OpenMetaverse /// /// The items /// The item Owners - /// a integer representing the number of milliseconds to wait for results + /// time to wait for results represented by /// An object on success, or null if no item was found /// Items will also be sent to the event - public InventoryItem FetchItem(UUID itemID, UUID ownerID, int timeoutMS) + public InventoryItem FetchItem(UUID itemID, UUID ownerID, TimeSpan timeout) { var fetchEvent = new AutoResetEvent(false); InventoryItem fetchedItem = null; @@ -517,7 +518,7 @@ namespace OpenMetaverse ItemReceived += Callback; RequestFetchInventory(itemID, ownerID); - fetchEvent.WaitOne(timeoutMS, false); + fetchEvent.WaitOne(timeout, false); ItemReceived -= Callback; return fetchedItem; @@ -639,14 +640,14 @@ namespace OpenMetaverse /// true to retrieve folders /// true to retrieve items /// sort order to return results in - /// a integer representing the number of milliseconds to wait for results - /// when false uses links and does not attempt to get the real object + /// time given to wait for results + /// when false uses links and does not attempt to get the real object /// A list of inventory items matching search criteria within folder /// /// InventoryFolder.DescendentCount will only be accurate if both folders and items are /// requested public List FolderContents(UUID folder, UUID owner, bool folders, bool items, - InventorySortOrder order, int timeoutMS, bool fast_loading = false) + InventorySortOrder order, TimeSpan timeout, bool fastLoading = false) { List objects = null; var fetchEvent = new AutoResetEvent(false); @@ -670,7 +671,7 @@ namespace OpenMetaverse FolderUpdated += FolderUpdatedCB; RequestFolderContents(folder, owner, folders, items, order); - if (fetchEvent.WaitOne(timeoutMS, false)) + if (fetchEvent.WaitOne(timeout, false)) { objects = _Store.GetContents(folder); } @@ -685,11 +686,11 @@ namespace OpenMetaverse { foreach (var ob in objects.Where(o => o.GetType() != typeof(InventoryFolder)).Cast()) { - if (ob.IsLink() && !fast_loading) + if (ob.IsLink() && !fastLoading) { if (Store.Items.ContainsKey(ob.AssetUUID)) { - cleaned_list.Add(Client.Inventory.FetchItem(ob.AssetUUID, Client.Self.AgentID, 1000 * 5)); + cleaned_list.Add(Client.Inventory.FetchItem(ob.AssetUUID, Client.Self.AgentID, TimeSpan.FromSeconds(5))); } else { @@ -716,10 +717,10 @@ namespace OpenMetaverse } public List FolderContents(UUID folder, UUID owner, bool folders, bool items, - InventorySortOrder order, int timeoutMS) + InventorySortOrder order, TimeSpan timeout) { return FolderContents(folder, owner, folders, items, - order, timeoutMS, false); + order, timeout, false); } @@ -1005,10 +1006,10 @@ namespace OpenMetaverse /// The folder to begin the search in /// The object owners /// A string path to search - /// milliseconds to wait for a reply + /// time to wait for reply /// Found items or if /// timeout occurs or item is not found - public UUID FindObjectByPath(UUID baseFolder, UUID inventoryOwner, string path, int timeoutMS) + public UUID FindObjectByPath(UUID baseFolder, UUID inventoryOwner, string path, TimeSpan timeout) { var findEvent = new AutoResetEvent(false); var foundItem = UUID.Zero; @@ -1025,7 +1026,7 @@ namespace OpenMetaverse FindObjectByPathReply += Callback; RequestFindObjectByPath(baseFolder, inventoryOwner, path); - findEvent.WaitOne(timeoutMS, false); + findEvent.WaitOne(timeout, false); FindObjectByPathReply -= Callback; @@ -2601,7 +2602,7 @@ namespace OpenMetaverse { var contents = Client.Inventory.FolderContents( - folderID, owner, true, true, InventorySortOrder.ByDate, 1000 * 15); + folderID, owner, true, true, InventorySortOrder.ByDate, TimeSpan.FromSeconds(15)); foreach (var entry in contents) { @@ -2612,7 +2613,7 @@ namespace OpenMetaverse GetInventoryRecursive(folder.UUID, owner, ref cats, ref items); break; case InventoryItem _: - items.Add(Client.Inventory.FetchItem(entry.UUID, owner, 1000 * 10)); + items.Add(Client.Inventory.FetchItem(entry.UUID, owner, TimeSpan.FromSeconds(10))); break; default: // shouldn't happen Logger.Log("Retrieved inventory contents of invalid type", Helpers.LogLevel.Error); @@ -2764,12 +2765,12 @@ namespace OpenMetaverse /// /// The tasks /// The tasks simulator local ID - /// milliseconds to wait for reply from simulator + /// time to wait for reply from simulator /// A list containing the inventory items inside the task or null /// if a timeout occurs /// This request blocks until the response from the simulator arrives - /// or timeoutMS is exceeded - public List GetTaskInventory(UUID objectID, uint objectLocalID, int timeoutMS) + /// before timeout is exceeded + public List GetTaskInventory(UUID objectID, uint objectLocalID, TimeSpan timeout) { string filename = null; var taskReplyEvent = new AutoResetEvent(false); @@ -2787,7 +2788,7 @@ namespace OpenMetaverse RequestTaskInventory(objectLocalID); - if (taskReplyEvent.WaitOne(timeoutMS, false)) + if (taskReplyEvent.WaitOne(timeout, false)) { TaskInventoryReply -= Callback; @@ -2811,7 +2812,7 @@ namespace OpenMetaverse // Start the actual asset xfer xferID = Client.Assets.RequestAssetXfer(filename, true, false, UUID.Zero, AssetType.Unknown, true); - if (taskDownloadEvent.WaitOne(timeoutMS, false)) + if (taskDownloadEvent.WaitOne(timeout, false)) { Client.Assets.XferReceived -= XferCallback; diff --git a/LibreMetaverse/ParcelManager.cs b/LibreMetaverse/ParcelManager.cs index 569559ab..4bd75296 100644 --- a/LibreMetaverse/ParcelManager.cs +++ b/LibreMetaverse/ParcelManager.cs @@ -1144,7 +1144,7 @@ namespace OpenMetaverse /// Simulator to request parcels from (must be connected) public void RequestAllSimParcels(Simulator simulator) { - RequestAllSimParcels(simulator, false, 750); + RequestAllSimParcels(simulator, false, TimeSpan.FromMilliseconds(750)); } /// @@ -1153,8 +1153,8 @@ namespace OpenMetaverse /// /// Simulator to request parcels from (must be connected) /// If TRUE, will force a full refresh - /// Number of milliseconds to pause in between each request - public void RequestAllSimParcels(Simulator simulator, bool refresh, int msDelay) + /// Pause time in between each request + public void RequestAllSimParcels(Simulator simulator, bool refresh, TimeSpan delay) { if (simulator.DownloadingParcelMap) { @@ -1194,7 +1194,7 @@ namespace OpenMetaverse y * 4.0f, x * 4.0f, int.MaxValue, false); // Wait the given amount of time for a reply before sending the next request - if (!WaitForSimParcel.WaitOne(msDelay, false)) + if (!WaitForSimParcel.WaitOne(delay, false)) ++timeouts; ++count; diff --git a/LibreMetaverse/Simulator.cs b/LibreMetaverse/Simulator.cs index 74f01436..6517c9ee 100644 --- a/LibreMetaverse/Simulator.cs +++ b/LibreMetaverse/Simulator.cs @@ -542,7 +542,7 @@ namespace OpenMetaverse } Client.Network.EventQueueRunning += queueCallback; - queueEvent.WaitOne(10 * 1000, false); + queueEvent.WaitOne(TimeSpan.FromSeconds(10), false); Client.Network.EventQueueRunning -= queueCallback; } diff --git a/LibreMetaverse/TexturePipeline.cs b/LibreMetaverse/TexturePipeline.cs index f0999853..206c352e 100644 --- a/LibreMetaverse/TexturePipeline.cs +++ b/LibreMetaverse/TexturePipeline.cs @@ -642,7 +642,7 @@ namespace OpenMetaverse if (task.Transfer.Size == 0) { // We haven't received the header yet, block until it's received or times out - task.Transfer.HeaderReceivedEvent.WaitOne(1000 * 5, false); + task.Transfer.HeaderReceivedEvent.WaitOne(TimeSpan.FromSeconds(5), false); if (task.Transfer.Size == 0) { diff --git a/Programs/GridProxy/GridProxy.cs b/Programs/GridProxy/GridProxy.cs index ad5f9bed..649febff 100644 --- a/Programs/GridProxy/GridProxy.cs +++ b/Programs/GridProxy/GridProxy.cs @@ -1206,7 +1206,7 @@ namespace GridProxy } ); loginRequest.PostRequestAsync(content, "application/llsd+xml", 1000 * 100); - remoteComplete.WaitOne(1000 * 100, false); + remoteComplete.WaitOne(TimeSpan.FromSeconds(100), false); if (response == null) { diff --git a/Programs/VivoxTest/VoiceTest.cs b/Programs/VivoxTest/VoiceTest.cs index 4ae7408e..fc7ea988 100644 --- a/Programs/VivoxTest/VoiceTest.cs +++ b/Programs/VivoxTest/VoiceTest.cs @@ -128,7 +128,7 @@ namespace VoiceTest Console.WriteLine("Waiting for OnEventQueueRunning"); - if (!EventQueueRunningEvent.WaitOne(45 * 1000, false)) + if (!EventQueueRunningEvent.WaitOne(TimeSpan.FromSeconds(45), false)) throw new VoiceException("EventQueueRunning event did not occur", true); Console.WriteLine("EventQueue running"); @@ -136,7 +136,7 @@ namespace VoiceTest Console.WriteLine("Asking the current simulator to create a provisional account..."); if (!voice.RequestProvisionAccount()) throw new VoiceException("Failed to request a provisional account", true); - if (!ProvisionEvent.WaitOne(120 * 1000, false)) + if (!ProvisionEvent.WaitOne(TimeSpan.FromMinutes(2), false)) throw new VoiceException("Failed to create a provisional account", true); Console.WriteLine("Provisional account created. Username: " + VoiceAccount + ", Password: " + VoicePassword); @@ -151,7 +151,7 @@ namespace VoiceTest if (!voice.RequestParcelVoiceInfo()) throw new Exception("Failed to request parcel voice info"); - if (!ParcelVoiceInfoEvent.WaitOne(45 * 1000, false)) + if (!ParcelVoiceInfoEvent.WaitOne(TimeSpan.FromSeconds(45), false)) throw new VoiceException("Failed to obtain parcel info voice", true); diff --git a/Programs/examples/PacketDump/PacketDump.cs b/Programs/examples/PacketDump/PacketDump.cs index b2e2db04..ba1cb95a 100644 --- a/Programs/examples/PacketDump/PacketDump.cs +++ b/Programs/examples/PacketDump/PacketDump.cs @@ -72,7 +72,7 @@ namespace PacketDump client.Network.BeginLogin(client.Network.DefaultLoginParams(args[0], args[1], args[2], "PacketDump", "1.0.0")); // Wait until LoginEvent is set in the LoginHandler callback, or we time out - if (LoginEvent.WaitOne(1000 * 20, false)) + if (LoginEvent.WaitOne(TimeSpan.FromSeconds(20), false)) { if (LoginSuccess) { diff --git a/Programs/examples/TestClient/Commands/Agent/CloneProfileCommand.cs b/Programs/examples/TestClient/Commands/Agent/CloneProfileCommand.cs index c20a2925..8fc7e8e7 100644 --- a/Programs/examples/TestClient/Commands/Agent/CloneProfileCommand.cs +++ b/Programs/examples/TestClient/Commands/Agent/CloneProfileCommand.cs @@ -57,7 +57,7 @@ namespace OpenMetaverse.TestClient // Wait for all the packets to arrive ReceivedProfileEvent.Reset(); - ReceivedProfileEvent.WaitOne(5000, false); + ReceivedProfileEvent.WaitOne(TimeSpan.FromSeconds(5), false); // Check if everything showed up if (!ReceivedInterests || !ReceivedProperties || !ReceivedGroups) diff --git a/Programs/examples/TestClient/Commands/Appearance/WearCommand.cs b/Programs/examples/TestClient/Commands/Appearance/WearCommand.cs index 97744c23..6054585f 100644 --- a/Programs/examples/TestClient/Commands/Appearance/WearCommand.cs +++ b/Programs/examples/TestClient/Commands/Appearance/WearCommand.cs @@ -23,14 +23,14 @@ namespace OpenMetaverse.TestClient target = target.TrimEnd(); - UUID folder = Client.Inventory.FindObjectByPath(Client.Inventory.Store.RootFolder.UUID, Client.Self.AgentID, target, 20 * 1000); + UUID folder = Client.Inventory.FindObjectByPath(Client.Inventory.Store.RootFolder.UUID, Client.Self.AgentID, target, TimeSpan.FromSeconds(20)); if (folder == UUID.Zero) { return "Outfit path " + target + " not found"; } - List contents = Client.Inventory.FolderContents(folder, Client.Self.AgentID, true, true, InventorySortOrder.ByName, 20 * 1000); + List contents = Client.Inventory.FolderContents(folder, Client.Self.AgentID, true, true, InventorySortOrder.ByName, TimeSpan.FromSeconds(20)); List items = new List(); if (contents == null) diff --git a/Programs/examples/TestClient/Commands/Communication/IMCommand.cs b/Programs/examples/TestClient/Commands/Communication/IMCommand.cs index 1846415c..d187f478 100644 --- a/Programs/examples/TestClient/Commands/Communication/IMCommand.cs +++ b/Programs/examples/TestClient/Commands/Communication/IMCommand.cs @@ -39,7 +39,7 @@ namespace OpenMetaverse.TestClient // Send the Query Client.Avatars.RequestAvatarNameSearch(ToAvatarName, UUID.Random()); - NameSearchEvent.WaitOne(6000, false); + NameSearchEvent.WaitOne(TimeSpan.FromMinutes(1), false); } if (Name2Key.ContainsKey(ToAvatarName.ToLower())) diff --git a/Programs/examples/TestClient/Commands/Communication/IMGroupCommand.cs b/Programs/examples/TestClient/Commands/Communication/IMGroupCommand.cs index b8b2566a..da65875c 100644 --- a/Programs/examples/TestClient/Commands/Communication/IMGroupCommand.cs +++ b/Programs/examples/TestClient/Commands/Communication/IMGroupCommand.cs @@ -47,7 +47,7 @@ namespace OpenMetaverse.TestClient WaitForSessionStart.Set(); } - if (WaitForSessionStart.WaitOne(20000, false)) + if (WaitForSessionStart.WaitOne(TimeSpan.FromSeconds(20), false)) { Client.Self.InstantMessageGroup(ToGroupID, message); } diff --git a/Programs/examples/TestClient/Commands/Directory/Key2NameCommand.cs b/Programs/examples/TestClient/Commands/Directory/Key2NameCommand.cs index 47bc6e62..be561eed 100644 --- a/Programs/examples/TestClient/Commands/Directory/Key2NameCommand.cs +++ b/Programs/examples/TestClient/Commands/Directory/Key2NameCommand.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Text; namespace OpenMetaverse.TestClient.Commands @@ -32,7 +33,7 @@ namespace OpenMetaverse.TestClient.Commands Client.Avatars.RequestAvatarName(key); Client.Groups.RequestGroupProfile(key); - if (!waitQuery.WaitOne(10000, false)) + if (!waitQuery.WaitOne(TimeSpan.FromSeconds(10), false)) { result.AppendLine("Timeout waiting for reply, this could mean the Key is not an avatar or a group"); } diff --git a/Programs/examples/TestClient/Commands/Directory/SearchClassifiedsCommand.cs b/Programs/examples/TestClient/Commands/Directory/SearchClassifiedsCommand.cs index e60df7f9..c8a75783 100644 --- a/Programs/examples/TestClient/Commands/Directory/SearchClassifiedsCommand.cs +++ b/Programs/examples/TestClient/Commands/Directory/SearchClassifiedsCommand.cs @@ -46,7 +46,7 @@ namespace OpenMetaverse.TestClient.Commands UUID searchID = Client.Directory.StartClassifiedSearch(searchText, DirectoryManager.ClassifiedCategories.Any, DirectoryManager.ClassifiedQueryFlags.Mature | DirectoryManager.ClassifiedQueryFlags.PG); - if (!waitQuery.WaitOne(20000, false) && Client.Network.Connected) + if (!waitQuery.WaitOne(TimeSpan.FromSeconds(20), false) && Client.Network.Connected) { result.AppendLine("Timeout waiting for simulator to respond to query."); } diff --git a/Programs/examples/TestClient/Commands/Directory/SearchEventsCommand.cs b/Programs/examples/TestClient/Commands/Directory/SearchEventsCommand.cs index 83a246d6..d17a7051 100644 --- a/Programs/examples/TestClient/Commands/Directory/SearchEventsCommand.cs +++ b/Programs/examples/TestClient/Commands/Directory/SearchEventsCommand.cs @@ -31,7 +31,7 @@ namespace OpenMetaverse.TestClient.Commands // send the request to the directory manager Client.Directory.StartEventsSearch(searchText, 0); string result; - if (waitQuery.WaitOne(20000, false) && Client.Network.Connected) + if (waitQuery.WaitOne(TimeSpan.FromSeconds(20), false) && Client.Network.Connected) { result = "Your query '" + searchText + "' matched " + resultCount + " Events. "; } diff --git a/Programs/examples/TestClient/Commands/Directory/SearchGroupsCommand.cs b/Programs/examples/TestClient/Commands/Directory/SearchGroupsCommand.cs index 25fc3176..2b866a81 100644 --- a/Programs/examples/TestClient/Commands/Directory/SearchGroupsCommand.cs +++ b/Programs/examples/TestClient/Commands/Directory/SearchGroupsCommand.cs @@ -32,7 +32,7 @@ namespace OpenMetaverse.TestClient.Commands Client.Directory.StartGroupSearch(searchText, 0); string result; - if (waitQuery.WaitOne(20000, false) && Client.Network.Connected) + if (waitQuery.WaitOne(TimeSpan.FromSeconds(20), false) && Client.Network.Connected) { result = "Your query '" + searchText + "' matched " + resultCount + " Groups. "; } diff --git a/Programs/examples/TestClient/Commands/Directory/SearchLandCommand.cs b/Programs/examples/TestClient/Commands/Directory/SearchLandCommand.cs index 067d594b..67726bdf 100644 --- a/Programs/examples/TestClient/Commands/Directory/SearchLandCommand.cs +++ b/Programs/examples/TestClient/Commands/Directory/SearchLandCommand.cs @@ -24,6 +24,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ +using System; using System.Text; namespace OpenMetaverse.TestClient.Commands @@ -116,7 +117,7 @@ namespace OpenMetaverse.TestClient.Commands // send the request to the directory manager Client.Directory.StartLandSearch(queryFlags, searchTypeFlags, maxPrice, minSize, 0); - if (!waitQuery.WaitOne(20000, false) && Client.Network.Connected) + if (!waitQuery.WaitOne(TimeSpan.FromSeconds(20), false) && Client.Network.Connected) { result.AppendLine("Timeout waiting for simulator to respond."); } diff --git a/Programs/examples/TestClient/Commands/Directory/SearchPeopleCommand.cs b/Programs/examples/TestClient/Commands/Directory/SearchPeopleCommand.cs index 55b41977..24c043be 100644 --- a/Programs/examples/TestClient/Commands/Directory/SearchPeopleCommand.cs +++ b/Programs/examples/TestClient/Commands/Directory/SearchPeopleCommand.cs @@ -33,7 +33,7 @@ namespace OpenMetaverse.TestClient.Commands Client.Directory.StartPeopleSearch(searchText, 0); string result; - if (waitQuery.WaitOne(20000, false) && Client.Network.Connected) + if (waitQuery.WaitOne(TimeSpan.FromSeconds(20), false) && Client.Network.Connected) { result = "Your query '" + searchText + "' matched " + resultCount + " People. "; } diff --git a/Programs/examples/TestClient/Commands/Directory/SearchPlacesCommand.cs b/Programs/examples/TestClient/Commands/Directory/SearchPlacesCommand.cs index 5cb0650d..f3070ed0 100644 --- a/Programs/examples/TestClient/Commands/Directory/SearchPlacesCommand.cs +++ b/Programs/examples/TestClient/Commands/Directory/SearchPlacesCommand.cs @@ -41,7 +41,7 @@ namespace OpenMetaverse.TestClient.Commands Client.Directory.PlacesReply += callback; Client.Directory.StartPlacesSearch(searchText); - if (!waitQuery.WaitOne(20000, false) && Client.Network.Connected) + if (!waitQuery.WaitOne(TimeSpan.FromSeconds(20), false) && Client.Network.Connected) { result.AppendLine("Timeout waiting for simulator to respond to query."); } diff --git a/Programs/examples/TestClient/Commands/Estate/DownloadTerrainCommand.cs b/Programs/examples/TestClient/Commands/Estate/DownloadTerrainCommand.cs index debacc60..af8b319e 100644 --- a/Programs/examples/TestClient/Commands/Estate/DownloadTerrainCommand.cs +++ b/Programs/examples/TestClient/Commands/Estate/DownloadTerrainCommand.cs @@ -61,9 +61,11 @@ namespace OpenMetaverse.TestClient Client.Assets.InitiateDownload += initiateDownloadDelegate; // configure request to tell the simulator to send us the file - List parameters = new List(); - parameters.Add("download filename"); - parameters.Add(fileName); + List parameters = new List + { + "download filename", + fileName + }; // send the request Client.Estate.EstateOwnerMessage("terrain", parameters); diff --git a/Programs/examples/TestClient/Commands/Estate/UploadRawTerrainCommand.cs b/Programs/examples/TestClient/Commands/Estate/UploadRawTerrainCommand.cs index 5879bb79..ee0556d1 100644 --- a/Programs/examples/TestClient/Commands/Estate/UploadRawTerrainCommand.cs +++ b/Programs/examples/TestClient/Commands/Estate/UploadRawTerrainCommand.cs @@ -36,7 +36,7 @@ namespace OpenMetaverse.TestClient Client.Estate.UploadTerrain(fileData, fileName); // Wait for upload to complete. Upload request is fired in callback from first request - if (!WaitForUploadComplete.WaitOne(120000, false)) + if (!WaitForUploadComplete.WaitOne(TimeSpan.FromMinutes(2), false)) { Cleanup(); return "Timeout waiting for terrain file upload"; diff --git a/Programs/examples/TestClient/Commands/Friends/MapFriendCommand.cs b/Programs/examples/TestClient/Commands/Friends/MapFriendCommand.cs index 2fd55025..0a6e0b7e 100644 --- a/Programs/examples/TestClient/Commands/Friends/MapFriendCommand.cs +++ b/Programs/examples/TestClient/Commands/Friends/MapFriendCommand.cs @@ -41,7 +41,7 @@ namespace OpenMetaverse.TestClient Client.Friends.FriendFoundReply += del; WaitforFriend.Reset(); Client.Friends.MapFriend(targetID); - if (!WaitforFriend.WaitOne(10000, false)) + if (!WaitforFriend.WaitOne(TimeSpan.FromSeconds(10), false)) { sb.AppendFormat("Timeout waiting for reply, Do you have mapping rights on {0}?", targetID); } diff --git a/Programs/examples/TestClient/Commands/Groups/ActivateGroupCommand.cs b/Programs/examples/TestClient/Commands/Groups/ActivateGroupCommand.cs index 1f1f69d6..83a8a3d0 100644 --- a/Programs/examples/TestClient/Commands/Groups/ActivateGroupCommand.cs +++ b/Programs/examples/TestClient/Commands/Groups/ActivateGroupCommand.cs @@ -36,7 +36,7 @@ namespace OpenMetaverse.TestClient Console.WriteLine("setting " + groupName + " as active group"); Client.Groups.ActivateGroup(groupUUID); - GroupsEvent.WaitOne(30000, false); + GroupsEvent.WaitOne(TimeSpan.FromSeconds(30), false); Client.Network.UnregisterCallback(PacketType.AgentDataUpdate, pcallback); GroupsEvent.Reset(); diff --git a/Programs/examples/TestClient/Commands/Groups/GroupMembersCommand.cs b/Programs/examples/TestClient/Commands/Groups/GroupMembersCommand.cs index bf2daebf..0cabda2f 100644 --- a/Programs/examples/TestClient/Commands/Groups/GroupMembersCommand.cs +++ b/Programs/examples/TestClient/Commands/Groups/GroupMembersCommand.cs @@ -37,7 +37,7 @@ namespace OpenMetaverse.TestClient if (UUID.Zero != GroupUUID) { Client.Groups.GroupMembersReply += GroupMembersHandler; GroupRequestID = Client.Groups.RequestGroupMembers(GroupUUID); - GroupsEvent.WaitOne(30000, false); + GroupsEvent.WaitOne(TimeSpan.FromSeconds(30), false); GroupsEvent.Reset(); Client.Groups.GroupMembersReply -= GroupMembersHandler; return Client + " got group members"; diff --git a/Programs/examples/TestClient/Commands/Groups/GroupRolesCommand.cs b/Programs/examples/TestClient/Commands/Groups/GroupRolesCommand.cs index 7301660c..7fb1e5fe 100644 --- a/Programs/examples/TestClient/Commands/Groups/GroupRolesCommand.cs +++ b/Programs/examples/TestClient/Commands/Groups/GroupRolesCommand.cs @@ -37,7 +37,7 @@ namespace OpenMetaverse.TestClient if (UUID.Zero != GroupUUID) { Client.Groups.GroupRoleDataReply += Groups_GroupRoles; GroupRequestID = Client.Groups.RequestGroupRoles(GroupUUID); - GroupsEvent.WaitOne(30000, false); + GroupsEvent.WaitOne(TimeSpan.FromSeconds(30), false); GroupsEvent.Reset(); Client.Groups.GroupRoleDataReply += Groups_GroupRoles; return Client + " got group roles"; diff --git a/Programs/examples/TestClient/Commands/Groups/JoinGroupCommand.cs b/Programs/examples/TestClient/Commands/Groups/JoinGroupCommand.cs index 3514eec4..8a5e74b5 100644 --- a/Programs/examples/TestClient/Commands/Groups/JoinGroupCommand.cs +++ b/Programs/examples/TestClient/Commands/Groups/JoinGroupCommand.cs @@ -47,7 +47,7 @@ namespace OpenMetaverse.TestClient queryID = Client.Directory.StartGroupSearch(groupName, 0); - GetGroupsSearchEvent.WaitOne(60000, false); + GetGroupsSearchEvent.WaitOne(TimeSpan.FromMinutes(1), false); Client.Directory.DirGroupsReply -= Directory_DirGroups; @@ -69,7 +69,7 @@ namespace OpenMetaverse.TestClient * TODO: implement the pay to join procedure. */ - GetGroupsSearchEvent.WaitOne(60000, false); + GetGroupsSearchEvent.WaitOne(TimeSpan.FromMinutes(1), false); Client.Groups.GroupJoinedReply -= Groups_GroupJoined; GetGroupsSearchEvent.Reset(); diff --git a/Programs/examples/TestClient/Commands/Groups/LeaveGroupCommand.cs b/Programs/examples/TestClient/Commands/Groups/LeaveGroupCommand.cs index b5ca7453..66c8d579 100644 --- a/Programs/examples/TestClient/Commands/Groups/LeaveGroupCommand.cs +++ b/Programs/examples/TestClient/Commands/Groups/LeaveGroupCommand.cs @@ -28,7 +28,7 @@ namespace OpenMetaverse.TestClient Client.Groups.GroupLeaveReply += Groups_GroupLeft; Client.Groups.LeaveGroup(groupUUID); - GroupsEvent.WaitOne(30000, false); + GroupsEvent.WaitOne(TimeSpan.FromSeconds(30), false); Client.Groups.GroupLeaveReply -= Groups_GroupLeft; GroupsEvent.Reset(); diff --git a/Programs/examples/TestClient/Commands/Inventory/BalanceCommand.cs b/Programs/examples/TestClient/Commands/Inventory/BalanceCommand.cs index a7d6102e..3ca85c2c 100644 --- a/Programs/examples/TestClient/Commands/Inventory/BalanceCommand.cs +++ b/Programs/examples/TestClient/Commands/Inventory/BalanceCommand.cs @@ -23,7 +23,7 @@ namespace OpenMetaverse.TestClient Client.Self.MoneyBalance += balance; Client.Self.RequestBalance(); string result = "Timeout waiting for balance reply"; - if (waitBalance.WaitOne(10000, false)) + if (waitBalance.WaitOne(TimeSpan.FromSeconds(10), false)) { result = Client + " has L$: " + Client.Self.Balance; } diff --git a/Programs/examples/TestClient/Commands/Inventory/DownloadCommand.cs b/Programs/examples/TestClient/Commands/Inventory/DownloadCommand.cs index f9afe2bd..7eaa4288 100644 --- a/Programs/examples/TestClient/Commands/Inventory/DownloadCommand.cs +++ b/Programs/examples/TestClient/Commands/Inventory/DownloadCommand.cs @@ -44,7 +44,7 @@ namespace OpenMetaverse.TestClient // Start the asset download Client.Assets.RequestAsset(AssetID, assetType, true, Assets_OnAssetReceived); - if (DownloadHandle.WaitOne(120 * 1000, false)) + if (DownloadHandle.WaitOne(TimeSpan.FromMinutes(2), false)) { return Success ? $"Saved {AssetID}.{assetType.ToString().ToLower()}" : $"Failed to download asset {AssetID}, perhaps {assetType} is the incorrect asset type?"; diff --git a/Programs/examples/TestClient/Commands/Inventory/InventoryCommand.cs b/Programs/examples/TestClient/Commands/Inventory/InventoryCommand.cs index 7e96e23e..2bfe24dc 100644 --- a/Programs/examples/TestClient/Commands/Inventory/InventoryCommand.cs +++ b/Programs/examples/TestClient/Commands/Inventory/InventoryCommand.cs @@ -32,7 +32,7 @@ namespace OpenMetaverse.TestClient void PrintFolder(InventoryFolder f, StringBuilder result, int indent) { List contents = Manager.FolderContents(f.UUID, Client.Self.AgentID, - true, true, InventorySortOrder.ByName, 3000); + true, true, InventorySortOrder.ByName, TimeSpan.FromSeconds(3)); if (contents != null) { diff --git a/Programs/examples/TestClient/Commands/Inventory/ObjectInventoryCommand.cs b/Programs/examples/TestClient/Commands/Inventory/ObjectInventoryCommand.cs index f6b2857b..eaad0269 100644 --- a/Programs/examples/TestClient/Commands/Inventory/ObjectInventoryCommand.cs +++ b/Programs/examples/TestClient/Commands/Inventory/ObjectInventoryCommand.cs @@ -28,7 +28,7 @@ namespace OpenMetaverse.TestClient else return "Couldn't find prim " + objectID; - List items = Client.Inventory.GetTaskInventory(objectID, objectLocalID, 1000 * 30); + List items = Client.Inventory.GetTaskInventory(objectID, objectLocalID, TimeSpan.FromSeconds(30)); if (items != null) { diff --git a/Programs/examples/TestClient/Commands/Inventory/TaskRunningCommand.cs b/Programs/examples/TestClient/Commands/Inventory/TaskRunningCommand.cs index f102fb1b..c2861563 100644 --- a/Programs/examples/TestClient/Commands/Inventory/TaskRunningCommand.cs +++ b/Programs/examples/TestClient/Commands/Inventory/TaskRunningCommand.cs @@ -30,7 +30,7 @@ namespace OpenMetaverse.TestClient else return $"Couldn't find prim {objectID}"; - List items = Client.Inventory.GetTaskInventory(objectID, objectLocalID, 1000 * 30); + List items = Client.Inventory.GetTaskInventory(objectID, objectLocalID, TimeSpan.FromSeconds(30)); //bool wantSet = false; bool setTaskTo = false; diff --git a/Programs/examples/TestClient/Commands/Inventory/ViewNotecardCommand.cs b/Programs/examples/TestClient/Commands/Inventory/ViewNotecardCommand.cs index 8936b511..c221bcf9 100644 --- a/Programs/examples/TestClient/Commands/Inventory/ViewNotecardCommand.cs +++ b/Programs/examples/TestClient/Commands/Inventory/ViewNotecardCommand.cs @@ -1,3 +1,4 @@ +using System; using OpenMetaverse.Assets; namespace OpenMetaverse.TestClient @@ -58,7 +59,7 @@ namespace OpenMetaverse.TestClient ); // wait for reply or timeout - if (!waitEvent.WaitOne(10000, false)) + if (!waitEvent.WaitOne(TimeSpan.FromSeconds(10), false)) { result.Append("Timeout waiting for notecard to download."); } diff --git a/Programs/examples/TestClient/Commands/Land/AgentLocationsCommand.cs b/Programs/examples/TestClient/Commands/Land/AgentLocationsCommand.cs index 7a4e187c..ff252504 100644 --- a/Programs/examples/TestClient/Commands/Land/AgentLocationsCommand.cs +++ b/Programs/examples/TestClient/Commands/Land/AgentLocationsCommand.cs @@ -27,7 +27,7 @@ namespace OpenMetaverse.TestClient return "Usage: agentlocations [regionhandle]"; List items = Client.Grid.MapItems(regionHandle, GridItemType.AgentLocations, - GridLayerType.Objects, 1000 * 20); + GridLayerType.Objects, TimeSpan.FromSeconds(20)); if (items != null) { diff --git a/Programs/examples/TestClient/Commands/Land/ParcelInfoCommand.cs b/Programs/examples/TestClient/Commands/Land/ParcelInfoCommand.cs index 8a0e237c..fd64fa61 100644 --- a/Programs/examples/TestClient/Commands/Land/ParcelInfoCommand.cs +++ b/Programs/examples/TestClient/Commands/Land/ParcelInfoCommand.cs @@ -35,7 +35,7 @@ namespace OpenMetaverse.TestClient if (Client.Network.CurrentSim.IsParcelMapFull()) ParcelsDownloaded.Set(); - if (ParcelsDownloaded.WaitOne(30000, false) && Client.Network.Connected) + if (ParcelsDownloaded.WaitOne(TimeSpan.FromSeconds(30), false) && Client.Network.Connected) { sb.AppendFormat("Downloaded {0} Parcels in {1} " + System.Environment.NewLine, Client.Network.CurrentSim.Parcels.Count, Client.Network.CurrentSim.Name); diff --git a/Programs/examples/TestClient/Commands/Land/ParcelPrimOwnersCommand.cs b/Programs/examples/TestClient/Commands/Land/ParcelPrimOwnersCommand.cs index f9241fb5..10418e0a 100644 --- a/Programs/examples/TestClient/Commands/Land/ParcelPrimOwnersCommand.cs +++ b/Programs/examples/TestClient/Commands/Land/ParcelPrimOwnersCommand.cs @@ -39,7 +39,7 @@ namespace OpenMetaverse.TestClient Client.Parcels.ParcelObjectOwnersReply += callback; Client.Parcels.RequestObjectOwners(Client.Network.CurrentSim, parcelID); - if (!wait.WaitOne(10000, false)) + if (!wait.WaitOne(TimeSpan.FromSeconds(10), false)) { result.AppendLine("Timed out waiting for packet."); } diff --git a/Programs/examples/TestClient/Commands/Land/ParcelSelectObjectsCommand.cs b/Programs/examples/TestClient/Commands/Land/ParcelSelectObjectsCommand.cs index 3fa45656..197fc8f2 100644 --- a/Programs/examples/TestClient/Commands/Land/ParcelSelectObjectsCommand.cs +++ b/Programs/examples/TestClient/Commands/Land/ParcelSelectObjectsCommand.cs @@ -46,7 +46,7 @@ namespace OpenMetaverse.TestClient Client.Parcels.RequestObjectOwners(Client.Network.CurrentSim, parcelID); - if (!wait.WaitOne(30000, false)) + if (!wait.WaitOne(TimeSpan.FromSeconds(30), false)) { result.AppendLine("Timed out waiting for packet."); } diff --git a/Programs/examples/TestClient/Commands/Prims/ChangePermsCommand.cs b/Programs/examples/TestClient/Commands/Prims/ChangePermsCommand.cs index cd8a9361..0f22e0d9 100644 --- a/Programs/examples/TestClient/Commands/Prims/ChangePermsCommand.cs +++ b/Programs/examples/TestClient/Commands/Prims/ChangePermsCommand.cs @@ -62,20 +62,24 @@ namespace OpenMetaverse.TestClient // Find the requested prim var rootPrim = Client.Network.CurrentSim.ObjectsPrimitives.Find(prim => prim.ID == rootID); if (rootPrim == null) - return $"Cannot find requested prim {rootID}"; - else - Logger.DebugLog($"Found requested prim {rootPrim.ID}", Client); + { + return $"Cannot find requested prim {rootID}"; + + } + Logger.DebugLog($"Found requested prim {rootPrim.ID}", Client); if (rootPrim.ParentID != 0) { // This is not actually a root prim, find the root if (!Client.Network.CurrentSim.ObjectsPrimitives.TryGetValue(rootPrim.ParentID, out rootPrim)) + { return "Cannot find root prim for requested object"; - else - Logger.DebugLog($"Set root prim to {rootPrim.ID}", Client); + } + + Logger.DebugLog($"Set root prim to {rootPrim.ID}", Client); } - // Find all of the child objects linked to this root + // Find, find all the child objects linked to this root var childPrims = Client.Network.CurrentSim.ObjectsPrimitives.FindAll(prim => prim.ParentID == rootPrim.LocalID); // Build a dictionary of primitives for referencing later @@ -95,7 +99,7 @@ namespace OpenMetaverse.TestClient PermissionMask.Modify, (Perms & PermissionMask.Modify) == PermissionMask.Modify); PermsSent = true; - if (!GotPermissionsEvent.WaitOne(1000 * 30, false)) + if (!GotPermissionsEvent.WaitOne(TimeSpan.FromSeconds(30), false)) return "Failed to set the modify bit, permissions in an unknown state"; PermCount = 0; @@ -103,7 +107,7 @@ namespace OpenMetaverse.TestClient PermissionMask.Copy, (Perms & PermissionMask.Copy) == PermissionMask.Copy); PermsSent = true; - if (!GotPermissionsEvent.WaitOne(1000 * 30, false)) + if (!GotPermissionsEvent.WaitOne(TimeSpan.FromSeconds(30), false)) return "Failed to set the copy bit, permissions in an unknown state"; PermCount = 0; @@ -111,7 +115,7 @@ namespace OpenMetaverse.TestClient PermissionMask.Transfer, (Perms & PermissionMask.Transfer) == PermissionMask.Transfer); PermsSent = true; - if (!GotPermissionsEvent.WaitOne(1000 * 30, false)) + if (!GotPermissionsEvent.WaitOne(TimeSpan.FromSeconds(30), false)) return "Failed to set the transfer bit, permissions in an unknown state"; #endregion Set Linkset Permissions @@ -121,7 +125,7 @@ namespace OpenMetaverse.TestClient foreach (Primitive prim in Objects.Values) { if ((prim.Flags & PrimFlags.InventoryEmpty) != 0) continue; - List items = Client.Inventory.GetTaskInventory(prim.ID, prim.LocalID, 1000 * 30); + List items = Client.Inventory.GetTaskInventory(prim.ID, prim.LocalID, TimeSpan.FromSeconds(30)); if (items == null) continue; foreach (var item in items.Where(i => !(i is InventoryFolder)).Cast()) diff --git a/Programs/examples/TestClient/Commands/Prims/DownloadTextureCommand.cs b/Programs/examples/TestClient/Commands/Prims/DownloadTextureCommand.cs index 7b56e91d..7a11d771 100644 --- a/Programs/examples/TestClient/Commands/Prims/DownloadTextureCommand.cs +++ b/Programs/examples/TestClient/Commands/Prims/DownloadTextureCommand.cs @@ -42,7 +42,7 @@ namespace OpenMetaverse.TestClient Client.Assets.RequestImage(TextureID, ImageType.Normal, Assets_OnImageReceived); - if (DownloadHandle.WaitOne(120 * 1000, false)) + if (DownloadHandle.WaitOne(TimeSpan.FromMinutes(2), false)) { if (resultState == TextureRequestState.Finished) { diff --git a/Programs/examples/TestClient/Commands/Prims/ExportCommand.cs b/Programs/examples/TestClient/Commands/Prims/ExportCommand.cs index fe720fc3..ab693f95 100644 --- a/Programs/examples/TestClient/Commands/Prims/ExportCommand.cs +++ b/Programs/examples/TestClient/Commands/Prims/ExportCommand.cs @@ -71,7 +71,7 @@ namespace OpenMetaverse.TestClient // Check for export permission first Client.Objects.RequestObjectPropertiesFamily(Client.Network.CurrentSim, id); - GotPermissionsEvent.WaitOne(1000 * 10, false); + GotPermissionsEvent.WaitOne(TimeSpan.FromSeconds(20), false); if (!GotPermissions) { diff --git a/Programs/examples/TestClient/Commands/Prims/ImportCommand.cs b/Programs/examples/TestClient/Commands/Prims/ImportCommand.cs index b119416b..e03496df 100644 --- a/Programs/examples/TestClient/Commands/Prims/ImportCommand.cs +++ b/Programs/examples/TestClient/Commands/Prims/ImportCommand.cs @@ -108,7 +108,7 @@ namespace OpenMetaverse.TestClient Client.Objects.AddPrim(Client.Network.CurrentSim, linkset.RootPrim.PrimData, GroupID, linkset.RootPrim.Position, linkset.RootPrim.Scale, linkset.RootPrim.Rotation); - if (!primDone.WaitOne(10000, false)) + if (!primDone.WaitOne(TimeSpan.FromSeconds(10), false)) return "Rez failed, timed out while creating the root prim."; Client.Objects.SetPosition(Client.Network.CurrentSim, primsCreated[primsCreated.Count - 1].LocalID, linkset.RootPrim.Position); @@ -124,7 +124,7 @@ namespace OpenMetaverse.TestClient Client.Objects.AddPrim(Client.Network.CurrentSim, prim.PrimData, GroupID, currentPosition, prim.Scale, prim.Rotation); - if (!primDone.WaitOne(10000, false)) + if (!primDone.WaitOne(TimeSpan.FromSeconds(10), false)) return "Rez failed, timed out while creating child prim."; Client.Objects.SetPosition(Client.Network.CurrentSim, primsCreated[primsCreated.Count - 1].LocalID, currentPosition); @@ -144,7 +144,7 @@ namespace OpenMetaverse.TestClient state = ImporterState.Linking; Client.Objects.LinkPrims(Client.Network.CurrentSim, linkQueue); - if (primDone.WaitOne(1000 * linkset.Children.Count, false)) + if (primDone.WaitOne(TimeSpan.FromSeconds(linkset.Children.Count), false)) Client.Objects.SetRotation(Client.Network.CurrentSim, rootLocalID, rootRotation); else Console.WriteLine("Warning: Failed to link {0} prims", linkQueue.Count); diff --git a/Programs/examples/TestClient/Commands/Prims/PrimInfoCommand.cs b/Programs/examples/TestClient/Commands/Prims/PrimInfoCommand.cs index a852816c..627b3505 100644 --- a/Programs/examples/TestClient/Commands/Prims/PrimInfoCommand.cs +++ b/Programs/examples/TestClient/Commands/Prims/PrimInfoCommand.cs @@ -70,7 +70,7 @@ namespace OpenMetaverse.TestClient Client.Objects.SelectObject(Client.Network.CurrentSim, target.LocalID, true); - propsEvent.WaitOne(1000 * 10, false); + propsEvent.WaitOne(TimeSpan.FromSeconds(10), false); Client.Objects.ObjectProperties -= propsCallback; return "Done."; diff --git a/Programs/examples/TestClient/Commands/Voice/ParcelVoiceInfo.cs b/Programs/examples/TestClient/Commands/Voice/ParcelVoiceInfo.cs index 62fa2252..d6ac726f 100644 --- a/Programs/examples/TestClient/Commands/Voice/ParcelVoiceInfo.cs +++ b/Programs/examples/TestClient/Commands/Voice/ParcelVoiceInfo.cs @@ -43,7 +43,7 @@ namespace OpenMetaverse.TestClient { return "RequestParcelVoiceInfo failed. Not available for the current grid?"; } - ParcelVoiceInfoEvent.WaitOne(30 * 1000, false); + ParcelVoiceInfoEvent.WaitOne(TimeSpan.FromSeconds(30), false); if (string.IsNullOrEmpty(VoiceRegionName) && -1 == VoiceLocalID) { diff --git a/Programs/examples/TestClient/Commands/Voice/VoiceAcountCommand.cs b/Programs/examples/TestClient/Commands/Voice/VoiceAcountCommand.cs index e96d39b2..be77d484 100644 --- a/Programs/examples/TestClient/Commands/Voice/VoiceAcountCommand.cs +++ b/Programs/examples/TestClient/Commands/Voice/VoiceAcountCommand.cs @@ -42,7 +42,7 @@ namespace OpenMetaverse.TestClient { return "RequestProvisionAccount failed. Not available for the current grid?"; } - ProvisionEvent.WaitOne(30 * 1000, false); + ProvisionEvent.WaitOne(TimeSpan.FromSeconds(30), false); if (string.IsNullOrEmpty(VoiceAccount) && string.IsNullOrEmpty(VoicePassword)) { diff --git a/Programs/examples/TestClient/TestClient.cs b/Programs/examples/TestClient/TestClient.cs index 3fefc638..9f0809a7 100644 --- a/Programs/examples/TestClient/TestClient.cs +++ b/Programs/examples/TestClient/TestClient.cs @@ -174,7 +174,7 @@ namespace OpenMetaverse.TestClient { Groups.CurrentGroups += Groups_CurrentGroups; Groups.RequestCurrentGroups(); - GroupsEvent.WaitOne(10000, false); + GroupsEvent.WaitOne(TimeSpan.FromSeconds(10), false); Groups.CurrentGroups -= Groups_CurrentGroups; GroupsEvent.Reset(); }