private void LoadAPIConfig(string pathToAPIConfig) { if (!File.Exists(pathToAPIConfig)) { throw new ApplicationException("No API configuration file found."); } FileStream fstream = new FileStream(pathToAPIConfig, FileMode.Open); DataContractJsonSerializer jsonSerializer = new DataContractJsonSerializer(typeof(RiotRestAPI.APIConfig)); object objResponse = jsonSerializer.ReadObject(fstream); fstream.Close(); _apiConfig = (RiotRestAPI.APIConfig)Convert.ChangeType(objResponse, typeof(RiotRestAPI.APIConfig)); LogProgress("Loaded API Config: " + _apiConfig.ApiKey); }