コード例 #1
0
 public FileType(string parDescription, string parSearchCriteria, Type parPreviewType, FileTypeGroup parGroup)
 {
     _Description    = parDescription;
     _SearchCriteria = parSearchCriteria;
     _PreviewType    = parPreviewType;
     _Group          = parGroup;
 }
コード例 #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            FileTypeGroup pdfFileTypeGroup        = new FileTypeGroup("PDF Documents", true, DocExp.Enums.GroupTypes.File);
            FileTypeGroup imageFileTypeGroup      = new FileTypeGroup("Images", true, DocExp.Enums.GroupTypes.File);
            FileTypeGroup otherFileTypeGroup      = new FileTypeGroup("Other Files", true, DocExp.Enums.GroupTypes.File);
            FileTypeGroup videoFileTypeGroup      = new FileTypeGroup("Video Files", true, DocExp.Enums.GroupTypes.File);
            FileTypeGroup musicFileTypeGroup      = new FileTypeGroup("Music Files", true, DocExp.Enums.GroupTypes.File);
            FileTypeGroup textFileTypeGroup       = new FileTypeGroup("Text Files", true, DocExp.Enums.GroupTypes.File);
            FileTypeGroup htmlFileTypeGroup       = new FileTypeGroup("Html Files", true, DocExp.Enums.GroupTypes.File);
            FileTypeGroup wordFileTypeGroup       = new FileTypeGroup("Word Files", true, DocExp.Enums.GroupTypes.File);
            FileTypeGroup excelFileTypeGroup      = new FileTypeGroup("Excel Files", true, DocExp.Enums.GroupTypes.File);
            FileTypeGroup powerpointFileTypeGroup = new FileTypeGroup("PowerPoint Files", true, DocExp.Enums.GroupTypes.File);
            FileTypeGroup drives  = new FileTypeGroup("Drives", false, DocExp.Enums.GroupTypes.Drive);
            FileTypeGroup folders = new FileTypeGroup("Folders", false, DocExp.Enums.GroupTypes.Folder);
            FileTypeGroup up      = new FileTypeGroup("", false, DocExp.Enums.GroupTypes.FolderUp);

            groups.Add(drives);
            groups.Add(folders);
            groups.Add(up);
            groups.Add(musicFileTypeGroup);
            groups.Add(videoFileTypeGroup);
            groups.Add(pdfFileTypeGroup);
            groups.Add(wordFileTypeGroup);
            groups.Add(excelFileTypeGroup);
            groups.Add(powerpointFileTypeGroup);
            groups.Add(imageFileTypeGroup);
            groups.Add(textFileTypeGroup);
            groups.Add(htmlFileTypeGroup);
            groups.Add(otherFileTypeGroup);


            fileTypes.Add(new FileType("Drivers", "*.*", null, drives));
            fileTypes.Add(new FileType("Folders", "*.*", null, folders));
            fileTypes.Add(new FileType("Up", "*.*", null, up));
            //fileTypes.Add(new FileType("PDF Files", "*.Pdf", typeof(PdfPreview), pdfFileTypeGroup));
            fileTypes.Add(new FileType("JPG Files", "*.Jpg", typeof(ImagePreview), imageFileTypeGroup));
            fileTypes.Add(new FileType("JPEG Files", "*.Jpeg", typeof(ImagePreview), imageFileTypeGroup));
            fileTypes.Add(new FileType("TIFF Files", "*.Tif", typeof(ImagePreview), imageFileTypeGroup));
            fileTypes.Add(new FileType("GIF Files", "*.Gif", typeof(ImagePreview), imageFileTypeGroup));
            fileTypes.Add(new FileType("BMP Files", "*.Bmp", typeof(ImagePreview), imageFileTypeGroup));
            fileTypes.Add(new FileType("PNG Files", "*.Png", typeof(ImagePreview), imageFileTypeGroup));
            fileTypes.Add(new FileType("MP3 Files", "*.Mp3", typeof(MediaPreview), musicFileTypeGroup));
            fileTypes.Add(new FileType("Wav Files", "*.Wav", typeof(MediaPreview), musicFileTypeGroup));
            fileTypes.Add(new FileType("Wma Files", "*.Wma", typeof(MediaPreview), musicFileTypeGroup));
            fileTypes.Add(new FileType("Midi Files", "*.Mid", typeof(MediaPreview), musicFileTypeGroup));
            fileTypes.Add(new FileType("Avi Files", "*.Avi", typeof(MediaPreview), videoFileTypeGroup));
            fileTypes.Add(new FileType("Mpg Files", "*.Mpg", typeof(MediaPreview), videoFileTypeGroup));
            fileTypes.Add(new FileType("Wmv Files", "*.Wmv", typeof(MediaPreview), videoFileTypeGroup));
            fileTypes.Add(new FileType("Html Files", "*.Html", typeof(HtmlPreview), htmlFileTypeGroup));
            fileTypes.Add(new FileType("Htm Files", "*.Htm", typeof(HtmlPreview), htmlFileTypeGroup));
            fileTypes.Add(new FileType("Txt Files", "*.Txt", typeof(TextPreview), textFileTypeGroup));
            fileTypes.Add(new FileType("Rtf Files", "*.Rtf", typeof(TextPreview), textFileTypeGroup));
            fileTypes.Add(new FileType("Docx Files", "*.Docx", typeof(WordPreview), wordFileTypeGroup));
            fileTypes.Add(new FileType("Doc Files", "*.Doc", typeof(WordPreview), wordFileTypeGroup));
            fileTypes.Add(new FileType("Xlsx Files", "*.Xlsx", typeof(ExcelPreview), excelFileTypeGroup));
            fileTypes.Add(new FileType("Xls Files", "*.Xls", typeof(ExcelPreview), excelFileTypeGroup));
            fileTypes.Add(new FileType("Pptx Files", "*.Pptx", typeof(PowerPointPreview), powerpointFileTypeGroup));
            fileTypes.Add(new FileType("Ppt Files", "*.Ppt", typeof(PowerPointPreview), powerpointFileTypeGroup));
            fileTypes.Add(new FileType("Ppsx Files", "*.Ppsx", typeof(PowerPointPreview), powerpointFileTypeGroup));
            fileTypes.Add(new FileType("Pps Files", "*.Pps", typeof(PowerPointPreview), powerpointFileTypeGroup));
            fileTypes.Add(new FileType("Other Files", "*.*", null, otherFileTypeGroup));

            foreach (Type t in System.Reflection.Assembly.GetExecutingAssembly().GetTypes())
            {
                if (t.BaseType == typeof(DocExp.AbstractClasses.Action))
                {
                    string       actionName = ((ActionAttributes)t.GetCustomAttributes(typeof(ActionAttributes), true)[0]).ActionName;
                    bool         isDefault  = ((ActionAttributes)t.GetCustomAttributes(typeof(ActionAttributes), true)[0]).IsDefaultAction;
                    GroupTypes[] gt         = ((ActionAttributes)t.GetCustomAttributes(typeof(ActionAttributes), true)[0]).ActionsGroupTypes;
                    ActionType   at         = new ActionType(actionName, t, isDefault);
                    foreach (GroupTypes g in gt)
                    {
                        at.ActionsGroupTypes.Add(g);
                    }
                    actionTypes.Add(at);
                }
            }
            SetImageSize();
            LoadDrives();
        }
