public bool Load() { if (!File.Exists(FileName)) { return(false); } try { Sections.Clear(); using (var fileData = new StreamReader(FileName, FileEncoding, true)) { string firstLine = null; while (string.IsNullOrEmpty(firstLine) && !fileData.EndOfStream) { firstLine = fileData.ReadLine(); } if (!FileEncoding.Equals(Encoding.Unicode) && !FileEncoding.Equals(Encoding.BigEndianUnicode) && EncodingDetector.IsUnicode(firstLine)) { FileEncoding = Encoding.Unicode; } else { FileEncoding = fileData.CurrentEncoding; } fileData.Close(); } using (var fileData = new StreamReader(FileName, FileEncoding, true)) { LoadContent(fileData); fileData.Close(); } return(true); } catch (IOException ex) { System.Diagnostics.Trace.TraceError(ex.Message); return(false); } }