private static void LoadFlagsFromFile()

in unity/Assets/Scripts/Utils/Flags.cs [56:89]


    private static void LoadFlagsFromFile(string file_name) {
        Logger.Info("Flags::LoadFlagsFromFile::Reading flag file: {0}", file_name);
        StreamReader reader = new StreamReader(file_name);
        string line = "";
        while ((line = reader.ReadLine()) != null) {
            string[] split = line.Split(new char[] { ' ' }, 3, StringSplitOptions.RemoveEmptyEntries);
            if (split.Length == 2) {
                string flag_type = split[0];
                string key = split[1];
                if (typeof(bool).Name.Equals(flag_type)) {
                    AddBoolFlag(key, true);
                } else if (typeof(string).Name.Equals(flag_type)) {
                    string_flags_[key] = "";
                }
            } else if (split.Length == 3) {
                string flag_type = split[0];
                string key = split[1];
                string value = split[2];
                if (typeof(bool).Name.Equals(flag_type)) {
                    AddBoolFlag(key, bool.Parse(value));
                } else if (typeof(int).Name.Equals(flag_type)) {
                    object_flags_[key] = int.Parse(value);
                } else if (typeof(float).Name.Equals(flag_type)) {
                    object_flags_[key] = float.Parse(value);
                } else if (typeof(string).Name.Equals(flag_type)) {
                    object_flags_[key] = value;
                    string_flags_[key] = value;
                } else {
                    string_flags_[key] = value;
                }
            }
        }
        reader.Close();
    }