Fixing white space and naming style.
This commit is contained in:
parent
69749abe53
commit
40862a4ad7
4 changed files with 42 additions and 65 deletions
|
@ -98,11 +98,9 @@ namespace LSLEditor.Helpers
|
|||
|
||||
public void Stop()
|
||||
{
|
||||
if(WorkerThread!=null)
|
||||
{
|
||||
if (WorkerThread != null) {
|
||||
WorkerThread.Abort();
|
||||
if (!WorkerThread.Join(2000))
|
||||
{
|
||||
if (!WorkerThread.Join(2000)) {
|
||||
// problems
|
||||
System.Windows.Forms.MessageBox.Show("TaskQueue thread not Aborted", "Oops...");
|
||||
}
|
||||
|
@ -110,21 +108,18 @@ namespace LSLEditor.Helpers
|
|||
}
|
||||
}
|
||||
|
||||
public void Invoke(object ActiveObject,string MethodName, params object[] args)
|
||||
public void Invoke(object ActiveObject, string MethodName, params object[] args)
|
||||
{
|
||||
if (ActiveObject == null)
|
||||
return;
|
||||
try
|
||||
{
|
||||
try {
|
||||
// Add the object to the internal buffer
|
||||
Tasks.Enqueue(new Task(ActiveObject, MethodName, args));
|
||||
|
||||
// Signal the internal thread that there is some new object in the buffer
|
||||
SignalNewTask.Set();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Trace.WriteLine(string.Format("I An exception occurred in TaskQueue.Invoke: {0}", e.Message));
|
||||
} catch (Exception e) {
|
||||
Trace.WriteLine(string.Format("An exception occurred in TaskQueue.Invoke: {0}", e.Message));
|
||||
// Since the exception was not actually handled and only logged - propagate it
|
||||
throw;
|
||||
}
|
||||
|
@ -139,32 +134,24 @@ namespace LSLEditor.Helpers
|
|||
Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US", false);
|
||||
Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US", false);
|
||||
|
||||
while (!stop)
|
||||
{
|
||||
try
|
||||
{
|
||||
while (!stop) {
|
||||
try {
|
||||
// Note: this code is safe (i.e. performing the .Count and .Dequeue not inside a lock)
|
||||
// because there is only one thread emptying the queue.
|
||||
// Even if .Count returns 0, and before Dequeue is called a new object is added to the Queue
|
||||
// then still the system will behave nicely: the next if statement will return false and
|
||||
// since this is run in an endless loop, in the next iteration we will have .Count > 0.
|
||||
if (Tasks.Count > 0)
|
||||
{
|
||||
if (Tasks.Count > 0) {
|
||||
(Tasks.Dequeue() as Task).Execute();
|
||||
}
|
||||
|
||||
// Wait until new objects are received or Dispose was called
|
||||
if (Tasks.Count == 0)
|
||||
{
|
||||
if (Tasks.Count == 0) {
|
||||
SignalNewTask.WaitOne();
|
||||
}
|
||||
}
|
||||
catch (ThreadAbortException)
|
||||
{
|
||||
} catch (ThreadAbortException) {
|
||||
Trace.WriteLine("TaskQueue.Worker: ThreadAbortException, no problem");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
Trace.WriteLine(string.Format("TaskQueue.Worker: {0}", e.Message));
|
||||
// Since the exception was not actually handled and only logged - propagate it
|
||||
throw;
|
||||
|
@ -191,17 +178,12 @@ namespace LSLEditor.Helpers
|
|||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!this.disposed)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!this.disposed) {
|
||||
if (disposing) {
|
||||
try {
|
||||
stop = true;
|
||||
SignalNewTask.Set();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
Trace.WriteLine(string.Format("An exception occurred in MessageLoop.AddToBuffer: {0}", e.Message));
|
||||
// Since the exception was not actually handled and only logged - propagate it
|
||||
throw;
|
||||
|
@ -228,22 +210,17 @@ namespace LSLEditor.Helpers
|
|||
|
||||
public void Execute()
|
||||
{
|
||||
try
|
||||
{
|
||||
try {
|
||||
MethodInfo mi = ActiveObject.GetType().GetMethod(MethodName,
|
||||
BindingFlags.Public |
|
||||
BindingFlags.Public |
|
||||
BindingFlags.Instance |
|
||||
//BindingFlags.DeclaredOnly |
|
||||
BindingFlags.NonPublic
|
||||
);
|
||||
mi.Invoke(ActiveObject, args);
|
||||
}
|
||||
catch (ThreadAbortException)
|
||||
{
|
||||
} catch (ThreadAbortException) {
|
||||
Trace.WriteLine("TaskQueue.Task.Execute: ThreadAbortException, no problem");
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
} catch (Exception exception) {
|
||||
Exception innerException = exception.InnerException;
|
||||
if (innerException == null)
|
||||
innerException = exception;
|
||||
|
@ -256,4 +233,4 @@ namespace LSLEditor.Helpers
|
|||
}
|
||||
#endregion Task
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2751,7 +2751,7 @@ namespace LSLEditor
|
|||
public void llSensor(String sName, key kID, integer iType, Float fRange, Float fArc)
|
||||
{
|
||||
Verbose(@"llSensor(""{0}"", {1}, {2}, {3}, {4})", sName, kID, iType, fRange, fArc);
|
||||
host.sensor_timer.Stop();
|
||||
host.SensorTimer.Stop();
|
||||
integer iTotalNumber = 1;
|
||||
host.ExecuteSecondLife("sensor", iTotalNumber);
|
||||
}
|
||||
|
@ -2759,16 +2759,16 @@ namespace LSLEditor
|
|||
public void llSensorRemove()
|
||||
{
|
||||
Verbose("llSensorRemove()");
|
||||
host.sensor_timer.Stop();
|
||||
host.SensorTimer.Stop();
|
||||
}
|
||||
|
||||
public void llSensorRepeat(String sName, key kID, integer iType, Float fRange, Float fArc, Float fRate)
|
||||
{
|
||||
Verbose(@"llSensorRepeat(""{0}"", {1}, {2}, {3}, {4}, {5})", sName, kID, iType, fRange, fArc, fRate);
|
||||
host.sensor_timer.Stop();
|
||||
host.SensorTimer.Stop();
|
||||
if (fRate > 0) {
|
||||
host.sensor_timer.Interval = (int)Math.Round(fRate * 1000);
|
||||
host.sensor_timer.Start();
|
||||
host.SensorTimer.Interval = (int)Math.Round(fRate * 1000);
|
||||
host.SensorTimer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3028,10 +3028,10 @@ namespace LSLEditor
|
|||
public void llSetTimerEvent(Float fSeconds)
|
||||
{
|
||||
Verbose("llSetTimerEvent({0})", fSeconds);
|
||||
host.timer.Stop();
|
||||
host.Timer.Stop();
|
||||
if (fSeconds > 0) {
|
||||
host.timer.Interval = (int)Math.Round(fSeconds * 1000);
|
||||
host.timer.Start();
|
||||
host.Timer.Interval = (int)Math.Round(fSeconds * 1000);
|
||||
host.Timer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
// </copyright>
|
||||
//
|
||||
// <summary>
|
||||
//
|
||||
// vector.cs
|
||||
//
|
||||
// </summary>
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ namespace LSLEditor
|
|||
this.Listen(e);
|
||||
|
||||
// talk only to the owner
|
||||
if (e.how != CommunicationType.OwnerSay) {
|
||||
if (e.How != CommunicationType.OwnerSay) {
|
||||
foreach (Form form in this.Children) {
|
||||
EditForm editForm = form as EditForm;
|
||||
if (editForm == null || editForm.IsDisposed) {
|
||||
|
@ -143,12 +143,12 @@ namespace LSLEditor
|
|||
{
|
||||
SecondLifeHost secondLifeHostSender = sender as SecondLifeHost;
|
||||
|
||||
Guid ObjectGuid = this.solutionExplorer.GetParentGuid(secondLifeHostSender.guid);
|
||||
Guid ObjectGuid = this.solutionExplorer.GetParentGuid(secondLifeHostSender.GUID);
|
||||
Guid RootObjectGuid = this.solutionExplorer.GetParentGuid(ObjectGuid);
|
||||
|
||||
List<Guid> list;
|
||||
|
||||
int intLinkNum = e.iLinkIndex;
|
||||
int intLinkNum = e.LinkIndex;
|
||||
switch (intLinkNum) {
|
||||
case 1: // LINK_ROOT , root prim in linked set (but not in a single prim, which is 0)
|
||||
list = this.solutionExplorer.GetScripts(RootObjectGuid, false);
|
||||
|
@ -251,28 +251,28 @@ namespace LSLEditor
|
|||
{
|
||||
// Translate the incomming messages a bit so it looks like SL.
|
||||
string strHow = ": ";
|
||||
if (e.how == CommunicationType.Shout) {
|
||||
if (e.How == CommunicationType.Shout) {
|
||||
strHow = " shout: ";
|
||||
}
|
||||
|
||||
if (e.how == CommunicationType.Whisper) {
|
||||
if (e.How == CommunicationType.Whisper) {
|
||||
strHow = " whispers: ";
|
||||
}
|
||||
|
||||
string strWho = e.name;
|
||||
string strMessage = e.message;
|
||||
string strWho = e.Name;
|
||||
string strMessage = e.Message;
|
||||
|
||||
if (e.name == Properties.Settings.Default.AvatarName) {
|
||||
if (e.Name == Properties.Settings.Default.AvatarName) {
|
||||
strWho = "You";
|
||||
}
|
||||
|
||||
if (e.message.ToString().StartsWith("/me")) {
|
||||
strWho = e.name;
|
||||
if (e.Message.ToString().StartsWith("/me")) {
|
||||
strWho = e.Name;
|
||||
strHow = " ";
|
||||
strMessage = e.message.ToString().Substring(3).Trim();
|
||||
strMessage = e.Message.ToString().Substring(3).Trim();
|
||||
}
|
||||
|
||||
if (e.channel == 0) {
|
||||
if (e.Channel == 0) {
|
||||
TalkToSimulatorConsole(strWho + strHow + strMessage);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue