corrade-vassal – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | vero | 1 | /* |
2 | * Copyright (c) 2006-2014, openmetaverse.org |
||
3 | * All rights reserved. |
||
4 | * |
||
5 | * - Redistribution and use in source and binary forms, with or without |
||
6 | * modification, are permitted provided that the following conditions are met: |
||
7 | * |
||
8 | * - Redistributions of source code must retain the above copyright notice, this |
||
9 | * list of conditions and the following disclaimer. |
||
10 | * - Neither the name of the openmetaverse.org nor the names |
||
11 | * of its contributors may be used to endorse or promote products derived from |
||
12 | * this software without specific prior written permission. |
||
13 | * |
||
14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
||
15 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||
16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||
17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
||
18 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
||
19 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
||
20 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
||
21 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
||
22 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
||
23 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
||
24 | * POSSIBILITY OF SUCH DAMAGE. |
||
25 | */ |
||
26 | |||
27 | using System; |
||
28 | using OpenMetaverse; |
||
29 | |||
30 | namespace OpenMetaverse.Assets |
||
31 | { |
||
32 | /// <summary> |
||
33 | /// Represents an LSL Text object containing a string of UTF encoded characters |
||
34 | /// </summary> |
||
35 | public class AssetScriptText : Asset |
||
36 | { |
||
37 | /// <summary>Override the base classes AssetType</summary> |
||
38 | public override AssetType AssetType { get { return AssetType.LSLText; } } |
||
39 | |||
40 | /// <summary>A string of characters represting the script contents</summary> |
||
41 | public string Source; |
||
42 | |||
43 | /// <summary>Initializes a new AssetScriptText object</summary> |
||
44 | public AssetScriptText() { } |
||
45 | |||
46 | /// <summary> |
||
47 | /// Initializes a new AssetScriptText object with parameters |
||
48 | /// </summary> |
||
49 | /// <param name="assetID">A unique <see cref="UUID"/> specific to this asset</param> |
||
50 | /// <param name="assetData">A byte array containing the raw asset data</param> |
||
51 | public AssetScriptText(UUID assetID, byte[] assetData) : base(assetID, assetData) { } |
||
52 | |||
53 | /// <summary> |
||
54 | /// Encode a string containing the scripts contents into byte encoded AssetData |
||
55 | /// </summary> |
||
56 | public override void Encode() |
||
57 | { |
||
58 | AssetData = Utils.StringToBytes(Source); |
||
59 | } |
||
60 | |||
61 | /// <summary> |
||
62 | /// Decode a byte array containing the scripts contents into a string |
||
63 | /// </summary> |
||
64 | /// <returns>true if decoding is successful</returns> |
||
65 | public override bool Decode() |
||
66 | { |
||
67 | Source = Utils.BytesToString(AssetData); |
||
68 | return true; |
||
69 | } |
||
70 | } |
||
71 | } |