コード例 #3
0
        public FileType GetFileType(string FileName)
        {
            FileTypeGroup pdfFileTypeGroup        = new FileTypeGroup("PDF Documents", true, DocExp.Enums.GroupTypes.File);
            FileTypeGroup imageFileTypeGroup      = new FileTypeGroup("Images", true, DocExp.Enums.GroupTypes.File);
            FileTypeGroup otherFileTypeGroup      = new FileTypeGroup("Other Files", true, DocExp.Enums.GroupTypes.File);
            FileTypeGroup videoFileTypeGroup      = new FileTypeGroup("Video Files", true, DocExp.Enums.GroupTypes.File);
            FileTypeGroup musicFileTypeGroup      = new FileTypeGroup("Music Files", true, DocExp.Enums.GroupTypes.File);
            FileTypeGroup textFileTypeGroup       = new FileTypeGroup("Text Files", true, DocExp.Enums.GroupTypes.File);
            FileTypeGroup htmlFileTypeGroup       = new FileTypeGroup("Html Files", true, DocExp.Enums.GroupTypes.File);
            FileTypeGroup wordFileTypeGroup       = new FileTypeGroup("Word Files", true, DocExp.Enums.GroupTypes.File);
            FileTypeGroup excelFileTypeGroup      = new FileTypeGroup("Excel Files", true, DocExp.Enums.GroupTypes.File);
            FileTypeGroup powerpointFileTypeGroup = new FileTypeGroup("PowerPoint Files", true, DocExp.Enums.GroupTypes.File);

            FileType TempFileType = null;

            string[] TempFileName = FileName.Split('.');
            switch (TempFileName[TempFileName.Length - 1].ToLower())
            {
            case "jpg":
                TempFileType = new FileType("JPG Files", "*.Jpg", typeof(ImagePreview), imageFileTypeGroup);
                break;

            case "jpeg":
                TempFileType = new FileType("JPEG Files", "*.Jpeg", typeof(ImagePreview), imageFileTypeGroup);
                break;

            case "tif":
                TempFileType = new FileType("TIFF Files", "*.Tif", typeof(ImagePreview), imageFileTypeGroup);
                break;

            case "gif":
                TempFileType = new FileType("GIF Files", "*.Gif", typeof(ImagePreview), imageFileTypeGroup);
                break;

            case "bmp":
                TempFileType = new FileType("BMP Files", "*.Bmp", typeof(ImagePreview), imageFileTypeGroup);
                break;

            case "png":
                TempFileType = new FileType("PNG Files", "*.Png", typeof(ImagePreview), imageFileTypeGroup);
                break;

            case "mp3":
                TempFileType = new FileType("MP3 Files", "*.Mp3", typeof(MediaPreview), musicFileTypeGroup);
                break;

            case "wav":
                TempFileType = new FileType("Wav Files", "*.Wav", typeof(MediaPreview), musicFileTypeGroup);
                break;

            case "wma":
                TempFileType = new FileType("Wma Files", "*.Wma", typeof(MediaPreview), musicFileTypeGroup);
                break;

            case "mid":
                TempFileType = new FileType("Midi Files", "*.Mid", typeof(MediaPreview), musicFileTypeGroup);
                break;

            case "avi":
                TempFileType = new FileType("Avi Files", "*.Avi", typeof(MediaPreview), videoFileTypeGroup);
                break;

            case "mpg":
                TempFileType = new FileType("Mpg Files", "*.Mpg", typeof(MediaPreview), videoFileTypeGroup);
                break;

            case "wmv":
                TempFileType = new FileType("Wmv Files", "*.Wmv", typeof(MediaPreview), videoFileTypeGroup);
                break;

            case "html":
                TempFileType = new FileType("Html Files", "*.Html", typeof(HtmlPreview), htmlFileTypeGroup);
                break;

            case "txt":
                TempFileType = new FileType("Txt Files", "*.Txt", typeof(TextPreview), textFileTypeGroup);
                break;

            case "rtf":
                TempFileType = new FileType("Rtf Files", "*.Rtf", typeof(TextPreview), textFileTypeGroup);
                break;

            case "docx":
                TempFileType = new FileType("Docx Files", "*.Docx", typeof(WordPreview), wordFileTypeGroup);
                break;

            case "doc":
                TempFileType = new FileType("Doc Files", "*.Doc", typeof(WordPreview), wordFileTypeGroup);
                break;

            case "xlsx":
                TempFileType = new FileType("Xlsx Files", "*.Xlsx", typeof(ExcelPreview), excelFileTypeGroup);
                break;

            case "xls":
                TempFileType = new FileType("Xls Files", "*.Xls", typeof(ExcelPreview), excelFileTypeGroup);
                break;

            case "pptx":
                TempFileType = new FileType("Pptx Files", "*.Pptx", typeof(PowerPointPreview), powerpointFileTypeGroup);
                break;

            case "ppt":
                TempFileType = new FileType("Ppt Files", "*.Ppt", typeof(PowerPointPreview), powerpointFileTypeGroup);
                break;

            case "ppsx":
                TempFileType = new FileType("Ppsx Files", "*.Ppsx", typeof(PowerPointPreview), powerpointFileTypeGroup);
                break;

            case "pps":
                TempFileType = new FileType("Pps Files", "*.Pps", typeof(PowerPointPreview), powerpointFileTypeGroup);
                break;
            }


            return(TempFileType);
        }