Ejemplo n.º 1
0
 public void OpenFile(string url, pluginner.IFSPlugin fsplugin)
 {
     lblFileName.Text = url;
     fileContent = fsplugin.GetFileContent(url);
     ChangeCodepage(Codepage);
 }
Ejemplo n.º 2
0
Archivo: VEd.cs Proyecto: kekekeks/fcmd
        /// <summary>Load the file in the VE (with plugin autodetection)</summary>
        /// <param name="URL">The file's URL</param>
        /// <param name="FS">The file's filesystem</param>
        /// <param name="AllowEdit">Mode of VE: true=editor, false=viewer</param>
        public void LoadFile(string URL, pluginner.IFSPlugin FS, bool AllowEdit)
        {
            byte[] ContentBytes = FS.GetFileContent(URL);
            string content = (ContentBytes != null && ContentBytes.Length > 0) ? Encoding.UTF8.GetString(ContentBytes) : "";
            pluginfinder pf = new pluginfinder();

            try
            {
                string GottenHeaders;
                if (content.Length >= 20) GottenHeaders = content.Substring(0, 20);
                else GottenHeaders = content;
                LoadFile(URL, FS, pf.GetFCVEplugin("NAME=" + URL + "HEADERS=" + GottenHeaders), AllowEdit);
            }
            catch (pluginfinder.PluginNotFoundException ex)
            {
                Console.WriteLine("ERROR: VE plugin is not loaded: " + ex.Message + "\n" + ex.StackTrace);
                Xwt.MessageDialog.ShowError(Locale.GetString("FCVE_PluginNotFound"));
                LoadFile(URL, FS, new base_plugins.ve.PlainText(), AllowEdit);
            }
            catch (Exception ex)
            {
                Xwt.MessageDialog.ShowError(string.Format(Locale.GetString("FCVE_LoadError"),ex.Message));
                Console.WriteLine("ERROR: VE can't load file: " + ex.Message + "\n" + ex.StackTrace);
                return;
            }
        }