using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace Blizzard { public class GetData { public Dictionary data; public GetData(string filePath) { data = new Dictionary(); if (!File.Exists(filePath)) { BlizzardSystem.WriteLine("No se puede encontrar el archivo '" + filePath + "'."); } try { using (StreamReader stream = new StreamReader(filePath)) { string line = null; while ((line = stream.ReadLine()) != null) { if (line.Length < 1 || line.StartsWith("#")) { continue; } int delimiterIndex = line.IndexOf('='); if (delimiterIndex != -1) { string key = line.Substring(0, delimiterIndex); string val = line.Substring(delimiterIndex + 1); data.Add(key, val); } } stream.Close(); } } catch (Exception e) { BlizzardSystem.WriteLine("No se pudo procesar el archivo; Error: " + e.Message); } } } }