Files
libremetaverse/libsecondlife/AssetSystem/AssetScript.cs
John Hurliman 1cb7f4c253 Huge svn cleanup!
* libsecondlife-cs is now libsecondlife
* All applications that are staying have been moved to trunk/
* SLProxy loads Analyst plugin by default if no other plugin is specified on the command line

git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@1068 52acb1d6-8a22-11de-b505-999d5b087335
2007-03-26 23:12:39 +00:00

44 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
namespace libsecondlife.AssetSystem
{
public class AssetScript : Asset
{
private string _Source;
public string Source
{
get { return _Source; }
set
{
_Source = value.Replace("\r", "");
setAsset(_Source);
}
}
public AssetScript(LLUUID assetID, string source)
: base(assetID, (sbyte)Asset.AssetType.LSLText, false, null)
{
_Source = source;
setAsset(source);
}
public AssetScript(LLUUID assetID, byte[] assetData)
: base(assetID, (sbyte)Asset.AssetType.LSLText, false, assetData)
{
_Source = System.Text.Encoding.UTF8.GetString(assetData).Trim();
}
private void setAsset(string source)
{
// Assume this is a string, add 1 for the null terminator
byte[] stringBytes = System.Text.Encoding.UTF8.GetBytes(source);
byte[] assetData = new byte[stringBytes.Length + 1];
Array.Copy(stringBytes, 0, assetData, 0, stringBytes.Length);
SetAssetData(assetData);
}
}
}