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

* Made a bunch more members static, removed some dead code, general cleaning.
This commit is contained in:
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

@@ -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())