From 8661094ddd48480e26fc86cf5ce61250b39b05af Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Sat, 13 Jul 2013 11:42:48 +0100 Subject: [PATCH 01/11] Fixing whitespace/formatting style. --- trunk/EditForm.cs | 160 +- trunk/SecondLife/SecondLifeHst.cs | 511 +-- trunk/SecondLife/SecondLifeMain.cs | 6657 ++++++++++++++-------------- trunk/SecondLife/String.cs | 14 +- trunk/SecondLife/integer.cs | 27 +- trunk/SecondLife/key.cs | 44 +- trunk/SecondLife/list.cs | 148 +- trunk/SecondLife/rotation.cs | 65 +- trunk/SecondLife/vector.cs | 42 +- trunk/SimulatorConsole.cs | 2 +- trunk/Solution/SolutionExplorer.cs | 44 +- trunk/UpdateApplicationForm.cs | 8 +- 12 files changed, 3822 insertions(+), 3900 deletions(-) diff --git a/trunk/EditForm.cs b/trunk/EditForm.cs index 888ccf3..a69dabd 100644 --- a/trunk/EditForm.cs +++ b/trunk/EditForm.cs @@ -58,9 +58,9 @@ namespace LSLEditor private string m_FullPathName; private Guid m_Guid; - // private bool sOutline = true; + // private bool sOutline = true; public LSLEditorForm parent; - public Encoding encodedAs = null; + public Encoding encodedAs = null; private const int WM_NCACTIVATE = 0x0086; protected override void WndProc(ref Message m) @@ -141,7 +141,7 @@ namespace LSLEditor this.Icon = lslEditorForm.Icon; this.parent = lslEditorForm; - this.numberedTextBoxUC1.TextBox.setEditform(this); + this.numberedTextBoxUC1.TextBox.setEditform(this); this.numberedTextBoxUC1.TextBox.Init(this.parent, this.parent.ConfLSL); this.numberedTextBoxUC1.TextBox.OnDirtyChanged += new IsDirtyHandler(TextBox_OnDirtyChanged); @@ -149,25 +149,25 @@ namespace LSLEditor this.Resize += new EventHandler(EditForm_Position); this.Layout += new LayoutEventHandler(EditForm_Layout); - ImageList imageList = new ImageList(); - imageList.Images.Add(new Bitmap(this.GetType(), "Images.Unknown.gif")); - imageList.Images.Add(new Bitmap(this.GetType(), "Images.Functions.gif")); - imageList.Images.Add(new Bitmap(this.GetType(), "Images.Events.gif")); - imageList.Images.Add(new Bitmap(this.GetType(), "Images.Constants.gif")); - imageList.Images.Add(new Bitmap(this.GetType(), "Images.Class.gif")); - imageList.Images.Add(new Bitmap(this.GetType(), "Images.Vars.gif")); - imageList.Images.Add(new Bitmap(this.GetType(), "Images.Properties.gif")); - imageList.Images.Add(new Bitmap(this.GetType(), "Images.States.gif")); + ImageList imageList = new ImageList(); + imageList.Images.Add(new Bitmap(this.GetType(), "Images.Unknown.gif")); + imageList.Images.Add(new Bitmap(this.GetType(), "Images.Functions.gif")); + imageList.Images.Add(new Bitmap(this.GetType(), "Images.Events.gif")); + imageList.Images.Add(new Bitmap(this.GetType(), "Images.Constants.gif")); + imageList.Images.Add(new Bitmap(this.GetType(), "Images.Class.gif")); + imageList.Images.Add(new Bitmap(this.GetType(), "Images.Vars.gif")); + imageList.Images.Add(new Bitmap(this.GetType(), "Images.Properties.gif")); + imageList.Images.Add(new Bitmap(this.GetType(), "Images.States.gif")); - this.tvOutline.ImageList = imageList; - if (lslEditorForm.outlineToolStripMenuItem.Checked) - { - splitContainer1.Panel2Collapsed = false; - } - else - { - splitContainer1.Panel2Collapsed = true; - } + this.tvOutline.ImageList = imageList; + if (lslEditorForm.outlineToolStripMenuItem.Checked) + { + splitContainer1.Panel2Collapsed = false; + } + else + { + splitContainer1.Panel2Collapsed = true; + } SetFont(); } @@ -199,7 +199,7 @@ namespace LSLEditor tabPage.Text = this.Text; this.parent.OnDirtyChanged(this.numberedTextBoxUC1.TextBox.Dirty); - } + } private void exitToolStripMenuItem_Click(object sender, EventArgs e) { @@ -319,32 +319,32 @@ namespace LSLEditor public void SaveCurrentFile(string strPath) { this.FullPathName = strPath; - Encoding encodeAs = this.encodedAs; - if (this.IsScript && encodeAs == null) - { - switch (Properties.Settings.Default.OutputFormat) - { - case "UTF8": - encodeAs = Encoding.UTF8; - break; - case "Unicode": - encodeAs = Encoding.Unicode; - break; - case "BigEndianUnicode": - encodeAs = Encoding.BigEndianUnicode; - break; - default: - encodeAs = Encoding.Default; - break; - } - } - else if (encodeAs == null) - { - encodeAs = Encoding.UTF8; - } + Encoding encodeAs = this.encodedAs; + if (this.IsScript && encodeAs == null) + { + switch (Properties.Settings.Default.OutputFormat) + { + case "UTF8": + encodeAs = Encoding.UTF8; + break; + case "Unicode": + encodeAs = Encoding.Unicode; + break; + case "BigEndianUnicode": + encodeAs = Encoding.BigEndianUnicode; + break; + default: + encodeAs = Encoding.Default; + break; + } + } + else if (encodeAs == null) + { + encodeAs = Encoding.UTF8; + } - this.numberedTextBoxUC1.TextBox.SaveCurrentFile(strPath, encodeAs); - this.encodedAs = encodeAs; + this.numberedTextBoxUC1.TextBox.SaveCurrentFile(strPath, encodeAs); + this.encodedAs = encodeAs; } public void SaveCurrentFile() @@ -492,44 +492,44 @@ namespace LSLEditor //this.disableCompilesyntaxCheckToolStripMenuItem.Checked = !this.disableCompilesyntaxCheckToolStripMenuItem.Checked; } - private void tvOutline_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) - { - this.parent.BeginInvoke(new TreeNodeMouseClickEventHandler( - delegate(object sender2, TreeNodeMouseClickEventArgs e2) - { - if (e.Node.Tag is Helpers.OutlineHelper) - { - Helpers.OutlineHelper ohOutline = (Helpers.OutlineHelper)e.Node.Tag; - if (ohOutline.line < this.TextBox.Lines.Length) - { - //editForm.Focus(); - //editForm.TextBox.Select(); - //editForm.TextBox.Goto(ohOutline.line + 1); + private void tvOutline_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) + { + this.parent.BeginInvoke(new TreeNodeMouseClickEventHandler( + delegate(object sender2, TreeNodeMouseClickEventArgs e2) + { + if (e.Node.Tag is Helpers.OutlineHelper) + { + Helpers.OutlineHelper ohOutline = (Helpers.OutlineHelper)e.Node.Tag; + if (ohOutline.line < this.TextBox.Lines.Length) + { + //editForm.Focus(); + //editForm.TextBox.Select(); + //editForm.TextBox.Goto(ohOutline.line + 1); - //TextBox.Focus(); - this.TextBox.Select(); - this.TextBox.SelectionStart = this.TextBox.GetFirstCharIndexFromLine(ohOutline.line); - + //TextBox.Focus(); + this.TextBox.Select(); + this.TextBox.SelectionStart = this.TextBox.GetFirstCharIndexFromLine(ohOutline.line); + - } - } - }), sender, e); - } + } + } + }), sender, e); + } - private void tvOutline_AfterSelect(object sender, TreeViewEventArgs e) - { - - //this.TextBox.Select - } + private void tvOutline_AfterSelect(object sender, TreeViewEventArgs e) + { + + //this.TextBox.Select + } - private void splitContainer1_Click(object sender, EventArgs e) - { + private void splitContainer1_Click(object sender, EventArgs e) + { - } + } - private void tvOutline_VisibleChanged(object sender, EventArgs e) - { - this.tvOutline.ExpandAll(); - } + private void tvOutline_VisibleChanged(object sender, EventArgs e) + { + this.tvOutline.ExpandAll(); + } } } \ No newline at end of file diff --git a/trunk/SecondLife/SecondLifeHst.cs b/trunk/SecondLife/SecondLifeHst.cs index 1a918a1..8f8db71 100644 --- a/trunk/SecondLife/SecondLifeHst.cs +++ b/trunk/SecondLife/SecondLifeHst.cs @@ -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,56 +194,55 @@ namespace LSLEditor public void State(string strStateName, bool blnForce) { - if (this.CompiledAssembly == null) - return; - if (blnForce) - this.CurrentStateName = ""; - this.NewStateName = strStateName; - this.StateChanged.Set(); + if (this.CompiledAssembly != null) { + if (blnForce) { + this.CurrentStateName = ""; + } + this.NewStateName = strStateName; + this.StateChanged.Set(); + } } private void SetState() { - if (CompiledAssembly == null) - return; - secondLife = CompiledAssembly.CreateInstance("LSLEditor.State_" + CurrentStateName) as SecondLife; + if (CompiledAssembly != null) { + secondLife = CompiledAssembly.CreateInstance("LSLEditor.State_" + CurrentStateName) as SecondLife; - if (secondLife == null) - { - MessageBox.Show("State " + CurrentStateName+" does not exist!"); - return; + if (secondLife == null) { + MessageBox.Show("State " + CurrentStateName + " does not exist!"); + return; + } + + ListenFilterList = new List(); + + LinkList = new List(); + + // Make friends + secondLife.host = this; + + // Update runtime userinterface by calling event handler + if (OnStateChange != null) { + OnStateChange(this, new SecondLifeHostEventArgs(CurrentStateName)); + } + + ExecuteSecondLife("state_entry"); } - - ListenFilterList = new List(); - - LinkList = new List(); - - // Make friends - secondLife.host = this; - - // Update runtime userinterface by calling event handler - 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 (intI > 0) - strArgs += ","; - strArgs += pi.ParameterType.ToString() + " " + pi.Name; - intI++; + 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); - VerboseEvent(strName, args); - - this.taskQueue.Invoke(secondLife, 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 list = new List(); - 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,10 +445,11 @@ namespace LSLEditor // sink listen public void Listen(SecondLifeHostChatEventArgs e) { - if (secondLife == null) - return; - if (CheckListenFilter(e.channel, e.name, e.id, e.message)) - ExecuteSecondLife("listen", 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 @@ -481,98 +457,99 @@ namespace LSLEditor // 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 != "") { + proxy = new System.Net.WebProxy(Properties.Settings.Default.ProxyServer.Replace("http://", "")); + } - System.Net.WebProxy proxy = null; - 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); + } - 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) - { - VerboseMessage(exception.Message); + 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; - SmtpClient client = new SmtpClient(); - client.SmtpServer = Properties.Settings.Default.EmailServer; + string strName = GetObjectName(); + string strObjectName = string.Format("Object-Name: {0}", strName); - string strName = GetObjectName(); - string strObjectName = string.Format("Object-Name: {0}", strName); + SecondLife.vector RegionCorner = secondLife.llGetRegionCorner(); + string strRegionName = secondLife.llGetRegionName(); + string strRegion = string.Format("Region: {0} ({1},{2})", strRegionName, RegionCorner.x, RegionCorner.y); - SecondLife.vector RegionCorner = secondLife.llGetRegionCorner(); - string strRegionName = secondLife.llGetRegionName(); - string strRegion = string.Format("Region: {0} ({1},{2})", strRegionName, RegionCorner.x, RegionCorner.y); + SecondLife.vector pos = secondLife.llGetPos(); + string strPosition = string.Format("Local-Position: ({0},{1},{2})", (int)pos.x, (int)pos.y, (int)pos.z); - SecondLife.vector pos = secondLife.llGetPos(); - string strPosition = string.Format("Local-Position: ({0},{1},{2})", (int)pos.x, (int)pos.y, (int)pos.z); + string strPrefix = strObjectName + "\r\n"; + strPrefix += strRegion + "\r\n"; + strPrefix += strPosition + "\r\n\r\n"; - string strPrefix = strObjectName + "\r\n"; - strPrefix += strRegion + "\r\n"; - strPrefix += strPosition + "\r\n\r\n"; + MailMessage msg = new MailMessage(); + msg.To = To; + msg.Subject = Subject; + msg.Body = strPrefix + Body; + msg.From = Properties.Settings.Default.EmailAddress; + msg.Headers.Add("Reply-to", msg.From); - MailMessage msg = new MailMessage(); - msg.To = To; - msg.Subject = Subject; - msg.Body = strPrefix + Body; - msg.From = Properties.Settings.Default.EmailAddress; - msg.Headers.Add("Reply-to", msg.From); + //MailAttachment myAttachment = new MailAttachment(strAttachmentFile); + //msg.Attachments.Add(myAttachment); - //MailAttachment myAttachment = new MailAttachment(strAttachmentFile); - //msg.Attachments.Add(myAttachment); - - VerboseMessage(client.Send(msg)); + 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, SecondLife.key k, SecondLife.String name, - SecondLife.String message, + SecondLife.String message, SecondLife.list buttons, SecondLife.integer channel); - private void Dialog(SecondLifeHost host, + private void Dialog(SecondLifeHost host, SecondLife.String objectName, SecondLife.key k, SecondLife.String name, @@ -589,68 +566,62 @@ 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); } - delegate void ShowTextBoxDelegate(SecondLifeHost host, - SecondLife.String objectName, - SecondLife.key k, - SecondLife.String name, - SecondLife.String message, - SecondLife.integer channel); - private void TextBox(SecondLifeHost host, - SecondLife.String objectName, - SecondLife.key k, - SecondLife.String name, - SecondLife.String message, - SecondLife.integer channel) - { - llTextBoxForm TextBoxForm = new llTextBoxForm(host, objectName, k, name, message, channel); - TextBoxForm.Left = this.mainForm.Left + this.mainForm.Width / 2 - TextBoxForm.Width / 2; - TextBoxForm.Top = this.mainForm.Top + this.mainForm.Height / 2 - TextBoxForm.Height / 2; - TextBoxForm.Show(this.mainForm); - this.mainForm.llTextBoxForms.Add(TextBoxForm); - } - public void llTextBox(SecondLife.key avatar, SecondLife.String message, SecondLife.integer channel) - { - if (message.ToString().Length >= 512) - { - VerboseMessage("llTextBox: message too long, must be less than 512 characters"); - return; - } - if (message.ToString().Length == 0) - { - VerboseMessage("llTextBos: must supply a message"); - return; - } - this.mainForm.Invoke(new ShowTextBoxDelegate(TextBox), this, (SecondLife.String)GetObjectName(), secondLife.llGetOwner(), (SecondLife.String)Properties.Settings.Default.AvatarName, message, channel); - } + delegate void ShowTextBoxDelegate(SecondLifeHost host, + SecondLife.String objectName, + SecondLife.key k, + SecondLife.String name, + SecondLife.String message, + SecondLife.integer channel); + private void TextBox(SecondLifeHost host, + SecondLife.String objectName, + SecondLife.key k, + SecondLife.String name, + SecondLife.String message, + SecondLife.integer channel) + { + llTextBoxForm TextBoxForm = new llTextBoxForm(host, objectName, k, name, message, channel); + TextBoxForm.Left = this.mainForm.Left + this.mainForm.Width / 2 - TextBoxForm.Width / 2; + TextBoxForm.Top = this.mainForm.Top + this.mainForm.Height / 2 - TextBoxForm.Height / 2; + TextBoxForm.Show(this.mainForm); + this.mainForm.llTextBoxForms.Add(TextBoxForm); + } + public void llTextBox(SecondLife.key avatar, SecondLife.String message, SecondLife.integer channel) + { + if (message.ToString().Length >= 512) { + VerboseMessage("llTextBox: message too long, must be less than 512 characters"); + return; + } + if (message.ToString().Length == 0) { + VerboseMessage("llTextBos: must supply a message"); + return; + } + this.mainForm.Invoke(new ShowTextBoxDelegate(TextBox), this, (SecondLife.String)GetObjectName(), secondLife.llGetOwner(), (SecondLife.String)Properties.Settings.Default.AvatarName, message, channel); + } public void SetPermissions(SecondLife.integer intPermissions) { @@ -681,12 +652,12 @@ namespace LSLEditor public void llRequestPermissions(SecondLife.key agent, SecondLife.integer intPermissions) { - this.mainForm.Invoke(new RequestPermissionsDelegate(RequestPermissions), + this.mainForm.Invoke(new RequestPermissionsDelegate(RequestPermissions), this, - (SecondLife.String)GetObjectName(), - secondLife.llGetOwner(), - (SecondLife.String)Properties.Settings.Default.AvatarName, - agent, + (SecondLife.String)GetObjectName(), + secondLife.llGetOwner(), + (SecondLife.String)Properties.Settings.Default.AvatarName, + agent, intPermissions); } @@ -694,26 +665,22 @@ 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; - // check againt m_intControls TODO!!!!! + if ((keys & Keys.Up) == Keys.Up) + held |= SecondLife.CONTROL_UP; + if ((keys & Keys.Down) == Keys.Down) + held |= SecondLife.CONTROL_DOWN; + if ((keys & Keys.Left) == Keys.Left) + held |= SecondLife.CONTROL_LEFT; + if ((keys & Keys.Right) == Keys.Right) + held |= SecondLife.CONTROL_RIGHT; - int held = 0; - int change = 0; - - if ((keys & Keys.Up) == Keys.Up) - held |= SecondLife.CONTROL_UP; - if ((keys & Keys.Down) == Keys.Down) - held |= SecondLife.CONTROL_DOWN; - if ((keys & Keys.Left) == Keys.Left) - held |= SecondLife.CONTROL_LEFT; - if ((keys & Keys.Right) == Keys.Right) - held |= SecondLife.CONTROL_RIGHT; - - ExecuteSecondLife("control", (SecondLife.key)Properties.Settings.Default.AvatarKey, (SecondLife.integer)held, (SecondLife.integer)change); + 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 listXmlRpc; public void llOpenRemoteDataChannel() { - if (listXmlRpc == null) + if (listXmlRpc == null) { listXmlRpc = new List(); + } XMLRPC xmlRpc = new XMLRPC(); xmlRpc.OnRequest += new XMLRPC.RequestEventHandler(xmlRpc_OnRequest); xmlRpc.OpenChannel(listXmlRpc.Count); @@ -830,27 +795,23 @@ namespace LSLEditor public void llCloseRemoteDataChannel(SecondLife.key channel) { - if (listXmlRpc == null) - return; - foreach (XMLRPC xmlRpc in listXmlRpc) - { - if (xmlRpc.guid == channel.guid) - { - xmlRpc.CloseChannel(); - break; + 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) - { - xmlRpc.RemoteDataReply(channel.guid, message_id.guid, sdata, idata); - break; + if (listXmlRpc != null) { + foreach (XMLRPC xmlRpc in listXmlRpc) { + if (xmlRpc.guid == channel.guid) { + xmlRpc.RemoteDataReply(channel.guid, message_id.guid, sdata, idata); + break; + } } } } @@ -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,17 +851,19 @@ 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); } @@ -963,16 +929,17 @@ namespace LSLEditor return mainForm.SolutionExplorer.GetInventoryType(this.guid, name); } - public void RemoveInventory(SecondLife.String name) - { - mainForm.SolutionExplorer.RemoveInventory(this.guid, name); - } + public void RemoveInventory(SecondLife.String name) + { + mainForm.SolutionExplorer.RemoveInventory(this.guid, name); + } 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); } diff --git a/trunk/SecondLife/SecondLifeMain.cs b/trunk/SecondLife/SecondLifeMain.cs index 38517d3..6366507 100644 --- a/trunk/SecondLife/SecondLifeMain.cs +++ b/trunk/SecondLife/SecondLifeMain.cs @@ -59,38 +59,38 @@ namespace LSLEditor Whisper, Say, Shout, OwnerSay, RegionSay, RegionSayTo } - public partial class SecondLife - { - // Make friends with my host - public SecondLifeHost host; + public partial class SecondLife + { + // Make friends with my host + public SecondLifeHost host; - #region members - // Random generator - private Random m_random; + #region members + // Random generator + private Random m_random; - private DateTime m_DateTimeScriptStarted; + private DateTime m_DateTimeScriptStarted; - private Boolean m_AllowDrop = false; - private Hashtable m_LandPassList; + private Boolean m_AllowDrop = false; + private Hashtable m_LandPassList; - private Hashtable m_LandBanList; + private Hashtable m_LandBanList; - private Float m_Volume; + private Float m_Volume; - private String m_ObjectName; + private String m_ObjectName; private String m_ParcelMusicURL; - private vector m_pos; - private rotation m_rot; - private rotation m_rotlocal; - private vector m_scale; - private String m_SitText; - private Float m_SoundRadius; + private vector m_pos; + private rotation m_rot; + private rotation m_rotlocal; + private vector m_scale; + private String m_SitText; + private Float m_SoundRadius; - private vector m_RegionCorner; + private vector m_RegionCorner; - private integer m_start_parameter; + private integer m_start_parameter; - #endregion + #endregion #region Properties @@ -104,139 +104,140 @@ namespace LSLEditor #region constructor public SecondLife() - { - host = null; - m_random = new Random(); - m_DateTimeScriptStarted = DateTime.Now.ToUniversalTime(); - m_LandPassList = new Hashtable(); - m_LandBanList = new Hashtable(); - m_Volume = 0.0; - m_ObjectName = null; - m_pos = new vector(127, 128, 20); - m_rot = rotation.ZERO_ROTATION; - m_rotlocal = rotation.ZERO_ROTATION; - m_scale = vector.ZERO_VECTOR; - m_SitText = "sittext"; - m_SoundRadius = 1.0; - m_start_parameter = 0; + { + host = null; + m_random = new Random(); + m_DateTimeScriptStarted = DateTime.Now.ToUniversalTime(); + m_LandPassList = new Hashtable(); + m_LandBanList = new Hashtable(); + m_Volume = 0.0; + m_ObjectName = null; + m_pos = new vector(127, 128, 20); + m_rot = rotation.ZERO_ROTATION; + m_rotlocal = rotation.ZERO_ROTATION; + m_scale = vector.ZERO_VECTOR; + m_SitText = "sittext"; + m_SoundRadius = 1.0; + m_start_parameter = 0; - m_RegionCorner = vector.ZERO_VECTOR; - } - #endregion + m_RegionCorner = vector.ZERO_VECTOR; + } + #endregion - #region internal routines - private void Verbose(string strLine, params object[] parameters) - { - if (parameters.Length == 0) - host.VerboseMessage(strLine); - else - host.VerboseMessage(string.Format(strLine, parameters)); - } + #region internal routines + private void Verbose(string strLine, params object[] parameters) + { + if (parameters.Length == 0) { + host.VerboseMessage(strLine); + } else { + host.VerboseMessage(string.Format(strLine, parameters)); + } + } - private void Chat(integer channel, string message, CommunicationType how) - { - host.Chat(host, channel, host.GetObjectName(), host.GetKey(), message, how); - } + private void Chat(integer channel, string message, CommunicationType how) + { + host.Chat(host, channel, host.GetObjectName(), host.GetKey(), message, how); + } - public void state(string strStateName) - { - Verbose("state->" + strStateName); - host.State(strStateName, false); - System.Threading.Thread.Sleep(1000); - System.Windows.Forms.MessageBox.Show("If you see this, something is wrong", "Oops..."); - } - #endregion + public void state(string strStateName) + { + Verbose("state->" + strStateName); + host.State(strStateName, false); + System.Threading.Thread.Sleep(1000); + System.Windows.Forms.MessageBox.Show("If you see this, something is wrong", "Oops..."); + } + #endregion - #region events as virtuals, if one is used, use override - virtual public void at_rot_target(integer number, rotation target_rotation, rotation our_rotation) { } - virtual public void at_target(integer tnum, vector targetpos, vector ourpos) { } - virtual public void attach(key attached) { } - virtual public void changed(integer changed) { } - virtual public void collision(integer total_number) { } - virtual public void collision_end(integer total_number) { } - virtual public void collision_start(integer total_number) { } - virtual public void control(key name, integer levels, integer edges) { } - virtual public void dataserver(key requested, String data) { } - virtual public void email(String time, String address, String subject, String body, integer remaining) { } - virtual public void http_response(key request_id, integer status, list metadata, String body) { } - virtual public void http_request(key request_id, String method, String body) { } - virtual public void land_collision(vector position) { } - virtual public void land_collision_end(vector position) { } - virtual public void land_collision_start(vector position) { } - virtual public void link_message(integer sender_number, integer number, String message, key id) { } - virtual public void listen(integer channel, String name, key id, String message) { } - virtual public void money(key giver, integer amount) { } - virtual public void moving_end() { } - virtual public void moving_start() { } - virtual public void no_sensor() { } - virtual public void not_at_rot_target() { } - virtual public void not_at_target() { } - virtual public void object_rez(key id) { } - virtual public void on_rez(integer start_param) { } + #region events as virtuals, if one is used, use override + virtual public void at_rot_target(integer number, rotation target_rotation, rotation our_rotation) { } + virtual public void at_target(integer tnum, vector targetpos, vector ourpos) { } + virtual public void attach(key attached) { } + virtual public void changed(integer changed) { } + virtual public void collision(integer total_number) { } + virtual public void collision_end(integer total_number) { } + virtual public void collision_start(integer total_number) { } + virtual public void control(key name, integer levels, integer edges) { } + virtual public void dataserver(key requested, String data) { } + virtual public void email(String time, String address, String subject, String body, integer remaining) { } + virtual public void http_response(key request_id, integer status, list metadata, String body) { } + virtual public void http_request(key request_id, String method, String body) { } + virtual public void land_collision(vector position) { } + virtual public void land_collision_end(vector position) { } + virtual public void land_collision_start(vector position) { } + virtual public void link_message(integer sender_number, integer number, String message, key id) { } + virtual public void listen(integer channel, String name, key id, String message) { } + virtual public void money(key giver, integer amount) { } + virtual public void moving_end() { } + virtual public void moving_start() { } + virtual public void no_sensor() { } + virtual public void not_at_rot_target() { } + virtual public void not_at_target() { } + virtual public void object_rez(key id) { } + virtual public void on_rez(integer start_param) { } virtual public void path_update(integer iType, list lReserved) { } - virtual public void remote_data(integer event_type, key channel, key message_id, String sender, integer idata, String sdata) { } - virtual public void run_time_permissions(integer permissions) { } - virtual public void sensor(integer total_number) { } - virtual public void state_entry() { } - virtual public void state_exit() { } - virtual public void timer() { } - virtual public void touch(integer total_number) { } - virtual public void touch_end(integer total_number) { } - virtual public void touch_start(integer total_number) { } - virtual public void transaction_result(key kID, integer iSuccess, String sMessage) { } - #endregion + virtual public void remote_data(integer event_type, key channel, key message_id, String sender, integer idata, String sdata) { } + virtual public void run_time_permissions(integer permissions) { } + virtual public void sensor(integer total_number) { } + virtual public void state_entry() { } + virtual public void state_exit() { } + virtual public void timer() { } + virtual public void touch(integer total_number) { } + virtual public void touch_end(integer total_number) { } + virtual public void touch_start(integer total_number) { } + virtual public void transaction_result(key kID, integer iSuccess, String sMessage) { } + #endregion - #region all constants - public const int TRUE = 1; - public const int FALSE = 0; + #region all constants + public const int TRUE = 1; + public const int FALSE = 0; - public const int DENSITY = 1; - public const int FRICTION = 2; - public const int GRAVITY_MULTIPLIER = 8; - public const int RESTITUTION = 4; + public const int DENSITY = 1; + public const int FRICTION = 2; + public const int GRAVITY_MULTIPLIER = 8; + public const int RESTITUTION = 4; - public const int AGENT = 1; - public const int ACTIVE = 2; - public const int PASSIVE = 4; - public const int SCRIPTED = 8; + public const int AGENT = 1; + public const int ACTIVE = 2; + public const int PASSIVE = 4; + public const int SCRIPTED = 8; - public const int ANIM_ON = 1; - public const int LOOP = 2; - public const int REVERSE = 4; - public const int PING_PONG = 8; - public const int SMOOTH = 16; - public const int ROTATE = 32; - public const int SCALE = 64; + public const int ANIM_ON = 1; + public const int LOOP = 2; + public const int REVERSE = 4; + public const int PING_PONG = 8; + public const int SMOOTH = 16; + public const int ROTATE = 32; + public const int SCALE = 64; - public static readonly Float PI = 3.1415926535897932384626; - public static readonly Float TWO_PI = 2.0 * PI; - public static readonly Float PI_BY_TWO = 1.570796; - public static readonly Float DEG_TO_RAD = 0.017453; - public static readonly Float RAD_TO_DEG = 57.295780; - public static readonly Float SQRT2 = 1.414214; + public static readonly Float PI = 3.1415926535897932384626; + public static readonly Float TWO_PI = 2.0 * PI; + public static readonly Float PI_BY_TWO = 1.570796; + public static readonly Float DEG_TO_RAD = 0.017453; + public static readonly Float RAD_TO_DEG = 57.295780; + public static readonly Float SQRT2 = 1.414214; - public static readonly key NULL_KEY = key.NULL_KEY; - public static readonly rotation ZERO_ROTATION = rotation.ZERO_ROTATION; - public static readonly vector ZERO_VECTOR = vector.ZERO_VECTOR; + public static readonly key NULL_KEY = key.NULL_KEY; + public static readonly rotation ZERO_ROTATION = rotation.ZERO_ROTATION; + public static readonly vector ZERO_VECTOR = vector.ZERO_VECTOR; - public const int ALL_SIDES = -1; + public const int ALL_SIDES = -1; - public const int DEBUG_CHANNEL = 2147483647; - public const string EOF = "\n\n\n"; + public const int DEBUG_CHANNEL = 2147483647; + public const string EOF = "\n\n\n"; - public const int AGENT_FLYING = 1; - public const int AGENT_ATTACHMENTS = 2; - public const int AGENT_SCRIPTED = 4; - public const int AGENT_MOUSELOOK = 8; - public const int AGENT_SITTING = 16; - public const int AGENT_ON_OBJECT = 32; - public const int AGENT_AWAY = 64; - public const int AGENT_WALKING = 128; - public const int AGENT_IN_AIR = 256; - public const int AGENT_TYPING = 512; - public const int AGENT_CROUCHING = 1024; - public const int AGENT_BUSY = 2048; - public const int AGENT_ALWAYS_RUN = 4096; + public const int AGENT_FLYING = 1; + public const int AGENT_ATTACHMENTS = 2; + public const int AGENT_SCRIPTED = 4; + public const int AGENT_MOUSELOOK = 8; + public const int AGENT_SITTING = 16; + public const int AGENT_ON_OBJECT = 32; + public const int AGENT_AWAY = 64; + public const int AGENT_WALKING = 128; + public const int AGENT_IN_AIR = 256; + public const int AGENT_TYPING = 512; + public const int AGENT_CROUCHING = 1024; + public const int AGENT_BUSY = 2048; + public const int AGENT_ALWAYS_RUN = 4096; public const int AGENT_AUTOPILOT = 0x2000; public const int AGENT_BY_LEGACY_NAME = 0x1; public const int AGENT_BY_USERNAME = 0x10; @@ -245,83 +246,83 @@ namespace LSLEditor public const int AGENT_LIST_PARCEL_OWNER = 0x02; public const int AGENT_LIST_REGION = 0x04; - public const int ATTACH_AVATAR_CENTER = 40; - public const int ATTACH_BACK = 9; - public const int ATTACH_CHEST = 1; - public const int ATTACH_CHIN = 12; - public const int ATTACH_HEAD = 2; - public const int ATTACH_LSHOULDER = 3; - public const int ATTACH_RSHOULDER = 4; - public const int ATTACH_LHAND = 5; - public const int ATTACH_RHAND = 6; - public const int ATTACH_LFOOT = 7; - public const int ATTACH_RFOOT = 8; - public const int ATTACH_PELVIS = 10; - public const int ATTACH_MOUTH = 11; - public const int ATTACH_NECK = 39; - public const int ATTACH_LEAR = 13; - public const int ATTACH_LEFT_PEC = 29; - public const int ATTACH_REAR = 14; - public const int ATTACH_LEYE = 15; - public const int ATTACH_REYE = 16; - public const int ATTACH_NOSE = 17; - public const int ATTACH_RUARM = 18; - public const int ATTACH_RLARM = 19; - public const int ATTACH_LUARM = 20; - public const int ATTACH_LLARM = 21; - public const int ATTACH_RHIP = 22; - public const int ATTACH_RIGHT_PEC = 30; - public const int ATTACH_RULEG = 23; - public const int ATTACH_RLLEG = 24; - public const int ATTACH_LHIP = 25; - public const int ATTACH_LULEG = 26; - public const int ATTACH_LLLEG = 27; - public const int ATTACH_BELLY = 28; - public const int ATTACH_RPEC = 29; - public const int ATTACH_LPEC = 30; + public const int ATTACH_AVATAR_CENTER = 40; + public const int ATTACH_BACK = 9; + public const int ATTACH_CHEST = 1; + public const int ATTACH_CHIN = 12; + public const int ATTACH_HEAD = 2; + public const int ATTACH_LSHOULDER = 3; + public const int ATTACH_RSHOULDER = 4; + public const int ATTACH_LHAND = 5; + public const int ATTACH_RHAND = 6; + public const int ATTACH_LFOOT = 7; + public const int ATTACH_RFOOT = 8; + public const int ATTACH_PELVIS = 10; + public const int ATTACH_MOUTH = 11; + public const int ATTACH_NECK = 39; + public const int ATTACH_LEAR = 13; + public const int ATTACH_LEFT_PEC = 29; + public const int ATTACH_REAR = 14; + public const int ATTACH_LEYE = 15; + public const int ATTACH_REYE = 16; + public const int ATTACH_NOSE = 17; + public const int ATTACH_RUARM = 18; + public const int ATTACH_RLARM = 19; + public const int ATTACH_LUARM = 20; + public const int ATTACH_LLARM = 21; + public const int ATTACH_RHIP = 22; + public const int ATTACH_RIGHT_PEC = 30; + public const int ATTACH_RULEG = 23; + public const int ATTACH_RLLEG = 24; + public const int ATTACH_LHIP = 25; + public const int ATTACH_LULEG = 26; + public const int ATTACH_LLLEG = 27; + public const int ATTACH_BELLY = 28; + public const int ATTACH_RPEC = 29; + public const int ATTACH_LPEC = 30; - public const int ATTACH_HUD_CENTER_2 = 31; - public const int ATTACH_HUD_TOP_RIGHT = 32; - public const int ATTACH_HUD_TOP_CENTER = 33; - public const int ATTACH_HUD_TOP_LEFT = 34; - public const int ATTACH_HUD_CENTER_1 = 35; - public const int ATTACH_HUD_BOTTOM_LEFT = 36; - public const int ATTACH_HUD_BOTTOM = 37; - public const int ATTACH_HUD_BOTTOM_RIGHT = 38; + public const int ATTACH_HUD_CENTER_2 = 31; + public const int ATTACH_HUD_TOP_RIGHT = 32; + public const int ATTACH_HUD_TOP_CENTER = 33; + public const int ATTACH_HUD_TOP_LEFT = 34; + public const int ATTACH_HUD_CENTER_1 = 35; + public const int ATTACH_HUD_BOTTOM_LEFT = 36; + public const int ATTACH_HUD_BOTTOM = 37; + public const int ATTACH_HUD_BOTTOM_RIGHT = 38; public const int AVOID_NONE = 0; public const int AVOID_CHARACTERS = 1; public const int AVOID_DYNAMIC_OBSTACLES = 2; - public const int CAMERA_PITCH = 0; - public const int CAMERA_FOCUS_OFFSET = 1; - public const int CAMERA_POSITION_LAG = 5; - public const int CAMERA_FOCUS_LAG = 6; - public const int CAMERA_DISTANCE = 7; - public const int CAMERA_BEHINDNESS_ANGLE = 8; - public const int CAMERA_BEHINDNESS_LAG = 9; - public const int CAMERA_POSITION_THRESHOLD = 10; - public const int CAMERA_FOCUS_THRESHOLD = 11; - public const int CAMERA_ACTIVE = 12; - public const int CAMERA_POSITION = 13; - public const int CAMERA_FOCUS = 17; - public const int CAMERA_FOCUS_LOCKED = 22; - public const int CAMERA_POSITION_LOCKED = 21; + public const int CAMERA_PITCH = 0; + public const int CAMERA_FOCUS_OFFSET = 1; + public const int CAMERA_POSITION_LAG = 5; + public const int CAMERA_FOCUS_LAG = 6; + public const int CAMERA_DISTANCE = 7; + public const int CAMERA_BEHINDNESS_ANGLE = 8; + public const int CAMERA_BEHINDNESS_LAG = 9; + public const int CAMERA_POSITION_THRESHOLD = 10; + public const int CAMERA_FOCUS_THRESHOLD = 11; + public const int CAMERA_ACTIVE = 12; + public const int CAMERA_POSITION = 13; + public const int CAMERA_FOCUS = 17; + public const int CAMERA_FOCUS_LOCKED = 22; + public const int CAMERA_POSITION_LOCKED = 21; - public const int CHANGED_INVENTORY = 1; - public const int CHANGED_COLOR = 2; - public const int CHANGED_SHAPE = 4; - public const int CHANGED_SCALE = 8; - public const int CHANGED_TEXTURE = 16; - public const int CHANGED_LINK = 32; - public const int CHANGED_ALLOWED_DROP = 64; - public const int CHANGED_OWNER = 128; - public const int CHANGED_REGION = 256; - public const int CHANGED_TELEPORT = 512; - public const int CHANGED_REGION_START = 1024; + public const int CHANGED_INVENTORY = 1; + public const int CHANGED_COLOR = 2; + public const int CHANGED_SHAPE = 4; + public const int CHANGED_SCALE = 8; + public const int CHANGED_TEXTURE = 16; + public const int CHANGED_LINK = 32; + public const int CHANGED_ALLOWED_DROP = 64; + public const int CHANGED_OWNER = 128; + public const int CHANGED_REGION = 256; + public const int CHANGED_TELEPORT = 512; + public const int CHANGED_REGION_START = 1024; public const int CHANGED_MEDIA = 2048; - public const int CHARACTER_ACCOUNT_FOR_SKIPPED_FRAMES = 14; + public const int CHARACTER_ACCOUNT_FOR_SKIPPED_FRAMES = 14; public const int CHARACTER_AVOIDANCE_MODE = 5; public const int CHARACTER_CMD_JUMP = 0x01; public const int CHARACTER_CMD_STOP = 0x00; @@ -330,29 +331,29 @@ namespace LSLEditor public const int CHARACTER_TYPE = 6; public const int CHARACTER_MAX_ACCEL = 8; public const int CHARACTER_MAX_DECEL = 9; - public const int CHARACTER_MAX_SPEED = 13; - public const int CHARACTER_MAX_TURN_RADIUS = 10; - public const int CHARACTER_ORIENTATION = 4; - public const int CHARACTER_RADIUS = 2; - public const int CHARACTER_STAY_WITHIN_PARCEL = 15; + public const int CHARACTER_MAX_SPEED = 13; + public const int CHARACTER_MAX_TURN_RADIUS = 10; + public const int CHARACTER_ORIENTATION = 4; + public const int CHARACTER_RADIUS = 2; + public const int CHARACTER_STAY_WITHIN_PARCEL = 15; public const int CHARACTER_TYPE_A = 0; public const int CHARACTER_TYPE_B = 1; public const int CHARACTER_TYPE_C = 2; public const int CHARACTER_TYPE_D = 3; public const int CHARACTER_TYPE_NONE = 4; - public const int CLICK_ACTION_NONE = 0; - public const int CLICK_ACTION_TOUCH = 0; - public const int CLICK_ACTION_SIT = 1; - public const int CLICK_ACTION_BUY = 2; - public const int CLICK_ACTION_PAY = 3; - public const int CLICK_ACTION_OPEN = 4; - public const int CLICK_ACTION_PLAY = 5; - public const int CLICK_ACTION_OPEN_MEDIA = 6; + public const int CLICK_ACTION_NONE = 0; + public const int CLICK_ACTION_TOUCH = 0; + public const int CLICK_ACTION_SIT = 1; + public const int CLICK_ACTION_BUY = 2; + public const int CLICK_ACTION_PAY = 3; + public const int CLICK_ACTION_OPEN = 4; + public const int CLICK_ACTION_PLAY = 5; + public const int CLICK_ACTION_OPEN_MEDIA = 6; public static readonly string CONTENT_TYPE_ATOM = "application/atom+xml"; public static readonly string CONTENT_TYPE_FORM = "application/x-www-form-urlencoded"; - public static readonly string CONTENT_TYPE_HTML = "text/html"; + public static readonly string CONTENT_TYPE_HTML = "text/html"; public static readonly string CONTENT_TYPE_JSON = "application/json"; public static readonly string CONTENT_TYPE_LLSD = "application/llsd+xml"; public static readonly string CONTENT_TYPE_RSS = "application/rss+xml"; @@ -360,142 +361,142 @@ namespace LSLEditor public static readonly string CONTENT_TYPE_XHTML = "application/xhtml+xml"; public static readonly string CONTENT_TYPE_XML = "application/xml"; - public const int CONTROL_FWD = 1; - public const int CONTROL_BACK = 2; - public const int CONTROL_LEFT = 4; - public const int CONTROL_RIGHT = 8; - public const int CONTROL_ROT_LEFT = 256; - public const int CONTROL_ROT_RIGHT = 512; - public const int CONTROL_UP = 16; - public const int CONTROL_DOWN = 32; - public const int CONTROL_LBUTTON = 268435456; - public const int CONTROL_ML_LBUTTON = 1073741824; + public const int CONTROL_FWD = 1; + public const int CONTROL_BACK = 2; + public const int CONTROL_LEFT = 4; + public const int CONTROL_RIGHT = 8; + public const int CONTROL_ROT_LEFT = 256; + public const int CONTROL_ROT_RIGHT = 512; + public const int CONTROL_UP = 16; + public const int CONTROL_DOWN = 32; + public const int CONTROL_LBUTTON = 268435456; + public const int CONTROL_ML_LBUTTON = 1073741824; - public const int DATA_ONLINE = 1; - public const int DATA_NAME = 2; - public const int DATA_BORN = 3; - public const int DATA_RATING = 4; + public const int DATA_ONLINE = 1; + public const int DATA_NAME = 2; + public const int DATA_BORN = 3; + public const int DATA_RATING = 4; - public const int DATA_SIM_POS = 5; - public const int DATA_SIM_STATUS = 6; - public const int DATA_SIM_RATING = 7; + public const int DATA_SIM_POS = 5; + public const int DATA_SIM_STATUS = 6; + public const int DATA_SIM_RATING = 7; - public const int DATA_PAYINFO = 8; + public const int DATA_PAYINFO = 8; - public const int ERR_GENERIC = -1; - public const int ERR_MALFORMED_PARAMS = -3; - public const int ERR_PARCEL_PERMISSIONS = -2; - public const int ERR_RUNTIME_PERMISSIONS = -4; - public const int ERR_THROTTLED = -5; + public const int ERR_GENERIC = -1; + public const int ERR_MALFORMED_PARAMS = -3; + public const int ERR_PARCEL_PERMISSIONS = -2; + public const int ERR_RUNTIME_PERMISSIONS = -4; + public const int ERR_THROTTLED = -5; - public const int ESTATE_ACCESS_ALLOWED_AGENT_ADD = 4; - public const int ESTATE_ACCESS_ALLOWED_AGENT_REMOVE = 8; - public const int ESTATE_ACCESS_ALLOWED_GROUP_ADD = 16; - public const int ESTATE_ACCESS_ALLOWED_GROUP_REMOVE = 32; - public const int ESTATE_ACCESS_BANNED_AGENT_ADD = 64; - public const int ESTATE_ACCESS_BANNED_AGENT_REMOVE = 128; + public const int ESTATE_ACCESS_ALLOWED_AGENT_ADD = 4; + public const int ESTATE_ACCESS_ALLOWED_AGENT_REMOVE = 8; + public const int ESTATE_ACCESS_ALLOWED_GROUP_ADD = 16; + public const int ESTATE_ACCESS_ALLOWED_GROUP_REMOVE = 32; + public const int ESTATE_ACCESS_BANNED_AGENT_ADD = 64; + public const int ESTATE_ACCESS_BANNED_AGENT_REMOVE = 128; public const int FORCE_DIRECT_PATH = 1; - public const int HTTP_BODY_MAXLENGTH = 2; - public const int HTTP_BODY_TRUNCATED = 0; - public const int HTTP_METHOD = 0; - public const int HTTP_MIMETYPE = 1; - public const int HTTP_PRAGMA_NO_CACHE = 6; - public const int HTTP_VERBOSE_THROTTLE = 4; - public const int HTTP_VERIFY_CERT = 3; + public const int HTTP_BODY_MAXLENGTH = 2; + public const int HTTP_BODY_TRUNCATED = 0; + public const int HTTP_METHOD = 0; + public const int HTTP_MIMETYPE = 1; + public const int HTTP_PRAGMA_NO_CACHE = 6; + public const int HTTP_VERBOSE_THROTTLE = 4; + public const int HTTP_VERIFY_CERT = 3; - public const int HORIZONTAL = 1; + public const int HORIZONTAL = 1; - public const int INVENTORY_ALL = -1; - public const int INVENTORY_NONE = -1; - public const int INVENTORY_TEXTURE = 0; - public const int INVENTORY_SOUND = 1; - public const int INVENTORY_LANDMARK = 3; - public const int INVENTORY_CLOTHING = 5; - public const int INVENTORY_OBJECT = 6; - public const int INVENTORY_NOTECARD = 7; - public const int INVENTORY_SCRIPT = 10; - public const int INVENTORY_BODYPART = 13; - public const int INVENTORY_ANIMATION = 20; - public const int INVENTORY_GESTURE = 21; + public const int INVENTORY_ALL = -1; + public const int INVENTORY_NONE = -1; + public const int INVENTORY_TEXTURE = 0; + public const int INVENTORY_SOUND = 1; + public const int INVENTORY_LANDMARK = 3; + public const int INVENTORY_CLOTHING = 5; + public const int INVENTORY_OBJECT = 6; + public const int INVENTORY_NOTECARD = 7; + public const int INVENTORY_SCRIPT = 10; + public const int INVENTORY_BODYPART = 13; + public const int INVENTORY_ANIMATION = 20; + public const int INVENTORY_GESTURE = 21; - public static readonly string JSON_ARRAY = "\uFDD2"; - public static readonly string JSON_FALSE = "\uFDD7"; - public static readonly string JSON_INVALID = "\uFDD0"; - public static readonly string JSON_NULL = "\uFDD5"; - public static readonly string JSON_NUMBER = "\uFDD3"; - public static readonly string JSON_OBJECT = "\uFDD1"; - public static readonly string JSON_STRING = "\uFDD4"; - public static readonly string JSON_TRUE = "\uFDD6"; + public static readonly string JSON_ARRAY = "\uFDD2"; + public static readonly string JSON_FALSE = "\uFDD7"; + public static readonly string JSON_INVALID = "\uFDD0"; + public static readonly string JSON_NULL = "\uFDD5"; + public static readonly string JSON_NUMBER = "\uFDD3"; + public static readonly string JSON_OBJECT = "\uFDD1"; + public static readonly string JSON_STRING = "\uFDD4"; + public static readonly string JSON_TRUE = "\uFDD6"; - public const int KFM_CMD_PAUSE = 2; - public const int KFM_CMD_PLAY = 0; - public const int KFM_CMD_STOP = 1; - public const int KFM_COMMAND = 0; - public const int KFM_DATA = 2; - public const int KFM_FORWARD = 0; - public const int KFM_LOOP = 1; - public const int KFM_MODE = 1; - public const int KFM_PING_PONG = 2; - public const int KFM_REVERSE = 2; - public const int KFM_ROTATION = 1; - public const int KFM_TRANSLATION = 2; + public const int KFM_CMD_PAUSE = 2; + public const int KFM_CMD_PLAY = 0; + public const int KFM_CMD_STOP = 1; + public const int KFM_COMMAND = 0; + public const int KFM_DATA = 2; + public const int KFM_FORWARD = 0; + public const int KFM_LOOP = 1; + public const int KFM_MODE = 1; + public const int KFM_PING_PONG = 2; + public const int KFM_REVERSE = 2; + public const int KFM_ROTATION = 1; + public const int KFM_TRANSLATION = 2; - public const int LAND_LEVEL = 0; - public const int LAND_RAISE = 1; - public const int LAND_LOWER = 2; - public const int LAND_SMOOTH = 3; - public const int LAND_NOISE = 4; - public const int LAND_REVERT = 5; + public const int LAND_LEVEL = 0; + public const int LAND_RAISE = 1; + public const int LAND_LOWER = 2; + public const int LAND_SMOOTH = 3; + public const int LAND_NOISE = 4; + public const int LAND_REVERT = 5; - public const int LAND_LARGE_BRUSH = 3; - public const int LAND_MEDIUM_BRUSH = 2; - public const int LAND_SMALL_BRUSH = 1; + public const int LAND_LARGE_BRUSH = 3; + public const int LAND_MEDIUM_BRUSH = 2; + public const int LAND_SMALL_BRUSH = 1; - public const int LINK_ROOT = 1; - public const int LINK_SET = -1; - public const int LINK_ALL_OTHERS = -2; - public const int LINK_ALL_CHILDREN = -3; - public const int LINK_THIS = -4; + public const int LINK_ROOT = 1; + public const int LINK_SET = -1; + public const int LINK_ALL_OTHERS = -2; + public const int LINK_ALL_CHILDREN = -3; + public const int LINK_THIS = -4; - public const int LIST_STAT_RANGE = 0; - public const int LIST_STAT_MIN = 1; - public const int LIST_STAT_MAX = 2; - public const int LIST_STAT_MEAN = 3; - public const int LIST_STAT_MEDIAN = 4; - public const int LIST_STAT_STD_DEV = 5; - public const int LIST_STAT_SUM = 6; - public const int LIST_STAT_SUM_SQUARES = 7; - public const int LIST_STAT_NUM_COUNT = 8; - public const int LIST_STAT_GEOMETRIC_MEAN = 9; + public const int LIST_STAT_RANGE = 0; + public const int LIST_STAT_MIN = 1; + public const int LIST_STAT_MAX = 2; + public const int LIST_STAT_MEAN = 3; + public const int LIST_STAT_MEDIAN = 4; + public const int LIST_STAT_STD_DEV = 5; + public const int LIST_STAT_SUM = 6; + public const int LIST_STAT_SUM_SQUARES = 7; + public const int LIST_STAT_NUM_COUNT = 8; + public const int LIST_STAT_GEOMETRIC_MEAN = 9; - public const int MASK_BASE = 0; - public const int MASK_EVERYONE = 3; - public const int MASK_GROUP = 2; - public const int MASK_NEXT = 4; - public const int MASK_OWNER = 1; + public const int MASK_BASE = 0; + public const int MASK_EVERYONE = 3; + public const int MASK_GROUP = 2; + public const int MASK_NEXT = 4; + public const int MASK_OWNER = 1; - public const int OBJECT_ATTACHED_POINT = 19; + public const int OBJECT_ATTACHED_POINT = 19; public const int OBJECT_CHARACTER_TIME = 17; - public const int OBJECT_NAME = 1; - public const int OBJECT_DESC = 2; - public const int OBJECT_POS = 3; - public const int OBJECT_ROOT = 18; - public const int OBJECT_ROT = 4; - public const int OBJECT_VELOCITY = 5; - public const int OBJECT_OWNER = 6; - public const int OBJECT_PATHFINDING_TYPE = 20; - public const int OBJECT_GROUP = 7; - public const int OBJECT_CREATOR = 8; - public const int OBJECT_PHYSICS = 21; - public const int OBJECT_PHANTOM = 22; - public const int OBJECT_TEMP_ON_REZ = 23; + public const int OBJECT_NAME = 1; + public const int OBJECT_DESC = 2; + public const int OBJECT_POS = 3; + public const int OBJECT_ROOT = 18; + public const int OBJECT_ROT = 4; + public const int OBJECT_VELOCITY = 5; + public const int OBJECT_OWNER = 6; + public const int OBJECT_PATHFINDING_TYPE = 20; + public const int OBJECT_GROUP = 7; + public const int OBJECT_CREATOR = 8; + public const int OBJECT_PHYSICS = 21; + public const int OBJECT_PHANTOM = 22; + public const int OBJECT_TEMP_ON_REZ = 23; - public const int OBJECT_STREAMING_COST = 15; - public const int OBJECT_PHYSICS_COST = 16; - public const int OBJECT_SERVER_COST = 14; - public const int OBJECT_PRIM_EQUIVALENCE = 13; + public const int OBJECT_STREAMING_COST = 15; + public const int OBJECT_PHYSICS_COST = 16; + public const int OBJECT_SERVER_COST = 14; + public const int OBJECT_PRIM_EQUIVALENCE = 13; public const int OBJECT_RUNNING_SCRIPT_COUNT = 9; public const int OBJECT_SCRIPT_MEMORY = 11; @@ -503,251 +504,251 @@ namespace LSLEditor public const int OBJECT_TOTAL_SCRIPT_COUNT = 10; public const int OBJECT_UNKNOWN_DETAIL = -1; - public const int OPT_AVATAR = 1; - public const int OPT_CHARACTER = 2; - public const int OPT_EXCLUSION_VOLUME = 6; - public const int OPT_LEGACY_LINKSET = 0; - public const int OPT_MATERIAL_VOLUME = 5; - public const int OPT_OTHER = -1; - public const int OPT_STATIC_OBSTACLE = 4; - public const int OPT_WALKABLE = 3; + public const int OPT_AVATAR = 1; + public const int OPT_CHARACTER = 2; + public const int OPT_EXCLUSION_VOLUME = 6; + public const int OPT_LEGACY_LINKSET = 0; + public const int OPT_MATERIAL_VOLUME = 5; + public const int OPT_OTHER = -1; + public const int OPT_STATIC_OBSTACLE = 4; + public const int OPT_WALKABLE = 3; - public const int OBJECT_RETURN_PARCEL = 1; - public const int OBJECT_RETURN_PARCEL_OWNER = 2; - public const int OBJECT_RETURN_REGION = 4; + public const int OBJECT_RETURN_PARCEL = 1; + public const int OBJECT_RETURN_PARCEL_OWNER = 2; + public const int OBJECT_RETURN_REGION = 4; - public const int PARCEL_COUNT_TOTAL = 0; - public const int PARCEL_COUNT_OWNER = 1; - public const int PARCEL_COUNT_GROUP = 2; - public const int PARCEL_COUNT_OTHER = 3; - public const int PARCEL_COUNT_SELECTED = 4; - public const int PARCEL_COUNT_TEMP = 5; + public const int PARCEL_COUNT_TOTAL = 0; + public const int PARCEL_COUNT_OWNER = 1; + public const int PARCEL_COUNT_GROUP = 2; + public const int PARCEL_COUNT_OTHER = 3; + public const int PARCEL_COUNT_SELECTED = 4; + public const int PARCEL_COUNT_TEMP = 5; - public const int PARCEL_DETAILS_AREA = 4; - public const int PARCEL_DETAILS_DESC = 1; - public const int PARCEL_DETAILS_GROUP = 3; - public const int PARCEL_DETAILS_ID = 5; - public const int PARCEL_DETAILS_NAME = 0; - public const int PARCEL_DETAILS_OWNER = 2; - public const int PARCEL_DETAILS_SEE_AVATARS = 6; + public const int PARCEL_DETAILS_AREA = 4; + public const int PARCEL_DETAILS_DESC = 1; + public const int PARCEL_DETAILS_GROUP = 3; + public const int PARCEL_DETAILS_ID = 5; + public const int PARCEL_DETAILS_NAME = 0; + public const int PARCEL_DETAILS_OWNER = 2; + public const int PARCEL_DETAILS_SEE_AVATARS = 6; - public const int PARCEL_FLAG_ALLOW_FLY = 0x0000001; - public const int PARCEL_FLAG_ALLOW_SCRIPTS = 0x0000002; - public const int PARCEL_FLAG_ALLOW_LANDMARK = 0x0000008; - public const int PARCEL_FLAG_ALLOW_TERRAFORM = 0x0000010; - public const int PARCEL_FLAG_ALLOW_DAMAGE = 0x0000020; - public const int PARCEL_FLAG_ALLOW_CREATE_OBJECTS = 0x0000040; - public const int PARCEL_FLAG_USE_ACCESS_GROUP = 0x0000100; - public const int PARCEL_FLAG_USE_ACCESS_LIST = 0x0000200; - public const int PARCEL_FLAG_USE_BAN_LIST = 0x0000400; - public const int PARCEL_FLAG_USE_LAND_PASS_LIST = 0x0000800; - public const int PARCEL_FLAG_LOCAL_SOUND_ONLY = 0x0008000; - public const int PARCEL_FLAG_RESTRICT_PUSHOBJECT = 0x0200000; - public const int PARCEL_FLAG_ALLOW_GROUP_SCRIPTS = 0x2000000; + public const int PARCEL_FLAG_ALLOW_FLY = 0x0000001; + public const int PARCEL_FLAG_ALLOW_SCRIPTS = 0x0000002; + public const int PARCEL_FLAG_ALLOW_LANDMARK = 0x0000008; + public const int PARCEL_FLAG_ALLOW_TERRAFORM = 0x0000010; + public const int PARCEL_FLAG_ALLOW_DAMAGE = 0x0000020; + public const int PARCEL_FLAG_ALLOW_CREATE_OBJECTS = 0x0000040; + public const int PARCEL_FLAG_USE_ACCESS_GROUP = 0x0000100; + public const int PARCEL_FLAG_USE_ACCESS_LIST = 0x0000200; + public const int PARCEL_FLAG_USE_BAN_LIST = 0x0000400; + public const int PARCEL_FLAG_USE_LAND_PASS_LIST = 0x0000800; + public const int PARCEL_FLAG_LOCAL_SOUND_ONLY = 0x0008000; + public const int PARCEL_FLAG_RESTRICT_PUSHOBJECT = 0x0200000; + public const int PARCEL_FLAG_ALLOW_GROUP_SCRIPTS = 0x2000000; - public const int PARCEL_FLAG_ALLOW_CREATE_GROUP_OBJECTS = 0x4000000; - public const int PARCEL_FLAG_ALLOW_ALL_OBJECT_ENTRY = 0x8000000; - public const int PARCEL_FLAG_ALLOW_GROUP_OBJECT_ENTRY = 0x10000000; + public const int PARCEL_FLAG_ALLOW_CREATE_GROUP_OBJECTS = 0x4000000; + public const int PARCEL_FLAG_ALLOW_ALL_OBJECT_ENTRY = 0x8000000; + public const int PARCEL_FLAG_ALLOW_GROUP_OBJECT_ENTRY = 0x10000000; - public const int PARCEL_MEDIA_COMMAND_STOP = 0; - public const int PARCEL_MEDIA_COMMAND_PAUSE = 1; - public const int PARCEL_MEDIA_COMMAND_PLAY = 2; - public const int PARCEL_MEDIA_COMMAND_LOOP = 3; - public const int PARCEL_MEDIA_COMMAND_TEXTURE = 4; - public const int PARCEL_MEDIA_COMMAND_URL = 5; - public const int PARCEL_MEDIA_COMMAND_TIME = 6; - public const int PARCEL_MEDIA_COMMAND_AGENT = 7; - public const int PARCEL_MEDIA_COMMAND_UNLOAD = 8; - public const int PARCEL_MEDIA_COMMAND_AUTO_ALIGN = 9; + public const int PARCEL_MEDIA_COMMAND_STOP = 0; + public const int PARCEL_MEDIA_COMMAND_PAUSE = 1; + public const int PARCEL_MEDIA_COMMAND_PLAY = 2; + public const int PARCEL_MEDIA_COMMAND_LOOP = 3; + public const int PARCEL_MEDIA_COMMAND_TEXTURE = 4; + public const int PARCEL_MEDIA_COMMAND_URL = 5; + public const int PARCEL_MEDIA_COMMAND_TIME = 6; + public const int PARCEL_MEDIA_COMMAND_AGENT = 7; + public const int PARCEL_MEDIA_COMMAND_UNLOAD = 8; + public const int PARCEL_MEDIA_COMMAND_AUTO_ALIGN = 9; - public const int PARCEL_MEDIA_COMMAND_TYPE = 10; - public const int PARCEL_MEDIA_COMMAND_SIZE = 11; - public const int PARCEL_MEDIA_COMMAND_DESC = 12; - public const int PARCEL_MEDIA_COMMAND_LOOP_SET = 13; + public const int PARCEL_MEDIA_COMMAND_TYPE = 10; + public const int PARCEL_MEDIA_COMMAND_SIZE = 11; + public const int PARCEL_MEDIA_COMMAND_DESC = 12; + public const int PARCEL_MEDIA_COMMAND_LOOP_SET = 13; - public const int PAY_DEFAULT = -2; - public const int PAY_HIDE = -1; + public const int PAY_DEFAULT = -2; + public const int PAY_HIDE = -1; - public const int PAYMENT_INFO_ON_FILE = 1; - public const int PAYMENT_INFO_USED = 2; + public const int PAYMENT_INFO_ON_FILE = 1; + public const int PAYMENT_INFO_USED = 2; - public const int PERM_ALL = 2147483647; - public const int PERM_COPY = 32768; - public const int PERM_MODIFY = 16384; - public const int PERM_MOVE = 524288; - public const int PERM_TRANSFER = 8192; + public const int PERM_ALL = 2147483647; + public const int PERM_COPY = 32768; + public const int PERM_MODIFY = 16384; + public const int PERM_MOVE = 524288; + public const int PERM_TRANSFER = 8192; - public const int PERMISSION_DEBIT = 2; - public const int PERMISSION_TAKE_CONTROLS = 4; - public const int PERMISSION_REMAP_CONTROLS = 8; - public const int PERMISSION_TRIGGER_ANIMATION = 16; - public const int PERMISSION_ATTACH = 32; - public const int PERMISSION_RELEASE_OWNERSHIP = 64; - public const int PERMISSION_CHANGE_LINKS = 128; - public const int PERMISSION_CHANGE_JOINTS = 256; - public const int PERMISSION_CHANGE_PERMISSIONS = 512; - public const int PERMISSION_CONTROL_CAMERA = 2048; - public const int PERMISSION_OVERRIDE_ANIMATIONS = 0x8000; - public const int PERMISSION_TRACK_CAMERA = 1024; - public const int PERMISSION_RETURN_OBJECTS = 65536; + public const int PERMISSION_DEBIT = 2; + public const int PERMISSION_TAKE_CONTROLS = 4; + public const int PERMISSION_REMAP_CONTROLS = 8; + public const int PERMISSION_TRIGGER_ANIMATION = 16; + public const int PERMISSION_ATTACH = 32; + public const int PERMISSION_RELEASE_OWNERSHIP = 64; + public const int PERMISSION_CHANGE_LINKS = 128; + public const int PERMISSION_CHANGE_JOINTS = 256; + public const int PERMISSION_CHANGE_PERMISSIONS = 512; + public const int PERMISSION_CONTROL_CAMERA = 2048; + public const int PERMISSION_OVERRIDE_ANIMATIONS = 0x8000; + public const int PERMISSION_TRACK_CAMERA = 1024; + public const int PERMISSION_RETURN_OBJECTS = 65536; - public const int PRIM_BUMP_BARK = 4; - public const int PRIM_BUMP_BLOBS = 12; - public const int PRIM_BUMP_BRICKS = 5; - public const int PRIM_BUMP_BRIGHT = 1; - public const int PRIM_BUMP_CHECKER = 6; - public const int PRIM_BUMP_CONCRETE = 7; - public const int PRIM_BUMP_DARK = 2; - public const int PRIM_BUMP_DISKS = 10; - public const int PRIM_BUMP_GRAVEL = 11; - public const int PRIM_BUMP_LARGETILE = 14; - public const int PRIM_BUMP_NONE = 0; - public const int PRIM_BUMP_SHINY = 19; - public const int PRIM_BUMP_SIDING = 13; - public const int PRIM_BUMP_STONE = 9; - public const int PRIM_BUMP_STUCCO = 15; - public const int PRIM_BUMP_SUCTION = 16; - public const int PRIM_BUMP_TILE = 8; - public const int PRIM_BUMP_WEAVE = 17; - public const int PRIM_BUMP_WOOD = 3; + public const int PRIM_BUMP_BARK = 4; + public const int PRIM_BUMP_BLOBS = 12; + public const int PRIM_BUMP_BRICKS = 5; + public const int PRIM_BUMP_BRIGHT = 1; + public const int PRIM_BUMP_CHECKER = 6; + public const int PRIM_BUMP_CONCRETE = 7; + public const int PRIM_BUMP_DARK = 2; + public const int PRIM_BUMP_DISKS = 10; + public const int PRIM_BUMP_GRAVEL = 11; + public const int PRIM_BUMP_LARGETILE = 14; + public const int PRIM_BUMP_NONE = 0; + public const int PRIM_BUMP_SHINY = 19; + public const int PRIM_BUMP_SIDING = 13; + public const int PRIM_BUMP_STONE = 9; + public const int PRIM_BUMP_STUCCO = 15; + public const int PRIM_BUMP_SUCTION = 16; + public const int PRIM_BUMP_TILE = 8; + public const int PRIM_BUMP_WEAVE = 17; + public const int PRIM_BUMP_WOOD = 3; - public const int PRIM_CAST_SHADOWS = 24; - public const int PRIM_COLOR = 18; - public const int PRIM_DESC = 28; - public const int PRIM_FLEXIBLE = 21; - public const int PRIM_FULLBRIGHT = 20; - public const int PRIM_HOLE_CIRCLE = 16; - public const int PRIM_HOLE_DEFAULT = 0; - public const int PRIM_HOLE_SQUARE = 32; - public const int PRIM_HOLE_TRIANGLE = 48; + public const int PRIM_CAST_SHADOWS = 24; + public const int PRIM_COLOR = 18; + public const int PRIM_DESC = 28; + public const int PRIM_FLEXIBLE = 21; + public const int PRIM_FULLBRIGHT = 20; + public const int PRIM_HOLE_CIRCLE = 16; + public const int PRIM_HOLE_DEFAULT = 0; + public const int PRIM_HOLE_SQUARE = 32; + public const int PRIM_HOLE_TRIANGLE = 48; public const int PRIM_LINK_TARGET = 34; - public const int PRIM_MATERIAL = 2; - public const int PRIM_MATERIAL_FLESH = 4; - public const int PRIM_MATERIAL_GLASS = 2; - public const int PRIM_MATERIAL_LIGHT = 7; - public const int PRIM_MATERIAL_METAL = 1; - public const int PRIM_MATERIAL_PLASTIC = 5; - public const int PRIM_MATERIAL_RUBBER = 6; - public const int PRIM_MATERIAL_STONE = 0; - public const int PRIM_MATERIAL_WOOD = 3; + public const int PRIM_MATERIAL = 2; + public const int PRIM_MATERIAL_FLESH = 4; + public const int PRIM_MATERIAL_GLASS = 2; + public const int PRIM_MATERIAL_LIGHT = 7; + public const int PRIM_MATERIAL_METAL = 1; + public const int PRIM_MATERIAL_PLASTIC = 5; + public const int PRIM_MATERIAL_RUBBER = 6; + public const int PRIM_MATERIAL_STONE = 0; + public const int PRIM_MATERIAL_WOOD = 3; - public const int PRIM_MEDIA_ALT_IMAGE_ENABLE = 0; - public const int PRIM_MEDIA_AUTO_LOOP = 4; - public const int PRIM_MEDIA_AUTO_PLAY = 5; - public const int PRIM_MEDIA_AUTO_SCALE = 6; - public const int PRIM_MEDIA_AUTO_ZOOM = 7; - public const int PRIM_MEDIA_CONTROLS = 1; - public const int PRIM_MEDIA_CONTROLS_MINI = 1; - public const int PRIM_MEDIA_CONTROLS_STANDARD = 0; - public const int PRIM_MEDIA_CURRENT_URL = 2; - public const int PRIM_MEDIA_FIRST_CLICK_INTERACT = 8; - public const int PRIM_MEDIA_HEIGHT_PIXELS = 10; - public const int PRIM_MEDIA_HOME_URL = 3; - public const int PRIM_MEDIA_PERM_ANYONE = 4; - public const int PRIM_MEDIA_PERM_GROUP = 2; - public const int PRIM_MEDIA_PERM_NONE = 0; - public const int PRIM_MEDIA_PERM_OWNER = 1; - public const int PRIM_MEDIA_PERMS_CONTROL = 14; - public const int PRIM_MEDIA_PERMS_INTERACT = 13; - public const int PRIM_MEDIA_WHITELIST = 12; - public const int PRIM_MEDIA_WHITELIST_ENABLE = 11; - public const int PRIM_MEDIA_WIDTH_PIXELS = 9; + public const int PRIM_MEDIA_ALT_IMAGE_ENABLE = 0; + public const int PRIM_MEDIA_AUTO_LOOP = 4; + public const int PRIM_MEDIA_AUTO_PLAY = 5; + public const int PRIM_MEDIA_AUTO_SCALE = 6; + public const int PRIM_MEDIA_AUTO_ZOOM = 7; + public const int PRIM_MEDIA_CONTROLS = 1; + public const int PRIM_MEDIA_CONTROLS_MINI = 1; + public const int PRIM_MEDIA_CONTROLS_STANDARD = 0; + public const int PRIM_MEDIA_CURRENT_URL = 2; + public const int PRIM_MEDIA_FIRST_CLICK_INTERACT = 8; + public const int PRIM_MEDIA_HEIGHT_PIXELS = 10; + public const int PRIM_MEDIA_HOME_URL = 3; + public const int PRIM_MEDIA_PERM_ANYONE = 4; + public const int PRIM_MEDIA_PERM_GROUP = 2; + public const int PRIM_MEDIA_PERM_NONE = 0; + public const int PRIM_MEDIA_PERM_OWNER = 1; + public const int PRIM_MEDIA_PERMS_CONTROL = 14; + public const int PRIM_MEDIA_PERMS_INTERACT = 13; + public const int PRIM_MEDIA_WHITELIST = 12; + public const int PRIM_MEDIA_WHITELIST_ENABLE = 11; + public const int PRIM_MEDIA_WIDTH_PIXELS = 9; - public const int PRIM_NAME = 27; - public const int PRIM_OMEGA = 32; - public const int PRIM_PHANTOM = 5; - public const int PRIM_PHYSICS = 3; - public const int PRIM_PHYSICS_MATERIAL = 31; - public const int PRIM_PHYSICS_SHAPE_CONVEX = 2; - public const int PRIM_PHYSICS_SHAPE_NONE = 1; - public const int PRIM_PHYSICS_SHAPE_PRIM = 0; - public const int PRIM_PHYSICS_SHAPE_TYPE = 30; - public const int PRIM_POINT_LIGHT = 23; - public const int PRIM_POSITION = 6; - public const int PRIM_POS_LOCAL = 33; - public const int PRIM_ROTATION = 8; - public const int PRIM_ROT_LOCAL = 29; - public const int PRIM_SCULPT_FLAG_INVERT = 64; - public const int PRIM_SCULPT_FLAG_MIRROR = 128; - public const int PRIM_SHINY_HIGH = 3; - public const int PRIM_SHINY_LOW = 1; - public const int PRIM_SHINY_MEDIUM = 2; - public const int PRIM_SHINY_NONE = 0; - public const int PRIM_SIZE = 7; + public const int PRIM_NAME = 27; + public const int PRIM_OMEGA = 32; + public const int PRIM_PHANTOM = 5; + public const int PRIM_PHYSICS = 3; + public const int PRIM_PHYSICS_MATERIAL = 31; + public const int PRIM_PHYSICS_SHAPE_CONVEX = 2; + public const int PRIM_PHYSICS_SHAPE_NONE = 1; + public const int PRIM_PHYSICS_SHAPE_PRIM = 0; + public const int PRIM_PHYSICS_SHAPE_TYPE = 30; + public const int PRIM_POINT_LIGHT = 23; + public const int PRIM_POSITION = 6; + public const int PRIM_POS_LOCAL = 33; + public const int PRIM_ROTATION = 8; + public const int PRIM_ROT_LOCAL = 29; + public const int PRIM_SCULPT_FLAG_INVERT = 64; + public const int PRIM_SCULPT_FLAG_MIRROR = 128; + public const int PRIM_SHINY_HIGH = 3; + public const int PRIM_SHINY_LOW = 1; + public const int PRIM_SHINY_MEDIUM = 2; + public const int PRIM_SHINY_NONE = 0; + public const int PRIM_SIZE = 7; public const int PRIM_SLICE = 35; - public const int PRIM_TEMP_ON_REZ = 4; - public const int PRIM_TEXGEN = 22; - public const int PRIM_TEXGEN_DEFAULT = 0; - public const int PRIM_TEXGEN_PLANAR = 1; - public const int PRIM_TEXT = 26; - public const int PRIM_TEXTURE = 17; - public const int PRIM_TYPE = 9; + public const int PRIM_TEMP_ON_REZ = 4; + public const int PRIM_TEXGEN = 22; + public const int PRIM_TEXGEN_DEFAULT = 0; + public const int PRIM_TEXGEN_PLANAR = 1; + public const int PRIM_TEXT = 26; + public const int PRIM_TEXTURE = 17; + public const int PRIM_TYPE = 9; - public const int PRIM_TYPE_BOX = 0; - public const int PRIM_TYPE_CYLINDER = 1; - public const int PRIM_TYPE_PRISM = 2; - public const int PRIM_TYPE_SPHERE = 3; - public const int PRIM_TYPE_TORUS = 4; - public const int PRIM_TYPE_TUBE = 5; - public const int PRIM_TYPE_RING = 6; - public const int PRIM_TYPE_SCULPT = 7; + public const int PRIM_TYPE_BOX = 0; + public const int PRIM_TYPE_CYLINDER = 1; + public const int PRIM_TYPE_PRISM = 2; + public const int PRIM_TYPE_SPHERE = 3; + public const int PRIM_TYPE_TORUS = 4; + public const int PRIM_TYPE_TUBE = 5; + public const int PRIM_TYPE_RING = 6; + public const int PRIM_TYPE_SCULPT = 7; - public const int PRIM_GLOW = 25; + public const int PRIM_GLOW = 25; public const int PRIM_SCULPT_TYPE_MASK = 7; - public const int PRIM_SCULPT_TYPE_SPHERE = 1; - public const int PRIM_SCULPT_TYPE_TORUS = 2; - public const int PRIM_SCULPT_TYPE_PLANE = 3; - public const int PRIM_SCULPT_TYPE_CYLINDER = 4; + public const int PRIM_SCULPT_TYPE_SPHERE = 1; + public const int PRIM_SCULPT_TYPE_TORUS = 2; + public const int PRIM_SCULPT_TYPE_PLANE = 3; + public const int PRIM_SCULPT_TYPE_CYLINDER = 4; - public const int PROFILE_NONE = 0; - public const int PROFILE_SCRIPT_MEMORY = 1; + public const int PROFILE_NONE = 0; + public const int PROFILE_SCRIPT_MEMORY = 1; - public const int PSYS_PART_FLAGS = 0; - public const int PSYS_PART_INTERP_COLOR_MASK = 1; - public const int PSYS_PART_INTERP_SCALE_MASK = 2; - public const int PSYS_PART_BOUNCE_MASK = 4; - public const int PSYS_PART_WIND_MASK = 8; - public const int PSYS_PART_FOLLOW_SRC_MASK = 16; - public const int PSYS_PART_FOLLOW_VELOCITY_MASK = 32; - public const int PSYS_PART_TARGET_POS_MASK = 64; - public const int PSYS_PART_TARGET_LINEAR_MASK = 128; - public const int PSYS_PART_EMISSIVE_MASK = 256; + public const int PSYS_PART_FLAGS = 0; + public const int PSYS_PART_INTERP_COLOR_MASK = 1; + public const int PSYS_PART_INTERP_SCALE_MASK = 2; + public const int PSYS_PART_BOUNCE_MASK = 4; + public const int PSYS_PART_WIND_MASK = 8; + public const int PSYS_PART_FOLLOW_SRC_MASK = 16; + public const int PSYS_PART_FOLLOW_VELOCITY_MASK = 32; + public const int PSYS_PART_TARGET_POS_MASK = 64; + public const int PSYS_PART_TARGET_LINEAR_MASK = 128; + public const int PSYS_PART_EMISSIVE_MASK = 256; - public const int PSYS_PART_SRC_PATTERN_ANGLE = 0x04; - public const int PSYS_PART_SRC_PATTERN_ANGLE_CONE = 0x08; - public const int PSYS_PART_SRC_PATTERN_DROP = 0x01; - public const int PSYS_PART_SRC_PATTERN_EXPLODE = 0x02; + public const int PSYS_PART_SRC_PATTERN_ANGLE = 0x04; + public const int PSYS_PART_SRC_PATTERN_ANGLE_CONE = 0x08; + public const int PSYS_PART_SRC_PATTERN_DROP = 0x01; + public const int PSYS_PART_SRC_PATTERN_EXPLODE = 0x02; - public const int PSYS_PART_START_COLOR = 1; - public const int PSYS_PART_START_ALPHA = 2; - public const int PSYS_PART_END_COLOR = 3; - public const int PSYS_PART_END_ALPHA = 4; - public const int PSYS_PART_START_SCALE = 5; - public const int PSYS_PART_END_SCALE = 6; - public const int PSYS_PART_MAX_AGE = 7; + public const int PSYS_PART_START_COLOR = 1; + public const int PSYS_PART_START_ALPHA = 2; + public const int PSYS_PART_END_COLOR = 3; + public const int PSYS_PART_END_ALPHA = 4; + public const int PSYS_PART_START_SCALE = 5; + public const int PSYS_PART_END_SCALE = 6; + public const int PSYS_PART_MAX_AGE = 7; - public const int PSYS_SRC_ACCEL = 8; - public const int PSYS_SRC_PATTERN = 9; - public const int PSYS_SRC_INNERANGLE = 10; - public const int PSYS_SRC_OUTERANGLE = 11; - public const int PSYS_SRC_TEXTURE = 12; - public const int PSYS_SRC_BURST_RATE = 13; - public const int PSYS_SRC_BURST_PART_COUNT = 15; - public const int PSYS_SRC_BURST_RADIUS = 16; - public const int PSYS_SRC_BURST_SPEED_MIN = 17; - public const int PSYS_SRC_BURST_SPEED_MAX = 18; - public const int PSYS_SRC_MAX_AGE = 19; - public const int PSYS_SRC_TARGET_KEY = 20; - public const int PSYS_SRC_OMEGA = 21; - public const int PSYS_SRC_ANGLE_BEGIN = 22; - public const int PSYS_SRC_ANGLE_END = 23; + public const int PSYS_SRC_ACCEL = 8; + public const int PSYS_SRC_PATTERN = 9; + public const int PSYS_SRC_INNERANGLE = 10; + public const int PSYS_SRC_OUTERANGLE = 11; + public const int PSYS_SRC_TEXTURE = 12; + public const int PSYS_SRC_BURST_RATE = 13; + public const int PSYS_SRC_BURST_PART_COUNT = 15; + public const int PSYS_SRC_BURST_RADIUS = 16; + public const int PSYS_SRC_BURST_SPEED_MIN = 17; + public const int PSYS_SRC_BURST_SPEED_MAX = 18; + public const int PSYS_SRC_MAX_AGE = 19; + public const int PSYS_SRC_TARGET_KEY = 20; + public const int PSYS_SRC_OMEGA = 21; + public const int PSYS_SRC_ANGLE_BEGIN = 22; + public const int PSYS_SRC_ANGLE_END = 23; - public const int PSYS_SRC_PATTERN_DROP = 1; - public const int PSYS_SRC_PATTERN_EXPLODE = 2; - public const int PSYS_SRC_PATTERN_ANGLE = 4; - public const int PSYS_SRC_PATTERN_ANGLE_CONE = 8; - public const int PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY = 16; + public const int PSYS_SRC_PATTERN_DROP = 1; + public const int PSYS_SRC_PATTERN_EXPLODE = 2; + public const int PSYS_SRC_PATTERN_ANGLE = 4; + public const int PSYS_SRC_PATTERN_ANGLE_CONE = 8; + public const int PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY = 16; public const int PU_EVADE_HIDDEN = 0x07; public const int PU_EVADE_SPOTTED = 0x08; @@ -762,7 +763,7 @@ namespace LSLEditor public const int PU_GOAL_REACHED = 0x01; public const int PU_SLOWDOWN_DISTANCE_REACHED = 0x00; - public const int PUBLIC_CHANNEL = 0; + public const int PUBLIC_CHANNEL = 0; public const int PURSUIT_FUZZ_FACTOR = 3; public const int PURSUIT_INTERCEPT = 4; @@ -784,56 +785,56 @@ namespace LSLEditor public const int RCERR_UNKNOWN = -1; - public const int REGION_FLAG_ALLOW_DAMAGE = 1; - public const int REGION_FLAG_FIXED_SUN = 16; - public const int REGION_FLAG_BLOCK_TERRAFORM = 64; - public const int REGION_FLAG_SANDBOX = 256; - public const int REGION_FLAG_DISABLE_COLLISIONS = 4096; - public const int REGION_FLAG_DISABLE_PHYSICS = 16384; - public const int REGION_FLAG_BLOCK_FLY = 524288; - public const int REGION_FLAG_ALLOW_DIRECT_TELEPORT = 1048576; - public const int REGION_FLAG_RESTRICT_PUSHOBJECT = 4194304; + public const int REGION_FLAG_ALLOW_DAMAGE = 1; + public const int REGION_FLAG_FIXED_SUN = 16; + public const int REGION_FLAG_BLOCK_TERRAFORM = 64; + public const int REGION_FLAG_SANDBOX = 256; + public const int REGION_FLAG_DISABLE_COLLISIONS = 4096; + public const int REGION_FLAG_DISABLE_PHYSICS = 16384; + public const int REGION_FLAG_BLOCK_FLY = 524288; + public const int REGION_FLAG_ALLOW_DIRECT_TELEPORT = 1048576; + public const int REGION_FLAG_RESTRICT_PUSHOBJECT = 4194304; - public const int REMOTE_DATA_CHANNEL = 1; - public const int REMOTE_DATA_REQUEST = 2; - public const int REMOTE_DATA_REPLY = 3; + public const int REMOTE_DATA_CHANNEL = 1; + public const int REMOTE_DATA_REQUEST = 2; + public const int REMOTE_DATA_REPLY = 3; public const int REQUIRE_LINE_OF_SIGHT = 2; - public const int SIM_STAT_PCT_CHARS_STEPPED = 0; + public const int SIM_STAT_PCT_CHARS_STEPPED = 0; - public const int STATUS_PHYSICS = 1; - public const int STATUS_ROTATE_X = 2; - public const int STATUS_ROTATE_Y = 4; - public const int STATUS_ROTATE_Z = 8; - public const int STATUS_PHANTOM = 16; - public const int STATUS_SANDBOX = 32; - public const int STATUS_BLOCK_GRAB = 64; - public const int STATUS_BLOCK_GRAB_OBJECT = 1024; - public const int STATUS_DIE_AT_EDGE = 128; - public const int STATUS_RETURN_AT_EDGE = 256; - public const int STATUS_CAST_SHADOWS = 512; - public const int STATUS_BOUNDS_ERROR = 1002; - public const int STATUS_INTERNAL_ERROR = 1999; - public const int STATUS_MALFORMED_PARAMS = 1000; - public const int STATUS_NOT_FOUND = 1003; - public const int STATUS_NOT_SUPPORTED = 1004; - public const int STATUS_OK = 0; - public const int STATUS_TYPE_MISMATCH = 1001; - public const int STATUS_WHITELIST_FAILED = 2001; + public const int STATUS_PHYSICS = 1; + public const int STATUS_ROTATE_X = 2; + public const int STATUS_ROTATE_Y = 4; + public const int STATUS_ROTATE_Z = 8; + public const int STATUS_PHANTOM = 16; + public const int STATUS_SANDBOX = 32; + public const int STATUS_BLOCK_GRAB = 64; + public const int STATUS_BLOCK_GRAB_OBJECT = 1024; + public const int STATUS_DIE_AT_EDGE = 128; + public const int STATUS_RETURN_AT_EDGE = 256; + public const int STATUS_CAST_SHADOWS = 512; + public const int STATUS_BOUNDS_ERROR = 1002; + public const int STATUS_INTERNAL_ERROR = 1999; + public const int STATUS_MALFORMED_PARAMS = 1000; + public const int STATUS_NOT_FOUND = 1003; + public const int STATUS_NOT_SUPPORTED = 1004; + public const int STATUS_OK = 0; + public const int STATUS_TYPE_MISMATCH = 1001; + public const int STATUS_WHITELIST_FAILED = 2001; - public const int STRING_TRIM_HEAD = 1; - public const int STRING_TRIM_TAIL = 2; - public const int STRING_TRIM = 3; + public const int STRING_TRIM_HEAD = 1; + public const int STRING_TRIM_TAIL = 2; + public const int STRING_TRIM = 3; - public static readonly key TEXTURE_BLANK = "5748decc-f629-461c-9a36-a35a221fe21f"; - public static readonly key TEXTURE_DEFAULT = "89556747-24cb-43ed-920b-47caed15465f"; - public static readonly key TEXTURE_PLYWOOD = "89556747-24cb-43ed-920b-47caed15465f"; - public static readonly key TEXTURE_TRANSPARENT = "8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"; - public static readonly key TEXTURE_MEDIA = "8b5fec65-8d8d-9dc5-cda8-8fdf2716e361"; + public static readonly key TEXTURE_BLANK = "5748decc-f629-461c-9a36-a35a221fe21f"; + public static readonly key TEXTURE_DEFAULT = "89556747-24cb-43ed-920b-47caed15465f"; + public static readonly key TEXTURE_PLYWOOD = "89556747-24cb-43ed-920b-47caed15465f"; + public static readonly key TEXTURE_TRANSPARENT = "8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"; + public static readonly key TEXTURE_MEDIA = "8b5fec65-8d8d-9dc5-cda8-8fdf2716e361"; public const int TOUCH_INVALID_FACE = -1; - public static readonly vector TOUCH_INVALID_TEXCOORD = new vector(-1.0, -1.0, 0.0); + public static readonly vector TOUCH_INVALID_TEXCOORD = new vector(-1.0, -1.0, 0.0); public static readonly vector TOUCH_INVALID_VECTOR = new vector(0.0, 0.0, 0.0); public const int TRAVERSAL_TYPE = 7; @@ -841,268 +842,268 @@ namespace LSLEditor public const int TRAVERSAL_TYPE_NONE = 2; public const int TRAVERSAL_TYPE_SLOW = 0; - public const int TYPE_INTEGER = 1; - public const int TYPE_FLOAT = 2; - public const int TYPE_STRING = 3; - public const int TYPE_KEY = 4; - public const int TYPE_VECTOR = 5; - public const int TYPE_ROTATION = 6; - public const int TYPE_INVALID = 0; + public const int TYPE_INTEGER = 1; + public const int TYPE_FLOAT = 2; + public const int TYPE_STRING = 3; + public const int TYPE_KEY = 4; + public const int TYPE_VECTOR = 5; + public const int TYPE_ROTATION = 6; + public const int TYPE_INVALID = 0; - public static readonly String URL_REQUEST_GRANTED = "URL_REQUEST_GRANTED"; - public static readonly String URL_REQUEST_DENIED = "URL_REQUEST_DENIED"; + public static readonly String URL_REQUEST_GRANTED = "URL_REQUEST_GRANTED"; + public static readonly String URL_REQUEST_DENIED = "URL_REQUEST_DENIED"; - public const int VEHICLE_TYPE_NONE = 0; + public const int VEHICLE_TYPE_NONE = 0; - public const int VEHICLE_LINEAR_FRICTION_TIMESCALE = 16; - public const int VEHICLE_ANGULAR_FRICTION_TIMESCALE = 17; - public const int VEHICLE_LINEAR_MOTOR_DIRECTION = 18; - public const int VEHICLE_ANGULAR_MOTOR_DIRECTION = 19; - public const int VEHICLE_LINEAR_MOTOR_OFFSET = 20; - public const int VEHICLE_HOVER_HEIGHT = 24; - public const int VEHICLE_HOVER_EFFICIENCY = 25; - public const int VEHICLE_HOVER_TIMESCALE = 26; - public const int VEHICLE_BUOYANCY = 27; - public const int VEHICLE_LINEAR_DEFLECTION_EFFICIENCY = 28; - public const int VEHICLE_LINEAR_DEFLECTION_TIMESCALE = 29; - public const int VEHICLE_LINEAR_MOTOR_TIMESCALE = 30; - public const int VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE = 31; - public const int VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY = 32; - public const int VEHICLE_ANGULAR_DEFLECTION_TIMESCALE = 33; - public const int VEHICLE_ANGULAR_MOTOR_TIMESCALE = 34; - public const int VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE = 35; - public const int VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY = 36; - public const int VEHICLE_VERTICAL_ATTRACTION_TIMESCALE = 37; - public const int VEHICLE_BANKING_EFFICIENCY = 38; - public const int VEHICLE_BANKING_MIX = 39; - public const int VEHICLE_BANKING_TIMESCALE = 40; - public const int VEHICLE_REFERENCE_FRAME = 44; + public const int VEHICLE_LINEAR_FRICTION_TIMESCALE = 16; + public const int VEHICLE_ANGULAR_FRICTION_TIMESCALE = 17; + public const int VEHICLE_LINEAR_MOTOR_DIRECTION = 18; + public const int VEHICLE_ANGULAR_MOTOR_DIRECTION = 19; + public const int VEHICLE_LINEAR_MOTOR_OFFSET = 20; + public const int VEHICLE_HOVER_HEIGHT = 24; + public const int VEHICLE_HOVER_EFFICIENCY = 25; + public const int VEHICLE_HOVER_TIMESCALE = 26; + public const int VEHICLE_BUOYANCY = 27; + public const int VEHICLE_LINEAR_DEFLECTION_EFFICIENCY = 28; + public const int VEHICLE_LINEAR_DEFLECTION_TIMESCALE = 29; + public const int VEHICLE_LINEAR_MOTOR_TIMESCALE = 30; + public const int VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE = 31; + public const int VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY = 32; + public const int VEHICLE_ANGULAR_DEFLECTION_TIMESCALE = 33; + public const int VEHICLE_ANGULAR_MOTOR_TIMESCALE = 34; + public const int VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE = 35; + public const int VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY = 36; + public const int VEHICLE_VERTICAL_ATTRACTION_TIMESCALE = 37; + public const int VEHICLE_BANKING_EFFICIENCY = 38; + public const int VEHICLE_BANKING_MIX = 39; + public const int VEHICLE_BANKING_TIMESCALE = 40; + public const int VEHICLE_REFERENCE_FRAME = 44; - // depricaded - public const int VEHICLE_FLAG_NO_FLY_UP = 1; + // depricaded + public const int VEHICLE_FLAG_NO_FLY_UP = 1; - public const int VEHICLE_FLAG_NO_DEFLECTION_UP = 1; - public const int VEHICLE_FLAG_LIMIT_ROLL_ONLY = 2; - public const int VEHICLE_FLAG_HOVER_WATER_ONLY = 4; - public const int VEHICLE_FLAG_HOVER_TERRAIN_ONLY = 8; - public const int VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT = 16; - public const int VEHICLE_FLAG_HOVER_UP_ONLY = 32; - public const int VEHICLE_FLAG_LIMIT_MOTOR_UP = 64; - public const int VEHICLE_FLAG_MOUSELOOK_STEER = 128; - public const int VEHICLE_FLAG_MOUSELOOK_BANK = 256; - public const int VEHICLE_FLAG_CAMERA_DECOUPLED = 512; + public const int VEHICLE_FLAG_NO_DEFLECTION_UP = 1; + public const int VEHICLE_FLAG_LIMIT_ROLL_ONLY = 2; + public const int VEHICLE_FLAG_HOVER_WATER_ONLY = 4; + public const int VEHICLE_FLAG_HOVER_TERRAIN_ONLY = 8; + public const int VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT = 16; + public const int VEHICLE_FLAG_HOVER_UP_ONLY = 32; + public const int VEHICLE_FLAG_LIMIT_MOTOR_UP = 64; + public const int VEHICLE_FLAG_MOUSELOOK_STEER = 128; + public const int VEHICLE_FLAG_MOUSELOOK_BANK = 256; + public const int VEHICLE_FLAG_CAMERA_DECOUPLED = 512; - public const int VEHICLE_TYPE_SLED = 1; - public const int VEHICLE_TYPE_CAR = 2; - public const int VEHICLE_TYPE_BOAT = 3; - public const int VEHICLE_TYPE_AIRPLANE = 4; - public const int VEHICLE_TYPE_BALLOON = 5; + public const int VEHICLE_TYPE_SLED = 1; + public const int VEHICLE_TYPE_CAR = 2; + public const int VEHICLE_TYPE_BOAT = 3; + public const int VEHICLE_TYPE_AIRPLANE = 4; + public const int VEHICLE_TYPE_BALLOON = 5; - public const int VERTICAL = 0; + public const int VERTICAL = 0; - //public const int REGION_FLAG_RESTRICT_PUSHOBJECT=4194304; + //public const int REGION_FLAG_RESTRICT_PUSHOBJECT=4194304; - #endregion + #endregion - #region Helper Functions + #region Helper Functions - #region List Functions + #region List Functions - private bool CorrectIt(int length, ref int start, ref int end) - { - if (start < 0) - start = length + start; + private bool CorrectIt(int length, ref int start, ref int end) + { + if (start < 0) + start = length + start; - if (end < 0) - end = length + end; + if (end < 0) + end = length + end; - if (start <= end) - { - if (start >= length) - return false; - if (end < 0) - return false; - } + if (start <= end) + { + if (start >= length) + return false; + if (end < 0) + return false; + } - start = Math.Max(0, start); - end = Math.Min(length - 1, end); + start = Math.Max(0, start); + end = Math.Min(length - 1, end); - return true; - } + return true; + } - public ArrayList RandomShuffle(ArrayList collection) - { - // We have to copy all items anyway, and there isn't a way to produce the items - // on the fly that is linear. So copying to an array and shuffling it is as efficient as we can get. + public ArrayList RandomShuffle(ArrayList collection) + { + // We have to copy all items anyway, and there isn't a way to produce the items + // on the fly that is linear. So copying to an array and shuffling it is as efficient as we can get. - if (collection == null) - throw new ArgumentNullException("collection"); + if (collection == null) + throw new ArgumentNullException("collection"); - int count = collection.Count; - for (int i = count - 1; i >= 1; --i) - { - // Pick an random number 0 through i inclusive. - int j = m_random.Next(i + 1); + int count = collection.Count; + for (int i = count - 1; i >= 1; --i) + { + // Pick an random number 0 through i inclusive. + int j = m_random.Next(i + 1); - // Swap array[i] and array[j] - object temp = collection[i]; - collection[i] = collection[j]; - collection[j] = temp; - } - return collection; - } + // Swap array[i] and array[j] + object temp = collection[i]; + collection[i] = collection[j]; + collection[j] = temp; + } + return collection; + } - private ArrayList List2Buckets(list src, int stride) - { - ArrayList buckets = null; - if ((src.Count % stride) == 0 && stride <= src.Count) - { - buckets = new ArrayList(); - for (int intI = 0; intI < src.Count; intI += stride) - { - object[] bucket = new object[stride]; - for (int intJ = 0; intJ < stride; intJ++) - bucket[intJ] = src[intI + intJ]; - buckets.Add(bucket); - } - } - return buckets; - } + private ArrayList List2Buckets(list src, int stride) + { + ArrayList buckets = null; + if ((src.Count % stride) == 0 && stride <= src.Count) + { + buckets = new ArrayList(); + for (int intI = 0; intI < src.Count; intI += stride) + { + object[] bucket = new object[stride]; + for (int intJ = 0; intJ < stride; intJ++) + bucket[intJ] = src[intI + intJ]; + buckets.Add(bucket); + } + } + return buckets; + } - private list Buckets2List(ArrayList buckets, int stride) - { - object[] items = new object[buckets.Count * stride]; - for (int intI = 0; intI < buckets.Count; intI++) - { - for (int intJ = 0; intJ < stride; intJ++) - items[intI * stride + intJ] = ((object[])buckets[intI])[intJ]; - } - return new list(items); - } + private list Buckets2List(ArrayList buckets, int stride) + { + object[] items = new object[buckets.Count * stride]; + for (int intI = 0; intI < buckets.Count; intI++) + { + for (int intJ = 0; intJ < stride; intJ++) + items[intI * stride + intJ] = ((object[])buckets[intI])[intJ]; + } + return new list(items); + } - private class BucketComparer : IComparer - { - private integer ascending; - public BucketComparer(integer ascending) - { - this.ascending = ascending; - } - public int Compare(object x, object y) - { - object[] xx = x as object[]; - object[] yy = y as object[]; + private class BucketComparer : IComparer + { + private integer ascending; + public BucketComparer(integer ascending) + { + this.ascending = ascending; + } + public int Compare(object x, object y) + { + object[] xx = x as object[]; + object[] yy = y as object[]; - object A, B; + object A, B; - if (ascending == TRUE) - { - A = xx[0]; - B = yy[0]; - } - else - { - B = xx[0]; - A = yy[0]; - } + if (ascending == TRUE) + { + A = xx[0]; + B = yy[0]; + } + else + { + B = xx[0]; + A = yy[0]; + } - string strType = A.GetType().ToString(); + string strType = A.GetType().ToString(); - if (((A is string) && (B is string)) || - ((A is SecondLife.String) && (B is SecondLife.String))) - return string.Compare(A.ToString(), B.ToString()); + if (((A is string) && (B is string)) || + ((A is SecondLife.String) && (B is SecondLife.String))) + return string.Compare(A.ToString(), B.ToString()); - if ((A is SecondLife.integer) && (B is SecondLife.integer)) - return SecondLife.integer.Compare((SecondLife.integer)A, (SecondLife.integer)B); + if ((A is SecondLife.integer) && (B is SecondLife.integer)) + return SecondLife.integer.Compare((SecondLife.integer)A, (SecondLife.integer)B); - if ((A is SecondLife.Float) && (B is SecondLife.Float)) - return SecondLife.Float.Compare((SecondLife.Float)A, (SecondLife.Float)B); + if ((A is SecondLife.Float) && (B is SecondLife.Float)) + return SecondLife.Float.Compare((SecondLife.Float)A, (SecondLife.Float)B); - return 0; - } - } - #endregion + return 0; + } + } + #endregion - #region String Functions - private list ParseString(String src, list separators, list spacers, bool blnKeepNulls) - { - list result = new list(); - int intFrom = 0; - string s = src; - for (int intI = 0; intI < s.Length; intI++) - { - string strTmp = s.Substring(intI); - bool blnFound = false; - for (int intJ = 0; intJ < separators.Count; intJ++) - { - string strSeparator = separators[intJ].ToString(); - if (strSeparator.Length == 0) - continue; // check this - if (strTmp.IndexOf(strSeparator) == 0) - { - string strBefore = s.Substring(intFrom, intI - intFrom); - if (strBefore != "" || blnKeepNulls) - result.Add(strBefore); - intI += strSeparator.Length - 1; - intFrom = intI + 1; - blnFound = true; - break; - } - } + #region String Functions + private list ParseString(String src, list separators, list spacers, bool blnKeepNulls) + { + list result = new list(); + int intFrom = 0; + string s = src; + for (int intI = 0; intI < s.Length; intI++) + { + string strTmp = s.Substring(intI); + bool blnFound = false; + for (int intJ = 0; intJ < separators.Count; intJ++) + { + string strSeparator = separators[intJ].ToString(); + if (strSeparator.Length == 0) + continue; // check this + if (strTmp.IndexOf(strSeparator) == 0) + { + string strBefore = s.Substring(intFrom, intI - intFrom); + if (strBefore != "" || blnKeepNulls) + result.Add(strBefore); + intI += strSeparator.Length - 1; + intFrom = intI + 1; + blnFound = true; + break; + } + } - if (blnFound) - continue; + if (blnFound) + continue; - for (int intJ = 0; intJ < spacers.Count; intJ++) - { - string strSpacer = spacers[intJ].ToString(); - if (strSpacer.Length == 0) - continue; // check this - if (strTmp.IndexOf(strSpacer) == 0) - { - string strBefore = s.Substring(intFrom, intI - intFrom); - if (strBefore != "" || blnKeepNulls) - result.Add(strBefore); - result.Add(strSpacer); - intI += strSpacer.Length - 1; - intFrom = intI + 1; - break; - } - } - } - string strLast = s.Substring(intFrom); - if (strLast != "" || blnKeepNulls) - result.Add(strLast); - return result; - } + for (int intJ = 0; intJ < spacers.Count; intJ++) + { + string strSpacer = spacers[intJ].ToString(); + if (strSpacer.Length == 0) + continue; // check this + if (strTmp.IndexOf(strSpacer) == 0) + { + string strBefore = s.Substring(intFrom, intI - intFrom); + if (strBefore != "" || blnKeepNulls) + result.Add(strBefore); + result.Add(strSpacer); + intI += strSpacer.Length - 1; + intFrom = intI + 1; + break; + } + } + } + string strLast = s.Substring(intFrom); + if (strLast != "" || blnKeepNulls) + result.Add(strLast); + return result; + } - private string StringToBase64(string str) - { - byte[] data = Encoding.UTF8.GetBytes(str); - return Convert.ToBase64String(data); - } + private string StringToBase64(string str) + { + byte[] data = Encoding.UTF8.GetBytes(str); + return Convert.ToBase64String(data); + } - private string Base64ToString(string str) - { - byte[] data = Convert.FromBase64String(str); - int intLen = Array.IndexOf(data, (byte)0x00); - if (intLen < 0) - intLen = data.Length; - return Encoding.UTF8.GetString(data, 0, intLen); - } + private string Base64ToString(string str) + { + byte[] data = Convert.FromBase64String(str); + int intLen = Array.IndexOf(data, (byte)0x00); + if (intLen < 0) + intLen = data.Length; + return Encoding.UTF8.GetString(data, 0, intLen); + } - private int LookupBase64(string s, int intIndex) - { - if (intIndex < s.Length) - { - int intReturn = FastLookupBase64[s[intIndex]]; - if (intReturn == 0) - if (s[intIndex] != 'A') - throw new Exception(); - return intReturn; - } - else - return 0; - } + private int LookupBase64(string s, int intIndex) + { + if (intIndex < s.Length) + { + int intReturn = FastLookupBase64[s[intIndex]]; + if (intReturn == 0) + if (s[intIndex] != 'A') + throw new Exception(); + return intReturn; + } + else + return 0; + } static readonly int[] FastLookupBase64 = {// 0 1 2 3 4 5 6 7 8 9 A B C D E F @@ -1122,701 +1123,701 @@ namespace LSLEditor 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // D0 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // E0 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; // F0 - #endregion + #endregion - #region Math Functions + #region Math Functions - private integer ModPow1(integer a, integer b, integer c) - { - return (int)Math.Pow((int)a, (int)b & (int)0xffff) % (int)c; - } + private integer ModPow1(integer a, integer b, integer c) + { + return (int)Math.Pow((int)a, (int)b & (int)0xffff) % (int)c; + } - private integer ModPow2(integer x, integer y, integer m) - { - if (!x) return 0; - integer k = 1 + (int)Math.Ceiling(Math.Log(Math.Abs(x)) / 0.69314718055994530941723212145818);//ceil(log2(x)) - integer w = 32; - integer p = w / k; - integer r = y / p; - integer f = y % p; - integer z = 1; - if (r) z = ModPow2(ModPow1(x, p, m), r, m); - if (f) z = (z * ModPow1(x, f, m)) % m; - return z; - } + private integer ModPow2(integer x, integer y, integer m) + { + if (!x) return 0; + integer k = 1 + (int)Math.Ceiling(Math.Log(Math.Abs(x)) / 0.69314718055994530941723212145818);//ceil(log2(x)) + integer w = 32; + integer p = w / k; + integer r = y / p; + integer f = y % p; + integer z = 1; + if (r) z = ModPow2(ModPow1(x, p, m), r, m); + if (f) z = (z * ModPow1(x, f, m)) % m; + return z; + } - #endregion Math Functions + #endregion Math Functions - private List GetListOfNumbers(list input) - { - List result = new List(); - for (int intI = 0; intI < input.Count; intI++) - { - object objI = input[intI]; - string strType = objI.GetType().ToString().Replace("LSLEditor.SecondLife+", ""); - switch (strType) - { - case "Float": - result.Add(Convert.ToDouble((Float)objI)); - break; - case "System.Int32": - result.Add(Convert.ToDouble((int)objI)); - break; - case "System.Double": - result.Add(Convert.ToDouble((double)objI)); - break; - case "integer": - result.Add(Convert.ToDouble((integer)objI)); - break; - default: - break; - } - } - return result; - } + private List GetListOfNumbers(list input) + { + List result = new List(); + for (int intI = 0; intI < input.Count; intI++) + { + object objI = input[intI]; + string strType = objI.GetType().ToString().Replace("LSLEditor.SecondLife+", ""); + switch (strType) + { + case "Float": + result.Add(Convert.ToDouble((Float)objI)); + break; + case "System.Int32": + result.Add(Convert.ToDouble((int)objI)); + break; + case "System.Double": + result.Add(Convert.ToDouble((double)objI)); + break; + case "integer": + result.Add(Convert.ToDouble((integer)objI)); + break; + default: + break; + } + } + return result; + } - private double GetAverage(double[] data) - { - try - { - double DataTotal = 0; - for (int i = 0; i < data.Length; i++) - { - DataTotal += data[i]; - } - return SafeDivide(DataTotal, data.Length); - } - catch (Exception) { throw; } - } + private double GetAverage(double[] data) + { + try + { + double DataTotal = 0; + for (int i = 0; i < data.Length; i++) + { + DataTotal += data[i]; + } + return SafeDivide(DataTotal, data.Length); + } + catch (Exception) { throw; } + } - public double GetStandardDeviation(double[] num) - { - double Sum = 0.0, SumOfSqrs = 0.0; - for (int i = 0; i < num.Length; i++) - { - Sum += num[i]; - SumOfSqrs += Math.Pow(num[i], 2); - } - double topSum = (num.Length * SumOfSqrs) - (Math.Pow(Sum, 2)); - double n = (double)num.Length; - return Math.Sqrt(topSum / (n * (n - 1))); - } + public double GetStandardDeviation(double[] num) + { + double Sum = 0.0, SumOfSqrs = 0.0; + for (int i = 0; i < num.Length; i++) + { + Sum += num[i]; + SumOfSqrs += Math.Pow(num[i], 2); + } + double topSum = (num.Length * SumOfSqrs) - (Math.Pow(Sum, 2)); + double n = (double)num.Length; + return Math.Sqrt(topSum / (n * (n - 1))); + } - private double SafeDivide(double value1, double value2) - { - double ret = 0; - try - { - if ((value1 == 0) || (value2 == 0)) { return ret; } - ret = value1 / value2; - } - catch { } - return ret; - } + private double SafeDivide(double value1, double value2) + { + double ret = 0; + try + { + if ((value1 == 0) || (value2 == 0)) { return ret; } + ret = value1 / value2; + } + catch { } + return ret; + } - private byte HexToInt(byte b) - { - if (b >= '0' && b <= '9') - return (byte)(b - '0'); - else if ((b >= 'a' && b <= 'f') || (b >= 'A' && b <= 'F')) - return (byte)((b & 0x5f) - 0x37); - else - return 0; // error - } - #endregion + private byte HexToInt(byte b) + { + if (b >= '0' && b <= '9') + return (byte)(b - '0'); + else if ((b >= 'a' && b <= 'f') || (b >= 'A' && b <= 'F')) + return (byte)((b & 0x5f) - 0x37); + else + return 0; // error + } + #endregion - #region llFunctions + #region llFunctions - public integer llAbs(integer fValue) - { - int intA = (int)Math.Abs((long)fValue); - Verbose("llAbs({0})={1}", fValue, intA); - return intA; - } + public integer llAbs(integer fValue) + { + int intA = (int)Math.Abs((long)fValue); + Verbose("llAbs({0})={1}", fValue, intA); + return intA; + } - public Float llAcos(Float fValue) - { - double dblA = Math.Acos(fValue); - Verbose("llAcos({0})={1}", fValue, dblA); - return dblA; - } + public Float llAcos(Float fValue) + { + double dblA = Math.Acos(fValue); + Verbose("llAcos({0})={1}", fValue, dblA); + return dblA; + } - public void llAddToLandBanList(key kID, Float fHours) - { - Verbose("llAddToLandBanList({0}, {1})", kID, fHours); - if (m_LandBanList.ContainsKey(kID)) - m_LandBanList.Remove(kID); - m_LandBanList.Add(kID, fHours); - } + public void llAddToLandBanList(key kID, Float fHours) + { + Verbose("llAddToLandBanList({0}, {1})", kID, fHours); + if (m_LandBanList.ContainsKey(kID)) + m_LandBanList.Remove(kID); + m_LandBanList.Add(kID, fHours); + } - public void llAddToLandPassList(key kID, Float fHours) - { - Verbose("llAddToLandPassList({0}, {1})", kID, fHours); - if (m_LandPassList.ContainsKey(kID)) - m_LandPassList.Remove(kID); - m_LandPassList.Add(kID, fHours); - } + public void llAddToLandPassList(key kID, Float fHours) + { + Verbose("llAddToLandPassList({0}, {1})", kID, fHours); + if (m_LandPassList.ContainsKey(kID)) + m_LandPassList.Remove(kID); + m_LandPassList.Add(kID, fHours); + } - public void llAdjustSoundVolume(Float fVolume) - { - Verbose("llAdjustSoundVolume({0}), fVolume"); - m_Volume = fVolume; - } + public void llAdjustSoundVolume(Float fVolume) + { + Verbose("llAdjustSoundVolume({0}), fVolume"); + m_Volume = fVolume; + } - public void llAllowInventoryDrop(integer iAllowDrop) - { - Verbose("llAllowInventoryDrop({0})", iAllowDrop); - m_AllowDrop = (Boolean)iAllowDrop; - } + public void llAllowInventoryDrop(integer iAllowDrop) + { + Verbose("llAllowInventoryDrop({0})", iAllowDrop); + m_AllowDrop = (Boolean)iAllowDrop; + } - public Float llAngleBetween(rotation a, rotation b) - { - rotation r = b / a; // calculate the rotation between the two arguments as quaternion - double s2 = r.s * r.s; // square of the s-element - double v2 = r.x * r.x + r.y * r.y + r.z * r.z; // sum of the squares of the v-elements + public Float llAngleBetween(rotation a, rotation b) + { + rotation r = b / a; // calculate the rotation between the two arguments as quaternion + double s2 = r.s * r.s; // square of the s-element + double v2 = r.x * r.x + r.y * r.y + r.z * r.z; // sum of the squares of the v-elements - if (s2 < v2) // compare the s-component to the v-component - { - return 2.0 * Math.Acos(Math.Sqrt(s2 / (s2 + v2))); // use arccos if the v-component is dominant - } - else if (v2 != 0) // make sure the v-component is non-zero - { - return 2.0 * Math.Asin(Math.Sqrt(v2 / (s2 + v2))); // use arcsin if the s-component is dominant - } - return 0.0; // one or both arguments are scaled too small to be meaningful, or the values are the same, so return zero - // implementation taken from LSL Portal. http://wiki.secondlife.com/w/index.php?title=LlAngleBetween - } + if (s2 < v2) // compare the s-component to the v-component + { + return 2.0 * Math.Acos(Math.Sqrt(s2 / (s2 + v2))); // use arccos if the v-component is dominant + } + else if (v2 != 0) // make sure the v-component is non-zero + { + return 2.0 * Math.Asin(Math.Sqrt(v2 / (s2 + v2))); // use arcsin if the s-component is dominant + } + return 0.0; // one or both arguments are scaled too small to be meaningful, or the values are the same, so return zero + // implementation taken from LSL Portal. http://wiki.secondlife.com/w/index.php?title=LlAngleBetween + } - public void llApplyImpulse(vector vForce, integer iLocal) - { - Verbose("llApplyImpulse({0}, {1}", vForce, iLocal); - } + public void llApplyImpulse(vector vForce, integer iLocal) + { + Verbose("llApplyImpulse({0}, {1}", vForce, iLocal); + } - public void llApplyRotationalImpulse(vector vForce, integer iLocal) - { - Verbose("llApplyRotationalImpulse({0}, {1})", vForce, iLocal); - } + public void llApplyRotationalImpulse(vector vForce, integer iLocal) + { + Verbose("llApplyRotationalImpulse({0}, {1})", vForce, iLocal); + } - public Float llAsin(Float fValue) - { - double dblA = Math.Asin(fValue); - Verbose("llAsin({0})={1}", fValue, dblA); - return dblA; - } + public Float llAsin(Float fValue) + { + double dblA = Math.Asin(fValue); + Verbose("llAsin({0})={1}", fValue, dblA); + return dblA; + } - public Float llAtan2(Float y, Float x) - { - double dblA = Math.Atan2(y, x); - Verbose("llAtan2({0}, {1})={2}", y, x, dblA); - return dblA; - } + public Float llAtan2(Float y, Float x) + { + double dblA = Math.Atan2(y, x); + Verbose("llAtan2({0}, {1})={2}", y, x, dblA); + return dblA; + } - public void llAttachToAvatar(integer iAttachPoint) - { - Verbose("llAttachToAvatar({0})", iAttachPoint); - } + public void llAttachToAvatar(integer iAttachPoint) + { + Verbose("llAttachToAvatar({0})", iAttachPoint); + } - public void llAttachToAvatarTemp(integer iAttachPoint) - { - Verbose("llAttachToAvatarTemp({0})", iAttachPoint); - } + public void llAttachToAvatarTemp(integer iAttachPoint) + { + Verbose("llAttachToAvatarTemp({0})", iAttachPoint); + } public key llAvatarOnLinkSitTarget(integer iLinkIndex) { - key kLinkUUID = new key(Guid.NewGuid()); - Verbose("llAvatarOnLinkSitTarget({0}))={1}", iLinkIndex, kLinkUUID); + key kLinkUUID = new key(Guid.NewGuid()); + Verbose("llAvatarOnLinkSitTarget({0}))={1}", iLinkIndex, kLinkUUID); return kLinkUUID; } - public key llAvatarOnSitTarget() - { - key kLinkUUID = new key(Guid.NewGuid()); - Verbose("llAvatarOnSitTarget()={0}", kLinkUUID); - return kLinkUUID; - } + public key llAvatarOnSitTarget() + { + key kLinkUUID = new key(Guid.NewGuid()); + Verbose("llAvatarOnSitTarget()={0}", kLinkUUID); + return kLinkUUID; + } - public rotation llAxes2Rot(vector vForward, vector vLeft, vector vUp) - { - rotation rRot = rotation.ZERO_ROTATION; - Verbose("llAxes2Rot({0}, {1}, {2})={3}", vForward, vLeft, +vUp, rRot); - return rRot; - } + public rotation llAxes2Rot(vector vForward, vector vLeft, vector vUp) + { + rotation rRot = rotation.ZERO_ROTATION; + Verbose("llAxes2Rot({0}, {1}, {2})={3}", vForward, vLeft, +vUp, rRot); + return rRot; + } - public rotation llAxisAngle2Rot(vector vAxis, Float fAngle) - { - vector vUnitAxis = llVecNorm(vAxis); - double dSineHalfAngle = Math.Sin(fAngle / 2); - double dCosineHalfAngle = Math.Cos(fAngle / 2); + public rotation llAxisAngle2Rot(vector vAxis, Float fAngle) + { + vector vUnitAxis = llVecNorm(vAxis); + double dSineHalfAngle = Math.Sin(fAngle / 2); + double dCosineHalfAngle = Math.Cos(fAngle / 2); - rotation rResult = new rotation( - dSineHalfAngle * vUnitAxis.x, - dSineHalfAngle * vUnitAxis.y, - dSineHalfAngle * vUnitAxis.z, - dCosineHalfAngle); + rotation rResult = new rotation( + dSineHalfAngle * vUnitAxis.x, + dSineHalfAngle * vUnitAxis.y, + dSineHalfAngle * vUnitAxis.z, + dCosineHalfAngle); - Verbose("llAxisAngle2Rot({0}, {1})={2}", vAxis, fAngle, rResult); - return rResult; - } + Verbose("llAxisAngle2Rot({0}, {1})={2}", vAxis, fAngle, rResult); + return rResult; + } - public integer llBase64ToInteger(String sString) - { - int iResult; + public integer llBase64ToInteger(String sString) + { + int iResult; - try - { - string s = sString; - byte[] data = new byte[4]; + try + { + string s = sString; + byte[] data = new byte[4]; - if (s.Length > 1) - { - data[3] = (byte)(LookupBase64(s, 0) << 2); - data[3] |= (byte)(LookupBase64(s, 1) >> 4); - } + if (s.Length > 1) + { + data[3] = (byte)(LookupBase64(s, 0) << 2); + data[3] |= (byte)(LookupBase64(s, 1) >> 4); + } - if (s.Length > 2) - { - data[2] = (byte)((LookupBase64(s, 1) & 0xf) << 4); - data[2] |= (byte)(LookupBase64(s, 2) >> 2); - } + if (s.Length > 2) + { + data[2] = (byte)((LookupBase64(s, 1) & 0xf) << 4); + data[2] |= (byte)(LookupBase64(s, 2) >> 2); + } - if (s.Length > 3) - { - data[1] = (byte)((LookupBase64(s, 2) & 0x7) << 6); - data[1] |= (byte)(LookupBase64(s, 3)); - } + if (s.Length > 3) + { + data[1] = (byte)((LookupBase64(s, 2) & 0x7) << 6); + data[1] |= (byte)(LookupBase64(s, 3)); + } - if (s.Length > 5) - { - data[0] = (byte)(LookupBase64(s, 4) << 2); - data[0] |= (byte)(LookupBase64(s, 5) >> 4); - } + if (s.Length > 5) + { + data[0] = (byte)(LookupBase64(s, 4) << 2); + data[0] |= (byte)(LookupBase64(s, 5) >> 4); + } - iResult = BitConverter.ToInt32(data, 0); + iResult = BitConverter.ToInt32(data, 0); - //0 12 34 56 - //1 78 12 34 - //2 56 78 12 - //3 34 56 78 + //0 12 34 56 + //1 78 12 34 + //2 56 78 12 + //3 34 56 78 - //4 12 34 56 - //5 78 12 34 - //6 56 78 12 - //7 34 56 78 - } - catch - { - iResult = (new Random()).Next(); - } - Verbose(@"llBase64ToInteger(""{0}"")={1}", sString, iResult); - return iResult; - } + //4 12 34 56 + //5 78 12 34 + //6 56 78 12 + //7 34 56 78 + } + catch + { + iResult = (new Random()).Next(); + } + Verbose(@"llBase64ToInteger(""{0}"")={1}", sString, iResult); + return iResult; + } - public String llBase64ToString(String sString) - { - string sResult = Base64ToString(sString.ToString()); - Verbose(@"llBase64ToString(""{0}"")=""{1}""", sString, sResult); - return sResult; - } + public String llBase64ToString(String sString) + { + string sResult = Base64ToString(sString.ToString()); + Verbose(@"llBase64ToString(""{0}"")=""{1}""", sString, sResult); + return sResult; + } - public void llBreakAllLinks() - { - host.llBreakAllLinks(); - Verbose("llBreakAllLinks()"); - } + public void llBreakAllLinks() + { + host.llBreakAllLinks(); + Verbose("llBreakAllLinks()"); + } - public void llBreakLink(integer iLinkIndex) - { - host.llBreakLink(iLinkIndex); - Verbose("llBreakLink({0})", iLinkIndex); - } + public void llBreakLink(integer iLinkIndex) + { + host.llBreakLink(iLinkIndex); + Verbose("llBreakLink({0})", iLinkIndex); + } - public list llCSV2List(String sString) - { - string sSource = sString; - list lResult = new list(); - StringBuilder sb = new StringBuilder(); - int WithinAngelBracket = 0; - for (int intI = 0; intI < sSource.Length; intI++) - { - char chrC = sSource[intI]; - if (chrC == '<') - WithinAngelBracket++; - else if (chrC == '>') - WithinAngelBracket--; + public list llCSV2List(String sString) + { + string sSource = sString; + list lResult = new list(); + StringBuilder sb = new StringBuilder(); + int WithinAngelBracket = 0; + for (int intI = 0; intI < sSource.Length; intI++) + { + char chrC = sSource[intI]; + if (chrC == '<') + WithinAngelBracket++; + else if (chrC == '>') + WithinAngelBracket--; - if (WithinAngelBracket == 0 && chrC == ',') - { - lResult.Add(sb.ToString()); - sb = new StringBuilder(); - } - else - { - sb.Append(sSource[intI]); - } - } - // dont forget the last one - lResult.Add(sb.ToString()); + if (WithinAngelBracket == 0 && chrC == ',') + { + lResult.Add(sb.ToString()); + sb = new StringBuilder(); + } + else + { + sb.Append(sSource[intI]); + } + } + // dont forget the last one + lResult.Add(sb.ToString()); - // remove the first space, if any - for (int intI = 0; intI < lResult.Count; intI++) - { - string strValue = lResult[intI].ToString(); - if (strValue == "") - continue; - if (strValue[0] == ' ') - lResult[intI] = strValue.Substring(1); - } + // remove the first space, if any + for (int intI = 0; intI < lResult.Count; intI++) + { + string strValue = lResult[intI].ToString(); + if (strValue == "") + continue; + if (strValue[0] == ' ') + lResult[intI] = strValue.Substring(1); + } - Verbose(@"llCSV2List(""{0}"")={1}", sSource, lResult.ToVerboseString()); + Verbose(@"llCSV2List(""{0}"")={1}", sSource, lResult.ToVerboseString()); - return lResult; - } + return lResult; + } - public list llCastRay(vector vStart, vector vEnd, list lOptions) - { - list lResult = new list(); - Verbose("llCastRay({0}, {1}, {2})={3}", vStart, vEnd, lOptions.ToVerboseString(), lResult.ToVerboseString()); - return lResult; - } + public list llCastRay(vector vStart, vector vEnd, list lOptions) + { + list lResult = new list(); + Verbose("llCastRay({0}, {1}, {2})={3}", vStart, vEnd, lOptions.ToVerboseString(), lResult.ToVerboseString()); + return lResult; + } - public integer llCeil(Float fValue) - { - int intA = (int)Math.Ceiling(fValue); - Verbose("llCeiling({0})={1}", fValue, intA); - return intA; - } + public integer llCeil(Float fValue) + { + int intA = (int)Math.Ceiling(fValue); + Verbose("llCeiling({0})={1}", fValue, intA); + return intA; + } - public void llClearCameraParams() - { - Verbose("llClearCameraParams()"); - } + public void llClearCameraParams() + { + Verbose("llClearCameraParams()"); + } - public integer llClearLinkMedia(integer iLink, integer iFace) - { - Verbose("llClearLinkMedia({0}, {1})={2}", iLink, iFace, true); - return true; - } + public integer llClearLinkMedia(integer iLink, integer iFace) + { + Verbose("llClearLinkMedia({0}, {1})={2}", iLink, iFace, true); + return true; + } - public integer llClearPrimMedia(integer iFace) - { - integer iResult = 0; - Verbose("llClearPrimMedia({0})={1}", iFace, iResult); - return iResult; - } + public integer llClearPrimMedia(integer iFace) + { + integer iResult = 0; + Verbose("llClearPrimMedia({0})={1}", iFace, iResult); + return iResult; + } - public void llCloseRemoteDataChannel(key kChannel) - { - host.llCloseRemoteDataChannel(kChannel); - Verbose("llCloseRemoteDataChannel({0})", kChannel); - } + public void llCloseRemoteDataChannel(key kChannel) + { + host.llCloseRemoteDataChannel(kChannel); + Verbose("llCloseRemoteDataChannel({0})", kChannel); + } - public Float llCloud(vector vOffset) - { - Float fResult = 0.0F; - Verbose("llCloud({0})={1}", vOffset, fResult); - return fResult; - } + public Float llCloud(vector vOffset) + { + Float fResult = 0.0F; + Verbose("llCloud({0})={1}", vOffset, fResult); + return fResult; + } - public void llCollisionFilter(String sName, key kID, integer iAccept) - { - Verbose(@"llCollisionFilter(""{0}"", {1}, {2})", sName, kID, iAccept); - } + public void llCollisionFilter(String sName, key kID, integer iAccept) + { + Verbose(@"llCollisionFilter(""{0}"", {1}, {2})", sName, kID, iAccept); + } - public void llCollisionSound(String sImpactSound, Float fImpactVolume) - { - Verbose(@"llCollisionSound(""{0}"", {1})", sImpactSound, + fImpactVolume); - } + public void llCollisionSound(String sImpactSound, Float fImpactVolume) + { + Verbose(@"llCollisionSound(""{0}"", {1})", sImpactSound, + fImpactVolume); + } - public void llCollisionSprite(String sImpactSprite) - { - Verbose(@"llCollisionSprite(""{0}"")", sImpactSprite); - } + public void llCollisionSprite(String sImpactSprite) + { + Verbose(@"llCollisionSprite(""{0}"")", sImpactSprite); + } - public Float llCos(Float fTheta) - { - double dblA = Math.Cos(fTheta); - Verbose("llCos({0})={1}", fTheta, dblA); - return dblA; - } + public Float llCos(Float fTheta) + { + double dblA = Math.Cos(fTheta); + Verbose("llCos({0})={1}", fTheta, dblA); + return dblA; + } public void llCreateCharacter(list lOptions) { - Verbose("llCreateCharacter({0})", lOptions.ToVerboseString()); + Verbose("llCreateCharacter({0})", lOptions.ToVerboseString()); } - public void llCreateLink(key kID, integer iSimulator) - { - Verbose("llCreateLink({0}, {1})", kID, iSimulator); - } + public void llCreateLink(key kID, integer iSimulator) + { + Verbose("llCreateLink({0}, {1})", kID, iSimulator); + } public void llDeleteCharacter() { Verbose("llDeleteCharacter()"); } - public list llDeleteSubList(list lSource, integer iStart, integer iEnd) - { - int intLength = lSource.Count; + public list llDeleteSubList(list lSource, integer iStart, integer iEnd) + { + int intLength = lSource.Count; - int start = iStart; - int end = iEnd; + int start = iStart; + int end = iEnd; - list src = new list(lSource); + list src = new list(lSource); - if (CorrectIt(intLength, ref start, ref end)) - { - if (start <= end) - { - for (int intI = start; intI <= end; intI++) - src[intI] = null; - } - else // excluding - { - for (int intI = 0; intI <= end; intI++) - src[intI] = null; - for (int intI = start; intI < intLength; intI++) - src[intI] = null; - } - } - list lResult = new list(); - for (int intI = 0; intI < src.Count; intI++) - { - if (src[intI] != null) - lResult.Add(src[intI]); - } - Verbose(string.Format("llDeleteSubList({0}, {1}, {2})={3}", lSource.ToVerboseString(), iStart, iEnd, lResult.ToVerboseString())); - return lResult; - } + if (CorrectIt(intLength, ref start, ref end)) + { + if (start <= end) + { + for (int intI = start; intI <= end; intI++) + src[intI] = null; + } + else // excluding + { + for (int intI = 0; intI <= end; intI++) + src[intI] = null; + for (int intI = start; intI < intLength; intI++) + src[intI] = null; + } + } + list lResult = new list(); + for (int intI = 0; intI < src.Count; intI++) + { + if (src[intI] != null) + lResult.Add(src[intI]); + } + Verbose(string.Format("llDeleteSubList({0}, {1}, {2})={3}", lSource.ToVerboseString(), iStart, iEnd, lResult.ToVerboseString())); + return lResult; + } - public String llDeleteSubString(String sSource, integer iStart, integer iEnd) - { - char[] src = sSource.ToString().ToCharArray(); - int start = iStart; - int end = iEnd; + public String llDeleteSubString(String sSource, integer iStart, integer iEnd) + { + char[] src = sSource.ToString().ToCharArray(); + int start = iStart; + int end = iEnd; - int intLength = src.Length; + int intLength = src.Length; - if (CorrectIt(intLength, ref start, ref end)) - { - if (start <= end) - { - for (int intI = start; intI <= end; intI++) - src[intI] = '\0'; - } - else // excluding - { - for (int intI = 0; intI <= end; intI++) - src[intI] = '\0'; - for (int intI = start; intI < intLength; intI++) - src[intI] = '\0'; - } - } - StringBuilder result = new StringBuilder(); - for (int intI = 0; intI < src.Length; intI++) - { - if (src[intI] != '\0') - result.Append(src[intI]); - } + if (CorrectIt(intLength, ref start, ref end)) + { + if (start <= end) + { + for (int intI = start; intI <= end; intI++) + src[intI] = '\0'; + } + else // excluding + { + for (int intI = 0; intI <= end; intI++) + src[intI] = '\0'; + for (int intI = start; intI < intLength; intI++) + src[intI] = '\0'; + } + } + StringBuilder result = new StringBuilder(); + for (int intI = 0; intI < src.Length; intI++) + { + if (src[intI] != '\0') + result.Append(src[intI]); + } - Verbose(string.Format(@"llDeleteSubString(""{0}"", {1}, {2})=""{3}""", sSource, iStart, iEnd, result)); - return result.ToString(); - } + Verbose(string.Format(@"llDeleteSubString(""{0}"", {1}, {2})=""{3}""", sSource, iStart, iEnd, result)); + return result.ToString(); + } - public void llDetachFromAvatar() - { - Verbose("llDetachFromAvatar()"); - } + public void llDetachFromAvatar() + { + Verbose("llDetachFromAvatar()"); + } - public vector llDetectedGrab(integer iIndex) - { - vector vCoords = vector.ZERO_VECTOR; - Verbose("llDetectedGrab({0})={1}", iIndex, vCoords); - return vCoords; - } + public vector llDetectedGrab(integer iIndex) + { + vector vCoords = vector.ZERO_VECTOR; + Verbose("llDetectedGrab({0})={1}", iIndex, vCoords); + return vCoords; + } - public integer llDetectedGroup(integer iIndex) - { - integer iDetected = 0; - Verbose("llDetectedGroup({0})={1}", iIndex, iDetected); - return iDetected; - } + public integer llDetectedGroup(integer iIndex) + { + integer iDetected = 0; + Verbose("llDetectedGroup({0})={1}", iIndex, iDetected); + return iDetected; + } - public key llDetectedKey(integer iIndex) - { - key kID = new key(Properties.Settings.Default.AvatarKey); - Verbose("llDetectedKey({0})={1}", iIndex, kID); - return kID; - } + public key llDetectedKey(integer iIndex) + { + key kID = new key(Properties.Settings.Default.AvatarKey); + Verbose("llDetectedKey({0})={1}", iIndex, kID); + return kID; + } - public integer llDetectedLinkNumber(integer iLinkIndex) - { - integer iDetected = 0; - Verbose("llDetectedLinkNumber({0})={1}", iLinkIndex, iDetected); - return iDetected; - } + public integer llDetectedLinkNumber(integer iLinkIndex) + { + integer iDetected = 0; + Verbose("llDetectedLinkNumber({0})={1}", iLinkIndex, iDetected); + return iDetected; + } - public String llDetectedName(integer iIndex) - { - string sResult = Properties.Settings.Default.AvatarName; - Verbose(@"llDetectedName({0})=""{1}""", iIndex, sResult); - return sResult; - } + public String llDetectedName(integer iIndex) + { + string sResult = Properties.Settings.Default.AvatarName; + Verbose(@"llDetectedName({0})=""{1}""", iIndex, sResult); + return sResult; + } - public key llDetectedOwner(integer iIndex) - { - key kID = new key(Properties.Settings.Default.AvatarKey); - Verbose("llDetectedOwner({0})={1}", iIndex, kID); - return kID; - } + public key llDetectedOwner(integer iIndex) + { + key kID = new key(Properties.Settings.Default.AvatarKey); + Verbose("llDetectedOwner({0})={1}", iIndex, kID); + return kID; + } - public vector llDetectedPos(integer iIndex) - { - vector vCoords = vector.ZERO_VECTOR; - Verbose("llDetectedPos({0})={1}", iIndex, vCoords); - return vCoords; - } + public vector llDetectedPos(integer iIndex) + { + vector vCoords = vector.ZERO_VECTOR; + Verbose("llDetectedPos({0})={1}", iIndex, vCoords); + return vCoords; + } - public rotation llDetectedRot(integer iIndex) - { - rotation rRotation = rotation.ZERO_ROTATION; - Verbose("llDetectedRot({0})={1}", iIndex, rRotation); - return rRotation; - } + public rotation llDetectedRot(integer iIndex) + { + rotation rRotation = rotation.ZERO_ROTATION; + Verbose("llDetectedRot({0})={1}", iIndex, rRotation); + return rRotation; + } - public vector llDetectedTouchBinormal(integer iIndex) - { - vector vCoords = new vector(); - Verbose("llDetectedTouchBinormal({0})={1}", iIndex, vCoords); - return vCoords; - } + public vector llDetectedTouchBinormal(integer iIndex) + { + vector vCoords = new vector(); + Verbose("llDetectedTouchBinormal({0})={1}", iIndex, vCoords); + return vCoords; + } - public integer llDetectedTouchFace(integer iIndex) - { - integer iFace = 0; - Verbose("llDetectedTouchFace({0})={1}", iIndex, iFace); - return iFace; - } + public integer llDetectedTouchFace(integer iIndex) + { + integer iFace = 0; + Verbose("llDetectedTouchFace({0})={1}", iIndex, iFace); + return iFace; + } - public vector llDetectedTouchNormal(integer iIndex) - { - vector vNormal = new vector(); - Verbose("llDetectedTouchNormal({0})={1}", iIndex, vNormal); - return vNormal; - } + public vector llDetectedTouchNormal(integer iIndex) + { + vector vNormal = new vector(); + Verbose("llDetectedTouchNormal({0})={1}", iIndex, vNormal); + return vNormal; + } - public vector llDetectedTouchPos(integer iIndex) - { - vector vCoords = vector.ZERO_VECTOR; - Verbose("llDetectedTouchPos({0})={1}", iIndex, vCoords); - return vCoords; - } + public vector llDetectedTouchPos(integer iIndex) + { + vector vCoords = vector.ZERO_VECTOR; + Verbose("llDetectedTouchPos({0})={1}", iIndex, vCoords); + return vCoords; + } - public vector llDetectedTouchST(integer iIndex) - { - vector vCoords = vector.ZERO_VECTOR; - Verbose("llDetectedTouchST({0})={1}", iIndex, vCoords); - return vCoords; - } + public vector llDetectedTouchST(integer iIndex) + { + vector vCoords = vector.ZERO_VECTOR; + Verbose("llDetectedTouchST({0})={1}", iIndex, vCoords); + return vCoords; + } - public vector llDetectedTouchUV(integer iIndex) - { - vector vUV = vector.ZERO_VECTOR; - Verbose("llDetectedTouchUV({0})={1}", iIndex, vUV); - return vUV; - } + public vector llDetectedTouchUV(integer iIndex) + { + vector vUV = vector.ZERO_VECTOR; + Verbose("llDetectedTouchUV({0})={1}", iIndex, vUV); + return vUV; + } - public integer llDetectedType(integer iIndex) - { - integer iResult = AGENT; - Verbose("llDetectedType({0})={1}", iIndex, iResult); - return iResult; - } + public integer llDetectedType(integer iIndex) + { + integer iResult = AGENT; + Verbose("llDetectedType({0})={1}", iIndex, iResult); + return iResult; + } - public vector llDetectedVel(integer iIndex) - { - vector vVelocity = vector.ZERO_VECTOR; - Verbose("llDetectedVel({0})={1}", iIndex, vVelocity); - return vVelocity; - } + public vector llDetectedVel(integer iIndex) + { + vector vVelocity = vector.ZERO_VECTOR; + Verbose("llDetectedVel({0})={1}", iIndex, vVelocity); + return vVelocity; + } - public void llDialog(key kID, String sMessage, list lButtons, integer iChannel) - { - Verbose(@"llDialog({0}, ""{1}"", {2}, {3})", kID, sMessage, lButtons.ToVerboseString(), iChannel); - host.llDialog(kID, sMessage, lButtons, iChannel); - } + public void llDialog(key kID, String sMessage, list lButtons, integer iChannel) + { + Verbose(@"llDialog({0}, ""{1}"", {2}, {3})", kID, sMessage, lButtons.ToVerboseString(), iChannel); + host.llDialog(kID, sMessage, lButtons, iChannel); + } - public void llDie() - { - Verbose("llDie()"); - host.Die(); - } + public void llDie() + { + Verbose("llDie()"); + host.Die(); + } - public String llDumpList2String(list lSource, String sSeparator) - { - StringBuilder result = new StringBuilder(); - for (int intI = 0; intI < lSource.Count; intI++) - { - if (intI > 0) - result.Append(sSeparator.ToString()); - result.Append(lSource[intI].ToString()); - } - Verbose(@"llDumpList2String({0},""{1}"")=""{2}""", lSource.ToVerboseString(), sSeparator, result.ToString()); - return result.ToString(); - } + public String llDumpList2String(list lSource, String sSeparator) + { + StringBuilder result = new StringBuilder(); + for (int intI = 0; intI < lSource.Count; intI++) + { + if (intI > 0) + result.Append(sSeparator.ToString()); + result.Append(lSource[intI].ToString()); + } + Verbose(@"llDumpList2String({0},""{1}"")=""{2}""", lSource.ToVerboseString(), sSeparator, result.ToString()); + return result.ToString(); + } - public integer llEdgeOfWorld(vector vPosition, vector vDirection) - { - integer iResult = 0; - Verbose("llEdgeOfWorld({0}, {1})={2}", vPosition, vDirection, iResult); - return iResult; - } + public integer llEdgeOfWorld(vector vPosition, vector vDirection) + { + integer iResult = 0; + Verbose("llEdgeOfWorld({0}, {1})={2}", vPosition, vDirection, iResult); + return iResult; + } - public void llEjectFromLand(key kID) - { - Verbose("llEjectFromLand({0})", kID); - } + public void llEjectFromLand(key kID) + { + Verbose("llEjectFromLand({0})", kID); + } - public void llEmail(String sAddress, String sSubject, String sMessage) - { - Verbose(@"llEmail(""{0}"", ""{1}"", ""{2}"")", sAddress, sSubject, sMessage); - host.Email(sAddress, sSubject, sMessage); - } + public void llEmail(String sAddress, String sSubject, String sMessage) + { + Verbose(@"llEmail(""{0}"", ""{1}"", ""{2}"")", sAddress, sSubject, sMessage); + host.Email(sAddress, sSubject, sMessage); + } - public String llEscapeURL(String sURL) - { - StringBuilder sb = new StringBuilder(); - byte[] data = Encoding.UTF8.GetBytes(sURL.ToString()); - for (int intI = 0; intI < data.Length; intI++) - { - byte chrC = data[intI]; - if ((chrC >= 'a' && chrC <= 'z') || - (chrC >= 'A' && chrC <= 'Z') || - (chrC >= '0' && chrC <= '9')) - sb.Append((char)chrC); - else - sb.AppendFormat("%{0:X2}", (int)chrC); - } - Verbose(string.Format(@"EscapeURL(""{0}"")=""{1}""", sURL, sb.ToString())); - return sb.ToString(); - } + public String llEscapeURL(String sURL) + { + StringBuilder sb = new StringBuilder(); + byte[] data = Encoding.UTF8.GetBytes(sURL.ToString()); + for (int intI = 0; intI < data.Length; intI++) + { + byte chrC = data[intI]; + if ((chrC >= 'a' && chrC <= 'z') || + (chrC >= 'A' && chrC <= 'Z') || + (chrC >= '0' && chrC <= '9')) + sb.Append((char)chrC); + else + sb.AppendFormat("%{0:X2}", (int)chrC); + } + Verbose(string.Format(@"EscapeURL(""{0}"")=""{1}""", sURL, sb.ToString())); + return sb.ToString(); + } - public rotation llEuler2Rot(vector v) - { - v /= 2.0; - double ax = Math.Sin(v.x); - double aw = Math.Cos(v.x); - double by = Math.Sin(v.y); - double bw = Math.Cos(v.y); - double cz = Math.Sin(v.z); - double cw = Math.Cos(v.z); - rotation rRotation = new rotation(aw * by * cz + ax * bw * cw, - aw * by * cw - ax * bw * cz, - aw * bw * cz + ax * by * cw, - aw * bw * cw - ax * by * cz); - Verbose("llEuler2Rot({0})={1}", v, rRotation); - return rRotation; - } + public rotation llEuler2Rot(vector v) + { + v /= 2.0; + double ax = Math.Sin(v.x); + double aw = Math.Cos(v.x); + double by = Math.Sin(v.y); + double bw = Math.Cos(v.y); + double cz = Math.Sin(v.z); + double cw = Math.Cos(v.z); + rotation rRotation = new rotation(aw * by * cz + ax * bw * cw, + aw * by * cw - ax * bw * cz, + aw * bw * cz + ax * by * cw, + aw * bw * cw - ax * by * cz); + Verbose("llEuler2Rot({0})={1}", v, rRotation); + return rRotation; + } public void llEvade(key TargetID, list Options) { @@ -1828,626 +1829,626 @@ namespace LSLEditor Verbose("llExecCharacterCmd({0}, {1})", Command, Options); } - public Float llFabs(Float fValue) - { - double dblA = Math.Abs(fValue); - Verbose("llFabs({0})={1}", fValue, dblA); - return dblA; - } + public Float llFabs(Float fValue) + { + double dblA = Math.Abs(fValue); + Verbose("llFabs({0})={1}", fValue, dblA); + return dblA; + } public void llFleeFrom(vector vSource, Float fDistance, list lOptions) { Verbose("llFleeFrom({0}, {1}, {2})", vSource, fDistance, lOptions.ToVerboseString()); } - public integer llFloor(Float fValue) - { - int intA = (int)Math.Floor(fValue); - Verbose("llFloor({0})={1}", fValue, intA); - return intA; - } + public integer llFloor(Float fValue) + { + int intA = (int)Math.Floor(fValue); + Verbose("llFloor({0})={1}", fValue, intA); + return intA; + } - public void llForceMouselook(integer iMouselook) - { - Verbose("llForceMouselook({0})", iMouselook); - } + public void llForceMouselook(integer iMouselook) + { + Verbose("llForceMouselook({0})", iMouselook); + } - public Float llFrand(Float fMaximum) - { - double dblValue = fMaximum * m_random.NextDouble(); - Verbose("llFrand({0})={1}", fMaximum, dblValue); - return dblValue; - } + public Float llFrand(Float fMaximum) + { + double dblValue = fMaximum * m_random.NextDouble(); + Verbose("llFrand({0})={1}", fMaximum, dblValue); + return dblValue; + } - public key llGenerateKey() - { - key kID = new key(Guid.NewGuid()); - Verbose("llGenerateKey()={0}", kID); - return kID; - } + public key llGenerateKey() + { + key kID = new key(Guid.NewGuid()); + Verbose("llGenerateKey()={0}", kID); + return kID; + } - public vector llGetAccel() - { - vector vAcceleration = vector.ZERO_VECTOR; - Verbose("llGetAccel()={0}", vAcceleration); - return vAcceleration; - } + public vector llGetAccel() + { + vector vAcceleration = vector.ZERO_VECTOR; + Verbose("llGetAccel()={0}", vAcceleration); + return vAcceleration; + } - public integer llGetAgentInfo(key kID) - { - integer iAgentFlags = 0; - Verbose("llGetAgentInfo({0})={1}", kID, iAgentFlags); - return iAgentFlags; - } + public integer llGetAgentInfo(key kID) + { + integer iAgentFlags = 0; + Verbose("llGetAgentInfo({0})={1}", kID, iAgentFlags); + return iAgentFlags; + } - public String llGetAgentLanguage(key kID) - { - string sLanguageCode = "en-us"; - Verbose(@"llGetAgentLanguage({0})=""{1}""", kID, sLanguageCode); - return sLanguageCode; - } + public String llGetAgentLanguage(key kID) + { + string sLanguageCode = "en-us"; + Verbose(@"llGetAgentLanguage({0})=""{1}""", kID, sLanguageCode); + return sLanguageCode; + } public list llGetAgentList(integer iScope, list lOptions) { - list lAgents = new list(); - Verbose("llGetAgentList({0}, [{1}])={2}", iScope, lOptions, lAgents.ToVerboseString()); - return lAgents; + list lAgents = new list(); + Verbose("llGetAgentList({0}, [{1}])={2}", iScope, lOptions, lAgents.ToVerboseString()); + return lAgents; } - public vector llGetAgentSize(key kID) - { - vector vAgentSize = vector.ZERO_VECTOR; - Verbose("llGetAgentSize({0})={1}", kID, vAgentSize); - return vAgentSize; - } + public vector llGetAgentSize(key kID) + { + vector vAgentSize = vector.ZERO_VECTOR; + Verbose("llGetAgentSize({0})={1}", kID, vAgentSize); + return vAgentSize; + } - public Float llGetAlpha(integer iFace) - { - Float fOpacity = 1.0F; - Verbose("llGetAlpha({0})={1}", iFace, fOpacity); - return fOpacity; - } + public Float llGetAlpha(integer iFace) + { + Float fOpacity = 1.0F; + Verbose("llGetAlpha({0})={1}", iFace, fOpacity); + return fOpacity; + } - public Float llGetAndResetTime() - { - // get time - double dTime = llGetTime(); - Verbose("llGetAndResetTime()=" + dTime); - // reset time - llResetTime(); - return dTime; - } + public Float llGetAndResetTime() + { + // get time + double dTime = llGetTime(); + Verbose("llGetAndResetTime()=" + dTime); + // reset time + llResetTime(); + return dTime; + } - public String llGetAnimation(key kID) - { - String sAnimation = ""; - Verbose(@"llGetAnimation({0})=""{1}""", kID, sAnimation); - return sAnimation; - } + public String llGetAnimation(key kID) + { + String sAnimation = ""; + Verbose(@"llGetAnimation({0})=""{1}""", kID, sAnimation); + return sAnimation; + } - public list llGetAnimationList(key kID) - { - list lAnimationList = new list(); - Verbose("llGetAnimationList({0})={1}", kID, lAnimationList.ToVerboseString()); - return lAnimationList; - } + public list llGetAnimationList(key kID) + { + list lAnimationList = new list(); + Verbose("llGetAnimationList({0})={1}", kID, lAnimationList.ToVerboseString()); + return lAnimationList; + } - public String llGetAnimationOverride(String sAnimationState) - { - String sAnimation = ""; - Verbose(@"llGetAnimationOverride(""{0}"")=""{1}""", sAnimationState, sAnimation); - return sAnimation; - } + public String llGetAnimationOverride(String sAnimationState) + { + String sAnimation = ""; + Verbose(@"llGetAnimationOverride(""{0}"")=""{1}""", sAnimationState, sAnimation); + return sAnimation; + } - public integer llGetAttached() - { - integer iAttachPoint = 0; - Verbose("llGetAttached()={0}", iAttachPoint); - return iAttachPoint; - } + public integer llGetAttached() + { + integer iAttachPoint = 0; + Verbose("llGetAttached()={0}", iAttachPoint); + return iAttachPoint; + } - public list llGetBoundingBox(key kID) - { - list lBoundingCoords = new list(); - Verbose("llGetBoundingBox({0})={1}", kID, lBoundingCoords.ToVerboseString()); - return lBoundingCoords; - } + public list llGetBoundingBox(key kID) + { + list lBoundingCoords = new list(); + Verbose("llGetBoundingBox({0})={1}", kID, lBoundingCoords.ToVerboseString()); + return lBoundingCoords; + } - public vector llGetCameraPos() - { - vector vCameraCoords = vector.ZERO_VECTOR; - Verbose("llGetCameraPos()={0}", vCameraCoords); - return vCameraCoords; - } + public vector llGetCameraPos() + { + vector vCameraCoords = vector.ZERO_VECTOR; + Verbose("llGetCameraPos()={0}", vCameraCoords); + return vCameraCoords; + } - public rotation llGetCameraRot() - { - rotation rCameraRotation = rotation.ZERO_ROTATION; - Verbose("llGetCameraRot()={0}", rCameraRotation); - return rCameraRotation; - } + public rotation llGetCameraRot() + { + rotation rCameraRotation = rotation.ZERO_ROTATION; + Verbose("llGetCameraRot()={0}", rCameraRotation); + return rCameraRotation; + } - public vector llGetCenterOfMass() - { - vector vCenterOfMass = vector.ZERO_VECTOR; - Verbose("llGetCenterOfMass()={0}", vCenterOfMass); - return vCenterOfMass; - } + public vector llGetCenterOfMass() + { + vector vCenterOfMass = vector.ZERO_VECTOR; + Verbose("llGetCenterOfMass()={0}", vCenterOfMass); + return vCenterOfMass; + } public list llGetClosestNavPoint(vector lPoint, list lOptions) { - list lClosetNavPoint = new list(); - Verbose("llGetClosestNavPoint({0}, {1})={2}", lPoint, lOptions.ToVerboseString(), lClosetNavPoint.ToVerboseString()); - return lClosetNavPoint; + list lClosetNavPoint = new list(); + Verbose("llGetClosestNavPoint({0}, {1})={2}", lPoint, lOptions.ToVerboseString(), lClosetNavPoint.ToVerboseString()); + return lClosetNavPoint; } - public vector llGetColor(integer iFace) - { - vector vColour = vector.ZERO_VECTOR; - Verbose("llGetColor({0})={1}", iFace, vColour); - return vColour; - } + public vector llGetColor(integer iFace) + { + vector vColour = vector.ZERO_VECTOR; + Verbose("llGetColor({0})={1}", iFace, vColour); + return vColour; + } - public key llGetCreator() - { - key kResult = Properties.Settings.Default.AvatarKey; - Verbose("llGetCreator()={0}", kResult); - return kResult; - } + public key llGetCreator() + { + key kResult = Properties.Settings.Default.AvatarKey; + Verbose("llGetCreator()={0}", kResult); + return kResult; + } - public String llGetDate() - { - string sResult = DateTime.Now.ToUniversalTime().ToString("yyyy-MM-dd"); - Verbose("llGetDate()={0}", sResult); - return sResult; - } + public String llGetDate() + { + string sResult = DateTime.Now.ToUniversalTime().ToString("yyyy-MM-dd"); + Verbose("llGetDate()={0}", sResult); + return sResult; + } - public string llGetDisplayName(key kAvatarID) - { - string sResult = ""; - Verbose("llGetDisplayName({0})={1}", kAvatarID, sResult); - return sResult; - } + public string llGetDisplayName(key kAvatarID) + { + string sResult = ""; + Verbose("llGetDisplayName({0})={1}", kAvatarID, sResult); + return sResult; + } - public Float llGetEnergy() - { - Float fResult = 1.23; - Verbose("llGetEnergy()={0}", fResult); - return fResult; - } + public Float llGetEnergy() + { + Float fResult = 1.23; + Verbose("llGetEnergy()={0}", fResult); + return fResult; + } - public string llGetEnv(string sDataRequest) - { - string sResult; - switch (sDataRequest) - { - case "sim_channel": - sResult = "Second Life Server"; - break; - case "sim_version": - sResult = "11.11.09.244706"; - break; - default: - sResult = ""; - break; - } - Verbose(@"llGetEnv(""{0}"")=""{1}""", sDataRequest, sResult); - return sResult; - } + public string llGetEnv(string sDataRequest) + { + string sResult; + switch (sDataRequest) + { + case "sim_channel": + sResult = "Second Life Server"; + break; + case "sim_version": + sResult = "11.11.09.244706"; + break; + default: + sResult = ""; + break; + } + Verbose(@"llGetEnv(""{0}"")=""{1}""", sDataRequest, sResult); + return sResult; + } - public vector llGetForce() - { - vector vForce = vector.ZERO_VECTOR; - Verbose("llGetForce()={0}", vForce); - return vForce; - } + public vector llGetForce() + { + vector vForce = vector.ZERO_VECTOR; + Verbose("llGetForce()={0}", vForce); + return vForce; + } - public integer llGetFreeMemory() - { - integer iFreeMemory = 16000; - Verbose("llGetFreeMemory()={0}", iFreeMemory); - return iFreeMemory; - } + public integer llGetFreeMemory() + { + integer iFreeMemory = 16000; + Verbose("llGetFreeMemory()={0}", iFreeMemory); + return iFreeMemory; + } - public integer llGetFreeURLs() - { - integer iFreeURLs = 0; - Verbose("llGetFreeURLs()={0}", iFreeURLs); - return iFreeURLs; - } + public integer llGetFreeURLs() + { + integer iFreeURLs = 0; + Verbose("llGetFreeURLs()={0}", iFreeURLs); + return iFreeURLs; + } - public Float llGetGMTclock() - { - Float fResult = DateTime.Now.ToUniversalTime().TimeOfDay.TotalSeconds; - Verbose("llGetGMTclock()={0}", fResult); - return fResult; - } + public Float llGetGMTclock() + { + Float fResult = DateTime.Now.ToUniversalTime().TimeOfDay.TotalSeconds; + Verbose("llGetGMTclock()={0}", fResult); + return fResult; + } - public vector llGetGeometricCenter() - { - vector vResult = ZERO_VECTOR; - Verbose("llGetGeometricCenter()={0}", vResult); - return vResult; - } + public vector llGetGeometricCenter() + { + vector vResult = ZERO_VECTOR; + Verbose("llGetGeometricCenter()={0}", vResult); + return vResult; + } - public String llGetHTTPHeader(key kRequestID, String sDesiredHeader) - { - String sResult = "not-implemented"; - Verbose(@"llGetHTTPHeader({0}, ""{1}"")=""{2}""", kRequestID, sDesiredHeader, sResult); - return sResult; - } + public String llGetHTTPHeader(key kRequestID, String sDesiredHeader) + { + String sResult = "not-implemented"; + Verbose(@"llGetHTTPHeader({0}, ""{1}"")=""{2}""", kRequestID, sDesiredHeader, sResult); + return sResult; + } - public key llGetInventoryCreator(String sItem) - { - key kAvatarID = Properties.Settings.Default.AvatarKey; - Verbose(@"llGetInventoryCreator(""{0}"")={1}", sItem, kAvatarID); - return kAvatarID; - } + public key llGetInventoryCreator(String sItem) + { + key kAvatarID = Properties.Settings.Default.AvatarKey; + Verbose(@"llGetInventoryCreator(""{0}"")={1}", sItem, kAvatarID); + return kAvatarID; + } - public key llGetInventoryKey(String sItemName) - { - key kID = host.GetInventoryKey(sItemName); - Verbose(@"llGetInventoryKey(""{0}"")={1}", sItemName, kID); - return kID; - } + public key llGetInventoryKey(String sItemName) + { + key kID = host.GetInventoryKey(sItemName); + Verbose(@"llGetInventoryKey(""{0}"")={1}", sItemName, kID); + return kID; + } - public String llGetInventoryName(integer iItemType, integer iItemIndex) - { - string sItemName = host.GetInventoryName(iItemType, iItemIndex); - Verbose(@"llGetInventoryName({0}, {1})=""{2}""", iItemType, iItemIndex, sItemName); - return sItemName; - } + public String llGetInventoryName(integer iItemType, integer iItemIndex) + { + string sItemName = host.GetInventoryName(iItemType, iItemIndex); + Verbose(@"llGetInventoryName({0}, {1})=""{2}""", iItemType, iItemIndex, sItemName); + return sItemName; + } - public integer llGetInventoryNumber(integer iType) - { - int iTypeCount = host.GetInventoryNumber(iType); - Verbose("llGetInventoryNumber({0})={1}", iType, iTypeCount); - return iTypeCount; - } + public integer llGetInventoryNumber(integer iType) + { + int iTypeCount = host.GetInventoryNumber(iType); + Verbose("llGetInventoryNumber({0})={1}", iType, iTypeCount); + return iTypeCount; + } - public integer llGetInventoryPermMask(String sItemName, integer iPermMask) - { - integer iPermissionState = 0; - Verbose(@"llGetInventoryPermMask(""{0}"", {1})={2}", sItemName, iPermMask, iPermissionState); - return iPermissionState; - } + public integer llGetInventoryPermMask(String sItemName, integer iPermMask) + { + integer iPermissionState = 0; + Verbose(@"llGetInventoryPermMask(""{0}"", {1})={2}", sItemName, iPermMask, iPermissionState); + return iPermissionState; + } - public integer llGetInventoryType(String sItemName) - { - integer iItemType = host.GetInventoryType(sItemName); - Verbose(@"llGetInventoryType(""{0}"")={1}", sItemName, iItemType); - return iItemType; - } + public integer llGetInventoryType(String sItemName) + { + integer iItemType = host.GetInventoryType(sItemName); + Verbose(@"llGetInventoryType(""{0}"")={1}", sItemName, iItemType); + return iItemType; + } - public key llGetKey() - { - key kID = host.GetKey(); - Verbose(@"llGetKey()=""{0}""", kID.ToString()); - return kID; - } + public key llGetKey() + { + key kID = host.GetKey(); + Verbose(@"llGetKey()=""{0}""", kID.ToString()); + return kID; + } - public key llGetLandOwnerAt(vector vPosition) - { - key kAvatarID = new key(Guid.NewGuid()); - Verbose("llGetLandOwnerAt({0})={1}", vPosition, kAvatarID); - return kAvatarID; - } + public key llGetLandOwnerAt(vector vPosition) + { + key kAvatarID = new key(Guid.NewGuid()); + Verbose("llGetLandOwnerAt({0})={1}", vPosition, kAvatarID); + return kAvatarID; + } - public key llGetLinkKey(integer iLinkIndex) - { - key kID = new key(Guid.NewGuid()); - Verbose("llGetLinkKey({0})={1}", iLinkIndex, kID); - return kID; - } + public key llGetLinkKey(integer iLinkIndex) + { + key kID = new key(Guid.NewGuid()); + Verbose("llGetLinkKey({0})={1}", iLinkIndex, kID); + return kID; + } - public list llGetLinkMedia(integer iLinkIndex, integer iFace, list lParameters) - { - list lMediaList = new list(); - Verbose("llGetLinkMedia({0}, {1}, {2})={3}", iLinkIndex, iFace, lParameters.ToVerboseString(), lMediaList.ToVerboseString()); - return lMediaList; - } + public list llGetLinkMedia(integer iLinkIndex, integer iFace, list lParameters) + { + list lMediaList = new list(); + Verbose("llGetLinkMedia({0}, {1}, {2})={3}", iLinkIndex, iFace, lParameters.ToVerboseString(), lMediaList.ToVerboseString()); + return lMediaList; + } - public String llGetLinkName(integer iLinkIndex) - { - String sLinkName = ""; - Verbose(@"llGetLinkName({0})=""{1}""", iLinkIndex, sLinkName); - return sLinkName; - } + public String llGetLinkName(integer iLinkIndex) + { + String sLinkName = ""; + Verbose(@"llGetLinkName({0})=""{1}""", iLinkIndex, sLinkName); + return sLinkName; + } - public integer llGetLinkNumber() - { - integer iLinkIndex = 0; - Verbose("llGetLinkNumber()={0}", iLinkIndex); - return iLinkIndex; - } + public integer llGetLinkNumber() + { + integer iLinkIndex = 0; + Verbose("llGetLinkNumber()={0}", iLinkIndex); + return iLinkIndex; + } - public integer llGetLinkNumberOfSides(integer iLinkIndex) - { - integer iSides = 6; - Verbose("llGetLinkNumberOfSides({0})={1}", iLinkIndex, iSides); - return iSides; - } + public integer llGetLinkNumberOfSides(integer iLinkIndex) + { + integer iSides = 6; + Verbose("llGetLinkNumberOfSides({0})={1}", iLinkIndex, iSides); + return iSides; + } - public list llGetLinkPrimitiveParams(integer iLinkIndex, list lParametersRequested) - { - list lParametersReturned = new list(); - Verbose("llGetLinkPrimitiveParams({0}, {1})={2}", iLinkIndex, lParametersRequested.ToVerboseString(), lParametersReturned); - return lParametersReturned; - } + public list llGetLinkPrimitiveParams(integer iLinkIndex, list lParametersRequested) + { + list lParametersReturned = new list(); + Verbose("llGetLinkPrimitiveParams({0}, {1})={2}", iLinkIndex, lParametersRequested.ToVerboseString(), lParametersReturned); + return lParametersReturned; + } - public integer llGetListEntryType(list lSource, integer iIndex) - { - integer iEntryType; + public integer llGetListEntryType(list lSource, integer iIndex) + { + integer iEntryType; - if (iIndex < 0) - iIndex = lSource.Count + iIndex; - if (iIndex >= lSource.Count || iIndex < 0) - iEntryType = 0; - else - { - switch (lSource[iIndex].GetType().ToString().Replace("LSLEditor.SecondLife+", "")) - { - case "System.Double": - case "Float": - iEntryType = TYPE_FLOAT; - break; - case "System.String": - case "String": - iEntryType = TYPE_STRING; - break; - case "System.Int32": - case "integer": - iEntryType = TYPE_INTEGER; - break; - case "key": - iEntryType = TYPE_KEY; - break; - case "vector": - iEntryType = TYPE_VECTOR; - break; - case "rotation": - iEntryType = TYPE_ROTATION; - break; - default: - iEntryType = TYPE_INVALID; - break; - } - } - Verbose("llGetListEntryType({0}, {1})={2}", lSource.ToVerboseString(), iIndex, iEntryType); - return iEntryType; - } + if (iIndex < 0) + iIndex = lSource.Count + iIndex; + if (iIndex >= lSource.Count || iIndex < 0) + iEntryType = 0; + else + { + switch (lSource[iIndex].GetType().ToString().Replace("LSLEditor.SecondLife+", "")) + { + case "System.Double": + case "Float": + iEntryType = TYPE_FLOAT; + break; + case "System.String": + case "String": + iEntryType = TYPE_STRING; + break; + case "System.Int32": + case "integer": + iEntryType = TYPE_INTEGER; + break; + case "key": + iEntryType = TYPE_KEY; + break; + case "vector": + iEntryType = TYPE_VECTOR; + break; + case "rotation": + iEntryType = TYPE_ROTATION; + break; + default: + iEntryType = TYPE_INVALID; + break; + } + } + Verbose("llGetListEntryType({0}, {1})={2}", lSource.ToVerboseString(), iIndex, iEntryType); + return iEntryType; + } - public integer llGetListLength(list lSource) - { - integer iLength = lSource.Count; - Verbose("llGetListLength({0})={1}", lSource.ToVerboseString(), iLength); - return iLength; - } + public integer llGetListLength(list lSource) + { + integer iLength = lSource.Count; + Verbose("llGetListLength({0})={1}", lSource.ToVerboseString(), iLength); + return iLength; + } - public vector llGetLocalPos() - { + public vector llGetLocalPos() + { Verbose("llGetLocalPos()={0}", m_pos); - return m_pos; - } + return m_pos; + } - public rotation llGetLocalRot() - { - Verbose("llGetLocalRot()={0}", m_rotlocal); - return m_rotlocal; - } + public rotation llGetLocalRot() + { + Verbose("llGetLocalRot()={0}", m_rotlocal); + return m_rotlocal; + } - public Float llGetMass() - { - Float fMass = 1.23; - Verbose("llGetMass()={0}", fMass); - return fMass; - } + public Float llGetMass() + { + Float fMass = 1.23; + Verbose("llGetMass()={0}", fMass); + return fMass; + } - public Float llGetMassMKS() - { - Float fMass = 1.23; - Verbose("llGetMassMKS()={0}", fMass); - return fMass; - } + public Float llGetMassMKS() + { + Float fMass = 1.23; + Verbose("llGetMassMKS()={0}", fMass); + return fMass; + } - public integer llGetMemoryLimit() - { - integer iMaxMemory = 65536; - Verbose("llGetMemoryLimit()={0}", iMaxMemory); - return iMaxMemory; - } + public integer llGetMemoryLimit() + { + integer iMaxMemory = 65536; + Verbose("llGetMemoryLimit()={0}", iMaxMemory); + return iMaxMemory; + } - public void llGetNextEmail(String sAddress, String sSubject) - { - Verbose(@"llGetNextEmail(""{0}"", ""{1}"")", sAddress, sSubject); - } + public void llGetNextEmail(String sAddress, String sSubject) + { + Verbose(@"llGetNextEmail(""{0}"", ""{1}"")", sAddress, sSubject); + } - public key llGetNotecardLine(String sNoteName, integer iLineIndex) - { - key kID = host.GetNotecardLine(sNoteName, iLineIndex); - Verbose(@"llGetNotecardLine(""{0}"", {1})={2}", sNoteName, iLineIndex, kID); - return kID; - } + public key llGetNotecardLine(String sNoteName, integer iLineIndex) + { + key kID = host.GetNotecardLine(sNoteName, iLineIndex); + Verbose(@"llGetNotecardLine(""{0}"", {1})={2}", sNoteName, iLineIndex, kID); + return kID; + } - public key llGetNumberOfNotecardLines(String sNoteName) - { - key kID = host.GetNumberOfNotecardLines(sNoteName); - Verbose(@"llGetNumberOfNotecardLines(""{0}"")={1}", sNoteName, kID); - return kID; - } + public key llGetNumberOfNotecardLines(String sNoteName) + { + key kID = host.GetNumberOfNotecardLines(sNoteName); + Verbose(@"llGetNumberOfNotecardLines(""{0}"")={1}", sNoteName, kID); + return kID; + } - public integer llGetNumberOfPrims() - { - integer iPrimCount = 10; - Verbose("llGetNumberOfPrims()={0}", iPrimCount); - return iPrimCount; - } + public integer llGetNumberOfPrims() + { + integer iPrimCount = 10; + Verbose("llGetNumberOfPrims()={0}", iPrimCount); + return iPrimCount; + } - public integer llGetNumberOfSides() - { - integer iSideCount = 6; - Verbose("llGetNumberOfSides()={0}", iSideCount); - return iSideCount; - } + public integer llGetNumberOfSides() + { + integer iSideCount = 6; + Verbose("llGetNumberOfSides()={0}", iSideCount); + return iSideCount; + } - public String llGetObjectDesc() - { - string sDescription = host.GetObjectDescription(); - Verbose(@"llGetObjectDesc()=""{0}""", sDescription); - return sDescription; - } + public String llGetObjectDesc() + { + string sDescription = host.GetObjectDescription(); + Verbose(@"llGetObjectDesc()=""{0}""", sDescription); + return sDescription; + } - public list llGetObjectDetails(key kID, list lObjectFlags) - { - list lObjectDetails = new list(); - for (int intI = 0; intI < lObjectFlags.Count; intI++) - { - if (!(lObjectFlags[intI] is integer)) - continue; - switch ((int)(integer)lObjectFlags[intI]) - { - case OBJECT_NAME: - lObjectDetails.Add((SecondLife.String)host.GetObjectName(new Guid(kID.guid))); - break; - case OBJECT_DESC: - lObjectDetails.Add((SecondLife.String)host.GetObjectDescription(new Guid(kID.guid))); - break; - case OBJECT_POS: - lObjectDetails.Add(llGetPos()); - break; - case OBJECT_ROT: - lObjectDetails.Add(llGetRot()); - break; - case OBJECT_VELOCITY: - lObjectDetails.Add(llGetVel()); - break; - case OBJECT_OWNER: - lObjectDetails.Add(llGetOwner()); - break; - case OBJECT_GROUP: - lObjectDetails.Add(OBJECT_UNKNOWN_DETAIL); - break; - case OBJECT_CREATOR: - lObjectDetails.Add(llGetCreator()); - break; - default: - lObjectDetails.Add(OBJECT_UNKNOWN_DETAIL); - break; - } - } - Verbose(@"llGetObjectDetails({0}, {1})={2}", kID, lObjectFlags, lObjectDetails); - return lObjectDetails; - } + public list llGetObjectDetails(key kID, list lObjectFlags) + { + list lObjectDetails = new list(); + for (int intI = 0; intI < lObjectFlags.Count; intI++) + { + if (!(lObjectFlags[intI] is integer)) + continue; + switch ((int)(integer)lObjectFlags[intI]) + { + case OBJECT_NAME: + lObjectDetails.Add((SecondLife.String)host.GetObjectName(new Guid(kID.guid))); + break; + case OBJECT_DESC: + lObjectDetails.Add((SecondLife.String)host.GetObjectDescription(new Guid(kID.guid))); + break; + case OBJECT_POS: + lObjectDetails.Add(llGetPos()); + break; + case OBJECT_ROT: + lObjectDetails.Add(llGetRot()); + break; + case OBJECT_VELOCITY: + lObjectDetails.Add(llGetVel()); + break; + case OBJECT_OWNER: + lObjectDetails.Add(llGetOwner()); + break; + case OBJECT_GROUP: + lObjectDetails.Add(OBJECT_UNKNOWN_DETAIL); + break; + case OBJECT_CREATOR: + lObjectDetails.Add(llGetCreator()); + break; + default: + lObjectDetails.Add(OBJECT_UNKNOWN_DETAIL); + break; + } + } + Verbose(@"llGetObjectDetails({0}, {1})={2}", kID, lObjectFlags, lObjectDetails); + return lObjectDetails; + } - public Float llGetObjectMass(key kID) - { - Float fMass = 0.0F; - Verbose("llGetObjectMass({0})={1}", kID, fMass); - return fMass; - } + public Float llGetObjectMass(key kID) + { + Float fMass = 0.0F; + Verbose("llGetObjectMass({0})={1}", kID, fMass); + return fMass; + } - public String llGetObjectName() - { - string sObjectName = host.GetObjectName(); - Verbose(@"llGetObjectName()=""{0}""", sObjectName); - return sObjectName; - } + public String llGetObjectName() + { + string sObjectName = host.GetObjectName(); + Verbose(@"llGetObjectName()=""{0}""", sObjectName); + return sObjectName; + } - public integer llGetObjectPermMask(integer iRequestedMask) - { - integer iRetunedMaskState = 0; - Verbose("llGetObjectPermMask({0})={1}", iRequestedMask, iRetunedMaskState); - return iRetunedMaskState; - } + public integer llGetObjectPermMask(integer iRequestedMask) + { + integer iRetunedMaskState = 0; + Verbose("llGetObjectPermMask({0})={1}", iRequestedMask, iRetunedMaskState); + return iRetunedMaskState; + } - // added 4 mei 2007 - public integer llGetObjectPrimCount(key kID) - { - integer iPrimCount = 0; - Verbose("llGetObjectPrimCount({0})={1}", kID, iPrimCount); - return iPrimCount; - } + // added 4 mei 2007 + public integer llGetObjectPrimCount(key kID) + { + integer iPrimCount = 0; + Verbose("llGetObjectPrimCount({0})={1}", kID, iPrimCount); + return iPrimCount; + } - public vector llGetOmega() - { - vector vOmega = vector.ZERO_VECTOR; - Verbose("llGetOmega()={0}", vOmega); - return vOmega; - } + public vector llGetOmega() + { + vector vOmega = vector.ZERO_VECTOR; + Verbose("llGetOmega()={0}", vOmega); + return vOmega; + } - public key llGetOwner() - { - key kID = new key(Properties.Settings.Default.AvatarKey); - Verbose("llGetOwner()={0}", kID); - return kID; - } + public key llGetOwner() + { + key kID = new key(Properties.Settings.Default.AvatarKey); + Verbose("llGetOwner()={0}", kID); + return kID; + } - public key llGetOwnerKey(key kID) - { - key kAvatarID = llGetOwner(); // This is incorrect, as the owner of this object may not be the owner of kID - Verbose("llGetOwnerKey({0})={1}", kID, kAvatarID); - return kAvatarID; - } + public key llGetOwnerKey(key kID) + { + key kAvatarID = llGetOwner(); // This is incorrect, as the owner of this object may not be the owner of kID + Verbose("llGetOwnerKey({0})={1}", kID, kAvatarID); + return kAvatarID; + } - /* - PARCEL_DETAILS_NAME 0 The name of the parcel. 63 Characters string - PARCEL_DETAILS_DESC 1 The description of the parcel. 127 Characters string - PARCEL_DETAILS_OWNER 2 The parcel owner's key. (36 Characters) key - PARCEL_DETAILS_GROUP 3 The parcel group's key. (36 Characters) key - PARCEL_DETAILS_AREA 4 The parcel's area, in sqm. (5 Characters) integer - */ - public list llGetParcelDetails(vector vPosition, list lRequestedDetails) - { - list lReturnedDetails = new list(); - for (int intI = 0; intI < lRequestedDetails.Count; intI++) - { - if (lRequestedDetails[intI] is integer) - { - switch ((int)(integer)lRequestedDetails[intI]) - { - case PARCEL_DETAILS_NAME: - lReturnedDetails.Add(Properties.Settings.Default.ParcelName); - break; - case PARCEL_DETAILS_DESC: - lReturnedDetails.Add(Properties.Settings.Default.ParcelDescription); - break; - case PARCEL_DETAILS_OWNER: - lReturnedDetails.Add(new key(Properties.Settings.Default.ParcelOwner)); - break; - case PARCEL_DETAILS_GROUP: - lReturnedDetails.Add(new key(Properties.Settings.Default.ParcelGroup)); - break; - case PARCEL_DETAILS_AREA: - lReturnedDetails.Add(new integer(Properties.Settings.Default.ParcelArea)); - break; - case PARCEL_DETAILS_ID: - lReturnedDetails.Add(new integer(Properties.Settings.Default.ParcelID)); - break; - case PARCEL_DETAILS_SEE_AVATARS: - lReturnedDetails.Add(new integer(Properties.Settings.Default.ParcelSeeAvatars)); - break; - default: - break; - } - } - } - Verbose("llGetParcelDetails({0}, {1})={2}", vPosition, lRequestedDetails.ToVerboseString(), lReturnedDetails.ToVerboseString()); - return lReturnedDetails; - } + /* + PARCEL_DETAILS_NAME 0 The name of the parcel. 63 Characters string + PARCEL_DETAILS_DESC 1 The description of the parcel. 127 Characters string + PARCEL_DETAILS_OWNER 2 The parcel owner's key. (36 Characters) key + PARCEL_DETAILS_GROUP 3 The parcel group's key. (36 Characters) key + PARCEL_DETAILS_AREA 4 The parcel's area, in sqm. (5 Characters) integer + */ + public list llGetParcelDetails(vector vPosition, list lRequestedDetails) + { + list lReturnedDetails = new list(); + for (int intI = 0; intI < lRequestedDetails.Count; intI++) + { + if (lRequestedDetails[intI] is integer) + { + switch ((int)(integer)lRequestedDetails[intI]) + { + case PARCEL_DETAILS_NAME: + lReturnedDetails.Add(Properties.Settings.Default.ParcelName); + break; + case PARCEL_DETAILS_DESC: + lReturnedDetails.Add(Properties.Settings.Default.ParcelDescription); + break; + case PARCEL_DETAILS_OWNER: + lReturnedDetails.Add(new key(Properties.Settings.Default.ParcelOwner)); + break; + case PARCEL_DETAILS_GROUP: + lReturnedDetails.Add(new key(Properties.Settings.Default.ParcelGroup)); + break; + case PARCEL_DETAILS_AREA: + lReturnedDetails.Add(new integer(Properties.Settings.Default.ParcelArea)); + break; + case PARCEL_DETAILS_ID: + lReturnedDetails.Add(new integer(Properties.Settings.Default.ParcelID)); + break; + case PARCEL_DETAILS_SEE_AVATARS: + lReturnedDetails.Add(new integer(Properties.Settings.Default.ParcelSeeAvatars)); + break; + default: + break; + } + } + } + Verbose("llGetParcelDetails({0}, {1})={2}", vPosition, lRequestedDetails.ToVerboseString(), lReturnedDetails.ToVerboseString()); + return lReturnedDetails; + } - public integer llGetParcelFlags(vector vPosition) - { - integer iReturnedFlags = 0; - Verbose("llGetParcelFlags({0})={1}", vPosition, iReturnedFlags); - return iReturnedFlags; - } + public integer llGetParcelFlags(vector vPosition) + { + integer iReturnedFlags = 0; + Verbose("llGetParcelFlags({0})={1}", vPosition, iReturnedFlags); + return iReturnedFlags; + } public integer llGetParcelMaxPrims(vector vPosition, integer iSimWide) - { - integer iMaxPrims = 0; - Verbose("llGetParcelMaxPrims({0}, {1})={2}", vPosition, iSimWide, iMaxPrims); - return iMaxPrims; - } + { + integer iMaxPrims = 0; + Verbose("llGetParcelMaxPrims({0}, {1})={2}", vPosition, iSimWide, iMaxPrims); + return iMaxPrims; + } public string llGetParcelMusicURL() { @@ -2455,171 +2456,171 @@ namespace LSLEditor return m_ParcelMusicURL; } - public integer llGetParcelPrimCount(vector vPosition, integer iCategory, integer iSimWide) - { - integer iPrimCount = 0; - Verbose("llGetParcelPrimCount({0}, {1}, {2})={3}", vPosition, iCategory, iSimWide, iPrimCount); - return iPrimCount; - } + public integer llGetParcelPrimCount(vector vPosition, integer iCategory, integer iSimWide) + { + integer iPrimCount = 0; + Verbose("llGetParcelPrimCount({0}, {1}, {2})={3}", vPosition, iCategory, iSimWide, iPrimCount); + return iPrimCount; + } - public list llGetParcelPrimOwners(vector vPosition) - { - list lOwners = new list(new object[] { Properties.Settings.Default.AvatarKey, 10 }); - Verbose("llGetParcelPrimOwners({0})={1}", vPosition, lOwners); - return lOwners; - } + public list llGetParcelPrimOwners(vector vPosition) + { + list lOwners = new list(new object[] { Properties.Settings.Default.AvatarKey, 10 }); + Verbose("llGetParcelPrimOwners({0})={1}", vPosition, lOwners); + return lOwners; + } - public integer llGetPermissions() - { + public integer llGetPermissions() + { integer iPermissions = 0; - Verbose("llGetPermissions()={0}", iPermissions); - return iPermissions; - } + Verbose("llGetPermissions()={0}", iPermissions); + return iPermissions; + } - public key llGetPermissionsKey() - { + public key llGetPermissionsKey() + { key kID = key.NULL_KEY; Verbose("llGetPermissionsKey()={0}", kID); return kID; - } + } - public list llGetPhysicsMaterial() - { + public list llGetPhysicsMaterial() + { list lMaterials = new list(); Verbose("llGetPhysicalMaterial()={0}", lMaterials); return lMaterials; - } + } - public vector llGetPos() - { - Verbose("llGetPos()={0}", m_pos); - return m_pos; - } + public vector llGetPos() + { + Verbose("llGetPos()={0}", m_pos); + return m_pos; + } - public list llGetPrimMediaParams(integer iFace, list lDesiredParams) - { + public list llGetPrimMediaParams(integer iFace, list lDesiredParams) + { list lReturnedParams = new list(); Verbose("llGetPrimMediaParams({0}, {1})={2}", iFace, lDesiredParams.ToVerboseString(), lReturnedParams.ToVerboseString()); return lReturnedParams; - } + } public list llGetPrimitiveParams(list lDesiredParams) - { + { list lReturnedParams = new list(); Verbose("llGetPrimitiveParams({0})={1}", lDesiredParams.ToVerboseString(), lReturnedParams.ToVerboseString()); return lReturnedParams; - } + } - // 334 - public integer llGetRegionAgentCount() - { + // 334 + public integer llGetRegionAgentCount() + { integer iAgentCount = 0; - Verbose("llGetRegionAgentCount()={0}", iAgentCount); - return iAgentCount; - } + Verbose("llGetRegionAgentCount()={0}", iAgentCount); + return iAgentCount; + } - public vector llGetRegionCorner() - { - System.Drawing.Point pRegionCorner = Properties.Settings.Default.RegionCorner; - vector vRegionCorner = new vector(pRegionCorner.X, pRegionCorner.Y, 0); - Verbose("llGetRegionCorner()={0}", vRegionCorner); - return vRegionCorner; - } + public vector llGetRegionCorner() + { + System.Drawing.Point pRegionCorner = Properties.Settings.Default.RegionCorner; + vector vRegionCorner = new vector(pRegionCorner.X, pRegionCorner.Y, 0); + Verbose("llGetRegionCorner()={0}", vRegionCorner); + return vRegionCorner; + } - public Float llGetRegionFPS() - { + public Float llGetRegionFPS() + { Float fRegionFPS = Properties.Settings.Default.RegionFPS; Verbose("llGetRegionFPS()={0}", fRegionFPS); return fRegionFPS; - } + } - public integer llGetRegionFlags() - { + public integer llGetRegionFlags() + { integer iRegionFlags = 0; Verbose("llGetRegionFlags()={0}", iRegionFlags); return iRegionFlags; - } + } - public String llGetRegionName() - { + public String llGetRegionName() + { String sRegionName = Properties.Settings.Default.RegionName; Verbose("llGetRegionName()={0}", sRegionName); return sRegionName; - } + } - public Float llGetRegionTimeDilation() - { + public Float llGetRegionTimeDilation() + { Float fTimeDilation = 0.9F; - Verbose("llGetRegionTimeDilation()={0}", fTimeDilation); + Verbose("llGetRegionTimeDilation()={0}", fTimeDilation); return fTimeDilation; - } + } - public vector llGetRootPosition() - { + public vector llGetRootPosition() + { vector vRootPosition = vector.ZERO_VECTOR; - Verbose("llGetRootPosition()={0}", vRootPosition); + Verbose("llGetRootPosition()={0}", vRootPosition); return vRootPosition; - } + } - public rotation llGetRootRotation() - { + public rotation llGetRootRotation() + { rotation vRootRotation = rotation.ZERO_ROTATION; Verbose("llGetRootRotation()={0}", vRootRotation); return vRootRotation; - } + } - public rotation llGetRot() - { - Verbose("llGetRot()={0}", m_rot); - return m_rot; - } + public rotation llGetRot() + { + Verbose("llGetRot()={0}", m_rot); + return m_rot; + } - public integer llGetSPMaxMemory() - { + public integer llGetSPMaxMemory() + { integer iMaxSPMemory = 65536; Verbose("llGetSPMaxMemory()={0}", iMaxSPMemory); return iMaxSPMemory; - } + } - public vector llGetScale() - { - Verbose("llGetScale()=" + m_scale); - return m_scale; - } + public vector llGetScale() + { + Verbose("llGetScale()=" + m_scale); + return m_scale; + } - public String llGetScriptName() - { - string sScriptName = host.GetScriptName(); - Verbose("llGetScriptName()={0}", sScriptName); - return sScriptName; - } + public String llGetScriptName() + { + string sScriptName = host.GetScriptName(); + Verbose("llGetScriptName()={0}", sScriptName); + return sScriptName; + } public integer llGetScriptState(String sScriptName) - { + { integer iScriptState = 0; Verbose(@"llGetScriptState(""{0}"")={1}", sScriptName, iScriptState); - return iScriptState; - } + return iScriptState; + } - public float llGetSimStats(integer iStatType) - { + public float llGetSimStats(integer iStatType) + { float iSimStat = 0.0F; - Verbose("llGetSimStats({0})={1}", iStatType, iSimStat); + Verbose("llGetSimStats({0})={1}", iStatType, iSimStat); return iSimStat; - } + } - public String llGetSimulatorHostname() - { + public String llGetSimulatorHostname() + { String sSimHostName = ""; - Verbose(@"llGetSimulatorHostname()=""{0}""", sSimHostName); + Verbose(@"llGetSimulatorHostname()=""{0}""", sSimHostName); return sSimHostName; - } + } - public integer llGetStartParameter() - { - Verbose("llGetStartParameter()={0}" + m_start_parameter); - return m_start_parameter; - } + public integer llGetStartParameter() + { + Verbose("llGetStartParameter()={0}" + m_start_parameter); + return m_start_parameter; + } public list llGetStaticPath(vector vStart, vector vEnd, Float fRadius, list lParameters) { @@ -2628,210 +2629,210 @@ namespace LSLEditor return lReturn; } - public integer llGetStatus(integer iRequestedStatus) - { + public integer llGetStatus(integer iRequestedStatus) + { integer iStatus = 0; Verbose("llGetStatus({0})={1}", iRequestedStatus, iStatus); return iStatus; - } + } - public String llGetSubString(String sSource, integer iStart, integer iEnd) - { - string src = sSource; - int start = iStart; - int end = iEnd; + public String llGetSubString(String sSource, integer iStart, integer iEnd) + { + string src = sSource; + int start = iStart; + int end = iEnd; - StringBuilder sResult = new StringBuilder(); + StringBuilder sResult = new StringBuilder(); - int intLength = src.Length; + int intLength = src.Length; - if (CorrectIt(intLength, ref start, ref end)) - { - if (start <= end) - { - for (int intI = start; intI <= end; intI++) - sResult.Append(src[intI]); - } - else // excluding - { - for (int intI = 0; intI <= end; intI++) - sResult.Append(src[intI]); - for (int intI = start; intI < intLength; intI++) - sResult.Append(src[intI]); - } - } - Verbose(string.Format(@"GetSubString(""{0}"", {1}, {2})=""{3}""", sSource, iStart, iEnd, sResult)); - return sResult.ToString(); - } + if (CorrectIt(intLength, ref start, ref end)) + { + if (start <= end) + { + for (int intI = start; intI <= end; intI++) + sResult.Append(src[intI]); + } + else // excluding + { + for (int intI = 0; intI <= end; intI++) + sResult.Append(src[intI]); + for (int intI = start; intI < intLength; intI++) + sResult.Append(src[intI]); + } + } + Verbose(string.Format(@"GetSubString(""{0}"", {1}, {2})=""{3}""", sSource, iStart, iEnd, sResult)); + return sResult.ToString(); + } - public vector llGetSunDirection() - { + public vector llGetSunDirection() + { vector vSunDirection = vector.ZERO_VECTOR; Verbose("llGetSunDirection()={0}", vSunDirection); return vSunDirection; - } + } - public String llGetTexture(integer iFace) - { + public String llGetTexture(integer iFace) + { String sTexture = ""; - Verbose(@"llGetTexture({0})=""{1}""", iFace, sTexture); + Verbose(@"llGetTexture({0})=""{1}""", iFace, sTexture); return sTexture; - } + } public vector llGetTextureOffset(integer iFace) - { + { vector vOffset = vector.ZERO_VECTOR; Verbose("llGetTextureOffset({0})={1}", iFace, vOffset); - return vOffset; - } + return vOffset; + } public Float llGetTextureRot(integer iFace) - { + { Float fTextureRot = 0.0; Verbose("llGetTextureRot({0})={1}", iFace, fTextureRot); return fTextureRot; - } + } - public vector llGetTextureScale(integer iFace) - { + public vector llGetTextureScale(integer iFace) + { vector vScale = vector.ZERO_VECTOR; Verbose("llGetTextureScale({0})={1}", iFace, vScale); return vScale; - } + } - public Float llGetTime() - { - TimeSpan span = DateTime.Now.ToUniversalTime() - m_DateTimeScriptStarted; - Verbose("llGetTime()={0}", span.TotalSeconds); - return span.TotalSeconds; - } + public Float llGetTime() + { + TimeSpan span = DateTime.Now.ToUniversalTime() - m_DateTimeScriptStarted; + Verbose("llGetTime()={0}", span.TotalSeconds); + return span.TotalSeconds; + } - public Float llGetTimeOfDay() - { - // dummy + public Float llGetTimeOfDay() + { + // dummy Float fSeconds = llGetTime(); - Verbose("llGetTimeOfDay()={0}", fSeconds); + Verbose("llGetTimeOfDay()={0}", fSeconds); return fSeconds; - } + } - public string llGetTimestamp() - { - string sTimestamp = DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.ffffffZ", System.Globalization.DateTimeFormatInfo.InvariantInfo); - Verbose(@"llGetTimestamp()=""{0}""", sTimestamp); - return sTimestamp; - } + public string llGetTimestamp() + { + string sTimestamp = DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.ffffffZ", System.Globalization.DateTimeFormatInfo.InvariantInfo); + Verbose(@"llGetTimestamp()=""{0}""", sTimestamp); + return sTimestamp; + } - public vector llGetTorque() - { + public vector llGetTorque() + { vector vTorque = vector.ZERO_VECTOR; Verbose("llGetTorque()={0}", vTorque); return vTorque; - } + } - public integer llGetUnixTime() - { - DateTime dtUnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, 0); - TimeSpan tsSeconds = DateTime.Now.ToUniversalTime() - dtUnixEpoch; - Verbose("llGetUnixTime()={0}", (int)tsSeconds.TotalSeconds); - return (int)tsSeconds.TotalSeconds; - } + public integer llGetUnixTime() + { + DateTime dtUnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, 0); + TimeSpan tsSeconds = DateTime.Now.ToUniversalTime() - dtUnixEpoch; + Verbose("llGetUnixTime()={0}", (int)tsSeconds.TotalSeconds); + return (int)tsSeconds.TotalSeconds; + } - public integer llGetUsedMemory() - { + public integer llGetUsedMemory() + { integer iUsedMemory = 65536; Verbose("llGetUsedMemory()={0}", iUsedMemory); return iUsedMemory; - } + } - public string llGetUsername(key kAvatarID) - { - //TODO Find a dummy username. - string sUserName = ""; - Verbose(@"llGetUsername({0})=""{1}""", kAvatarID, sUserName); - return sUserName; - } + public string llGetUsername(key kAvatarID) + { + //TODO Find a dummy username. + string sUserName = ""; + Verbose(@"llGetUsername({0})=""{1}""", kAvatarID, sUserName); + return sUserName; + } - public vector llGetVel() - { + public vector llGetVel() + { vector vVelocity = vector.ZERO_VECTOR; Verbose("llGetVel()={0}", vVelocity); return vVelocity; - } + } - public Float llGetWallclock() - { - Float fSeconds = (int)DateTime.Now.AddHours(-9.0).TimeOfDay.TotalSeconds; - Verbose("llGetWallclock()={0}", fSeconds); - return fSeconds; - } + public Float llGetWallclock() + { + Float fSeconds = (int)DateTime.Now.AddHours(-9.0).TimeOfDay.TotalSeconds; + Verbose("llGetWallclock()={0}", fSeconds); + return fSeconds; + } - public void llGiveInventory(key kID, String sItemName) - { - Verbose(@"llGiveInventory({0}, ""{1}"")", kID, sItemName); - } + public void llGiveInventory(key kID, String sItemName) + { + Verbose(@"llGiveInventory({0}, ""{1}"")", kID, sItemName); + } - public void llGiveInventoryList(key kID, String sDirectory, list lInventory) - { - Verbose(@"llGiveInventoryList({0}, ""{1}"", {2})", kID, sDirectory, lInventory.ToVerboseString()); - } + public void llGiveInventoryList(key kID, String sDirectory, list lInventory) + { + Verbose(@"llGiveInventoryList({0}, ""{1}"", {2})", kID, sDirectory, lInventory.ToVerboseString()); + } - public integer llGiveMoney(key kAvatarID, integer iAmount) - { + public integer llGiveMoney(key kAvatarID, integer iAmount) + { Verbose("llGiveMoney({0}, {1})=0", kAvatarID, iAmount); return 0; - } + } - public Float llGround(vector vOffset) - { - Float fHeight = 25.0; - Verbose("llGround({0})={1}", vOffset, fHeight); - return fHeight; - } + public Float llGround(vector vOffset) + { + Float fHeight = 25.0; + Verbose("llGround({0})={1}", vOffset, fHeight); + return fHeight; + } public vector llGroundContour(vector vOffset) - { + { vector vContour = vector.ZERO_VECTOR; Verbose("llGroundContour({0})={1}", vOffset, vContour); return vContour; - } + } - public vector llGroundNormal(vector vOffset) - { - vector vGroundNormal = new vector(0.0, 0.0, 1.0); + public vector llGroundNormal(vector vOffset) + { + vector vGroundNormal = new vector(0.0, 0.0, 1.0); Verbose("llGroundNormal({0})={1}", vOffset, vGroundNormal); - return vGroundNormal; - } + return vGroundNormal; + } - public void llGroundRepel(Float fHeight, integer iWater, Float fTau) - { + public void llGroundRepel(Float fHeight, integer iWater, Float fTau) + { Verbose("llGroundRepel({0}, {1}, {2})", fHeight, iWater, fTau); - } + } - public vector llGroundSlope(vector vOffset) - { + public vector llGroundSlope(vector vOffset) + { vector vSlope = vector.ZERO_VECTOR; Verbose("llGroundSlope({0})={1}" + vOffset, vSlope); return vSlope; - } + } - public key llHTTPRequest(String sURL, list lParameters, String sBody) - { - key kRequestID = host.Http(sURL, lParameters, sBody); - Verbose(@"llHTTPRequest(""{0}"", {1}, ""{2}"")=""{3}""", sURL, lParameters.ToVerboseString(), sBody, kRequestID); - return kRequestID; - } + public key llHTTPRequest(String sURL, list lParameters, String sBody) + { + key kRequestID = host.Http(sURL, lParameters, sBody); + Verbose(@"llHTTPRequest(""{0}"", {1}, ""{2}"")=""{3}""", sURL, lParameters.ToVerboseString(), sBody, kRequestID); + return kRequestID; + } public void llHTTPResponse(key kRequestID, integer iStatus, String sBody) - { + { Verbose(@"llHTTPResponse({0}, {1}, ""{2}"")", kRequestID, iStatus, sBody); } - public String llInsertString(String sDestination, integer iIndex, String sSource) - { - string dst = sDestination; - string src = sSource; - int position = iIndex; - string sResult; + public String llInsertString(String sDestination, integer iIndex, String sSource) + { + string dst = sDestination; + string src = sSource; + int position = iIndex; + string sResult; if (position < dst.Length) { sResult = dst.Substring(0, position) + src + dst.Substring(position); @@ -2843,181 +2844,181 @@ namespace LSLEditor sResult = "**ERROR**"; } Verbose(@"llInsertString(""{0}"", {1}, ""{2}"")=""{3}""", sDestination, iIndex, sSource, sResult); - return sResult; - } + return sResult; + } - public void llInstantMessage(key kAvatarID, String sMessage) - { + public void llInstantMessage(key kAvatarID, String sMessage) + { Verbose(@"llInstantMessage({0}, ""{1}"")", kAvatarID, sMessage); - } + } - public String llIntegerToBase64(integer iNumber) - { - byte[] data = new byte[4]; - data[3] = (byte)(iNumber & 0xff); - data[2] = (byte)((iNumber >> 8) & 0xff); - data[1] = (byte)((iNumber >> 16) & 0xff); - data[0] = (byte)((iNumber >> 24) & 0xff); - string sResult = Convert.ToBase64String(data); - Verbose(@"llIntegerToBase64({0})=""{1}""", iNumber, sResult); - return sResult; - } + public String llIntegerToBase64(integer iNumber) + { + byte[] data = new byte[4]; + data[3] = (byte)(iNumber & 0xff); + data[2] = (byte)((iNumber >> 8) & 0xff); + data[1] = (byte)((iNumber >> 16) & 0xff); + data[0] = (byte)((iNumber >> 24) & 0xff); + string sResult = Convert.ToBase64String(data); + Verbose(@"llIntegerToBase64({0})=""{1}""", iNumber, sResult); + return sResult; + } - public list llJson2List(string sJSON) - { - //TODO implement conversion to list - list lJSON = new list(); - Verbose("llJson2List({0})={1}", sJSON, lJSON); - return lJSON; - } + public list llJson2List(string sJSON) + { + //TODO implement conversion to list + list lJSON = new list(); + Verbose("llJson2List({0})={1}", sJSON, lJSON); + return lJSON; + } - public string llJsonGetValue(string sJSON, list lSpecifiers) - { - //TODO determine return value from list - string sReturn = JSON_INVALID; - Verbose("llJsonGetValue({0}, {1})= {2}", sJSON, lSpecifiers, sReturn); - return sReturn; - } + public string llJsonGetValue(string sJSON, list lSpecifiers) + { + //TODO determine return value from list + string sReturn = JSON_INVALID; + Verbose("llJsonGetValue({0}, {1})= {2}", sJSON, lSpecifiers, sReturn); + return sReturn; + } - public string llJsonSetValue(string sJSON, list lSpecifiers, string sValue) - { - //TODO determine return value - string sReturn = JSON_INVALID; - Verbose("llJsonGetValue({0}, {1}, {2})= {3}", sJSON, lSpecifiers, sValue, sReturn); - return sReturn; - } + public string llJsonSetValue(string sJSON, list lSpecifiers, string sValue) + { + //TODO determine return value + string sReturn = JSON_INVALID; + Verbose("llJsonGetValue({0}, {1}, {2})= {3}", sJSON, lSpecifiers, sValue, sReturn); + return sReturn; + } - public string llJsonValueType(string sJSON, list lSpecifiers) - { - //TODO determine return value - string sReturn = JSON_INVALID; - Verbose("llJsonGetValue({0}, {1})= {2}", sJSON, lSpecifiers, sReturn); - return sReturn; - } + public string llJsonValueType(string sJSON, list lSpecifiers) + { + //TODO determine return value + string sReturn = JSON_INVALID; + Verbose("llJsonGetValue({0}, {1})= {2}", sJSON, lSpecifiers, sReturn); + return sReturn; + } - public String llKey2Name(key kID) - { - string sAvatarName = ""; + public String llKey2Name(key kID) + { + string sAvatarName = ""; if (Properties.Settings.Default.AvatarKey == kID) { sAvatarName = Properties.Settings.Default.AvatarName; } - Verbose(@"llKey2Name({0})=""{1}""", kID, sAvatarName); - return sAvatarName; - } + Verbose(@"llKey2Name({0})=""{1}""", kID, sAvatarName); + return sAvatarName; + } - public void llLinkParticleSystem(integer iLink, list lParameters) - { + public void llLinkParticleSystem(integer iLink, list lParameters) + { Verbose("llLinkParticleSystem({0}, {1})", iLink, lParameters.ToVerboseString()); - } + } - public void llLinkSitTarget(integer iLinkIndex, vector vOffset, rotation rRotation) - { - Verbose("llLinkSitTarget({0}, {1}, {2})", iLinkIndex, vOffset, rRotation); - } + public void llLinkSitTarget(integer iLinkIndex, vector vOffset, rotation rRotation) + { + Verbose("llLinkSitTarget({0}, {1}, {2})", iLinkIndex, vOffset, rRotation); + } - public String llList2CSV(list lSource) - { - StringBuilder sCSV = new StringBuilder(); - for (int intI = 0; intI < lSource.Count; intI++) - { - if (intI > 0) sCSV.Append(", "); - sCSV.Append(lSource[intI].ToString()); - } - Verbose(@"llList2CSV({0})=""{1}""", lSource.ToVerboseString(), sCSV.ToString()); - return sCSV.ToString(); - } + public String llList2CSV(list lSource) + { + StringBuilder sCSV = new StringBuilder(); + for (int intI = 0; intI < lSource.Count; intI++) + { + if (intI > 0) sCSV.Append(", "); + sCSV.Append(lSource[intI].ToString()); + } + Verbose(@"llList2CSV({0})=""{1}""", lSource.ToVerboseString(), sCSV.ToString()); + return sCSV.ToString(); + } - public Float llList2Float(list lSource, integer iIndex) - { - Float fResult; - if (iIndex < 0) iIndex = lSource.Count + iIndex; + public Float llList2Float(list lSource, integer iIndex) + { + Float fResult; + if (iIndex < 0) iIndex = lSource.Count + iIndex; if (iIndex >= lSource.Count || iIndex < 0) { fResult = 0.0; } else { fResult = (Float)lSource[iIndex].ToString(); } - Verbose("llList2Float({0}, {1})={2}", lSource.ToVerboseString(), iIndex, fResult); - return fResult; - } + Verbose("llList2Float({0}, {1})={2}", lSource.ToVerboseString(), iIndex, fResult); + return fResult; + } - public integer llList2Integer(list lSrc, integer iIndex) - { - integer iResult; - if (iIndex < 0) iIndex = lSrc.Count + iIndex; + public integer llList2Integer(list lSrc, integer iIndex) + { + integer iResult; + if (iIndex < 0) iIndex = lSrc.Count + iIndex; if (iIndex >= lSrc.Count || iIndex < 0) { iResult = 0; } else { iResult = (integer)lSrc[iIndex].ToString(); } - Verbose("llList2Integer({0}, {1})={2}", lSrc.ToVerboseString(), iIndex, iResult); - return iResult; - } + Verbose("llList2Integer({0}, {1})={2}", lSrc.ToVerboseString(), iIndex, iResult); + return iResult; + } - public string llList2Json(string sType, list lValues) - { - //TODO determine return value - string sReturn = JSON_INVALID; - Verbose(@"llList2Json({0}, {1})=""{2}""", sType, lValues.ToVerboseString(), sReturn); - return sReturn; - } + public string llList2Json(string sType, list lValues) + { + //TODO determine return value + string sReturn = JSON_INVALID; + Verbose(@"llList2Json({0}, {1})=""{2}""", sType, lValues.ToVerboseString(), sReturn); + return sReturn; + } - public key llList2Key(list lSource, integer iIndex) - { - key kResult; - if (iIndex < 0) iIndex = lSource.Count + iIndex; + public key llList2Key(list lSource, integer iIndex) + { + key kResult; + if (iIndex < 0) iIndex = lSource.Count + iIndex; if (iIndex >= lSource.Count || iIndex < 0) { kResult = key.NULL_KEY; } else { kResult = (key)lSource[iIndex].ToString(); } - Verbose("llList2Key({0}, {1})={2}", lSource.ToVerboseString(), iIndex, kResult); - return kResult; - } + Verbose("llList2Key({0}, {1})={2}", lSource.ToVerboseString(), iIndex, kResult); + return kResult; + } - public list llList2List(list lSource, integer iStart, integer iEnd) - { - int iLength = lSource.Count; + public list llList2List(list lSource, integer iStart, integer iEnd) + { + int iLength = lSource.Count; - int start = iStart; - int end = iEnd; + int start = iStart; + int end = iEnd; - list lResult = new list(); + list lResult = new list(); - if (CorrectIt(iLength, ref start, ref end)) - { + if (CorrectIt(iLength, ref start, ref end)) + { if (start <= end) { for (int intI = start; intI <= end; intI++) lResult.Add(lSource[intI]); } else { // excluding for (int intI = 0; intI <= end; intI++) lResult.Add(lSource[intI]); for (int intI = start; intI < iLength; intI++) lResult.Add(lSource[intI]); } - } + } - Verbose(string.Format("List2List({0}, {1}, {2})={3}", lSource.ToVerboseString(), iStart, iEnd, lResult.ToVerboseString())); - return lResult; - } + Verbose(string.Format("List2List({0}, {1}, {2})={3}", lSource.ToVerboseString(), iStart, iEnd, lResult.ToVerboseString())); + return lResult; + } - public list llList2ListStrided(list lSource, integer iStart, integer iEnd, integer iStride) - { - int iLength = lSource.Count; + public list llList2ListStrided(list lSource, integer iStart, integer iEnd, integer iStride) + { + int iLength = lSource.Count; - int start = iStart; - int end = iEnd; + int start = iStart; + int end = iEnd; - list lTemp = new list(); + list lTemp = new list(); - if (CorrectIt(iLength, ref start, ref end)) - { + if (CorrectIt(iLength, ref start, ref end)) + { if (start <= end) { for (int intI = start; intI <= end; intI++) lTemp.Add(lSource[intI]); } else // excluding - { + { for (int intI = 0; intI <= end; intI++) lTemp.Add(lSource[intI]); for (int intI = start; intI < iLength; intI++) lTemp.Add(lSource[intI]); } - } - list lResult = new list(); - string sRemark = ""; + } + list lResult = new list(); + string sRemark = ""; if (iStride <= 0) { sRemark = " ** stride must be > 0 **"; } else { @@ -3027,14 +3028,14 @@ namespace LSLEditor for (int intI = iStride - 1; intI < lTemp.Count; intI += iStride) lResult.Add(lTemp[intI]); } } - Verbose(@"llList2ListStrided({0}, {1}, {2}, {3})={4}{5}", lSource.ToVerboseString(), start, end, iStride, lResult.ToVerboseString(), sRemark); - return lResult; - } + Verbose(@"llList2ListStrided({0}, {1}, {2}, {3})={4}{5}", lSource.ToVerboseString(), start, end, iStride, lResult.ToVerboseString(), sRemark); + return lResult; + } - public rotation llList2Rot(list lSource, integer iIndex) - { - rotation rResult; - if (iIndex < 0) iIndex = lSource.Count + iIndex; + public rotation llList2Rot(list lSource, integer iIndex) + { + rotation rResult; + if (iIndex < 0) iIndex = lSource.Count + iIndex; if (iIndex >= lSource.Count || iIndex < 0) { rResult = ZERO_ROTATION; } else { @@ -3044,27 +3045,27 @@ namespace LSLEditor rResult = rotation.ZERO_ROTATION; } } - Verbose("llList2Rot({0}, {1})={2}", lSource.ToVerboseString(), iIndex, rResult); - return rResult; - } + Verbose("llList2Rot({0}, {1})={2}", lSource.ToVerboseString(), iIndex, rResult); + return rResult; + } - public String llList2String(list lSource, integer iIndex) - { - String sResult; - if (iIndex < 0) iIndex = lSource.Count + iIndex; + public String llList2String(list lSource, integer iIndex) + { + String sResult; + if (iIndex < 0) iIndex = lSource.Count + iIndex; if (iIndex >= lSource.Count || iIndex < 0) { sResult = ""; } else { sResult = (String)lSource[iIndex].ToString(); } - Verbose(@"llList2String({0}, {1})=""{2}""", lSource.ToVerboseString(), iIndex, sResult); - return sResult; - } + Verbose(@"llList2String({0}, {1})=""{2}""", lSource.ToVerboseString(), iIndex, sResult); + return sResult; + } - public vector llList2Vector(list lSource, integer iIndex) - { - vector vResult; - if (iIndex < 0) iIndex = lSource.Count + iIndex; + public vector llList2Vector(list lSource, integer iIndex) + { + vector vResult; + if (iIndex < 0) iIndex = lSource.Count + iIndex; if (iIndex >= lSource.Count || iIndex < 0) { vResult = ZERO_VECTOR; } else { @@ -3074,81 +3075,81 @@ namespace LSLEditor vResult = vector.ZERO_VECTOR; } } - Verbose("llList2Vector({0}, {1})={2}", lSource.ToVerboseString(), iIndex, vResult); - return vResult; - } + Verbose("llList2Vector({0}, {1})={2}", lSource.ToVerboseString(), iIndex, vResult); + return vResult; + } - public integer llListFindList(list lSource, list lMatch) - { - if (lSource.Count == 0) return -1; - if (lMatch.Count == 0) return 0; - if (lMatch.Count > lSource.Count) return -1; + public integer llListFindList(list lSource, list lMatch) + { + if (lSource.Count == 0) return -1; + if (lMatch.Count == 0) return 0; + if (lMatch.Count > lSource.Count) return -1; - int iReturn = -1; - for (int intI = 0; intI <= (lSource.Count - lMatch.Count); intI++) - { - if (lMatch[0].Equals(lSource[intI])) - { - bool blnOkay = true; - for (int intJ = 1; intJ < lMatch.Count; intJ++) - { - if (!lMatch[intJ].Equals(lSource[intI + intJ])) - { - blnOkay = false; - break; - } - } - if (blnOkay) - { - iReturn = intI; - break; - } - } - } - Verbose("llListFindList({0}, {1}={2}", lSource.ToVerboseString(), lMatch.ToVerboseString(), iReturn); - return iReturn; - } + int iReturn = -1; + for (int intI = 0; intI <= (lSource.Count - lMatch.Count); intI++) + { + if (lMatch[0].Equals(lSource[intI])) + { + bool blnOkay = true; + for (int intJ = 1; intJ < lMatch.Count; intJ++) + { + if (!lMatch[intJ].Equals(lSource[intI + intJ])) + { + blnOkay = false; + break; + } + } + if (blnOkay) + { + iReturn = intI; + break; + } + } + } + Verbose("llListFindList({0}, {1}={2}", lSource.ToVerboseString(), lMatch.ToVerboseString(), iReturn); + return iReturn; + } - public list llListInsertList(list lDestination, list lSource, integer iIndex) - { - int intLength = lDestination.Count; - list lResult = new list(); - if (iIndex < 0) - iIndex = lDestination.Count + iIndex; + public list llListInsertList(list lDestination, list lSource, integer iIndex) + { + int intLength = lDestination.Count; + list lResult = new list(); + if (iIndex < 0) + iIndex = lDestination.Count + iIndex; - for (int intI = 0; intI < Math.Min(iIndex, intLength); intI++) lResult.Add(lDestination[intI]); + for (int intI = 0; intI < Math.Min(iIndex, intLength); intI++) lResult.Add(lDestination[intI]); - lResult.AddRange(lSource); + lResult.AddRange(lSource); - for (int intI = Math.Max(0, iIndex); intI < intLength; intI++) lResult.Add(lDestination[intI]); + for (int intI = Math.Max(0, iIndex); intI < intLength; intI++) lResult.Add(lDestination[intI]); - Verbose("llListInsertList({0}, {1}, {2})={3}", lDestination.ToVerboseString(), lSource.ToVerboseString(), iIndex, lResult.ToVerboseString()); - return lResult; - } + Verbose("llListInsertList({0}, {1}, {2})={3}", lDestination.ToVerboseString(), lSource.ToVerboseString(), iIndex, lResult.ToVerboseString()); + return lResult; + } - public list llListRandomize(list lSource, integer iStride) - { - list lResult; - ArrayList buckets = List2Buckets(lSource, iStride); + public list llListRandomize(list lSource, integer iStride) + { + list lResult; + ArrayList buckets = List2Buckets(lSource, iStride); if (buckets == null) { lResult = new list(lSource); } else { lResult = Buckets2List(RandomShuffle(buckets), iStride); } - Verbose("llListRandomize({0}, {1})={2}", lSource.ToVerboseString(), iStride, lResult.ToVerboseString()); - return lResult; - } + Verbose("llListRandomize({0}, {1})={2}", lSource.ToVerboseString(), iStride, lResult.ToVerboseString()); + return lResult; + } - // TODO check this!!! - public list llListReplaceList(list lDestination, list lSource, integer iStart, integer iEnd) - { - int intLength = lDestination.Count; + // TODO check this!!! + public list llListReplaceList(list lDestination, list lSource, integer iStart, integer iEnd) + { + int intLength = lDestination.Count; int intStart = iStart; int intEnd = iEnd; CorrectIt(intLength, ref intStart, ref intEnd); - list lResult = new list(); + list lResult = new list(); if (intStart <= intEnd) { for (int intI = 0; intI < intStart; intI++) lResult.Add(lDestination[intI]); lResult.AddRange(lSource); @@ -3157,27 +3158,27 @@ namespace LSLEditor // where to add src????? for (int intI = intEnd; intI <= intStart; intI++) lResult.Add(lDestination[intI]); } - Verbose("llListReplaceList({0}, {1}, {2}, {3}={4}", lDestination.ToVerboseString(), lSource.ToVerboseString(), intStart, intEnd, lResult.ToVerboseString()); - return lResult; - } + Verbose("llListReplaceList({0}, {1}, {2}, {3}={4}", lDestination.ToVerboseString(), lSource.ToVerboseString(), intStart, intEnd, lResult.ToVerboseString()); + return lResult; + } - public list llListSort(list lSource, integer iStride, integer iAscending) - { + public list llListSort(list lSource, integer iStride, integer iAscending) + { int intAscending = iAscending; int intStride = iStride; - list lResult; - ArrayList buckets = List2Buckets(lSource, intStride); + list lResult; + ArrayList buckets = List2Buckets(lSource, intStride); if (buckets == null) { lResult = new list(lSource); } else { buckets.Sort(new BucketComparer(intAscending)); lResult = Buckets2List(buckets, intStride); } - Verbose("llListSort({0}, {1}, {2})={3}", lSource.ToVerboseString(), iStride, iAscending, lResult.ToVerboseString()); - return lResult; - } + Verbose("llListSort({0}, {1}, {2})={3}", lSource.ToVerboseString(), iStride, iAscending, lResult.ToVerboseString()); + return lResult; + } - /* + /* 0 LIST_STAT_RANGE Returns the range. 1 LIST_STAT_MIN Retrieves the smallest number. 2 LIST_STAT_MAX Retrieves the largest number. @@ -3188,926 +3189,926 @@ namespace LSLEditor 7 LIST_STAT_SUM_SQUARES Calculates the sum of the squares. 8 LIST_STAT_NUM_COUNT Retrieves the amount of float and integer elements. Theoretically similar to llGetListLength, except LL states that this function ignores all non-integer and non-float elements. Therefore, this is a useful tool for mixed lists of numbers and non-numbers. 9 LIST_STAT_GEOMETRIC_MEAN Calculates the geometric mean. All numbers must be greater than zero for this to work, according to LL. - */ - public Float llListStatistics(integer iOperation, list lInput) - { - double dResult = 0.0; - double rmin, rmax; - int operation = iOperation; - List input = GetListOfNumbers(lInput); - if (input.Count > 0) - { - switch (operation) - { - case LIST_STAT_RANGE: - rmin = double.MaxValue; - rmax = double.MinValue; - for (int intI = 0; intI < input.Count; intI++) { - if (input[intI] < rmin) rmin = input[intI]; - if (input[intI] > rmax) rmax = input[intI]; - } - dResult = rmax - rmin; - break; - case LIST_STAT_MIN: - dResult = double.MaxValue; + */ + public Float llListStatistics(integer iOperation, list lInput) + { + double dResult = 0.0; + double rmin, rmax; + int operation = iOperation; + List input = GetListOfNumbers(lInput); + if (input.Count > 0) + { + switch (operation) + { + case LIST_STAT_RANGE: + rmin = double.MaxValue; + rmax = double.MinValue; + for (int intI = 0; intI < input.Count; intI++) { + if (input[intI] < rmin) rmin = input[intI]; + if (input[intI] > rmax) rmax = input[intI]; + } + dResult = rmax - rmin; + break; + case LIST_STAT_MIN: + dResult = double.MaxValue; for (int intI = 0; intI < input.Count; intI++) { if (input[intI] < dResult) dResult = input[intI]; } - break; - case LIST_STAT_MAX: - dResult = double.MinValue; + break; + case LIST_STAT_MAX: + dResult = double.MinValue; for (int intI = 0; intI < input.Count; intI++) { if (input[intI] > dResult) dResult = input[intI]; } - break; - case LIST_STAT_MEAN: + break; + case LIST_STAT_MEAN: for (int intI = 0; intI < input.Count; intI++) { dResult += input[intI]; } - dResult = dResult / input.Count; - break; - case LIST_STAT_MEDIAN: - input.Sort(); + dResult = dResult / input.Count; + break; + case LIST_STAT_MEDIAN: + input.Sort(); if (Math.Ceiling(input.Count * 0.5) == input.Count * 0.5) { dResult = (input[(int)(input.Count * 0.5 - 1)] + input[(int)(input.Count * 0.5)]) / 2; } else { dResult = input[((int)(Math.Ceiling(input.Count * 0.5))) - 1]; } - break; - case LIST_STAT_STD_DEV: - dResult = GetStandardDeviation(input.ToArray()); - break; - case LIST_STAT_SUM: + break; + case LIST_STAT_STD_DEV: + dResult = GetStandardDeviation(input.ToArray()); + break; + case LIST_STAT_SUM: for (int intI = 0; intI < input.Count; intI++) { dResult += input[intI]; } - break; - case LIST_STAT_SUM_SQUARES: + break; + case LIST_STAT_SUM_SQUARES: for (int intI = 0; intI < input.Count; intI++) { dResult += input[intI] * input[intI]; } - //double av = GetAverage(input.ToArray()); - //for (int intI = 0; intI < input.Count; intI++) - // result += (av - input[intI]) * (av - input[intI]); - break; - case LIST_STAT_NUM_COUNT: - dResult = input.Count; - break; - case LIST_STAT_GEOMETRIC_MEAN: + //double av = GetAverage(input.ToArray()); + //for (int intI = 0; intI < input.Count; intI++) + // result += (av - input[intI]) * (av - input[intI]); + break; + case LIST_STAT_NUM_COUNT: + dResult = input.Count; + break; + case LIST_STAT_GEOMETRIC_MEAN: for (int intI = 0; intI < input.Count; intI++) { input[intI] = Math.Log(input[intI]); } - dResult = Math.Exp(GetAverage(input.ToArray())); - break; - default: - break; - } - } - Verbose("llListStatistics({0}, {1})={2}", iOperation, lInput.ToVerboseString(), dResult); - return dResult; - } + dResult = Math.Exp(GetAverage(input.ToArray())); + break; + default: + break; + } + } + Verbose("llListStatistics({0}, {1})={2}", iOperation, lInput.ToVerboseString(), dResult); + return dResult; + } - public integer llListen(integer iChannel, String sName, key kID, String sText) - { - int intHandle = host.llListen(iChannel, sName, kID, sText); - Verbose(@"llListen({0}, ""{1}"", {2}, {3})={4}", iChannel, sName, kID, sText, intHandle); - return intHandle; - } + public integer llListen(integer iChannel, String sName, key kID, String sText) + { + int intHandle = host.llListen(iChannel, sName, kID, sText); + Verbose(@"llListen({0}, ""{1}"", {2}, {3})={4}", iChannel, sName, kID, sText, intHandle); + return intHandle; + } - public void llListenControl(integer iHandle, integer iActive) - { - Verbose("llListenControl({0}, {1})", iHandle, iActive); - host.llListenControl(iHandle, iActive); - } + public void llListenControl(integer iHandle, integer iActive) + { + Verbose("llListenControl({0}, {1})", iHandle, iActive); + host.llListenControl(iHandle, iActive); + } - public void llListenRemove(integer iHandle) - { + public void llListenRemove(integer iHandle) + { Verbose("llListenRemove({0})", iHandle); - host.llListenRemove(iHandle); - } + host.llListenRemove(iHandle); + } - public void llLoadURL(key kAvatarID, String sText, String sURL) - { - Verbose(@"llLoadURL({0}, ""{1}"", ""{2}"")", kAvatarID, sText, sURL); - string strUrl = sURL.ToString(); + public void llLoadURL(key kAvatarID, String sText, String sURL) + { + Verbose(@"llLoadURL({0}, ""{1}"", ""{2}"")", kAvatarID, sText, sURL); + string strUrl = sURL.ToString(); if (strUrl.StartsWith("http://")) { System.Diagnostics.Process.Start(strUrl); } - } + } - public Float llLog(Float fValue) - { - double dblA = 0.0; + public Float llLog(Float fValue) + { + double dblA = 0.0; if (fValue > 0.0) { dblA = Math.Log(fValue); } - Verbose("llLog({0})={1}", fValue, dblA); - return dblA; - } + Verbose("llLog({0})={1}", fValue, dblA); + return dblA; + } - public Float llLog10(Float fValue) - { - double dblA = 0.0; + public Float llLog10(Float fValue) + { + double dblA = 0.0; if (fValue > 0.0) { dblA = Math.Log10(fValue); } - Verbose("llLog10({0})={1}", fValue, dblA); - return dblA; - } + Verbose("llLog10({0})={1}", fValue, dblA); + return dblA; + } - public void llLookAt(vector vTarget, Float fStrength, Float fDamping) - { - Verbose("llLookAt({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7})", vTarget, fStrength, fDamping); - } + public void llLookAt(vector vTarget, Float fStrength, Float fDamping) + { + Verbose("llLookAt({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7})", vTarget, fStrength, fDamping); + } - public void llLoopSound(String sSound, Float sVolume) - { + public void llLoopSound(String sSound, Float sVolume) + { try { System.Media.SoundPlayer sp = host.GetSoundPlayer(sSound); sp.PlayLooping(); } catch { } - Verbose("llLoopSound({0}, {1})", sSound, sVolume); - } + Verbose("llLoopSound({0}, {1})", sSound, sVolume); + } - public void llLoopSoundMaster(String sSound, Float fVolume) - { + public void llLoopSoundMaster(String sSound, Float fVolume) + { try { System.Media.SoundPlayer sp = host.GetSoundPlayer(sSound); sp.PlayLooping(); } catch { } Verbose("llLoopSoundMaster({0}, {1})", sSound, fVolume); - } + } - public void llLoopSoundSlave(String sSound, Float fVolume) - { + public void llLoopSoundSlave(String sSound, Float fVolume) + { try { System.Media.SoundPlayer sp = host.GetSoundPlayer(sSound); sp.PlayLooping(); } catch { } Verbose("llLoopSoundSlave({0}, {1})", sSound, fVolume); - } + } - // ok - public String llMD5String(String sSource, integer iNonce) - { - System.Security.Cryptography.MD5 md5 = new System.Security.Cryptography.MD5CryptoServiceProvider(); - byte[] hash = md5.ComputeHash(Encoding.ASCII.GetBytes(sSource + ":" + iNonce.ToString())); - StringBuilder sbResult = new StringBuilder(); - foreach (byte hex in hash) - sbResult.Append(hex.ToString("x2")); //convert to standard MD5 form - Verbose("llMD5String({0}, {1})={2}", sSource, iNonce, sbResult); - return sbResult.ToString(); - } + // ok + public String llMD5String(String sSource, integer iNonce) + { + System.Security.Cryptography.MD5 md5 = new System.Security.Cryptography.MD5CryptoServiceProvider(); + byte[] hash = md5.ComputeHash(Encoding.ASCII.GetBytes(sSource + ":" + iNonce.ToString())); + StringBuilder sbResult = new StringBuilder(); + foreach (byte hex in hash) + sbResult.Append(hex.ToString("x2")); //convert to standard MD5 form + Verbose("llMD5String({0}, {1})={2}", sSource, iNonce, sbResult); + return sbResult.ToString(); + } - public void llMakeExplosion(integer iParticles, Float fScale, Float fVelocity, Float fLifetime, Float fArc, String sTexture, vector vOffset) - { + public void llMakeExplosion(integer iParticles, Float fScale, Float fVelocity, Float fLifetime, Float fArc, String sTexture, vector vOffset) + { Verbose(@"llMakeExplosion({0}, {1}, {2}, {3}, {4}, ""{5}"", {6})", iParticles, fScale, fVelocity, fLifetime, fArc, sTexture, vOffset); - } + } - public void llMakeFire(integer iParticles, Float fScale, Float fVelocity, Float fLifetime, Float fArc, String sTexture, vector vOffset) - { + public void llMakeFire(integer iParticles, Float fScale, Float fVelocity, Float fLifetime, Float fArc, String sTexture, vector vOffset) + { Verbose(@"llMakeFire({0}, {1}, {2}, {3}, {4}, ""{5}"", {6})", iParticles, fScale, fVelocity, fLifetime, fArc, sTexture, vOffset); - } + } - public void llMakeFountain(integer iParticles, Float fScale, Float fVelocity, Float fLifetime, Float fArc, String sTexture, vector vOffset) - { + public void llMakeFountain(integer iParticles, Float fScale, Float fVelocity, Float fLifetime, Float fArc, String sTexture, vector vOffset) + { Verbose(@"llMakeFountain({0}, {1}, {2}, {3}, {4}, ""{5}"", {6})", iParticles, fScale, fVelocity, fLifetime, fArc, sTexture, vOffset); - } + } - public void llMakeSmoke(integer iParticles, Float fScale, Float fVelocity, Float fLifetime, Float fArc, String sTexture, vector vOffset) - { + public void llMakeSmoke(integer iParticles, Float fScale, Float fVelocity, Float fLifetime, Float fArc, String sTexture, vector vOffset) + { Verbose(@"llMakeSmoke({0}, {1}, {2}, {3}, {4}, ""{5}"", {6})", iParticles, fScale, fVelocity, fLifetime, fArc, sTexture, vOffset); - } + } - public void llManageEstateAccess(integer iAction, key kID) - { - Verbose("llManageEstateAccess({0}, {1}", iAction, kID); - } + public void llManageEstateAccess(integer iAction, key kID) + { + Verbose("llManageEstateAccess({0}, {1}", iAction, kID); + } - public void llMapDestination(String sLandmark, vector vPosition, vector vLookat) - { + public void llMapDestination(String sLandmark, vector vPosition, vector vLookat) + { Verbose(@"llMapDestination({0}, {1}, {2})", sLandmark, vPosition, vLookat); - } + } - public void llMessageLinked(integer iLink, integer iValue, String sText, key kID) - { + public void llMessageLinked(integer iLink, integer iValue, String sText, key kID) + { Verbose(@"llMessageLinked({0}, {1}, ""{2}"", {3})", iLink, iValue, sText, kID); - host.MessageLinked(iLink, iValue, sText, kID); - } + host.MessageLinked(iLink, iValue, sText, kID); + } - public void llMinEventDelay(Float fDelay) - { + public void llMinEventDelay(Float fDelay) + { Verbose("llMinEventDelay({0}", fDelay); - } + } - public integer llModPow(integer iValue1, integer iValue2, integer iModulus) - { - integer iResult = ModPow2(iValue1, iValue2, iModulus); - Verbose("llModPow({0}, {1}, {2})={3}", iValue1, iValue2, iModulus, iResult); - return iResult; - } + public integer llModPow(integer iValue1, integer iValue2, integer iModulus) + { + integer iResult = ModPow2(iValue1, iValue2, iModulus); + Verbose("llModPow({0}, {1}, {2})={3}", iValue1, iValue2, iModulus, iResult); + return iResult; + } - public void llModifyLand(integer iAction, integer iSize) - { + public void llModifyLand(integer iAction, integer iSize) + { Verbose("llModifyLand({0}, {1})", iAction, iSize); - } + } - public void llMoveToTarget(vector vTarget, Float fTau) - { + public void llMoveToTarget(vector vTarget, Float fTau) + { Verbose("llMoveToTarget({0}, {1})", vTarget, fTau); - } + } public void llNavigateTo(vector vLocation, list lOptions) { Verbose("llNavigateTo({0}, {1})", vLocation, lOptions); } - public void llOffsetTexture(Float fOffsetS, Float fOffsetT, integer iFace) - { + public void llOffsetTexture(Float fOffsetS, Float fOffsetT, integer iFace) + { Verbose("llOffsetTexture({0}, {1}, {2})", fOffsetS, fOffsetT, iFace); - } + } - public void llOpenRemoteDataChannel() - { - host.llOpenRemoteDataChannel(); - Verbose("llOpenRemoteDataChannel()"); - } + public void llOpenRemoteDataChannel() + { + host.llOpenRemoteDataChannel(); + Verbose("llOpenRemoteDataChannel()"); + } - public integer llOverMyLand(key kID) - { + public integer llOverMyLand(key kID) + { integer iResult = integer.TRUE; Verbose("llOverMyLand({0})={1}", kID, iResult); - return iResult; - } + return iResult; + } - public void llOwnerSay(String sText) - { - Chat(0, sText, CommunicationType.OwnerSay); - } + public void llOwnerSay(String sText) + { + Chat(0, sText, CommunicationType.OwnerSay); + } - public void llParcelMediaCommandList(list lCommands) - { + public void llParcelMediaCommandList(list lCommands) + { Verbose("llParcelMediaCommandList({0})", lCommands.ToVerboseString()); - } + } - public list llParcelMediaQuery(list lQuery) - { + public list llParcelMediaQuery(list lQuery) + { list lResult = new list(); - Verbose("llParcelMediaQuery({0})={1})", lQuery.ToVerboseString(), lResult.ToVerboseString()); + Verbose("llParcelMediaQuery({0})={1})", lQuery.ToVerboseString(), lResult.ToVerboseString()); return lResult; - } + } - // 21 sep 2007, check this - public list llParseString2List(String sSource, list lSseparators, list lSpacers) - { - list lResult = ParseString(sSource, lSseparators, lSpacers, false); - Verbose(@"llParseString2List(""{0}"", {1}, {2})={3}", sSource, lSseparators.ToVerboseString(), lSpacers.ToVerboseString(), lResult.ToVerboseString()); - return lResult; - } + // 21 sep 2007, check this + public list llParseString2List(String sSource, list lSseparators, list lSpacers) + { + list lResult = ParseString(sSource, lSseparators, lSpacers, false); + Verbose(@"llParseString2List(""{0}"", {1}, {2})={3}", sSource, lSseparators.ToVerboseString(), lSpacers.ToVerboseString(), lResult.ToVerboseString()); + return lResult; + } - // 21 sep 2007, check this, first check 3 oct 2007, last element=="" is added also - public list llParseStringKeepNulls(String sSource, list lSeparators, list lSpacers) - { - list lResult = ParseString(sSource, lSeparators, lSpacers, true); - Verbose(@"llParseStringKeepNulls(""{0}"", {1}, {2})={3}", sSource, lSeparators.ToVerboseString(), lSpacers.ToVerboseString(), lResult.ToVerboseString()); - return lResult; - } + // 21 sep 2007, check this, first check 3 oct 2007, last element=="" is added also + public list llParseStringKeepNulls(String sSource, list lSeparators, list lSpacers) + { + list lResult = ParseString(sSource, lSeparators, lSpacers, true); + Verbose(@"llParseStringKeepNulls(""{0}"", {1}, {2})={3}", sSource, lSeparators.ToVerboseString(), lSpacers.ToVerboseString(), lResult.ToVerboseString()); + return lResult; + } - public void llParticleSystem(list lParameters) - { + public void llParticleSystem(list lParameters) + { Verbose("llParticleSystem({0})", lParameters.ToVerboseString()); - } + } - public void llPassCollisions(integer iPassFlag) - { + public void llPassCollisions(integer iPassFlag) + { Verbose("llPassCollisions({0})", iPassFlag); - } + } public void llPassTouches(integer iPassFlag) - { + { Verbose("llPassTouches({0})", iPassFlag); - } + } public void llPatrolPoints(list lPoints, list lOptions) { Verbose("llPatrolPoints({0}, {1})", lPoints, lOptions); } - public void llPlaySound(String sSoundName, Float fVolume) - { - try { - System.Media.SoundPlayer sp = host.GetSoundPlayer(sSoundName); - sp.Play(); + public void llPlaySound(String sSoundName, Float fVolume) + { + try { + System.Media.SoundPlayer sp = host.GetSoundPlayer(sSoundName); + sp.Play(); Verbose("llPlaySound({0}, {1})", sSoundName, fVolume); - } catch (Exception exception) { + } catch (Exception exception) { Verbose("llPlaySound({0}, {1}) **{2}", sSoundName, fVolume, exception.Message); - } - } + } + } - public void llPlaySoundSlave(String sSoundName, Float fVolume) - { + public void llPlaySoundSlave(String sSoundName, Float fVolume) + { try { System.Media.SoundPlayer sp = host.GetSoundPlayer(sSoundName); sp.Play(); } catch { } Verbose("llPlaySoundSlave({0}, {1})", sSoundName, fVolume); - } + } - public void llPointAt(vector vTarget) - { + public void llPointAt(vector vTarget) + { Verbose("llPointAt({0})", vTarget); - } + } - public Float llPow(Float fBase, Float fExponent) - { - double dblA = Math.Pow(fBase, fExponent); + public Float llPow(Float fBase, Float fExponent) + { + double dblA = Math.Pow(fBase, fExponent); Verbose("llPow({0}, {1})={2}", fBase, fExponent, dblA); - return dblA; - } + return dblA; + } - public void llPreloadSound(String sSoundName) - { + public void llPreloadSound(String sSoundName) + { Verbose("llPreloadSound({0})", sSoundName); - } + } public void llPursue(key kTargetID, list lOptions) { Verbose("llPursue({0}, {1})", kTargetID, lOptions); } - public void llPushObject(key kID, vector vImpulse, vector vAngularImpulse, integer iLocalFlag) - { + public void llPushObject(key kID, vector vImpulse, vector vAngularImpulse, integer iLocalFlag) + { Verbose("llPushObject({0}, {1}, {2}, {3})", kID, vImpulse, vAngularImpulse, iLocalFlag); - } + } - public void llRegionSay(integer iChannel, String sText) - { + public void llRegionSay(integer iChannel, String sText) + { if (iChannel != 0) { Chat(iChannel, sText, CommunicationType.RegionSay); } Verbose(@"llRegionSay({0}, ""{1}"")", iChannel, sText); - } + } - public void llRegionSayTo(key kTargetID, integer iChannel, String sText) - { - Verbose(@"llRegionSayTo({0}, {1}, ""{2}"")", kTargetID, iChannel, sText); - } + public void llRegionSayTo(key kTargetID, integer iChannel, String sText) + { + Verbose(@"llRegionSayTo({0}, {1}, ""{2}"")", kTargetID, iChannel, sText); + } - public void llReleaseCamera(key kID) - { + public void llReleaseCamera(key kID) + { Verbose("llReleaseCamera({0})", kID); - } + } - public void llReleaseControls() - { - Verbose("llReleaseControls()"); - this.host.ReleaseControls(); - } + public void llReleaseControls() + { + Verbose("llReleaseControls()"); + this.host.ReleaseControls(); + } - public void llReleaseControls(key kAvatarID) - { + public void llReleaseControls(key kAvatarID) + { Verbose("llReleaseControls({0})", kAvatarID); - } + } - public void llReleaseURL(string sURL) - { + public void llReleaseURL(string sURL) + { Verbose(@"llReleaseURL(""{0}"")", sURL); } - public void llRemoteDataReply(key kChannel, key kMessageID, String sData, integer iData) - { - host.llRemoteDataReply(kChannel, kMessageID, sData, iData); - Verbose("llRemoteDataReply({0}, {1}, {2}, {3})", kChannel, kMessageID, sData, iData); - } + public void llRemoteDataReply(key kChannel, key kMessageID, String sData, integer iData) + { + host.llRemoteDataReply(kChannel, kMessageID, sData, iData); + Verbose("llRemoteDataReply({0}, {1}, {2}, {3})", kChannel, kMessageID, sData, iData); + } - public void llRemoteDataSetRegion() - { - Verbose("llRemoteDataSetRegion()"); - } + public void llRemoteDataSetRegion() + { + Verbose("llRemoteDataSetRegion()"); + } - public void llRemoteLoadScript(key kTargetID, String sName, integer iRunningFlag, integer iStartParameter) - { + public void llRemoteLoadScript(key kTargetID, String sName, integer iRunningFlag, integer iStartParameter) + { Verbose(@"llRemoteLoadScript({0}, ""{1}"", {2}, {3})", kTargetID, sName, iRunningFlag, iStartParameter); - } + } - public void llRemoteLoadScriptPin(key kTargetID, String sName, integer iPIN, integer iRunningFlag, integer iStartParameter) - { - Verbose(@"llRemoteLoadScriptPin({0}, ""{1}"", {2}, {3}, {4})", kTargetID, sName, iPIN, iRunningFlag, iStartParameter); - } + public void llRemoteLoadScriptPin(key kTargetID, String sName, integer iPIN, integer iRunningFlag, integer iStartParameter) + { + Verbose(@"llRemoteLoadScriptPin({0}, ""{1}"", {2}, {3}, {4})", kTargetID, sName, iPIN, iRunningFlag, iStartParameter); + } - public void llRemoveFromLandBanList(key kAvatarID) - { + public void llRemoveFromLandBanList(key kAvatarID) + { Verbose("llRemoveFromLandBanList({0})", kAvatarID); if (m_LandBanList.ContainsKey(kAvatarID)) { m_LandBanList.Remove(kAvatarID); } - } + } - public void llRemoveFromLandPassList(key kAvatarID) - { + public void llRemoveFromLandPassList(key kAvatarID) + { Verbose("llRemoveFromLandPassList({0})", kAvatarID); - if (m_LandPassList.ContainsKey(kAvatarID)) { + if (m_LandPassList.ContainsKey(kAvatarID)) { m_LandPassList.Remove(kAvatarID); } - } + } - public void llRemoveInventory(String sInventoryItem) - { - host.RemoveInventory(sInventoryItem); + public void llRemoveInventory(String sInventoryItem) + { + host.RemoveInventory(sInventoryItem); Verbose("llRemoveInventory({0})", sInventoryItem); - } + } - public void llRemoveVehicleFlags(integer iFlags) - { + public void llRemoveVehicleFlags(integer iFlags) + { Verbose("llRemoveVehicleFlags({0})", iFlags); - } + } - public key llRequestAgentData(key kID, integer iDataConstant) - { - key kResult = new key(Guid.NewGuid()); + public key llRequestAgentData(key kID, integer iDataConstant) + { + key kResult = new key(Guid.NewGuid()); - string strData = "***"; - switch ((int)iDataConstant) - { - case DATA_ONLINE: - break; - case DATA_NAME: - strData = Properties.Settings.Default.AvatarName; - break; - case DATA_BORN: - strData = DateTime.Now.ToString("yyyy-MM-dd"); - break; - case DATA_RATING: - break; - case DATA_PAYINFO: - break; - default: - break; - } - host.ExecuteSecondLife("dataserver", kResult, (SecondLife.String)strData); - return kResult; - } + string strData = "***"; + switch ((int)iDataConstant) + { + case DATA_ONLINE: + break; + case DATA_NAME: + strData = Properties.Settings.Default.AvatarName; + break; + case DATA_BORN: + strData = DateTime.Now.ToString("yyyy-MM-dd"); + break; + case DATA_RATING: + break; + case DATA_PAYINFO: + break; + default: + break; + } + host.ExecuteSecondLife("dataserver", kResult, (SecondLife.String)strData); + return kResult; + } - public key llRequestDisplayName(key kAvatarID) - { - key kID = new key(Guid.NewGuid()); - string strData = "dummyDisplay Name"; - host.ExecuteSecondLife("dataserver", kID, (SecondLife.String)strData); - Verbose("llRequestDisplayName({0})={1}", kAvatarID, kID); - return kID; - } + public key llRequestDisplayName(key kAvatarID) + { + key kID = new key(Guid.NewGuid()); + string strData = "dummyDisplay Name"; + host.ExecuteSecondLife("dataserver", kID, (SecondLife.String)strData); + Verbose("llRequestDisplayName({0})={1}", kAvatarID, kID); + return kID; + } - public key llRequestInventoryData(String sName) - { + public key llRequestInventoryData(String sName) + { key kResult = new key(Guid.NewGuid()); Verbose(@"llRequestInventoryData(""{0}"")={1}", sName, kResult); - return kResult; - } + return kResult; + } - public void llRequestPermissions(key kAvatarID, integer iPermissionFlags) - { + public void llRequestPermissions(key kAvatarID, integer iPermissionFlags) + { Verbose("llRequestPermissions({0}, {1})", kAvatarID, iPermissionFlags); - this.host.llRequestPermissions(kAvatarID, iPermissionFlags); - } + this.host.llRequestPermissions(kAvatarID, iPermissionFlags); + } - //346 - public key llRequestSecureURL() - { + //346 + public key llRequestSecureURL() + { key kResult = new key(Guid.NewGuid()); Verbose("llRequestPermissions()={0}", kResult); return kResult; - } + } - public key llRequestSimulatorData(String sSimulator, integer iData) - { + public key llRequestSimulatorData(String sSimulator, integer iData) + { key kResult = new key(Guid.NewGuid()); Verbose(@"llRequestSimulatorData(""{0}"", {1})={2}", sSimulator, iData, kResult); - return kResult; - } + return kResult; + } - //345 - public key llRequestURL() - { + //345 + public key llRequestURL() + { key kResult = new key(Guid.NewGuid()); Verbose("llRequestURL()={0}", kResult); return kResult; } - public key llRequestUsername(key kAvatarID) - { - key kID = new key(Guid.NewGuid()); - string strData = "dummyUser Name"; - Verbose("llRequestDisplayName({0})={1}", kAvatarID, kID); - host.ExecuteSecondLife("dataserver", kID, (SecondLife.String)strData); - return kID; - } + public key llRequestUsername(key kAvatarID) + { + key kID = new key(Guid.NewGuid()); + string strData = "dummyUser Name"; + Verbose("llRequestDisplayName({0})={1}", kAvatarID, kID); + host.ExecuteSecondLife("dataserver", kID, (SecondLife.String)strData); + return kID; + } - public void llResetAnimationOverride(String sAnimationState) - { - Verbose("llResetAnimationOverride({0})", sAnimationState); - } + public void llResetAnimationOverride(String sAnimationState) + { + Verbose("llResetAnimationOverride({0})", sAnimationState); + } - public void llResetLandBanList() - { - m_LandBanList = new Hashtable(); - Verbose("llResetLandBanList()"); - } + public void llResetLandBanList() + { + m_LandBanList = new Hashtable(); + Verbose("llResetLandBanList()"); + } - public void llResetLandPassList() - { - m_LandPassList = new Hashtable(); - Verbose("llResetLandPassList()"); - } + public void llResetLandPassList() + { + m_LandPassList = new Hashtable(); + Verbose("llResetLandPassList()"); + } - public void llResetOtherScript(String sScriptName) - { + public void llResetOtherScript(String sScriptName) + { Verbose("llResetOtherScript({0})", sScriptName); - } + } - public void llResetScript() - { - Verbose("llResetScript()"); - host.Reset(); - System.Threading.Thread.Sleep(1000); - System.Windows.Forms.MessageBox.Show("If you see this, something wrong in llResetScript()", "Oops..."); - } + public void llResetScript() + { + Verbose("llResetScript()"); + host.Reset(); + System.Threading.Thread.Sleep(1000); + System.Windows.Forms.MessageBox.Show("If you see this, something wrong in llResetScript()", "Oops..."); + } - public void llResetTime() - { - Verbose("llResetTime()"); - m_DateTimeScriptStarted = DateTime.Now.ToUniversalTime(); - } + public void llResetTime() + { + Verbose("llResetTime()"); + m_DateTimeScriptStarted = DateTime.Now.ToUniversalTime(); + } - public integer llReturnObjectsByID(list lObjects) - { - integer iReturned = ERR_GENERIC; - Verbose("llReturnObjectsByID({0})={1}", lObjects, iReturned); - return iReturned; - } + public integer llReturnObjectsByID(list lObjects) + { + integer iReturned = ERR_GENERIC; + Verbose("llReturnObjectsByID({0})={1}", lObjects, iReturned); + return iReturned; + } - public integer llReturnObjectsByOwner(key kID, integer iScope) - { - integer iReturned = ERR_GENERIC; - Verbose("llReturnObjectsByOwner({0}, {1})={2}", kID, iScope, iReturned); - return iReturned; - } + public integer llReturnObjectsByOwner(key kID, integer iScope) + { + integer iReturned = ERR_GENERIC; + Verbose("llReturnObjectsByOwner({0}, {1})={2}", kID, iScope, iReturned); + return iReturned; + } - public void llRezAtRoot(String sInventoryItem, vector vPosition, vector vVelocity, rotation rRotation, integer iParameter) - { + public void llRezAtRoot(String sInventoryItem, vector vPosition, vector vVelocity, rotation rRotation, integer iParameter) + { Verbose(@"llRezAtRoot(""{0}"", {1}, {2}, {3}, {4})", sInventoryItem, vPosition, vVelocity, rRotation, iParameter); - } + } - public void llRezObject(String sInventoryItem, vector vPosition, vector vVelocity, rotation rRotation, integer iParameter) - { + public void llRezObject(String sInventoryItem, vector vPosition, vector vVelocity, rotation rRotation, integer iParameter) + { Verbose(@"llRezObject(""{0}"", {1}, {2}, {3}, {4})", sInventoryItem, vPosition, vVelocity, rRotation, iParameter); - object_rez(new key(Guid.NewGuid())); - on_rez(iParameter); - } + object_rez(new key(Guid.NewGuid())); + on_rez(iParameter); + } - public Float llRot2Angle(rotation rRotation) - { + public Float llRot2Angle(rotation rRotation) + { Float fAngle = 0.0F; Verbose("llRot2Angle({0})={1}", rRotation, fAngle); return fAngle; - } + } - public vector llRot2Axis(rotation rRotation) - { + public vector llRot2Axis(rotation rRotation) + { vector vAxis = vector.ZERO_VECTOR; Verbose("llRot2Axis({0})={1})", rRotation, vAxis); return vAxis; - } + } - public vector llRot2Euler(rotation rRotation) - { - // http://rpgstats.com/wiki/index.php?title=LibraryRotationFunctions - rotation t = new rotation(rRotation.x * rRotation.x, rRotation.y * rRotation.y, rRotation.z * rRotation.z, rRotation.s * rRotation.s); - double m = (t.x + t.y + t.z + t.s); - vector vEuler = new vector(0, 0, 0); - if (m != 0) { - double n = 2 * (rRotation.y * rRotation.s + rRotation.x * rRotation.z); - double p = m * m - n * n; - if (p > 0) - vEuler = new vector(Math.Atan2(2.0 * (rRotation.x * rRotation.s - rRotation.y * rRotation.z), (-t.x - t.y + t.z + t.s)), - Math.Atan2(n, Math.Sqrt(p)), Math.Atan2(2.0 * (rRotation.z * rRotation.s - rRotation.x * rRotation.y), (t.x - t.y - t.z + t.s))); - else if (n > 0) - vEuler = new vector(0, PI_BY_TWO, Math.Atan2((rRotation.z * rRotation.s + rRotation.x * rRotation.y), 0.5 - t.x - t.z)); - else - vEuler = new vector(0, -PI_BY_TWO, Math.Atan2((rRotation.z * rRotation.s + rRotation.x * rRotation.y), 0.5 - t.x - t.z)); - } + public vector llRot2Euler(rotation rRotation) + { + // http://rpgstats.com/wiki/index.php?title=LibraryRotationFunctions + rotation t = new rotation(rRotation.x * rRotation.x, rRotation.y * rRotation.y, rRotation.z * rRotation.z, rRotation.s * rRotation.s); + double m = (t.x + t.y + t.z + t.s); + vector vEuler = new vector(0, 0, 0); + if (m != 0) { + double n = 2 * (rRotation.y * rRotation.s + rRotation.x * rRotation.z); + double p = m * m - n * n; + if (p > 0) + vEuler = new vector(Math.Atan2(2.0 * (rRotation.x * rRotation.s - rRotation.y * rRotation.z), (-t.x - t.y + t.z + t.s)), + Math.Atan2(n, Math.Sqrt(p)), Math.Atan2(2.0 * (rRotation.z * rRotation.s - rRotation.x * rRotation.y), (t.x - t.y - t.z + t.s))); + else if (n > 0) + vEuler = new vector(0, PI_BY_TWO, Math.Atan2((rRotation.z * rRotation.s + rRotation.x * rRotation.y), 0.5 - t.x - t.z)); + else + vEuler = new vector(0, -PI_BY_TWO, Math.Atan2((rRotation.z * rRotation.s + rRotation.x * rRotation.y), 0.5 - t.x - t.z)); + } Verbose("llRot2Euler({0})={1}", rRotation, vEuler); - return vEuler; - } + return vEuler; + } - public vector llRot2Fwd(rotation rRotation) - { - vector v = new vector(1.0 / (rRotation.x * rRotation.x + rRotation.y * rRotation.y + rRotation.z * rRotation.z + rRotation.s * rRotation.s), 0, 0); - vector vResult = v * rRotation; - Verbose("llRot2Fwd({0})={1}", rRotation, vResult); - return vResult; - } + public vector llRot2Fwd(rotation rRotation) + { + vector v = new vector(1.0 / (rRotation.x * rRotation.x + rRotation.y * rRotation.y + rRotation.z * rRotation.z + rRotation.s * rRotation.s), 0, 0); + vector vResult = v * rRotation; + Verbose("llRot2Fwd({0})={1}", rRotation, vResult); + return vResult; + } - public vector llRot2Left(rotation rRotation) - { - vector v = new vector(0, 1.0 / (rRotation.x * rRotation.x + rRotation.y * rRotation.y + rRotation.z * rRotation.z + rRotation.s * rRotation.s), 0); - vector vResult = v * rRotation; - Verbose("llRot2Left({0})={1}", rRotation, vResult); - return vResult; - } + public vector llRot2Left(rotation rRotation) + { + vector v = new vector(0, 1.0 / (rRotation.x * rRotation.x + rRotation.y * rRotation.y + rRotation.z * rRotation.z + rRotation.s * rRotation.s), 0); + vector vResult = v * rRotation; + Verbose("llRot2Left({0})={1}", rRotation, vResult); + return vResult; + } - public vector llRot2Up(rotation rRotation) - { - vector v = new vector(0, 0, 1.0 / (rRotation.x * rRotation.x + rRotation.y * rRotation.y + rRotation.z * rRotation.z + rRotation.s * rRotation.s)); - vector vResult = v * rRotation; - Verbose("llRot2Left({0})={1}", rRotation, vResult); - return vResult; - } + public vector llRot2Up(rotation rRotation) + { + vector v = new vector(0, 0, 1.0 / (rRotation.x * rRotation.x + rRotation.y * rRotation.y + rRotation.z * rRotation.z + rRotation.s * rRotation.s)); + vector vResult = v * rRotation; + Verbose("llRot2Left({0})={1}", rRotation, vResult); + return vResult; + } - public void llRotateTexture(Float fRadians, integer iFace) - { + public void llRotateTexture(Float fRadians, integer iFace) + { Verbose("llRotateTexture({0}, {1})", fRadians, iFace); - } + } - public rotation llRotBetween(vector vDirection1, vector vDirection2) - { + public rotation llRotBetween(vector vDirection1, vector vDirection2) + { rotation rResult = rotation.ZERO_ROTATION; Verbose("llRotBetween({0}, {1})={2}", vDirection1, vDirection2, rResult); - return rResult; - } + return rResult; + } - public void llRotLookAt(rotation rRotation, Float fStrength, Float fDamping) - { + public void llRotLookAt(rotation rRotation, Float fStrength, Float fDamping) + { Verbose("llRotLookAt({0}, {1}, {2})", rRotation, fStrength, fDamping); - } + } - public integer llRotTarget(rotation rRotation, Float fError) - { + public integer llRotTarget(rotation rRotation, Float fError) + { integer iHandle = 0; Verbose("llRotTarget({0}, {1})={2})", rRotation, fError, iHandle); return iHandle; - } + } - public void llRotTargetRemove(integer iHandle) - { + public void llRotTargetRemove(integer iHandle) + { Verbose("llRotTargetRemove({0})", iHandle); - } + } - public integer llRound(Float fValue) - { - int intA = (int)Math.Round(fValue); + public integer llRound(Float fValue) + { + int intA = (int)Math.Round(fValue); Verbose("llRound({0})={1})=", fValue, intA); - return intA; - } + return intA; + } - public integer llSameGroup(key kID) - { + public integer llSameGroup(key kID) + { integer iFlag = 0; - Verbose("llSameGroup({0})={1})", kID, iFlag); - return iFlag; - } + Verbose("llSameGroup({0})={1})", kID, iFlag); + return iFlag; + } - public void llSay(integer iChannel, String sText) - { - Chat(iChannel, sText, CommunicationType.Say); - } + public void llSay(integer iChannel, String sText) + { + Chat(iChannel, sText, CommunicationType.Say); + } - public void llScaleTexture(Float fScaleS, Float fScaleT, integer iFace) - { + public void llScaleTexture(Float fScaleS, Float fScaleT, integer iFace) + { Verbose("llScaleTexture({0}, {1}, {2})", fScaleS, fScaleT, iFace); - } + } - public integer llScriptDanger(vector vPosition) - { + public integer llScriptDanger(vector vPosition) + { integer iFlag = 0; Verbose("llScriptDanger({0})={1}", vPosition, iFlag); - return iFlag; - } + return iFlag; + } - public void llScriptProfiler(integer iState) - { - Verbose("llScriptProfiler({0})", iState); - } + public void llScriptProfiler(integer iState) + { + Verbose("llScriptProfiler({0})", iState); + } - public key llSendRemoteData(key kChannel, String sDestination, integer iData, String sData) - { - key kID = host.llSendRemoteData(kChannel, sDestination, iData, sData); - Verbose("llSendRemoteData({0}, {1}, {2}, {3})={4}", kChannel, sDestination, iData, sData, kID); - return kID; - } + public key llSendRemoteData(key kChannel, String sDestination, integer iData, String sData) + { + key kID = host.llSendRemoteData(kChannel, sDestination, iData, sData); + Verbose("llSendRemoteData({0}, {1}, {2}, {3})={4}", kChannel, sDestination, iData, sData, kID); + return kID; + } - 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(); - integer iTotalNumber = 1; - host.ExecuteSecondLife("sensor", iTotalNumber); - } + 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(); + integer iTotalNumber = 1; + host.ExecuteSecondLife("sensor", iTotalNumber); + } - public void llSensorRemove() - { - Verbose("llSensorRemove()"); - host.sensor_timer.Stop(); - } + public void llSensorRemove() + { + Verbose("llSensorRemove()"); + host.sensor_timer.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(); - if (fRate > 0) { - host.sensor_timer.Interval = (int)Math.Round(fRate * 1000); - host.sensor_timer.Start(); - } - } + 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(); + if (fRate > 0) { + host.sensor_timer.Interval = (int)Math.Round(fRate * 1000); + host.sensor_timer.Start(); + } + } - public void llSetAlpha(Float fOpacity, integer iFace) - { + public void llSetAlpha(Float fOpacity, integer iFace) + { Verbose("llSetAlpha({0}, {1})", fOpacity, iFace); - } + } - public void llSetAngularVelocity(vector vForce, integer iLocal) - { + public void llSetAngularVelocity(vector vForce, integer iLocal) + { Verbose("llSetAngularVelocity({0}, {1})", vForce, iLocal); - } + } - public void llSetAnimationOverride(String sAnimationState, String sAnimation) - { - Verbose("llSetAnimationOverride({0}, {1})", sAnimationState, sAnimation); - } + public void llSetAnimationOverride(String sAnimationState, String sAnimation) + { + Verbose("llSetAnimationOverride({0}, {1})", sAnimationState, sAnimation); + } - public void llSetBuoyancy(Float fBuoyancy) - { - Verbose("llSetBuoyancy({0})", fBuoyancy); - } + public void llSetBuoyancy(Float fBuoyancy) + { + Verbose("llSetBuoyancy({0})", fBuoyancy); + } - public void llSetCameraAtOffset(vector vOffset) - { - Verbose("llSetCameraAtOffset({0})", vOffset); - } + public void llSetCameraAtOffset(vector vOffset) + { + Verbose("llSetCameraAtOffset({0})", vOffset); + } - public void llSetCameraEyeOffset(vector vOffset) - { - Verbose("llSetCameraEyeOffset({0})", vOffset); - } + public void llSetCameraEyeOffset(vector vOffset) + { + Verbose("llSetCameraEyeOffset({0})", vOffset); + } - public void llSetCameraParams(list lRules) - { - Verbose("llSetCameraParams({0})", lRules.ToVerboseString()); - } + public void llSetCameraParams(list lRules) + { + Verbose("llSetCameraParams({0})", lRules.ToVerboseString()); + } - public void llSetClickAction(integer iAction) - { - Verbose("llSetClickAction({0})", iAction); - } + public void llSetClickAction(integer iAction) + { + Verbose("llSetClickAction({0})", iAction); + } - public void llSetColor(vector vColour, integer iFace) - { + public void llSetColor(vector vColour, integer iFace) + { Verbose("llSetColor({0}, {1})", vColour, iFace); - } + } public void llSetContentType(key kHTTPRequestID, integer iContentType) { Verbose("llSetContentType({0}, {1})", kHTTPRequestID, iContentType); } - public void llSetDamage(Float fDamage) - { - Verbose("llSetDamage({0})", fDamage); - } + public void llSetDamage(Float fDamage) + { + Verbose("llSetDamage({0})", fDamage); + } - public void llSetForce(vector vForce, integer iLocal) - { - Verbose("llSetForce({0}, {1})", vForce, iLocal); - } + public void llSetForce(vector vForce, integer iLocal) + { + Verbose("llSetForce({0}, {1})", vForce, iLocal); + } - public void llSetForceAndTorque(vector vForce, vector vTorque, integer iLocal) - { - Verbose("llSetForceAndTorque({0}, {1}, {2})", vForce, vTorque, iLocal); - } + public void llSetForceAndTorque(vector vForce, vector vTorque, integer iLocal) + { + Verbose("llSetForceAndTorque({0}, {1}, {2})", vForce, vTorque, iLocal); + } - public void llSetHoverHeight(Float fHeight, Float fWater, Float fTau) - { - Verbose("llSetHoverHeight({0}, {1}, {2})", fHeight, fWater, fTau); - } + public void llSetHoverHeight(Float fHeight, Float fWater, Float fTau) + { + Verbose("llSetHoverHeight({0}, {1}, {2})", fHeight, fWater, fTau); + } - public void llSetInventoryPermMask(String sItem, integer iMask, integer iValue) - { - Verbose(@"llSetInventoryPermMask(""{0}"", {1}, {2})", sItem, iMask, iValue); - } + public void llSetInventoryPermMask(String sItem, integer iMask, integer iValue) + { + Verbose(@"llSetInventoryPermMask(""{0}"", {1}, {2})", sItem, iMask, iValue); + } - public void llSetKeyframedMotion(list lKeyframes, list lOptions) - { - Verbose("llSetKeyframedMotion({0}, {1})", lKeyframes.ToVerboseString(), lOptions.ToVerboseString()); - } + public void llSetKeyframedMotion(list lKeyframes, list lOptions) + { + Verbose("llSetKeyframedMotion({0}, {1})", lKeyframes.ToVerboseString(), lOptions.ToVerboseString()); + } - public void llSetLinkAlpha(integer iLinkIndex, Float fAlpha, integer iFace) - { - Verbose("llSetLinkAlpha({0}, {1}, {2})", iLinkIndex, fAlpha, iFace); - } + public void llSetLinkAlpha(integer iLinkIndex, Float fAlpha, integer iFace) + { + Verbose("llSetLinkAlpha({0}, {1}, {2})", iLinkIndex, fAlpha, iFace); + } public void llSetLinkCamera(integer iLinkIndex, vector vEyeOffset, vector vLookOffset) { Verbose("llSetLinkCamera({0}, {1}, {2})", iLinkIndex, vEyeOffset, vLookOffset); } - public void llSetLinkColor(integer iLinkIndex, vector vColour, integer iFace) - { - Verbose("llSetLinkColor({0}, {1}, {2})", iLinkIndex, vColour, iFace); - } + public void llSetLinkColor(integer iLinkIndex, vector vColour, integer iFace) + { + Verbose("llSetLinkColor({0}, {1}, {2})", iLinkIndex, vColour, iFace); + } public integer llSetLinkMedia(integer iLinkIndex, integer iFace, list lParameters) - { + { integer iResult = STATUS_OK; Verbose("llSetLinkMedia({0}, {1}, {2})={3}", iLinkIndex, iFace, lParameters.ToVerboseString(), iResult); return iResult; - } + } - public void llSetLinkPrimitiveParams(integer iLinkIndex, list lRules) - { - Verbose("llSetLinkPrimitiveParams({0}, {1})", iLinkIndex, lRules.ToVerboseString()); - } + public void llSetLinkPrimitiveParams(integer iLinkIndex, list lRules) + { + Verbose("llSetLinkPrimitiveParams({0}, {1})", iLinkIndex, lRules.ToVerboseString()); + } - public void llSetLinkPrimitiveParamsFast(integer iLinkIndex, list lRules) - { - Verbose("llSetLinkPrimitiveParamsFast({0}, {1})", iLinkIndex, lRules.ToVerboseString()); - } + public void llSetLinkPrimitiveParamsFast(integer iLinkIndex, list lRules) + { + Verbose("llSetLinkPrimitiveParamsFast({0}, {1})", iLinkIndex, lRules.ToVerboseString()); + } - public void llSetLinkTexture(integer iLinkIndex, String sTexture, integer iFace) - { - Verbose(@"llSetLinkTexture({0}, ""{1}"", {2})", iLinkIndex, sTexture, iFace); - } + public void llSetLinkTexture(integer iLinkIndex, String sTexture, integer iFace) + { + Verbose(@"llSetLinkTexture({0}, ""{1}"", {2})", iLinkIndex, sTexture, iFace); + } - public void llSetLinkTextureAnim(integer iLinkIndex, integer iMode, integer iFace, integer iSizeX, integer iSizeY, Float fStart, Float fLength, Float fRate) - { - Verbose("llSetLinkTextureAnim({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7})", iLinkIndex, iMode, iFace, iSizeX, iSizeY, fStart, fLength, fRate); - } + public void llSetLinkTextureAnim(integer iLinkIndex, integer iMode, integer iFace, integer iSizeX, integer iSizeY, Float fStart, Float fLength, Float fRate) + { + Verbose("llSetLinkTextureAnim({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7})", iLinkIndex, iMode, iFace, iSizeX, iSizeY, fStart, fLength, fRate); + } - public void llSetLocalRot(rotation rRotation) - { - this.m_rotlocal = rRotation; - Verbose("llSetLocalRot({0})", rRotation); - } + public void llSetLocalRot(rotation rRotation) + { + this.m_rotlocal = rRotation; + Verbose("llSetLocalRot({0})", rRotation); + } - public integer llSetMemoryLimit(integer iLimit) - { + public integer llSetMemoryLimit(integer iLimit) + { integer iResult = true; Verbose("llSetMemoryLimit({0})=(1)", iLimit, iResult); - return iResult; - } + return iResult; + } - public void llSetObjectDesc(String sDescription) - { - Verbose(@"llSetObjectDesc(""{0}"")", sDescription); - host.SetObjectDescription(sDescription); - } + public void llSetObjectDesc(String sDescription) + { + Verbose(@"llSetObjectDesc(""{0}"")", sDescription); + host.SetObjectDescription(sDescription); + } - public void llSetObjectName(String sName) - { - Verbose(@"llSetObjectName(""{0}"")", sName); - host.SetObjectName(sName); - } + public void llSetObjectName(String sName) + { + Verbose(@"llSetObjectName(""{0}"")", sName); + host.SetObjectName(sName); + } - public void llSetObjectPermMask(integer iMaskConstant, integer iValue) - { - Verbose("llSetObjectPermMask({0}, {1})", iMaskConstant, iValue); - } + public void llSetObjectPermMask(integer iMaskConstant, integer iValue) + { + Verbose("llSetObjectPermMask({0}, {1})", iMaskConstant, iValue); + } - public void llSetParcelMusicURL(String sURL) - { - Verbose(@"llSetParcelMusicURL(""{0}"")", sURL); + public void llSetParcelMusicURL(String sURL) + { + Verbose(@"llSetParcelMusicURL(""{0}"")", sURL); m_ParcelMusicURL = sURL; - } + } - public void llSetPayPrice(integer iPrice, list lButtons) - { + public void llSetPayPrice(integer iPrice, list lButtons) + { Verbose("llSetPayPrice({0}, {1})", iPrice, lButtons.ToVerboseString()); - } + } - public void llSetPhysicsMaterial(integer iMaterialBits, Float fGravityMultiplier, Float fRestitution, Float fFriction, Float fDensity) - { - Verbose("llSetPhysicsMaterial({0}, {1}, {2}, {3}, {4})", iMaterialBits, fGravityMultiplier, fRestitution, fFriction, fDensity); - } + public void llSetPhysicsMaterial(integer iMaterialBits, Float fGravityMultiplier, Float fRestitution, Float fFriction, Float fDensity) + { + Verbose("llSetPhysicsMaterial({0}, {1}, {2}, {3}, {4})", iMaterialBits, fGravityMultiplier, fRestitution, fFriction, fDensity); + } - public void llSetPos(vector vPosition) - { - Verbose("llSetPos({0})", vPosition); - m_pos = vPosition; - } + public void llSetPos(vector vPosition) + { + Verbose("llSetPos({0})", vPosition); + m_pos = vPosition; + } - public integer llSetPrimMediaParams(integer iFace, list lParameters) - { + public integer llSetPrimMediaParams(integer iFace, list lParameters) + { integer iResult = 0; Verbose("llSetPrimMediaParams({0}, {1})={2}", iFace, lParameters.ToVerboseString(), iResult); - return iResult; - } + return iResult; + } - public void llSetPrimitiveParams(list lRule) - { + public void llSetPrimitiveParams(list lRule) + { Verbose("llSetPrimitiveParams({0})", lRule.ToVerboseString()); - } + } public integer llSetRegionPos(vector vPosition) { @@ -4117,207 +4118,207 @@ namespace LSLEditor return iResult; } - public void llSetRemoteScriptAccessPin(integer iPIN) - { - Verbose("llSetRemoteScriptAccessPin({0})", iPIN); - } + public void llSetRemoteScriptAccessPin(integer iPIN) + { + Verbose("llSetRemoteScriptAccessPin({0})", iPIN); + } - public void llSetRot(rotation rRotation) - { - Verbose("llSetRot({0})", rRotation); - m_rot = rRotation; - } + public void llSetRot(rotation rRotation) + { + Verbose("llSetRot({0})", rRotation); + m_rot = rRotation; + } - public void llSetScale(vector vScale) - { - Verbose("llSetScale({0})", vScale); - m_scale = vScale; - } + public void llSetScale(vector vScale) + { + Verbose("llSetScale({0})", vScale); + m_scale = vScale; + } - public void llSetScriptState(String sName, integer iRunState) - { - Verbose(@"llSetScriptState(""{0}"", {1})", sName, iRunState); - } + public void llSetScriptState(String sName, integer iRunState) + { + Verbose(@"llSetScriptState(""{0}"", {1})", sName, iRunState); + } - public void llSetSitText(String sText) - { - Verbose(@"llSetSitText(""{0}"")", sText); - m_SitText = sText; - } + public void llSetSitText(String sText) + { + Verbose(@"llSetSitText(""{0}"")", sText); + m_SitText = sText; + } - public void llSetSoundQueueing(integer iQueueFlag) - { - Verbose("llSetSoundQueueing({0})", iQueueFlag); - } + public void llSetSoundQueueing(integer iQueueFlag) + { + Verbose("llSetSoundQueueing({0})", iQueueFlag); + } - public void llSetSoundRadius(Float fRadius) - { - m_SoundRadius = fRadius; + public void llSetSoundRadius(Float fRadius) + { + m_SoundRadius = fRadius; Verbose("llSetSoundRadius({0})", fRadius); - } + } - public void llSetStatus(integer iStatusConstant, integer iValue) - { - Verbose("llSetStatus({0}, {1})", iStatusConstant, iValue); - } + public void llSetStatus(integer iStatusConstant, integer iValue) + { + Verbose("llSetStatus({0}, {1})", iStatusConstant, iValue); + } - public void llSetText(String sText, vector vColour, Float fOpacity) - { - Verbose(@"llSetText(""{0}"", {1}, {2})", sText, vColour, fOpacity); - } + public void llSetText(String sText, vector vColour, Float fOpacity) + { + Verbose(@"llSetText(""{0}"", {1}, {2})", sText, vColour, fOpacity); + } - public void llSetTexture(String sTextureName, integer iFace) - { - Verbose(@"llSetTexture(""{0}"", {1})", sTextureName, iFace); - } + public void llSetTexture(String sTextureName, integer iFace) + { + Verbose(@"llSetTexture(""{0}"", {1})", sTextureName, iFace); + } - public void llSetTextureAnim(integer iMode, integer iFace, integer iSizeX, integer iSizeY, Float fStart, Float fLength, Float fRate) - { - Verbose("llSetTextureAnim({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7})", iMode, iFace, iSizeX, iSizeY, fStart, fLength, fRate); - } + public void llSetTextureAnim(integer iMode, integer iFace, integer iSizeX, integer iSizeY, Float fStart, Float fLength, Float fRate) + { + Verbose("llSetTextureAnim({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7})", iMode, iFace, iSizeX, iSizeY, fStart, fLength, fRate); + } - public void llSetTimerEvent(Float fSeconds) - { - Verbose("llSetTimerEvent({0})", fSeconds); - host.timer.Stop(); - if (fSeconds > 0) - { - host.timer.Interval = (int)Math.Round(fSeconds * 1000); - host.timer.Start(); - } - } + public void llSetTimerEvent(Float fSeconds) + { + Verbose("llSetTimerEvent({0})", fSeconds); + host.timer.Stop(); + if (fSeconds > 0) + { + host.timer.Interval = (int)Math.Round(fSeconds * 1000); + host.timer.Start(); + } + } - public void llSetTorque(vector vTorque, integer iLocal) - { - Verbose("llSetTorque({0}, {1})", vTorque, iLocal); - } + public void llSetTorque(vector vTorque, integer iLocal) + { + Verbose("llSetTorque({0}, {1})", vTorque, iLocal); + } - public void llSetTouchText(String sText) - { - Verbose(@"llSetTouchText(""{0}"")", sText); - } + public void llSetTouchText(String sText) + { + Verbose(@"llSetTouchText(""{0}"")", sText); + } - public void llSetVehicleFlags(integer iVehicleFlagConstants) - { - Verbose("llSetVehicleFlags({0})", iVehicleFlagConstants); - } + public void llSetVehicleFlags(integer iVehicleFlagConstants) + { + Verbose("llSetVehicleFlags({0})", iVehicleFlagConstants); + } - public void llSetVehicleFloatParam(integer iParameterName, Float fParameterValue) - { + public void llSetVehicleFloatParam(integer iParameterName, Float fParameterValue) + { Verbose("llSetVehicledoubleParam({0}, {1})", iParameterName, fParameterValue); - } + } - public void llSetVehicleRotationParam(integer iParameterName, rotation fParameterValue) - { + public void llSetVehicleRotationParam(integer iParameterName, rotation fParameterValue) + { Verbose("llSetVehicleRotationParam({0}, {1})", iParameterName, fParameterValue); - } + } - public void llSetVehicleType(integer iTypeConstant) - { - Verbose("llSetVehicleType({0})", iTypeConstant); - } + public void llSetVehicleType(integer iTypeConstant) + { + Verbose("llSetVehicleType({0})", iTypeConstant); + } public void llSetVehicleVectorParam(integer iParameterName, vector vParameterValue) - { + { Verbose("llSetVehicleVectorParam({0}, {1})", iParameterName, vParameterValue); - } + } - public void llSetVelocity(vector vForce, integer iLocal) - { - Verbose("llSetVelocity({0}, {1})", vForce, iLocal); - } + public void llSetVelocity(vector vForce, integer iLocal) + { + Verbose("llSetVelocity({0}, {1})", vForce, iLocal); + } - public String llSHA1String(String sSource) - { - byte[] buffer = System.Text.Encoding.UTF8.GetBytes(sSource.ToString()); - System.Security.Cryptography.SHA1CryptoServiceProvider cryptoTransformSHA1 = new System.Security.Cryptography.SHA1CryptoServiceProvider(); - string sHash = BitConverter.ToString(cryptoTransformSHA1.ComputeHash(buffer)).Replace("-", ""); - Verbose(@"llSHA1String(""{0"")=""{1}""", sSource, sHash); - return sHash; - } + public String llSHA1String(String sSource) + { + byte[] buffer = System.Text.Encoding.UTF8.GetBytes(sSource.ToString()); + System.Security.Cryptography.SHA1CryptoServiceProvider cryptoTransformSHA1 = new System.Security.Cryptography.SHA1CryptoServiceProvider(); + string sHash = BitConverter.ToString(cryptoTransformSHA1.ComputeHash(buffer)).Replace("-", ""); + Verbose(@"llSHA1String(""{0"")=""{1}""", sSource, sHash); + return sHash; + } - public void llShout(integer iChannel, String sText) - { - Chat(iChannel, sText, CommunicationType.Shout); - } + public void llShout(integer iChannel, String sText) + { + Chat(iChannel, sText, CommunicationType.Shout); + } - public Float llSin(Float fTheta) - { - double dblA = Math.Sin(fTheta); + public Float llSin(Float fTheta) + { + double dblA = Math.Sin(fTheta); Verbose("llSin({0})={1}", fTheta, dblA); - return dblA; - } + return dblA; + } - public void llSitTarget(vector vOffset, rotation rRotation) - { - Verbose("llSitTarget({0}, {1})", vOffset, rRotation); - } + public void llSitTarget(vector vOffset, rotation rRotation) + { + Verbose("llSitTarget({0}, {1})", vOffset, rRotation); + } - public void llSleep(Float fSeconds) - { - Verbose("llSleep({0})", fSeconds); - System.Threading.Thread.Sleep((int)Math.Round(fSeconds * 1000)); - } + public void llSleep(Float fSeconds) + { + Verbose("llSleep({0})", fSeconds); + System.Threading.Thread.Sleep((int)Math.Round(fSeconds * 1000)); + } - public Float llSqrt(Float fValue) - { - double dblA = Math.Sqrt(fValue); + public Float llSqrt(Float fValue) + { + double dblA = Math.Sqrt(fValue); Verbose("llSqrt({0})={1}", fValue, dblA); - return dblA; - } + return dblA; + } - public void llStartAnimation(String sAnimationName) - { - Verbose(@"llStartAnimation(""{0}"")", sAnimationName); - } + public void llStartAnimation(String sAnimationName) + { + Verbose(@"llStartAnimation(""{0}"")", sAnimationName); + } public void llStopAnimation(String sAnimationName) - { + { Verbose(@"llStopAnimation(""{0}"")", sAnimationName); - } + } - public void llStopHover() - { - Verbose("llStopHover()"); - } + public void llStopHover() + { + Verbose("llStopHover()"); + } - public void llStopLookAt() - { - Verbose("llStopLookAt()"); - } + public void llStopLookAt() + { + Verbose("llStopLookAt()"); + } - public void llStopMoveToTarget() - { - Verbose("llStopMoveToTarget()"); - } + public void llStopMoveToTarget() + { + Verbose("llStopMoveToTarget()"); + } - public void llStopPointAt() - { - Verbose("llStopPointAt()"); - } + public void llStopPointAt() + { + Verbose("llStopPointAt()"); + } - public void llStopSound() - { - Verbose("llStopSound()"); - } + public void llStopSound() + { + Verbose("llStopSound()"); + } - public integer llStringLength(String sSource) - { - int intLength = ((string)sSource).Length; - Verbose(@"llStringLength(""{0}"")={1}", sSource, intLength); - return intLength; - } + public integer llStringLength(String sSource) + { + int intLength = ((string)sSource).Length; + Verbose(@"llStringLength(""{0}"")={1}", sSource, intLength); + return intLength; + } - public String llStringToBase64(String sText) - { - string sResult = StringToBase64(sText.ToString()); - Verbose(@"llStringToBase64(""{0}"")=""{1}""", sText, sResult); - return sResult; - } + public String llStringToBase64(String sText) + { + string sResult = StringToBase64(sText.ToString()); + Verbose(@"llStringToBase64(""{0}"")=""{1}""", sText, sResult); + return sResult; + } - public String llStringTrim(String sText, integer iTrimType) - { - string strResult = sText.ToString(); + public String llStringTrim(String sText, integer iTrimType) + { + string strResult = sText.ToString(); if ((iTrimType & STRING_TRIM_HEAD) != 0) { strResult = strResult.TrimStart(); @@ -4327,196 +4328,196 @@ namespace LSLEditor strResult = strResult.TrimEnd(); } - Verbose(@"llStringTrim(""{0}"", {1})=""{2}""", sText, iTrimType, strResult); - return strResult; - } + Verbose(@"llStringTrim(""{0}"", {1})=""{2}""", sText, iTrimType, strResult); + return strResult; + } - public integer llSubStringIndex(String sSource, String sPattern) - { - int intIndex = ((string)sSource).IndexOf((string)sPattern); - Verbose("llSubStringIndex({0}, {1})={2}", sSource, sPattern, intIndex); - return intIndex; - } + public integer llSubStringIndex(String sSource, String sPattern) + { + int intIndex = ((string)sSource).IndexOf((string)sPattern); + Verbose("llSubStringIndex({0}, {1})={2}", sSource, sPattern, intIndex); + return intIndex; + } - public void llTakeCamera(key kAvatarID) - { - Verbose("llTakeCamera({0})", kAvatarID); - } + public void llTakeCamera(key kAvatarID) + { + Verbose("llTakeCamera({0})", kAvatarID); + } - public void llTakeControls(integer iControls, integer iAcceptFlag, integer iPassOnFlag) - { - Verbose("llTakeControls({0}, {1}), {2})", iControls, iAcceptFlag, iPassOnFlag); - this.host.TakeControls(iControls, iAcceptFlag, iPassOnFlag); - } + public void llTakeControls(integer iControls, integer iAcceptFlag, integer iPassOnFlag) + { + Verbose("llTakeControls({0}, {1}), {2})", iControls, iAcceptFlag, iPassOnFlag); + this.host.TakeControls(iControls, iAcceptFlag, iPassOnFlag); + } - public Float llTan(Float fTheta) - { - double dblA = Math.Tan(fTheta); + public Float llTan(Float fTheta) + { + double dblA = Math.Tan(fTheta); Verbose("llTan({0})={1}", fTheta, dblA); - return dblA; - } + return dblA; + } - public integer llTarget(vector vPosition, Float fRange) - { + public integer llTarget(vector vPosition, Float fRange) + { integer iResult = 0; Verbose("llTarget({0}, {1})={2}", vPosition, fRange, iResult); return iResult; - } + } - public void llTargetOmega(vector vAxis, Float fSpinRate, Float fGain) - { - Verbose("llTargetOmega({0}, {1}, {2})", vAxis, fSpinRate, fGain); - } + public void llTargetOmega(vector vAxis, Float fSpinRate, Float fGain) + { + Verbose("llTargetOmega({0}, {1}, {2})", vAxis, fSpinRate, fGain); + } - public void llTargetRemove(integer iTargetHandle) - { - Verbose("llTargetRemove({0})", iTargetHandle); - } + public void llTargetRemove(integer iTargetHandle) + { + Verbose("llTargetRemove({0})", iTargetHandle); + } - public void llTeleportAgent(key kAvatarID, String sLandmarkName, vector vLandingPoint, vector vLookAtPoint) - { - Verbose(@"llTeleportAgentHome({0}, ""{1}"", {2}, {3})", kAvatarID, sLandmarkName, vLandingPoint, vLookAtPoint); - } + public void llTeleportAgent(key kAvatarID, String sLandmarkName, vector vLandingPoint, vector vLookAtPoint) + { + Verbose(@"llTeleportAgentHome({0}, ""{1}"", {2}, {3})", kAvatarID, sLandmarkName, vLandingPoint, vLookAtPoint); + } - public void llTeleportAgentGlobalCoords(key kAvatarID, vector vGlobalPosition, vector vRegionPosition, vector iLookAtPoint) - { - Verbose("llTeleportAgentHome({0}, {1}, {2}, {3})", kAvatarID, vGlobalPosition, vRegionPosition, iLookAtPoint); - } + public void llTeleportAgentGlobalCoords(key kAvatarID, vector vGlobalPosition, vector vRegionPosition, vector iLookAtPoint) + { + Verbose("llTeleportAgentHome({0}, {1}, {2}, {3})", kAvatarID, vGlobalPosition, vRegionPosition, iLookAtPoint); + } - public void llTeleportAgentHome(key kAvatarID) - { - Verbose("llTeleportAgentHome({0})", kAvatarID); - } + public void llTeleportAgentHome(key kAvatarID) + { + Verbose("llTeleportAgentHome({0})", kAvatarID); + } - public void llTextBox(key kAvatar, String sText, integer iChannel) - { - Verbose(@"llTextBox({0}, ""{1}"", {2})", kAvatar, sText, iChannel); - host.llTextBox(kAvatar, sText, iChannel); - } + public void llTextBox(key kAvatar, String sText, integer iChannel) + { + Verbose(@"llTextBox({0}, ""{1}"", {2})", kAvatar, sText, iChannel); + host.llTextBox(kAvatar, sText, iChannel); + } - public String llToLower(String sText) - { - string strTemp = ((string)sText).ToLower(); + public String llToLower(String sText) + { + string strTemp = ((string)sText).ToLower(); Verbose(@"llToLower(""{0}"")=""{1}""", sText, strTemp); - return strTemp; - } + return strTemp; + } - public String llToUpper(String sText) - { - string strTemp = ((string)sText).ToUpper(); - Verbose(@"llToUpper(""{0}"")=""{1}""", sText, strTemp); - return strTemp; - } + public String llToUpper(String sText) + { + string strTemp = ((string)sText).ToUpper(); + Verbose(@"llToUpper(""{0}"")=""{1}""", sText, strTemp); + return strTemp; + } - public key llTransferLindenDollars(key kPayee, integer iAmount) - { - key kID = new key(Guid.NewGuid()); - string strData = kPayee.ToString() + "," + iAmount.ToString(); - Verbose("llTransferLindenDollars({0}, {1})", kPayee, iAmount); - host.ExecuteSecondLife("transaction_result", kID, true, (SecondLife.String)strData); - return kID; - } + public key llTransferLindenDollars(key kPayee, integer iAmount) + { + key kID = new key(Guid.NewGuid()); + string strData = kPayee.ToString() + "," + iAmount.ToString(); + Verbose("llTransferLindenDollars({0}, {1})", kPayee, iAmount); + host.ExecuteSecondLife("transaction_result", kID, true, (SecondLife.String)strData); + return kID; + } - public void llTriggerSound(String sSoundName, Float fVolume) - { - Verbose(@"llTriggerSound(""{0}"", {1})", sSoundName, fVolume); - } + public void llTriggerSound(String sSoundName, Float fVolume) + { + Verbose(@"llTriggerSound(""{0}"", {1})", sSoundName, fVolume); + } - public void llTriggerSoundLimited(String sSoundName, Float fVolume, vector vBoxNE, vector vBoxSW) - { - Verbose("llTriggerSoundLimited({0}, {1}, {2}, {3})", sSoundName, fVolume, vBoxNE, vBoxSW); - } + public void llTriggerSoundLimited(String sSoundName, Float fVolume, vector vBoxNE, vector vBoxSW) + { + Verbose("llTriggerSoundLimited({0}, {1}, {2}, {3})", sSoundName, fVolume, vBoxNE, vBoxSW); + } - public String llUnescapeURL(String sURL) - { - byte[] data = Encoding.UTF8.GetBytes(sURL.ToString()); - List list = new List(); - for (int intI = 0; intI < data.Length; intI++) - { - byte chrC = data[intI]; - if (chrC == (byte)'%') - { - if (intI < (data.Length - 2)) - list.Add((byte) - (HexToInt(data[intI + 1]) << 4 - | HexToInt(data[intI + 2]))); - intI += 2; - } - else - { - list.Add(chrC); - } - } - data = list.ToArray(); - int intLen = Array.IndexOf(data, (byte)0x0); - if (intLen < 0) - intLen = data.Length; - string strTmp = Encoding.UTF8.GetString(data, 0, intLen); - Verbose(string.Format(@"llUnescapeURL(""{0}"")=""{1}""", sURL, strTmp)); - return strTmp; - } + public String llUnescapeURL(String sURL) + { + byte[] data = Encoding.UTF8.GetBytes(sURL.ToString()); + List list = new List(); + for (int intI = 0; intI < data.Length; intI++) + { + byte chrC = data[intI]; + if (chrC == (byte)'%') + { + if (intI < (data.Length - 2)) + list.Add((byte) + (HexToInt(data[intI + 1]) << 4 + | HexToInt(data[intI + 2]))); + intI += 2; + } + else + { + list.Add(chrC); + } + } + data = list.ToArray(); + int intLen = Array.IndexOf(data, (byte)0x0); + if (intLen < 0) + intLen = data.Length; + string strTmp = Encoding.UTF8.GetString(data, 0, intLen); + Verbose(string.Format(@"llUnescapeURL(""{0}"")=""{1}""", sURL, strTmp)); + return strTmp; + } - public void llUnSit(key kAvatarID) - { - Verbose("llUnSit({0})", kAvatarID); - } + public void llUnSit(key kAvatarID) + { + Verbose("llUnSit({0})", kAvatarID); + } public void llUpdateCharacter(list lOptions) { Verbose("llUpdateCharacter({0})", lOptions.ToVerboseString()); } - public Float llVecDist(vector vPostionA, vector vPositionB) - { - vector vecValue = new vector(vPostionA.x - vPositionB.x, vPostionA.y - vPositionB.y, vPostionA.z - vPositionB.z); - double dblMag = llVecMag(vecValue); + public Float llVecDist(vector vPostionA, vector vPositionB) + { + vector vecValue = new vector(vPostionA.x - vPositionB.x, vPostionA.y - vPositionB.y, vPostionA.z - vPositionB.z); + double dblMag = llVecMag(vecValue); Verbose("llVecDist({0}, {1})={2}", vPostionA, vPositionB, dblMag); - return dblMag; - } + return dblMag; + } - public Float llVecMag(vector vVector) - { - double dblValue = Math.Sqrt(vVector.x * vVector.x + vVector.y * vVector.y + vVector.z * vVector.z); - Verbose("llVecMag({0})={1}", vVector, dblValue); - return dblValue; - } + public Float llVecMag(vector vVector) + { + double dblValue = Math.Sqrt(vVector.x * vVector.x + vVector.y * vVector.y + vVector.z * vVector.z); + Verbose("llVecMag({0})={1}", vVector, dblValue); + return dblValue; + } - public vector llVecNorm(vector vVector) - { - double dblMag = llVecMag(vVector); - vector vecValue = new vector(vVector.x / dblMag, vVector.y / dblMag, vVector.z / dblMag); + public vector llVecNorm(vector vVector) + { + double dblMag = llVecMag(vVector); + vector vecValue = new vector(vVector.x / dblMag, vVector.y / dblMag, vVector.z / dblMag); Verbose("llVecNorm({0})={1}", vVector, vecValue); - return vecValue; - } + return vecValue; + } - public void llVolumeDetect(integer iDetectFlag) - { - Verbose("llVolumeDetect({0})", iDetectFlag); - } + public void llVolumeDetect(integer iDetectFlag) + { + Verbose("llVolumeDetect({0})", iDetectFlag); + } public void llWanderWithin(vector vOrigin, vector vDistance, list lOptions) { Verbose("llWanderWithin({0}, {1}, {2})", vOrigin, vDistance, lOptions.ToVerboseString()); } - public Float llWater(vector vOffset) - { + public Float llWater(vector vOffset) + { Float fWaterLevel = 0.0F; Verbose("llWater({0})={1}", vOffset, fWaterLevel); return fWaterLevel; - } + } - public void llWhisper(integer iChannel, String sText) - { - Chat(iChannel, sText, CommunicationType.Whisper); - } + public void llWhisper(integer iChannel, String sText) + { + Chat(iChannel, sText, CommunicationType.Whisper); + } - public vector llWind(vector vOffset) - { + public vector llWind(vector vOffset) + { vector vDirection = vector.ZERO_VECTOR; Verbose("llWind({0})={1}", vOffset, vDirection); return vDirection; - } + } public String llXorBase64(String sText1, String sText2) { @@ -4532,23 +4533,23 @@ namespace LSLEditor return sResult; } - public String llXorBase64StringsCorrect(String sText1, String sText2) - { + public String llXorBase64StringsCorrect(String sText1, String sText2) + { string S1 = Base64ToString(sText1.ToString()); - string S2 = Base64ToString(sText2.ToString()); - int intLength = S1.Length; - if (S2.Length == 0) - S2 = " "; - while (S2.Length < intLength) - S2 += S2; - S2 = S2.Substring(0, intLength); - StringBuilder sb = new StringBuilder(); - for (int intI = 0; intI < intLength; intI++) - sb.Append((char)(S1[intI] ^ S2[intI])); - string sResult = StringToBase64(sb.ToString()); - Verbose(@"llXorBase64StringsCorrect(""{0}"",""{1}"")=""{2}""", sText1, sText2, sResult); - return sResult; - } - #endregion - } + string S2 = Base64ToString(sText2.ToString()); + int intLength = S1.Length; + if (S2.Length == 0) + S2 = " "; + while (S2.Length < intLength) + S2 += S2; + S2 = S2.Substring(0, intLength); + StringBuilder sb = new StringBuilder(); + for (int intI = 0; intI < intLength; intI++) + sb.Append((char)(S1[intI] ^ S2[intI])); + string sResult = StringToBase64(sb.ToString()); + Verbose(@"llXorBase64StringsCorrect(""{0}"",""{1}"")=""{2}""", sText1, sText2, sResult); + return sResult; + } + #endregion + } } diff --git a/trunk/SecondLife/String.cs b/trunk/SecondLife/String.cs index 7a12bf5..9948159 100644 --- a/trunk/SecondLife/String.cs +++ b/trunk/SecondLife/String.cs @@ -80,7 +80,7 @@ namespace LSLEditor public static explicit operator String(float i) { - return new String(string.Format("{0:0.000000}",i)); + return new String(string.Format("{0:0.000000}", i)); } public static implicit operator string(String s) @@ -100,19 +100,16 @@ namespace LSLEditor public static bool operator !=(String x, String y) { - return !(x==y); + return !(x == y); } // Public overrides 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; } diff --git a/trunk/SecondLife/integer.cs b/trunk/SecondLife/integer.cs index d93ee3a..7c6a65e 100644 --- a/trunk/SecondLife/integer.cs +++ b/trunk/SecondLife/integer.cs @@ -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; } } diff --git a/trunk/SecondLife/key.cs b/trunk/SecondLife/key.cs index 104ea5a..357f403 100644 --- a/trunk/SecondLife/key.cs +++ b/trunk/SecondLife/key.cs @@ -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; } } diff --git a/trunk/SecondLife/list.cs b/trunk/SecondLife/list.cs index f201d26..6517108 100644 --- a/trunk/SecondLife/list.cs +++ b/trunk/SecondLife/list.cs @@ -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++) - { - bool blnFound = false; - for (int intJ = 0; intJ < m.Count; intJ++) - { - if (l[intI].Equals(m[intJ])) - { - blnFound = true; - break; + int intDifferent = 0; + 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])) { + 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,19 +285,19 @@ 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) - sb.Append("\""+this.value[intI].ToString()+"\""); - else + 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 { sb.Append(this.value[intI].ToString()); + } } sb.Append(']'); return sb.ToString(); @@ -315,33 +305,25 @@ namespace LSLEditor 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(); } } diff --git a/trunk/SecondLife/rotation.cs b/trunk/SecondLife/rotation.cs index b024590..d64a577 100644 --- a/trunk/SecondLife/rotation.cs +++ b/trunk/SecondLife/rotation.cs @@ -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,10 +153,11 @@ 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 @@ -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; } } diff --git a/trunk/SecondLife/vector.cs b/trunk/SecondLife/vector.cs index ecf6b30..c7264af 100644 --- a/trunk/SecondLife/vector.cs +++ b/trunk/SecondLife/vector.cs @@ -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,10 +263,11 @@ 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; } } diff --git a/trunk/SimulatorConsole.cs b/trunk/SimulatorConsole.cs index 1eebf8b..08e0b66 100644 --- a/trunk/SimulatorConsole.cs +++ b/trunk/SimulatorConsole.cs @@ -148,7 +148,7 @@ namespace LSLEditor List 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) diff --git a/trunk/Solution/SolutionExplorer.cs b/trunk/Solution/SolutionExplorer.cs index 9a1125c..eea352f 100644 --- a/trunk/Solution/SolutionExplorer.cs +++ b/trunk/Solution/SolutionExplorer.cs @@ -1992,28 +1992,28 @@ namespace LSLEditor.Solution return typeSL; } - private delegate void DelegateRemoveInventory(Guid guid, SecondLife.String name); - public void RemoveInventory(Guid guid, SecondLife.String name) - { - if (this.treeView1.InvokeRequired) - { - this.treeView1.Invoke(new DelegateRemoveInventory(RemoveInventory), new object[] { guid, name }); - return; - } + private delegate void DelegateRemoveInventory(Guid guid, SecondLife.String name); + public void RemoveInventory(Guid guid, SecondLife.String name) + { + if (this.treeView1.InvokeRequired) + { + this.treeView1.Invoke(new DelegateRemoveInventory(RemoveInventory), new object[] { guid, name }); + return; + } - TreeNode treeNode = FindGuid(this.treeView1.TopNode, guid); - if (treeNode == null) - return; - TreeNode parent = treeNode.Parent; - for (int i = 0; i < parent.Nodes.Count; ++i) - { - if (parent.Nodes[i].Text == name) - { - parent.Nodes.RemoveAt(i); - return; - } - } - } + TreeNode treeNode = FindGuid(this.treeView1.TopNode, guid); + if (treeNode == null) + return; + TreeNode parent = treeNode.Parent; + for (int i = 0; i < parent.Nodes.Count; ++i) + { + if (parent.Nodes[i].Text == name) + { + parent.Nodes.RemoveAt(i); + return; + } + } + } private delegate string DelegateGetInventoryName(Guid guid, int type, int number); public string GetInventoryName(Guid guid, int type, int number) { @@ -2441,7 +2441,7 @@ namespace LSLEditor.Solution break; } } - } + } public class NodeSorter : System.Collections.IComparer { public int Compare(object x, object y) diff --git a/trunk/UpdateApplicationForm.cs b/trunk/UpdateApplicationForm.cs index 6f6c595..cdaf6ff 100644 --- a/trunk/UpdateApplicationForm.cs +++ b/trunk/UpdateApplicationForm.cs @@ -202,11 +202,11 @@ namespace LSLEditor if (strLine == null) break; - int intSplit = strLine.IndexOf("="); + int intSplit = strLine.IndexOf("="); if (intSplit < 0) continue; - string strName = strLine.Substring(0, intSplit); + string strName = strLine.Substring(0, intSplit); string strValue = strLine.Substring(intSplit + 1); //All hashes are of the uncompressed file. However, different archives may contain different versions. @@ -224,7 +224,7 @@ namespace LSLEditor case "BZipUrl": bzip.uri = strValue; break; - case "GZipVersion": + case "GZipVersion": gzip = new versionInfo(strValue); break; case "GZipHash": @@ -242,7 +242,7 @@ namespace LSLEditor case "ZipUrl": wzip.uri = strValue; break; - case "HelpHash": + case "HelpHash": strHelpHashWeb = strValue; break; case "HelpUrl2": From 52be06be96eee3559423ab58c728d2a3a699936d Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Sat, 13 Jul 2013 12:36:00 +0100 Subject: [PATCH 02/11] Updating copyright date --- trunk/Properties/AssemblyInfo.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/trunk/Properties/AssemblyInfo.cs b/trunk/Properties/AssemblyInfo.cs index c2dd05f..da901fb 100644 --- a/trunk/Properties/AssemblyInfo.cs +++ b/trunk/Properties/AssemblyInfo.cs @@ -55,7 +55,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LSL Editor")] -[assembly: AssemblyCopyright("2006 - 2012")] +[assembly: AssemblyCopyright("2006 - 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -69,7 +69,8 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: - +// +// LSL-Editor uses the Major.Minor.Bugfix.Build format. [assembly: AssemblyVersion("2.999.999.1")] // From 95889e1a35d9efa1b03cf75f5b3e6f525547741f Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Sat, 13 Jul 2013 13:51:25 +0100 Subject: [PATCH 03/11] Fixing return value that I missed during style fix. --- trunk/SecondLife/vector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trunk/SecondLife/vector.cs b/trunk/SecondLife/vector.cs index c7264af..9003ba3 100644 --- a/trunk/SecondLife/vector.cs +++ b/trunk/SecondLife/vector.cs @@ -232,7 +232,7 @@ namespace LSLEditor } else if (Math.Abs(v1.z - v2.z) > EqualityTolerence) { bResult = false; } - return true; + return bResult; } public static bool operator !=(vector v1, vector v2) From 4b1ca5cae73bfedc3fb2066a7178a28eb41ec7d4 Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Sat, 13 Jul 2013 13:53:06 +0100 Subject: [PATCH 04/11] Adding new post-build event that updates AssemblyInfo.cs 'revision' on successful build. --- trunk/lsleditor.csproj | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/trunk/lsleditor.csproj b/trunk/lsleditor.csproj index 8200ef0..64d25fe 100644 --- a/trunk/lsleditor.csproj +++ b/trunk/lsleditor.csproj @@ -1,4 +1,4 @@ - + Local @@ -20,7 +20,7 @@ false WinExe LSLEditor - OnOutputUpdated + OnBuildSuccess LSLEditor.LSLEditorForm @@ -870,7 +870,6 @@ "$(FrameworkSDKDir)Bin\rc.exe" /r "$(ProjectDir)$(TargetName).rc" - - + E:\Dev\C#\AssemblyRevisionIncrement\bin\Release\AssemblyRevisionIncrementer.exe /t="$(SolutionDir)\Properties\AssemblyInfo.cs" \ No newline at end of file From 1c685b74c4aece3514c4e11cf9e3a7186650cbd0 Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Sun, 14 Jul 2013 03:53:26 +0100 Subject: [PATCH 05/11] Moving AssemblyRevisionIncrementer into repo tree. --- build/AssemblyRevisionIncrementer.exe | Bin 0 -> 8192 bytes trunk/Properties/AssemblyInfo.cs | 6 +++--- trunk/lsleditor.csproj | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 build/AssemblyRevisionIncrementer.exe diff --git a/build/AssemblyRevisionIncrementer.exe b/build/AssemblyRevisionIncrementer.exe new file mode 100644 index 0000000000000000000000000000000000000000..7e2ef2e9756a3422eaee454227a72bf5dd1fb4f0 GIT binary patch literal 8192 zcmeHLeQX@Zb$`3JygS~JCoWIohd#{JNw!atdHifFsiH-S9}XQ#Vnj-&8>Q0T-H=@S zZudO9N0D-4(6Aji$VV-pZR!+-9s8fS2#Tg?5hrmII0=HZK++TlVAMbbr+>IXTI9nh z+O!4i{@&aNk4Gss(0>XfbGL8byf^daeay_8*|Wd%EQN^3!1M0AM6ck@Wn95u4K~3} z^nEo!f7SZEgRf|F-#fUt>iAYkdMnZ{S~=Twy}-%}OO{>BajmKI3s%v~i%ffa>~K}| z{4~*=7NUQB;71>>jrJz#T3m|~?FJ=Qp*}u>w}odM4+9G?y`ncTr9Z!E6A$QILNxv~ zQHT0(y{pwq6G}tw0^{REJ>e>`@pYA`4fPj>iS{?r-wU^hU_re^QU74QMwAJ}dVu;< zNdWMatyR5IQ^g{>nvuTDp{8^j2f{+T@HCWhXrGay;GrSwN>}l)tUK^DlyRan4ON9+ zWxt}ZZaTHlWdvp_!M-EXh;HQ(ZhqU69Ms7N7ky0$P}0-TBpj11bvzzUcOtI$#APdJ zX*eKuR6YwdoJPQ7;q)HB{guvOlVL>b^@lm(M|R+hG`#;h5PTVvG>>6Rs*|d2YYv| zXRNh*sl7G&8E5#p@X@Eo12j6l4p|mLvLq9!@2*;EM^>iPj@c6M< zCxy}xc84BL9|X0#?PfNJwU}Y$w`9bO099^FM$MKkGorkcY(oEObxxBO>_0n*b7&?|YO0oiMY0r$xtSE~EXHdNEcAX~*Z(!CTnjqatS zVH*0p(*E=p-+A|4(*(^#>G+Iu`u9M%xi{G^-)2SID-o|xk((q_I+c=%aM#e@NY_w% zB%JA$hZX5qhs;-yi2P%P$hYt^6I(MZa&)4)0b>5qml2<@;XzD@=T1ic6zw-bG3v|U z%)$d_G~NkNcwbr@%?xHn21kZYFr|eGfUjbK9D1CH*V7m999jsZ*TMXY z3-o5ZvTq-{|KjWvct1yd5p(s>nSz()#we(25AM;Ut-MG6_njlWPx9!jHtWndwj4rN zf@2BGis!nbGY|c%+QzEyFg-(0U=w_sUI(1hPHJJwDY&WN^9sJA;6Et%Zwf|qZh2a_ z^e`i%nf?6T6=|36rnFxYk!Ziqtuq-emCg9Xb@5t z4{u3nqYtXujh^R?J2jpcTJ_%ogk#8m?AE}$0Yh|9QI05hOwk7wK3c_l=_UGYI;h|g z1&0(oq2PpqvkHD#!G{3H$yT_d;G+s|DEI{6G&FySK19y}cGKq-d>Ln>6n%-l5Smx; zB7KEk3#I5a`hMsm@W|_-eVAR`{$;uuDg(Y1x(@h@(Bq2oq{2S|_124<~K1m~b2DAJK@T8*bQ}7UGa0WA<>7S$$dVNUI7w9Qaa`fkbk6=}2kiic^ z!eew) K13cjFVmR2!SzD0)ieKIyxxDdly`54wKueDmyXkDS(X}^nBL=*6%DyPnR z`Eo(rM-#p;irK=(1+nJ%j_1z0IVp<54TQ{ybwTr$qa{t*YhrTME@p-FGtHf5q*q*6 zb7^`#5H3sc>vCt^We+lP!uLH%ML*}sf|I3%4L=Y?I-h-5*W&J68oKh%?Wa=wxm@X+Ss{A2v7!#d`uK>UcG%<#vmlc8nI&a zAufpJ>JW8H7oDIWCIW1x*>WK2gy>aJQTt zfSMQU=a&f{yD}%-m0*i>B_7t z9xdDKNvwUf__0%kaAONeqRpo-VvDqCg#?`>3mX~MFYqE#Yk@ZC0`N6*Ky%0=mu5)f zUBpFm4Ydro>v$|0pn%5c6rhb3EG?jA^eF(l5B!g)Hd3{bpsi6q`g@A^QPO%B8~TkQ zIX#AC`!T#}dKx-hp!0ZGzs7b}eFTg0kR_m{rKARUvu3P!04?c2vmM*U2o2!$#1ujj zq|g{1i>P~E*_u;w*?t#xf!^2bqf2NZ>mH)JoB1LH~nn#<3Jb0C4K_hU`n37)tCj0oNE}<#k^#F zwr1LGG>BAf-x0Bz?R->F=ktdid-^Ns|9orqtA~4U{QGNf|B|9#zJB>q@93MKz{yiP zkO-5WNE}FDTHr7oN}%BUsVDSsqJ?xl5si@^?by@VswJX^rD+KUdJBL#&1e*@HEyaU z_Cu7O=!mvNASN1#7%VqxXjqeI8Ra2ZL?YT^=}`p}QPmibm4FoJli1avX*}K?w5QVn z48^oWE6e993rWNxA*E1fQEyQQ)Jak_Y@z#s5bKttu%&C!B+hyetU4-dcnBzEMRrG{ z7%GZC9wj5uSp)|P9|*x4I5FWXLwEDOTRXK-3tL6_PSMV%9IJNBAv&y4Up=E*-+bBH z#1r8_J^I^`Nv%=RCK*k1wuD@0zbXLG^Eg+}FYL>M$OB zD!Q;RwXporzWsN6_CL;j{gZb+pMB#~-;II4c=Ga;Si9Wp;d*Af>}4Omyng%xmyu0{ z?Tg#D#IduK&q5^4k1(thmvO6FX?oSZr)`n1AoEVI3w5egCr%+U`2yd4@x}E{vc?tm z{{!f_^C{Cd@g0kfBhziyt8%-XzYTr$7Ig04Bm|U7V4nr{!Z^`0>NbE1N_vXuC)K!f z{h81x;3cHaD}bEV7HAfU?HuZ}fHT0k{EhLmcPesgoh$Ftio13HuU6FyLqU^EYD=u8 zo7yJF4Gxn5xQLC`#zyO7W9BWplG2$^^cTjDF)20ZR7p0R>~>1}wrVqoJup)2Z4} z^DSFciOB!emU$Jk%F!W@6rO|jjq!dj`OUE!Rk7MGuQ_7P@j9;hG>>Fq6>K|>?TGWw zzV?k%r`L-GYprsJ8cQK}q%7g)ygV*4W2uXaGyTU?7A~!B-Y$5q7)xykKXv-P_Sh-A zdabu0!1c#cW$B*ubE~-j`Ta#FCq3U=4*GLm@uck+GiyUBt7yB False .NET Framework 2.0 %28x86%29 - false + true False @@ -859,7 +859,7 @@ False .NET Framework 3.5 - true + false False @@ -870,6 +870,6 @@ "$(FrameworkSDKDir)Bin\rc.exe" /r "$(ProjectDir)$(TargetName).rc" - E:\Dev\C#\AssemblyRevisionIncrement\bin\Release\AssemblyRevisionIncrementer.exe /t="$(SolutionDir)\Properties\AssemblyInfo.cs" + $(SolutionDir)\..\build\AssemblyRevisionIncrementer.exe /t="$(SolutionDir)\Properties\AssemblyInfo.cs" \ No newline at end of file From 8d7cab032f10a55abeebe1ca635d039bc3eb16bf Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Sun, 14 Jul 2013 07:50:24 +0100 Subject: [PATCH 06/11] Fixing indents and braces. --- trunk/SecondLife/SecondLifeMain.cs | 656 ++++++++++++++--------------- 1 file changed, 323 insertions(+), 333 deletions(-) diff --git a/trunk/SecondLife/SecondLifeMain.cs b/trunk/SecondLife/SecondLifeMain.cs index 3c25b8b..d4b9164 100644 --- a/trunk/SecondLife/SecondLifeMain.cs +++ b/trunk/SecondLife/SecondLifeMain.cs @@ -60,293 +60,294 @@ namespace LSLEditor Whisper, Say, Shout, OwnerSay, RegionSay, RegionSayTo } - public partial class SecondLife - { - // Make friends with my host - public SecondLifeHost host; + public partial class SecondLife + { + // Make friends with my host + public SecondLifeHost host; - #region members - // Random generator - private Random m_random; + #region members + // Random generator + private Random m_random; - private DateTime m_DateTimeScriptStarted; + private DateTime m_DateTimeScriptStarted; - private Boolean m_AllowDrop = false; - private Hashtable m_LandPassList; + private Boolean m_AllowDrop = false; + private Hashtable m_LandPassList; - private Hashtable m_LandBanList; + private Hashtable m_LandBanList; - private Float m_Volume; + private Float m_Volume; - private String m_ObjectName; + private String m_ObjectName; private String m_ParcelMusicURL; - private vector m_pos; - private rotation m_rot; - private rotation m_rotlocal; - private vector m_scale; - private String m_SitText; - private Float m_SoundRadius; + private vector m_pos; + private rotation m_rot; + private rotation m_rotlocal; + private vector m_scale; + private String m_SitText; + private Float m_SoundRadius; - private vector m_RegionCorner; + private vector m_RegionCorner; - private integer m_start_parameter; + private integer m_start_parameter; - #endregion + #endregion #region Properties - public vector GetLocalPos { // TODO change this to use a call to llGetLocalPos specifying NOT to be Verbose. After all functions have been changed to allow verbose/silent option. get { return m_pos; } } - #endregion #region constructor public SecondLife() - { - host = null; - m_random = new Random(); - m_DateTimeScriptStarted = DateTime.Now.ToUniversalTime(); - m_LandPassList = new Hashtable(); - m_LandBanList = new Hashtable(); - m_Volume = 0.0; - m_ObjectName = null; - m_pos = new vector(127, 128, 20); - m_rot = rotation.ZERO_ROTATION; - m_rotlocal = rotation.ZERO_ROTATION; - m_scale = vector.ZERO_VECTOR; - m_SitText = "sittext"; - m_SoundRadius = 1.0; - m_start_parameter = 0; + { + host = null; + m_random = new Random(); + m_DateTimeScriptStarted = DateTime.Now.ToUniversalTime(); + m_LandPassList = new Hashtable(); + m_LandBanList = new Hashtable(); + m_Volume = 0.0; + m_ObjectName = null; + m_pos = new vector(127, 128, 20); + m_rot = rotation.ZERO_ROTATION; + m_rotlocal = rotation.ZERO_ROTATION; + m_scale = vector.ZERO_VECTOR; + m_SitText = "sittext"; + m_SoundRadius = 1.0; + m_start_parameter = 0; - m_RegionCorner = vector.ZERO_VECTOR; - } - #endregion + m_RegionCorner = vector.ZERO_VECTOR; + } + #endregion - #region internal routines - private void Verbose(string strLine, params object[] parameters) - { - if (parameters.Length == 0) - host.VerboseMessage(strLine); - else - host.VerboseMessage(string.Format(strLine, parameters)); - } + #region internal routines + private void Verbose(string strLine, params object[] parameters) + { + if (parameters.Length == 0) { + host.VerboseMessage(strLine); + } else { + host.VerboseMessage(string.Format(strLine, parameters)); + } + } - private void Chat(integer channel, string message, CommunicationType how) - { - host.Chat(host, channel, host.GetObjectName(), host.GetKey(), message, how); - } + private void Chat(integer iChannel, string sText, CommunicationType ctHow) + { + host.Chat(host, iChannel, host.GetObjectName(), host.GetKey(), sText, ctHow); + } - public void state(string strStateName) - { - Verbose("state->" + strStateName); - host.State(strStateName, false); - System.Threading.Thread.Sleep(1000); - System.Windows.Forms.MessageBox.Show("If you see this, something is wrong", "Oops..."); - } - #endregion + public void state(string strStateName) + { + Verbose("state->" + strStateName); + host.State(strStateName, false); + System.Threading.Thread.Sleep(1000); + System.Windows.Forms.MessageBox.Show("If you see this, something is wrong", "Oops..."); + } + #endregion - #region Helper Functions + #region Helper Functions - #region List Functions + #region List Functions - private bool CorrectIt(int length, ref int start, ref int end) - { - if (start < 0) - start = length + start; + private bool CorrectIt(int length, ref int start, ref int end) + { + if (start < 0) { + start = length + start; + } - if (end < 0) - end = length + end; + if (end < 0) { + end = length + end; + } - if (start <= end) - { - if (start >= length) - return false; - if (end < 0) - return false; - } + if (start <= end) { + if (start >= length) { + return false; + } + if (end < 0) { + return false; + } + } - start = Math.Max(0, start); - end = Math.Min(length - 1, end); + start = Math.Max(0, start); + end = Math.Min(length - 1, end); - return true; - } + return true; + } - public ArrayList RandomShuffle(ArrayList collection) - { - // We have to copy all items anyway, and there isn't a way to produce the items - // on the fly that is linear. So copying to an array and shuffling it is as efficient as we can get. + public ArrayList RandomShuffle(ArrayList collection) + { + // We have to copy all items anyway, and there isn't a way to produce the items + // on the fly that is linear. So copying to an array and shuffling it is as efficient as we can get. - if (collection == null) - throw new ArgumentNullException("collection"); + if (collection == null) { + throw new ArgumentNullException("collection"); + } - int count = collection.Count; - for (int i = count - 1; i >= 1; --i) - { - // Pick an random number 0 through i inclusive. - int j = m_random.Next(i + 1); + int count = collection.Count; + for (int i = count - 1; i >= 1; --i) { + // Pick an random number 0 through i inclusive. + int j = m_random.Next(i + 1); - // Swap array[i] and array[j] - object temp = collection[i]; - collection[i] = collection[j]; - collection[j] = temp; - } - return collection; - } + // Swap array[i] and array[j] + object temp = collection[i]; + collection[i] = collection[j]; + collection[j] = temp; + } + return collection; + } - private ArrayList List2Buckets(list src, int stride) - { - ArrayList buckets = null; - if ((src.Count % stride) == 0 && stride <= src.Count) - { - buckets = new ArrayList(); - for (int intI = 0; intI < src.Count; intI += stride) - { - object[] bucket = new object[stride]; - for (int intJ = 0; intJ < stride; intJ++) - bucket[intJ] = src[intI + intJ]; - buckets.Add(bucket); - } - } - return buckets; - } + private ArrayList List2Buckets(list src, int stride) + { + ArrayList buckets = null; + if ((src.Count % stride) == 0 && stride <= src.Count) { + buckets = new ArrayList(); + for (int intI = 0; intI < src.Count; intI += stride) { + object[] bucket = new object[stride]; + for (int intJ = 0; intJ < stride; intJ++) { + bucket[intJ] = src[intI + intJ]; + } + buckets.Add(bucket); + } + } + return buckets; + } - private list Buckets2List(ArrayList buckets, int stride) - { - object[] items = new object[buckets.Count * stride]; - for (int intI = 0; intI < buckets.Count; intI++) - { - for (int intJ = 0; intJ < stride; intJ++) - items[intI * stride + intJ] = ((object[])buckets[intI])[intJ]; - } - return new list(items); - } + private list Buckets2List(ArrayList buckets, int stride) + { + object[] items = new object[buckets.Count * stride]; + for (int intI = 0; intI < buckets.Count; intI++) { + for (int intJ = 0; intJ < stride; intJ++) { + items[intI * stride + intJ] = ((object[])buckets[intI])[intJ]; + } + } + return new list(items); + } - private class BucketComparer : IComparer - { - private integer ascending; - public BucketComparer(integer ascending) - { - this.ascending = ascending; - } - public int Compare(object x, object y) - { - object[] xx = x as object[]; - object[] yy = y as object[]; + private class BucketComparer : IComparer + { + private integer ascending; + public BucketComparer(integer ascending) + { + this.ascending = ascending; + } + public int Compare(object x, object y) + { + object[] xx = x as object[]; + object[] yy = y as object[]; - object A, B; + object A, B; - if (ascending == TRUE) - { - A = xx[0]; - B = yy[0]; - } - else - { - B = xx[0]; - A = yy[0]; - } + if (ascending == TRUE) { + A = xx[0]; + B = yy[0]; + } else { + B = xx[0]; + A = yy[0]; + } - string strType = A.GetType().ToString(); + string strType = A.GetType().ToString(); - if (((A is string) && (B is string)) || - ((A is SecondLife.String) && (B is SecondLife.String))) - return string.Compare(A.ToString(), B.ToString()); + if (((A is string) && (B is string)) || ((A is SecondLife.String) && (B is SecondLife.String))) { + return string.Compare(A.ToString(), B.ToString()); + } - if ((A is SecondLife.integer) && (B is SecondLife.integer)) - return SecondLife.integer.Compare((SecondLife.integer)A, (SecondLife.integer)B); + if ((A is SecondLife.integer) && (B is SecondLife.integer)) { + return SecondLife.integer.Compare((SecondLife.integer)A, (SecondLife.integer)B); + } - if ((A is SecondLife.Float) && (B is SecondLife.Float)) - return SecondLife.Float.Compare((SecondLife.Float)A, (SecondLife.Float)B); + if ((A is SecondLife.Float) && (B is SecondLife.Float)) { + return SecondLife.Float.Compare((SecondLife.Float)A, (SecondLife.Float)B); + } - return 0; - } - } - #endregion + return 0; + } + } + #endregion - #region String Functions - private list ParseString(String src, list separators, list spacers, bool blnKeepNulls) - { - list result = new list(); - int intFrom = 0; - string s = src; - for (int intI = 0; intI < s.Length; intI++) - { - string strTmp = s.Substring(intI); - bool blnFound = false; - for (int intJ = 0; intJ < separators.Count; intJ++) - { - string strSeparator = separators[intJ].ToString(); - if (strSeparator.Length == 0) - continue; // check this - if (strTmp.IndexOf(strSeparator) == 0) - { - string strBefore = s.Substring(intFrom, intI - intFrom); - if (strBefore != "" || blnKeepNulls) - result.Add(strBefore); - intI += strSeparator.Length - 1; - intFrom = intI + 1; - blnFound = true; - break; - } - } + #region String Functions + private list ParseString(String src, list separators, list spacers, bool blnKeepNulls) + { + list result = new list(); + int intFrom = 0; + string s = src; + for (int intI = 0; intI < s.Length; intI++) { + string strTmp = s.Substring(intI); + bool blnFound = false; + for (int intJ = 0; intJ < separators.Count; intJ++) { + string strSeparator = separators[intJ].ToString(); + if (strSeparator.Length == 0) { + continue; // check this + } + if (strTmp.IndexOf(strSeparator) == 0) { + string strBefore = s.Substring(intFrom, intI - intFrom); + if (strBefore != "" || blnKeepNulls) { + result.Add(strBefore); + } + intI += strSeparator.Length - 1; + intFrom = intI + 1; + blnFound = true; + break; + } + } - if (blnFound) - continue; + if (blnFound) continue; - for (int intJ = 0; intJ < spacers.Count; intJ++) - { - string strSpacer = spacers[intJ].ToString(); - if (strSpacer.Length == 0) - continue; // check this - if (strTmp.IndexOf(strSpacer) == 0) - { - string strBefore = s.Substring(intFrom, intI - intFrom); - if (strBefore != "" || blnKeepNulls) - result.Add(strBefore); - result.Add(strSpacer); - intI += strSpacer.Length - 1; - intFrom = intI + 1; - break; - } - } - } - string strLast = s.Substring(intFrom); - if (strLast != "" || blnKeepNulls) - result.Add(strLast); - return result; - } + for (int intJ = 0; intJ < spacers.Count; intJ++) { + string strSpacer = spacers[intJ].ToString(); + if (strSpacer.Length == 0) { + continue; // check this + } + if (strTmp.IndexOf(strSpacer) == 0) { + string strBefore = s.Substring(intFrom, intI - intFrom); + if (strBefore != "" || blnKeepNulls) { + result.Add(strBefore); + } + result.Add(strSpacer); + intI += strSpacer.Length - 1; + intFrom = intI + 1; + break; + } + } + } + string strLast = s.Substring(intFrom); + if (strLast != "" || blnKeepNulls) { + result.Add(strLast); + } + return result; + } - private string StringToBase64(string str) - { - byte[] data = Encoding.UTF8.GetBytes(str); - return Convert.ToBase64String(data); - } + private string StringToBase64(string str) + { + byte[] data = Encoding.UTF8.GetBytes(str); + return Convert.ToBase64String(data); + } - private string Base64ToString(string str) - { - byte[] data = Convert.FromBase64String(str); - int intLen = Array.IndexOf(data, (byte)0x00); - if (intLen < 0) - intLen = data.Length; - return Encoding.UTF8.GetString(data, 0, intLen); - } + private string Base64ToString(string str) + { + byte[] data = Convert.FromBase64String(str); + int intLen = Array.IndexOf(data, (byte)0x00); + if (intLen < 0) { + intLen = data.Length; + } + return Encoding.UTF8.GetString(data, 0, intLen); + } - private int LookupBase64(string s, int intIndex) - { - if (intIndex < s.Length) - { - int intReturn = FastLookupBase64[s[intIndex]]; - if (intReturn == 0) - if (s[intIndex] != 'A') - throw new Exception(); - return intReturn; - } - else - return 0; - } + private int LookupBase64(string s, int intIndex) + { + if (intIndex < s.Length) { + int intReturn = FastLookupBase64[s[intIndex]]; + if (intReturn == 0) { + if (s[intIndex] != 'A') { + throw new Exception(); + } + } + return intReturn; + } else { + return 0; + } + } static readonly int[] FastLookupBase64 = {// 0 1 2 3 4 5 6 7 8 9 A B C D E F @@ -366,109 +367,98 @@ namespace LSLEditor 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // D0 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // E0 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; // F0 - #endregion + #endregion - #region Math Functions + #region Math Functions + private integer ModPow1(integer a, integer b, integer c) + { + return (int)Math.Pow((int)a, (int)b & (int)0xffff) % (int)c; + } + private integer ModPow2(integer x, integer y, integer m) + { + if (!x) return 0; + integer k = 1 + (int)Math.Ceiling(Math.Log(Math.Abs(x)) / 0.69314718055994530941723212145818);//ceil(log2(x)) + integer w = 32; + integer p = w / k; + integer r = y / p; + integer f = y % p; + integer z = 1; + if (r) z = ModPow2(ModPow1(x, p, m), r, m); + if (f) z = (z * ModPow1(x, f, m)) % m; + return z; + } + #endregion Math Functions - private integer ModPow1(integer a, integer b, integer c) - { - return (int)Math.Pow((int)a, (int)b & (int)0xffff) % (int)c; - } + private List GetListOfNumbers(list input) + { + List result = new List(); + for (int intI = 0; intI < input.Count; intI++) { + object objI = input[intI]; + string strType = objI.GetType().ToString().Replace("LSLEditor.SecondLife+", ""); + switch (strType) { + case "Float": + result.Add(Convert.ToDouble((Float)objI)); + break; + case "System.Int32": + result.Add(Convert.ToDouble((int)objI)); + break; + case "System.Double": + result.Add(Convert.ToDouble((double)objI)); + break; + case "integer": + result.Add(Convert.ToDouble((integer)objI)); + break; + default: + break; + } + } + return result; + } - private integer ModPow2(integer x, integer y, integer m) - { - if (!x) return 0; - integer k = 1 + (int)Math.Ceiling(Math.Log(Math.Abs(x)) / 0.69314718055994530941723212145818);//ceil(log2(x)) - integer w = 32; - integer p = w / k; - integer r = y / p; - integer f = y % p; - integer z = 1; - if (r) z = ModPow2(ModPow1(x, p, m), r, m); - if (f) z = (z * ModPow1(x, f, m)) % m; - return z; - } + private double GetAverage(double[] data) + { + try { + double DataTotal = 0; + for (int i = 0; i < data.Length; i++) { + DataTotal += data[i]; + } + return SafeDivide(DataTotal, data.Length); + } catch (Exception) { throw; } + } - #endregion Math Functions + public double GetStandardDeviation(double[] num) + { + double Sum = 0.0, SumOfSqrs = 0.0; + for (int i = 0; i < num.Length; i++) { + Sum += num[i]; + SumOfSqrs += Math.Pow(num[i], 2); + } + double topSum = (num.Length * SumOfSqrs) - (Math.Pow(Sum, 2)); + double n = (double)num.Length; + return Math.Sqrt(topSum / (n * (n - 1))); + } - private List GetListOfNumbers(list input) - { - List result = new List(); - for (int intI = 0; intI < input.Count; intI++) - { - object objI = input[intI]; - string strType = objI.GetType().ToString().Replace("LSLEditor.SecondLife+", ""); - switch (strType) - { - case "Float": - result.Add(Convert.ToDouble((Float)objI)); - break; - case "System.Int32": - result.Add(Convert.ToDouble((int)objI)); - break; - case "System.Double": - result.Add(Convert.ToDouble((double)objI)); - break; - case "integer": - result.Add(Convert.ToDouble((integer)objI)); - break; - default: - break; - } - } - return result; - } + private double SafeDivide(double value1, double value2) + { + double ret = 0; + try { + if ((value1 == 0) || (value2 == 0)) { return ret; } + ret = value1 / value2; + } catch { } + return ret; + } - private double GetAverage(double[] data) - { - try - { - double DataTotal = 0; - for (int i = 0; i < data.Length; i++) - { - DataTotal += data[i]; - } - return SafeDivide(DataTotal, data.Length); - } - catch (Exception) { throw; } - } - - public double GetStandardDeviation(double[] num) - { - double Sum = 0.0, SumOfSqrs = 0.0; - for (int i = 0; i < num.Length; i++) - { - Sum += num[i]; - SumOfSqrs += Math.Pow(num[i], 2); - } - double topSum = (num.Length * SumOfSqrs) - (Math.Pow(Sum, 2)); - double n = (double)num.Length; - return Math.Sqrt(topSum / (n * (n - 1))); - } - - private double SafeDivide(double value1, double value2) - { - double ret = 0; - try - { - if ((value1 == 0) || (value2 == 0)) { return ret; } - ret = value1 / value2; - } - catch { } - return ret; - } - - private byte HexToInt(byte b) - { - if (b >= '0' && b <= '9') - return (byte)(b - '0'); - else if ((b >= 'a' && b <= 'f') || (b >= 'A' && b <= 'F')) - return (byte)((b & 0x5f) - 0x37); - else - return 0; // error - } - #endregion - - } + private byte HexToInt(byte b) + { + if (b >= '0' && b <= '9') { + return (byte)(b - '0'); + } else if ((b >= 'a' && b <= 'f') || (b >= 'A' && b <= 'F')) { + return (byte)((b & 0x5f) - 0x37); + } else { + return 0; // error + } + } + #endregion + } } From 52b52a2fa79b2d5cb2549c2bb76f5e84054a1bd6 Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Sun, 14 Jul 2013 11:46:16 +0100 Subject: [PATCH 07/11] Renaming variables and fixing methods to have a single return. --- trunk/SecondLife/SecondLifeEvents.cs | 52 +++---- trunk/SecondLife/SecondLifeMain.cs | 211 ++++++++++++++------------- 2 files changed, 132 insertions(+), 131 deletions(-) diff --git a/trunk/SecondLife/SecondLifeEvents.cs b/trunk/SecondLife/SecondLifeEvents.cs index 5b20c7a..87613ca 100644 --- a/trunk/SecondLife/SecondLifeEvents.cs +++ b/trunk/SecondLife/SecondLifeEvents.cs @@ -50,41 +50,41 @@ namespace LSLEditor public partial class SecondLife { #region events as virtuals, if one is used, use override - virtual public void at_rot_target(integer number, rotation target_rotation, rotation our_rotation) { } - virtual public void at_target(integer tnum, vector targetpos, vector ourpos) { } - virtual public void attach(key attached) { } - virtual public void changed(integer changed) { } - virtual public void collision(integer total_number) { } - virtual public void collision_end(integer total_number) { } - virtual public void collision_start(integer total_number) { } - virtual public void control(key name, integer levels, integer edges) { } - virtual public void dataserver(key requested, String data) { } - virtual public void email(String time, String address, String subject, String body, integer remaining) { } - virtual public void http_response(key request_id, integer status, list metadata, String body) { } - virtual public void http_request(key request_id, String method, String body) { } - virtual public void land_collision(vector position) { } - virtual public void land_collision_end(vector position) { } - virtual public void land_collision_start(vector position) { } - virtual public void link_message(integer sender_number, integer number, String message, key id) { } - virtual public void listen(integer channel, String name, key id, String message) { } - virtual public void money(key giver, integer amount) { } + virtual public void at_rot_target(integer iHandle, rotation rTargetRotation, rotation rCurrentRotation) { } + virtual public void at_target(integer iHandle, vector vTargetPosition, vector vCurrrentPosition) { } + virtual public void attach(key kAttached) { } + virtual public void changed(integer iChangedFlags) { } + virtual public void collision(integer iCollisionCount) { } + virtual public void collision_end(integer iCollisionCount) { } + virtual public void collision_start(integer iCollisionCount) { } + virtual public void control(key kID, integer iLevels, integer iEdges) { } + virtual public void dataserver(key kRequestID, String sData) { } + virtual public void email(String sTime, String sAddress, String sSubject, String sBody, integer iRemaining) { } + virtual public void http_response(key kRequestID, integer iStatus, list lMetadata, String sBody) { } + virtual public void http_request(key kRequestID, String sMethod, String sBody) { } + virtual public void land_collision(vector vPosition) { } + virtual public void land_collision_end(vector vPosition) { } + virtual public void land_collision_start(vector vPosition) { } + virtual public void link_message(integer iSenderLinkIndex, integer iNumber, String sText, key kID) { } + virtual public void listen(integer iChannel, String sName, key kID, String sText) { } + virtual public void money(key kPayerID, integer iAmount) { } virtual public void moving_end() { } virtual public void moving_start() { } virtual public void no_sensor() { } virtual public void not_at_rot_target() { } virtual public void not_at_target() { } - virtual public void object_rez(key id) { } - virtual public void on_rez(integer start_param) { } + virtual public void object_rez(key kID) { } + virtual public void on_rez(integer iStartParameter) { } virtual public void path_update(integer iType, list lReserved) { } - virtual public void remote_data(integer event_type, key channel, key message_id, String sender, integer idata, String sdata) { } - virtual public void run_time_permissions(integer permissions) { } - virtual public void sensor(integer total_number) { } + virtual public void remote_data(integer iEventType, key kChannelID, key kMessageID, String sSender, integer iData, String sData) { } + virtual public void run_time_permissions(integer iPermissionsFlags) { } + virtual public void sensor(integer iSensedCount) { } virtual public void state_entry() { } virtual public void state_exit() { } virtual public void timer() { } - virtual public void touch(integer total_number) { } - virtual public void touch_end(integer total_number) { } - virtual public void touch_start(integer total_number) { } + virtual public void touch(integer iTouchesCount) { } + virtual public void touch_end(integer iTouchesCount) { } + virtual public void touch_start(integer iTouchesCount) { } virtual public void transaction_result(key kID, integer iSuccess, String sMessage) { } #endregion } diff --git a/trunk/SecondLife/SecondLifeMain.cs b/trunk/SecondLife/SecondLifeMain.cs index d4b9164..ac95d71 100644 --- a/trunk/SecondLife/SecondLifeMain.cs +++ b/trunk/SecondLife/SecondLifeMain.cs @@ -150,76 +150,76 @@ namespace LSLEditor #region Helper Functions #region List Functions - - private bool CorrectIt(int length, ref int start, ref int end) + private bool CorrectIt(int intLength, ref int intStart, ref int intEnd) { - if (start < 0) { - start = length + start; + bool bResult = true; + if (intStart < 0) { + intStart = intLength + intStart; } - if (end < 0) { - end = length + end; + if (intEnd < 0) { + intEnd = intLength + intEnd; } - if (start <= end) { - if (start >= length) { - return false; + if (intStart <= intEnd) { + if (intStart >= intLength) { + bResult = false; } - if (end < 0) { - return false; + if (intEnd < 0) { + bResult = false; } } - start = Math.Max(0, start); - end = Math.Min(length - 1, end); + intStart = Math.Max(0, intStart); + intEnd = Math.Min(intLength - 1, intEnd); - return true; + return bResult; } - public ArrayList RandomShuffle(ArrayList collection) + public ArrayList RandomShuffle(ArrayList alCollection) { // We have to copy all items anyway, and there isn't a way to produce the items // on the fly that is linear. So copying to an array and shuffling it is as efficient as we can get. - if (collection == null) { + if (alCollection == null) { throw new ArgumentNullException("collection"); } - int count = collection.Count; - for (int i = count - 1; i >= 1; --i) { + int intCount = alCollection.Count; + for (int i = intCount - 1; i >= 1; --i) { // Pick an random number 0 through i inclusive. int j = m_random.Next(i + 1); // Swap array[i] and array[j] - object temp = collection[i]; - collection[i] = collection[j]; - collection[j] = temp; + object temp = alCollection[i]; + alCollection[i] = alCollection[j]; + alCollection[j] = temp; } - return collection; + return alCollection; } - private ArrayList List2Buckets(list src, int stride) + private ArrayList List2Buckets(list lSource, int intStride) { - ArrayList buckets = null; - if ((src.Count % stride) == 0 && stride <= src.Count) { - buckets = new ArrayList(); - for (int intI = 0; intI < src.Count; intI += stride) { - object[] bucket = new object[stride]; - for (int intJ = 0; intJ < stride; intJ++) { - bucket[intJ] = src[intI + intJ]; + ArrayList alBuckets = null; + if ((lSource.Count % intStride) == 0 && intStride <= lSource.Count) { + alBuckets = new ArrayList(); + for (int intI = 0; intI < lSource.Count; intI += intStride) { + object[] bucket = new object[intStride]; + for (int intJ = 0; intJ < intStride; intJ++) { + bucket[intJ] = lSource[intI + intJ]; } - buckets.Add(bucket); + alBuckets.Add(bucket); } } - return buckets; + return alBuckets; } - private list Buckets2List(ArrayList buckets, int stride) + private list Buckets2List(ArrayList alBuckets, int intStride) { - object[] items = new object[buckets.Count * stride]; - for (int intI = 0; intI < buckets.Count; intI++) { - for (int intJ = 0; intJ < stride; intJ++) { - items[intI * stride + intJ] = ((object[])buckets[intI])[intJ]; + object[] items = new object[alBuckets.Count * intStride]; + for (int intI = 0; intI < alBuckets.Count; intI++) { + for (int intJ = 0; intJ < intStride; intJ++) { + items[intI * intStride + intJ] = ((object[])alBuckets[intI])[intJ]; } } return new list(items); @@ -227,19 +227,20 @@ namespace LSLEditor private class BucketComparer : IComparer { - private integer ascending; + private integer iAscending; public BucketComparer(integer ascending) { - this.ascending = ascending; + this.iAscending = ascending; } public int Compare(object x, object y) { + int iResult = 0; + object A, B; + object[] xx = x as object[]; object[] yy = y as object[]; - object A, B; - - if (ascending == TRUE) { + if (iAscending == TRUE) { A = xx[0]; B = yy[0]; } else { @@ -250,40 +251,36 @@ namespace LSLEditor string strType = A.GetType().ToString(); if (((A is string) && (B is string)) || ((A is SecondLife.String) && (B is SecondLife.String))) { - return string.Compare(A.ToString(), B.ToString()); + iResult = string.Compare(A.ToString(), B.ToString()); + } else if ((A is SecondLife.integer) && (B is SecondLife.integer)) { + iResult = SecondLife.integer.Compare((SecondLife.integer)A, (SecondLife.integer)B); + } else if ((A is SecondLife.Float) && (B is SecondLife.Float)) { + iResult = SecondLife.Float.Compare((SecondLife.Float)A, (SecondLife.Float)B); } - if ((A is SecondLife.integer) && (B is SecondLife.integer)) { - return SecondLife.integer.Compare((SecondLife.integer)A, (SecondLife.integer)B); - } - - if ((A is SecondLife.Float) && (B is SecondLife.Float)) { - return SecondLife.Float.Compare((SecondLife.Float)A, (SecondLife.Float)B); - } - - return 0; + return iResult; } } #endregion #region String Functions - private list ParseString(String src, list separators, list spacers, bool blnKeepNulls) + private list ParseString(String sSource, list lSeparators, list lSpacers, bool blnKeepNulls) { - list result = new list(); + list lResult = new list(); int intFrom = 0; - string s = src; + string s = sSource; for (int intI = 0; intI < s.Length; intI++) { string strTmp = s.Substring(intI); bool blnFound = false; - for (int intJ = 0; intJ < separators.Count; intJ++) { - string strSeparator = separators[intJ].ToString(); + for (int intJ = 0; intJ < lSeparators.Count; intJ++) { + string strSeparator = lSeparators[intJ].ToString(); if (strSeparator.Length == 0) { continue; // check this } if (strTmp.IndexOf(strSeparator) == 0) { string strBefore = s.Substring(intFrom, intI - intFrom); if (strBefore != "" || blnKeepNulls) { - result.Add(strBefore); + lResult.Add(strBefore); } intI += strSeparator.Length - 1; intFrom = intI + 1; @@ -294,17 +291,17 @@ namespace LSLEditor if (blnFound) continue; - for (int intJ = 0; intJ < spacers.Count; intJ++) { - string strSpacer = spacers[intJ].ToString(); + for (int intJ = 0; intJ < lSpacers.Count; intJ++) { + string strSpacer = lSpacers[intJ].ToString(); if (strSpacer.Length == 0) { continue; // check this } if (strTmp.IndexOf(strSpacer) == 0) { string strBefore = s.Substring(intFrom, intI - intFrom); if (strBefore != "" || blnKeepNulls) { - result.Add(strBefore); + lResult.Add(strBefore); } - result.Add(strSpacer); + lResult.Add(strSpacer); intI += strSpacer.Length - 1; intFrom = intI + 1; break; @@ -313,20 +310,20 @@ namespace LSLEditor } string strLast = s.Substring(intFrom); if (strLast != "" || blnKeepNulls) { - result.Add(strLast); + lResult.Add(strLast); } - return result; + return lResult; } - private string StringToBase64(string str) + private string StringToBase64(string strText) { - byte[] data = Encoding.UTF8.GetBytes(str); + byte[] data = Encoding.UTF8.GetBytes(strText); return Convert.ToBase64String(data); } - private string Base64ToString(string str) + private string Base64ToString(string strText) { - byte[] data = Convert.FromBase64String(str); + byte[] data = Convert.FromBase64String(strText); int intLen = Array.IndexOf(data, (byte)0x00); if (intLen < 0) { intLen = data.Length; @@ -336,17 +333,18 @@ namespace LSLEditor private int LookupBase64(string s, int intIndex) { + int intReturn = 0; if (intIndex < s.Length) { - int intReturn = FastLookupBase64[s[intIndex]]; + intReturn = FastLookupBase64[s[intIndex]]; if (intReturn == 0) { if (s[intIndex] != 'A') { throw new Exception(); } } - return intReturn; } else { - return 0; + intReturn = 0; } + return intReturn; } static readonly int[] FastLookupBase64 = @@ -370,50 +368,50 @@ namespace LSLEditor #endregion #region Math Functions - private integer ModPow1(integer a, integer b, integer c) + private integer ModPow1(integer iA, integer iB, integer iC) { - return (int)Math.Pow((int)a, (int)b & (int)0xffff) % (int)c; + return (int)Math.Pow((int)iA, (int)iB & (int)0xffff) % (int)iC; } - private integer ModPow2(integer x, integer y, integer m) + private integer ModPow2(integer iValueX, integer iValueY, integer iModulus) { - if (!x) return 0; - integer k = 1 + (int)Math.Ceiling(Math.Log(Math.Abs(x)) / 0.69314718055994530941723212145818);//ceil(log2(x)) + if (!iValueX) return 0; + integer k = 1 + (int)Math.Ceiling(Math.Log(Math.Abs(iValueX)) / 0.69314718055994530941723212145818); //ceil(log2(x)) integer w = 32; integer p = w / k; - integer r = y / p; - integer f = y % p; + integer r = iValueY / p; + integer f = iValueY % p; integer z = 1; - if (r) z = ModPow2(ModPow1(x, p, m), r, m); - if (f) z = (z * ModPow1(x, f, m)) % m; + if (r) z = ModPow2(ModPow1(iValueX, p, iModulus), r, iModulus); + if (f) z = (z * ModPow1(iValueX, f, iModulus)) % iModulus; return z; } #endregion Math Functions - private List GetListOfNumbers(list input) + private List GetListOfNumbers(list lInput) { - List result = new List(); - for (int intI = 0; intI < input.Count; intI++) { - object objI = input[intI]; + List lResult = new List(); + for (int intI = 0; intI < lInput.Count; intI++) { + object objI = lInput[intI]; string strType = objI.GetType().ToString().Replace("LSLEditor.SecondLife+", ""); switch (strType) { case "Float": - result.Add(Convert.ToDouble((Float)objI)); + lResult.Add(Convert.ToDouble((Float)objI)); break; case "System.Int32": - result.Add(Convert.ToDouble((int)objI)); + lResult.Add(Convert.ToDouble((int)objI)); break; case "System.Double": - result.Add(Convert.ToDouble((double)objI)); + lResult.Add(Convert.ToDouble((double)objI)); break; case "integer": - result.Add(Convert.ToDouble((integer)objI)); + lResult.Add(Convert.ToDouble((integer)objI)); break; default: break; } } - return result; + return lResult; } private double GetAverage(double[] data) @@ -427,37 +425,40 @@ namespace LSLEditor } catch (Exception) { throw; } } - public double GetStandardDeviation(double[] num) + public double GetStandardDeviation(double[] dblNumbers) { - double Sum = 0.0, SumOfSqrs = 0.0; - for (int i = 0; i < num.Length; i++) { - Sum += num[i]; - SumOfSqrs += Math.Pow(num[i], 2); + double dblSum = 0.0, dblSumOfSqrs = 0.0; + for (int i = 0; i < dblNumbers.Length; i++) { + dblSum += dblNumbers[i]; + dblSumOfSqrs += Math.Pow(dblNumbers[i], 2); } - double topSum = (num.Length * SumOfSqrs) - (Math.Pow(Sum, 2)); - double n = (double)num.Length; - return Math.Sqrt(topSum / (n * (n - 1))); + double dblTopSum = (dblNumbers.Length * dblSumOfSqrs) - (Math.Pow(dblSum, 2)); + double dblN = (double)dblNumbers.Length; + return Math.Sqrt(dblTopSum / (dblN * (dblN - 1))); } - private double SafeDivide(double value1, double value2) + private double SafeDivide(double dblValue1, double dblValue2) { - double ret = 0; + double dblResult = 0; try { - if ((value1 == 0) || (value2 == 0)) { return ret; } - ret = value1 / value2; + if ((dblValue1 != 0) && (dblValue2 != 0)) { + dblResult = dblValue1 / dblValue2; + } } catch { } - return ret; + return dblResult; } private byte HexToInt(byte b) { + byte bResult; if (b >= '0' && b <= '9') { - return (byte)(b - '0'); + bResult = (byte)(b - '0'); } else if ((b >= 'a' && b <= 'f') || (b >= 'A' && b <= 'F')) { - return (byte)((b & 0x5f) - 0x37); + bResult = (byte)((b & 0x5f) - 0x37); } else { - return 0; // error + bResult = 0; // error } + return bResult; } #endregion } From 6437594240e606104acf70add5915c120b7b40fd Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Sun, 14 Jul 2013 12:37:16 +0100 Subject: [PATCH 08/11] Fixing a few missed braces. --- trunk/SecondLife/SecondLifeFunctions.cs | 121 ++++++++++++++---------- 1 file changed, 69 insertions(+), 52 deletions(-) diff --git a/trunk/SecondLife/SecondLifeFunctions.cs b/trunk/SecondLife/SecondLifeFunctions.cs index 9d3e208..0ecadc2 100644 --- a/trunk/SecondLife/SecondLifeFunctions.cs +++ b/trunk/SecondLife/SecondLifeFunctions.cs @@ -67,16 +67,18 @@ namespace LSLEditor public void llAddToLandBanList(key kID, Float fHours) { Verbose("llAddToLandBanList({0}, {1})", kID, fHours); - if (m_LandBanList.ContainsKey(kID)) + if (m_LandBanList.ContainsKey(kID)) { m_LandBanList.Remove(kID); + } m_LandBanList.Add(kID, fHours); } public void llAddToLandPassList(key kID, Float fHours) { Verbose("llAddToLandPassList({0}, {1})", kID, fHours); - if (m_LandPassList.ContainsKey(kID)) + if (m_LandPassList.ContainsKey(kID)) { m_LandPassList.Remove(kID); + } m_LandPassList.Add(kID, fHours); } @@ -386,8 +388,9 @@ namespace LSLEditor } list lResult = new list(); for (int intI = 0; intI < src.Count; intI++) { - if (src[intI] != null) + if (src[intI] != null) { lResult.Add(src[intI]); + } } Verbose(string.Format("llDeleteSubList({0}, {1}, {2})={3}", lSource.ToVerboseString(), iStart, iEnd, lResult.ToVerboseString())); return lResult; @@ -403,20 +406,24 @@ namespace LSLEditor if (CorrectIt(intLength, ref start, ref end)) { if (start <= end) { - for (int intI = start; intI <= end; intI++) + for (int intI = start; intI <= end; intI++) { src[intI] = '\0'; + } } else // excluding { - for (int intI = 0; intI <= end; intI++) + for (int intI = 0; intI <= end; intI++) { src[intI] = '\0'; - for (int intI = start; intI < intLength; intI++) + } + for (int intI = start; intI < intLength; intI++) { src[intI] = '\0'; + } } } StringBuilder result = new StringBuilder(); for (int intI = 0; intI < src.Length; intI++) { - if (src[intI] != '\0') + if (src[intI] != '\0') { result.Append(src[intI]); + } } Verbose(string.Format(@"llDeleteSubString(""{0}"", {1}, {2})=""{3}""", sSource, iStart, iEnd, result)); @@ -556,8 +563,9 @@ namespace LSLEditor { StringBuilder result = new StringBuilder(); for (int intI = 0; intI < lSource.Count; intI++) { - if (intI > 0) + if (intI > 0) { result.Append(sSeparator.ToString()); + } result.Append(lSource[intI].ToString()); } Verbose(@"llDumpList2String({0},""{1}"")=""{2}""", lSource.ToVerboseString(), sSeparator, result.ToString()); @@ -588,12 +596,11 @@ namespace LSLEditor byte[] data = Encoding.UTF8.GetBytes(sURL.ToString()); for (int intI = 0; intI < data.Length; intI++) { byte chrC = data[intI]; - if ((chrC >= 'a' && chrC <= 'z') || - (chrC >= 'A' && chrC <= 'Z') || - (chrC >= '0' && chrC <= '9')) + if ((chrC >= 'a' && chrC <= 'z') || (chrC >= 'A' && chrC <= 'Z') || (chrC >= '0' && chrC <= '9')) { sb.Append((char)chrC); - else + } else { sb.AppendFormat("%{0:X2}", (int)chrC); + } } Verbose(string.Format(@"EscapeURL(""{0}"")=""{1}""", sURL, sb.ToString())); return sb.ToString(); @@ -709,11 +716,11 @@ namespace LSLEditor public Float llGetAndResetTime() { // get time - double dTime = llGetTime(); - Verbose("llGetAndResetTime()=" + dTime); + double dblTime = llGetTime(); + Verbose("llGetAndResetTime()=" + dblTime); // reset time llResetTime(); - return dTime; + return dblTime; } public String llGetAnimation(key kID) @@ -976,11 +983,12 @@ namespace LSLEditor { integer iEntryType; - if (iIndex < 0) + if (iIndex < 0) { iIndex = lSource.Count + iIndex; - if (iIndex >= lSource.Count || iIndex < 0) + } + if (iIndex >= lSource.Count || iIndex < 0) { iEntryType = 0; - else { + } else { switch (lSource[iIndex].GetType().ToString().Replace("LSLEditor.SecondLife+", "")) { case "System.Double": case "Float": @@ -1096,8 +1104,9 @@ namespace LSLEditor { list lObjectDetails = new list(); for (int intI = 0; intI < lObjectFlags.Count; intI++) { - if (!(lObjectFlags[intI] is integer)) + if (!(lObjectFlags[intI] is integer)) { continue; + } switch ((int)(integer)lObjectFlags[intI]) { case OBJECT_NAME: lObjectDetails.Add((SecondLife.String)host.GetObjectName(new Guid(kID.guid))); @@ -1177,7 +1186,7 @@ namespace LSLEditor public key llGetOwnerKey(key kID) { - key kAvatarID = llGetOwner(); // This is incorrect, as the owner of this object may not be the owner of kID + key kAvatarID = llGetOwner(); // This is incorrect, as the owner of this object may not be the owner of kID Verbose("llGetOwnerKey({0})={1}", kID, kAvatarID); return kAvatarID; } @@ -1439,12 +1448,13 @@ namespace LSLEditor if (start <= end) { for (int intI = start; intI <= end; intI++) sResult.Append(src[intI]); - } else // excluding - { - for (int intI = 0; intI <= end; intI++) + } else {// excluding + for (int intI = 0; intI <= end; intI++) { sResult.Append(src[intI]); - for (int intI = start; intI < intLength; intI++) + } + for (int intI = start; intI < intLength; intI++) { sResult.Append(src[intI]); + } } } Verbose(string.Format(@"GetSubString(""{0}"", {1}, {2})=""{3}""", sSource, iStart, iEnd, sResult)); @@ -1615,15 +1625,15 @@ namespace LSLEditor public String llInsertString(String sDestination, integer iIndex, String sSource) { - string dst = sDestination; - string src = sSource; - int position = iIndex; + string strDestination = sDestination; + string strSource = sSource; + int intPosition = iIndex; string sResult; - if (position < dst.Length) { - sResult = dst.Substring(0, position) + src + dst.Substring(position); - } else if (position >= 0) { - sResult = dst + src; + if (intPosition < strDestination.Length) { + sResult = strDestination.Substring(0, intPosition) + strSource + strDestination.Substring(intPosition); + } else if (intPosition >= 0) { + sResult = strDestination + strSource; } else { sResult = "**ERROR**"; } @@ -1784,18 +1794,17 @@ namespace LSLEditor { int iLength = lSource.Count; - int start = iStart; - int end = iEnd; + int intStart = iStart; + int intEnd = iEnd; list lTemp = new list(); - if (CorrectIt(iLength, ref start, ref end)) { - if (start <= end) { - for (int intI = start; intI <= end; intI++) lTemp.Add(lSource[intI]); - } else // excluding - { - for (int intI = 0; intI <= end; intI++) lTemp.Add(lSource[intI]); - for (int intI = start; intI < iLength; intI++) lTemp.Add(lSource[intI]); + if (CorrectIt(iLength, ref intStart, ref intEnd)) { + if (intStart <= intEnd) { + for (int intI = intStart; intI <= intEnd; intI++) lTemp.Add(lSource[intI]); + } else { // excluding + for (int intI = 0; intI <= intEnd; intI++) lTemp.Add(lSource[intI]); + for (int intI = intStart; intI < iLength; intI++) lTemp.Add(lSource[intI]); } } list lResult = new list(); @@ -1803,13 +1812,13 @@ namespace LSLEditor if (iStride <= 0) { sRemark = " ** stride must be > 0 **"; } else { - if (start == 0) { + if (intStart == 0) { for (int intI = 0; intI < lTemp.Count; intI += iStride) lResult.Add(lTemp[intI]); } else { for (int intI = iStride - 1; intI < lTemp.Count; intI += iStride) lResult.Add(lTemp[intI]); } } - Verbose(@"llList2ListStrided({0}, {1}, {2}, {3})={4}{5}", lSource.ToVerboseString(), start, end, iStride, lResult.ToVerboseString(), sRemark); + Verbose(@"llList2ListStrided({0}, {1}, {2}, {3})={4}{5}", lSource.ToVerboseString(), intStart, intEnd, iStride, lResult.ToVerboseString(), sRemark); return lResult; } @@ -1890,8 +1899,9 @@ namespace LSLEditor { int intLength = lDestination.Count; list lResult = new list(); - if (iIndex < 0) + if (iIndex < 0) { iIndex = lDestination.Count + iIndex; + } for (int intI = 0; intI < Math.Min(iIndex, intLength); intI++) lResult.Add(lDestination[intI]); @@ -2131,8 +2141,9 @@ namespace LSLEditor System.Security.Cryptography.MD5 md5 = new System.Security.Cryptography.MD5CryptoServiceProvider(); byte[] hash = md5.ComputeHash(Encoding.ASCII.GetBytes(sSource + ":" + iNonce.ToString())); StringBuilder sbResult = new StringBuilder(); - foreach (byte hex in hash) + foreach (byte hex in hash) { sbResult.Append(hex.ToString("x2")); //convert to standard MD5 form + } Verbose("llMD5String({0}, {1})={2}", sSource, iNonce, sbResult); return sbResult.ToString(); } @@ -2565,13 +2576,14 @@ namespace LSLEditor if (m != 0) { double n = 2 * (rRotation.y * rRotation.s + rRotation.x * rRotation.z); double p = m * m - n * n; - if (p > 0) + if (p > 0) { vEuler = new vector(Math.Atan2(2.0 * (rRotation.x * rRotation.s - rRotation.y * rRotation.z), (-t.x - t.y + t.z + t.s)), Math.Atan2(n, Math.Sqrt(p)), Math.Atan2(2.0 * (rRotation.z * rRotation.s - rRotation.x * rRotation.y), (t.x - t.y - t.z + t.s))); - else if (n > 0) + } else if (n > 0) { vEuler = new vector(0, PI_BY_TWO, Math.Atan2((rRotation.z * rRotation.s + rRotation.x * rRotation.y), 0.5 - t.x - t.z)); - else + } else { vEuler = new vector(0, -PI_BY_TWO, Math.Atan2((rRotation.z * rRotation.s + rRotation.x * rRotation.y), 0.5 - t.x - t.z)); + } } Verbose("llRot2Euler({0})={1}", rRotation, vEuler); return vEuler; @@ -3207,10 +3219,11 @@ namespace LSLEditor for (int intI = 0; intI < data.Length; intI++) { byte chrC = data[intI]; if (chrC == (byte)'%') { - if (intI < (data.Length - 2)) + if (intI < (data.Length - 2)) { list.Add((byte) (HexToInt(data[intI + 1]) << 4 | HexToInt(data[intI + 2]))); + } intI += 2; } else { list.Add(chrC); @@ -3218,8 +3231,9 @@ namespace LSLEditor } data = list.ToArray(); int intLen = Array.IndexOf(data, (byte)0x0); - if (intLen < 0) + if (intLen < 0) { intLen = data.Length; + } string strTmp = Encoding.UTF8.GetString(data, 0, intLen); Verbose(string.Format(@"llUnescapeURL(""{0}"")=""{1}""", sURL, strTmp)); return strTmp; @@ -3306,14 +3320,17 @@ namespace LSLEditor string S1 = Base64ToString(sText1.ToString()); string S2 = Base64ToString(sText2.ToString()); int intLength = S1.Length; - if (S2.Length == 0) + if (S2.Length == 0) { S2 = " "; - while (S2.Length < intLength) + } + while (S2.Length < intLength) { S2 += S2; + } S2 = S2.Substring(0, intLength); StringBuilder sb = new StringBuilder(); - for (int intI = 0; intI < intLength; intI++) + for (int intI = 0; intI < intLength; intI++) { sb.Append((char)(S1[intI] ^ S2[intI])); + } string sResult = StringToBase64(sb.ToString()); Verbose(@"llXorBase64StringsCorrect(""{0}"",""{1}"")=""{2}""", sText1, sText2, sResult); return sResult; From af230cbed774a724b6de8ff9a482758985f1bc3f Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Sun, 14 Jul 2013 16:49:03 +0100 Subject: [PATCH 09/11] Fixing indentation and braces in trunk/ --- trunk/About.cs | 2 +- trunk/Browser.cs | 66 +-- trunk/EditForm.cs | 231 ++++----- trunk/FindWindow.cs | 182 +++---- trunk/GotoWindow.cs | 23 +- trunk/LSLEditorForm.cs | 855 +++++++++++++------------------ trunk/PermissionsForm.cs | 25 +- trunk/Properties/AssemblyInfo.cs | 4 +- trunk/RuntimeConsole.cs | 256 +++++---- trunk/SimulatorConsole.cs | 201 ++++---- trunk/UpdateApplicationForm.cs | 210 ++++---- trunk/llDialogForm.cs | 24 +- trunk/llTextBoxForm.cs | 63 ++- 13 files changed, 962 insertions(+), 1180 deletions(-) diff --git a/trunk/About.cs b/trunk/About.cs index d84bb2b..36b3bdc 100644 --- a/trunk/About.cs +++ b/trunk/About.cs @@ -74,7 +74,7 @@ namespace LSLEditor private void About_Load(object sender, EventArgs e) { string strExeFileName = Path.GetFileName(Assembly.GetExecutingAssembly().CodeBase); - this.webBrowser1.Navigate("res://" + strExeFileName + "/"+ Properties.Settings.Default.About); + this.webBrowser1.Navigate("res://" + strExeFileName + "/" + Properties.Settings.Default.About); } } } \ No newline at end of file diff --git a/trunk/Browser.cs b/trunk/Browser.cs index 17d756b..f8b1573 100644 --- a/trunk/Browser.cs +++ b/trunk/Browser.cs @@ -69,46 +69,37 @@ namespace LSLEditor { WebBrowser axWebBrowser1 = sender as WebBrowser; ToolStripStatusLabel status = axWebBrowser1.Tag as ToolStripStatusLabel; - if (status == null) - return; - status.Text = axWebBrowser1.StatusText; + if (status != null) { + status.Text = axWebBrowser1.StatusText; + } } - private void axWebBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e) { string strUrl = e.Url.ToString(); - if (strUrl.EndsWith(".lsl")) - { + if (strUrl.EndsWith(".lsl")) { e.Cancel = true; - if (MessageBox.Show("Import LSL script?", "Import script", MessageBoxButtons.OKCancel) == DialogResult.Cancel) - return; + if (MessageBox.Show("Import LSL script?", "Import script", MessageBoxButtons.OKCancel) != DialogResult.Cancel) { + WebBrowser axWebBrowser1 = sender as WebBrowser; + axWebBrowser1.Stop(); - WebBrowser axWebBrowser1 = sender as WebBrowser; - axWebBrowser1.Stop(); - - this.lslEditorForm.OpenFile(strUrl,Guid.NewGuid()); + this.lslEditorForm.OpenFile(strUrl, Guid.NewGuid()); + } } } public void ShowWebBrowser(string strTabName, string strUrl) { WebBrowser axWebBrowser1 = null; - try - { - if (!Properties.Settings.Default.HelpNewTab) - { + try { + if (!Properties.Settings.Default.HelpNewTab) { TabPage tabPage = this.tabControl1.TabPages[0]; tabPage.Text = strTabName + " "; axWebBrowser1 = tabPage.Controls[0] as WebBrowser; } - } - catch - { - } + } catch { } - if (axWebBrowser1 == null) - { + if (axWebBrowser1 == null) { TabPage tabPage = new TabPage(strTabName + " "); tabPage.BackColor = Color.White; @@ -117,7 +108,7 @@ namespace LSLEditor ToolStripStatusLabel toolStripStatusLabel1 = new ToolStripStatusLabel(); StatusStrip statusStrip1 = new StatusStrip(); - statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { toolStripStatusLabel1}); + statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { toolStripStatusLabel1 }); statusStrip1.Location = new System.Drawing.Point(0, 318); statusStrip1.Name = "statusStrip1"; statusStrip1.Size = new System.Drawing.Size(584, 22); @@ -148,29 +139,26 @@ namespace LSLEditor private void closeToolStripMenuItem_Click(object sender, EventArgs e) { int intTabToClose = (int)this.contextMenuStrip1.Tag; - if (intTabToClose >= this.tabControl1.TabCount) - return; - this.tabControl1.TabPages.RemoveAt(intTabToClose); + if (intTabToClose < this.tabControl1.TabCount) { + this.tabControl1.TabPages.RemoveAt(intTabToClose); + } } private void tabControl1_MouseDown(object sender, MouseEventArgs e) { TabControl tabControl = sender as TabControl; - if (tabControl == null) - return; - if (e.Button == MouseButtons.Right) - { - for (int intI = 0; intI < tabControl.TabCount; intI++) - { - Rectangle rt = tabControl.GetTabRect(intI); - if (e.X > rt.Left && e.X < rt.Right - && e.Y > rt.Top && e.Y < rt.Bottom) - { - this.contextMenuStrip1.Tag = intI; - this.contextMenuStrip1.Show(this.tabControl1, new Point(e.X, e.Y)); + if (tabControl != null) { + if (e.Button == MouseButtons.Right) { + for (int intI = 0; intI < tabControl.TabCount; intI++) { + Rectangle rt = tabControl.GetTabRect(intI); + if (e.X > rt.Left && e.X < rt.Right + && e.Y > rt.Top && e.Y < rt.Bottom) { + this.contextMenuStrip1.Tag = intI; + this.contextMenuStrip1.Show(this.tabControl1, new Point(e.X, e.Y)); + } } } } } } -} \ No newline at end of file +} diff --git a/trunk/EditForm.cs b/trunk/EditForm.cs index a69dabd..e30436d 100644 --- a/trunk/EditForm.cs +++ b/trunk/EditForm.cs @@ -65,18 +65,14 @@ namespace LSLEditor private const int WM_NCACTIVATE = 0x0086; protected override void WndProc(ref Message m) { - if (m.Msg == WM_NCACTIVATE) - { - if (m.LParam != IntPtr.Zero) - { + if (m.Msg == WM_NCACTIVATE) { + if (m.LParam != IntPtr.Zero) { m.WParam = new IntPtr(1); - } - else - { + } else { this.numberedTextBoxUC1.TextBox.MakeAllInvis(); } } - try { base.WndProc(ref m); } catch {} + try { base.WndProc(ref m); } catch { } } public SyntaxRichTextBox TextBox @@ -123,10 +119,11 @@ namespace LSLEditor } set { - if(value) + if (value) { this.tabPage1.Text = "Script"; - else + } else { this.tabPage1.Text = "Text"; + } this.TextBox.ToolTipping = value; } } @@ -160,12 +157,9 @@ namespace LSLEditor imageList.Images.Add(new Bitmap(this.GetType(), "Images.States.gif")); this.tvOutline.ImageList = imageList; - if (lslEditorForm.outlineToolStripMenuItem.Checked) - { + if (lslEditorForm.outlineToolStripMenuItem.Checked) { splitContainer1.Panel2Collapsed = false; - } - else - { + } else { splitContainer1.Panel2Collapsed = true; } SetFont(); @@ -178,8 +172,9 @@ namespace LSLEditor void EditForm_Layout(object sender, LayoutEventArgs e) { - if (this.WindowState == FormWindowState.Minimized) + if (this.WindowState == FormWindowState.Minimized) { this.numberedTextBoxUC1.TextBox.MakeAllInvis(); + } } void EditForm_Position(object sender, EventArgs e) @@ -190,13 +185,15 @@ namespace LSLEditor void TextBox_OnDirtyChanged(object sender, EventArgs e) { this.Text = this.ScriptName; - if (this.numberedTextBoxUC1.TextBox.Dirty) - this.Text = this.Text.Trim()+"* "; - else - this.Text = this.Text.Trim()+" "; + if (this.numberedTextBoxUC1.TextBox.Dirty) { + this.Text = this.Text.Trim() + "* "; + } else { + this.Text = this.Text.Trim() + " "; + } TabPage tabPage = this.Tag as TabPage; - if (tabPage != null) + if (tabPage != null) { tabPage.Text = this.Text; + } this.parent.OnDirtyChanged(this.numberedTextBoxUC1.TextBox.Dirty); } @@ -216,20 +213,19 @@ namespace LSLEditor { this.m_FullPathName = value; string strDirectory = Path.GetDirectoryName(this.m_FullPathName); - if (Directory.Exists(strDirectory)) - { + if (Directory.Exists(strDirectory)) { Properties.Settings.Default.WorkingDirectory = strDirectory; - } - else - { - if(!Directory.Exists(Properties.Settings.Default.WorkingDirectory)) + } else { + if (!Directory.Exists(Properties.Settings.Default.WorkingDirectory)) { Properties.Settings.Default.WorkingDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); + } this.m_FullPathName = Path.Combine(Properties.Settings.Default.WorkingDirectory, this.m_FullPathName); } this.Text = this.ScriptName; TabPage tabPage = this.Tag as TabPage; - if (tabPage != null) + if (tabPage != null) { tabPage.Text = this.Text + " "; + } } } @@ -263,53 +259,50 @@ namespace LSLEditor private int PercentageIndentTab() { + int intResult; int intSpaces = 0; int intTabs = 0; StringReader sr = new StringReader(this.TextBox.Text); - while (true) - { + while (true) { string strLine = sr.ReadLine(); - if (strLine == null) - break; - if (strLine.Length == 0) - continue; - if (strLine[0] == ' ') + if (strLine == null) break; + if (strLine.Length == 0) continue; + if (strLine[0] == ' ') { intSpaces++; - else if (strLine[0] == '\t') + } else if (strLine[0] == '\t') { intTabs++; + } } - if (intTabs == 0 && intSpaces==0) - return 50; - return (int)Math.Round((100.0 * intTabs) / (intTabs + intSpaces)); + if (intTabs == 0 && intSpaces == 0) { + intResult = 50; + } else { + intResult = (int)Math.Round((100.0 * intTabs) / (intTabs + intSpaces)); + } + return intResult; } public void LoadFile(string strPath) { - if(strPath.StartsWith("http://")) + if (strPath.StartsWith("http://")) { this.FullPathName = Path.GetFileName(strPath); - else + } else { this.FullPathName = strPath; + } this.encodedAs = this.numberedTextBoxUC1.TextBox.LoadFile(strPath); - if (!this.IsScript) - return; + if (this.IsScript) { - if (Properties.Settings.Default.IndentAutoCorrect) - { - this.TextBox.FormatDocument(); - this.TextBox.ClearUndoStack(); - } - else - { - if (Properties.Settings.Default.IndentWarning) - { - if ((PercentageIndentTab() > 50 && Properties.Settings.Default.SL4SpacesIndent) || - (PercentageIndentTab() < 50 && !Properties.Settings.Default.SL4SpacesIndent)) - { - if (MessageBox.Show("Indent scheme differs from settings\nDo you want to correct it?\nIt can also be corrected by pressing Ctrl-D or turn on Autocorrection (tools menu)", "Indent Warning!!", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) - { - this.TextBox.FormatDocument(); - //this.TextBox.ClearUndoStack(); + if (Properties.Settings.Default.IndentAutoCorrect) { + this.TextBox.FormatDocument(); + this.TextBox.ClearUndoStack(); + } else { + if (Properties.Settings.Default.IndentWarning) { + if ((PercentageIndentTab() > 50 && Properties.Settings.Default.SL4SpacesIndent) || + (PercentageIndentTab() < 50 && !Properties.Settings.Default.SL4SpacesIndent)) { + if (MessageBox.Show("Indent scheme differs from settings\nDo you want to correct it?\nIt can also be corrected by pressing Ctrl-D or turn on Autocorrection (tools menu)", "Indent Warning!!", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) { + this.TextBox.FormatDocument(); + //this.TextBox.ClearUndoStack(); + } } } } @@ -320,10 +313,8 @@ namespace LSLEditor { this.FullPathName = strPath; Encoding encodeAs = this.encodedAs; - if (this.IsScript && encodeAs == null) - { - switch (Properties.Settings.Default.OutputFormat) - { + if (this.IsScript && encodeAs == null) { + switch (Properties.Settings.Default.OutputFormat) { case "UTF8": encodeAs = Encoding.UTF8; break; @@ -337,9 +328,7 @@ namespace LSLEditor encodeAs = Encoding.Default; break; } - } - else if (encodeAs == null) - { + } else if (encodeAs == null) { encodeAs = Encoding.UTF8; } @@ -381,16 +370,15 @@ namespace LSLEditor { this.numberedTextBoxUC1.TextBox.MakeAllInvis(); - if (runtime != null) - { + if (runtime != null) { this.components.Remove(runtime); - if (!runtime.IsDisposed) + if (!runtime.IsDisposed) { runtime.Dispose(); + } runtime = null; } - - for (int intI = this.tabControl1.TabPages.Count - 1; intI > 0; intI--) - { + + for (int intI = this.tabControl1.TabPages.Count - 1; intI > 0; intI--) { this.tabControl1.TabPages.RemoveAt(intI); } } @@ -400,65 +388,62 @@ namespace LSLEditor public bool StartCompiler() { + bool blnResult = false; //if (this.disableCompilesyntaxCheckToolStripMenuItem.Checked) // return false; - if (!this.IsScript) - return false; + if (this.IsScript) { + StopCompiler(); - StopCompiler(); + if (this.parent != null) { + runtime = new RuntimeConsole(this.parent); - if (this.parent == null) - return false; + // for disposing + this.components.Add(runtime); - runtime = new RuntimeConsole(this.parent); + if (!runtime.Compile(this)) { + this.tabControl1.SelectedIndex = 0; + return false; + } - // for disposing - this.components.Add(runtime); - - if (!runtime.Compile(this)) - { - this.tabControl1.SelectedIndex = 0; - return false; + TabPage tabPage = new TabPage("Debug"); + tabPage.Controls.Add(runtime); + this.tabControl1.TabPages.Add(tabPage); + this.tabControl1.SelectedIndex = 1; + blnResult = true; + } } - - TabPage tabPage = new TabPage("Debug"); - tabPage.Controls.Add(runtime); - this.tabControl1.TabPages.Add(tabPage); - this.tabControl1.SelectedIndex = 1; - return true; + return blnResult; } public bool SyntaxCheck() { + bool blnResult = false; //if (this.disableCompilesyntaxCheckToolStripMenuItem.Checked) // return false; - if (!this.IsScript) - return false; + if (this.IsScript) { + LSL2CSharp translator = new LSL2CSharp(ConfLSL); + string strCSharp = translator.Parse(SourceCode); - LSL2CSharp translator = new LSL2CSharp(ConfLSL); - string strCSharp = translator.Parse(SourceCode); + if (System.Diagnostics.Debugger.IsAttached) { + for (int intI = this.tabControl1.TabPages.Count - 1; intI > 0; intI--) { + this.tabControl1.TabPages.RemoveAt(intI); + } - if (System.Diagnostics.Debugger.IsAttached) - { - for (int intI = this.tabControl1.TabPages.Count - 1; intI > 0; intI--) - { - this.tabControl1.TabPages.RemoveAt(intI); + // TODO + TabPage tabPage = new TabPage("C#"); + NumberedTextBox.NumberedTextBoxUC numberedTextBoxUC1 = new NumberedTextBox.NumberedTextBoxUC(); + numberedTextBoxUC1.TextBox.Init(null, this.ConfCSharp); + numberedTextBoxUC1.TextBox.Text = strCSharp; + numberedTextBoxUC1.TextBox.ReadOnly = true; + numberedTextBoxUC1.Dock = DockStyle.Fill; + tabPage.Controls.Add(numberedTextBoxUC1); + this.tabControl.TabPages.Add(tabPage); } - - // TODO - TabPage tabPage = new TabPage("C#"); - NumberedTextBox.NumberedTextBoxUC numberedTextBoxUC1 = new NumberedTextBox.NumberedTextBoxUC(); - numberedTextBoxUC1.TextBox.Init(null, this.ConfCSharp); - numberedTextBoxUC1.TextBox.Text = strCSharp; - numberedTextBoxUC1.TextBox.ReadOnly = true; - numberedTextBoxUC1.Dock = DockStyle.Fill; - tabPage.Controls.Add(numberedTextBoxUC1); - this.tabControl.TabPages.Add(tabPage); + blnResult = (null != CompilerHelper.CompileCSharp(this, strCSharp)); } - - return (null != CompilerHelper.CompileCSharp(this, strCSharp)); + return blnResult; } public int Find(string strSearch, int intStart, int intEnd, RichTextBoxFinds options) @@ -476,13 +461,13 @@ namespace LSLEditor private void EditForm_FormClosing(object sender, FormClosingEventArgs e) { this.parent.CancelClosing = false; - if (this.Dirty) - { + if (this.Dirty) { DialogResult dialogResult = MessageBox.Show(this, @"Save """ + this.ScriptName + @"""?", "File has changed", MessageBoxButtons.YesNoCancel); - if (dialogResult == DialogResult.Yes) - e.Cancel = !this.parent.SaveFile(this,false); - else + if (dialogResult == DialogResult.Yes) { + e.Cancel = !this.parent.SaveFile(this, false); + } else { e.Cancel = (dialogResult == DialogResult.Cancel); + } } this.parent.CancelClosing = e.Cancel; } @@ -497,11 +482,9 @@ namespace LSLEditor this.parent.BeginInvoke(new TreeNodeMouseClickEventHandler( delegate(object sender2, TreeNodeMouseClickEventArgs e2) { - if (e.Node.Tag is Helpers.OutlineHelper) - { + if (e.Node.Tag is Helpers.OutlineHelper) { Helpers.OutlineHelper ohOutline = (Helpers.OutlineHelper)e.Node.Tag; - if (ohOutline.line < this.TextBox.Lines.Length) - { + if (ohOutline.line < this.TextBox.Lines.Length) { //editForm.Focus(); //editForm.TextBox.Select(); //editForm.TextBox.Goto(ohOutline.line + 1); @@ -509,7 +492,7 @@ namespace LSLEditor //TextBox.Focus(); this.TextBox.Select(); this.TextBox.SelectionStart = this.TextBox.GetFirstCharIndexFromLine(ohOutline.line); - + } } @@ -518,7 +501,7 @@ namespace LSLEditor private void tvOutline_AfterSelect(object sender, TreeViewEventArgs e) { - + //this.TextBox.Select } @@ -532,4 +515,4 @@ namespace LSLEditor this.tvOutline.ExpandAll(); } } -} \ No newline at end of file +} diff --git a/trunk/FindWindow.cs b/trunk/FindWindow.cs index e50325f..b0260dc 100644 --- a/trunk/FindWindow.cs +++ b/trunk/FindWindow.cs @@ -89,14 +89,12 @@ namespace LSLEditor set { this.label1.Text = ""; // clear out message - if (value != "") - { + if (value != "") { this.comboBoxFind.Text = value; - } - else - { - if (this.comboBoxFind.Items.Count > 0) + } else { + if (this.comboBoxFind.Items.Count > 0) { this.comboBoxFind.SelectedIndex = this.comboBoxFind.Items.Count - 1; + } } } } @@ -106,17 +104,16 @@ namespace LSLEditor string strText = comboBox.Text; bool Found = false; - foreach (string strC in comboBox.Items) - { - if (strC == strText) - { + foreach (string strC in comboBox.Items) { + if (strC == strText) { Found = true; break; } } - if (!Found) + if (!Found) { comboBox.Items.Add(strText); + } return Found; } @@ -124,40 +121,35 @@ namespace LSLEditor { this.label1.Text = ""; EditForm editForm = this.lslEditForm.ActiveMdiForm as EditForm; - if (editForm == null) - return; + if (editForm != null) { + if (!UpdateComboBox(this.comboBoxFind)) { + editForm.TextBox.SelectionLength = 0; + editForm.TextBox.SelectionStart = 0; + } - if (!UpdateComboBox(this.comboBoxFind)) - { - editForm.TextBox.SelectionLength = 0; - editForm.TextBox.SelectionStart = 0; - } + RichTextBoxFinds options = RichTextBoxFinds.None; - RichTextBoxFinds options = RichTextBoxFinds.None; + if (this.checkBoxMatchCase.Checked) options |= RichTextBoxFinds.MatchCase; + if (this.checkBoxReverse.Checked) options |= RichTextBoxFinds.Reverse; + if (this.checkBoxWholeWord.Checked) options |= RichTextBoxFinds.WholeWord; - if (this.checkBoxMatchCase.Checked) options |= RichTextBoxFinds.MatchCase; - if (this.checkBoxReverse.Checked) options |= RichTextBoxFinds.Reverse; - if (this.checkBoxWholeWord.Checked) options |= RichTextBoxFinds.WholeWord; + if (this.checkBoxReverse.Checked) { + intStart = 0; // start cant change ;-) + intEnd = editForm.TextBox.SelectionStart; + } else { + intStart = editForm.TextBox.SelectionStart + editForm.TextBox.SelectionLength; + if (intStart == editForm.TextBox.Text.Length) { + intStart = 0; + } + intEnd = editForm.TextBox.Text.Length - 1; // length can change!! + } - if (this.checkBoxReverse.Checked) - { - intStart = 0; // start cant change ;-) - intEnd = editForm.TextBox.SelectionStart; - } - else - { - intStart = editForm.TextBox.SelectionStart + editForm.TextBox.SelectionLength; - if (intStart == editForm.TextBox.Text.Length) - intStart = 0; - intEnd = editForm.TextBox.Text.Length - 1; // length can change!! - } - - string strFind = this.comboBoxFind.Text; - int intIndex = editForm.Find(strFind, intStart, intEnd, options); - if (intIndex < 0) - { - this.label1.Text = "Not found..."; - return; + string strFind = this.comboBoxFind.Text; + int intIndex = editForm.Find(strFind, intStart, intEnd, options); + if (intIndex < 0) { + this.label1.Text = "Not found..."; + return; + } } } @@ -169,15 +161,11 @@ namespace LSLEditor private void comboBoxFind_KeyDown(object sender, KeyEventArgs e) { - if (e.KeyCode == Keys.Return) - { - if (this.Replace.Enabled) - { + if (e.KeyCode == Keys.Return) { + if (this.Replace.Enabled) { this.comboBoxReplace.Focus(); e.SuppressKeyPress = true; - } - else - { + } else { Find(); e.SuppressKeyPress = true; } @@ -187,30 +175,26 @@ namespace LSLEditor private void Replace_Click(object sender, EventArgs e) { EditForm editForm = this.lslEditForm.ActiveMdiForm as EditForm; - if (editForm == null) - return; + if (editForm != null) { + UpdateComboBox(this.comboBoxReplace); - UpdateComboBox(this.comboBoxReplace); + if (editForm.TextBox.SelectionLength > 0) { + string strReplacement = this.comboBoxReplace.Text; + editForm.TextBox.ReplaceSelectedText(strReplacement); + } - if (editForm.TextBox.SelectionLength > 0) - { - string strReplacement = this.comboBoxReplace.Text; - editForm.TextBox.ReplaceSelectedText(strReplacement); + Find(); + this.Focus(); } - - Find(); - this.Focus(); } // WildCardToRegex not used!! private string WildCardToRegex(string strWildCard) { StringBuilder sb = new StringBuilder(strWildCard.Length + 8); - for (int intI = 0; intI < strWildCard.Length; intI++) - { + for (int intI = 0; intI < strWildCard.Length; intI++) { char chrC = strWildCard[intI]; - switch (chrC) - { + switch (chrC) { case '*': sb.Append(".*"); break; @@ -233,42 +217,41 @@ namespace LSLEditor private void ReplaceAll_Click(object sender, EventArgs e) { EditForm editForm = this.lslEditForm.ActiveMdiForm as EditForm; - if (editForm == null) - return; + if (editForm == null) { + UpdateComboBox(this.comboBoxReplace); - UpdateComboBox(this.comboBoxReplace); + string strPattern; + string strFind = Regex.Escape(this.comboBoxFind.Text); + string strReplacement = this.comboBoxReplace.Text; + string strSourceCode = editForm.SourceCode; - string strPattern; - string strFind = Regex.Escape(this.comboBoxFind.Text); - string strReplacement = this.comboBoxReplace.Text; - string strSourceCode = editForm.SourceCode; + RegexOptions regexOptions = RegexOptions.Compiled; + if (!this.checkBoxMatchCase.Checked) { + regexOptions |= RegexOptions.IgnoreCase; + } + if (this.checkBoxWholeWord.Checked) { + strPattern = @"\b" + strFind + @"\b"; + } else { + strPattern = strFind; + } - RegexOptions regexOptions = RegexOptions.Compiled; - if (!this.checkBoxMatchCase.Checked) - regexOptions |= RegexOptions.IgnoreCase; - if (this.checkBoxWholeWord.Checked) - strPattern = @"\b" + strFind + @"\b"; - else - strPattern = strFind; + Regex regex = new Regex(strPattern, regexOptions); - Regex regex = new Regex(strPattern, regexOptions); - - int intCount = 0; - foreach(Match m in regex.Matches(strSourceCode)) - { - if (m.Value.Length > 0) - intCount++; + int intCount = 0; + foreach (Match m in regex.Matches(strSourceCode)) { + if (m.Value.Length > 0) { + intCount++; + } + } + if (intCount == 0) { + MessageBox.Show("No matches found"); + } else { + if (MessageBox.Show("There are " + intCount + " occurences, replace them all?", "Find and Replace", MessageBoxButtons.YesNoCancel) == DialogResult.Yes) { + editForm.SourceCode = regex.Replace(strSourceCode, strReplacement); + } + } + this.Focus(); } - if (intCount == 0) - { - MessageBox.Show("No matches found"); - } - else - { - if (MessageBox.Show("There are " + intCount + " occurences, replace them all?", "Find and Replace", MessageBoxButtons.YesNoCancel) == DialogResult.Yes) - editForm.SourceCode = regex.Replace(strSourceCode, strReplacement); - } - this.Focus(); } private void FindWindow_FormClosing(object sender, FormClosingEventArgs e) @@ -281,22 +264,19 @@ namespace LSLEditor private void FindWindow_KeyDown(object sender, KeyEventArgs e) { - if (e.KeyData == Keys.Escape) - { + if (e.KeyData == Keys.Escape) { this.Visible = false; e.SuppressKeyPress = true; e.Handled = true; } - if (e.KeyCode == Keys.Return) - { + if (e.KeyCode == Keys.Return) { Find(); e.SuppressKeyPress = true; this.Focus(); } - if (e.KeyCode == Keys.F3) - { + if (e.KeyCode == Keys.F3) { Find(); e.SuppressKeyPress = true; this.Focus(); @@ -309,7 +289,5 @@ namespace LSLEditor { this.comboBoxFind.Focus(); } - - } -} \ No newline at end of file +} diff --git a/trunk/GotoWindow.cs b/trunk/GotoWindow.cs index f431384..d69b693 100644 --- a/trunk/GotoWindow.cs +++ b/trunk/GotoWindow.cs @@ -56,7 +56,7 @@ namespace LSLEditor this.lslEditForm = lslEditForm; EditForm editForm = this.lslEditForm.ActiveMdiForm as EditForm; - this.label1.Text = "Line number (1-"+editForm.TextBox.Lines.Length+")"; + this.label1.Text = "Line number (1-" + editForm.TextBox.Lines.Length + ")"; } private void button1_Click(object sender, EventArgs e) @@ -67,16 +67,12 @@ namespace LSLEditor private void Goto() { EditForm editForm = this.lslEditForm.ActiveMdiForm as EditForm; - if (editForm == null) - return; - try - { - int intLine = Convert.ToInt32(this.textBox1.Text); - editForm.TextBox.Goto(intLine); - this.Close(); - } - catch - { + if (editForm != null) { + try { + int intLine = Convert.ToInt32(this.textBox1.Text); + editForm.TextBox.Goto(intLine); + this.Close(); + } catch { } } } @@ -87,12 +83,11 @@ namespace LSLEditor private void textBox1_KeyDown(object sender, KeyEventArgs e) { - if (e.KeyCode == Keys.Return) - { + if (e.KeyCode == Keys.Return) { Goto(); e.SuppressKeyPress = true; } } } -} \ No newline at end of file +} diff --git a/trunk/LSLEditorForm.cs b/trunk/LSLEditorForm.cs index 085be90..da23a30 100644 --- a/trunk/LSLEditorForm.cs +++ b/trunk/LSLEditorForm.cs @@ -69,7 +69,6 @@ using LSLEditor.Docking; // At the bottom of the form there are - // 1) tabcontrol1 , holding tabbed documents // 2) splitter1, for increasing simulator window // 3) panel1 , holding simulator or listview for compiler errors @@ -114,16 +113,12 @@ namespace LSLEditor private const int WM_NCACTIVATE = 0x0086; protected override void WndProc(ref Message m) { - if (m.Msg == WM_NCACTIVATE) - { - if (m.LParam != IntPtr.Zero) - { + if (m.Msg == WM_NCACTIVATE) { + if (m.LParam != IntPtr.Zero) { m.WParam = new IntPtr(1); } - } - else - { - try { curProc.MaxWorkingSet = curProc.MaxWorkingSet; } catch {} + } else { + try { curProc.MaxWorkingSet = curProc.MaxWorkingSet; } catch { } } base.WndProc(ref m); } @@ -138,15 +133,18 @@ namespace LSLEditor private void SetDefaultProperties() { - if (Properties.Settings.Default.FontEditor == null) + if (Properties.Settings.Default.FontEditor == null) { Properties.Settings.Default.FontEditor = new Font("Courier New", 9.75F, FontStyle.Regular); + } - if (Properties.Settings.Default.FontTooltips == null) + if (Properties.Settings.Default.FontTooltips == null) { Properties.Settings.Default.FontTooltips = new Font(SystemFonts.MessageBoxFont.Name, 9.75F, FontStyle.Regular); + } string strLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); - if (Properties.Settings.Default.ProjectLocation == "") + if (Properties.Settings.Default.ProjectLocation == "") { Properties.Settings.Default.ProjectLocation = strLocation; + } } public LSLEditorForm(string[] args) @@ -154,17 +152,14 @@ namespace LSLEditor Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", false); Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US", false); - if (args.Length == 1) - { - if (args[0] == "/reset") - { + if (args.Length == 1) { + if (args[0] == "/reset") { Properties.Settings.Default.Reset(); Properties.Settings.Default.CallUpgrade = false; } } - if (Properties.Settings.Default.CallUpgrade) - { + if (Properties.Settings.Default.CallUpgrade) { Properties.Settings.Default.Upgrade(); Properties.Settings.Default.CallUpgrade = false; } @@ -185,12 +180,9 @@ namespace LSLEditor SetupChildForms(); - try - { + try { Start(args); - } - catch (Exception exception) - { + } catch (Exception exception) { MessageBox.Show("Error: " + OopsFormatter.ApplyFormatting(exception.Message), "Oops"); } } @@ -199,11 +191,12 @@ namespace LSLEditor { get { - if (this.IsMdiContainer) + if (this.IsMdiContainer) { return this.MdiChildren; + } List
children = new List(); - //TODO: Find Child forms + //TODO: Find Child forms //foreach (TabPage tabPage in this.tabControlExtended1.TabPages) // children.Add(tabPage.Tag as Form); return children.ToArray(); @@ -214,28 +207,26 @@ namespace LSLEditor { get { - if (this.IsMdiContainer) - return this.ActiveMdiChild; - else - { + Form form = null; + if (this.IsMdiContainer) { + form = this.ActiveMdiChild; + } else { //TODO: Get Active Mdi Form - return null; + //return null; //dockPanel.ActiveContent - // if (this.tabControlExtended1.SelectedTab == null) - // return null; - // return this.tabControlExtended1.SelectedTab.Tag as Form; + // if (this.tabControlExtended1.SelectedTab == null) + // return null; + // return this.tabControlExtended1.SelectedTab.Tag as Form; } + return form; } } public void ActivateMdiForm(Form form) { - if (this.IsMdiContainer) - { + if (this.IsMdiContainer) { this.ActivateMdiChild(form); - } - else - { + } else { //TODO: Activate the right Mdi Form /*for (int intI = 0; intI < this.tabControlExtended1.TabCount; intI++) { @@ -253,8 +244,7 @@ namespace LSLEditor public void AddForm(DockContent form) { - if (this.IsMdiContainer) - { + if (this.IsMdiContainer) { //form.MdiParent = this; //form.Tag = null; //form.Show(); @@ -262,12 +252,7 @@ namespace LSLEditor //TODO: add form in the right way form.Show(dockPanel); - } - else - { - - - + } else { //form.Visible = false; //form.MdiParent = null; //TabPage tabPage = new TabPage(form.Text+" "); @@ -330,14 +315,12 @@ namespace LSLEditor Version version = Assembly.GetExecutingAssembly().GetName().Version; this.Text += " " + version.Major + "." + version.Minor; - if (System.Diagnostics.Debugger.IsAttached) - { + if (System.Diagnostics.Debugger.IsAttached) { this.Text += " (ALPHA)"; - } - else - { - if (Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().Location).Contains("beta")) + } else { + if (Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().Location).Contains("beta")) { this.Text += " (BETA)"; + } } //TODO: Fix close buttons on tabs @@ -345,29 +328,18 @@ namespace LSLEditor //this.tabControlExtended1.SetDrawMode(); //this.tabControlExtended1.OnTabClose += new EventHandler(tabControl1_OnTabClose); - if (args.Length == 0) - { + if (args.Length == 0) { NewFile(); - } - else - { - if (args[0] == "/reset") - { + } else { + if (args[0] == "/reset") { NewFile(); - } - else - { - if (Path.GetExtension(args[0]) == ".sol") - { + } else { + if (Path.GetExtension(args[0]) == ".sol") { this.SolutionExplorer.OpenSolution(args[0]); - } - else - { + } else { bool blnRun = false; - foreach (string strFileName in args) - { - if (strFileName == "/run") - { + foreach (string strFileName in args) { + if (strFileName == "/run") { blnRun = true; continue; } @@ -376,8 +348,7 @@ namespace LSLEditor editForm.TextBox.OnCursorPositionChanged += new SyntaxRichTextBox.CursorPositionChangedHandler(TextBox_OnCursorPositionChanged); AddForm(editForm); } - if (blnRun) - { + if (blnRun) { this.stopToolStripMenuItem.Enabled = true; StartSimulator(); } @@ -394,10 +365,11 @@ namespace LSLEditor private XmlDocument GetXmlFromResource(string strName) { XmlDocument xml = new XmlDocument(); - Stream resource = Assembly.GetExecutingAssembly().GetManifestResourceStream(this.GetType().Namespace + "."+strName); + Stream resource = Assembly.GetExecutingAssembly().GetManifestResourceStream(this.GetType().Namespace + "." + strName); - if (resource != null) + if (resource != null) { xml.Load(resource); + } return xml; } @@ -425,18 +397,16 @@ namespace LSLEditor public EditForm OpenFile(string strPath, Guid guid, bool blnIsScript) { EditForm editForm = null; - if (this.Children.Length > 0) - { + if (this.Children.Length > 0) { editForm = this.Children[0] as EditForm; - if (editForm != null && !editForm.IsDisposed) - { - if (editForm.ScriptName != Properties.Settings.Default.ExampleName || editForm.Dirty) + if (editForm != null && !editForm.IsDisposed) { + if (editForm.ScriptName != Properties.Settings.Default.ExampleName || editForm.Dirty) { editForm = null; + } } } - if (editForm == null) - { + if (editForm == null) { editForm = new EditForm(this); editForm.TextBox.OnCursorPositionChanged += new SyntaxRichTextBox.CursorPositionChangedHandler(TextBox_OnCursorPositionChanged); AddForm(editForm); @@ -461,33 +431,34 @@ namespace LSLEditor private void OpenFile(string strFileName) { - OpenFile(strFileName, Guid.Empty , true); + OpenFile(strFileName, Guid.Empty, true); } private string ClippedPath(string strPath) { - if (strPath.Length < Properties.Settings.Default.PathClipLength) - return strPath; - - string strRoot = Path.GetPathRoot(strPath); - string strTmp = ""; - while (strTmp.Length < Properties.Settings.Default.PathClipLength) - { - strTmp = Path.Combine(Path.GetFileName(strPath) , strTmp); - strPath = Path.GetDirectoryName(strPath); - if (strPath == strRoot || strPath == null) - break; + string strResult = strPath; + if (Properties.Settings.Default.PathClipLength < strPath.Length) { + string strRoot = Path.GetPathRoot(strPath); + string strTmp = ""; + while (strTmp.Length < Properties.Settings.Default.PathClipLength) { + strTmp = Path.Combine(Path.GetFileName(strPath), strTmp); + strPath = Path.GetDirectoryName(strPath); + if (strPath == strRoot || strPath == null) { + break; + } + } + strResult = Path.Combine(Path.Combine(strRoot, "..."), strTmp); } - return Path.Combine(Path.Combine(strRoot, "..."), strTmp); + return strPath; } private void InitRecentFileList() { - if (Properties.Settings.Default.RecentFileList == null) + if (Properties.Settings.Default.RecentFileList == null) { Properties.Settings.Default.RecentFileList = new System.Collections.Specialized.StringCollection(); + } int intLen = Properties.Settings.Default.RecentFileList.Count; - for (int intI = 0; intI < intLen; intI++) - { + for (int intI = 0; intI < intLen; intI++) { ToolStripMenuItem tsmi = new ToolStripMenuItem(ClippedPath(Properties.Settings.Default.RecentFileList[intI])); tsmi.Tag = Properties.Settings.Default.RecentFileList[intI]; this.recentFileToolStripMenuItem.DropDownItems.Add(tsmi); @@ -496,11 +467,11 @@ namespace LSLEditor private void InitRecentProjectList() { - if (Properties.Settings.Default.RecentProjectList == null) + if (Properties.Settings.Default.RecentProjectList == null) { Properties.Settings.Default.RecentProjectList = new System.Collections.Specialized.StringCollection(); + } int intLen = Properties.Settings.Default.RecentProjectList.Count; - for (int intI = 0; intI < intLen; intI++) - { + for (int intI = 0; intI < intLen; intI++) { ToolStripMenuItem tsmi = new ToolStripMenuItem(ClippedPath(Properties.Settings.Default.RecentProjectList[intI])); tsmi.Tag = Properties.Settings.Default.RecentProjectList[intI]; this.recentProjectToolStripMenuItem.DropDownItems.Add(tsmi); @@ -510,21 +481,21 @@ namespace LSLEditor private void InitPluginsList() { // erase old plugins - for (int intI = this.toolsStripMenuItem.DropDownItems.Count - 1; intI > 0; intI--) + for (int intI = this.toolsStripMenuItem.DropDownItems.Count - 1; intI > 0; intI--) { this.toolsStripMenuItem.DropDownItems.RemoveAt(intI); + } - if (Properties.Settings.Default.Plugins == null) - return; - - ToolStripMenuItem tsmi; - EventHandler handler = new EventHandler(this.PluginsHandler); - foreach (string strPlugin in Properties.Settings.Default.Plugins) - { - if(strPlugin.ToLower().Contains("lslint")) - tsmi = new ToolStripMenuItem(strPlugin, null, handler, Keys.F7); - else - tsmi = new ToolStripMenuItem(strPlugin, null, handler); - this.toolsStripMenuItem.DropDownItems.Add(tsmi); + if (Properties.Settings.Default.Plugins != null) { + ToolStripMenuItem tsmi; + EventHandler handler = new EventHandler(this.PluginsHandler); + foreach (string strPlugin in Properties.Settings.Default.Plugins) { + if (strPlugin.ToLower().Contains("lslint")) { + tsmi = new ToolStripMenuItem(strPlugin, null, handler, Keys.F7); + } else { + tsmi = new ToolStripMenuItem(strPlugin, null, handler); + } + this.toolsStripMenuItem.DropDownItems.Add(tsmi); + } } } @@ -535,17 +506,14 @@ namespace LSLEditor this.recentFileToolStripMenuItem.DropDownItems.Insert(0, tsmi); Properties.Settings.Default.RecentFileList.Insert(0, strPath); int intListLen = Properties.Settings.Default.RecentFileList.Count; - for (int intI = intListLen - 1; intI > 0; intI--) - { - if (strPath.ToLower() == Properties.Settings.Default.RecentFileList[intI].ToLower()) - { + for (int intI = intListLen - 1; intI > 0; intI--) { + if (strPath.ToLower() == Properties.Settings.Default.RecentFileList[intI].ToLower()) { this.recentFileToolStripMenuItem.DropDownItems.RemoveAt(intI); Properties.Settings.Default.RecentFileList.RemoveAt(intI); } } int intLen = Properties.Settings.Default.RecentFileMax; - if (this.recentFileToolStripMenuItem.DropDownItems.Count > intLen) - { + if (this.recentFileToolStripMenuItem.DropDownItems.Count > intLen) { this.recentFileToolStripMenuItem.DropDownItems.RemoveAt(intLen); Properties.Settings.Default.RecentFileList.RemoveAt(intLen); } @@ -556,25 +524,21 @@ namespace LSLEditor ToolStripMenuItem tsmi = new ToolStripMenuItem(ClippedPath(strPath)); tsmi.Tag = strPath; - if (AddToList) - { + if (AddToList) { this.recentProjectToolStripMenuItem.DropDownItems.Insert(0, tsmi); Properties.Settings.Default.RecentProjectList.Insert(0, strPath); } int intListLen = Properties.Settings.Default.RecentProjectList.Count; - for (int intI = intListLen - 1; intI > 0; intI--) - { - if (strPath.ToLower() == Properties.Settings.Default.RecentProjectList[intI].ToLower()) - { + for (int intI = intListLen - 1; intI > 0; intI--) { + if (strPath.ToLower() == Properties.Settings.Default.RecentProjectList[intI].ToLower()) { this.recentProjectToolStripMenuItem.DropDownItems.RemoveAt(intI); Properties.Settings.Default.RecentProjectList.RemoveAt(intI); } } int intLen = Properties.Settings.Default.RecentProjectMax; - if (this.recentProjectToolStripMenuItem.DropDownItems.Count > intLen) - { + if (this.recentProjectToolStripMenuItem.DropDownItems.Count > intLen) { this.recentProjectToolStripMenuItem.DropDownItems.RemoveAt(intLen); Properties.Settings.Default.RecentProjectList.RemoveAt(intLen); } @@ -584,12 +548,9 @@ namespace LSLEditor private void ReadNoteFiles() { this.openNoteFilesDialog.Multiselect = true; - if (this.openNoteFilesDialog.ShowDialog() == DialogResult.OK) - { - foreach (string strFileName in this.openNoteFilesDialog.FileNames) - { - if (File.Exists(strFileName)) - { + if (this.openNoteFilesDialog.ShowDialog() == DialogResult.OK) { + foreach (string strFileName in this.openNoteFilesDialog.FileNames) { + if (File.Exists(strFileName)) { OpenFile(strFileName, Guid.NewGuid(), false); UpdateRecentFileList(strFileName); } @@ -600,12 +561,9 @@ namespace LSLEditor private void ReadScriptFiles() { this.openScriptFilesDialog.Multiselect = true; - if (this.openScriptFilesDialog.ShowDialog() == DialogResult.OK) - { - foreach (string strFileName in this.openScriptFilesDialog.FileNames) - { - if (File.Exists(strFileName)) - { + if (this.openScriptFilesDialog.ShowDialog() == DialogResult.OK) { + foreach (string strFileName in this.openScriptFilesDialog.FileNames) { + if (File.Exists(strFileName)) { OpenFile(strFileName, Guid.NewGuid()); UpdateRecentFileList(strFileName); } @@ -625,17 +583,16 @@ namespace LSLEditor public bool SaveFile(EditForm editForm, bool blnSaveAs) { DialogResult dialogresult = DialogResult.OK; - if (editForm.FullPathName == Properties.Settings.Default.ExampleName || blnSaveAs) - { + if (editForm.FullPathName == Properties.Settings.Default.ExampleName || blnSaveAs) { SaveFileDialog saveDialog = editForm.IsScript ? this.saveScriptFilesDialog : this.saveNoteFilesDialog; saveDialog.FileName = editForm.FullPathName; string strExtension = Path.GetExtension(editForm.FullPathName); dialogresult = saveDialog.ShowDialog(); - if (dialogresult == DialogResult.OK) + if (dialogresult == DialogResult.OK) { editForm.FullPathName = saveDialog.FileName; + } } - if (dialogresult == DialogResult.OK) - { + if (dialogresult == DialogResult.OK) { editForm.SaveCurrentFile(); UpdateRecentFileList(editForm.FullPathName); return true; @@ -646,23 +603,24 @@ namespace LSLEditor // save file of active MDI child, if any private bool SaveActiveFile() { + bool blnResult = false; EditForm editForm = this.ActiveMdiForm as EditForm; - if (editForm == null) - return false; - // save as!! - // TODO: Refactor saveDialog to be a property of the form - SaveFileDialog saveDialog = editForm.IsScript ? this.saveScriptFilesDialog : this.saveNoteFilesDialog; - return SaveFile(editForm, true); + if (editForm != null) { + // save as!! + // TODO: Refactor saveDialog to be a property of the form + SaveFileDialog saveDialog = editForm.IsScript ? this.saveScriptFilesDialog : this.saveNoteFilesDialog; + blnResult = SaveFile(editForm, true); + } + return blnResult; } - private void saveToolStripMenuItem_Click(object sender, EventArgs e) { EditForm editForm = this.ActiveMdiForm as EditForm; - if (editForm == null) - return; - editForm.SaveCurrentFile(); - this.Focus(); + if (editForm != null) { + editForm.SaveCurrentFile(); + this.Focus(); + } } private void saveAsToolStripMenuItem_Click(object sender, EventArgs e) @@ -672,37 +630,30 @@ namespace LSLEditor private Browser GetBrowser() { - if (this.browser == null || this.browser.IsDisposed) - { + if (this.browser == null || this.browser.IsDisposed) { this.browser = new Browser(this); - if (Properties.Settings.Default.BrowserLocation != Point.Empty) - { + if (Properties.Settings.Default.BrowserLocation != Point.Empty) { this.browser.StartPosition = FormStartPosition.Manual; this.browser.Location = Properties.Settings.Default.BrowserLocation; } - if (Properties.Settings.Default.BrowserSize != Size.Empty) + if (Properties.Settings.Default.BrowserSize != Size.Empty) { this.browser.Size = Properties.Settings.Default.BrowserSize; + } this.browser.SizeChanged += new EventHandler(browser_SizeChanged); this.browser.LocationChanged += new EventHandler(browser_LocationChanged); - if (this.browserInWindowToolStripMenuItem.Checked) - { + if (this.browserInWindowToolStripMenuItem.Checked) { this.browser.MdiParent = null; this.browser.Show(); - } - else - { + } else { AddForm(this.browser); //this.browser.MdiParent = this; } } this.browser.Activate(); - if (this.IsMdiContainer) - { + if (this.IsMdiContainer) { this.ActivateMdiChild(this.browser); - } - else - { + } else { //TODO: find browser in childs /*for (int intI = 0; intI < this.tabControlExtended1.TabCount; intI++) { @@ -735,20 +686,17 @@ namespace LSLEditor { // Initialize the dialog's PrinterSettings property to hold user // defined printer settings. - pageSetupDialog1.PageSettings = - new System.Drawing.Printing.PageSettings(); + pageSetupDialog1.PageSettings = new System.Drawing.Printing.PageSettings(); // Initialize dialog's PrinterSettings property to hold user // set printer settings. - pageSetupDialog1.PrinterSettings = - new System.Drawing.Printing.PrinterSettings(); + pageSetupDialog1.PrinterSettings = new System.Drawing.Printing.PrinterSettings(); //Do not show the network in the printer dialog. pageSetupDialog1.ShowNetwork = false; //Show the dialog storing the result. - if (pageSetupDialog1.ShowDialog() != DialogResult.OK) - { + if (pageSetupDialog1.ShowDialog() != DialogResult.OK) { pageSetupDialog1.PageSettings = null; pageSetupDialog1.PrinterSettings = null; } @@ -757,8 +705,7 @@ namespace LSLEditor private void printPreviewtoolStripMenuItem_Click(object sender, EventArgs e) { EditForm editForm = this.ActiveMdiForm as EditForm; - if (editForm != null) - { + if (editForm != null) { printerHelp(editForm); printer.PrintPreviewEditForm(editForm); } @@ -767,8 +714,7 @@ namespace LSLEditor private void printToolStripMenuItem_Click(object sender, EventArgs e) { EditForm editForm = this.ActiveMdiForm as EditForm; - if (editForm != null) - { + if (editForm != null) { printerHelp(editForm); printer.PrintEditForm(editForm); } @@ -786,9 +732,9 @@ namespace LSLEditor private void copyToClipboardToolStripMenuItem_Click(object sender, EventArgs e) { EditForm editForm = this.ActiveMdiForm as EditForm; - if (editForm == null) - return; - editForm.TextBox.ToClipBoard(); + if (editForm != null) { + editForm.TextBox.ToClipBoard(); + } } private void exitToolStripMenuItem_Click(object sender, EventArgs e) @@ -799,84 +745,82 @@ namespace LSLEditor private void undoToolStripMenuItem_Click(object sender, EventArgs e) { EditForm editForm = this.ActiveMdiForm as EditForm; - if (editForm == null) - return; - editForm.TextBox.Undo(); + if (editForm != null) { + editForm.TextBox.Undo(); + } } private void redoToolStripMenuItem_Click(object sender, EventArgs e) { EditForm editForm = this.ActiveMdiForm as EditForm; - if (editForm == null) - return; - editForm.TextBox.Redo(); + if (editForm != null) { + editForm.TextBox.Redo(); + } } private void cutToolStripMenuItem_Click(object sender, EventArgs e) { EditForm editForm = this.ActiveMdiForm as EditForm; - if (editForm == null) - return; - editForm.TextBox.Cut(); + if (editForm != null) { + editForm.TextBox.Cut(); + } } private void copyToolStripMenuItem_Click(object sender, EventArgs e) { EditForm editForm = this.ActiveMdiForm as EditForm; - if (editForm == null) - return; - editForm.TextBox.Copy(); + if (editForm != null) { + editForm.TextBox.Copy(); + } } private void pasteToolStripMenuItem_Click(object sender, EventArgs e) { EditForm editForm = this.ActiveMdiForm as EditForm; - if (editForm == null) - return; - editForm.TextBox.Paste(); + if (editForm != null) { + editForm.TextBox.Paste(); + } } private void deleteToolStripMenuItem_Click(object sender, EventArgs e) { EditForm editForm = this.ActiveMdiForm as EditForm; - if (editForm == null) - return; - editForm.TextBox.Delete(); + if (editForm != null) { + editForm.TextBox.Delete(); + } } private void selectAllToolStripMenuItem_Click(object sender, EventArgs e) { EditForm editForm = this.ActiveMdiForm as EditForm; - if (editForm == null) - return; - editForm.TextBox.SelectAll(); + if (editForm != null) { + editForm.TextBox.SelectAll(); + } } private void formatDocumentToolStripMenuItem_Click(object sender, EventArgs e) { EditForm editForm = this.ActiveMdiForm as EditForm; - if (editForm == null) - return; - editForm.TextBox.FormatDocument(); + if (editForm != null) { + editForm.TextBox.FormatDocument(); + } } private void formatSelectedTextToolStripMenuItem_Click(object sender, EventArgs e) { EditForm editForm = this.ActiveMdiForm as EditForm; - if (editForm == null) - return; - editForm.TextBox.AutoFormatSelectedText(); + if (editForm != null) { + editForm.TextBox.AutoFormatSelectedText(); + } } private void wordWrapToolStripMenuItem_Click(object sender, EventArgs e) { EditForm editForm = this.ActiveMdiForm as EditForm; - if (editForm != null) - { + if (editForm != null) { ToolStripMenuItem tsmi = sender as ToolStripMenuItem; - if (tsmi != null) - { + if (tsmi != null) { tsmi.Checked = !tsmi.Checked; editForm.TextBox.WordWrap = tsmi.Checked; } @@ -912,11 +856,13 @@ namespace LSLEditor Font listBoxFont; Font toolTipFont; - if (Properties.Settings.Default.FontEditor == null) + if (Properties.Settings.Default.FontEditor == null) { Properties.Settings.Default.FontEditor = new Font("Courier New", 9.75F, FontStyle.Regular); + } - if (Properties.Settings.Default.FontTooltips == null) + if (Properties.Settings.Default.FontTooltips == null) { Properties.Settings.Default.FontTooltips = new Font(SystemFonts.MessageBoxFont.Name, 9.75F, FontStyle.Regular); + } toolTipFont = Properties.Settings.Default.FontTooltips; listBoxFont = Properties.Settings.Default.FontEditor; @@ -926,11 +872,11 @@ namespace LSLEditor this.TooltipListBox.Font = toolTipFont; this.GListBoxWindow.Font = listBoxFont; - foreach (Form form in this.Children) - { + foreach (Form form in this.Children) { EditForm editForm = form as EditForm; - if (editForm == null || editForm.IsDisposed) + if (editForm == null || editForm.IsDisposed) { continue; + } editForm.SetFont(); } } @@ -975,7 +921,7 @@ namespace LSLEditor imageList.Images.Add(new Bitmap(this.GetType(), "Images.States.gif")); this.GListBoxWindow.GListBox.ImageList = imageList; - // this.tvOutline.ImageList = imageList; + // this.tvOutline.ImageList = imageList; this.Move += new EventHandler(LSLEditorForm_SetPosition); this.Resize += new EventHandler(LSLEditorForm_SetPosition); @@ -987,44 +933,43 @@ namespace LSLEditor void GListBox_SelectedIndexChanged(object sender, EventArgs e) { EditForm editForm = this.ActiveMdiForm as EditForm; - if (editForm != null) + if (editForm != null) { editForm.TextBox.ShowTooltipOnListBox(); + } } void GListBox_DoubleClick(object sender, EventArgs e) { EditForm editForm = this.ActiveMdiForm as EditForm; - if (editForm != null) + if (editForm != null) { editForm.TextBox.InsertSelectedWord(); + } } private void LSLEditorForm_SetPosition(object sender, EventArgs e) { - foreach (PermissionsForm pf in this.PermissionForms) - { + foreach (PermissionsForm pf in this.PermissionForms) { pf.Top = this.Top + 30; pf.Left = this.Right - pf.Width - 5; } - foreach(llDialogForm df in this.llDialogForms) - { + foreach (llDialogForm df in this.llDialogForms) { df.Top = this.Top + 30; df.Left = this.Right - df.Width - 5; } - foreach(llTextBoxForm tbf in this.llTextBoxForms) - { + foreach (llTextBoxForm tbf in this.llTextBoxForms) { tbf.Left = this.Left + this.Width / 2 - tbf.Width / 2; tbf.Top = this.Top + this.Height / 2 - tbf.Height / 2; } EditForm editForm = this.ActiveMdiForm as EditForm; - if (editForm != null) + if (editForm != null) { editForm.TextBox.SetPosition(Screen.PrimaryScreen.WorkingArea); + } } private void LoadProperties() { - try - { + try { //TODO: hmmm? //this.tabControlExtended1.Visible = false; @@ -1036,53 +981,45 @@ namespace LSLEditor Size size = Properties.Settings.Default.LSLEditorSize; Point location = Properties.Settings.Default.LSLEditorLocation; Rectangle rect = new Rectangle(location, size); - if(Screen.PrimaryScreen.WorkingArea.Contains(rect)) - { - if (size.Width > 100 && size.Height > 100) - { + if (Screen.PrimaryScreen.WorkingArea.Contains(rect)) { + if (size.Width > 100 && size.Height > 100) { this.Location = location; this.Size = size; } } - this.browserInWindowToolStripMenuItem.Checked = - Properties.Settings.Default.BrowserInWindow; + this.browserInWindowToolStripMenuItem.Checked = Properties.Settings.Default.BrowserInWindow; - this.WikiSepBrowserstoolStripMenuItem.Checked = - Properties.Settings.Default.WikiSeperateBrowser; + this.WikiSepBrowserstoolStripMenuItem.Checked = Properties.Settings.Default.WikiSeperateBrowser; - } - catch(Exception exception) - { + } catch (Exception exception) { MessageBox.Show("Error Properties: " + OopsFormatter.ApplyFormatting(exception.Message), "Oops, but continue"); } } + // TODO cleanup multiple return points public bool CloseAllOpenWindows() { - foreach (Form form in this.Children) - { + foreach (Form form in this.Children) { EditForm editForm = form as EditForm; - if (editForm == null || editForm.IsDisposed) + if (editForm == null || editForm.IsDisposed) { continue; + } ActivateMdiForm(editForm); - if (editForm.Dirty) - { + if (editForm.Dirty) { DialogResult dialogResult = MessageBox.Show(this, @"Save """ + editForm.ScriptName + @"""?", "File has changed", MessageBoxButtons.YesNoCancel); - if (dialogResult == DialogResult.Cancel) - { + if (dialogResult == DialogResult.Cancel) { return false; } - if (dialogResult == DialogResult.Yes) - { + if (dialogResult == DialogResult.Yes) { // TODO: Refactor saveDialog to be a property of the form SaveFileDialog saveDialog = editForm.IsScript ? this.saveScriptFilesDialog : this.saveNoteFilesDialog; - if(!SaveFile(editForm, false)) + if (!SaveFile(editForm, false)) { return false; + } } - if (dialogResult == DialogResult.No) - { + if (dialogResult == DialogResult.No) { editForm.Dirty = false; } } @@ -1091,59 +1028,50 @@ namespace LSLEditor return true; } + // TODO cleanup multiple return points private void LSLEditorForm_FormClosing(object sender, FormClosingEventArgs e) { - try - { + try { Properties.Settings.Default.LSLEditorSize = this.Size; Properties.Settings.Default.LSLEditorLocation = this.Location; Properties.Settings.Default.Save(); - if (this.IsMdiContainer) - { + if (this.IsMdiContainer) { // this is set by any EditForm close e.Cancel = this.CancelClosing; return; } - if (this.SolutionExplorer != null & !this.SolutionExplorer.IsDisposed) - { + if (this.SolutionExplorer != null & !this.SolutionExplorer.IsDisposed) { this.SolutionExplorer.CloseSolution(); } e.Cancel = !CloseAllOpenWindows(); - } - catch - { - } + } catch { } } private void helpKeywordToolStripMenuItem_Click(object sender, EventArgs e) { EditForm editForm = this.ActiveMdiForm as EditForm; - if (editForm == null) - return; - - Point dummy; - string strKeyWord = editForm.TextBox.GetCurrentKeyWord(false, out dummy); - ShowHelpOnKeyWord(strKeyWord); + if (editForm != null) { + Point dummy; + string strKeyWord = editForm.TextBox.GetCurrentKeyWord(false, out dummy); + ShowHelpOnKeyWord(strKeyWord); + } } + // TODO cleanup multiple return points private void ShowHelpOnKeyWord(string strKeyWord) { - if (Properties.Settings.Default.HelpOffline) - { + if (Properties.Settings.Default.HelpOffline) { string strHelpFile = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), Properties.Settings.Default.HelpOfflineFile); - if (!File.Exists(strHelpFile)) - { - if (MessageBox.Show("No Offline help, use Online Wiki?", "Offline Help fails", MessageBoxButtons.OKCancel,MessageBoxIcon.Question) != DialogResult.OK) + if (!File.Exists(strHelpFile)) { + if (MessageBox.Show("No Offline help, use Online Wiki?", "Offline Help fails", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK) return; - } - else - { + } else { if (strKeyWord == "") Help.ShowHelp(this, strHelpFile); else @@ -1154,15 +1082,13 @@ namespace LSLEditor string strUrl = Properties.Settings.Default.Help + strKeyWord; - if (strKeyWord == "") + if (strKeyWord == "") { strKeyWord = "Help"; - - if (Properties.Settings.Default.WikiSeperateBrowser) - { - System.Diagnostics.Process.Start(strUrl); } - else - { + + if (Properties.Settings.Default.WikiSeperateBrowser) { + System.Diagnostics.Process.Start(strUrl); + } else { Browser browser = GetBrowser(); browser.ShowWebBrowser(strKeyWord, strUrl); } @@ -1190,8 +1116,7 @@ namespace LSLEditor private void InitSyntaxError() { // information out of every script - if (this.SyntaxErrors == null) - { + if (this.SyntaxErrors == null) { this.SyntaxErrors = new SyntaxError(); this.SyntaxErrors.OnSyntaxError += new SyntaxError.SyntaxErrorHandler(SyntaxErrors_OnSyntaxError); this.SyntaxErrors.Dock = DockStyle.Fill; @@ -1202,87 +1127,82 @@ namespace LSLEditor private void SyntaxErrors_OnSyntaxError(object sender, SyntaxError.SyntaxErrorEventArgs e) { EditForm editForm = null; - foreach (Form form in this.Children) - { + foreach (Form form in this.Children) { editForm = form as EditForm; - if (editForm == null || editForm.IsDisposed) + if (editForm == null || editForm.IsDisposed) { continue; - if (editForm.FullPathName == e.FullPathName) - { + } + if (editForm.FullPathName == e.FullPathName) { ActivateMdiForm(editForm); editForm.TextBox.Goto(e.Line, e.Char); editForm.Focus(); return; } } - editForm = OpenFile(e.FullPathName,e.EditFormGuid,e.IsScript); + editForm = OpenFile(e.FullPathName, e.EditFormGuid, e.IsScript); editForm.TextBox.Goto(e.Line, e.Char); editForm.Focus(); } private void StartSimulator() { - if (!SyntaxCheck(true)) - return; + if (SyntaxCheck(true)) { + this.SimulatorConsole = new SimulatorConsole(this.SolutionExplorer, this.Children); - this.SimulatorConsole = new SimulatorConsole(this.SolutionExplorer, this.Children); - - this.SimulatorConsole.Show(dockPanel); - //TODO: Show Simulator Console somewhere - //this.panel1.Controls.Clear(); - //this.panel1.Controls.Add(this.SimulatorConsole); - //this.panel1.Visible = true; - //this.splitter1.SplitPosition = Properties.Settings.Default.SimulatorSize.Height; + this.SimulatorConsole.Show(dockPanel); + //TODO: Show Simulator Console somewhere + //this.panel1.Controls.Clear(); + //this.panel1.Controls.Add(this.SimulatorConsole); + //this.panel1.Visible = true; + //this.splitter1.SplitPosition = Properties.Settings.Default.SimulatorSize.Height; + } } public void StopSimulator() { //TODO: Hide simulator? Or we could keep it like the debug output in VS //this.panel1.Visible = false; - if (this.SimulatorConsole != null) - { + if (this.SimulatorConsole != null) { this.SimulatorConsole.Stop(); this.SimulatorConsole.Dispose(); } this.SimulatorConsole = null; } - private bool SyntaxCheck(bool Silent) { //TODO: What do we hide on SyntaxCheck? //this.panel1.Visible = false; InitSyntaxError(); - foreach (Form form in this.Children) - { + foreach (Form form in this.Children) { EditForm editForm = form as EditForm; - if (editForm == null || editForm.IsDisposed) + if (editForm == null || editForm.IsDisposed) { continue; - if (Properties.Settings.Default.AutoSaveOnDebug) - { - if (editForm.Dirty) + } + if (Properties.Settings.Default.AutoSaveOnDebug) { + if (editForm.Dirty) { editForm.SaveCurrentFile(); + } } editForm.SyntaxCheck(); } - if (this.SyntaxErrors.HasErrors) - { + bool blnResult = false; + if (this.SyntaxErrors.HasErrors) { this.SyntaxErrors.Show(dockPanel); //TODO: Show errors somewhere in an output //this.panel1.Controls.Clear(); //this.panel1.Controls.Add(this.SyntaxErrors); //this.panel1.Visible = true; //this.splitter1.SplitPosition = Properties.Settings.Default.SimulatorSize.Height; - return false; - } - else - { - if (!Silent) + } else { + if (!Silent) { MessageBox.Show("LSL Syntax seems OK", "LSL Syntax Checker", MessageBoxButtons.OK, MessageBoxIcon.Information); - return true; + } + blnResult = true; } + return blnResult; } private void releaseNotesToolStripMenuItem_Click(object sender, EventArgs e) @@ -1321,18 +1241,15 @@ namespace LSLEditor private void tabControlExtended1_MouseDown(object sender, MouseEventArgs e) { TabControl tabControl = sender as TabControl; - if (tabControl == null) - return; - if (e.Button == MouseButtons.Right) - { - for (int intI = 0; intI < tabControl.TabCount; intI++) - { - Rectangle rt = tabControl.GetTabRect(intI); - if (e.X > rt.Left && e.X < rt.Right - && e.Y > rt.Top && e.Y < rt.Bottom) - { - this.contextMenuStrip1.Tag = intI; - this.contextMenuStrip1.Show(tabControl, new Point(e.X, e.Y)); + if (tabControl != null) { + if (e.Button == MouseButtons.Right) { + for (int intI = 0; intI < tabControl.TabCount; intI++) { + Rectangle rt = tabControl.GetTabRect(intI); + if (e.X > rt.Left && e.X < rt.Right + && e.Y > rt.Top && e.Y < rt.Bottom) { + this.contextMenuStrip1.Tag = intI; + this.contextMenuStrip1.Show(tabControl, new Point(e.X, e.Y)); + } } } } @@ -1340,11 +1257,11 @@ namespace LSLEditor private bool IsInSolutionExplorer(Guid guid) { - if (this.SolutionExplorer == null || this.SolutionExplorer.IsDisposed) - return false; - if (this.SolutionExplorer.GetKey(guid) == null) - return false; - return true; + bool blnResult = true; + if (this.SolutionExplorer == null || this.SolutionExplorer.IsDisposed || this.SolutionExplorer.GetKey(guid) == null) { + blnResult = false; + } + return blnResult; } @@ -1415,31 +1332,27 @@ namespace LSLEditor private void toolStripMenuItem1_Click(object sender, EventArgs e) { EditForm editForm = this.ActiveMdiForm as EditForm; - if (editForm == null) - return; - if (GotoWindow == null || GotoWindow.IsDisposed) - { - GotoWindow = new GotoWindow(this); - if (Properties.Settings.Default.GotoLocation != Point.Empty) - { - GotoWindow.StartPosition = FormStartPosition.Manual; - GotoWindow.Location = Properties.Settings.Default.GotoLocation; + if (editForm != null) { + if (GotoWindow == null || GotoWindow.IsDisposed) { + GotoWindow = new GotoWindow(this); + if (Properties.Settings.Default.GotoLocation != Point.Empty) { + GotoWindow.StartPosition = FormStartPosition.Manual; + GotoWindow.Location = Properties.Settings.Default.GotoLocation; + } + GotoWindow.LocationChanged += new EventHandler(gotoForm_LocationChanged); } - GotoWindow.LocationChanged += new EventHandler(gotoForm_LocationChanged); + GotoWindow.Show(this); } - GotoWindow.Show(this); } public void CloseActiveWindow() { - if (this.IsMdiContainer) - { - if(this.ActiveMdiForm!=null && !this.ActiveMdiForm.IsDisposed) + if (this.IsMdiContainer) { + if (this.ActiveMdiForm != null && !this.ActiveMdiForm.IsDisposed) { this.ActiveMdiForm.Close(); - } - else - { + } + } else { //TODO: Find a new way /* int intTabToClose = this.tabControlExtended1.SelectedIndex; @@ -1464,8 +1377,7 @@ namespace LSLEditor private void LSLEditorForm_Load(object sender, EventArgs e) { LoadProperties(); - if (Properties.Settings.Default.CheckForUpdates) - { + if (Properties.Settings.Default.CheckForUpdates) { updateApplicationForm = new UpdateApplicationForm(); updateApplicationForm.Icon = this.Icon; updateApplicationForm.OnUpdateAvailable += new EventHandler(updateApplicationForm_OnUpdateAvailable); @@ -1481,42 +1393,43 @@ namespace LSLEditor private void commentInToolStripMenuItem_Click(object sender, EventArgs e) { EditForm editForm = this.ActiveMdiForm as EditForm; - if (editForm == null) - return; - editForm.TextBox.MultiLineComment(true); + if (editForm != null) { + editForm.TextBox.MultiLineComment(true); + } } private void uncommentingSelectedTextToolStripMenuItem_Click(object sender, EventArgs e) { EditForm editForm = this.ActiveMdiForm as EditForm; - if (editForm == null) - return; - editForm.TextBox.MultiLineComment(false); + if (editForm != null) { + editForm.TextBox.MultiLineComment(false); + } } private void FindandReplace(bool blnReplaceAlso) { EditForm editForm = this.ActiveMdiForm as EditForm; - if (editForm == null) - return; - if (findWindow == null || findWindow.IsDisposed) - { - findWindow = new FindWindow(this); - findWindow.LocationChanged += new EventHandler(findForm_LocationChanged); + if (editForm != null) { + if (findWindow == null || findWindow.IsDisposed) { + findWindow = new FindWindow(this); + findWindow.LocationChanged += new EventHandler(findForm_LocationChanged); + } + Rectangle rect = new Rectangle(this.Location, this.Size); + if (rect.Contains(Properties.Settings.Default.FindLocation)) { + findWindow.Location = Properties.Settings.Default.FindLocation; + } else { + findWindow.Location = this.Location; + } + Point dummy; + findWindow.ReplaceAlso = blnReplaceAlso; + findWindow.KeyWord = editForm.TextBox.GetCurrentKeyWord(false, out dummy); + if (findWindow.Visible == false) { + findWindow.Show(this); + } + findWindow.FindFocus(); } - Rectangle rect = new Rectangle(this.Location, this.Size); - if (rect.Contains(Properties.Settings.Default.FindLocation)) - findWindow.Location = Properties.Settings.Default.FindLocation; - else - findWindow.Location = this.Location; - Point dummy; - findWindow.ReplaceAlso = blnReplaceAlso; - findWindow.KeyWord = editForm.TextBox.GetCurrentKeyWord(false, out dummy); - if (findWindow.Visible == false) - findWindow.Show(this); - findWindow.FindFocus(); } private void replaceToolStripMenuItem_Click(object sender, EventArgs e) @@ -1531,8 +1444,9 @@ namespace LSLEditor private void findNextToolStripMenuItem_Click(object sender, EventArgs e) { - if (findWindow != null && !findWindow.IsDisposed) + if (findWindow != null && !findWindow.IsDisposed) { findWindow.Find(); + } } @@ -1540,12 +1454,9 @@ namespace LSLEditor { //TODO: We need another way to activate the Solution Explorer //this.panel2.Visible = blnVisible; - if (blnVisible) - { + if (blnVisible) { m_SolutionExplorer.Show(dockPanel); - } - else - { + } else { m_SolutionExplorer.Hide(); } this.solutionExplorerToolStripMenuItem.Checked = blnVisible; @@ -1592,14 +1503,13 @@ namespace LSLEditor private void recentFileToolStripMenuItem_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) { ToolStripMenuItem tsmi = e.ClickedItem as ToolStripMenuItem; - if (tsmi == null) - return; + if (tsmi != null) { + this.fileStripMenuItem.HideDropDown(); - this.fileStripMenuItem.HideDropDown(); - - string strPath = tsmi.Tag.ToString(); - OpenFile(strPath, Guid.NewGuid()); - UpdateRecentFileList(strPath); + string strPath = tsmi.Tag.ToString(); + OpenFile(strPath, Guid.NewGuid()); + UpdateRecentFileList(strPath); + } } private void makeBugReporttoolStripMenuItem_Click(object sender, EventArgs e) @@ -1624,12 +1534,11 @@ namespace LSLEditor #region SolutionExplorer private void openProjectSolutionToolStripMenuItem_Click(object sender, EventArgs e) { - if (this.openSolutionFilesDialog.ShowDialog(this) == DialogResult.OK) - { - if (File.Exists(this.openSolutionFilesDialog.FileName)) - { - if(CloseAllOpenWindows()) + if (this.openSolutionFilesDialog.ShowDialog(this) == DialogResult.OK) { + if (File.Exists(this.openSolutionFilesDialog.FileName)) { + if (CloseAllOpenWindows()) { this.SolutionExplorer.OpenSolution(this.openSolutionFilesDialog.FileName); + } } } } @@ -1637,8 +1546,9 @@ namespace LSLEditor private void newProjectToolStripMenuItem_Click(object sender, EventArgs e) { NewProject np = new NewProject(this); - if (np.ShowDialog(this) == DialogResult.OK) + if (np.ShowDialog(this) == DialogResult.OK) { CloseAllOpenWindows(); + } } @@ -1661,52 +1571,45 @@ namespace LSLEditor { this.SolutionExplorer.AddNewObject(); } - #endregion SolutionExplorer private void recentProjectToolStripMenuItem_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) { ToolStripMenuItem tsmi = e.ClickedItem as ToolStripMenuItem; - if (tsmi == null) - return; + if (tsmi != null) { + this.fileStripMenuItem.HideDropDown(); - this.fileStripMenuItem.HideDropDown(); - - if (CloseAllOpenWindows()) - { - string strPath = tsmi.Tag.ToString(); - this.SolutionExplorer.OpenSolution(strPath); + if (CloseAllOpenWindows()) { + string strPath = tsmi.Tag.ToString(); + this.SolutionExplorer.OpenSolution(strPath); + } } } private void LSLEditorForm_DragEnter(object sender, DragEventArgs e) { - if (e.Data.GetDataPresent(DataFormats.FileDrop)) + if (e.Data.GetDataPresent(DataFormats.FileDrop)) { e.Effect = DragDropEffects.Copy; - else + } else { e.Effect = DragDropEffects.None; + } } private delegate void DelegateOpenFile(string s); private void LSLEditorForm_DragDrop(object sender, DragEventArgs e) { - try - { + try { DelegateOpenFile delegateOpenFile = new DelegateOpenFile(OpenFile); Array allFiles = (Array)e.Data.GetData(DataFormats.FileDrop); - if (allFiles == null) - return; + if (allFiles != null) { + for (int intI = 0; intI < allFiles.Length; intI++) { + string strFileName = allFiles.GetValue(intI).ToString(); + this.BeginInvoke(delegateOpenFile, new object[] { strFileName }); + } - for (int intI = 0; intI < allFiles.Length; intI++) - { - string strFileName = allFiles.GetValue(intI).ToString(); - this.BeginInvoke(delegateOpenFile, new object[] { strFileName }); + this.Activate(); // in the case Explorer overlaps this form } - - this.Activate(); // in the case Explorer overlaps this form - } - catch - { + } catch { // Error in DragDrop function (dont show messagebox, explorer is waiting } } @@ -1740,19 +1643,13 @@ namespace LSLEditor Plugins.LSLint lslint = new Plugins.LSLint(); - if (lslint.SyntaxCheck(this)) - { - if (lslint.HasErrors) - { + if (lslint.SyntaxCheck(this)) { + if (lslint.HasErrors) { this.SyntaxErrors.Show(dockPanel); - } - else - { + } else { MessageBox.Show("LSL Syntax seems OK", "LSLint Syntax Checker", MessageBoxButtons.OK, MessageBoxIcon.Information); } - } - else - { + } else { MessageBox.Show("LSLint:" + lslint.ExceptionMessage, "LSLint plugin", MessageBoxButtons.OK, MessageBoxIcon.Error); } } @@ -1764,15 +1661,12 @@ namespace LSLEditor private void SvnPlugin() { - if (File.Exists(Svn.Executable)) - { + if (File.Exists(Svn.Executable)) { Properties.Settings.Default.VersionControl = true; Properties.Settings.Default.VersionControlSVN = true; Properties.Settings.Default.SvnExe = Svn.Executable; MessageBox.Show("SVN is installed and can be used in the solution explorer", "SVN information", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - else - { + } else { Properties.Settings.Default.VersionControl = false; Properties.Settings.Default.VersionControlSVN = false; MessageBox.Show("SVN is NOT installed (can not find svn binary)", "SVN information", MessageBoxButtons.OK, MessageBoxIcon.Error); @@ -1791,36 +1685,35 @@ namespace LSLEditor //this.panel1.Visible = false; ToolStripMenuItem tsmi = sender as ToolStripMenuItem; - if (tsmi == null) - return; - - switch (tsmi.Text.ToLower()) - { - case "lslint": - LSLint(); - break; - case "particles": - Particles(); - break; - case "svn (version control)": - SvnPlugin(); - break; - default: - GenericPlugin(tsmi.Text); - //MessageBox.Show("Unknown plugin", "LSLEditor plugins warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); - break; + if (tsmi != null) { + switch (tsmi.Text.ToLower()) { + case "lslint": + LSLint(); + break; + case "particles": + Particles(); + break; + case "svn (version control)": + SvnPlugin(); + break; + default: + GenericPlugin(tsmi.Text); + //MessageBox.Show("Unknown plugin", "LSLEditor plugins warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); + break; + } } } private void SaveAllToolStripMenuItem_Click(object sender, EventArgs e) { - foreach (Form form in this.Children) - { + foreach (Form form in this.Children) { EditForm editForm = form as EditForm; - if (editForm == null || editForm.IsDisposed) + if (editForm == null || editForm.IsDisposed) { continue; - if (editForm.Dirty) + } + if (editForm.Dirty) { editForm.SaveCurrentFile(); + } } // save it all, also solution explorer file if (this.SolutionExplorer != null & !this.SolutionExplorer.IsDisposed) @@ -1830,15 +1723,12 @@ namespace LSLEditor private void SetupFileMenu() { EditForm editForm = this.ActiveMdiForm as EditForm; - if (editForm != null) - { + if (editForm != null) { this.saveToolStripMenuItem.Text = "Save " + editForm.ScriptName; this.saveScriptFilesDialog.FileName = editForm.ScriptName; this.saveToolStripMenuItem.Enabled = editForm.Dirty; this.closeFileToolStripMenuItem.Enabled = true; - } - else - { + } else { this.closeFileToolStripMenuItem.Enabled = false; } } @@ -1847,8 +1737,9 @@ namespace LSLEditor { SetupFileMenu(); EditForm ef = this.ActiveMdiForm as EditForm; - if (ef != null) + if (ef != null) { ef.SetFocus(); + } } private void LSLEditorForm_MdiChildActivate(object sender, EventArgs e) @@ -1882,10 +1773,10 @@ namespace LSLEditor { //NativeHelper.SendMyKeys.PasteTextToApp("hello", "SecondLife", null); EditForm editForm = this.ActiveMdiForm as EditForm; - if (editForm == null) - return; - editForm.TextBox.ToClipBoard(); - NativeHelper.SendMyKeys.ClipBoardToApp("SecondLife", null); + if (editForm != null) { + editForm.TextBox.ToClipBoard(); + NativeHelper.SendMyKeys.ClipBoardToApp("SecondLife", null); + } } private void outlineToolStripMenuItem_Click(object sender, EventArgs e) @@ -1895,30 +1786,22 @@ namespace LSLEditor private void outlineToolStripMenuItem_CheckedChanged(object sender, EventArgs e) { - foreach (Form k in this.Children) - { + foreach (Form k in this.Children) { EditForm editForm = k as EditForm; - if (editForm == null) - return; - if (outlineToolStripMenuItem.Checked) - { - editForm.splitContainer1.Panel2Collapsed = false; - } - else - { - editForm.splitContainer1.Panel2Collapsed = true; + if (editForm == null) { + if (outlineToolStripMenuItem.Checked) { + editForm.splitContainer1.Panel2Collapsed = false; + } else { + editForm.splitContainer1.Panel2Collapsed = true; + } } } } - - private void toolStripMenuItem9_Click_1(object sender, EventArgs e) { Browser browser = GetBrowser(); browser.ShowWebBrowser("LSLEditor QA", Properties.Settings.Default.qasite); } - - } -} \ No newline at end of file +} diff --git a/trunk/PermissionsForm.cs b/trunk/PermissionsForm.cs index ab834a6..4d64c37 100644 --- a/trunk/PermissionsForm.cs +++ b/trunk/PermissionsForm.cs @@ -72,28 +72,35 @@ namespace LSLEditor StringBuilder sb = new StringBuilder(); - if ((intPermissions & SecondLife.PERMISSION_DEBIT) == SecondLife.PERMISSION_DEBIT) + if ((intPermissions & SecondLife.PERMISSION_DEBIT) == SecondLife.PERMISSION_DEBIT) { sb.AppendLine("Take Linden dollars (L$) from you"); + } - if ((intPermissions & SecondLife.PERMISSION_TAKE_CONTROLS) == SecondLife.PERMISSION_TAKE_CONTROLS) + if ((intPermissions & SecondLife.PERMISSION_TAKE_CONTROLS) == SecondLife.PERMISSION_TAKE_CONTROLS) { sb.AppendLine("Act on your control inputs"); + } - if ((intPermissions & SecondLife.PERMISSION_TRIGGER_ANIMATION) == SecondLife.PERMISSION_TRIGGER_ANIMATION) + if ((intPermissions & SecondLife.PERMISSION_TRIGGER_ANIMATION) == SecondLife.PERMISSION_TRIGGER_ANIMATION) { sb.AppendLine("Animate your avatar"); + } - if ((intPermissions & SecondLife.PERMISSION_ATTACH) == SecondLife.PERMISSION_ATTACH) + if ((intPermissions & SecondLife.PERMISSION_ATTACH) == SecondLife.PERMISSION_ATTACH) { sb.AppendLine("Attach to your avatar"); + } - if ((intPermissions & SecondLife.PERMISSION_CHANGE_LINKS) == SecondLife.PERMISSION_CHANGE_LINKS) + if ((intPermissions & SecondLife.PERMISSION_CHANGE_LINKS) == SecondLife.PERMISSION_CHANGE_LINKS) { sb.AppendLine("Link and delink from other objects"); + } - if ((intPermissions & SecondLife.PERMISSION_TRACK_CAMERA) == SecondLife.PERMISSION_TRACK_CAMERA) + if ((intPermissions & SecondLife.PERMISSION_TRACK_CAMERA) == SecondLife.PERMISSION_TRACK_CAMERA) { sb.AppendLine("Track your camera"); + } - if ((intPermissions & SecondLife.PERMISSION_CONTROL_CAMERA) == SecondLife.PERMISSION_CONTROL_CAMERA) + if ((intPermissions & SecondLife.PERMISSION_CONTROL_CAMERA) == SecondLife.PERMISSION_CONTROL_CAMERA) { sb.AppendLine("Control your camera"); + } - this.label1.Text = "'"+strObjectName+"', an object owned by '"+strOwner + "',\nwould like to:"; + this.label1.Text = "'" + strObjectName + "', an object owned by '" + strOwner + "',\nwould like to:"; this.label2.Text = sb.ToString(); } @@ -109,4 +116,4 @@ namespace LSLEditor this.Close(); } } -} \ No newline at end of file +} diff --git a/trunk/Properties/AssemblyInfo.cs b/trunk/Properties/AssemblyInfo.cs index aeaf400..5f3912f 100644 --- a/trunk/Properties/AssemblyInfo.cs +++ b/trunk/Properties/AssemblyInfo.cs @@ -70,7 +70,7 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: // We use a Major.Minor.Bugfix.Build pattern. -[assembly: AssemblyVersion("2.999.999.7")] +[assembly: AssemblyVersion("2.999.999.13")] // // In order to sign your assembly you must specify a key to use. Refer to the @@ -100,4 +100,4 @@ using System.Runtime.InteropServices; [assembly: AssemblyDelaySign(false)] //[assembly: AssemblyKeyName("")] [assembly: ComVisibleAttribute(false)] -[assembly: AssemblyFileVersionAttribute("2.999.999.7")] +[assembly: AssemblyFileVersionAttribute("2.999.999.13")] diff --git a/trunk/RuntimeConsole.cs b/trunk/RuntimeConsole.cs index 0bf28d6..47ad84e 100644 --- a/trunk/RuntimeConsole.cs +++ b/trunk/RuntimeConsole.cs @@ -74,27 +74,29 @@ namespace LSLEditor private bool GetNewHost() { + bool blnResult = false; Assembly assembly = CompilerHelper.CompileCSharp(editForm, CSharpCode); - if (assembly == null) - return false; + if (assembly != null) { + if (SecondLifeHost != null) { + SecondLifeHost.Dispose(); + } + SecondLifeHost = null; - if(SecondLifeHost!=null) - SecondLifeHost.Dispose(); - SecondLifeHost = null; + SecondLifeHost = new SecondLifeHost(this.mainForm, assembly, editForm.FullPathName, editForm.guid); + SecondLifeHost.OnChat += editForm.ChatHandler; + SecondLifeHost.OnMessageLinked += editForm.MessageLinkedHandler; + SecondLifeHost.OnDie += new EventHandler(host_OnDie); + SecondLifeHost.OnReset += new EventHandler(SecondLifeHost_OnReset); + SecondLifeHost.OnListenChannelsChanged += new EventHandler(SecondLifeHost_OnListenChannelsChanged); - SecondLifeHost = new SecondLifeHost(this.mainForm, assembly, editForm.FullPathName, editForm.guid); - SecondLifeHost.OnChat += editForm.ChatHandler; - SecondLifeHost.OnMessageLinked += editForm.MessageLinkedHandler; - SecondLifeHost.OnDie += new EventHandler(host_OnDie); - SecondLifeHost.OnReset += new EventHandler(SecondLifeHost_OnReset); - SecondLifeHost.OnListenChannelsChanged += new EventHandler(SecondLifeHost_OnListenChannelsChanged); + SecondLifeHost.OnVerboseMessage += new SecondLifeHost.SecondLifeHostMessageHandler(host_OnVerboseMessage); + SecondLifeHost.OnStateChange += new SecondLifeHost.SecondLifeHostMessageHandler(host_OnStateChange); - SecondLifeHost.OnVerboseMessage += new SecondLifeHost.SecondLifeHostMessageHandler(host_OnVerboseMessage); - SecondLifeHost.OnStateChange += new SecondLifeHost.SecondLifeHostMessageHandler(host_OnStateChange); + SecondLifeHost.State("default", true); - SecondLifeHost.State("default", true); - - return true; + blnResult = true; + } + return blnResult; } public bool Compile(EditForm editForm) @@ -119,8 +121,7 @@ namespace LSLEditor private void ResetScriptWatch() { - while (true) - { + while (true) { this.ResetScriptEvent.WaitOne(); SecondLifeHost.Dispose(); @@ -131,13 +132,10 @@ namespace LSLEditor private delegate void AddListenChannelsDelegate(ComboBox comboBox, string[] channels); private void AddListenChannelsToComboxBox(ComboBox comboBox, string[] channels) { - if (comboBox.InvokeRequired) - { + if (comboBox.InvokeRequired) { comboBox.Invoke(new AddListenChannelsDelegate(AddListenChannelsToComboxBox), - new object[] { comboBox , channels }); - } - else - { + new object[] { comboBox, channels }); + } else { comboBox.Items.Clear(); comboBox.Items.AddRange(channels); comboBox.SelectedIndex = 0; @@ -145,18 +143,19 @@ namespace LSLEditor } private void SecondLifeHost_OnListenChannelsChanged(object sender, EventArgs e) { - foreach (Control control in this.panel4.Controls) - { + foreach (Control control in this.panel4.Controls) { GroupboxEvent gbe = control as GroupboxEvent; - if (gbe == null) + if (gbe == null) { continue; - foreach (Control control1 in gbe.Controls) - { + } + foreach (Control control1 in gbe.Controls) { GroupBox gb = control1 as GroupBox; - if (gb == null) + if (gb == null) { continue; - if (gb.Name!="listen_0") + } + if (gb.Name != "listen_0") { continue; + } ComboBox comboBox = gb.Controls[0] as ComboBox; AddListenChannelsToComboxBox(comboBox, SecondLifeHost.GetListenChannels()); } @@ -165,13 +164,10 @@ namespace LSLEditor void host_OnDie(object sender, EventArgs e) { - if(this.panel1.InvokeRequired) - { + if (this.panel1.InvokeRequired) { // using Evenhandler definition as a delegate this.panel1.Invoke(new EventHandler(host_OnDie)); - } - else - { + } else { this.panel1.Enabled = false; } } @@ -185,16 +181,11 @@ namespace LSLEditor private delegate void SetStateComboboxDelegate(string strName); public void SetStateCombobox(string strName) { - if (this.comboBox1.InvokeRequired) - { + if (this.comboBox1.InvokeRequired) { this.comboBox1.Invoke(new SetStateComboboxDelegate(SetStateCombobox), new object[] { strName }); - } - else - { - for (int intI = 0; intI < this.comboBox1.Items.Count; intI++) - { - if (this.comboBox1.Items[intI].ToString() == strName) - { + } else { + for (int intI = 0; intI < this.comboBox1.Items.Count; intI++) { + if (this.comboBox1.Items[intI].ToString() == strName) { this.comboBox1.SelectedIndex = intI; break; } @@ -204,13 +195,13 @@ namespace LSLEditor private void comboBox1_SelectedIndexChanged(object sender, System.EventArgs e) { - if (SecondLifeHost == null) - return; - string strStateName = (string)this.comboBox1.Items[this.comboBox1.SelectedIndex]; - if (strStateName != "") - { - if (SecondLifeHost.CurrentStateName != strStateName) - SecondLifeHost.State(strStateName,true); + if (SecondLifeHost != null) { + string strStateName = (string)this.comboBox1.Items[this.comboBox1.SelectedIndex]; + if (strStateName != "") { + if (SecondLifeHost.CurrentStateName != strStateName) { + SecondLifeHost.State(strStateName, true); + } + } } } @@ -230,8 +221,7 @@ namespace LSLEditor strC = translator.Parse(strC); - foreach (string strState in translator.States) - { + foreach (string strState in translator.States) { this.comboBox1.Items.Add(strState); } return strC; @@ -240,18 +230,14 @@ namespace LSLEditor private delegate void ShowLifeEventsDelegate(); private void ShowLifeEvents() { - if (this.panel4.InvokeRequired) - { + if (this.panel4.InvokeRequired) { this.panel4.Invoke(new ShowLifeEventsDelegate(ShowLifeEvents), null); - } - else - { + } else { int intX = 8; int intY = 0; this.panel4.Controls.Clear(); - foreach (string strEventName in SecondLifeHost.GetEvents()) - { + foreach (string strEventName in SecondLifeHost.GetEvents()) { string strArgs = SecondLifeHost.GetArgumentsFromMethod(strEventName); GroupboxEvent ge = new GroupboxEvent(new Point(intX, intY), strEventName, strArgs, new System.EventHandler(this.buttonEvent_Click)); this.panel4.Controls.Add(ge); @@ -265,28 +251,23 @@ namespace LSLEditor // Verbose public void VerboseConsole(string strLine) { - if (this.textBox2.IsDisposed) - return; - if (this.textBox2.InvokeRequired) - { - this.textBox2.Invoke(new AppendTextDelegate(VerboseConsole), new object[] { strLine }); - } - else - { - this.textBox2.AppendText(strLine.Replace("\n", "\r\n") + "\r\n"); + if (!this.textBox2.IsDisposed) { + if (this.textBox2.InvokeRequired) { + this.textBox2.Invoke(new AppendTextDelegate(VerboseConsole), new object[] { strLine }); + } else { + this.textBox2.AppendText(strLine.Replace("\n", "\r\n") + "\r\n"); + } } } private string GetArgumentValue(string strName) { - foreach (Control parent in this.panel4.Controls) - { - if (parent.Name == "GroupboxTextbox") - { - foreach (Control c in parent.Controls) - { - if (c.Name == strName) + foreach (Control parent in this.panel4.Controls) { + if (parent.Name == "GroupboxTextbox") { + foreach (Control c in parent.Controls) { + if (c.Name == strName) { return c.Controls[0].Text; + } } } } @@ -295,71 +276,62 @@ namespace LSLEditor private object[] GetArguments(string strName, string strArgs) { - if (strArgs == "") - return new object[0]; - - try - { - string[] args = strArgs.Trim().Split(new char[] { ',' }); - object[] argobjects = new object[args.Length]; - for (int intI = 0; intI < argobjects.Length; intI++) - { - string[] argument = args[intI].Trim().Split(new char[] { ' ' }); - if (argument.Length == 2) - { - string[] arArgs; - string strArgumentValue = GetArgumentValue(strName + "_" + intI); - string strArgumentName = argument[1]; - string strArgumentType = argument[0]; - switch (strArgumentType) - { - case "System.String": - argobjects[intI] = strArgumentValue; - break; - case "System.Int32": - argobjects[intI] = int.Parse(strArgumentValue); - break; - case "LSLEditor.SecondLife+Float": - argobjects[intI] = new SecondLife.Float(strArgumentValue); - break; - case "LSLEditor.SecondLife+integer": - argobjects[intI] = new SecondLife.integer(int.Parse(strArgumentValue)); - break; - case "LSLEditor.SecondLife+String": - argobjects[intI] = new SecondLife.String(strArgumentValue); - break; - case "LSLEditor.SecondLife+key": - argobjects[intI] = new SecondLife.key(strArgumentValue); - break; - case "LSLEditor.SecondLife+list": - argobjects[intI] = new SecondLife.list(new string[] { strArgumentValue } ); - break; - case "LSLEditor.SecondLife+rotation": - arArgs = strArgumentValue.Replace("<", "").Replace(">", "").Replace(" ", "").Split(new char[] { ',' }); - argobjects[intI] = new SecondLife.rotation(double.Parse(arArgs[0]), double.Parse(arArgs[1]), double.Parse(arArgs[2]), double.Parse(arArgs[3])); - break; - case "LSLEditor.SecondLife+vector": - arArgs = strArgumentValue.Replace("<", "").Replace(">", "").Replace(" ", "").Split(new char[] { ',' }); - argobjects[intI] = new SecondLife.vector(double.Parse(arArgs[0]), double.Parse(arArgs[1]), double.Parse(arArgs[2])); - break; - default: - MessageBox.Show("Compiler->GetArguments->[" + strArgumentType + "][" + strArgumentName + "]"); - argobjects[intI] = null; - break; + object[] objResult = new object[0]; + if (strArgs != "") { + try { + string[] args = strArgs.Trim().Split(new char[] { ',' }); + object[] argobjects = new object[args.Length]; + for (int intI = 0; intI < argobjects.Length; intI++) { + string[] argument = args[intI].Trim().Split(new char[] { ' ' }); + if (argument.Length == 2) { + string[] arArgs; + string strArgumentValue = GetArgumentValue(strName + "_" + intI); + string strArgumentName = argument[1]; + string strArgumentType = argument[0]; + switch (strArgumentType) { + case "System.String": + argobjects[intI] = strArgumentValue; + break; + case "System.Int32": + argobjects[intI] = int.Parse(strArgumentValue); + break; + case "LSLEditor.SecondLife+Float": + argobjects[intI] = new SecondLife.Float(strArgumentValue); + break; + case "LSLEditor.SecondLife+integer": + argobjects[intI] = new SecondLife.integer(int.Parse(strArgumentValue)); + break; + case "LSLEditor.SecondLife+String": + argobjects[intI] = new SecondLife.String(strArgumentValue); + break; + case "LSLEditor.SecondLife+key": + argobjects[intI] = new SecondLife.key(strArgumentValue); + break; + case "LSLEditor.SecondLife+list": + argobjects[intI] = new SecondLife.list(new string[] { strArgumentValue }); + break; + case "LSLEditor.SecondLife+rotation": + arArgs = strArgumentValue.Replace("<", "").Replace(">", "").Replace(" ", "").Split(new char[] { ',' }); + argobjects[intI] = new SecondLife.rotation(double.Parse(arArgs[0]), double.Parse(arArgs[1]), double.Parse(arArgs[2]), double.Parse(arArgs[3])); + break; + case "LSLEditor.SecondLife+vector": + arArgs = strArgumentValue.Replace("<", "").Replace(">", "").Replace(" ", "").Split(new char[] { ',' }); + argobjects[intI] = new SecondLife.vector(double.Parse(arArgs[0]), double.Parse(arArgs[1]), double.Parse(arArgs[2])); + break; + default: + MessageBox.Show("Compiler->GetArguments->[" + strArgumentType + "][" + strArgumentName + "]"); + argobjects[intI] = null; + break; + } + } else { + MessageBox.Show("Argument must be 'type name' [" + args[intI] + "]"); + break; } } - else - { - MessageBox.Show("Argument must be 'type name' [" + args[intI] + "]"); - break; - } - } - return argobjects; - } - catch - { - return new object[0]; + objResult = argobjects; + } catch { } } + return objResult; } private void buttonEvent_Click(object sender, System.EventArgs e) @@ -374,8 +346,9 @@ namespace LSLEditor private void Die() { - if (this.SecondLifeHost != null) + if (this.SecondLifeHost != null) { this.SecondLifeHost.Die(); + } } // Die @@ -386,8 +359,9 @@ namespace LSLEditor private void textBox2_KeyDown(object sender, KeyEventArgs e) { - if (e.Control && e.KeyCode == Keys.A) + if (e.Control && e.KeyCode == Keys.A) { this.textBox2.SelectAll(); + } } private void selectAllToolStripMenuItem_Click(object sender, EventArgs e) diff --git a/trunk/SimulatorConsole.cs b/trunk/SimulatorConsole.cs index 08e0b66..b1c9df0 100644 --- a/trunk/SimulatorConsole.cs +++ b/trunk/SimulatorConsole.cs @@ -71,10 +71,12 @@ namespace LSLEditor this.History = new List(); this.intHistory = 0; - if (Properties.Settings.Default.SimulatorLocation != Point.Empty) + if (Properties.Settings.Default.SimulatorLocation != Point.Empty) { this.Location = Properties.Settings.Default.SimulatorLocation; - if (Properties.Settings.Default.SimulatorSize != Size.Empty) + } + if (Properties.Settings.Default.SimulatorSize != Size.Empty) { this.Size = Properties.Settings.Default.SimulatorSize; + } this.Clear(); @@ -86,11 +88,11 @@ namespace LSLEditor this.LocationChanged += new EventHandler(SimulatorConsole_LocationChanged); - foreach (Form form in this.Children) - { + foreach (Form form in this.Children) { EditForm editForm = form as EditForm; - if (editForm == null || editForm.IsDisposed) + if (editForm == null || editForm.IsDisposed) { continue; + } editForm.ChatHandler = chathandler; editForm.MessageLinkedHandler = messagelinkedhandler; editForm.StartCompiler(); @@ -99,11 +101,11 @@ namespace LSLEditor public void Stop() { - foreach (Form form in this.Children) - { + foreach (Form form in this.Children) { EditForm editForm = form as EditForm; - if (editForm == null || editForm.IsDisposed) + if (editForm == null || editForm.IsDisposed) { continue; + } editForm.StopCompiler(); } } @@ -118,24 +120,26 @@ namespace LSLEditor this.Listen(e); // talk only to the owner - if (e.how == CommunicationType.OwnerSay) - return; + if (e.how != CommunicationType.OwnerSay) { + foreach (Form form in this.Children) { + EditForm editForm = form as EditForm; + if (editForm == null || editForm.IsDisposed) { + continue; + } - foreach (Form form in this.Children) - { - EditForm editForm = form as EditForm; - if (editForm == null || editForm.IsDisposed) - continue; + if (editForm.runtime == null) { + continue; + } - if (editForm.runtime == null) - continue; + if (editForm.runtime.SecondLifeHost == null) { + continue; + } - if (editForm.runtime.SecondLifeHost == null) - continue; - - // prevent loops loops loops loops, dont talk to myself - if (sender != editForm.runtime.SecondLifeHost) - editForm.runtime.SecondLifeHost.Listen(e); + // prevent loops loops loops loops, dont talk to myself + if (sender != editForm.runtime.SecondLifeHost) { + editForm.runtime.SecondLifeHost.Listen(e); + } + } } } @@ -149,8 +153,7 @@ namespace LSLEditor List list; int intLinkNum = e.iLinkIndex; - switch (intLinkNum) - { + 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); break; @@ -160,8 +163,7 @@ namespace LSLEditor case -2: // LINK_ALL_OTHERS , all other prims in object besides prim function is in list = this.solutionExplorer.GetScripts(RootObjectGuid, true); // remove scripts in prim itself, and below - foreach (Guid guid in this.solutionExplorer.GetScripts(ObjectGuid, true)) - { + foreach (Guid guid in this.solutionExplorer.GetScripts(ObjectGuid, true)) { if (list.Contains(guid)) list.Remove(guid); } @@ -169,19 +171,18 @@ namespace LSLEditor case -3: // LINK_ALL_CHILDREN , all child prims in object list = this.solutionExplorer.GetScripts(RootObjectGuid, true); // remove root itself - foreach (Guid guid in this.solutionExplorer.GetScripts(RootObjectGuid, false)) - { + foreach (Guid guid in this.solutionExplorer.GetScripts(RootObjectGuid, false)) { if (list.Contains(guid)) list.Remove(guid); } break; - case -4: // LINK_THIS - /* - * From SL Wiki: "Causes the script to act only upon the prim the prim the script is in." - * This means LINK_THIS, links to every script in the prim, not just the caller. - * @author = MrSoundless - * @date = 28 April 2011 - */ + case -4: // LINK_THIS + /* + * From SL Wiki: "Causes the script to act only upon the prim the prim the script is in." + * This means LINK_THIS, links to every script in the prim, not just the caller. + * @author = MrSoundless + * @date = 28 April 2011 + */ list = new List(); //list.Add(secondLifeHostSender.guid); // 4 feb 2008 list = this.solutionExplorer.GetScripts(ObjectGuid, true); // 28 april 2011 @@ -193,36 +194,41 @@ namespace LSLEditor } // only send message to running scripts in list - foreach (Form form in this.Children) - { + foreach (Form form in this.Children) { EditForm editForm = form as EditForm; - if (editForm == null || editForm.IsDisposed) + if (editForm == null || editForm.IsDisposed) { continue; + } - if (editForm.runtime == null) + if (editForm.runtime == null) { continue; + } - if (editForm.runtime.SecondLifeHost == null) + if (editForm.runtime.SecondLifeHost == null) { continue; + } - if(list.Contains(editForm.guid)) + if (list.Contains(editForm.guid)) { editForm.runtime.SecondLifeHost.LinkMessage(e); + } } } private void SimulatorConsole_OnControl(object sender, EventArgs e) { - foreach (Form form in this.Children) - { + foreach (Form form in this.Children) { EditForm editForm = form as EditForm; - if (editForm == null || editForm.IsDisposed) + if (editForm == null || editForm.IsDisposed) { continue; + } - if (editForm.runtime == null) + if (editForm.runtime == null) { continue; + } - if (editForm.runtime.SecondLifeHost == null) + if (editForm.runtime.SecondLifeHost == null) { continue; + } editForm.runtime.SecondLifeHost.SendControl((Keys)sender); } @@ -231,47 +237,48 @@ namespace LSLEditor private delegate void AppendTextDelegate(string strLine); public void TalkToSimulatorConsole(string strLine) { - if (this.textBox2.InvokeRequired) - { + if (this.textBox2.InvokeRequired) { this.textBox2.Invoke(new AppendTextDelegate(TalkToSimulatorConsole), new object[] { strLine }); - } - else - { + } else { this.textBox2.AppendText(strLine.Replace("\n", "\r\n") + "\r\n"); } } private void Chat(int channel, string name, SecondLife.key id, string message, CommunicationType how) { - if (OnChat != null) + if (OnChat != null) { OnChat(this, new SecondLifeHostChatEventArgs(channel, name, id, message, how)); + } } public void Listen(SecondLifeHostChatEventArgs e) { // 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; - if (e.name == Properties.Settings.Default.AvatarName) + if (e.name == Properties.Settings.Default.AvatarName) { strWho = "You"; + } - if (e.message.ToString().StartsWith("/me")) - { + if (e.message.ToString().StartsWith("/me")) { strWho = e.name; strHow = " "; strMessage = e.message.ToString().Substring(3).Trim(); } - if (e.channel == 0) + if (e.channel == 0) { TalkToSimulatorConsole(strWho + strHow + strMessage); + } } private void Speak(CommunicationType how) @@ -283,35 +290,26 @@ namespace LSLEditor intHistory = History.Count; - if (strMessage == "") - return; - - if (strMessage[0] == '/') - { - if (strMessage.StartsWith("/me")) - { - // do nothing - } - else - { - string strChannel = ""; - for (int intI = 1; intI < strMessage.Length; intI++) - { - if (strMessage[intI] >= '0' && strMessage[intI] <= '9') - { - strChannel += strMessage[intI]; - if (intI < 10) - continue; + if (strMessage != ""){ + if (strMessage[0] == '/') { + if (strMessage.StartsWith("/me")) { + // do nothing + } else { + string strChannel = ""; + for (int intI = 1; intI < strMessage.Length; intI++) { + if (strMessage[intI] >= '0' && strMessage[intI] <= '9') { + strChannel += strMessage[intI]; + if (intI < 10) { + continue; + } + } + try { + intChannel = Convert.ToInt32(strChannel); + strMessage = strMessage.Substring(intI).Trim(); + } catch { + } + break; } - try - { - intChannel = Convert.ToInt32(strChannel); - strMessage = strMessage.Substring(intI).Trim(); - } - catch - { - } - break; } } } @@ -336,13 +334,16 @@ namespace LSLEditor private void ScrollChat(KeyEventArgs e) { e.SuppressKeyPress = true; - if (e.KeyCode == Keys.Up) + if (e.KeyCode == Keys.Up) { intHistory = Math.Max(0, intHistory - 1); - if (e.KeyCode == Keys.Down) + } + if (e.KeyCode == Keys.Down) { intHistory = Math.Min(History.Count, intHistory + 1); + } this.textBox1.Clear(); - if (intHistory != History.Count) + if (intHistory != History.Count) { this.textBox1.AppendText(History[intHistory]); + } } private void textBox1_KeyDown(object sender, KeyEventArgs e) @@ -350,23 +351,16 @@ namespace LSLEditor this.buttonSay.Enabled = true; this.buttonShout.Enabled = true; - if (e.KeyCode == Keys.Return) - { + if (e.KeyCode == Keys.Return) { Speak(CommunicationType.Say); e.SuppressKeyPress = true; } - if (e.Control && (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down)) - { + if (e.Control && (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down)) { ScrollChat(e); - } - else if (e.KeyCode == Keys.Down || - e.KeyCode == Keys.Left || - e.KeyCode == Keys.Right || - e.KeyCode == Keys.Up - ) - { - if (OnControl != null) + } else if (e.KeyCode == Keys.Down || e.KeyCode == Keys.Left || e.KeyCode == Keys.Right || e.KeyCode == Keys.Up ) { + if (OnControl != null) { OnControl(e.KeyCode, new EventArgs()); + } e.SuppressKeyPress = true; } } @@ -391,8 +385,9 @@ namespace LSLEditor private void textBox2_KeyDown(object sender, KeyEventArgs e) { - if (e.Control && e.KeyCode == Keys.A) + if (e.Control && e.KeyCode == Keys.A) { this.textBox2.SelectAll(); + } } private void copyToolStripMenuItem_Click(object sender, EventArgs e) diff --git a/trunk/UpdateApplicationForm.cs b/trunk/UpdateApplicationForm.cs index cdaf6ff..16c53a5 100644 --- a/trunk/UpdateApplicationForm.cs +++ b/trunk/UpdateApplicationForm.cs @@ -112,10 +112,11 @@ namespace LSLEditor { Uri url; string strVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString(); - if (Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().Location).Contains("beta")) + if (Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().Location).Contains("beta")) { url = new Uri(Properties.Settings.Default.UpdateManifest + "?beta-" + strVersion); - else + } else { url = new Uri(Properties.Settings.Default.UpdateManifest + "?" + strVersion); + } manifest = new WebClient(); manifest.DownloadStringCompleted += new DownloadStringCompletedEventHandler(manifest_DownloadCompleted); @@ -130,28 +131,26 @@ namespace LSLEditor public void CheckForUpdate(bool blnForce) { - if (!blnForce) - { - if (Properties.Settings.Default.DeleteOldFiles) + if (!blnForce) { + if (Properties.Settings.Default.DeleteOldFiles) { DeleteOldFile(); + } DateTime dateTime = Properties.Settings.Default.CheckDate; - if (Properties.Settings.Default.CheckEveryDay) - { + if (Properties.Settings.Default.CheckEveryDay) { TimeSpan lastUpdate = DateTime.Now - dateTime; - if (lastUpdate.TotalDays >= 1.0) + if (lastUpdate.TotalDays >= 1.0) { blnForce = true; - } - else if (Properties.Settings.Default.CheckEveryWeek) - { + } + } else if (Properties.Settings.Default.CheckEveryWeek) { TimeSpan lastUpdate = DateTime.Now - dateTime; - if(lastUpdate.TotalDays >= 7.0) + if (lastUpdate.TotalDays >= 7.0) { blnForce = true; + } } } - if (blnForce) - { + if (blnForce) { Properties.Settings.Default.CheckDate = DateTime.Now; Properties.Settings.Default.Save(); // save also all settings @@ -164,7 +163,7 @@ namespace LSLEditor if (e.Error != null) return; - versionInfo bzip = new versionInfo(); + versionInfo bzip = new versionInfo(); versionInfo gzip = new versionInfo(); versionInfo wzip = new versionInfo(); @@ -176,19 +175,13 @@ namespace LSLEditor string strHelpHashMe = ""; string strHelpFile = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), Properties.Settings.Default.HelpOfflineFile); - if (File.Exists(strHelpFile)) - { + if (File.Exists(strHelpFile)) { strHelpHashMe = Decompressor.MD5Verify.ComputeHash(strHelpFile); - } - else - { + } else { // help file does not exist - if (Properties.Settings.Default.HelpOffline || blnOnlyHelpFile) - { + if (Properties.Settings.Default.HelpOffline || blnOnlyHelpFile) { strHelpHashMe = "*"; // force new update - } - else - { + } else { strHelpHashMe = ""; // no update this.labelHelpFile.Visible = false; this.labelHelpversionString.Visible = false; @@ -196,22 +189,22 @@ namespace LSLEditor } StringReader sr = new StringReader(e.Result); - for (int intI = 0; intI < 255; intI++) - { + for (int intI = 0; intI < 255; intI++) { string strLine = sr.ReadLine(); - if (strLine == null) + if (strLine == null) { break; - + } + int intSplit = strLine.IndexOf("="); - if (intSplit < 0) + if (intSplit < 0) { continue; - + } + string strName = strLine.Substring(0, intSplit); string strValue = strLine.Substring(intSplit + 1); //All hashes are of the uncompressed file. However, different archives may contain different versions. - switch (strName) - { + switch (strName) { case "Version": case "BZipVersion": bzip = new versionInfo(strValue); @@ -274,46 +267,39 @@ namespace LSLEditor this.labelOurVersionString.Text = current.version.ToString(); this.labelLatestVersionString.Text = web.version.ToString(); - if (String.IsNullOrEmpty(web.uri) || (web.version.CompareTo(current.version) != 1)) - { + if (String.IsNullOrEmpty(web.uri) || (web.version.CompareTo(current.version) != 1)) { return; } - if (strHelpHashMe == "") + if (strHelpHashMe == "") { strHelpHashMe = strHelpHashWeb; + } - if (strHelpHashMe == strHelpHashWeb) - { + if (strHelpHashMe == strHelpHashWeb) { this.labelHelpversionString.Text = "Up to date"; this.strHelpUrl = null; - } - else - { + } else { this.labelHelpversionString.Text = "Out of date"; } - if (current.hash == web.hash) - { + if (current.hash == web.hash) { this.strDownloadUrl = null; - } - else - { + } else { this.strDownloadUrl = web.uri; } - if (this.blnOnlyHelpFile) - { + if (this.blnOnlyHelpFile) { this.strDownloadUrl = null; this.labelLatestVersion.Visible = false; this.labelLatestVersionString.Visible = false; } - if (this.strHelpUrl != null || this.strDownloadUrl != null) - { + if (this.strHelpUrl != null || this.strDownloadUrl != null) { this.buttonUpdate.Enabled = true; - if (OnUpdateAvailable != null) + if (OnUpdateAvailable != null) { OnUpdateAvailable(this, null); + } } } @@ -330,85 +316,85 @@ namespace LSLEditor private void Download() { - if (strHelpUrl != null) + if (strHelpUrl != null) { DownloadHelpFile(); // starts also DownloadProgram when finished - else + } else { DownloadProgram(); + } } private void DownloadHelpFile() { - if (strHelpUrl == null) - return; + if (strHelpUrl != null) { + Uri url = new Uri(strHelpUrl); - Uri url = new Uri(strHelpUrl); + client = new WebClient(); - client = new WebClient(); + if (this.strHelpReferer != null) { + client.Headers.Add("Referer", strHelpReferer); + } - if(this.strHelpReferer != null) - client.Headers.Add("Referer", strHelpReferer); + client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadHelpFileCompleted); + client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged); - client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadHelpFileCompleted); - client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged); + string strCurrentFile = Assembly.GetExecutingAssembly().Location; + string strDirectory = Path.GetDirectoryName(strCurrentFile); + string strNewFile = Path.Combine(strDirectory, Properties.Settings.Default.HelpOfflineFile); - string strCurrentFile = Assembly.GetExecutingAssembly().Location; - string strDirectory = Path.GetDirectoryName(strCurrentFile); - string strNewFile = Path.Combine(strDirectory, Properties.Settings.Default.HelpOfflineFile); + if (File.Exists(strNewFile)) { + File.Delete(strNewFile); + } - if (File.Exists(strNewFile)) - File.Delete(strNewFile); - - client.DownloadFileAsync(url, strNewFile); + client.DownloadFileAsync(url, strNewFile); + } } void client_DownloadHelpFileCompleted(object sender, AsyncCompletedEventArgs e) { - try - { - if (e.Error != null) + try { + if (e.Error != null) { throw e.Error; + } string strCurrentFile = Assembly.GetExecutingAssembly().Location; string strDirectory = Path.GetDirectoryName(strCurrentFile); string strNewFile = Path.Combine(strDirectory, Properties.Settings.Default.HelpOfflineFile); string strComputedHash = Decompressor.MD5Verify.ComputeHash(strNewFile); - if (strComputedHash != strHelpHashWeb) - { + if (strComputedHash != strHelpHashWeb) { this.buttonUpdate.Enabled = true; throw new Exception("MD5 Hash of HelpFile not correct, try downloading again!"); } - if (this.strDownloadUrl != null) + if (this.strDownloadUrl != null) { DownloadProgram(); - else + } else { this.Close(); - } - catch (Exception exception) - { + } + } catch (Exception exception) { MessageBox.Show(exception.Message, "Oops...", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void DownloadProgram() { - if (strDownloadUrl == null) - return; + if (strDownloadUrl != null) { + Uri url = new Uri(strDownloadUrl); - Uri url = new Uri(strDownloadUrl); + client = new WebClient(); + client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted); + client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged); - client = new WebClient(); - client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted); - client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged); + string strCurrentFile = Assembly.GetExecutingAssembly().Location; + string strDirectory = Path.GetDirectoryName(strCurrentFile); + string strNewFileName = Path.GetFileName(strDownloadUrl); + string strNewFile = Path.Combine(strDirectory, strNewFileName); - string strCurrentFile = Assembly.GetExecutingAssembly().Location; - string strDirectory = Path.GetDirectoryName(strCurrentFile); - string strNewFileName = Path.GetFileName(strDownloadUrl); - string strNewFile = Path.Combine(strDirectory, strNewFileName); + if (File.Exists(strNewFile)) { + File.Delete(strNewFile); + } - if (File.Exists(strNewFile)) - File.Delete(strNewFile); - - client.DownloadFileAsync(url, strNewFile, strNewFileName); + client.DownloadFileAsync(url, strNewFile, strNewFileName); + } } void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e) @@ -418,10 +404,10 @@ namespace LSLEditor void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e) { - try - { - if (e.Error != null) + try { + if (e.Error != null) { throw e.Error; + } string strNewFileName = e.UserState.ToString(); @@ -433,8 +419,7 @@ namespace LSLEditor string strOldFile = Path.Combine(strDirectory, "_LSLEditor.exe"); string strExtension = Path.GetExtension(strNewFileName); - switch (strExtension) - { + switch (strExtension) { case ".bz2": Decompressor.BZip2.Decompress(File.OpenRead(strZipFile), File.Create(strNewFile)); break; @@ -449,16 +434,16 @@ namespace LSLEditor break; } string strComputedHash = Decompressor.MD5Verify.ComputeHash(strNewFile); - if (strComputedHash == strHashWeb) - { + if (strComputedHash == strHashWeb) { if (File.Exists(strOldFile)) File.Delete(strOldFile); File.Move(strCurrentFile, strOldFile); File.Move(strNewFile, strCurrentFile); - if (File.Exists(strZipFile)) + if (File.Exists(strZipFile)) { File.Delete(strZipFile); + } // save all there is pending (if any) Properties.Settings.Default.Save(); @@ -466,32 +451,28 @@ namespace LSLEditor System.Diagnostics.Process.Start(strCurrentFile); Environment.Exit(0); - } - else - { + } else { this.buttonUpdate.Enabled = true; throw new Exception("MD5 Hash not correct, try downloading again!"); } - } - catch (Exception exception) - { + } catch (Exception exception) { MessageBox.Show(exception.Message, "Oops...", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void UpdateApplicationForm_FormClosing(object sender, FormClosingEventArgs e) { - if (client != null) - { - if (client.IsBusy) + if (client != null) { + if (client.IsBusy) { client.CancelAsync(); + } client.Dispose(); } client = null; - if (manifest != null) - { - if (manifest.IsBusy) + if (manifest != null) { + if (manifest.IsBusy) { manifest.CancelAsync(); + } manifest.Dispose(); } manifest = null; @@ -502,9 +483,10 @@ namespace LSLEditor string strCurrentFile = Assembly.GetExecutingAssembly().Location; string strDirectory = Path.GetDirectoryName(strCurrentFile); string strOldFile = Path.Combine(strDirectory, "_LSLEditor.exe"); - if (File.Exists(strOldFile)) + if (File.Exists(strOldFile)) { File.Delete(strOldFile); + } } } -} \ No newline at end of file +} diff --git a/trunk/llDialogForm.cs b/trunk/llDialogForm.cs index 7adf465..aaaf176 100644 --- a/trunk/llDialogForm.cs +++ b/trunk/llDialogForm.cs @@ -58,7 +58,7 @@ namespace LSLEditor private string OwnerName; private SecondLife.key id; - public llDialogForm(SecondLifeHost host, SecondLife.String strObjectName, SecondLife.key id, SecondLife.String strOwner, SecondLife.String strMessage, SecondLife.list buttons, SecondLife.integer intChannel) + public llDialogForm(SecondLifeHost host, SecondLife.String strObjectName, SecondLife.key id, SecondLife.String strOwner, SecondLife.String strMessage, SecondLife.list buttons, SecondLife.integer intChannel) { InitializeComponent(); @@ -68,21 +68,19 @@ namespace LSLEditor this.ObjectName = strObjectName; this.id = id; - for (int intI = 1; intI <= 12; intI++) - { + for (int intI = 1; intI <= 12; intI++) { Button button = this.Controls["Button" + intI] as Button; button.Visible = false; } - this.label1.Text = strOwner + "'s '" + strObjectName +"'"; - this.label2.Text = strMessage.ToString().Replace("&","&&"); + this.label1.Text = strOwner + "'s '" + strObjectName + "'"; + this.label2.Text = strMessage.ToString().Replace("&", "&&"); - for (int intI = 1; intI <= buttons.Count; intI++) - { + for (int intI = 1; intI <= buttons.Count; intI++) { Button button = this.Controls["Button" + intI] as Button; if (button == null) continue; - button.Text = buttons[intI - 1].ToString().Replace("&","&&"); + button.Text = buttons[intI - 1].ToString().Replace("&", "&&"); button.Visible = true; button.Click += new EventHandler(button_Click); } @@ -91,10 +89,10 @@ namespace LSLEditor void button_Click(object sender, EventArgs e) { Button button = sender as Button; - if (button == null) - return; - host.Chat(this,this.Channel, this.OwnerName, this.id, button.Text.Replace("&&","&"), CommunicationType.Say); - this.Close(); + if (button != null) { + host.Chat(this, this.Channel, this.OwnerName, this.id, button.Text.Replace("&&", "&"), CommunicationType.Say); + this.Close(); + } } private void button13_Click(object sender, EventArgs e) @@ -102,4 +100,4 @@ namespace LSLEditor this.Close(); } } -} \ No newline at end of file +} diff --git a/trunk/llTextBoxForm.cs b/trunk/llTextBoxForm.cs index 4ee700f..470dfdb 100644 --- a/trunk/llTextBoxForm.cs +++ b/trunk/llTextBoxForm.cs @@ -12,40 +12,39 @@ using System.Windows.Forms; namespace LSLEditor { - public partial class llTextBoxForm : Form - { - private SecondLifeHost host; - private int Channel; - private string ObjectName; - private string OwnerName; - private SecondLife.key id; + public partial class llTextBoxForm : Form + { + private SecondLifeHost host; + private int Channel; + private string ObjectName; + private string OwnerName; + private SecondLife.key id; - public llTextBoxForm(SecondLifeHost host, SecondLife.String strObjectName, SecondLife.key id, SecondLife.String strOwner, SecondLife.String strMessage, SecondLife.integer intChannel) - { - InitializeComponent(); + public llTextBoxForm(SecondLifeHost host, SecondLife.String strObjectName, SecondLife.key id, SecondLife.String strOwner, SecondLife.String strMessage, SecondLife.integer intChannel) + { + InitializeComponent(); - this.host = host; - this.Channel = intChannel; - this.OwnerName = strOwner; - this.ObjectName = strObjectName; - this.id = id; + this.host = host; + this.Channel = intChannel; + this.OwnerName = strOwner; + this.ObjectName = strObjectName; + this.id = id; - this.label1.Text = strMessage.ToString().Replace("&", "&&"); - } + this.label1.Text = strMessage.ToString().Replace("&", "&&"); + } - private void buttonIgnore_Click(object sender, EventArgs e) - { - this.Close(); - } - - private void buttonOK_Click(object sender, EventArgs e) - { - Button button = sender as Button; - if (button == null) - return; - - host.Chat(this,this.Channel, this.OwnerName, this.id, textBox.Text.Replace("&&","&"), CommunicationType.Say); + private void buttonIgnore_Click(object sender, EventArgs e) + { this.Close(); - } - } -} \ No newline at end of file + } + + private void buttonOK_Click(object sender, EventArgs e) + { + Button button = sender as Button; + if (button != null) { + host.Chat(this, this.Channel, this.OwnerName, this.id, textBox.Text.Replace("&&", "&"), CommunicationType.Say); + this.Close(); + } + } + } +} From afddb63ecc7633c594ea2dd5503835776818aaae Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Mon, 15 Jul 2013 20:58:55 +0100 Subject: [PATCH 10/11] Adding StyleCop changes to allow style enforcement. --- trunk/Settings.StyleCop | 163 +++++++++++++++++ trunk/lsleditor.csproj | 382 +++++++++++++++++++++++++++++++++------- 2 files changed, 477 insertions(+), 68 deletions(-) create mode 100644 trunk/Settings.StyleCop diff --git a/trunk/Settings.StyleCop b/trunk/Settings.StyleCop new file mode 100644 index 0000000..fad8a5b --- /dev/null +++ b/trunk/Settings.StyleCop @@ -0,0 +1,163 @@ + + + en-GB + NoMerge + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + False + + + + + True + + + + + True + + + + + False + + + + + True + + + + + True + + + + + True + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + + + + + + False + + + + + False + + + + + + + + + + False + + + + + + + + + + False + + + + + False + + + + + False + + + + + False + + + + + + + \ No newline at end of file diff --git a/trunk/lsleditor.csproj b/trunk/lsleditor.csproj index 4294ae0..e30729e 100644 --- a/trunk/lsleditor.csproj +++ b/trunk/lsleditor.csproj @@ -1,4 +1,4 @@ - + Local @@ -125,274 +125,471 @@ About.cs + false Form + true BugReportForm.cs + true + + + true + + + true + + + true + + + true + + + true - - - - - Component + true + + + true - Form + true + + + true + + + true + + + true + + + true - - - - UserControl + true UserControl + true Component + true + + + true - Component + true Component + true Component + true Component + true Component + true Component + true Component + true Component + true + + + true + + + true - - Component + true Component + true Component + true + + + true - Form + true Component + true + + + true - Form + true + + + true + + + true + + + true + + + true + + + true - - - - - Component + true + + + true + + + true + + + true + + + true + + + true + + + true - - - - - - Component + true + + + true + + + true - - Component + true Component + true Component + true + + + true + + + true + + + true - - - - - - - - - - + + true + + + true + + + true + + + true + + + true + + + true + + + true + Form + true llTextBoxForm.cs + true + + + true + + + true + + + true + + + true + + + true - - - - - Form + true GuidProperty.cs + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true - - - - - - - - - Form + true NewProject.cs + true Form + true PermissionsForm.cs + true Form + true GotoWindow.cs + true UserControl + true Numbered.cs + true Form + true TooltipWindow.cs + true Component + true GListBox.cs + true Form + true GListBoxWindow.cs + true UserControl + true RichLabel.cs + true Form + true llDialogForm.cs + true + + + true + + + true - - Form + true Browser.cs + true + + + true - Form + true EditForm.cs + true Form + true FindWindow.cs + true Form + true LSLEditorForm.cs + true True True Resources.resx + true True True Settings.settings + true + + + true - Component + true + + + true - UserControl + true NumberedTextBoxUC.cs + true UserControl + true RuntimeConsole.cs + true + + + true - Code + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true - - - - - - - Component + true Code + true Designer @@ -400,139 +597,187 @@ Code + false Component + true TabControlExtended.cs + true Form + true SimulatorConsole.cs + true Form + true SolutionExplorer.cs + true Form + true SvnAguments.cs + true + + + true + + + true - - Form + true SyntaxError.cs + true UserControl + true EnvironmentPlugins.cs + true UserControl + true RuntimeGeneral.cs + true UserControl + true TextEditorCodeCompletion.cs + true UserControl + true EnvironmentBrowser.cs + true UserControl + true ProjectSettings.cs + true UserControl + true RuntimeInternal.cs + true UserControl + true RuntimeSmtp.cs + true UserControl + true RuntimeExternal.cs + true UserControl + true EnvironmentGeneral.cs + true UserControl + true TextEditorFontColors.cs + true UserControl + true EnvironmentHelp.cs + true UserControl + true TextEditorGeneral.cs + true Form + true ToolsOptions.cs + true UserControl + true VersionControlGeneral.cs + true Form + true ToolWindow.cs + true Form + true UpdateApplicationForm.cs + true True True Reference.map + true Designer @@ -871,6 +1116,7 @@ + "$(FrameworkSDKDir)Bin\rc.exe" /r "$(ProjectDir)$(TargetName).rc" $(SolutionDir)\..\build\AssemblyRevisionIncrementer.exe /t="$(SolutionDir)\Properties\AssemblyInfo.cs" From 571f0343956edbd049d2bcaf439de558c8aed3c5 Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Mon, 15 Jul 2013 21:00:09 +0100 Subject: [PATCH 11/11] Updating first batch of files. --- trunk/About.Designer.cs | 58 ++++-- trunk/About.cs | 24 ++- trunk/Properties/AssemblyInfo.cs | 4 +- trunk/SecondLife/SecondLifeConstants.cs | 1 + trunk/SecondLife/SecondLifeFunctions.cs | 78 ++++---- trunk/SecondLife/SecondLifeMain.cs | 250 ++++++++++++++---------- 6 files changed, 260 insertions(+), 155 deletions(-) diff --git a/trunk/About.Designer.cs b/trunk/About.Designer.cs index 1eb81b3..180ba9a 100644 --- a/trunk/About.Designer.cs +++ b/trunk/About.Designer.cs @@ -1,22 +1,60 @@ namespace LSLEditor { - partial class About + /// + /// About dialogue box form. + /// + public partial class About { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; + /// + /// Container for LSLife picture. + /// + private System.Windows.Forms.PictureBox pictureBox1; + + /// + /// Container to hold all the elements. + /// + private System.Windows.Forms.GroupBox groupBox1; + + /// + /// OK Button. + /// + private System.Windows.Forms.Button button1; + + /// + /// Web Browser. + /// + private System.Windows.Forms.WebBrowser webBrowser1; + + /// + /// Link label. + /// + private System.Windows.Forms.LinkLabel linkLabel1; + + /// + /// Version label. + /// + private System.Windows.Forms.Label label1; + + /// + /// LSL Editor label. + /// + private System.Windows.Forms.Label label2; + /// /// Clean up any resources being used. /// - /// true if managed resources should be disposed; otherwise, false. + /// True if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { - if (disposing && (components != null)) - { - components.Dispose(); + if (disposing && (this.components != null)) { + this.components.Dispose(); } + base.Dispose(disposing); } @@ -133,13 +171,5 @@ namespace LSLEditor } #endregion - - private System.Windows.Forms.PictureBox pictureBox1; - private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.Button button1; - private System.Windows.Forms.WebBrowser webBrowser1; - private System.Windows.Forms.LinkLabel linkLabel1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label1; } -} \ No newline at end of file +} diff --git a/trunk/About.cs b/trunk/About.cs index 36b3bdc..92b529e 100644 --- a/trunk/About.cs +++ b/trunk/About.cs @@ -42,18 +42,23 @@ // ******** // */ using System; +using System.ComponentModel; using System.IO; using System.Reflection; -using System.ComponentModel; using System.Windows.Forms; namespace LSLEditor { + /// About dialogue box form. public partial class About : Form { + /// + /// Initialises a new instance of the class. + /// + /// The parent form. public About(LSLEditorForm parent) { - InitializeComponent(); + this.InitializeComponent(); this.Icon = parent.Icon; @@ -61,16 +66,31 @@ namespace LSLEditor this.label2.Text = strVersion; } + /// + /// OK/Close button. + /// + /// + /// private void button1_Click(object sender, EventArgs e) { this.Close(); } + /// + /// Link to SourceForge page. + /// + /// + /// private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { System.Diagnostics.Process.Start(Properties.Settings.Default.ContactUrl); } + /// + /// Loads the page. + /// + /// + /// private void About_Load(object sender, EventArgs e) { string strExeFileName = Path.GetFileName(Assembly.GetExecutingAssembly().CodeBase); diff --git a/trunk/Properties/AssemblyInfo.cs b/trunk/Properties/AssemblyInfo.cs index 5f3912f..8f5d300 100644 --- a/trunk/Properties/AssemblyInfo.cs +++ b/trunk/Properties/AssemblyInfo.cs @@ -70,7 +70,7 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: // We use a Major.Minor.Bugfix.Build pattern. -[assembly: AssemblyVersion("2.999.999.13")] +[assembly: AssemblyVersion("2.999.999.117")] // // In order to sign your assembly you must specify a key to use. Refer to the @@ -100,4 +100,4 @@ using System.Runtime.InteropServices; [assembly: AssemblyDelaySign(false)] //[assembly: AssemblyKeyName("")] [assembly: ComVisibleAttribute(false)] -[assembly: AssemblyFileVersionAttribute("2.999.999.13")] +[assembly: AssemblyFileVersionAttribute("2.999.999.117")] diff --git a/trunk/SecondLife/SecondLifeConstants.cs b/trunk/SecondLife/SecondLifeConstants.cs index 5228575..2d2a418 100644 --- a/trunk/SecondLife/SecondLifeConstants.cs +++ b/trunk/SecondLife/SecondLifeConstants.cs @@ -280,6 +280,7 @@ namespace LSLEditor public const int INVENTORY_ANIMATION = 20; public const int INVENTORY_GESTURE = 21; + public const int JSON_APPEND = -1; public static readonly string JSON_ARRAY = "\uFDD2"; public static readonly string JSON_FALSE = "\uFDD7"; public static readonly string JSON_INVALID = "\uFDD0"; diff --git a/trunk/SecondLife/SecondLifeFunctions.cs b/trunk/SecondLife/SecondLifeFunctions.cs index 0ecadc2..489b9a0 100644 --- a/trunk/SecondLife/SecondLifeFunctions.cs +++ b/trunk/SecondLife/SecondLifeFunctions.cs @@ -67,31 +67,31 @@ namespace LSLEditor public void llAddToLandBanList(key kID, Float fHours) { Verbose("llAddToLandBanList({0}, {1})", kID, fHours); - if (m_LandBanList.ContainsKey(kID)) { - m_LandBanList.Remove(kID); + if (htLandBanList.ContainsKey(kID)) { + htLandBanList.Remove(kID); } - m_LandBanList.Add(kID, fHours); + htLandBanList.Add(kID, fHours); } public void llAddToLandPassList(key kID, Float fHours) { Verbose("llAddToLandPassList({0}, {1})", kID, fHours); - if (m_LandPassList.ContainsKey(kID)) { - m_LandPassList.Remove(kID); + if (htLandPassList.ContainsKey(kID)) { + htLandPassList.Remove(kID); } - m_LandPassList.Add(kID, fHours); + htLandPassList.Add(kID, fHours); } public void llAdjustSoundVolume(Float fVolume) { Verbose("llAdjustSoundVolume({0}), fVolume"); - m_Volume = fVolume; + this.fVolume = fVolume; } public void llAllowInventoryDrop(integer iAllowDrop) { Verbose("llAllowInventoryDrop({0})", iAllowDrop); - m_AllowDrop = (Boolean)iAllowDrop; + blnAllowDrop = (Boolean)iAllowDrop; } public Float llAngleBetween(rotation a, rotation b) @@ -659,7 +659,7 @@ namespace LSLEditor public Float llFrand(Float fMaximum) { - double dblValue = fMaximum * m_random.NextDouble(); + double dblValue = fMaximum * rdmRandom.NextDouble(); Verbose("llFrand({0})={1}", fMaximum, dblValue); return dblValue; } @@ -1029,14 +1029,14 @@ namespace LSLEditor public vector llGetLocalPos() { - Verbose("llGetLocalPos()={0}", m_pos); - return m_pos; + Verbose("llGetLocalPos()={0}", vPosition); + return vPosition; } public rotation llGetLocalRot() { - Verbose("llGetLocalRot()={0}", m_rotlocal); - return m_rotlocal; + Verbose("llGetLocalRot()={0}", rRotationlocal); + return rRotationlocal; } public Float llGetMass() @@ -1250,8 +1250,8 @@ namespace LSLEditor public string llGetParcelMusicURL() { - Verbose(@"llGetParcelMaxPrims()=""{0}""", m_ParcelMusicURL); - return m_ParcelMusicURL; + Verbose(@"llGetParcelMaxPrims()=""{0}""", sParcelMusicURL); + return sParcelMusicURL; } public integer llGetParcelPrimCount(vector vPosition, integer iCategory, integer iSimWide) @@ -1291,8 +1291,8 @@ namespace LSLEditor public vector llGetPos() { - Verbose("llGetPos()={0}", m_pos); - return m_pos; + Verbose("llGetPos()={0}", vPosition); + return vPosition; } public list llGetPrimMediaParams(integer iFace, list lDesiredParams) @@ -1369,8 +1369,8 @@ namespace LSLEditor public rotation llGetRot() { - Verbose("llGetRot()={0}", m_rot); - return m_rot; + Verbose("llGetRot()={0}", rRotation); + return rRotation; } public integer llGetSPMaxMemory() @@ -1382,8 +1382,8 @@ namespace LSLEditor public vector llGetScale() { - Verbose("llGetScale()=" + m_scale); - return m_scale; + Verbose("llGetScale()=" + vScale); + return vScale; } public String llGetScriptName() @@ -1416,8 +1416,8 @@ namespace LSLEditor public integer llGetStartParameter() { - Verbose("llGetStartParameter()={0}" + m_start_parameter); - return m_start_parameter; + Verbose("llGetStartParameter()={0}" + iStartParameter); + return iStartParameter; } public list llGetStaticPath(vector vStart, vector vEnd, Float fRadius, list lParameters) @@ -1498,7 +1498,7 @@ namespace LSLEditor public Float llGetTime() { - TimeSpan span = DateTime.Now.ToUniversalTime() - m_DateTimeScriptStarted; + TimeSpan span = DateTime.Now.ToUniversalTime() - dtDateTimeScriptStarted; Verbose("llGetTime()={0}", span.TotalSeconds); return span.TotalSeconds; } @@ -2388,16 +2388,16 @@ namespace LSLEditor public void llRemoveFromLandBanList(key kAvatarID) { Verbose("llRemoveFromLandBanList({0})", kAvatarID); - if (m_LandBanList.ContainsKey(kAvatarID)) { - m_LandBanList.Remove(kAvatarID); + if (htLandBanList.ContainsKey(kAvatarID)) { + htLandBanList.Remove(kAvatarID); } } public void llRemoveFromLandPassList(key kAvatarID) { Verbose("llRemoveFromLandPassList({0})", kAvatarID); - if (m_LandPassList.ContainsKey(kAvatarID)) { - m_LandPassList.Remove(kAvatarID); + if (htLandPassList.ContainsKey(kAvatarID)) { + htLandPassList.Remove(kAvatarID); } } @@ -2498,13 +2498,13 @@ namespace LSLEditor public void llResetLandBanList() { - m_LandBanList = new Hashtable(); + htLandBanList = new Hashtable(); Verbose("llResetLandBanList()"); } public void llResetLandPassList() { - m_LandPassList = new Hashtable(); + htLandPassList = new Hashtable(); Verbose("llResetLandPassList()"); } @@ -2524,7 +2524,7 @@ namespace LSLEditor public void llResetTime() { Verbose("llResetTime()"); - m_DateTimeScriptStarted = DateTime.Now.ToUniversalTime(); + dtDateTimeScriptStarted = DateTime.Now.ToUniversalTime(); } public integer llReturnObjectsByID(list lObjects) @@ -2833,7 +2833,7 @@ namespace LSLEditor public void llSetLocalRot(rotation rRotation) { - this.m_rotlocal = rRotation; + this.rRotationlocal = rRotation; Verbose("llSetLocalRot({0})", rRotation); } @@ -2864,7 +2864,7 @@ namespace LSLEditor public void llSetParcelMusicURL(String sURL) { Verbose(@"llSetParcelMusicURL(""{0}"")", sURL); - m_ParcelMusicURL = sURL; + sParcelMusicURL = sURL; } public void llSetPayPrice(integer iPrice, list lButtons) @@ -2880,7 +2880,7 @@ namespace LSLEditor public void llSetPos(vector vPosition) { Verbose("llSetPos({0})", vPosition); - m_pos = vPosition; + this.vPosition = vPosition; } public integer llSetPrimMediaParams(integer iFace, list lParameters) @@ -2899,7 +2899,7 @@ namespace LSLEditor { integer iResult = true; Verbose("llSetRegionPos({0})={1}", vPosition, iResult); - m_pos = vPosition; + this.vPosition = vPosition; return iResult; } @@ -2911,13 +2911,13 @@ namespace LSLEditor public void llSetRot(rotation rRotation) { Verbose("llSetRot({0})", rRotation); - m_rot = rRotation; + this.rRotation = rRotation; } public void llSetScale(vector vScale) { Verbose("llSetScale({0})", vScale); - m_scale = vScale; + this.vScale = vScale; } public void llSetScriptState(String sName, integer iRunState) @@ -2928,7 +2928,7 @@ namespace LSLEditor public void llSetSitText(String sText) { Verbose(@"llSetSitText(""{0}"")", sText); - m_SitText = sText; + sSitText = sText; } public void llSetSoundQueueing(integer iQueueFlag) @@ -2938,7 +2938,7 @@ namespace LSLEditor public void llSetSoundRadius(Float fRadius) { - m_SoundRadius = fRadius; + fSoundRadius = fRadius; Verbose("llSetSoundRadius({0})", fRadius); } diff --git a/trunk/SecondLife/SecondLifeMain.cs b/trunk/SecondLife/SecondLifeMain.cs index ac95d71..0233c67 100644 --- a/trunk/SecondLife/SecondLifeMain.cs +++ b/trunk/SecondLife/SecondLifeMain.cs @@ -42,19 +42,21 @@ // ******** // */ using System; -using System.Text; -using System.Text.RegularExpressions; using System.Collections; using System.Collections.Generic; +using System.Text; +using System.Text.RegularExpressions; - -// +/* // (C) 2006,2007 Alphons van der Heijden // mail: alphons@heijden.com -// + */ namespace LSLEditor { + /// + /// Enumeration of Communication Types that the host understands + /// public enum CommunicationType { Whisper, Say, Shout, OwnerSay, RegionSay, RegionSayTo @@ -62,80 +64,109 @@ namespace LSLEditor public partial class SecondLife { - // Make friends with my host - public SecondLifeHost host; + /// + /// Holds the host object. + /// + private SecondLifeHost slhHost; #region members - // Random generator - private Random m_random; + /// + /// Random generator. + /// + private Random rdmRandom; - private DateTime m_DateTimeScriptStarted; + /// + /// Holds the time of the script starting execution. + /// + private DateTime dtDateTimeScriptStarted; - private Boolean m_AllowDrop = false; - private Hashtable m_LandPassList; + /// + /// Contains a boolean value indicating wether this object accepts other items to be dropped into it. + /// + private bool blnAllowDrop = false; - private Hashtable m_LandBanList; + /// + /// Contains a list of keys of avatars that may enter a parcel. + /// + private Hashtable htLandPassList; - private Float m_Volume; + /// + /// Contains a list of keys of avatars that may NOT enter a parcel. + /// + private Hashtable htLandBanList; - private String m_ObjectName; - private String m_ParcelMusicURL; - private vector m_pos; - private rotation m_rot; - private rotation m_rotlocal; - private vector m_scale; - private String m_SitText; - private Float m_SoundRadius; + /// + /// Volume of sound played by this prim. + /// + private Float fVolume; - private vector m_RegionCorner; + private String sObjectName; + private String sParcelMusicURL; + private vector vPosition; + private rotation rRotation; + private rotation rRotationlocal; + private vector vScale; + private String sSitText; + private Float fSoundRadius; - private integer m_start_parameter; + private vector vRegionCorner; + private integer iStartParameter; + + #endregion + + #region Constructor + /// + /// Initialises the class. + /// + public SecondLife() + { + this.host = null; + rdmRandom = new Random(); + dtDateTimeScriptStarted = DateTime.Now.ToUniversalTime(); + htLandPassList = new Hashtable(); + htLandBanList = new Hashtable(); + fVolume = 0.0; + sObjectName = null; + vPosition = new vector(127, 128, 20); + rRotation = rotation.ZERO_ROTATION; + rRotationlocal = rotation.ZERO_ROTATION; + vScale = vector.ZERO_VECTOR; + sSitText = "sittext"; + fSoundRadius = 1.0; + iStartParameter = 0; + + vRegionCorner = vector.ZERO_VECTOR; + } #endregion #region Properties public vector GetLocalPos { // TODO change this to use a call to llGetLocalPos specifying NOT to be Verbose. After all functions have been changed to allow verbose/silent option. - get { return m_pos; } + get { return vPosition; } } - #endregion - - #region constructor - public SecondLife() + + public SecondLifeHost host { - host = null; - m_random = new Random(); - m_DateTimeScriptStarted = DateTime.Now.ToUniversalTime(); - m_LandPassList = new Hashtable(); - m_LandBanList = new Hashtable(); - m_Volume = 0.0; - m_ObjectName = null; - m_pos = new vector(127, 128, 20); - m_rot = rotation.ZERO_ROTATION; - m_rotlocal = rotation.ZERO_ROTATION; - m_scale = vector.ZERO_VECTOR; - m_SitText = "sittext"; - m_SoundRadius = 1.0; - m_start_parameter = 0; - - m_RegionCorner = vector.ZERO_VECTOR; + get { return this.slhHost; } + set { this.slhHost = value; } } #endregion - + #region internal routines private void Verbose(string strLine, params object[] parameters) { if (parameters.Length == 0) { host.VerboseMessage(strLine); } else { - host.VerboseMessage(string.Format(strLine, parameters)); + this.host.VerboseMessage(string.Format(strLine, parameters)); } } private void Chat(integer iChannel, string sText, CommunicationType ctHow) { - host.Chat(host, iChannel, host.GetObjectName(), host.GetKey(), sText, ctHow); + this.host.Chat(this.host, iChannel, this.host.GetObjectName(), this.host.GetKey(), sText, ctHow); } public void state(string strStateName) @@ -178,8 +209,9 @@ namespace LSLEditor public ArrayList RandomShuffle(ArrayList alCollection) { - // We have to copy all items anyway, and there isn't a way to produce the items - // on the fly that is linear. So copying to an array and shuffling it is as efficient as we can get. + /* We have to copy all items anyway, and there isn't a way to produce the items + on the fly that is linear. So copying to an array and shuffling it is as efficient as we can get. + */ if (alCollection == null) { throw new ArgumentNullException("collection"); @@ -188,7 +220,7 @@ namespace LSLEditor int intCount = alCollection.Count; for (int i = intCount - 1; i >= 1; --i) { // Pick an random number 0 through i inclusive. - int j = m_random.Next(i + 1); + int j = rdmRandom.Next(i + 1); // Swap array[i] and array[j] object temp = alCollection[i]; @@ -225,37 +257,46 @@ namespace LSLEditor return new list(items); } + /// + /// Implements the Comparer Interface for our custom types (Float, Integer, and String). + /// private class BucketComparer : IComparer { private integer iAscending; + + /// + /// Initialises the class. + /// + /// public BucketComparer(integer ascending) { this.iAscending = ascending; } + public int Compare(object x, object y) { int iResult = 0; - object A, B; + object objA, objB; object[] xx = x as object[]; object[] yy = y as object[]; if (iAscending == TRUE) { - A = xx[0]; - B = yy[0]; + objA = xx[0]; + objB = yy[0]; } else { - B = xx[0]; - A = yy[0]; + objB = xx[0]; + objA = yy[0]; } - string strType = A.GetType().ToString(); + string strType = objA.GetType().ToString(); - if (((A is string) && (B is string)) || ((A is SecondLife.String) && (B is SecondLife.String))) { - iResult = string.Compare(A.ToString(), B.ToString()); - } else if ((A is SecondLife.integer) && (B is SecondLife.integer)) { - iResult = SecondLife.integer.Compare((SecondLife.integer)A, (SecondLife.integer)B); - } else if ((A is SecondLife.Float) && (B is SecondLife.Float)) { - iResult = SecondLife.Float.Compare((SecondLife.Float)A, (SecondLife.Float)B); + if (((objA is string) && (objB is string)) || ((objA is SecondLife.String) && (objB is SecondLife.String))) { + iResult = string.Compare(objA.ToString(), objB.ToString()); + } else if ((objA is SecondLife.integer) && (objB is SecondLife.integer)) { + iResult = SecondLife.integer.Compare((SecondLife.integer)objA, (SecondLife.integer)objB); + } else if ((objA is SecondLife.Float) && (objB is SecondLife.Float)) { + iResult = SecondLife.Float.Compare((SecondLife.Float)objA, (SecondLife.Float)objB); } return iResult; @@ -289,7 +330,9 @@ namespace LSLEditor } } - if (blnFound) continue; + if (blnFound) { + continue; + } for (int intJ = 0; intJ < lSpacers.Count; intJ++) { string strSpacer = lSpacers[intJ].ToString(); @@ -347,24 +390,25 @@ namespace LSLEditor return intReturn; } - static readonly int[] FastLookupBase64 = - {// 0 1 2 3 4 5 6 7 8 9 A B C D E F - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 00 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 10 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,62, 0, 0, 0,63, // 20 - 52,53,54,55,56,57,58,59,60,61, 0, 0, 0, 0, 0, 0, // 30 - 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14, // 40 - 15,16,17,18,19,20,21,22,23,24,25, 0, 0, 0, 0, 0, // 50 - 0,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40, // 60 - 41,42,43,44,45,46,47,48,49,50,51, 0, 0, 0, 0, 0, // 70 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 80 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 90 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // A0 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // B0 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // C0 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // D0 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // E0 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; // F0 +////[SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1204:StaticElementsMustAppearBeforeInstanceElements", Justification = "Stays with other string functions.")] + private static readonly int[] FastLookupBase64 = + { // 0 1 2 3 4 5 6 7 8 9 A B C D E F + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 00 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 10 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 63, // 20 + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 0, 0, 0, 0, 0, 0, // 30 + 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, // 40 + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 0, 0, 0, 0, // 50 + 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, // 60 + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 0, 0, 0, 0, 0, // 70 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 80 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 90 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // A0 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // B0 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // C0 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // D0 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // E0 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // F0 #endregion #region Math Functions @@ -375,16 +419,23 @@ namespace LSLEditor private integer ModPow2(integer iValueX, integer iValueY, integer iModulus) { - if (!iValueX) return 0; - integer k = 1 + (int)Math.Ceiling(Math.Log(Math.Abs(iValueX)) / 0.69314718055994530941723212145818); //ceil(log2(x)) - integer w = 32; - integer p = w / k; - integer r = iValueY / p; - integer f = iValueY % p; - integer z = 1; - if (r) z = ModPow2(ModPow1(iValueX, p, iModulus), r, iModulus); - if (f) z = (z * ModPow1(iValueX, f, iModulus)) % iModulus; - return z; + integer iResult = 0; + if (iValueX != 0) { + integer k = 1 + (int)Math.Ceiling(Math.Log(Math.Abs(iValueX)) / 0.69314718055994530941723212145818); // ceil(log2(x)) + integer w = 32; + integer p = w / k; + integer r = iValueY / p; + integer f = iValueY % p; + integer z = 1; + if (r) { + z = ModPow2(ModPow1(iValueX, p, iModulus), r, iModulus); + } + if (f) { + z = (z * ModPow1(iValueX, f, iModulus)) % iModulus; + } + iResult = z; + } + return iResult; } #endregion Math Functions @@ -417,12 +468,14 @@ namespace LSLEditor private double GetAverage(double[] data) { try { - double DataTotal = 0; + double dblDataTotal = 0; for (int i = 0; i < data.Length; i++) { - DataTotal += data[i]; + dblDataTotal += data[i]; } - return SafeDivide(DataTotal, data.Length); - } catch (Exception) { throw; } + return SafeDivide(dblDataTotal, data.Length); + } catch (Exception) { + throw; + } } public double GetStandardDeviation(double[] dblNumbers) @@ -432,7 +485,7 @@ namespace LSLEditor dblSum += dblNumbers[i]; dblSumOfSqrs += Math.Pow(dblNumbers[i], 2); } - double dblTopSum = (dblNumbers.Length * dblSumOfSqrs) - (Math.Pow(dblSum, 2)); + double dblTopSum = (dblNumbers.Length * dblSumOfSqrs) - Math.Pow(dblSum, 2); double dblN = (double)dblNumbers.Length; return Math.Sqrt(dblTopSum / (dblN * (dblN - 1))); } @@ -444,7 +497,8 @@ namespace LSLEditor if ((dblValue1 != 0) && (dblValue2 != 0)) { dblResult = dblValue1 / dblValue2; } - } catch { } + } catch { + } return dblResult; }