aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.GridInterfaces/Remote/RemoteAssetServer.cs
diff options
context:
space:
mode:
authorMW2007-05-15 17:51:13 +0000
committerMW2007-05-15 17:51:13 +0000
commit384293ac5676cf7ba1fbf77c182a117bd61822be (patch)
tree122b1ecab835ba2dca6383e5b33375be233821ba /OpenSim.GridInterfaces/Remote/RemoteAssetServer.cs
parentAdded SimClientPacketHandlers.cs (moved the SimClient Packet handlers into it) (diff)
downloadopensim-SC-384293ac5676cf7ba1fbf77c182a117bd61822be.zip
opensim-SC-384293ac5676cf7ba1fbf77c182a117bd61822be.tar.gz
opensim-SC-384293ac5676cf7ba1fbf77c182a117bd61822be.tar.bz2
opensim-SC-384293ac5676cf7ba1fbf77c182a117bd61822be.tar.xz
Worked on Asset server, asset downloads (from server to sim) now work.
Asset uploads (from sim to server) may or may not work, needs more testing, if they don't work then it should be just a encoding problem and not hard to fix.
Diffstat (limited to 'OpenSim.GridInterfaces/Remote/RemoteAssetServer.cs')
-rw-r--r--OpenSim.GridInterfaces/Remote/RemoteAssetServer.cs9
1 files changed, 7 insertions, 2 deletions
diff --git a/OpenSim.GridInterfaces/Remote/RemoteAssetServer.cs b/OpenSim.GridInterfaces/Remote/RemoteAssetServer.cs
index d79073a..7432dee 100644
--- a/OpenSim.GridInterfaces/Remote/RemoteAssetServer.cs
+++ b/OpenSim.GridInterfaces/Remote/RemoteAssetServer.cs
@@ -49,6 +49,11 @@ namespace OpenSim.GridInterfaces.Remote
49 49
50 public void UploadNewAsset(AssetBase asset) 50 public void UploadNewAsset(AssetBase asset)
51 { 51 {
52 Encoding Windows1252Encoding = Encoding.GetEncoding(1252);
53 string ret = Windows1252Encoding.GetString(asset.Data);
54 byte[] buffer = Windows1252Encoding.GetBytes(ret);
55 WebClient client = new WebClient();
56 client.UploadData(this.AssetServerUrl + "assets/" + asset.FullID, buffer);
52 57
53 } 58 }
54 59
@@ -66,14 +71,14 @@ namespace OpenSim.GridInterfaces.Remote
66 // 404... THE MAGIC FILE NOT FOUND ERROR, very useful for telling you things such as a file (or asset ;) ) not being found!!!!!!!!!!! it's 2:22AM 71 // 404... THE MAGIC FILE NOT FOUND ERROR, very useful for telling you things such as a file (or asset ;) ) not being found!!!!!!!!!!! it's 2:22AM
67 ARequest req = this._assetRequests.Dequeue(); 72 ARequest req = this._assetRequests.Dequeue();
68 LLUUID assetID = req.AssetID; 73 LLUUID assetID = req.AssetID;
69 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW," RemoteAssetServer- Got a AssetServer request, processing it - " + this.AssetServerUrl + "assets/" + assetID); 74 // OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW," RemoteAssetServer- Got a AssetServer request, processing it - " + this.AssetServerUrl + "assets/" + assetID);
70 WebRequest AssetLoad = WebRequest.Create(this.AssetServerUrl + "assets/" + assetID); 75 WebRequest AssetLoad = WebRequest.Create(this.AssetServerUrl + "assets/" + assetID);
71 WebResponse AssetResponse = AssetLoad.GetResponse(); 76 WebResponse AssetResponse = AssetLoad.GetResponse();
72 byte[] idata = new byte[(int)AssetResponse.ContentLength]; 77 byte[] idata = new byte[(int)AssetResponse.ContentLength];
73 BinaryReader br = new BinaryReader(AssetResponse.GetResponseStream()); 78 BinaryReader br = new BinaryReader(AssetResponse.GetResponseStream());
74 idata = br.ReadBytes((int)AssetResponse.ContentLength); 79 idata = br.ReadBytes((int)AssetResponse.ContentLength);
75 br.Close(); 80 br.Close();
76 81
77 AssetBase asset = new AssetBase(); 82 AssetBase asset = new AssetBase();
78 asset.FullID = assetID; 83 asset.FullID = assetID;
79 asset.Data = idata; 84 asset.Data = idata;