Ejemplo n.º 1
0
        /* ЗАМЕТКА РАЗРАБОТЧИКУ
         *
         * В данном файле размещаются подпрограммы для управления файлами, которые
         * вызываются из MainWindow.cs. Также планируется использование этих подпрограмм
         * после реализации текстовой коммандной строки FC (которая внизу окна).
         * Все комманды работают с активной и пассивой панелью - Active/PassivePanel.
         * FC всегда их определяет сам. Пассивая панель - всегда получатель файлов.
         * Названия комманд - UNIX в верблюжьем регистре (Ls, Rm, MkDir, Touch и т.п.).
         * Всем коммандам параметры передаются строкой, но допускаются исключения, напр.,
         * если базовая функция "перегружена" функцией для нужд графического интерфейса.
         * Sorry for my bad english.
         */

        /// <summary>
        /// Reads the file <paramref name="url"/> and shows in FC Viewer
        /// </summary>
        /// <param name="url"></param>
        public void FCView(string url)
        {
            VEd fcv = new VEd();

            pluginner.IFSPlugin fs = ActivePanel.FS;
            if (!fs.FileExists(url))
            {
                //MessageBox.Show(string.Format(locale.GetString("FileNotFound"), ActivePanel.list.SelectedItems[0].Text), "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                Xwt.MessageDialog.ShowError(string.Format(Locale.GetString("FileNotFound"), ActivePanel.GetValue(ActivePanel.dfDisplayName)));
                return;
            }

            pluginner.File SelectedFile = fs.GetFile(url, new int());
            string         FileContent  = Encoding.ASCII.GetString(fs.GetFileContent(url));

            fcv.LoadFile(url, ActivePanel.FS, false);
            fcv.Show();
        }
Ejemplo n.º 2
0
 public void LoadFile(string url, pluginner.IFSPlugin fsplugin)
 {
     URL     = url; FS = fsplugin;
     Content = Encoding.UTF8.GetString(fsplugin.GetFile(url, new int()).Content);
 }
Ejemplo n.º 3
0
        public void ChCp(object sender, EventArgs e) //change codepage
        {
            //BUG: the f*cking runtime substitutes selected by user menuitem with "unicode". wtf?
            Xwt.CheckBoxMenuItem SelItem = (Xwt.CheckBoxMenuItem)sender;
            Content     = Encoding.GetEncoding(Convert.ToInt32(SelItem.Tag)).GetString(FS.GetFile(URL, new int()).Content);
            txtBox.Text = Content;
#if DEBUG
            Console.WriteLine("Codepage debug: CP" + SelItem.Tag.ToString() + "=" + Encoding.GetEncoding(Convert.ToInt32(SelItem.Tag)).EncodingName + " (wanted:" + SelItem.Label + ")");
#endif
            foreach (Xwt.MenuItem CurItem in SettingsMenu)
            {
                if (CurItem.GetType() == new Xwt.CheckBoxMenuItem().GetType())//if the menuitem is checkbox
                {
                    Xwt.CheckBoxMenuItem SelItem2 = (Xwt.CheckBoxMenuItem)SelItem;
                    if (Convert.ToInt32(SelItem.Tag) == Convert.ToInt32(CurItem.Tag))
                    {//this is that!
                        SelItem2.Checked = true;
                    }
                    else
                    {//no, removing possibly mark
                        SelItem2.Checked = false;
                    }
                }
            }
        }