Exemple #1
0
        public string GetVariable(VariableType type)
        {
            string result;

            switch (type)
            {
            case VariableType.EditorDirectory:
                result = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                break;

            case VariableType.ScriptDirectory:
                result = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + Dir + "Script";
                break;

            case VariableType.LevelDirectory:
                if (!string.IsNullOrEmpty(LevelFilePath))
                {
                    result = Path.GetDirectoryName(LevelFilePath);
                }
                else
                {
                    result = GetVariable(VariableType.EditorDirectory);
                }
                break;

            case VariableType.GameDirectory:
                result = MakeAbsolute(GameDirectory ?? VariableCreate(VariableType.LevelDirectory), VariableType.GameDirectory);
                break;

            case VariableType.LevelName:
                if (!string.IsNullOrEmpty(LevelFilePath))
                {
                    result = PathC.GetFileNameWithoutExtensionTry(LevelFilePath);
                }
                else if (Wads.Count > 0 && !string.IsNullOrEmpty(Wads[0].Path))
                {
                    result = PathC.GetFileNameWithoutExtensionTry(Wads[0].Path);
                }
                else
                {
                    result = "Default";
                }
                break;

            case VariableType.EngineVersion:
                result = GameVersion.ToString();
                break;

            case VariableType.SoundEngineVersion:
                result = (GameVersion.Native()).ToString();
                break;

            default:
                throw new ArgumentException();
            }
            if (result == null)
            {
                result = "";
            }
            return(result);
        }