diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Util.cs | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 745da17..c4fc643 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -1372,11 +1372,30 @@ namespace OpenSim.Framework | |||
1372 | return (ipaddr1 != null) ? "http://" + ipaddr1.ToString() + ":" + port1 : uri; | 1372 | return (ipaddr1 != null) ? "http://" + ipaddr1.ToString() + ":" + port1 : uri; |
1373 | } | 1373 | } |
1374 | 1374 | ||
1375 | /// <summary> | ||
1376 | /// Convert a string to a byte format suitable for transport in an LLUDP packet. The output is truncated to 256 bytes if necessary. | ||
1377 | /// </summary> | ||
1378 | /// <param name="str"> | ||
1379 | /// If null or empty, then an bytes[0] is returned. | ||
1380 | /// Using "\0" will return a conversion of the null character to a byte. This is not the same as bytes[0] | ||
1381 | /// </param> | ||
1382 | /// <param name="args"> | ||
1383 | /// Arguments to substitute into the string via the {} mechanism. | ||
1384 | /// </param> | ||
1385 | /// <returns></returns> | ||
1375 | public static byte[] StringToBytes256(string str, params object[] args) | 1386 | public static byte[] StringToBytes256(string str, params object[] args) |
1376 | { | 1387 | { |
1377 | return StringToBytes256(string.Format(str, args)); | 1388 | return StringToBytes256(string.Format(str, args)); |
1378 | } | 1389 | } |
1379 | 1390 | ||
1391 | /// <summary> | ||
1392 | /// Convert a string to a byte format suitable for transport in an LLUDP packet. The output is truncated to 256 bytes if necessary. | ||
1393 | /// </summary> | ||
1394 | /// <param name="str"> | ||
1395 | /// If null or empty, then an bytes[0] is returned. | ||
1396 | /// Using "\0" will return a conversion of the null character to a byte. This is not the same as bytes[0] | ||
1397 | /// </param> | ||
1398 | /// <returns></returns> | ||
1380 | public static byte[] StringToBytes256(string str) | 1399 | public static byte[] StringToBytes256(string str) |
1381 | { | 1400 | { |
1382 | if (String.IsNullOrEmpty(str)) { return Utils.EmptyBytes; } | 1401 | if (String.IsNullOrEmpty(str)) { return Utils.EmptyBytes; } |
@@ -1395,11 +1414,30 @@ namespace OpenSim.Framework | |||
1395 | return data; | 1414 | return data; |
1396 | } | 1415 | } |
1397 | 1416 | ||
1417 | /// <summary> | ||
1418 | /// Convert a string to a byte format suitable for transport in an LLUDP packet. The output is truncated to 1024 bytes if necessary. | ||
1419 | /// </summary> | ||
1420 | /// <param name="str"> | ||
1421 | /// If null or empty, then an bytes[0] is returned. | ||
1422 | /// Using "\0" will return a conversion of the null character to a byte. This is not the same as bytes[0] | ||
1423 | /// </param> | ||
1424 | /// <param name="args"> | ||
1425 | /// Arguments to substitute into the string via the {} mechanism. | ||
1426 | /// </param> | ||
1427 | /// <returns></returns> | ||
1398 | public static byte[] StringToBytes1024(string str, params object[] args) | 1428 | public static byte[] StringToBytes1024(string str, params object[] args) |
1399 | { | 1429 | { |
1400 | return StringToBytes1024(string.Format(str, args)); | 1430 | return StringToBytes1024(string.Format(str, args)); |
1401 | } | 1431 | } |
1402 | 1432 | ||
1433 | /// <summary> | ||
1434 | /// Convert a string to a byte format suitable for transport in an LLUDP packet. The output is truncated to 1024 bytes if necessary. | ||
1435 | /// </summary> | ||
1436 | /// <param name="str"> | ||
1437 | /// If null or empty, then an bytes[0] is returned. | ||
1438 | /// Using "\0" will return a conversion of the null character to a byte. This is not the same as bytes[0] | ||
1439 | /// </param> | ||
1440 | /// <returns></returns> | ||
1403 | public static byte[] StringToBytes1024(string str) | 1441 | public static byte[] StringToBytes1024(string str) |
1404 | { | 1442 | { |
1405 | if (String.IsNullOrEmpty(str)) { return Utils.EmptyBytes; } | 1443 | if (String.IsNullOrEmpty(str)) { return Utils.EmptyBytes; } |