Updating first batch of files.

This commit is contained in:
Ima Mechanique 2013-07-15 21:00:09 +01:00
parent afddb63ecc
commit 571f034395
6 changed files with 260 additions and 155 deletions

View file

@ -1,22 +1,60 @@
namespace LSLEditor namespace LSLEditor
{ {
partial class About /// <summary>
/// About dialogue box form.
/// </summary>
public partial class About
{ {
/// <summary> /// <summary>
/// Required designer variable. /// Required designer variable.
/// </summary> /// </summary>
private System.ComponentModel.IContainer components = null; private System.ComponentModel.IContainer components = null;
/// <summary>
/// Container for LSLife picture.
/// </summary>
private System.Windows.Forms.PictureBox pictureBox1;
/// <summary>
/// Container to hold all the elements.
/// </summary>
private System.Windows.Forms.GroupBox groupBox1;
/// <summary>
/// OK Button.
/// </summary>
private System.Windows.Forms.Button button1;
/// <summary>
/// Web Browser.
/// </summary>
private System.Windows.Forms.WebBrowser webBrowser1;
/// <summary>
/// Link label.
/// </summary>
private System.Windows.Forms.LinkLabel linkLabel1;
/// <summary>
/// Version label.
/// </summary>
private System.Windows.Forms.Label label1;
/// <summary>
/// LSL Editor label.
/// </summary>
private System.Windows.Forms.Label label2;
/// <summary> /// <summary>
/// Clean up any resources being used. /// Clean up any resources being used.
/// </summary> /// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> /// <param name="disposing">True if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
if (disposing && (components != null)) if (disposing && (this.components != null)) {
{ this.components.Dispose();
components.Dispose();
} }
base.Dispose(disposing); base.Dispose(disposing);
} }
@ -133,13 +171,5 @@ namespace LSLEditor
} }
#endregion #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;
} }
} }

View file

@ -42,18 +42,23 @@
// ******** // ********
// */ // */
using System; using System;
using System.ComponentModel;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using System.ComponentModel;
using System.Windows.Forms; using System.Windows.Forms;
namespace LSLEditor namespace LSLEditor
{ {
/// <summary>About dialogue box form.</summary>
public partial class About : Form public partial class About : Form
{ {
/// <summary>
/// Initialises a new instance of the <see cref="About" /> class.
/// </summary>
/// <param name="parent">The parent form.</param>
public About(LSLEditorForm parent) public About(LSLEditorForm parent)
{ {
InitializeComponent(); this.InitializeComponent();
this.Icon = parent.Icon; this.Icon = parent.Icon;
@ -61,16 +66,31 @@ namespace LSLEditor
this.label2.Text = strVersion; this.label2.Text = strVersion;
} }
/// <summary>
/// OK/Close button.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button1_Click(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e)
{ {
this.Close(); this.Close();
} }
/// <summary>
/// Link to SourceForge page.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{ {
System.Diagnostics.Process.Start(Properties.Settings.Default.ContactUrl); System.Diagnostics.Process.Start(Properties.Settings.Default.ContactUrl);
} }
/// <summary>
/// Loads the page.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void About_Load(object sender, EventArgs e) private void About_Load(object sender, EventArgs e)
{ {
string strExeFileName = Path.GetFileName(Assembly.GetExecutingAssembly().CodeBase); string strExeFileName = Path.GetFileName(Assembly.GetExecutingAssembly().CodeBase);

View file

@ -70,7 +70,7 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Revision and Build Numbers // You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// We use a Major.Minor.Bugfix.Build pattern. // 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 // 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: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyName("")] //[assembly: AssemblyKeyName("")]
[assembly: ComVisibleAttribute(false)] [assembly: ComVisibleAttribute(false)]
[assembly: AssemblyFileVersionAttribute("2.999.999.13")] [assembly: AssemblyFileVersionAttribute("2.999.999.117")]

View file

@ -280,6 +280,7 @@ namespace LSLEditor
public const int INVENTORY_ANIMATION = 20; public const int INVENTORY_ANIMATION = 20;
public const int INVENTORY_GESTURE = 21; public const int INVENTORY_GESTURE = 21;
public const int JSON_APPEND = -1;
public static readonly string JSON_ARRAY = "\uFDD2"; public static readonly string JSON_ARRAY = "\uFDD2";
public static readonly string JSON_FALSE = "\uFDD7"; public static readonly string JSON_FALSE = "\uFDD7";
public static readonly string JSON_INVALID = "\uFDD0"; public static readonly string JSON_INVALID = "\uFDD0";

View file

@ -67,31 +67,31 @@ namespace LSLEditor
public void llAddToLandBanList(key kID, Float fHours) public void llAddToLandBanList(key kID, Float fHours)
{ {
Verbose("llAddToLandBanList({0}, {1})", kID, fHours); Verbose("llAddToLandBanList({0}, {1})", kID, fHours);
if (m_LandBanList.ContainsKey(kID)) { if (htLandBanList.ContainsKey(kID)) {
m_LandBanList.Remove(kID); htLandBanList.Remove(kID);
} }
m_LandBanList.Add(kID, fHours); htLandBanList.Add(kID, fHours);
} }
public void llAddToLandPassList(key kID, Float fHours) public void llAddToLandPassList(key kID, Float fHours)
{ {
Verbose("llAddToLandPassList({0}, {1})", kID, fHours); Verbose("llAddToLandPassList({0}, {1})", kID, fHours);
if (m_LandPassList.ContainsKey(kID)) { if (htLandPassList.ContainsKey(kID)) {
m_LandPassList.Remove(kID); htLandPassList.Remove(kID);
} }
m_LandPassList.Add(kID, fHours); htLandPassList.Add(kID, fHours);
} }
public void llAdjustSoundVolume(Float fVolume) public void llAdjustSoundVolume(Float fVolume)
{ {
Verbose("llAdjustSoundVolume({0}), fVolume"); Verbose("llAdjustSoundVolume({0}), fVolume");
m_Volume = fVolume; this.fVolume = fVolume;
} }
public void llAllowInventoryDrop(integer iAllowDrop) public void llAllowInventoryDrop(integer iAllowDrop)
{ {
Verbose("llAllowInventoryDrop({0})", iAllowDrop); Verbose("llAllowInventoryDrop({0})", iAllowDrop);
m_AllowDrop = (Boolean)iAllowDrop; blnAllowDrop = (Boolean)iAllowDrop;
} }
public Float llAngleBetween(rotation a, rotation b) public Float llAngleBetween(rotation a, rotation b)
@ -659,7 +659,7 @@ namespace LSLEditor
public Float llFrand(Float fMaximum) public Float llFrand(Float fMaximum)
{ {
double dblValue = fMaximum * m_random.NextDouble(); double dblValue = fMaximum * rdmRandom.NextDouble();
Verbose("llFrand({0})={1}", fMaximum, dblValue); Verbose("llFrand({0})={1}", fMaximum, dblValue);
return dblValue; return dblValue;
} }
@ -1029,14 +1029,14 @@ namespace LSLEditor
public vector llGetLocalPos() public vector llGetLocalPos()
{ {
Verbose("llGetLocalPos()={0}", m_pos); Verbose("llGetLocalPos()={0}", vPosition);
return m_pos; return vPosition;
} }
public rotation llGetLocalRot() public rotation llGetLocalRot()
{ {
Verbose("llGetLocalRot()={0}", m_rotlocal); Verbose("llGetLocalRot()={0}", rRotationlocal);
return m_rotlocal; return rRotationlocal;
} }
public Float llGetMass() public Float llGetMass()
@ -1250,8 +1250,8 @@ namespace LSLEditor
public string llGetParcelMusicURL() public string llGetParcelMusicURL()
{ {
Verbose(@"llGetParcelMaxPrims()=""{0}""", m_ParcelMusicURL); Verbose(@"llGetParcelMaxPrims()=""{0}""", sParcelMusicURL);
return m_ParcelMusicURL; return sParcelMusicURL;
} }
public integer llGetParcelPrimCount(vector vPosition, integer iCategory, integer iSimWide) public integer llGetParcelPrimCount(vector vPosition, integer iCategory, integer iSimWide)
@ -1291,8 +1291,8 @@ namespace LSLEditor
public vector llGetPos() public vector llGetPos()
{ {
Verbose("llGetPos()={0}", m_pos); Verbose("llGetPos()={0}", vPosition);
return m_pos; return vPosition;
} }
public list llGetPrimMediaParams(integer iFace, list lDesiredParams) public list llGetPrimMediaParams(integer iFace, list lDesiredParams)
@ -1369,8 +1369,8 @@ namespace LSLEditor
public rotation llGetRot() public rotation llGetRot()
{ {
Verbose("llGetRot()={0}", m_rot); Verbose("llGetRot()={0}", rRotation);
return m_rot; return rRotation;
} }
public integer llGetSPMaxMemory() public integer llGetSPMaxMemory()
@ -1382,8 +1382,8 @@ namespace LSLEditor
public vector llGetScale() public vector llGetScale()
{ {
Verbose("llGetScale()=" + m_scale); Verbose("llGetScale()=" + vScale);
return m_scale; return vScale;
} }
public String llGetScriptName() public String llGetScriptName()
@ -1416,8 +1416,8 @@ namespace LSLEditor
public integer llGetStartParameter() public integer llGetStartParameter()
{ {
Verbose("llGetStartParameter()={0}" + m_start_parameter); Verbose("llGetStartParameter()={0}" + iStartParameter);
return m_start_parameter; return iStartParameter;
} }
public list llGetStaticPath(vector vStart, vector vEnd, Float fRadius, list lParameters) public list llGetStaticPath(vector vStart, vector vEnd, Float fRadius, list lParameters)
@ -1498,7 +1498,7 @@ namespace LSLEditor
public Float llGetTime() public Float llGetTime()
{ {
TimeSpan span = DateTime.Now.ToUniversalTime() - m_DateTimeScriptStarted; TimeSpan span = DateTime.Now.ToUniversalTime() - dtDateTimeScriptStarted;
Verbose("llGetTime()={0}", span.TotalSeconds); Verbose("llGetTime()={0}", span.TotalSeconds);
return span.TotalSeconds; return span.TotalSeconds;
} }
@ -2388,16 +2388,16 @@ namespace LSLEditor
public void llRemoveFromLandBanList(key kAvatarID) public void llRemoveFromLandBanList(key kAvatarID)
{ {
Verbose("llRemoveFromLandBanList({0})", kAvatarID); Verbose("llRemoveFromLandBanList({0})", kAvatarID);
if (m_LandBanList.ContainsKey(kAvatarID)) { if (htLandBanList.ContainsKey(kAvatarID)) {
m_LandBanList.Remove(kAvatarID); htLandBanList.Remove(kAvatarID);
} }
} }
public void llRemoveFromLandPassList(key kAvatarID) public void llRemoveFromLandPassList(key kAvatarID)
{ {
Verbose("llRemoveFromLandPassList({0})", kAvatarID); Verbose("llRemoveFromLandPassList({0})", kAvatarID);
if (m_LandPassList.ContainsKey(kAvatarID)) { if (htLandPassList.ContainsKey(kAvatarID)) {
m_LandPassList.Remove(kAvatarID); htLandPassList.Remove(kAvatarID);
} }
} }
@ -2498,13 +2498,13 @@ namespace LSLEditor
public void llResetLandBanList() public void llResetLandBanList()
{ {
m_LandBanList = new Hashtable(); htLandBanList = new Hashtable();
Verbose("llResetLandBanList()"); Verbose("llResetLandBanList()");
} }
public void llResetLandPassList() public void llResetLandPassList()
{ {
m_LandPassList = new Hashtable(); htLandPassList = new Hashtable();
Verbose("llResetLandPassList()"); Verbose("llResetLandPassList()");
} }
@ -2524,7 +2524,7 @@ namespace LSLEditor
public void llResetTime() public void llResetTime()
{ {
Verbose("llResetTime()"); Verbose("llResetTime()");
m_DateTimeScriptStarted = DateTime.Now.ToUniversalTime(); dtDateTimeScriptStarted = DateTime.Now.ToUniversalTime();
} }
public integer llReturnObjectsByID(list lObjects) public integer llReturnObjectsByID(list lObjects)
@ -2833,7 +2833,7 @@ namespace LSLEditor
public void llSetLocalRot(rotation rRotation) public void llSetLocalRot(rotation rRotation)
{ {
this.m_rotlocal = rRotation; this.rRotationlocal = rRotation;
Verbose("llSetLocalRot({0})", rRotation); Verbose("llSetLocalRot({0})", rRotation);
} }
@ -2864,7 +2864,7 @@ namespace LSLEditor
public void llSetParcelMusicURL(String sURL) public void llSetParcelMusicURL(String sURL)
{ {
Verbose(@"llSetParcelMusicURL(""{0}"")", sURL); Verbose(@"llSetParcelMusicURL(""{0}"")", sURL);
m_ParcelMusicURL = sURL; sParcelMusicURL = sURL;
} }
public void llSetPayPrice(integer iPrice, list lButtons) public void llSetPayPrice(integer iPrice, list lButtons)
@ -2880,7 +2880,7 @@ namespace LSLEditor
public void llSetPos(vector vPosition) public void llSetPos(vector vPosition)
{ {
Verbose("llSetPos({0})", vPosition); Verbose("llSetPos({0})", vPosition);
m_pos = vPosition; this.vPosition = vPosition;
} }
public integer llSetPrimMediaParams(integer iFace, list lParameters) public integer llSetPrimMediaParams(integer iFace, list lParameters)
@ -2899,7 +2899,7 @@ namespace LSLEditor
{ {
integer iResult = true; integer iResult = true;
Verbose("llSetRegionPos({0})={1}", vPosition, iResult); Verbose("llSetRegionPos({0})={1}", vPosition, iResult);
m_pos = vPosition; this.vPosition = vPosition;
return iResult; return iResult;
} }
@ -2911,13 +2911,13 @@ namespace LSLEditor
public void llSetRot(rotation rRotation) public void llSetRot(rotation rRotation)
{ {
Verbose("llSetRot({0})", rRotation); Verbose("llSetRot({0})", rRotation);
m_rot = rRotation; this.rRotation = rRotation;
} }
public void llSetScale(vector vScale) public void llSetScale(vector vScale)
{ {
Verbose("llSetScale({0})", vScale); Verbose("llSetScale({0})", vScale);
m_scale = vScale; this.vScale = vScale;
} }
public void llSetScriptState(String sName, integer iRunState) public void llSetScriptState(String sName, integer iRunState)
@ -2928,7 +2928,7 @@ namespace LSLEditor
public void llSetSitText(String sText) public void llSetSitText(String sText)
{ {
Verbose(@"llSetSitText(""{0}"")", sText); Verbose(@"llSetSitText(""{0}"")", sText);
m_SitText = sText; sSitText = sText;
} }
public void llSetSoundQueueing(integer iQueueFlag) public void llSetSoundQueueing(integer iQueueFlag)
@ -2938,7 +2938,7 @@ namespace LSLEditor
public void llSetSoundRadius(Float fRadius) public void llSetSoundRadius(Float fRadius)
{ {
m_SoundRadius = fRadius; fSoundRadius = fRadius;
Verbose("llSetSoundRadius({0})", fRadius); Verbose("llSetSoundRadius({0})", fRadius);
} }

View file

@ -42,19 +42,21 @@
// ******** // ********
// */ // */
using System; using System;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
/*
//
// (C) 2006,2007 Alphons van der Heijden // (C) 2006,2007 Alphons van der Heijden
// mail: alphons@heijden.com // mail: alphons@heijden.com
// */
namespace LSLEditor namespace LSLEditor
{ {
/// <summary>
/// Enumeration of Communication Types that the host understands
/// </summary>
public enum CommunicationType public enum CommunicationType
{ {
Whisper, Say, Shout, OwnerSay, RegionSay, RegionSayTo Whisper, Say, Shout, OwnerSay, RegionSay, RegionSayTo
@ -62,80 +64,109 @@ namespace LSLEditor
public partial class SecondLife public partial class SecondLife
{ {
// Make friends with my host /// <summary>
public SecondLifeHost host; /// Holds the host object.
/// </summary>
private SecondLifeHost slhHost;
#region members #region members
// Random generator /// <summary>
private Random m_random; /// Random generator.
/// </summary>
private Random rdmRandom;
private DateTime m_DateTimeScriptStarted; /// <summary>
/// Holds the time of the script starting execution.
/// </summary>
private DateTime dtDateTimeScriptStarted;
private Boolean m_AllowDrop = false; /// <summary>
private Hashtable m_LandPassList; /// Contains a boolean value indicating wether this object accepts other items to be dropped into it.
/// </summary>
private bool blnAllowDrop = false;
private Hashtable m_LandBanList; /// <summary>
/// Contains a list of keys of avatars that may enter a parcel.
/// </summary>
private Hashtable htLandPassList;
private Float m_Volume; /// <summary>
/// Contains a list of keys of avatars that may NOT enter a parcel.
/// </summary>
private Hashtable htLandBanList;
private String m_ObjectName; /// <summary>
private String m_ParcelMusicURL; /// Volume of sound played by this prim.
private vector m_pos; /// </summary>
private rotation m_rot; private Float fVolume;
private rotation m_rotlocal;
private vector m_scale;
private String m_SitText;
private Float m_SoundRadius;
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
/// <summary>
/// Initialises the <see cref="SecondLife"/> class.
/// </summary>
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 #endregion
#region Properties #region Properties
public vector GetLocalPos 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. // 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
public SecondLifeHost host
#region constructor
public SecondLife()
{ {
host = null; get { return this.slhHost; }
m_random = new Random(); set { this.slhHost = value; }
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 #endregion
#region internal routines #region internal routines
private void Verbose(string strLine, params object[] parameters) private void Verbose(string strLine, params object[] parameters)
{ {
if (parameters.Length == 0) { if (parameters.Length == 0) {
host.VerboseMessage(strLine); host.VerboseMessage(strLine);
} else { } else {
host.VerboseMessage(string.Format(strLine, parameters)); this.host.VerboseMessage(string.Format(strLine, parameters));
} }
} }
private void Chat(integer iChannel, string sText, CommunicationType ctHow) 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) public void state(string strStateName)
@ -178,8 +209,9 @@ namespace LSLEditor
public ArrayList RandomShuffle(ArrayList alCollection) public ArrayList RandomShuffle(ArrayList alCollection)
{ {
// We have to copy all items anyway, and there isn't a way to produce the items /* 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. on the fly that is linear. So copying to an array and shuffling it is as efficient as we can get.
*/
if (alCollection == null) { if (alCollection == null) {
throw new ArgumentNullException("collection"); throw new ArgumentNullException("collection");
@ -188,7 +220,7 @@ namespace LSLEditor
int intCount = alCollection.Count; int intCount = alCollection.Count;
for (int i = intCount - 1; i >= 1; --i) { for (int i = intCount - 1; i >= 1; --i) {
// Pick an random number 0 through i inclusive. // 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] // Swap array[i] and array[j]
object temp = alCollection[i]; object temp = alCollection[i];
@ -225,37 +257,46 @@ namespace LSLEditor
return new list(items); return new list(items);
} }
/// <summary>
/// Implements the Comparer Interface for our custom types (Float, Integer, and String).
/// </summary>
private class BucketComparer : IComparer private class BucketComparer : IComparer
{ {
private integer iAscending; private integer iAscending;
/// <summary>
/// Initialises the <see cref="BucketComparer"/> class.
/// </summary>
/// <param name="ascending"></param>
public BucketComparer(integer ascending) public BucketComparer(integer ascending)
{ {
this.iAscending = ascending; this.iAscending = ascending;
} }
public int Compare(object x, object y) public int Compare(object x, object y)
{ {
int iResult = 0; int iResult = 0;
object A, B; object objA, objB;
object[] xx = x as object[]; object[] xx = x as object[];
object[] yy = y as object[]; object[] yy = y as object[];
if (iAscending == TRUE) { if (iAscending == TRUE) {
A = xx[0]; objA = xx[0];
B = yy[0]; objB = yy[0];
} else { } else {
B = xx[0]; objB = xx[0];
A = yy[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))) { if (((objA is string) && (objB is string)) || ((objA is SecondLife.String) && (objB is SecondLife.String))) {
iResult = string.Compare(A.ToString(), B.ToString()); iResult = string.Compare(objA.ToString(), objB.ToString());
} else if ((A is SecondLife.integer) && (B is SecondLife.integer)) { } else if ((objA is SecondLife.integer) && (objB is SecondLife.integer)) {
iResult = SecondLife.integer.Compare((SecondLife.integer)A, (SecondLife.integer)B); iResult = SecondLife.integer.Compare((SecondLife.integer)objA, (SecondLife.integer)objB);
} else if ((A is SecondLife.Float) && (B is SecondLife.Float)) { } else if ((objA is SecondLife.Float) && (objB is SecondLife.Float)) {
iResult = SecondLife.Float.Compare((SecondLife.Float)A, (SecondLife.Float)B); iResult = SecondLife.Float.Compare((SecondLife.Float)objA, (SecondLife.Float)objB);
} }
return iResult; return iResult;
@ -289,7 +330,9 @@ namespace LSLEditor
} }
} }
if (blnFound) continue; if (blnFound) {
continue;
}
for (int intJ = 0; intJ < lSpacers.Count; intJ++) { for (int intJ = 0; intJ < lSpacers.Count; intJ++) {
string strSpacer = lSpacers[intJ].ToString(); string strSpacer = lSpacers[intJ].ToString();
@ -347,24 +390,25 @@ namespace LSLEditor
return intReturn; return intReturn;
} }
static readonly int[] FastLookupBase64 = ////[SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1204:StaticElementsMustAppearBeforeInstanceElements", Justification = "Stays with other string functions.")]
{// 0 1 2 3 4 5 6 7 8 9 A B C D E F private static readonly int[] FastLookupBase64 =
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 00 { // 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, // 10 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,62, 0, 0, 0,63, // 20 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 10
52,53,54,55,56,57,58,59,60,61, 0, 0, 0, 0, 0, 0, // 30 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 63, // 20
0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14, // 40 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 0, 0, 0, 0, 0, 0, // 30
15,16,17,18,19,20,21,22,23,24,25, 0, 0, 0, 0, 0, // 50 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, // 40
0,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40, // 60 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 0, 0, 0, 0, // 50
41,42,43,44,45,46,47,48,49,50,51, 0, 0, 0, 0, 0, // 70 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, // 60
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 80 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, // 90 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, // A0 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, // B0 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, // C0 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, // D0 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, // E0 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}; // F0 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
@ -375,16 +419,23 @@ namespace LSLEditor
private integer ModPow2(integer iValueX, integer iValueY, integer iModulus) private integer ModPow2(integer iValueX, integer iValueY, integer iModulus)
{ {
if (!iValueX) return 0; integer iResult = 0;
integer k = 1 + (int)Math.Ceiling(Math.Log(Math.Abs(iValueX)) / 0.69314718055994530941723212145818); //ceil(log2(x)) if (iValueX != 0) {
integer w = 32; integer k = 1 + (int)Math.Ceiling(Math.Log(Math.Abs(iValueX)) / 0.69314718055994530941723212145818); // ceil(log2(x))
integer p = w / k; integer w = 32;
integer r = iValueY / p; integer p = w / k;
integer f = iValueY % p; integer r = iValueY / p;
integer z = 1; integer f = iValueY % p;
if (r) z = ModPow2(ModPow1(iValueX, p, iModulus), r, iModulus); integer z = 1;
if (f) z = (z * ModPow1(iValueX, f, iModulus)) % iModulus; if (r) {
return z; z = ModPow2(ModPow1(iValueX, p, iModulus), r, iModulus);
}
if (f) {
z = (z * ModPow1(iValueX, f, iModulus)) % iModulus;
}
iResult = z;
}
return iResult;
} }
#endregion Math Functions #endregion Math Functions
@ -417,12 +468,14 @@ namespace LSLEditor
private double GetAverage(double[] data) private double GetAverage(double[] data)
{ {
try { try {
double DataTotal = 0; double dblDataTotal = 0;
for (int i = 0; i < data.Length; i++) { for (int i = 0; i < data.Length; i++) {
DataTotal += data[i]; dblDataTotal += data[i];
} }
return SafeDivide(DataTotal, data.Length); return SafeDivide(dblDataTotal, data.Length);
} catch (Exception) { throw; } } catch (Exception) {
throw;
}
} }
public double GetStandardDeviation(double[] dblNumbers) public double GetStandardDeviation(double[] dblNumbers)
@ -432,7 +485,7 @@ namespace LSLEditor
dblSum += dblNumbers[i]; dblSum += dblNumbers[i];
dblSumOfSqrs += Math.Pow(dblNumbers[i], 2); 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; double dblN = (double)dblNumbers.Length;
return Math.Sqrt(dblTopSum / (dblN * (dblN - 1))); return Math.Sqrt(dblTopSum / (dblN * (dblN - 1)));
} }
@ -444,7 +497,8 @@ namespace LSLEditor
if ((dblValue1 != 0) && (dblValue2 != 0)) { if ((dblValue1 != 0) && (dblValue2 != 0)) {
dblResult = dblValue1 / dblValue2; dblResult = dblValue1 / dblValue2;
} }
} catch { } } catch {
}
return dblResult; return dblResult;
} }