Esempio n. 1
0
        //VERY buggy
        //private void open_edit(string file_name)
        //{
        //    this.file_name = file_name;

        //    EditStream fs = new EditStream(file_name);
        //    Encoding enc = ((Encoding_DisplayInfo)toolStripComboBoxEncoding.SelectedItem).EncodingInfo.GetEncoding();
        //    if (text_provider != null)
        //    {
        //        text_provider.Dispose();
        //    }
        //    text_provider = TextProviderFactory.CreateProvider(fs, enc);
        //    TextViewControl.TextProvider = text_provider;
        //    Text = string.Format(Options.GetLiteral(Options.LANG_FILE_EDIT) + " [{0}]", file_name);

        //    //saveAsToolStripMenuItem.Enabled = true;
        //    //saveToolStripMenuItem.Enabled = true;
        //}

        private void open_view(string file_name, Encoding encoding)
        {
            this.file_name = file_name;

            var fs = WinAPiFSwrapper.CreateStreamEx
                         (file_name,
                         FileAccess.Read,
                         FileShare.Read,
                         FileMode.Open,
                         CreateFileOptions.RANDOM_ACCESS);

            text_provider = TextProviderFactory.CreateProvider(fs, encoding);
            TextViewControl.TextProvider = text_provider;
            Text = string.Format(Options.GetLiteral(Options.LANG_FILE_VIEW) + " [{0}]", file_name);
        }