aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/AssetInventoryServer/Extensions/SimpleUtils.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Grid/AssetInventoryServer/Extensions/SimpleUtils.cs')
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Extensions/SimpleUtils.cs88
1 files changed, 44 insertions, 44 deletions
diff --git a/OpenSim/Grid/AssetInventoryServer/Extensions/SimpleUtils.cs b/OpenSim/Grid/AssetInventoryServer/Extensions/SimpleUtils.cs
index fe6491e..b3edf59 100644
--- a/OpenSim/Grid/AssetInventoryServer/Extensions/SimpleUtils.cs
+++ b/OpenSim/Grid/AssetInventoryServer/Extensions/SimpleUtils.cs
@@ -1,44 +1,44 @@
1using System; 1using System;
2using System.IO; 2using System.IO;
3using OpenMetaverse; 3using OpenMetaverse;
4 4
5namespace OpenSim.Grid.AssetInventoryServer.Extensions 5namespace OpenSim.Grid.AssetInventoryServer.Extensions
6{ 6{
7 public static class SimpleUtils 7 public static class SimpleUtils
8 { 8 {
9 public static string ParseNameFromFilename(string filename) 9 public static string ParseNameFromFilename(string filename)
10 { 10 {
11 filename = Path.GetFileName(filename); 11 filename = Path.GetFileName(filename);
12 12
13 int dot = filename.LastIndexOf('.'); 13 int dot = filename.LastIndexOf('.');
14 int firstDash = filename.IndexOf('-'); 14 int firstDash = filename.IndexOf('-');
15 15
16 if (dot - 37 > 0 && firstDash > 0) 16 if (dot - 37 > 0 && firstDash > 0)
17 return filename.Substring(0, firstDash); 17 return filename.Substring(0, firstDash);
18 else 18 else
19 return String.Empty; 19 return String.Empty;
20 } 20 }
21 21
22 public static UUID ParseUUIDFromFilename(string filename) 22 public static UUID ParseUUIDFromFilename(string filename)
23 { 23 {
24 int dot = filename.LastIndexOf('.'); 24 int dot = filename.LastIndexOf('.');
25 25
26 if (dot > 35) 26 if (dot > 35)
27 { 27 {
28 // Grab the last 36 characters of the filename 28 // Grab the last 36 characters of the filename
29 string uuidString = filename.Substring(dot - 36, 36); 29 string uuidString = filename.Substring(dot - 36, 36);
30 UUID uuid; 30 UUID uuid;
31 UUID.TryParse(uuidString, out uuid); 31 UUID.TryParse(uuidString, out uuid);
32 return uuid; 32 return uuid;
33 } 33 }
34 else 34 else
35 { 35 {
36 UUID uuid; 36 UUID uuid;
37 if (UUID.TryParse(Path.GetFileName(filename), out uuid)) 37 if (UUID.TryParse(Path.GetFileName(filename), out uuid))
38 return uuid; 38 return uuid;
39 else 39 else
40 return UUID.Zero; 40 return UUID.Zero;
41 } 41 }
42 } 42 }
43 } 43 }
44} 44}