diff options
Diffstat (limited to 'Asset_manager.cs')
-rw-r--r-- | Asset_manager.cs | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/Asset_manager.cs b/Asset_manager.cs index 3723e1d..20cf3a1 100644 --- a/Asset_manager.cs +++ b/Asset_manager.cs | |||
@@ -34,26 +34,26 @@ using libsecondlife.Packets; | |||
34 | using libsecondlife.AssetSystem; | 34 | using libsecondlife.AssetSystem; |
35 | using System.IO; | 35 | using System.IO; |
36 | 36 | ||
37 | namespace Second_server | 37 | namespace OpenSim |
38 | { | 38 | { |
39 | /// <summary> | 39 | /// <summary> |
40 | /// Description of Asset_manager. | 40 | /// Description of Asset_manager. |
41 | /// </summary> | 41 | /// </summary> |
42 | public class Asset_manager | 42 | public class AssetManager |
43 | { | 43 | { |
44 | public Dictionary<libsecondlife.LLUUID,Asset_info> Assets; | 44 | public Dictionary<libsecondlife.LLUUID,AssetInfo> Assets; |
45 | public ArrayList requests=new ArrayList(); //should change to a generic | 45 | public ArrayList requests=new ArrayList(); //should change to a generic |
46 | // public ArrayList uploads=new ArrayList(); | 46 | // public ArrayList uploads=new ArrayList(); |
47 | private Server server; | 47 | private Server server; |
48 | 48 | ||
49 | public Asset_manager(Server serve) | 49 | public AssetManager(Server serve) |
50 | { | 50 | { |
51 | server=serve; | 51 | server=serve; |
52 | Assets=new Dictionary<libsecondlife.LLUUID,Asset_info> (); | 52 | Assets=new Dictionary<libsecondlife.LLUUID,AssetInfo> (); |
53 | this.initialise(); | 53 | this.initialise(); |
54 | } | 54 | } |
55 | 55 | ||
56 | public void add_request(User_Agent_info user, LLUUID asset_id, TransferRequestPacket tran_req) | 56 | public void AddRequest(User_Agent_info user, LLUUID asset_id, TransferRequestPacket tran_req) |
57 | { | 57 | { |
58 | 58 | ||
59 | if(!this.Assets.ContainsKey(asset_id)) | 59 | if(!this.Assets.ContainsKey(asset_id)) |
@@ -61,18 +61,18 @@ namespace Second_server | |||
61 | //not found asset | 61 | //not found asset |
62 | return; | 62 | return; |
63 | } | 63 | } |
64 | Asset_info info=this.Assets[asset_id]; | 64 | AssetInfo info=this.Assets[asset_id]; |
65 | System.Console.WriteLine("send asset : "+asset_id); | 65 | System.Console.WriteLine("send asset : "+asset_id); |
66 | //for now as it will be only skin or shape request just send back the asset | 66 | //for now as it will be only skin or shape request just send back the asset |
67 | TransferInfoPacket tran_i=new TransferInfoPacket(); | 67 | TransferInfoPacket Transfer=new TransferInfoPacket(); |
68 | tran_i.TransferInfo.ChannelType=2; | 68 | Transfer.TransferInfo.ChannelType=2; |
69 | tran_i.TransferInfo.Status=0; | 69 | Transfer.TransferInfo.Status=0; |
70 | tran_i.TransferInfo.TargetType=0; | 70 | Transfer.TransferInfo.TargetType=0; |
71 | tran_i.TransferInfo.Params=tran_req.TransferInfo.Params; | 71 | Transfer.TransferInfo.Params=tran_req.TransferInfo.Params; |
72 | tran_i.TransferInfo.Size=info.data.Length; | 72 | Transfer.TransferInfo.Size=info.data.Length; |
73 | tran_i.TransferInfo.TransferID=tran_req.TransferInfo.TransferID; | 73 | Transfer.TransferInfo.TransferID=tran_req.TransferInfo.TransferID; |
74 | 74 | ||
75 | server.SendPacket(tran_i,true,user); | 75 | server.SendPacket(Transfer,true,user); |
76 | 76 | ||
77 | TransferPacketPacket tran_p=new TransferPacketPacket(); | 77 | TransferPacketPacket tran_p=new TransferPacketPacket(); |
78 | tran_p.TransferData.Packet=0; | 78 | tran_p.TransferData.Packet=0; |
@@ -110,14 +110,17 @@ namespace Second_server | |||
110 | private void initialise() | 110 | private void initialise() |
111 | { | 111 | { |
112 | //for now read in our test image | 112 | //for now read in our test image |
113 | Asset_info im=new Asset_info(); | 113 | AssetInfo im=new AssetInfo(); |
114 | im.filename="base_shape.dat"; | 114 | im.filename="base_shape.dat"; |
115 | im.Full_ID=new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); | 115 | im.Full_ID=new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); |
116 | this.load_asset(im); | 116 | this.loadAsset(im); |
117 | this.Assets.Add(im.Full_ID,im); | 117 | this.Assets.Add(im.Full_ID,im); |
118 | } | 118 | } |
119 | private void load_asset(Asset_info info) | 119 | private void loadAsset(AssetInfo info) |
120 | { | 120 | { |
121 | //should request Asset from storage manager | ||
122 | //but for now read from file | ||
123 | |||
121 | string data_path = System.AppDomain.CurrentDomain.BaseDirectory + @"\assets\"; | 124 | string data_path = System.AppDomain.CurrentDomain.BaseDirectory + @"\assets\"; |
122 | string filename=data_path+@info.filename; | 125 | string filename=data_path+@info.filename; |
123 | FileInfo fInfo = new FileInfo(filename); | 126 | FileInfo fInfo = new FileInfo(filename); |
@@ -135,21 +138,21 @@ namespace Second_server | |||
135 | } | 138 | } |
136 | } | 139 | } |
137 | 140 | ||
138 | public class Asset_request | 141 | public class AssetRequest |
139 | { | 142 | { |
140 | public User_Agent_info req_user; | 143 | public User_Agent_info RequestUser; |
141 | public LLUUID req_image; | 144 | public LLUUID RequestImage; |
142 | public Asset_info asset_inf; | 145 | public AssetInfo asset_inf; |
143 | public long data_pointer=0; | 146 | public long data_pointer=0; |
144 | public int num_packets=0; | 147 | public int num_packets=0; |
145 | public int packet_counter=0; | 148 | public int packet_counter=0; |
146 | 149 | ||
147 | public Asset_request() | 150 | public AssetRequest() |
148 | { | 151 | { |
149 | 152 | ||
150 | } | 153 | } |
151 | } | 154 | } |
152 | public class Asset_info | 155 | public class AssetInfo |
153 | { | 156 | { |
154 | public byte[] data; | 157 | public byte[] data; |
155 | public LLUUID Full_ID; | 158 | public LLUUID Full_ID; |
@@ -159,7 +162,7 @@ namespace Second_server | |||
159 | public ulong last_used; //need to add a tick/time counter and keep record | 162 | public ulong last_used; //need to add a tick/time counter and keep record |
160 | // of how often images are requested to unload unused ones. | 163 | // of how often images are requested to unload unused ones. |
161 | 164 | ||
162 | public Asset_info() | 165 | public AssetInfo() |
163 | { | 166 | { |
164 | 167 | ||
165 | } | 168 | } |