void ReadAll() { if (!CheckSignature(_input)) { throw new RapFormatException("Attempt to read a rap file with an invalid signature"); } //skip signature since CheckSignature helpfully rewinds _input.Seek(4, SeekOrigin.Current); //skip reserved bytes _input.Seek(6, SeekOrigin.Current); //skip first entryType _input.Seek(1, SeekOrigin.Current); //skip null classname BinaryFile.ReadString(_input); //skip enum offset var enumOffset = BinaryFile.ReadUInt32(_input); //now we are at the actual list of classes so start reading var c = ReadClassBody("", _input.Position); Root = new ConfigFile(c); //finally read the enums if present and add them to the Root if (enumOffset != 0) { var enums = ReadEnums(enumOffset); if (enums != null) { Root.Add(enums); } } }
/// <summary> /// Stores a config setting. This is meant to be open and editable by the user by the config file. /// </summary> /// <param name="key"></param> /// <param name="value"></param> /// <returns></returns> public object SetConfig(string key, object value) { if (ConfigFile.ContainsKey(key)) { ConfigFile[key] = value.ToString(); return(value); } ConfigFile.Add(key, value.ToString()); return(value); }
/// <summary> /// Gets a value from the config settings. /// </summary> /// <param name="key"></param> /// <param name="onNull"></param> /// <returns></returns> public string GetConfig(string key, string onNull = "") { if (ConfigFile.ContainsKey(key)) { return(ConfigFile[key]); } else { ConfigFile.Add(key, onNull); return(onNull); } }