#W# Initial Commit: Avatars Conquest
This commit is contained in:
commit
8eae46895e
7512 changed files with 416187 additions and 0 deletions
64
Scripts/Misc/DataPath.cs
Normal file
64
Scripts/Misc/DataPath.cs
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.Win32;
|
||||
using Server;
|
||||
|
||||
namespace Server.Misc
|
||||
{
|
||||
public class DataPath
|
||||
{
|
||||
private static string CustomPath = "Data/Files";
|
||||
|
||||
public static void Configure()
|
||||
{
|
||||
if ( CustomPath != null )
|
||||
Core.DataDirectories.Add( CustomPath );
|
||||
|
||||
if ( Core.DataDirectories.Count == 0 && !Core.Service )
|
||||
{
|
||||
Console.WriteLine( "Enter the Ultima Online directory:" );
|
||||
Console.Write( "> " );
|
||||
|
||||
Core.DataDirectories.Add( Console.ReadLine() );
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetPath( string subName, string keyName )
|
||||
{
|
||||
try
|
||||
{
|
||||
string keyString;
|
||||
|
||||
if( Core.Is64Bit )
|
||||
keyString = @"SOFTWARE\Wow6432Node\{0}";
|
||||
else
|
||||
keyString = @"SOFTWARE\{0}";
|
||||
|
||||
using( RegistryKey key = Registry.LocalMachine.OpenSubKey( String.Format( keyString, subName ) ) )
|
||||
{
|
||||
if( key == null )
|
||||
return null;
|
||||
|
||||
string v = key.GetValue( keyName ) as string;
|
||||
|
||||
if( String.IsNullOrEmpty( v ) )
|
||||
return null;
|
||||
|
||||
if ( keyName == "InstallDir" )
|
||||
v = v + @"\";
|
||||
|
||||
v = Path.GetDirectoryName( v );
|
||||
|
||||
if ( String.IsNullOrEmpty( v ) )
|
||||
return null;
|
||||
|
||||
return v;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue