private void BtnOkClick(object sender, EventArgs e)
 {
     m_filetypes = FileTypeManager.GetSettings();
     Close();
 }
        /// <summary>
        /// Tries to load the specified UniFile and returns the proper FileTool.
        /// </summary>
        /// <param name="file"></param>
        /// <param name="forceText">Set this to true to always use the Text-editor.</param>
        /// <returns></returns>
        static public FileTool LoadFile(UniFile file, bool forceText = false)
        {
            if (!AllowOpeningFilesTwice && s_openTools.ContainsKey(file.FilePath))
            {
                return(s_openTools[file.FilePath]);
            }

            FileTool tmp;

            byte[]  stream   = file.ConsumeStream();
            UniFile filecopy = new UniFile(stream);

            filecopy.FilePath = file.FilePath;

            if (forceText)
            {
                try
                {
                    tmp = new TextEditor(filecopy);
                }
                catch (Exception e)
                {
                    UIHelper.ShowError("Can't open the selected file " + file.FileName + " as Text: " + e.Message);
                    return(null);
                }
            }
            else if (FileTypeManager.FileTypes.ContainsKey(filecopy.FileExtension))
            {
                tmp = FileTypeManager.LaunchFromExt(filecopy.FileName, filecopy);
            }
            else
            {
                try
                {
                    tmp = new RelicChunkyViewer(filecopy);
                }
                catch
                {
                    try
                    {
                        filecopy             = new UniFile(stream);
                        file.Stream.Position = 0;
                        tmp = new TextEditor(filecopy);
                    }
                    catch (Exception ex)
                    {
                        LoggingManager.SendError("Failed to open file");
                        LoggingManager.HandleException(ex);
                        file.Close();
                        UIHelper.ShowError("Can't open the selected file " + file.FileName + ", no suitable plugin found!");
                        return(null);
                    }
                }
            }
            tmp.OnSaved += FileTool_OnSaved;
            if (!s_openTools.ContainsKey(file.FilePath))
            {
                s_openTools.Add(file.FilePath, tmp);
            }
            if (FileLoaded != null)
            {
                FileLoaded(file, tmp);
            }
            return(tmp);
        }