diff options
* Introduced some experimental code with regards to asset data substitution
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/AssetCache.cs | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs index e0d0bd7..b571c0b 100644 --- a/OpenSim/Framework/Communications/Cache/AssetCache.cs +++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Text.RegularExpressions; | ||
31 | using System.Threading; | 32 | using System.Threading; |
32 | using GlynnTucker.Cache; | 33 | using GlynnTucker.Cache; |
33 | using log4net; | 34 | using log4net; |
@@ -547,9 +548,49 @@ namespace OpenSim.Framework.Communications.Cache | |||
547 | req.RequestUser.SendAsset(req2); | 548 | req.RequestUser.SendAsset(req2); |
548 | 549 | ||
549 | } | 550 | } |
551 | } | ||
552 | |||
553 | public byte[] ProcessAssetData(byte[] assetData) | ||
554 | { | ||
555 | string data = Encoding.ASCII.GetString(assetData); | ||
556 | |||
557 | data = ProcessAssetDataString(data); | ||
558 | |||
559 | return Encoding.ASCII.GetBytes( data ); | ||
560 | } | ||
561 | |||
562 | public string ProcessAssetDataString(string data) | ||
563 | { | ||
564 | Regex regex = new Regex("(creator_url|owner_url)\\s+(\\S+)"); | ||
565 | |||
566 | data = regex.Replace(data, delegate(Match m) | ||
567 | { | ||
568 | string result = String.Empty; | ||
550 | 569 | ||
570 | string key = m.Groups[1].Captures[0].Value; | ||
571 | |||
572 | string value = m.Groups[2].Captures[0].Value; | ||
573 | |||
574 | Guid id = Util.GetHashGuid(value, AssetInfo.Secret); | ||
575 | |||
576 | switch (key) | ||
577 | { | ||
578 | case "creator_url": | ||
579 | result = "creator_id " + id; | ||
580 | break; | ||
581 | |||
582 | case "owner_url": | ||
583 | result = "owner_id " + id; | ||
584 | break; | ||
585 | } | ||
586 | |||
587 | return result; | ||
588 | }); | ||
589 | |||
590 | return data; | ||
551 | } | 591 | } |
552 | 592 | ||
593 | |||
553 | public class AssetRequest | 594 | public class AssetRequest |
554 | { | 595 | { |
555 | public IClientAPI RequestUser; | 596 | public IClientAPI RequestUser; |
@@ -578,6 +619,8 @@ namespace OpenSim.Framework.Communications.Cache | |||
578 | Name = aBase.Name; | 619 | Name = aBase.Name; |
579 | Description = aBase.Description; | 620 | Description = aBase.Description; |
580 | } | 621 | } |
622 | |||
623 | public const string Secret = "secret"; | ||
581 | } | 624 | } |
582 | 625 | ||
583 | public class TextureImage : AssetBase | 626 | public class TextureImage : AssetBase |