Fixing whitespace/formatting style.

This commit is contained in:
Ima Mechanique 2013-07-13 11:42:48 +01:00
parent 3bc95288c5
commit 8661094ddd
12 changed files with 3822 additions and 3900 deletions

View file

@ -66,17 +66,17 @@ namespace LSLEditor
public class SecondLifeHostMessageLinkedEventArgs : EventArgs
{
public SecondLife.integer linknum;
public SecondLife.integer num;
public SecondLife.String str;
public SecondLife.key id;
public SecondLife.integer iLinkIndex;
public SecondLife.integer iNumber;
public SecondLife.String sText;
public SecondLife.key kID;
public SecondLifeHostMessageLinkedEventArgs(SecondLife.integer linknum, SecondLife.integer num, SecondLife.String str, SecondLife.key id)
public SecondLifeHostMessageLinkedEventArgs(SecondLife.integer iLinkIndex, SecondLife.integer iNumber, SecondLife.String sText, SecondLife.key kID)
{
this.linknum = linknum;
this.num = num;
this.str = str;
this.id = id;
this.iLinkIndex = iLinkIndex;
this.iNumber = iNumber;
this.sText = sText;
this.kID = kID;
}
}
@ -179,12 +179,10 @@ namespace LSLEditor
private void StateWatch()
{
while (true)
{
while (true) {
this.StateChanged.WaitOne();
this.taskQueue.Start(); // is implicit Stop() old Queue
if (this.CurrentStateName != this.NewStateName)
{
if (this.CurrentStateName != this.NewStateName) {
this.CurrentStateName = this.NewStateName;
ExecuteSecondLife("state_exit");
@ -196,22 +194,21 @@ namespace LSLEditor
public void State(string strStateName, bool blnForce)
{
if (this.CompiledAssembly == null)
return;
if (blnForce)
if (this.CompiledAssembly != null) {
if (blnForce) {
this.CurrentStateName = "";
}
this.NewStateName = strStateName;
this.StateChanged.Set();
}
}
private void SetState()
{
if (CompiledAssembly == null)
return;
if (CompiledAssembly != null) {
secondLife = CompiledAssembly.CreateInstance("LSLEditor.State_" + CurrentStateName) as SecondLife;
if (secondLife == null)
{
if (secondLife == null) {
MessageBox.Show("State " + CurrentStateName + " does not exist!");
return;
}
@ -224,29 +221,29 @@ namespace LSLEditor
secondLife.host = this;
// Update runtime userinterface by calling event handler
if (OnStateChange != null)
if (OnStateChange != null) {
OnStateChange(this, new SecondLifeHostEventArgs(CurrentStateName));
}
ExecuteSecondLife("state_entry");
}
}
public string GetArgumentsFromMethod(string strName)
{
if (this.secondLife == null)
return "";
MethodInfo mi = secondLife.GetType().GetMethod(strName, BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly);
if (mi == null)
return "";
int intI = 0;
string strArgs = "";
foreach (ParameterInfo pi in mi.GetParameters())
{
if (this.secondLife != null) {
MethodInfo mi = secondLife.GetType().GetMethod(strName, BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly);
if (mi != null) {
int intI = 0;
foreach (ParameterInfo pi in mi.GetParameters()) {
if (intI > 0)
strArgs += ",";
strArgs += pi.ParameterType.ToString() + " " + pi.Name;
intI++;
}
}
}
return strArgs;
}
@ -256,10 +253,8 @@ namespace LSLEditor
sb.Append("*** ");
sb.Append(strEventName);
sb.Append('(');
for (int intI = 0; intI < args.Length; intI++)
{
if (intI > 0)
sb.Append(',');
for (int intI = 0; intI < args.Length; intI++) {
if (intI > 0) sb.Append(',');
sb.Append(args[intI].ToString());
}
sb.Append(")");
@ -268,21 +263,18 @@ namespace LSLEditor
public void ExecuteSecondLife(string strName, params object[] args)
{
if (secondLife == null)
return;
if (secondLife != null) {
VerboseEvent(strName, args);
this.taskQueue.Invoke(secondLife, strName, args);
}
}
public ArrayList GetEvents()
{
ArrayList ar = new ArrayList();
if (secondLife != null)
{
foreach (MethodInfo mi in secondLife.GetType().GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly))
{
if (secondLife != null) {
foreach (MethodInfo mi in secondLife.GetType().GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly)) {
ar.Add(mi.Name);
}
}
@ -292,17 +284,18 @@ namespace LSLEditor
public void Reset()
{
if (OnReset != null)
if (OnReset != null) {
OnReset(this, new EventArgs());
}
}
public void Die()
{
if (OnDie != null)
if (OnDie != null) {
OnDie(this, new EventArgs());
}
if (secondLife != null)
{
if (secondLife != null) {
// stop all timers
this.timer.Stop();
this.sensor_timer.Stop();
@ -313,26 +306,21 @@ namespace LSLEditor
this.secondLife = null;
}
}
public void Dispose()
{
if (taskQueue != null)
{
if (taskQueue != null) {
this.taskQueue.Stop();
this.taskQueue.Dispose();
this.taskQueue = null;
}
if (listXmlRpc != null)
{
foreach (XMLRPC xmlRpc in listXmlRpc)
{
if (listXmlRpc != null) {
foreach (XMLRPC xmlRpc in listXmlRpc) {
xmlRpc.CloseChannel();
}
}
if (secondLife != null)
{
if (secondLife != null) {
this.timer.Stop();
this.sensor_timer.Stop();
this.mainForm = null;
@ -364,10 +352,8 @@ namespace LSLEditor
public void llBreakLink(int linknum)
{
foreach (Link link in this.LinkList)
{
if (link.number == linknum)
{
foreach (Link link in this.LinkList) {
if (link.number == linknum) {
this.LinkList.Remove(link);
break;
}
@ -381,8 +367,7 @@ namespace LSLEditor
public string[] GetListenChannels() // for GroupboxEvent
{
List<string> list = new List<string>();
foreach (ListenFilter lf in ListenFilterList)
{
foreach (ListenFilter lf in ListenFilterList) {
list.Add(lf.channel.ToString());
}
return list.ToArray();
@ -407,11 +392,9 @@ namespace LSLEditor
public void llListenControl(int number, int active)
{
for (int intI = 0; intI < ListenFilterList.Count; intI++)
{
for (int intI = 0; intI < ListenFilterList.Count; intI++) {
ListenFilter lf = ListenFilterList[intI];
if (lf.GetHashCode() == number)
{
if (lf.GetHashCode() == number) {
lf.active = (active == 1);
ListenFilterList[intI] = lf;
break;
@ -421,11 +404,9 @@ namespace LSLEditor
public void llListenRemove(int intHandle)
{
for (int intI = 0; intI < ListenFilterList.Count; intI++)
{
for (int intI = 0; intI < ListenFilterList.Count; intI++) {
ListenFilter lf = ListenFilterList[intI];
if (lf.GetHashCode() == intHandle)
{
if (lf.GetHashCode() == intHandle) {
ListenFilterList.RemoveAt(intI);
break;
}
@ -450,18 +431,12 @@ namespace LSLEditor
{
ListenFilter lfToCheck = new ListenFilter(channel, name, id, message);
foreach (ListenFilter lf in ListenFilterList)
{
if (!lf.active)
continue;
if (lf.channel != lfToCheck.channel)
continue;
if (lf.name != "" && lf.name != lfToCheck.name)
continue;
if (lf.id != Guid.Empty.ToString() && lf.id!="" && lf.id != lfToCheck.id)
continue;
if (lf.message != "" && lf.message != lfToCheck.message)
continue;
foreach (ListenFilter lf in ListenFilterList) {
if (!lf.active) continue;
if (lf.channel != lfToCheck.channel) continue;
if (lf.name != "" && lf.name != lfToCheck.name) continue;
if (lf.id != Guid.Empty.ToString() && lf.id != "" && lf.id != lfToCheck.id) continue;
if (lf.message != "" && lf.message != lfToCheck.message) continue;
return true;
}
return false;
@ -470,65 +445,65 @@ namespace LSLEditor
// sink listen
public void Listen(SecondLifeHostChatEventArgs e)
{
if (secondLife == null)
return;
if (CheckListenFilter(e.channel, e.name, e.id, e.message))
if (secondLife != null) {
if (CheckListenFilter(e.channel, e.name, e.id, e.message)) {
ExecuteSecondLife("listen", e.channel, e.name, e.id, e.message);
}
}
}
#endregion
// raise
public void Chat(object sender, int channel, string name, SecondLife.key id, string message, CommunicationType how)
{
if (OnChat != null)
if (OnChat != null) {
OnChat(sender, new SecondLifeHostChatEventArgs(channel, name, id, message, how));
}
}
// raise
public void MessageLinked(SecondLife.integer linknum, SecondLife.integer num, SecondLife.String str, SecondLife.key id)
public void MessageLinked(SecondLife.integer iLlinkIndex, SecondLife.integer iNumber, SecondLife.String sText, SecondLife.key kID)
{
if (OnMessageLinked != null)
OnMessageLinked(this, new SecondLifeHostMessageLinkedEventArgs(linknum, num, str, id));
if (OnMessageLinked != null) {
OnMessageLinked(this, new SecondLifeHostMessageLinkedEventArgs(iLlinkIndex, iNumber, sText, kID));
}
}
// sink
public void LinkMessage(SecondLifeHostMessageLinkedEventArgs e)
{
ExecuteSecondLife("link_message", e.linknum, e.num, e.str, e.id);
ExecuteSecondLife("link_message", e.iLinkIndex, e.iNumber, e.sText, e.kID);
}
public SecondLife.key Http(string Url, SecondLife.list Parameters, string Body)
{
if (secondLife == null)
return SecondLife.NULL_KEY;
SecondLife.key Key = SecondLife.NULL_KEY;
if (secondLife != null) {
System.Net.WebProxy proxy = null;
if (Properties.Settings.Default.ProxyServer != "")
if (Properties.Settings.Default.ProxyServer != "") {
proxy = new System.Net.WebProxy(Properties.Settings.Default.ProxyServer.Replace("http://", ""));
if (Properties.Settings.Default.ProxyUserid != "" && proxy != null)
proxy.Credentials = new System.Net.NetworkCredential(Properties.Settings.Default.ProxyUserid, Properties.Settings.Default.ProxyPassword);
SecondLife.key Key = new SecondLife.key(Guid.NewGuid());
//WebRequestClass a = new WebRequestClass(proxy, secondLife, Url, Parameters, Body, Key);
try
{
HTTPRequest.Request(proxy, secondLife, Url, Parameters, Body, Key);
}
catch(Exception exception)
{
if (Properties.Settings.Default.ProxyUserid != "" && proxy != null) {
proxy.Credentials = new System.Net.NetworkCredential(Properties.Settings.Default.ProxyUserid, Properties.Settings.Default.ProxyPassword);
}
Key = new SecondLife.key(Guid.NewGuid());
//WebRequestClass a = new WebRequestClass(proxy, secondLife, Url, Parameters, Body, Key);
try {
HTTPRequest.Request(proxy, secondLife, Url, Parameters, Body, Key);
} catch (Exception exception) {
VerboseMessage(exception.Message);
}
}
return Key;
}
public void Email(string To, string Subject, string Body)
{
if (secondLife == null)
return;
if (secondLife != null) {
SmtpClient client = new SmtpClient();
client.SmtpServer = Properties.Settings.Default.EmailServer;
@ -558,12 +533,14 @@ namespace LSLEditor
VerboseMessage(client.Send(msg));
}
}
public void VerboseMessage(string Message)
{
if (OnVerboseMessage != null)
if (OnVerboseMessage != null) {
OnVerboseMessage(this, new SecondLifeHostEventArgs(Message));
}
}
delegate void ShowDialogDelegate(SecondLifeHost host,
SecondLife.String objectName,
@ -589,32 +566,28 @@ namespace LSLEditor
public void llDialog(SecondLife.key avatar, SecondLife.String message, SecondLife.list buttons, SecondLife.integer channel)
{
if (message.ToString().Length >= 512)
{
if (message.ToString().Length >= 512) {
VerboseMessage("llDialog: message too long, must be less than 512 characters");
return;
}
if (message.ToString().Length == 0)
{
if (message.ToString().Length == 0) {
VerboseMessage("llDialog: must supply a message");
return;
}
for (int intI = 0; intI < buttons.Count; intI++)
{
if (buttons[intI].ToString() == "")
{
for (int intI = 0; intI < buttons.Count; intI++) {
if (buttons[intI].ToString() == "") {
VerboseMessage("llDialog: all buttons must have label strings");
return;
}
if (buttons[intI].ToString().Length > 24)
{
if (buttons[intI].ToString().Length > 24) {
VerboseMessage("llDialog:Button Labels can not have more than 24 characters");
return;
}
}
if (buttons.Count == 0)
if (buttons.Count == 0) {
buttons = new SecondLife.list(new string[] { "OK" });
}
this.mainForm.Invoke(new ShowDialogDelegate(Dialog), this, (SecondLife.String)GetObjectName(), secondLife.llGetOwner(), (SecondLife.String)Properties.Settings.Default.AvatarName, message, buttons, channel);
}
@ -639,13 +612,11 @@ namespace LSLEditor
}
public void llTextBox(SecondLife.key avatar, SecondLife.String message, SecondLife.integer channel)
{
if (message.ToString().Length >= 512)
{
if (message.ToString().Length >= 512) {
VerboseMessage("llTextBox: message too long, must be less than 512 characters");
return;
}
if (message.ToString().Length == 0)
{
if (message.ToString().Length == 0) {
VerboseMessage("llTextBos: must supply a message");
return;
}
@ -694,13 +665,8 @@ namespace LSLEditor
public void SendControl(Keys keys)
{
if (m_intControls < 0)
return;
if (this.secondLife == null)
return;
if (m_intControls >= 0 || this.secondLife != null) {
// check againt m_intControls TODO!!!!!
int held = 0;
int change = 0;
@ -715,6 +681,7 @@ namespace LSLEditor
ExecuteSecondLife("control", (SecondLife.key)Properties.Settings.Default.AvatarKey, (SecondLife.integer)held, (SecondLife.integer)change);
}
}
public void TakeControls(int intControls, int accept, int pass_on)
{
@ -732,11 +699,9 @@ namespace LSLEditor
StreamReader sr = new StreamReader(strPath);
int intI = 0;
string strData = SecondLife.EOF;
while (!sr.EndOfStream)
{
while (!sr.EndOfStream) {
string strLine = sr.ReadLine();
if (intI == line)
{
if (intI == line) {
strData = strLine;
break;
}
@ -749,10 +714,10 @@ namespace LSLEditor
public SecondLife.key GetNotecardLine(string name, int line)
{
string strPath = mainForm.SolutionExplorer.GetPath(this.guid, name);
if(strPath == string.Empty)
if (strPath == string.Empty) {
strPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), name);
if (!File.Exists(strPath))
{
}
if (!File.Exists(strPath)) {
VerboseMessage("Notecard: " + strPath + " not found");
taskQueue.Invoke(secondLife, "llSay", (SecondLife.integer)0, (SecondLife.String)("Couldn't find notecard " + name));
return SecondLife.NULL_KEY;
@ -767,8 +732,7 @@ namespace LSLEditor
{
StreamReader sr = new StreamReader(strPath);
int intI = 0;
while (!sr.EndOfStream)
{
while (!sr.EndOfStream) {
string strLine = sr.ReadLine();
intI++;
}
@ -780,11 +744,11 @@ namespace LSLEditor
public SecondLife.key GetNumberOfNotecardLines(string name)
{
string strPath = mainForm.SolutionExplorer.GetPath(this.guid, name);
if (strPath == string.Empty)
if (strPath == string.Empty) {
strPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), name);
}
if (!File.Exists(strPath))
{
if (!File.Exists(strPath)) {
VerboseMessage("Notecard: " + strPath + " not found");
taskQueue.Invoke(secondLife, "llSay", (SecondLife.integer)0, (SecondLife.String)("Couldn't find notecard " + name));
return SecondLife.NULL_KEY;
@ -800,8 +764,9 @@ namespace LSLEditor
private List<XMLRPC> listXmlRpc;
public void llOpenRemoteDataChannel()
{
if (listXmlRpc == null)
if (listXmlRpc == null) {
listXmlRpc = new List<XMLRPC>();
}
XMLRPC xmlRpc = new XMLRPC();
xmlRpc.OnRequest += new XMLRPC.RequestEventHandler(xmlRpc_OnRequest);
xmlRpc.OpenChannel(listXmlRpc.Count);
@ -830,30 +795,26 @@ namespace LSLEditor
public void llCloseRemoteDataChannel(SecondLife.key channel)
{
if (listXmlRpc == null)
return;
foreach (XMLRPC xmlRpc in listXmlRpc)
{
if (xmlRpc.guid == channel.guid)
{
if (listXmlRpc != null) {
foreach (XMLRPC xmlRpc in listXmlRpc) {
if (xmlRpc.guid == channel.guid) {
xmlRpc.CloseChannel();
break;
}
}
}
}
public void llRemoteDataReply(SecondLife.key channel, SecondLife.key message_id, string sdata, int idata)
{
if (listXmlRpc == null)
return;
foreach (XMLRPC xmlRpc in listXmlRpc)
{
if (xmlRpc.guid == channel.guid)
{
if (listXmlRpc != null) {
foreach (XMLRPC xmlRpc in listXmlRpc) {
if (xmlRpc.guid == channel.guid) {
xmlRpc.RemoteDataReply(channel.guid, message_id.guid, sdata, idata);
break;
}
}
}
}
// Wiki sais this is not working in InWorld
public SecondLife.key llSendRemoteData(SecondLife.key channel, string dest, int idata, string sdata)
@ -880,10 +841,7 @@ namespace LSLEditor
public string GetObjectName(Guid guid)
{
string strObjectName = mainForm.SolutionExplorer.GetObjectName(guid);
if (strObjectName != string.Empty)
return strObjectName;
else
return this.ObjectName;
return strObjectName != string.Empty ? strObjectName : this.ObjectName;
}
public string GetObjectName()
@ -893,18 +851,20 @@ namespace LSLEditor
public void SetObjectName(string name)
{
if (!mainForm.SolutionExplorer.SetObjectName(this.guid, name))
if (!mainForm.SolutionExplorer.SetObjectName(this.guid, name)) {
ObjectName = name;
}
}
public string GetObjectDescription(Guid guid)
{
string strObjectDescription = mainForm.SolutionExplorer.GetObjectDescription(guid);
if (strObjectDescription != string.Empty)
if (strObjectDescription != string.Empty) {
return strObjectDescription;
else
} else {
return this.ObjectDescription;
}
}
public string GetObjectDescription()
{
@ -913,43 +873,49 @@ namespace LSLEditor
public void SetObjectDescription(string description)
{
if (!mainForm.SolutionExplorer.SetObjectDescription(this.guid, description))
if (!mainForm.SolutionExplorer.SetObjectDescription(this.guid, description)) {
this.ObjectDescription = description;
}
}
public string GetScriptName()
{
string strScriptName = mainForm.SolutionExplorer.GetScriptName(this.guid);
if (strScriptName == string.Empty)
if (strScriptName == string.Empty) {
strScriptName = this.FullPath;
if (Properties.Settings.Default.llGetScriptName)
}
if (Properties.Settings.Default.llGetScriptName) {
strScriptName = Path.GetFileNameWithoutExtension(strScriptName);
else
} else {
strScriptName = Path.GetFileName(strScriptName);
}
return strScriptName;
}
public SecondLife.key GetKey()
{
string strGuid = mainForm.SolutionExplorer.GetKey(this.guid);
if (strGuid == string.Empty)
if (strGuid == string.Empty) {
return new SecondLife.key(this.guid);
}
return new SecondLife.key(strGuid);
}
public SecondLife.String GetInventoryName(SecondLife.integer type, SecondLife.integer number)
{
string strInventoryName = mainForm.SolutionExplorer.GetInventoryName(this.guid, type, number);
if (strInventoryName == string.Empty)
if (strInventoryName == string.Empty) {
return "**GetInventoryName only works in SolutionExplorer**";
}
return strInventoryName;
}
public SecondLife.key GetInventoryKey(SecondLife.String name)
{
string strInventoryKey = mainForm.SolutionExplorer.GetInventoryKey(this.guid, name);
if (strInventoryKey == string.Empty)
if (strInventoryKey == string.Empty) {
return new SecondLife.key(Guid.Empty);
}
return new SecondLife.key(strInventoryKey);
}
@ -971,8 +937,9 @@ namespace LSLEditor
public System.Media.SoundPlayer GetSoundPlayer(string sound)
{
string strPath = mainForm.SolutionExplorer.GetPath(this.guid, sound);
if (strPath == string.Empty)
if (strPath == string.Empty) {
strPath = sound;
}
return new System.Media.SoundPlayer(strPath);
}

View file

@ -127,11 +127,12 @@ namespace LSLEditor
#region internal routines
private void Verbose(string strLine, params object[] parameters)
{
if (parameters.Length == 0)
if (parameters.Length == 0) {
host.VerboseMessage(strLine);
else
} else {
host.VerboseMessage(string.Format(strLine, parameters));
}
}
private void Chat(integer channel, string message, CommunicationType how)
{

View file

@ -107,12 +107,9 @@ namespace LSLEditor
public override bool Equals(object o)
{
try
{
try {
return (bool)(this.value == o.ToString());
}
catch
{
} catch {
return false;
}
}
@ -124,8 +121,9 @@ namespace LSLEditor
public override string ToString()
{
if (this.value == null)
if (this.value == null) {
this.value = "";
}
return this.value;
}

View file

@ -57,8 +57,7 @@ namespace LSLEditor
{
get
{
if (m_value == null)
m_value = (Int32)0;
if (m_value == null) m_value = (Int32)0;
return (Int32)m_value;
}
set
@ -137,10 +136,7 @@ namespace LSLEditor
// Logical negation (NOT) operator
public static integer operator !(integer x)
{
if (x.value == 0)
return TRUE;
else
return FALSE;
return x.value == 0 ? TRUE : FALSE;
}
// Bitwise AND operator
@ -257,22 +253,21 @@ namespace LSLEditor
public static int Compare(integer a, integer b)
{
if (a.value < b.value)
return -1;
if (a.value > b.value)
return 1;
return 0;
int intResult = 0;
if (a.value < b.value) {
intResult = -1;
} else if (a.value > b.value) {
intResult = 1;
}
return intResult;
}
// Override the Object.Equals(object o) method:
public override bool Equals(object o)
{
try
{
try {
return (bool)(this == (integer)o);
}
catch
{
} catch {
return false;
}
}

View file

@ -84,25 +84,18 @@ namespace LSLEditor
// This is the one-and-only implicit typecasting in SecondLife
public static implicit operator key(string strGuid)
{
if (strGuid == null)
return new key("");
else
return new key(strGuid);
return strGuid == null ? new key("") : new key(strGuid);
}
public static implicit operator key(String _strGuid)
{
string strGuid = _strGuid;
if (strGuid == null)
return new key("");
else
return new key(strGuid);
return strGuid == null ? new key("") : new key(strGuid);
}
public override string ToString()
{
if (this.guid == null)
this.guid = "";
if (this.guid == null) this.guid = "";
return this.guid.ToString();
}
@ -129,34 +122,27 @@ namespace LSLEditor
public static bool operator true(key k)
{
if ((object)k == null)
return false;
if (k.guid == NULL_KEY)
return false;
if (k.guid == "")
return false;
return true;
bool bResult = true;
if ((object)k == null || k.guid == NULL_KEY || k.guid == "") {
bResult = false;
}
return bResult;
}
public static bool operator false(key k)
{
if ((object)k == null)
return true;
if (k.guid == NULL_KEY)
return true;
if (k.guid == "")
return true;
return false;
bool bResult = false;
if ((object)k == null || k.guid == NULL_KEY || k.guid == "") {
bResult = true;
}
return bResult;
}
public override bool Equals(object obj)
{
try
{
try {
return (this == (key)obj);
}
catch
{
} catch {
return false;
}
}

View file

@ -70,94 +70,85 @@ namespace LSLEditor
{
get
{
if (this.value == null)
this.value = new ArrayList();
if (this.value == null) this.value = new ArrayList();
return this.value.Count;
}
}
public void AddRange(list c)
{
if(this.value == null)
this.value = new ArrayList();
if (this.value == null) this.value = new ArrayList();
this.value.AddRange(c.ToArray());
}
public void Add(object value)
{
if (this.value == null)
this.value = new ArrayList();
if (this.value == null) this.value = new ArrayList();
string strType = value.GetType().ToString();
if (value is string)
if (value is string) {
this.value.Add((String)value.ToString());
else if (value is int)
} else if (value is int) {
this.value.Add(new integer((int)value));
else if (value is uint)
} else if (value is uint) {
this.value.Add(new integer((int)(uint)value));
else if (value is double)
} else if (value is double) {
this.value.Add(new Float((double)value));
else
} else {
this.value.Add(value);
}
}
public object this[int index]
{
get
{
if (this.value == null)
this.value = new ArrayList();
if (this.value == null) this.value = new ArrayList();
return this.value[index];
}
set
{
if (this.value == null)
this.value = new ArrayList();
if (this.value == null) this.value = new ArrayList();
this.value[index] = value;
}
}
public void Insert(int index, object value)
{
if (this.value == null)
this.value = new ArrayList();
if (this.value == null) this.value = new ArrayList();
if (this.value == null)
this.value = new ArrayList();
if (this.value == null) this.value = new ArrayList();
string strType = value.GetType().ToString();
if (value is string)
if (value is string) {
this.value.Insert(index, (String)value.ToString());
else if (value is int)
} else if (value is int) {
this.value.Insert(index, new integer((int)value));
else if (value is uint)
} else if (value is uint) {
this.value.Insert(index, new integer((int)(uint)value));
else if (value is double)
} else if (value is double) {
this.value.Insert(index, new Float((double)value));
else
} else {
this.value.Insert(index, value);
}
}
public object[] ToArray()
{
if (this.value == null)
this.value = new ArrayList();
if (this.value == null) this.value = new ArrayList();
return this.value.ToArray();
}
public static list operator +(list a, list b)
{
list l = new list();
if((object)a != null)
l.AddRange(a);
if ((object)b != null)
l.AddRange(b);
if ((object)a != null) l.AddRange(a);
if ((object)b != null) l.AddRange(b);
return l;
}
public static list operator +(object b, list a)
{
list l = new list();
if ((object)a != null)
l.AddRange(a);
if ((object)a != null) l.AddRange(a);
l.Insert(0, b);
return l;
}
@ -165,8 +156,7 @@ namespace LSLEditor
public static list operator +(list a, object b)
{
list l = new list();
if ((object)a != null)
l.AddRange(a);
if ((object)a != null) l.AddRange(a);
l.Add(b);
return l;
}
@ -235,50 +225,50 @@ namespace LSLEditor
public static integer operator ==(list l, list m)
{
if (l.Count != m.Count)
return FALSE;
for (int intI = 0; intI < l.Count; intI++)
if (!l[intI].Equals(m[intI]))
return FALSE;
return TRUE;
int iResult = TRUE;
if (l.Count != m.Count) {
iResult = FALSE;
} else {
for (int intI = 0; intI < l.Count; intI++) {
if (!l[intI].Equals(m[intI])) {
iResult = FALSE;
break;
}
}
}
return iResult;
}
public static integer operator !=(list l, list m)
{
int intDifferent = 0;
if (m.Count == 0) // shortcut
return l.Count;
for (int intI = 0; intI < l.Count; intI++)
{
if (m.Count == 0) {// shortcut
intDifferent = l.Count;
} else {
for (int intI = 0; intI < l.Count; intI++) {
bool blnFound = false;
for (int intJ = 0; intJ < m.Count; intJ++)
{
if (l[intI].Equals(m[intJ]))
{
for (int intJ = 0; intJ < m.Count; intJ++) {
if (l[intI].Equals(m[intJ])) {
blnFound = true;
break;
}
}
if(!blnFound)
intDifferent++;
if (!blnFound) intDifferent++;
}
}
return intDifferent;
}
public static bool operator true(list x)
{
if ((object)x == null)
return false;
return (x.value.Count != 0);
return (object)x == null ? false : (x.value.Count != 0);
}
// Definitely false operator. Returns true if the operand is
// ==0, false otherwise:
public static bool operator false(list x)
{
if ((object)x == null)
return true;
return (x.value.Count == 0);
return (object)x == null ? true : (x.value.Count == 0);
}
@ -295,53 +285,45 @@ namespace LSLEditor
public string ToVerboseString()
{
if (this.value == null)
if (this.value == null) {
this.value = new ArrayList();
}
StringBuilder sb = new StringBuilder();
sb.Append('[');
for (int intI = 0; intI < this.value.Count; intI++)
{
if(intI>0)
sb.Append(',');
if((this.value[intI] is string) && Properties.Settings.Default.QuotesListVerbose)
for (int intI = 0; intI < this.value.Count; intI++) {
if (intI > 0) sb.Append(',');
if ((this.value[intI] is string) && Properties.Settings.Default.QuotesListVerbose) {
sb.Append("\"" + this.value[intI].ToString() + "\"");
else
} else {
sb.Append(this.value[intI].ToString());
}
}
sb.Append(']');
return sb.ToString();
}
public override string ToString()
{
if (this.value == null)
this.value = new ArrayList();
if (this.value == null) this.value = new ArrayList();
StringBuilder sb = new StringBuilder();
for (int intI = 0; intI < this.value.Count; intI++)
{
if (this.value[intI] is vector)
{
for (int intI = 0; intI < this.value.Count; intI++) {
if (this.value[intI] is vector) {
vector v = (vector)this.value[intI];
sb.AppendFormat(new System.Globalization.CultureInfo("en-us"), "<{0:0.000000}, {1:0.000000}, {2:0.000000}>", (double)v.x, (double)v.y, (double)v.z);
}
else if (this.value[intI] is rotation)
{
} else if (this.value[intI] is rotation) {
rotation r = (rotation)this.value[intI];
sb.AppendFormat(new System.Globalization.CultureInfo("en-us"), "<{0:0.000000}, {1:0.000000}, {2:0.000000}, {3:0.000000}>", (double)r.x, (double)r.y, (double)r.z, (double)r.s);
}
else
} else {
sb.Append(this.value[intI].ToString());
}
}
return sb.ToString();
}
public static explicit operator String(list l)
{
if ((object)l == null)
return "";
else
return l.ToString();
return (object)l == null ? "" : l.ToString();
}
}

View file

@ -56,8 +56,7 @@ namespace LSLEditor
{
get
{
if (m_x == null)
m_x = (Float)0;
if (m_x == null) m_x = (Float)0;
return (Float)m_x;
}
set
@ -70,8 +69,7 @@ namespace LSLEditor
{
get
{
if (m_y == null)
m_y = (Float)0;
if (m_y == null) m_y = (Float)0;
return (Float)m_y;
}
set
@ -84,8 +82,7 @@ namespace LSLEditor
{
get
{
if (m_z == null)
m_z = (Float)0;
if (m_z == null) m_z = (Float)0;
return (Float)m_z;
}
set
@ -98,8 +95,7 @@ namespace LSLEditor
{
get
{
if (m_s == null)
m_s = (Float)0;
if (m_s == null) m_s = (Float)0;
return (Float)m_s;
}
set
@ -137,8 +133,7 @@ namespace LSLEditor
RegexOptions.IgnorePatternWhitespace |
RegexOptions.Compiled);
Match m = regex.Match(a);
if (m.Success)
{
if (m.Success) {
this.m_x = new Float(m.Groups["x"].Value);
this.m_y = new Float(m.Groups["y"].Value);
this.m_z = new Float(m.Groups["z"].Value);
@ -158,11 +153,12 @@ namespace LSLEditor
public static explicit operator String(rotation rot)
{
if ((object)rot == null)
if ((object)rot == null) {
return ZERO_ROTATION.ToString();
else
} else {
return rot.ToString();
}
}
// 23 feb 2008
public static rotation operator -(rotation r)
@ -220,19 +216,19 @@ namespace LSLEditor
public static bool operator ==(rotation r1, rotation r2)
{
if ((object)r1 == null)
r1 = ZERO_ROTATION;
if ((object)r2 == null)
r2 = ZERO_ROTATION;
if (Math.Abs(r1.x - r2.x) > EqualityTolerence)
return false;
if (Math.Abs(r1.y - r2.y) > EqualityTolerence)
return false;
if (Math.Abs(r1.z - r2.z) > EqualityTolerence)
return false;
if (Math.Abs(r1.s - r2.s) > EqualityTolerence)
return false;
return true;
bool bReturn = true;
if ((object)r1 == null) r1 = ZERO_ROTATION;
if ((object)r2 == null) r2 = ZERO_ROTATION;
if (Math.Abs(r1.x - r2.x) > EqualityTolerence) {
bReturn = false;
} else if (Math.Abs(r1.y - r2.y) > EqualityTolerence) {
bReturn = false;
} else if (Math.Abs(r1.z - r2.z) > EqualityTolerence) {
bReturn = false;
} else if (Math.Abs(r1.s - r2.s) > EqualityTolerence) {
bReturn = false;
}
return bReturn;
}
public static bool operator !=(rotation r, rotation s)
@ -242,19 +238,23 @@ namespace LSLEditor
public static bool operator true(rotation r)
{
if ((object)r == null)
if ((object)r == null) {
return false;
if (r.x == 0 && r.y == 0 && r.z == 0 && r.s == 1)
}
if (r.x == 0 && r.y == 0 && r.z == 0 && r.s == 1) {
return false;
}
return true;
}
public static bool operator false(rotation r)
{
if ((object)r == null)
if ((object)r == null) {
return true;
if (r.x == 0 && r.y == 0 && r.z == 0 && r.s == 1)
}
if (r.x == 0 && r.y == 0 && r.z == 0 && r.s == 1) {
return true;
}
return false;
}
@ -266,12 +266,9 @@ namespace LSLEditor
public override bool Equals(object obj)
{
try
{
try {
return (this == (rotation)obj);
}
catch
{
} catch {
return false;
}
}

View file

@ -221,17 +221,17 @@ namespace LSLEditor
public static bool operator ==(vector v1, vector v2)
{
if ((object)v1 == null)
v1 = ZERO_VECTOR;
if ((object)v2 == null)
v2 = ZERO_VECTOR;
if ((object)v1 == null) v1 = ZERO_VECTOR;
if ((object)v2 == null) v2 = ZERO_VECTOR;
if (Math.Abs(v1.x - v2.x) > EqualityTolerence)
return false;
if (Math.Abs(v1.y - v2.y) > EqualityTolerence)
return false;
if (Math.Abs(v1.z - v2.z) > EqualityTolerence)
return false;
bool bResult = true;
if (Math.Abs(v1.x - v2.x) > EqualityTolerence) {
bResult = false;
} else if (Math.Abs(v1.y - v2.y) > EqualityTolerence) {
bResult = false;
} else if (Math.Abs(v1.z - v2.z) > EqualityTolerence) {
bResult = false;
}
return true;
}
@ -242,19 +242,17 @@ namespace LSLEditor
public static bool operator true(vector v)
{
if ((object)v == null)
return false;
if (v.x == 0 && v.y == 0 && v.z == 0)
if ((object)v == null || (v.x == 0 && v.y == 0 && v.z == 0)) {
return false;
}
return true;
}
public static bool operator false(vector v)
{
if ((object)v == null)
return true;
if (v.x == 0 && v.y == 0 && v.z == 0)
if ((object)v == null || (v.x == 0 && v.y == 0 && v.z == 0)) {
return true;
}
return false;
}
@ -265,11 +263,12 @@ namespace LSLEditor
public static explicit operator String(vector v)
{
if ((object)v == null)
if ((object)v == null) {
return ZERO_VECTOR.ToString();
else
} else {
return v.ToString();
}
}
public override int GetHashCode()
{
@ -278,12 +277,9 @@ namespace LSLEditor
public override bool Equals(object obj)
{
try
{
try {
return (this == (vector)obj);
}
catch
{
} catch {
return false;
}
}

View file

@ -148,7 +148,7 @@ namespace LSLEditor
List<Guid> list;
int intLinkNum = e.linknum;
int intLinkNum = e.iLinkIndex;
switch (intLinkNum)
{
case 1: // LINK_ROOT , root prim in linked set (but not in a single prim, which is 0)