Advertisement
Blizzardo1

Global.cs

Sep 28th, 2015
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.79 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Reflection;
  4.  
  5. namespace Blizzeta.Paradox.Code
  6. {
  7.     public class Global
  8.     {
  9.  
  10.         private const char WinSp = '\\';
  11.         private const char NixSp = '/';
  12.         public static readonly char DirSeparator = IsWindows ? WinSp : NixSp;
  13.  
  14.         private static readonly string AudioFmt = string.Format( "{{0}}{0}Audio", DirSeparator );
  15.         private static readonly string EffectsFmt = string.Format( "{{0}}{0}Effects", DirSeparator );
  16.         private static readonly string SpritesFmt = string.Format( "{{0}}{0}Sprites", DirSeparator );
  17.         private static readonly string WorldsFmt = string.Format( "{{0}}{0}Worlds", DirSeparator );
  18.         private static readonly string DungeonsFmt = string.Format( "{{0}}{0}Dungeons", DirSeparator );
  19.         private static readonly string SecretsFmt = string.Format( "{{0}}{0}Secrets", DirSeparator );
  20.         private static readonly string WorldFmt = string.Format( "{{0}}{0}World", DirSeparator );
  21.         private static readonly string BackgroundDataFmt = string.Format( "{{0}}{0}BackgroundData", DirSeparator );
  22.         private static readonly string ParallaxFmt = string.Format( "{{0}}{0}Parallax", DirSeparator );
  23.         private static readonly string EnemiesFmt = string.Format( "{{0}}{0}Enemies", DirSeparator );
  24.         private static readonly string BossesFmt = string.Format( "{{0}}{0}Bosses", DirSeparator );
  25.         private static readonly string NpcFmt = string.Format( "{{0}}{0}NPC", DirSeparator );
  26.         private static readonly string PlayerFmt = string.Format( "{{0}}{0}Player", DirSeparator );
  27.         private static readonly string DarkFmt = string.Format( "{{0}}{0}Dark", DirSeparator );
  28.         private static readonly string LightFmt = string.Format( "{{0}}{0}Light", DirSeparator );
  29.  
  30.         public static readonly string Root = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
  31.  
  32.         public static readonly string Resources = string.Format("{0}{1}Resources", Root, DirSeparator);
  33.  
  34.         public static readonly string Audio = string.Format( AudioFmt, Resources );
  35.  
  36.         public static readonly string AudioDark = string.Format( DarkFmt, Audio );
  37.         public static readonly string AudioEffects = string.Format( EffectsFmt, Audio );
  38.         public static readonly string AudioLight = string.Format( LightFmt, Audio );
  39.  
  40.         public static readonly string Sprites = string.OSVersion( SpritesFmt, Resources );
  41.         public static readonly string SpritesEnemies = string.Format( EnemiesFmt, Sprites );
  42.         public static readonly string SpritesEnemiesBosses = string.Format( BossesFmt, SpritesEnemies );
  43.         public static readonly string SpritesEnemiesDark = string.Format( DarkFmt, SpritesEnemies );
  44.         public static readonly string SpritesEnemiesLight = string.Format( LightFmt, SpritesEnemies );
  45.         public static readonly string SpritesNpc = string.Format( NpcFmt, Sprites );
  46.         public static readonly string SpritesPlayer = string.Format( PlayerFmt, Sprites );
  47.  
  48.         public static readonly string Worlds = string.Format( WorldsFmt, Resources );
  49.         public static readonly string WorldsDark = string.Format( DarkFmt, Worlds );
  50.         public static readonly string WorldsDarkDungeons = string.Format( DungeonsFmt, WorldsDark );
  51.         public static readonly string WorldsDarkSecrets = string.Format( SecretsFmt, WorldsDark );
  52.         public static readonly string WorldsDarkWorld = string.Format( WorldFmt, WorldsDark );
  53.         public static readonly string WorldsDarkWorldBackGroundData = string.Format( BackgroundDataFmt, WorldsDarkWorld );
  54.         public static readonly string WorldsDarkWorldParallax = string.Format( ParallaxFmt, WorldsDarkWorld );
  55.  
  56.         public static readonly string WorldsLight = string.Format( LightFmt, Worlds );
  57.         public static readonly string WorldsLightDungeons = string.Format( DungeonsFmt, WorldsLight );
  58.         public static readonly string WorldsLightSecrets = string.Format( SecretsFmt, WorldsLight );
  59.         public static readonly string WorldsLightWorld = string.Format( WorldFmt, WorldsLight );
  60.  
  61.         public static readonly string WorldsLightWorldBackGroundData = string.Format( BackgroundDataFmt,
  62.             WorldsLightWorld );
  63.  
  64.         public static readonly string WorldsLightWorldParallax = string.Format( ParallaxFmt, WorldsLightWorld );
  65.  
  66.  
  67.         public static bool IsLinux
  68.         { get { return CheckSanityOS(  Platform.Unix ); } }
  69.         public static bool IsWindows
  70.         { get { return CheckSanityOS ( PlatformID.Win32NT); } }
  71.         public static bool IsMac
  72.         { get { return CheckSanityOS ( PlatformID.MacOSX ); } }
  73.  
  74.         private static bool CheckSanityOS( PlatformID platform )
  75.         {
  76.             return Environment.OSVersion.Platform == platform;
  77.         }
  78.  
  79.     }
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement