aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.Framework
diff options
context:
space:
mode:
authorMW2007-04-25 18:12:06 +0000
committerMW2007-04-25 18:12:06 +0000
commit9ed0a8dbad121b64ca8baca78f28ca58602c47ca (patch)
tree5c0008e0be59cb7ccaaf8ff1b0ea2f272a0548e6 /OpenSim.Framework
parentCan now use the xml config file for setting up things like sandbox mode, logi... (diff)
downloadopensim-SC_OLD-9ed0a8dbad121b64ca8baca78f28ca58602c47ca.zip
opensim-SC_OLD-9ed0a8dbad121b64ca8baca78f28ca58602c47ca.tar.gz
opensim-SC_OLD-9ed0a8dbad121b64ca8baca78f28ca58602c47ca.tar.bz2
opensim-SC_OLD-9ed0a8dbad121b64ca8baca78f28ca58602c47ca.tar.xz
updated to use lastest version of libsl but is currently broke when using SL viewer 1.15.02, due to big changes in the message templates.
Diffstat (limited to 'OpenSim.Framework')
-rw-r--r--OpenSim.Framework/AgentInventory.cs5
-rw-r--r--OpenSim.Framework/OpenSim.Framework.csproj6
-rw-r--r--OpenSim.Framework/OpenSim.Framework.dll.build1
-rw-r--r--OpenSim.Framework/Util.cs89
4 files changed, 99 insertions, 2 deletions
diff --git a/OpenSim.Framework/AgentInventory.cs b/OpenSim.Framework/AgentInventory.cs
index cabefc9..35c27d9 100644
--- a/OpenSim.Framework/AgentInventory.cs
+++ b/OpenSim.Framework/AgentInventory.cs
@@ -4,6 +4,7 @@ using System.Text;
4using libsecondlife; 4using libsecondlife;
5using libsecondlife.Packets; 5using libsecondlife.Packets;
6using OpenSim.Framework.Types; 6using OpenSim.Framework.Types;
7using OpenSim.Framework.Utilities;
7 8
8namespace OpenSim.Framework.Inventory 9namespace OpenSim.Framework.Inventory
9{ 10{
@@ -114,9 +115,9 @@ namespace OpenSim.Framework.Inventory
114 Console.WriteLine("updating inventory item details"); 115 Console.WriteLine("updating inventory item details");
115 if (this.InventoryItems.ContainsKey(itemID)) 116 if (this.InventoryItems.ContainsKey(itemID))
116 { 117 {
117 Console.WriteLine("changing name to "+ Helpers.FieldToString(packet.Name)); 118 Console.WriteLine("changing name to "+ Util.FieldToString(packet.Name));
118 InventoryItem Item = this.InventoryItems[itemID]; 119 InventoryItem Item = this.InventoryItems[itemID];
119 Item.Name = Helpers.FieldToString(packet.Name); 120 Item.Name = Util.FieldToString(packet.Name);
120 Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated()); 121 Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated());
121 //TODO need to update the rest of the info 122 //TODO need to update the rest of the info
122 } 123 }
diff --git a/OpenSim.Framework/OpenSim.Framework.csproj b/OpenSim.Framework/OpenSim.Framework.csproj
index ea4817e..0061140 100644
--- a/OpenSim.Framework/OpenSim.Framework.csproj
+++ b/OpenSim.Framework/OpenSim.Framework.csproj
@@ -76,6 +76,12 @@
76 </Reference> 76 </Reference>
77 </ItemGroup> 77 </ItemGroup>
78 <ItemGroup> 78 <ItemGroup>
79 <ProjectReference Include="..\XmlRpcCS\XMLRPC.csproj">
80 <Name>XMLRPC</Name>
81 <Project>{8E81D43C-0000-0000-0000-000000000000}</Project>
82 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
83 <Private>False</Private>
84 </ProjectReference>
79 </ItemGroup> 85 </ItemGroup>
80 <ItemGroup> 86 <ItemGroup>
81 <Compile Include="AgentInventory.cs"> 87 <Compile Include="AgentInventory.cs">
diff --git a/OpenSim.Framework/OpenSim.Framework.dll.build b/OpenSim.Framework/OpenSim.Framework.dll.build
index 8048de5..2ed5643 100644
--- a/OpenSim.Framework/OpenSim.Framework.dll.build
+++ b/OpenSim.Framework/OpenSim.Framework.dll.build
@@ -50,6 +50,7 @@
50 <include name="System.Xml.dll" /> 50 <include name="System.Xml.dll" />
51 <include name="../bin/libsecondlife.dll" /> 51 <include name="../bin/libsecondlife.dll" />
52 <include name="../bin/Db4objects.Db4o.dll" /> 52 <include name="../bin/Db4objects.Db4o.dll" />
53 <include name="../bin/XMLRPC.dll" />
53 </references> 54 </references>
54 </csc> 55 </csc>
55 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" /> 56 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" />
diff --git a/OpenSim.Framework/Util.cs b/OpenSim.Framework/Util.cs
index 695cac9..17ca611 100644
--- a/OpenSim.Framework/Util.cs
+++ b/OpenSim.Framework/Util.cs
@@ -36,6 +36,95 @@ namespace OpenSim.Framework.Utilities
36 return id; 36 return id;
37 } 37 }
38 38
39 public static int fast_distance2d(int x, int y)
40 {
41 x = System.Math.Abs(x);
42 y = System.Math.Abs(y);
43
44 int min = System.Math.Min(x, y);
45
46 return (x + y - (min >> 1) - (min >> 2) + (min >> 4));
47 }
48
49 public static string FieldToString(byte[] bytes)
50 {
51 return FieldToString(bytes, String.Empty);
52 }
53
54 /// <summary>
55 /// Convert a variable length field (byte array) to a string, with a
56 /// field name prepended to each line of the output
57 /// </summary>
58 /// <remarks>If the byte array has unprintable characters in it, a
59 /// hex dump will be put in the string instead</remarks>
60 /// <param name="bytes">The byte array to convert to a string</param>
61 /// <param name="fieldName">A field name to prepend to each line of output</param>
62 /// <returns>An ASCII string or a string containing a hex dump, minus
63 /// the null terminator</returns>
64 public static string FieldToString(byte[] bytes, string fieldName)
65 {
66 // Check for a common case
67 if (bytes.Length == 0) return String.Empty;
68
69 StringBuilder output = new StringBuilder();
70 bool printable = true;
71
72 for (int i = 0; i < bytes.Length; ++i)
73 {
74 // Check if there are any unprintable characters in the array
75 if ((bytes[i] < 0x20 || bytes[i] > 0x7E) && bytes[i] != 0x09
76 && bytes[i] != 0x0D && bytes[i] != 0x0A && bytes[i] != 0x00)
77 {
78 printable = false;
79 break;
80 }
81 }
82
83 if (printable)
84 {
85 if (fieldName.Length > 0)
86 {
87 output.Append(fieldName);
88 output.Append(": ");
89 }
90
91 if (bytes[bytes.Length - 1] == 0x00)
92 output.Append(UTF8Encoding.UTF8.GetString(bytes, 0, bytes.Length - 1));
93 else
94 output.Append(UTF8Encoding.UTF8.GetString(bytes));
95 }
96 else
97 {
98 for (int i = 0; i < bytes.Length; i += 16)
99 {
100 if (i != 0)
101 output.Append(Environment.NewLine);
102 if (fieldName.Length > 0)
103 {
104 output.Append(fieldName);
105 output.Append(": ");
106 }
107
108 for (int j = 0; j < 16; j++)
109 {
110 if ((i + j) < bytes.Length)
111 output.Append(String.Format("{0:X2} ", bytes[i + j]));
112 else
113 output.Append(" ");
114 }
115
116 for (int j = 0; j < 16 && (i + j) < bytes.Length; j++)
117 {
118 if (bytes[i + j] >= 0x20 && bytes[i + j] < 0x7E)
119 output.Append((char)bytes[i + j]);
120 else
121 output.Append(".");
122 }
123 }
124 }
125
126 return output.ToString();
127 }
39 public Util() 128 public Util()
40 { 129 {
41 130