View of /trunk/AssetServer/Extensions/Simple/SimpleUtils.cs
Parent Directory
|
Revision Log
Revision 49 -
(download)
(annotate)
Mon Dec 15 21:13:28 2008 UTC (4 years, 5 months ago) by jhurliman
File size: 1266 byte(s)
Mon Dec 15 21:13:28 2008 UTC (4 years, 5 months ago) by jhurliman
File size: 1266 byte(s)
* Switched over to Prebuild, removed all project and solution files * Shuffled things around to put AssetServer in its own folder * Updated to the latest OpenMetaverseTypes.dll which now includes DoubleDictionary, ExpiringCache, and BlockingQueue
using System;
using System.IO;
using OpenMetaverse;
namespace AssetServer.Extensions
{
public static class SimpleUtils
{
public static string ParseNameFromFilename(string filename)
{
filename = Path.GetFileName(filename);
int dot = filename.LastIndexOf('.');
int firstDash = filename.IndexOf('-');
if (dot - 37 > 0 && firstDash > 0)
return filename.Substring(0, firstDash);
else
return String.Empty;
}
public static UUID ParseUUIDFromFilename(string filename)
{
int dot = filename.LastIndexOf('.');
if (dot > 35)
{
// Grab the last 36 characters of the filename
string uuidString = filename.Substring(dot - 36, 36);
UUID uuid;
UUID.TryParse(uuidString, out uuid);
return uuid;
}
else
{
UUID uuid;
if (UUID.TryParse(Path.GetFileName(filename), out uuid))
return uuid;
else
return UUID.Zero;
}
}
}
}
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |

