コード例 #1
0
        public override string GetParentFile(FileInfo fi, FileTaskType taskType)
        {
            if (ProTONEConfig.UseLinkedFiles)
            {
                // Check whether the child file is a double extension file
                // In this case the parent file should have same name but w/o the second extension part.
                string parentFilePath = Path.Combine(fi.DirectoryName, Path.GetFileNameWithoutExtension(fi.FullName));
                if (File.Exists(parentFilePath))
                    return parentFilePath;

                string fileType = fi.Extension.ToUpperInvariant().Trim('.');
                string[] parentFileTypes = ProTONEConfig.GetParentFileTypes(fileType);

                if (parentFileTypes != null && parentFileTypes.Length > 0)
                {
                    foreach (string parentFileType in parentFileTypes)
                    {
                        parentFilePath = Path.ChangeExtension(fi.FullName, parentFileType);
                        if (File.Exists(parentFilePath))
                        {
                            return parentFilePath;
                        }
                    }
                }
            }

            return null;
        }
コード例 #2
0
        public override List<string> GetChildFiles(string file, FileTaskType taskType)
        {
            List<string> list = new List<string>();

            if (ProTONEConfig.UseLinkedFiles)
            {
                string fileType = PathUtils.GetExtension(file).ToUpperInvariant();
                string[] childFileTypes = ProTONEConfig.GetChildFileTypes(fileType);

                if (childFileTypes != null && childFileTypes.Length > 0)
                {
                    foreach (string childFileType in childFileTypes)
                    {
                        // This will find files like "FileName.PFT" and change them into "FileName.CFT"
                        string childFilePath = Path.ChangeExtension(file, childFileType);
                        if (File.Exists(childFilePath) && !list.Contains(childFilePath))
                        {
                            list.Add(childFilePath);
                        }

                        // This will find files like "FileName.PFT" and change them into "FileName.PFT.CFT"
                        // (i.e. handle double type extension case like for Bookmark files)
                        string childFileType2 = string.Format("{0}.{1}", PathUtils.GetExtension(file), childFileType);
                        string childFilePath2 = Path.ChangeExtension(file, childFileType2);
                        if (File.Exists(childFilePath2) && !list.Contains(childFilePath2))
                        {
                            list.Add(childFilePath2);
                        }
                    }
                }
            }

            return list;
        }
コード例 #3
0
        public override List<string> GetChildFiles(FileInfo fi, FileTaskType taskType)
        {
            List<string> list = new List<string>();

            if (ProTONEConfig.UseLinkedFiles)
            {
                string fileType = fi.Extension.ToUpperInvariant().Trim('.');
                string[] childFileTypes = ProTONEConfig.GetChildFileTypes(fileType);

                if (childFileTypes != null && childFileTypes.Length > 0)
                {
                    foreach (string childFileType in childFileTypes)
                    {
                        // This will find files like "FileName.PFT" and change them into "FileName.CFT"
                        string childFilePath = Path.ChangeExtension(fi.FullName, childFileType);
                        if (File.Exists(childFilePath) && !list.Contains(childFilePath))
                        {
                            list.Add(childFilePath);
                        }

                        // This will find files like "FileName.PFT" and change them into "FileName.PFT.CFT"
                        // (i.e. handle double type extension case like for Bookmark files)
                        string childFileType2 = string.Format("{0}.{1}", fi.Extension, childFileType);
                        string childFilePath2 = Path.ChangeExtension(fi.FullName, childFileType2);
                        if (File.Exists(childFilePath2) && !list.Contains(childFilePath2))
                        {
                            list.Add(childFilePath2);
                        }
                    }
                }
            }

            return list;
        }
コード例 #4
0
        public override string GetParentFile(string file, FileTaskType taskType)
        {
            if (ProTONEConfig.UseLinkedFiles)
            {
                string parentFilePath = "";

                if (Path.HasExtension(file))
                {
                    // Check whether the child file is a double extension file
                    // In this case the parent file should have same name but w/o the second extension part.
                    parentFilePath = Path.Combine(Path.GetDirectoryName(file), Path.GetFileNameWithoutExtension(file));
                    if (File.Exists(parentFilePath))
                        return parentFilePath;
                }

                string fileType = Path.GetExtension(file).ToUpperInvariant();
                string[] parentFileTypes = ProTONEConfig.GetParentFileTypes(fileType);

                if (parentFileTypes != null && parentFileTypes.Length > 0)
                {
                    foreach (string parentFileType in parentFileTypes)
                    {
                        parentFilePath = Path.ChangeExtension(file, parentFileType);
                        if (File.Exists(parentFilePath))
                        {
                            return parentFilePath;
                        }
                    }
                }
            }

            return null;
        }
コード例 #5
0
        public FileTaskForm(FileTaskType type, List <string> srcFiles, string srcPath)
        {
            InitializeComponent();

            _task = InitTask(type, srcFiles, srcPath);
            _task.FileTaskProgress += new FileTaskProgressDG(OnFileTaskProgress);

            this.Shown       += new EventHandler(FileTaskForm_Shown);
            this.FormClosing += new FormClosingEventHandler(FileTaskForm_FormClosing);
        }
