* ThreadPool starvation check is done all the time now, not only under debugging mode
* Added Helpers.EnUsCulture for float parsing, converted all of the Single and Double parsing to be internationally friendly git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@1089 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
@@ -284,9 +284,6 @@ namespace libsecondlife.AssetSystem
|
||||
/// <returns></returns>
|
||||
internal void UpdateFromAssetData()
|
||||
{
|
||||
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-us");
|
||||
Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-us");
|
||||
|
||||
if ( AssetData == null || AssetData.Length == 0)
|
||||
{
|
||||
return;
|
||||
@@ -417,12 +414,10 @@ namespace libsecondlife.AssetSystem
|
||||
try
|
||||
{
|
||||
int id = Int32.Parse(fields[0]);
|
||||
float weight; Single.Parse(fields[1], System.Globalization.NumberStyles.Float);
|
||||
if (Single.TryParse(fields[1], System.Globalization.NumberStyles.Float, new CultureInfo("en-us").NumberFormat, out weight) == false)
|
||||
{
|
||||
weight = 0.0f;
|
||||
}
|
||||
|
||||
float weight = 0.0f;
|
||||
Single.TryParse(fields[1], System.Globalization.NumberStyles.Float,
|
||||
Helpers.EnUsCulture.NumberFormat, out weight);
|
||||
_Parameters[id] = weight;
|
||||
}
|
||||
catch (Exception)
|
||||
|
||||
@@ -109,6 +109,12 @@ namespace libsecondlife
|
||||
public static System.Security.Cryptography.MD5 MD5Builder =
|
||||
new System.Security.Cryptography.MD5CryptoServiceProvider();
|
||||
|
||||
/// <summary>Provide a single instance of the CultureInfo class to
|
||||
/// help parsing in situations where Second Life assumes an en-us
|
||||
/// culture</summary>
|
||||
public static readonly System.Globalization.CultureInfo EnUsCulture =
|
||||
new System.Globalization.CultureInfo("en-us");
|
||||
|
||||
/// <summary>
|
||||
/// Converts an unsigned integer to a hexadecimal string
|
||||
/// </summary>
|
||||
|
||||
@@ -529,7 +529,8 @@ namespace libsecondlife
|
||||
double value;
|
||||
endPos = FindEnd(llsd, 1);
|
||||
|
||||
if (Double.TryParse(llsd.Substring(1, endPos - 1), out value))
|
||||
if (Double.TryParse(llsd.Substring(1, endPos - 1), System.Globalization.NumberStyles.Float,
|
||||
Helpers.EnUsCulture.NumberFormat, out value))
|
||||
return value;
|
||||
else
|
||||
throw new LLSDParseException("Failed to parse double value type");
|
||||
|
||||
@@ -213,7 +213,7 @@ namespace libsecondlife
|
||||
case ValueType.F32:
|
||||
{
|
||||
float temp = 0.0f;
|
||||
Single.TryParse(value, out temp);
|
||||
Single.TryParse(value, System.Globalization.NumberStyles.Float, Helpers.EnUsCulture.NumberFormat, out temp);
|
||||
Value = temp;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -840,16 +840,13 @@ namespace libsecondlife
|
||||
|
||||
#endregion FireCallbacks
|
||||
|
||||
if (Client.Settings.DEBUG)
|
||||
int workerThreads, completionPortThreads;
|
||||
ThreadPool.GetAvailableThreads(out workerThreads, out completionPortThreads);
|
||||
if (workerThreads == 0 || completionPortThreads == 0)
|
||||
{
|
||||
int workerThreads, completionPortThreads;
|
||||
ThreadPool.GetAvailableThreads(out workerThreads, out completionPortThreads);
|
||||
if (workerThreads == 0 || completionPortThreads == 0)
|
||||
{
|
||||
Client.Log(String.Format(
|
||||
"Thread starvation, packets will be dropped. WorkerThreads: {0}, CompletionPortThreads: {1}",
|
||||
workerThreads, completionPortThreads), Helpers.LogLevel.Error);
|
||||
}
|
||||
Client.Log(String.Format(
|
||||
"Thread starvation, packets will be dropped. WorkerThreads: {0}, CompletionPortThreads: {1}",
|
||||
workerThreads, completionPortThreads), Helpers.LogLevel.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,9 @@ namespace VisualParamGenerator
|
||||
{
|
||||
class VisualParamGenerator
|
||||
{
|
||||
public static readonly System.Globalization.CultureInfo EnUsCulture =
|
||||
new System.Globalization.CultureInfo("en-us");
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
if (args.Length < 3)
|
||||
@@ -109,12 +112,15 @@ namespace VisualParamGenerator
|
||||
if (node.Attributes["label_max"] != null)
|
||||
label_max = node.Attributes["label_max"].Value;
|
||||
|
||||
float min = Single.Parse(node.Attributes["value_min"].Value);
|
||||
float max = Single.Parse(node.Attributes["value_max"].Value);
|
||||
float min = Single.Parse(node.Attributes["value_min"].Value,
|
||||
System.Globalization.NumberStyles.Float, EnUsCulture.NumberFormat);
|
||||
float max = Single.Parse(node.Attributes["value_max"].Value,
|
||||
System.Globalization.NumberStyles.Float, EnUsCulture.NumberFormat);
|
||||
|
||||
float def;
|
||||
if (node.Attributes["value_default"] != null)
|
||||
def = Single.Parse(node.Attributes["value_default"].Value);
|
||||
def = Single.Parse(node.Attributes["value_default"].Value,
|
||||
System.Globalization.NumberStyles.Float, EnUsCulture.NumberFormat);
|
||||
else
|
||||
def = min;
|
||||
|
||||
|
||||
@@ -277,7 +277,8 @@ namespace libsecondlife.Utilities.Appearance
|
||||
try
|
||||
{
|
||||
int id = Int32.Parse(fields[0]);
|
||||
float weight = Single.Parse(fields[1]);
|
||||
float weight = Single.Parse(fields[1], System.Globalization.NumberStyles.Float,
|
||||
Helpers.EnUsCulture.NumberFormat);
|
||||
|
||||
Params[id] = weight;
|
||||
}
|
||||
|
||||
@@ -387,8 +387,8 @@ namespace libsecondlife.Utilities.Assets
|
||||
/// <param name="tempFile"></param>
|
||||
/// <param name="storeLocal"></param>
|
||||
/// <param name="isPriority"></param>
|
||||
public void RequestUpload(LLUUID transactionID, AssetType type, byte[] data,
|
||||
bool tempFile, bool storeLocal, bool isPriority)
|
||||
public void RequestUpload(LLUUID transactionID, AssetType type, byte[] data, bool tempFile, bool storeLocal,
|
||||
bool isPriority)
|
||||
{
|
||||
if (!Transfers.ContainsKey(transactionID))
|
||||
{
|
||||
@@ -485,7 +485,7 @@ namespace libsecondlife.Utilities.Assets
|
||||
else
|
||||
{
|
||||
Client.Log("Received a TransferInfo packet with a SourceType of " + transfer.Source.ToString() +
|
||||
" and a Params field length of " + info.TransferInfo.Params.Length,
|
||||
" and a Params field length of " + info.TransferInfo.Params.Length,
|
||||
Helpers.LogLevel.Warning);
|
||||
}
|
||||
}
|
||||
@@ -723,7 +723,7 @@ namespace libsecondlife.Utilities.Assets
|
||||
}
|
||||
|
||||
// The header is downloaded, we can insert this data in to the proper position
|
||||
Array.Copy(image.ImageData.Data, 0, transfer.AssetData, transfer.InitialDataSize +
|
||||
Array.Copy(image.ImageData.Data, 0, transfer.AssetData, transfer.InitialDataSize +
|
||||
(1000 * (image.ImageID.Packet - 1)), image.ImageData.Data.Length);
|
||||
transfer.Transferred += image.ImageData.Data.Length;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user