diff --git a/OpenSim/Framework/AssetConfig.cs b/OpenSim/Framework/AssetConfig.cs
deleted file mode 100644
index 9ee41a14f1..0000000000
--- a/OpenSim/Framework/AssetConfig.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System;
-using System.IO;
-
-namespace OpenSim.Framework
-{
- ///
- /// AssetConfig -- For Asset Server Configuration
- ///
- public class AssetConfig:ConfigBase
- {
- public string DatabaseConnect = String.Empty;
- public string DatabaseProvider = String.Empty;
- public uint HttpPort = ConfigSettings.DefaultAssetServerHttpPort;
- public string AssetSetsLocation = string.Empty;
-
- public AssetConfig(string description, string filename)
- {
- m_configMember =
- new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, true);
- m_configMember.performConfigurationRetrieve();
- }
-
- public void loadConfigurationOptions()
- {
- m_configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
- "DLL for database provider", "OpenSim.Data.MySQL.dll", false);
-
- m_configMember.addConfigurationOption("database_connect", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
- "Database connection string", "", false);
-
- m_configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
- "Http Listener port", ConfigSettings.DefaultAssetServerHttpPort.ToString(), false);
-
- m_configMember.addConfigurationOption("assetset_location", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
- "Location of 'AssetSets.xml'",
- string.Format(".{0}assets{0}AssetSets.xml", Path.DirectorySeparatorChar), false);
- }
-
- public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
- {
- switch (configuration_key)
- {
- case "database_provider":
- DatabaseProvider = (string) configuration_result;
- break;
- case "database_connect":
- DatabaseConnect = (string) configuration_result;
- break;
- case "assetset_location":
- AssetSetsLocation = (string) configuration_result;
- break;
- case "http_port":
- HttpPort = (uint) configuration_result;
- break;
- }
-
- return true;
- }
- }
-}
diff --git a/OpenSim/Framework/AssetRequest.cs b/OpenSim/Framework/AssetRequest.cs
deleted file mode 100644
index fa4e2f9bfe..0000000000
--- a/OpenSim/Framework/AssetRequest.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using OpenMetaverse;
-
-namespace OpenSim.Framework
-{
- public struct AssetRequest
- {
- public UUID AssetID;
- public bool IsTexture;
- }
-}
diff --git a/OpenSim/Framework/AssetStorage.cs b/OpenSim/Framework/AssetStorage.cs
deleted file mode 100644
index 7dab2f2fcf..0000000000
--- a/OpenSim/Framework/AssetStorage.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using OpenMetaverse;
-
-namespace OpenSim.Framework
-{
- public class AssetStorage
- {
- public byte[] Data;
- public string Name;
- public sbyte Type;
- public UUID UUID;
-
- public AssetStorage()
- {
- }
-
- public AssetStorage(UUID assetUUID)
- {
- UUID = assetUUID;
- }
- }
-}
diff --git a/OpenSim/Framework/IAssetCache.cs b/OpenSim/Framework/IAssetCache.cs
deleted file mode 100644
index 654180d42b..0000000000
--- a/OpenSim/Framework/IAssetCache.cs
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using OpenMetaverse;
-using OpenMetaverse.Packets;
-
-namespace OpenSim.Framework
-{
- public delegate void AssetRequestCallback(UUID assetId, AssetBase asset);
-
- ///
- /// Interface to the local asset cache. This is the mechanism through which assets can be added and requested.
- ///
- public interface IAssetCache : IPlugin
- {
- ///
- /// The 'server' from which assets can be requested and to which assets are persisted.
- ///
-
- void Initialise(ConfigSettings cs);
-
- ///
- /// Report statistical data to the log.
- ///
- void ShowState();
-
- ///
- /// Clear the asset cache.
- ///
- void Clear();
-
- ///
- /// Get an asset only if it's already in the cache.
- ///
- ///
- ///
- /// true if the asset was in the cache, false if it was not
- bool TryGetCachedAsset(UUID assetID, out AssetBase asset);
-
- ///
- /// Asynchronously retrieve an asset.
- ///
- ///
- ///
- ///
- /// A callback invoked when the asset has either been found or not found.
- /// If the asset was found this is called with the asset UUID and the asset data
- /// If the asset was not found this is still called with the asset UUID but with a null asset data reference
- void GetAsset(UUID assetID, AssetRequestCallback callback, bool isTexture);
-
- ///
- /// Synchronously retreive an asset. If the asset isn't in the cache, a request will be made to the persistent store to
- /// load it into the cache.
- ///
- ///
- /// XXX We'll keep polling the cache until we get the asset or we exceed
- /// the allowed number of polls. This isn't a very good way of doing things since a single thread
- /// is processing inbound packets, so if the asset server is slow, we could block this for up to
- /// the timeout period. Whereever possible we want to use the asynchronous callback GetAsset()
- ///
- ///
- ///
- /// null if the asset could not be retrieved
- AssetBase GetAsset(UUID assetID, bool isTexture);
-
- ///
- /// Add an asset to both the persistent store and the cache.
- ///
- ///
- void AddAsset(AssetBase asset);
-
- ///
- /// Expire an asset from the cache
- ///
- /// Allows you to clear a specific asset by uuid out
- /// of the asset cache. This is needed because the osdynamic
- /// texture code grows the asset cache without bounds. The
- /// real solution here is a much better cache archicture, but
- /// this is a stop gap measure until we have such a thing.
- void ExpireAsset(UUID assetID);
-
- ///
- /// Handle an asset request from the client. The result will be sent back asynchronously.
- ///
- ///
- ///
- void AddAssetRequest(IClientAPI userInfo, TransferRequestPacket transferRequest);
- }
-
-}
diff --git a/OpenSim/Framework/InventoryConfig.cs b/OpenSim/Framework/InventoryConfig.cs
deleted file mode 100644
index f539d556d7..0000000000
--- a/OpenSim/Framework/InventoryConfig.cs
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System;
-
-namespace OpenSim.Framework
-{
- ///
- /// Defines and handles inventory grid server configuration
- ///
- public class InventoryConfig:ConfigBase
- {
- public string DatabaseConnect = String.Empty;
- public string DatabaseProvider = String.Empty;
- public string DefaultStartupMsg = String.Empty;
- public uint HttpPort = ConfigSettings.DefaultInventoryServerHttpPort;
- public string InventoryServerURL = String.Empty;
- public string UserServerURL = String.Empty;
- public string AssetServerURL = String.Empty;
- public bool SessionLookUp = true;
- public bool RegionAccessToAgentsInventory = true;
-
- public InventoryConfig(string description, string filename)
- {
- m_configMember =
- new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, true);
- m_configMember.performConfigurationRetrieve();
- }
-
- public void loadConfigurationOptions()
- {
- m_configMember.addConfigurationOption("default_inventory_server",
- ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
- "Default Inventory Server URI (this server's external name)",
- "http://127.0.0.1:8004", false);
- m_configMember.addConfigurationOption("default_user_server",
- ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
- "Default User Server URI",
- "http://127.0.0.1:8002", false);
- m_configMember.addConfigurationOption("default_asset_server",
- ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
- "Default Asset Server URI",
- "http://127.0.0.1:8003", false);
- m_configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
- "DLL for database provider", "OpenSim.Data.MySQL.dll", false);
- m_configMember.addConfigurationOption("database_connect", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
- "Database Connect String", "", false);
- m_configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
- "Http Listener port", ConfigSettings.DefaultInventoryServerHttpPort.ToString(), false);
- m_configMember.addConfigurationOption("session_lookup", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
- "Enable session lookup security", "False", false);
- m_configMember.addConfigurationOption("region_access", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
- "Allow direct region access to users inventories? (Keep True if you don't know what this is about)", "True", false);
- }
-
- public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
- {
- switch (configuration_key)
- {
- case "default_inventory_server":
- InventoryServerURL = (string)configuration_result;
- break;
- case "default_user_server":
- UserServerURL = (string) configuration_result;
- break;
- case "default_asset_server":
- AssetServerURL = (string)configuration_result;
- break;
- case "database_provider":
- DatabaseProvider = (string) configuration_result;
- break;
- case "database_connect":
- DatabaseConnect = (string) configuration_result;
- break;
- case "http_port":
- HttpPort = (uint) configuration_result;
- break;
- case "session_lookup":
- SessionLookUp = (bool)configuration_result;
- break;
- case "region_access":
- RegionAccessToAgentsInventory = (bool)configuration_result;
- break;
- }
-
- return true;
- }
- }
-}
diff --git a/OpenSim/Framework/NeighbourInfo.cs b/OpenSim/Framework/NeighbourInfo.cs
deleted file mode 100644
index 3a46fbb1b2..0000000000
--- a/OpenSim/Framework/NeighbourInfo.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-namespace OpenSim.Framework
-{
- public class NeighbourInfo
- {
- public ulong regionhandle;
- public uint RegionLocX;
- public uint RegionLocY;
- public string sim_ip;
- public uint sim_port;
-
- public NeighbourInfo()
- {
- }
- }
-}
\ No newline at end of file
diff --git a/OpenSim/Framework/Parallel.cs b/OpenSim/Framework/Parallel.cs
deleted file mode 100644
index a0394f2c25..0000000000
--- a/OpenSim/Framework/Parallel.cs
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System;
-using System.Collections.Generic;
-using System.Threading;
-
-namespace OpenSim.Framework
-{
- ///
- /// Provides helper methods for parallelizing loops
- ///
- public static class Parallel
- {
- public static readonly int ProcessorCount = System.Environment.ProcessorCount;
-
- ///
- /// Executes a for loop in which iterations may run in parallel
- ///
- /// The loop will be started at this index
- /// The loop will be terminated before this index is reached
- /// Method body to run for each iteration of the loop
- public static void For(int fromInclusive, int toExclusive, Action body)
- {
- For(ProcessorCount, fromInclusive, toExclusive, body);
- }
-
- ///
- /// Executes a for loop in which iterations may run in parallel
- ///
- /// The number of concurrent execution threads to run
- /// The loop will be started at this index
- /// The loop will be terminated before this index is reached
- /// Method body to run for each iteration of the loop
- public static void For(int threadCount, int fromInclusive, int toExclusive, Action body)
- {
- int counter = threadCount;
- AutoResetEvent threadFinishEvent = new AutoResetEvent(false);
- Exception exception = null;
-
- --fromInclusive;
-
- for (int i = 0; i < threadCount; i++)
- {
- Util.FireAndForget(
- delegate(object o)
- {
-// int threadIndex = (int)o;
-
- while (exception == null)
- {
- int currentIndex = Interlocked.Increment(ref fromInclusive);
-
- if (currentIndex >= toExclusive)
- break;
-
- try { body(currentIndex); }
- catch (Exception ex) { exception = ex; break; }
- }
-
- if (Interlocked.Decrement(ref counter) == 0)
- threadFinishEvent.Set();
- }, i
- );
- }
-
- threadFinishEvent.WaitOne();
- threadFinishEvent.Close();
-
- if (exception != null)
- throw new Exception(exception.Message, exception);
- }
-
- ///
- /// Executes a foreach loop in which iterations may run in parallel
- ///
- /// Object type that the collection wraps
- /// An enumerable collection to iterate over
- /// Method body to run for each object in the collection
- public static void ForEach(IEnumerable enumerable, Action body)
- {
- ForEach(ProcessorCount, enumerable, body);
- }
-
- ///
- /// Executes a foreach loop in which iterations may run in parallel
- ///
- /// Object type that the collection wraps
- /// The number of concurrent execution threads to run
- /// An enumerable collection to iterate over
- /// Method body to run for each object in the collection
- public static void ForEach(int threadCount, IEnumerable enumerable, Action body)
- {
- int counter = threadCount;
- AutoResetEvent threadFinishEvent = new AutoResetEvent(false);
- IEnumerator enumerator = enumerable.GetEnumerator();
- object syncRoot = new object();
- Exception exception = null;
-
- for (int i = 0; i < threadCount; i++)
- {
- Util.FireAndForget(
- delegate(object o)
- {
-// int threadIndex = (int)o;
-
- while (exception == null)
- {
- T entry;
-
- lock (syncRoot)
- {
- if (!enumerator.MoveNext())
- break;
- entry = (T)enumerator.Current; // Explicit typecast for Mono's sake
- }
-
- try { body(entry); }
- catch (Exception ex) { exception = ex; break; }
- }
-
- if (Interlocked.Decrement(ref counter) == 0)
- threadFinishEvent.Set();
- }, i
- );
- }
-
- threadFinishEvent.WaitOne();
- threadFinishEvent.Close();
-
- if (exception != null)
- throw new Exception(exception.Message, exception);
- }
-
- ///
- /// Executes a series of tasks in parallel
- ///
- /// A series of method bodies to execute
- public static void Invoke(params Action[] actions)
- {
- Invoke(ProcessorCount, actions);
- }
-
- ///
- /// Executes a series of tasks in parallel
- ///
- /// The number of concurrent execution threads to run
- /// A series of method bodies to execute
- public static void Invoke(int threadCount, params Action[] actions)
- {
- int counter = threadCount;
- AutoResetEvent threadFinishEvent = new AutoResetEvent(false);
- int index = -1;
- Exception exception = null;
-
- for (int i = 0; i < threadCount; i++)
- {
- Util.FireAndForget(
- delegate(object o)
- {
-// int threadIndex = (int)o;
-
- while (exception == null)
- {
- int currentIndex = Interlocked.Increment(ref index);
-
- if (currentIndex >= actions.Length)
- break;
-
- try { actions[currentIndex](); }
- catch (Exception ex) { exception = ex; break; }
- }
-
- if (Interlocked.Decrement(ref counter) == 0)
- threadFinishEvent.Set();
- }, i
- );
- }
-
- threadFinishEvent.WaitOne();
- threadFinishEvent.Close();
-
- if (exception != null)
- throw new Exception(exception.Message, exception);
- }
- }
-}
diff --git a/OpenSim/Framework/ProxyCodec.cs b/OpenSim/Framework/ProxyCodec.cs
deleted file mode 100644
index 130581aac8..0000000000
--- a/OpenSim/Framework/ProxyCodec.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System;
-using System.Net;
-
-namespace OpenSim.Framework
-{
- public sealed class ProxyCodec
- {
- public static void EncodeProxyMessage(byte[] bytes, ref int numBytes, EndPoint trueEP)
- {
- if (numBytes > 4090) // max UPD size = 4096
- {
- throw new Exception("ERROR: No space to encode the proxy EP");
- }
-
- ushort port = (ushort) ((IPEndPoint) trueEP).Port;
- bytes[numBytes++] = (byte) (port % 256);
- bytes[numBytes++] = (byte) (port / 256);
-
- foreach (byte b in ((IPEndPoint) trueEP).Address.GetAddressBytes())
- {
- bytes[numBytes++] = b;
- }
- }
-
- public static IPEndPoint DecodeProxyMessage(byte[] bytes, ref int numBytes)
- {
- // IPv4 Only
- byte[] addr = new byte[4];
-
- addr[3] = bytes[--numBytes];
- addr[2] = bytes[--numBytes];
- addr[1] = bytes[--numBytes];
- addr[0] = bytes[--numBytes];
-
- ushort port = (ushort) (bytes[--numBytes] * 256);
- port += (ushort) bytes[--numBytes];
-
- return new IPEndPoint(new IPAddress(addr), (int) port);
- }
- }
-}
diff --git a/OpenSim/Framework/RegionUpData.cs b/OpenSim/Framework/RegionUpData.cs
deleted file mode 100644
index 12e444215b..0000000000
--- a/OpenSim/Framework/RegionUpData.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System;
-
-namespace OpenSim.Framework
-{
- [Serializable]
- public class RegionUpData
- {
- private string m_ipaddr = "";
- private int m_port = 0;
- private uint m_X = 0;
- private uint m_Y = 0;
-
- public RegionUpData(uint X, uint Y, string ipaddr, int port)
- {
- m_X = X;
- m_Y = Y;
- m_ipaddr = ipaddr;
- m_port = port;
- }
-
- public uint X
- {
- get { return m_X; }
- }
-
- public uint Y
- {
- get { return m_Y; }
- }
-
- public string IPADDR
- {
- get { return m_ipaddr; }
- }
-
- public int PORT
- {
- get { return m_port; }
- }
- }
-}
\ No newline at end of file
diff --git a/OpenSim/Framework/Remoting.cs b/OpenSim/Framework/Remoting.cs
deleted file mode 100644
index 75024ef34c..0000000000
--- a/OpenSim/Framework/Remoting.cs
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System;
-using System.Security.Cryptography;
-using System.Text;
-
-namespace OpenSim.Framework
-{
- ///
- /// NEEDS AUDIT.
- ///
- ///
- /// Suggested implementation
- /// Store two digests for each foreign host. A local copy of the local hash using the local challenge (when issued), and a local copy of the remote hash using the remote challenge.
- /// When sending data to the foreign host - run 'Sign' on the data and affix the returned byte[] to the message.
- /// When receiving data from the foreign host - run 'Authenticate' against the data and the attached byte[].
- /// Both hosts should be performing these operations for this to be effective.
- ///
- internal class RemoteDigest
- {
- private byte[] currentHash;
- private byte[] secret;
-
- private SHA512Managed SHA512;
-
- ///
- /// Initialises a new RemoteDigest authentication mechanism
- ///
- /// Needs an audit by a cryptographic professional - was not "roll your own"'d by choice but rather a serious lack of decent authentication mechanisms in .NET remoting
- /// The shared secret between systems (for inter-sim, this is provided in encrypted form during connection, for grid this is input manually in setup)
- /// Binary salt - some common value - to be decided what
- /// The challenge key provided by the third party
- public RemoteDigest(string sharedSecret, byte[] salt, string challenge)
- {
- SHA512 = new SHA512Managed();
- Rfc2898DeriveBytes RFC2898 = new Rfc2898DeriveBytes(sharedSecret, salt);
- secret = RFC2898.GetBytes(512);
- ASCIIEncoding ASCII = new ASCIIEncoding();
-
- currentHash = SHA512.ComputeHash(AppendArrays(secret, ASCII.GetBytes(challenge)));
- }
-
- ///
- /// Authenticates a piece of incoming data against the local digest. Upon successful authentication, digest string is incremented.
- ///
- /// The incoming data
- /// The remote digest
- ///
- public bool Authenticate(byte[] data, byte[] digest)
- {
- byte[] newHash = SHA512.ComputeHash(AppendArrays(AppendArrays(currentHash, secret), data));
- if (digest == newHash)
- {
- currentHash = newHash;
- return true;
- }
- else
- {
- throw new Exception("Hash comparison failed. Key resync required.");
- }
- }
-
- ///
- /// Signs a new bit of data with the current hash. Returns a byte array which should be affixed to the message.
- /// Signing a piece of data will automatically increment the hash - if you sign data and do not send it, the
- /// hashes will get out of sync and throw an exception when validation is attempted.
- ///
- /// The outgoing data
- /// The local digest
- public byte[] Sign(byte[] data)
- {
- currentHash = SHA512.ComputeHash(AppendArrays(AppendArrays(currentHash, secret), data));
- return currentHash;
- }
-
- ///
- /// Generates a new challenge string to be issued to a foreign host. Challenges are 1024-bit (effective strength of less than 512-bits) messages generated using the Crytographic Random Number Generator.
- ///
- /// A 128-character hexadecimal string containing the challenge.
- public static string GenerateChallenge()
- {
- RNGCryptoServiceProvider RNG = new RNGCryptoServiceProvider();
- byte[] bytes = new byte[64];
- RNG.GetBytes(bytes);
-
- StringBuilder sb = new StringBuilder(bytes.Length * 2);
- foreach (byte b in bytes)
- {
- sb.AppendFormat("{0:x2}", b);
- }
- return sb.ToString();
- }
-
- ///
- /// Helper function, merges two byte arrays
- ///
- /// Sourced from MSDN Forum
- /// A
- /// B
- /// C
- private static byte[] AppendArrays(byte[] a, byte[] b)
- {
- byte[] c = new byte[a.Length + b.Length];
- Buffer.BlockCopy(a, 0, c, 0, a.Length);
- Buffer.BlockCopy(b, 0, c, a.Length, b.Length);
- return c;
- }
- }
-}
\ No newline at end of file
diff --git a/OpenSim/Framework/SerializableInventory.cs b/OpenSim/Framework/SerializableInventory.cs
deleted file mode 100644
index 6c7f3ff677..0000000000
--- a/OpenSim/Framework/SerializableInventory.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System.Collections;
-using System.Xml.Serialization;
-
-namespace OpenSim.Framework
-{
- /*
- * .Net has some issues, serializing a dictionary, so we cannot reuse the InventoryFolder
- * class defined in Communications.Framework.Communications.Caches. So we serialize/deserialize
- * into this simpler class, and then use that.
- */
-
- [XmlRoot(ElementName = "inventory", IsNullable = true)]
- public class SerializableInventory
- {
- [XmlElement(ElementName = "folder", IsNullable = true)] public SerializableFolder root;
-
- #region Nested type: SerializableFolder
-
- [XmlRoot(ElementName = "folder", IsNullable = true)]
- public class SerializableFolder : InventoryFolderBase
- {
- [XmlArray(ElementName = "items", IsNullable = true)] [XmlArrayItem(ElementName = "item", IsNullable = true, Type = typeof (InventoryItemBase))] public ArrayList
- Items;
-
- [XmlArray(ElementName = "folders", IsNullable = true)] [XmlArrayItem(ElementName = "folder", IsNullable = true, Type = typeof (SerializableFolder))] public
- ArrayList SubFolders;
- }
-
- #endregion
- }
-}
\ No newline at end of file
diff --git a/OpenSim/Framework/WearableItem.cs b/OpenSim/Framework/WearableItem.cs
deleted file mode 100644
index 159306acc0..0000000000
--- a/OpenSim/Framework/WearableItem.cs
+++ /dev/null
@@ -1,355 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the OpenSimulator Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.IO;
-using System.Text.RegularExpressions;
-using OpenMetaverse;
-
-namespace OpenSim.Framework
-{
- public class WearableItem
- {
- public string WearableName = "";
- public WearableType WearType = WearableType.Invalid;
-
- public string ItemInfo = "Created Wearable";
-
- public SortedList VisualSettings = new SortedList();
- // public LLObject.TextureEntry TextureEntry = null;
- //public byte[] TextureEntry = null;
-
- public List TextureStrings = new List();
-
- //permissions
- public uint BaseMask = 0;
- public uint OwnerMask = 0;
- public uint GroupMask = 0;
- public uint EveryoneMask = 0;
- public uint NextOwnerMask = 0;
-
- public UUID CreatorID = UUID.Zero;
- public UUID OwnerID = UUID.Zero;
- public UUID LastOwnerID = UUID.Zero;
- public UUID GroupID = UUID.Zero;
-
- //sale
- public string SaleType = "not";
- public int SalePrice = 10;
-
- private string BuildString = "";
-
-
- public WearableItem(string wearableName, WearableType type)
- {
- WearableName = wearableName;
- WearType = type;
- }
-
- public WearableItem(string wearableName)
- {
- WearableName = wearableName;
- WearType = ConvertNameToType(WearableName);
- }
-
- public WearableItem(WearableType type)
- {
- WearType = type;
- WearableName = Enum.GetName(typeof(WearableType), type).ToLower();
- }
-
- public WearableItem()
- {
- }
-
- public void AddVisualSetting(VisualSetting setting)
- {
- if (!VisualSettings.ContainsKey(setting.VisualParam.ParamID))
- {
- VisualSettings.Add(setting.VisualParam.ParamID, setting);
- }
- }
-
- public bool TryGetSetting(string paramName, out VisualSetting paramSetting)
- {
- foreach (VisualSetting setting in VisualSettings.Values)
- {
- if (setting.VisualParam.Name == paramName)
- {
- paramSetting = setting;
- return true;
- }
- }
-
- paramSetting = null;
- return false;
- }
-
- public bool SetParamValue(string paramName, float value)
- {
- VisualSetting paramSetting;
- if (TryGetSetting(paramName, out paramSetting))
- {
- if ((value >= paramSetting.VisualParam.MinValue) && (value <= paramSetting.VisualParam.MaxValue))
- {
- paramSetting.Value = value;
- return true;
- }
- }
- return false;
- }
-
- public void RandomiseValues()
- {
- foreach (VisualSetting setting in VisualSettings.Values)
- {
- //int randNum = Util.RandomClass.Next(0, 1000);
- float range = setting.VisualParam.MaxValue - setting.VisualParam.MinValue;
- // float val = ((float) randNum) / ((float)(1000.0f / range));
- float val = (float)Util.RandomClass.NextDouble() * range * 0.2f;
- setting.Value = setting.VisualParam.MinValue + (range / 2) + val;
- }
- }
-
- public WearableType ConvertNameToType(string name)
- {
- return (WearableType)Enum.Parse(typeof(WearableType), name, true);
- }
-
- public string ToAssetFormat()
- {
- BuildString = "LLWearable version 22\n";
- BuildString += "New Item \n";
- BuildString += ItemInfo + "\n";
-
-
- AddSectionStart("permissions");
- AddTabbedNameValueLine("base_mask", BaseMask.ToString("00000000"));
- AddTabbedNameValueLine("owner_mask", OwnerMask.ToString("00000000"));
- AddTabbedNameValueLine("group_mask", GroupMask.ToString("00000000"));
- AddTabbedNameValueLine("everyone_mask", EveryoneMask.ToString("00000000"));
- AddTabbedNameValueLine("next_owner_mask", NextOwnerMask.ToString("00000000"));
- AddTabbedNameValueLine("creator_id", CreatorID.ToString());
- AddTabbedNameValueLine("owner_id", OwnerID.ToString());
- AddTabbedNameValueLine("last_owner_id", LastOwnerID.ToString());
- AddTabbedNameValueLine("group_id", GroupID.ToString());
- AddSectionEnd();
-
- AddSectionStart("sale_info");
- AddTabbedNameValueLine("sale_type", SaleType.ToString());
- AddTabbedNameValueLine("sale_price", SalePrice.ToString());
- AddSectionEnd();
-
- AddNameValueLine("type", ((byte)WearType).ToString());
- AddNameValueLine("parameters", VisualSettings.Count.ToString());
-
- foreach (KeyValuePair kp in VisualSettings)
- {
- AddNameValueLine(kp.Key.ToString(), kp.Value.Value.ToString(CultureInfo.InvariantCulture));
- }
- if (TextureStrings.Count == 0)
- {
- AddNameValueLine("textures", "0"); //todo output texture entry
- }
- else
- {
- AddNameValueLine("textures", TextureStrings.Count.ToString());
- for (int i = 0; i < TextureStrings.Count; i++)
- {
- BuildString += TextureStrings[i] + "\n";
- }
- BuildString += "\n";
-
- }
-
- return BuildString;
- }
-
- public void SaveToFile(string fileName)
- {
- File.WriteAllText(fileName, this.ToAssetFormat());
- }
-
- public void AddSectionStart(string sectionName)
- {
- BuildString += "\t" + sectionName + " 0\n";
- BuildString += "\t{\n";
- }
-
- public void AddSectionEnd()
- {
- BuildString += "\t}\n";
- }
-
- private void AddTabbedNameValueLine(string name, string value)
- {
- BuildString += "\t\t";
- BuildString += name + "\t";
- BuildString += value + "\n";
- }
-
- private void AddNameValueLine(string name, string value)
- {
- // BuildString += "\t\t";
- BuildString += name + " ";
- BuildString += value + "\n";
- }
-
- #region Static Methods
- public static List FindParamsForWearable(string wearableName)
- {
- List wearableParams = new List();
- foreach (VisualParam param in VisualParams.Params.Values)
- {
- if (param.Wearable == wearableName)
- {
- wearableParams.Add(param);
- }
- }
-
- return wearableParams;
- }
-
- public static WearableItem Create(string wearableTypeName)
- {
- WearableItem wearableItem = new WearableItem(wearableTypeName);
- List typeParams = FindParamsForWearable(wearableTypeName);
- foreach (VisualParam param in typeParams)
- {
- wearableItem.AddVisualSetting(new VisualSetting(param));
- }
- return wearableItem;
- }
-
- public static WearableItem CreateFromAsset(string assetData)
- {
- UUID creatorID = UUID.Zero;
- UUID ownerID = UUID.Zero;
- UUID lastOwnerID = UUID.Zero;
- UUID groupID = UUID.Zero;
-
- char[] newlineDelimiter = { '\n' };
- string[] lines = assetData.Split(newlineDelimiter);
-
- WearableItem wearableObject = null;
- Regex r = new Regex("[\t ]+");
- bool reachedParams = false;
- bool reachedTextures = false;
- foreach (string line in lines)
- {
- string trimLine = line.Trim();
- // m_log.Debug("line : " + trimLine);
-
- string[] splitLine = r.Split(trimLine);
- if (splitLine.Length > 1)
- {
- switch (splitLine[0])
- {
- case "textures":
- reachedParams = false;
- reachedTextures = true;
- break;
-
- case "type":
- string wearableTypeName = Enum.GetName(typeof(WearableType), (WearableType)Convert.ToInt32(splitLine[1]));
- wearableObject = Create(wearableTypeName.ToLower());
- break;
-
- case "parameters":
- reachedParams = true;
- break;
-
- case "creator_id":
- creatorID = new UUID(splitLine[1]);
- break;
-
- case "owner_id":
- ownerID = new UUID(splitLine[1]);
- break;
-
- case "last_owner_id":
- lastOwnerID = new UUID(splitLine[1]);
- break;
-
- case "group_id":
- groupID = new UUID(splitLine[1]);
- break;
-
- default:
- if ((wearableObject != null) && (reachedParams))
- {
- int id = Convert.ToInt32(splitLine[0]);
- if (wearableObject.VisualSettings.ContainsKey(id))
- {
-
- wearableObject.VisualSettings[id].Value = Convert.ToSingle(splitLine[1], CultureInfo.InvariantCulture);
- }
- }
- else if ((wearableObject != null) && (reachedTextures))
- {
- wearableObject.TextureStrings.Add(line);
- }
- break;
- }
- }
- }
-
- if (wearableObject != null)
- {
- wearableObject.CreatorID = creatorID;
- wearableObject.OwnerID = ownerID;
- wearableObject.LastOwnerID = lastOwnerID;
- wearableObject.GroupID = groupID;
- }
-
- return wearableObject;
- }
- #endregion
-
- #region Nested Class
- public class VisualSetting
- {
- public VisualParam VisualParam;
- public float Value = 0;
-
- public VisualSetting(VisualParam param, float value)
- {
- VisualParam = param;
- Value = value;
- }
-
- public VisualSetting(VisualParam param)
- {
- VisualParam = param;
- Value = param.DefaultValue;
- }
- }
- #endregion
- }
-}