aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/AssetInventoryServer/Extensions/SimpleUtils.cs
diff options
context:
space:
mode:
authorMike Mazur2009-02-16 02:25:25 +0000
committerMike Mazur2009-02-16 02:25:25 +0000
commit8d304725518424131fa42dce1515137e0bb1eada (patch)
tree69ba204f2560971b385332e5bd689cbc3a8fbff9 /OpenSim/Grid/AssetInventoryServer/Extensions/SimpleUtils.cs
parent- add OpenSim.Grid.AssetServer.Plugins.OpenSim as a dependency for OpenSim.Da... (diff)
downloadopensim-SC_OLD-8d304725518424131fa42dce1515137e0bb1eada.zip
opensim-SC_OLD-8d304725518424131fa42dce1515137e0bb1eada.tar.gz
opensim-SC_OLD-8d304725518424131fa42dce1515137e0bb1eada.tar.bz2
opensim-SC_OLD-8d304725518424131fa42dce1515137e0bb1eada.tar.xz
Rename NewAssetServer AssetInventoryServer and fully qualify with
OpenSim.Grid.AssetInventoryServer.
Diffstat (limited to 'OpenSim/Grid/AssetInventoryServer/Extensions/SimpleUtils.cs')
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Extensions/SimpleUtils.cs44
1 files changed, 44 insertions, 0 deletions
diff --git a/OpenSim/Grid/AssetInventoryServer/Extensions/SimpleUtils.cs b/OpenSim/Grid/AssetInventoryServer/Extensions/SimpleUtils.cs
new file mode 100644
index 0000000..fe6491e
--- /dev/null
+++ b/OpenSim/Grid/AssetInventoryServer/Extensions/SimpleUtils.cs
@@ -0,0 +1,44 @@
1using System;
2using System.IO;
3using OpenMetaverse;
4
5namespace OpenSim.Grid.AssetInventoryServer.Extensions
6{
7 public static class SimpleUtils
8 {
9 public static string ParseNameFromFilename(string filename)
10 {
11 filename = Path.GetFileName(filename);
12
13 int dot = filename.LastIndexOf('.');
14 int firstDash = filename.IndexOf('-');
15
16 if (dot - 37 > 0 && firstDash > 0)
17 return filename.Substring(0, firstDash);
18 else
19 return String.Empty;
20 }
21
22 public static UUID ParseUUIDFromFilename(string filename)
23 {
24 int dot = filename.LastIndexOf('.');
25
26 if (dot > 35)
27 {
28 // Grab the last 36 characters of the filename
29 string uuidString = filename.Substring(dot - 36, 36);
30 UUID uuid;
31 UUID.TryParse(uuidString, out uuid);
32 return uuid;
33 }
34 else
35 {
36 UUID uuid;
37 if (UUID.TryParse(Path.GetFileName(filename), out uuid))
38 return uuid;
39 else
40 return UUID.Zero;
41 }
42 }
43 }
44}