iniParser.DoesExist C# (CSharp) Method

DoesExist() public method

Returns true if the file exists, or false if it doesnt.
public DoesExist ( IniFiles, file ) : bool
file IniFiles, The selected file.
return bool
    public bool DoesExist(IniFiles file)
    {
        return File.Exists(Application.dataPath+"/"+file+".ini") ? true : false;
    }

Usage Example

示例#1
0
    void Awake()
    {
        parser = new iniParser();

        if (!parser.DoesExist("WormballSettings"))
        {
            parser.Set("MatchLength", ScoreManager.instance.totalGameTime.ToString());
            parser.save("WormballSettings");
        }
        else
        {
            parser.load("WormballSettings");

            float parseVal = 5f;
            if (float.TryParse(parser.Get("MatchLength"), out parseVal))
            {
                ScoreManager.instance.totalGameTime = float.Parse(parser.Get("MatchLength"));
            }
            else
            {
                ScoreManager.instance.totalGameTime = 45f;
            }
        }

        gameState = GameState.Menu;
        prevState = gameState;

        StartCoroutine(UpdateState());

#if UNITY_EDITOR
        AssetDatabase.Refresh();
#endif
    }
All Usage Examples Of iniParser::DoesExist