* Breaking all the code, breaking all the code..!

* Made a bunch more members static, removed some dead code, general cleaning.
0.6.0-stable
Adam Frisby 2008-05-01 16:23:53 +00:00
parent 5231903778
commit 01f31fd933
27 changed files with 61 additions and 72 deletions

View File

@ -1352,7 +1352,7 @@ namespace OpenSim.Data.SQLite
*
**********************************************************************/
private SqliteCommand createInsertCommand(string table, DataTable dt)
private static SqliteCommand createInsertCommand(string table, DataTable dt)
{
/**
* This is subtle enough to deserve some commentary.
@ -1387,7 +1387,7 @@ namespace OpenSim.Data.SQLite
return cmd;
}
private SqliteCommand createUpdateCommand(string table, string pk, DataTable dt)
private static SqliteCommand createUpdateCommand(string table, string pk, DataTable dt)
{
string sql = "update " + table + " set ";
string subsql = String.Empty;
@ -1415,7 +1415,7 @@ namespace OpenSim.Data.SQLite
}
private string defineTable(DataTable dt)
private static string defineTable(DataTable dt)
{
string sql = "create table " + dt.TableName + "(";
string subsql = String.Empty;
@ -1457,7 +1457,7 @@ namespace OpenSim.Data.SQLite
/// for us.
///</summary>
///<returns>a built sqlite parameter</returns>
private SqliteParameter createSqliteParameter(string name, Type type)
private static SqliteParameter createSqliteParameter(string name, Type type)
{
SqliteParameter param = new SqliteParameter();
param.ParameterName = ":" + name;

View File

@ -784,7 +784,7 @@ namespace OpenSim.Data.SQLite
conn.Close();
}
private bool TestTables(SqliteConnection conn)
private static bool TestTables(SqliteConnection conn)
{
SqliteCommand cmd = new SqliteCommand(userSelect, conn);
SqliteCommand fcmd = new SqliteCommand(userFriendsSelect, conn);

View File

@ -43,7 +43,7 @@ namespace OpenSim.Framework.AssetLoader.Filesystem
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected AssetBase CreateAsset(string assetIdStr, string name, string path, bool isImage)
protected static AssetBase CreateAsset(string assetIdStr, string name, string path, bool isImage)
{
AssetBase asset = new AssetBase(
new LLUUID(assetIdStr),
@ -64,7 +64,7 @@ namespace OpenSim.Framework.AssetLoader.Filesystem
return asset;
}
protected void LoadAsset(AssetBase info, bool image, string path)
protected static void LoadAsset(AssetBase info, bool image, string path)
{
FileInfo fInfo = new FileInfo(path);
long numBytes = fInfo.Length;
@ -119,9 +119,9 @@ namespace OpenSim.Framework.AssetLoader.Filesystem
/// <summary>
/// Use the asset set information at path to load assets
/// </summary>
/// <param name="path"></param>
/// <param name="assetSetPath"></param>
/// <param name="assets"></param>
protected void LoadXmlAssetSet(string assetSetPath, List<AssetBase> assets)
protected static void LoadXmlAssetSet(string assetSetPath, List<AssetBase> assets)
{
m_log.InfoFormat("[ASSETS]: Loading asset set {0}", assetSetPath);

View File

@ -542,7 +542,7 @@ namespace OpenSim.Framework.Communications.Cache
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
private int CalculateNumPackets(byte[] data)
private static int CalculateNumPackets(byte[] data)
{
const uint m_maxPacketSize = 600;
int numPackets = 1;

View File

@ -241,7 +241,7 @@ namespace OpenSim.Framework.Communications.Cache
/// <param name="path"></param>
/// <param name="fileDescription"></param>
/// <param name="action"></param>
private void LoadFromFile(string path, string fileDescription, ConfigAction action)
private static void LoadFromFile(string path, string fileDescription, ConfigAction action)
{
if (File.Exists(path))
{

View File

@ -378,7 +378,7 @@ namespace OpenSim.Framework.Communications.Capabilities
///
/// </summary>
/// <returns></returns>
protected LLSDMapLayer GetLLSDMapLayerResponse()
protected static LLSDMapLayer GetLLSDMapLayerResponse()
{
LLSDMapLayer mapLayer = new LLSDMapLayer();
mapLayer.Right = 5000;
@ -758,7 +758,7 @@ namespace OpenSim.Framework.Communications.Capabilities
// bw.Close();
// fs.Close();
//}
private void SaveAssetToFile(string filename, byte[] data)
private static void SaveAssetToFile(string filename, byte[] data)
{
string assetPath = "UserAssets";
if (!Directory.Exists(assetPath))
@ -840,7 +840,7 @@ namespace OpenSim.Framework.Communications.Capabilities
// bw.Close();
// fs.Close();
//}
private void SaveAssetToFile(string filename, byte[] data)
private static void SaveAssetToFile(string filename, byte[] data)
{
string assetPath = "UserAssets";
if (!Directory.Exists(assetPath))
@ -945,7 +945,7 @@ namespace OpenSim.Framework.Communications.Capabilities
// bw.Close();
// fs.Close();
//}
private void SaveAssetToFile(string filename, byte[] data)
private static void SaveAssetToFile(string filename, byte[] data)
{
string assetPath = "UserAssets";
if (!Directory.Exists(assetPath))

View File

@ -496,7 +496,7 @@ namespace OpenSim.Framework.Communications
return llsdBack;
}
private LLSDArray WrapLLSDMap(LLSDMap wrapMe)
private static LLSDArray WrapLLSDMap(LLSDMap wrapMe)
{
LLSDArray array = new LLSDArray();
array.Add(wrapMe);

View File

@ -728,7 +728,7 @@ namespace OpenSim.Framework.Communications
return m_welcomeMessage;
}
private LoginResponse.BuddyList ConvertFriendListItem(List<FriendListItem> LFL)
private static LoginResponse.BuddyList ConvertFriendListItem(List<FriendListItem> LFL)
{
LoginResponse.BuddyList buddylistreturn = new LoginResponse.BuddyList();
foreach (FriendListItem fl in LFL)

View File

@ -164,7 +164,7 @@ namespace OpenSim.Framework.Communications
/// </summary>
/// <param name="s">string to be examined</param>
/// <returns>true if slash is present</returns>
private bool isSlashed(string s)
private static bool isSlashed(string s)
{
return s.Substring(s.Length - 1, 1) == "/";
}
@ -196,7 +196,7 @@ namespace OpenSim.Framework.Communications
sb.Append("&");
sb.Append(kv.Key);
if (kv.Value != null && kv.Value.Length != 0)
if (!string.IsNullOrEmpty(kv.Value))
{
sb.Append("=");
sb.Append(kv.Value);

View File

@ -472,7 +472,7 @@ namespace OpenSim.Framework
}
}
private IGenericConfig LoadConfigDll(string dllName)
private static IGenericConfig LoadConfigDll(string dllName)
{
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
IGenericConfig plug = null;

View File

@ -66,7 +66,7 @@ namespace OpenSim.Framework.Console
/// </summary>
/// <param name="input">arbitrary string for input</param>
/// <returns>an ansii color</returns>
private ConsoleColor DeriveColor(string input)
private static ConsoleColor DeriveColor(string input)
{
int colIdx = (input.ToUpper().GetHashCode() % 6) + 9;
return (ConsoleColor) colIdx;

View File

@ -101,7 +101,7 @@ namespace OpenSim.Framework.Console
}
}
private ConsoleColor DeriveColor(string input)
private static ConsoleColor DeriveColor(string input)
{
int colIdx = (input.ToUpper().GetHashCode() % 6) + 9;
return (ConsoleColor) colIdx;

View File

@ -89,7 +89,7 @@ namespace OpenSim.Framework
public Packet GetPacket(PacketType type)
{
Packet packet = null;
Packet packet;
lock (pool)
{
@ -109,7 +109,7 @@ namespace OpenSim.Framework
}
// private byte[] decoded_header = new byte[10];
private PacketType GetType(byte[] bytes)
private static PacketType GetType(byte[] bytes)
{
byte[] decoded_header = new byte[10 + 8];
ushort id;

View File

@ -123,7 +123,7 @@ namespace OpenSim.Framework
/// <param name="a">A</param>
/// <param name="b">B</param>
/// <returns>C</returns>
private byte[] AppendArrays(byte[] a, byte[] b)
private static byte[] AppendArrays(byte[] a, byte[] b)
{
byte[] c = new byte[a.Length + b.Length];
Buffer.BlockCopy(a, 0, c, 0, a.Length);

View File

@ -496,7 +496,7 @@ namespace OpenSim.Framework.Servers
}
}
private void DoHTTPGruntWork(Hashtable responsedata, HttpListenerResponse response)
private static void DoHTTPGruntWork(Hashtable responsedata, HttpListenerResponse response)
{
int responsecode = (int)responsedata["int_response_code"];
string responseString = (string)responsedata["str_response_string"];
@ -505,7 +505,7 @@ namespace OpenSim.Framework.Servers
//Even though only one other part of the entire code uses HTTPHandlers, we shouldn't expect this
//and should check for NullReferenceExceptions
if (contentType == null || contentType == "")
if (string.IsNullOrEmpty(contentType))
{
contentType = "text/html";
}
@ -677,12 +677,12 @@ namespace OpenSim.Framework.Servers
}
// Fallback HTTP responses in case the HTTP error response files don't exist
private string getDefaultHTTP404(string host)
private static string getDefaultHTTP404(string host)
{
return "<HTML><HEAD><TITLE>404 Page not found</TITLE><BODY><BR /><H1>Ooops!</H1><P>The page you requested has been obsconded with by knomes. Find hippos quick!</P><P>If you are trying to log-in, your link parameters should have: &quot;-loginpage http://" + host + "/?method=login -loginuri http://" + host + "/&quot; in your link </P></BODY></HTML>";
}
private string getDefaultHTTP500()
private static string getDefaultHTTP500()
{
return "<HTML><HEAD><TITLE>500 Internal Server Error</TITLE><BODY><BR /><H1>Ooops!</H1><P>The server you requested is overun by knomes! Find hippos quick!</P></BODY></HTML>";
}

View File

@ -51,7 +51,7 @@ namespace OpenSim.Framework.Servers
m_method = binaryMethod;
}
private byte[] ReadFully(Stream stream)
private static byte[] ReadFully(Stream stream)
{
byte[] buffer = new byte[32768];
using (MemoryStream ms = new MemoryStream())

View File

@ -78,8 +78,6 @@ namespace OpenSim.Grid.GridServer
m_log.Info("[DATA]: Added IGridData Interface");
}
typeInterface = null;
// Logs go here
typeInterface = pluginType.GetInterface("ILogData", true);
@ -91,12 +89,8 @@ namespace OpenSim.Grid.GridServer
_logplugins.Add(plug.getName(), plug);
m_log.Info("[DATA]: Added ILogData Interface");
}
typeInterface = null;
}
}
pluginAssembly = null;
}
/// <summary>
@ -274,7 +268,7 @@ namespace OpenSim.Grid.GridServer
sim.regionSendKey == Config.SimRecvKey);
}
private XmlRpcResponse ErrorResponse(string error)
private static XmlRpcResponse ErrorResponse(string error)
{
XmlRpcResponse errorResponse = new XmlRpcResponse();
Hashtable errorResponseData = new Hashtable();
@ -609,7 +603,7 @@ namespace OpenSim.Grid.GridServer
response.Value = responseData;
//RegionProfileData TheSim = null;
string uuid = String.Empty; ;
string uuid;
Hashtable requestData = (Hashtable)request.Params[0];
if (requestData.ContainsKey("UUID"))
@ -744,8 +738,7 @@ namespace OpenSim.Grid.GridServer
response.Value = responseData;
IList simProfileList = new ArrayList();
bool fastMode = false; // MySQL Only
fastMode = (Config.DatabaseProvider == "OpenSim.Data.MySQL.dll");
bool fastMode = (Config.DatabaseProvider == "OpenSim.Data.MySQL.dll");
if (fastMode)
{

View File

@ -71,12 +71,8 @@ namespace OpenSim.Grid.InventoryServer
"Invenstorage: Added IInventoryData Interface");
break;
}
typeInterface = null;
}
}
pluginAssembly = null;
}
protected static SerializableInventory loadInventoryFromXmlFile(string fileName)

View File

@ -80,14 +80,14 @@ namespace OpenSim.Grid.ScriptServer
Console.ReadLine();
}
private void RPC_ReceiveCommand(int ID, string Command, object[] p)
private static void RPC_ReceiveCommand(int ID, string Command, object[] p)
{
m_log.Info("[SERVER]: Received command: '" + Command + "'");
if (p != null)
{
for (int i = 0; i < p.Length; i++)
{
m_log.Info("[SERVER]: Param " + i + ": " + p[i].ToString());
m_log.Info("[SERVER]: Param " + i + ": " + p[i]);
}
}

View File

@ -209,7 +209,7 @@ namespace OpenSim.Grid.UserServer
XmlRpcRequest GridReq = new XmlRpcRequest("logout_of_simulator", SendParams);
try
{
XmlRpcResponse GridResp = GridReq.Send(serv.URI, 6000);
GridReq.Send(serv.URI, 6000);
}
catch (WebException)
{
@ -243,7 +243,7 @@ namespace OpenSim.Grid.UserServer
XmlRpcRequest GridReq = new XmlRpcRequest("login_to_simulator", SendParams);
try
{
XmlRpcResponse GridResp = GridReq.Send(serv.URI, 6000);
GridReq.Send(serv.URI, 6000);
m_log.Info("[LOGIN]: Notified : " + serv.URI + " about user login");
}
catch (WebException)

View File

@ -377,9 +377,9 @@ namespace OpenSim.Region.ClientStack
}
private int ScaleThrottle(int value, int curmax, int newmax)
private static int ScaleThrottle(int value, int curmax, int newmax)
{
return (int) (((float) value/(float) curmax)*newmax);
return (value / curmax) * newmax;
}
public byte[] GetThrottlesPacked(float multiplier)

View File

@ -653,7 +653,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
GC.Collect();
}
internal void BulletXMessage(string message, bool isWarning)
internal static void BulletXMessage(string message, bool isWarning)
{
PhysicsPluginManager.PhysicsPluginMessage("[Modified BulletX]:\t" + message, isWarning);
}
@ -1455,7 +1455,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
}
catch (Exception ex)
{
_parent_scene.BulletXMessage(_parent_scene.is_ex_message + ex.Message, true);
BulletXScene.BulletXMessage(_parent_scene.is_ex_message + ex.Message, true);
rigidBody.ActivationState = ActivationState.DisableSimulation;
_parent_scene.AddForgottenRigidBody(rigidBody);
}
@ -1532,10 +1532,10 @@ namespace OpenSim.Region.Physics.BulletXPlugin
}
catch (Exception ex)
{
_parentscene.BulletXMessage(ex.Message, true);
BulletXScene.BulletXMessage(ex.Message, true);
}
}
_parentscene.BulletXMessage("BulletXPlanet created.", false);
BulletXScene.BulletXMessage("BulletXPlanet created.", false);
}
internal float HeightValue(Vector3 position)

View File

@ -66,7 +66,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
StartThread();
}
private void StartThread()
private static void StartThread()
{
if (cmdHandlerThread == null)
{

View File

@ -343,7 +343,7 @@ namespace OpenSim.DataStore.MSSQL
dt.Columns.Add(col);
}
private DataTable createTerrainTable()
private static DataTable createTerrainTable()
{
DataTable terrain = new DataTable("terrain");
@ -354,7 +354,7 @@ namespace OpenSim.DataStore.MSSQL
return terrain;
}
private DataTable createPrimTable()
private static DataTable createPrimTable()
{
DataTable prims = new DataTable("prims");
@ -418,7 +418,7 @@ namespace OpenSim.DataStore.MSSQL
return prims;
}
private DataTable createShapeTable()
private static DataTable createShapeTable()
{
DataTable shapes = new DataTable("primshapes");
createCol(shapes, "UUID", typeof (String));
@ -619,7 +619,7 @@ namespace OpenSim.DataStore.MSSQL
}
}
private PrimitiveBaseShape buildShape(DataRow row)
private static PrimitiveBaseShape buildShape(DataRow row)
{
PrimitiveBaseShape s = new PrimitiveBaseShape();
s.Scale = new LLVector3(
@ -675,7 +675,7 @@ namespace OpenSim.DataStore.MSSQL
return s;
}
private void fillShapeRow(DataRow row, SceneObjectPart prim)
private static void fillShapeRow(DataRow row, SceneObjectPart prim)
{
PrimitiveBaseShape s = prim.Shape;
row["UUID"] = prim.UUID;
@ -770,7 +770,7 @@ namespace OpenSim.DataStore.MSSQL
*
**********************************************************************/
private SqlCommand createInsertCommand(string table, DataTable dt)
private static SqlCommand createInsertCommand(string table, DataTable dt)
{
/**
* This is subtle enough to deserve some commentary.
@ -804,7 +804,7 @@ namespace OpenSim.DataStore.MSSQL
return cmd;
}
private SqlCommand createUpdateCommand(string table, string pk, DataTable dt)
private static SqlCommand createUpdateCommand(string table, string pk, DataTable dt)
{
string sql = "update " + table + " set ";
string subsql = String.Empty;
@ -831,7 +831,7 @@ namespace OpenSim.DataStore.MSSQL
}
private string defineTable(DataTable dt)
private static string defineTable(DataTable dt)
{
string sql = "create table " + dt.TableName + "(";
string subsql = String.Empty;
@ -854,7 +854,7 @@ namespace OpenSim.DataStore.MSSQL
return sql;
}
private void fillTerrainRow(DataRow row, LLUUID regionUUID, int rev, double[,] val)
private static void fillTerrainRow(DataRow row, LLUUID regionUUID, int rev, double[,] val)
{
row["RegionUUID"] = regionUUID;
row["Revision"] = rev;
@ -890,7 +890,7 @@ namespace OpenSim.DataStore.MSSQL
/// for us.
///</summary>
///<returns>a built Sql parameter</returns>
private SqlParameter createSqlParameter(string name, Type type)
private static SqlParameter createSqlParameter(string name, Type type)
{
SqlParameter param = new SqlParameter();
param.ParameterName = "@" + name;
@ -934,7 +934,7 @@ namespace OpenSim.DataStore.MSSQL
da.InsertCommand.Connection = conn;
}
private void InitDB(SqlConnection conn)
private static void InitDB(SqlConnection conn)
{
string createPrims = defineTable(createPrimTable());
string createShapes = defineTable(createShapeTable());
@ -977,7 +977,7 @@ namespace OpenSim.DataStore.MSSQL
conn.Close();
}
private bool TestTables(SqlConnection conn)
private static bool TestTables(SqlConnection conn)
{
SqlCommand primSelectCmd = new SqlCommand(primSelect, conn);
SqlDataAdapter pDa = new SqlDataAdapter(primSelectCmd);
@ -1046,7 +1046,7 @@ namespace OpenSim.DataStore.MSSQL
*
**********************************************************************/
private DbType dbtypeFromType(Type type)
private static DbType dbtypeFromType(Type type)
{
if (type == typeof (String))
{
@ -1072,7 +1072,7 @@ namespace OpenSim.DataStore.MSSQL
// this is something we'll need to implement for each db
// slightly differently.
private string SqlType(Type type)
private static string SqlType(Type type)
{
if (type == typeof (String))
{

View File

@ -72,7 +72,7 @@ namespace OpenSimExport
}
}
protected ConsoleBase CreateConsole()
protected static ConsoleBase CreateConsole()
{
return new ConsoleBase("Export", null);
}

View File

@ -434,7 +434,7 @@ namespace OpenSim.ApplicationPlugins.LoadBalancer
src_region.RegionID.ToString());
}
private void SerializeClient(int idx, Scene scene, ScenePresence pre, string export_dir)
private static void SerializeClient(int idx, Scene scene, ScenePresence pre, string export_dir)
{
string filename;
IClientAPI controller = null;

View File

@ -312,7 +312,7 @@ namespace OpenSim.ApplicationPlugins.RegionProxy
}
}
protected void ClosePort(ServerData sd)
protected static void ClosePort(ServerData sd)
{
// Close the port if it exists and is open
if (sd.server == null) return;