Ejemplo n.º 1
0
        public void Read()
        {
            try
            {
                m_bLoading = true;

                var filePath = m_uri.LocalPath;
                if (File.Exists(filePath))
                {
                    // Store whether file has byte order mark
                    m_bHasBom = SledUtil.FileHasBom(filePath);

                    using (Stream stream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
                    {
                        using (var reader = new StreamReader(stream, true))
                        {
                            // Store encoding
                            m_encoding = reader.CurrentEncoding;

                            // Read file and update editor
                            m_editor.Text  = reader.ReadToEnd();
                            m_editor.Dirty = false;
                        }
                    }
                }
            }
            finally
            {
                m_bLoading = false;
            }
        }