コード例 #6
0
ファイル: FileTaskForm.cs プロジェクト: rraguso/protone-suite
        public FileTaskForm(FileTaskType type, List<string> srcFiles, string srcPath)
        {
            InitializeComponent();

            _task = InitTask(type, srcFiles, srcPath);
            _task.FileTaskProgress += new FileTaskProgressDG(OnFileTaskProgress);

            this.Shown += new EventHandler(FileTaskForm_Shown);
            this.FormClosing += new FormClosingEventHandler(FileTaskForm_FormClosing);
        }
コード例 #7
0
        List <string> OnQueryLinkedFiles(string path, FileTaskType taskType)
        {
            FEFileTaskSupport support = new FEFileTaskSupport(null);

            if (File.Exists(path))
            {
                return(support.GetChildFiles(path, taskType));
            }

            return(null);
        }
コード例 #8
0
        public BaseFileTask(FileTaskType type, List <string> srcFiles, string srcFolder)
        {
            this.TaskType = type;
            this.ErrorMap = new Dictionary <string, string>();

            this.SrcFiles  = srcFiles;
            this.SrcFolder = srcFolder;

            _timer           = new System.Timers.Timer(500);
            _timer.AutoReset = true;
            _timer.Elapsed  += new System.Timers.ElapsedEventHandler(_timer_Elapsed);

            _support        = InitSupport();
            this.IsFinished = false;
        }
コード例 #9
0
ファイル: FileTaskForm.cs プロジェクト: rraguso/protone-suite
        protected virtual BaseFileTask InitTask(FileTaskType type, List<string> srcFiles, string srcPath)
        {
            switch (type)
            {
                case FileTaskType.Copy:
                    return new CopyFilesTask(srcFiles, srcPath);

                case FileTaskType.Move:
                    return new MoveFilesTask(srcFiles, srcPath);

                case FileTaskType.Delete:
                    return new DeleteFilesTask(srcFiles);
            }

            return null;
        }
コード例 #10
0
        protected virtual BaseFileTask InitTask(FileTaskType type, List <string> srcFiles, string srcPath)
        {
            switch (type)
            {
            case FileTaskType.Copy:
                return(new CopyFilesTask(srcFiles, srcPath));

            case FileTaskType.Move:
                return(new MoveFilesTask(srcFiles, srcPath));

            case FileTaskType.Delete:
                return(new DeleteFilesTask(srcFiles));
            }

            return(null);
        }
コード例 #11
0
        protected override BaseFileTask InitTask(FileTaskType type, List<string> srcFiles, string srcPath)
        {
            switch (type)
            {
                case FileTaskType.Copy:
                    return new FECopyFilesTask(srcFiles, srcPath);

                case FileTaskType.Move:
                    return new FEMoveFilesTask(srcFiles, srcPath);

                case FileTaskType.Delete:
                    return new FEDeleteFilesTask(srcFiles);
            }

            return null;
        }
コード例 #12
0
 public virtual List <string> GetChildFiles(string path, FileTaskType taskType)
 {
     return(null);
 }
コード例 #13
0
 public virtual List<string> GetChildFiles(FileInfo fi, FileTaskType taskType)
 {
     return null;
 }
コード例 #14
0
 public FEFileTaskForm(FileTaskType type, List<string> srcFiles, string srcPath)
     : base(type, srcFiles, srcPath)
 {
 }
コード例 #15
0
 public virtual string GetParentFile(FileInfo fi, FileTaskType taskType)
 {
     return null;
 }
コード例 #16
0
ファイル: AddonPanel.cs プロジェクト: rraguso/protone-suite
        List<string> OnQueryLinkedFiles(string path, FileTaskType taskType)
        {
            FEFileTaskSupport support = new FEFileTaskSupport(null);

            FileInfo fi = new FileInfo(path);
            if (fi != null && fi.Exists)
            {
                return support.GetChildFiles(fi, taskType);
            }

            return null;
        }
コード例 #17
0
 public virtual string GetParentFile(string path, FileTaskType taskType)
 {
     return(null);
 }
コード例 #18
0
 public FEFileTaskForm(FileTaskType type, List <string> srcFiles, string srcPath)
     : base(type, srcFiles, srcPath)
 {
 }
コード例 #19
0
ファイル: BaseFileTask.cs プロジェクト: rraguso/protone-suite
        public BaseFileTask(FileTaskType type, List<string> srcFiles, string srcFolder)
        {
            this.TaskType = type;
            this.ErrorMap = new Dictionary<string, string>();

            this.SrcFiles = srcFiles;
            this.SrcFolder = srcFolder;

            _timer = new System.Timers.Timer(500);
            _timer.AutoReset = true;
            _timer.Elapsed += new System.Timers.ElapsedEventHandler(_timer_Elapsed);

            _support = InitSupport();
            this.IsFinished = false;
        }