Example #1
0
        public EpisodeFile(AppModel owner, string filePath, HashSet<string> copySet = null, HashSet<string> moveSet = null)
        {
            this.Model = owner;
            this.Actions = new DispatchedCollection<EpisodeFileAction>();
            this.Errors = new DispatchedCollection<string>();
            

            if (copySet != null)
            {
                if (copySet.Count > 0)
                {
                    foreach (var fa in
                        copySet.Select(
                            s =>
                            new EpisodeFileAction(this)
                                {
                                    Arguments = s,
                                    Command = EpisodeFileActionCommand.Copy,
                                    IsEnabled = true
                                }))
                    {
                        this.Actions.Add(fa);
                    }
                }
                else
                {
                    this.Actions.Add(new EpisodeFileAction(this)
                    {
                        Command = EpisodeFileActionCommand.Copy,
                        IsEnabled = true
                    });
                }
            }

            if (moveSet != null)
            {
                if (moveSet.Count > 0)
                {
                    foreach (var fa in
                        moveSet.Select(
                            s =>
                            new EpisodeFileAction(this)
                            {
                                Arguments = s,
                                Command = EpisodeFileActionCommand.Move,
                                IsEnabled = true
                            }))
                    {
                        this.Actions.Add(fa);
                    }
                }
                else
                {
                    this.Actions.Add(new EpisodeFileAction(this)
                    {
                        Command = EpisodeFileActionCommand.Move,
                        IsEnabled = true
                    });
                }
            }

            if (Actions.All(f => f.Command != EpisodeFileActionCommand.Copy))
            {
                Actions.Add(new EpisodeFileAction(this) { Command = EpisodeFileActionCommand.Copy });
            }

            if (Actions.All(f => f.Command != EpisodeFileActionCommand.Move))
            {
                Actions.Add(new EpisodeFileAction(this) { Command = EpisodeFileActionCommand.Move });
            }

            this.inProcessing = true;
            this.FilePath = filePath;
            this.FileName = Path.GetFileName(this.FilePath);
            this.Status = "";
            
            this.ShowSelector = new ShowSelector(this);
            this.ShowSelector.DoProcessFile();
        }
Example #2
0
        public EpisodeFile(AppModel owner, string filePath, HashSet <string> copySet = null, HashSet <string> moveSet = null)
        {
            this.Model   = owner;
            this.Actions = new DispatchedCollection <EpisodeFileAction>();
            this.Errors  = new DispatchedCollection <string>();


            if (copySet != null)
            {
                if (copySet.Count > 0)
                {
                    foreach (var fa in
                             copySet.Select(
                                 s =>
                                 new EpisodeFileAction(this)
                    {
                        Arguments = s,
                        Command = EpisodeFileActionCommand.Copy,
                        IsEnabled = true
                    }))
                    {
                        this.Actions.Add(fa);
                    }
                }
                else
                {
                    this.Actions.Add(new EpisodeFileAction(this)
                    {
                        Command   = EpisodeFileActionCommand.Copy,
                        IsEnabled = true
                    });
                }
            }

            if (moveSet != null)
            {
                if (moveSet.Count > 0)
                {
                    foreach (var fa in
                             moveSet.Select(
                                 s =>
                                 new EpisodeFileAction(this)
                    {
                        Arguments = s,
                        Command = EpisodeFileActionCommand.Move,
                        IsEnabled = true
                    }))
                    {
                        this.Actions.Add(fa);
                    }
                }
                else
                {
                    this.Actions.Add(new EpisodeFileAction(this)
                    {
                        Command   = EpisodeFileActionCommand.Move,
                        IsEnabled = true
                    });
                }
            }

            if (Actions.All(f => f.Command != EpisodeFileActionCommand.Copy))
            {
                Actions.Add(new EpisodeFileAction(this)
                {
                    Command = EpisodeFileActionCommand.Copy
                });
            }

            if (Actions.All(f => f.Command != EpisodeFileActionCommand.Move))
            {
                Actions.Add(new EpisodeFileAction(this)
                {
                    Command = EpisodeFileActionCommand.Move
                });
            }

            this.inProcessing = true;
            this.FilePath     = filePath;
            this.FileName     = Path.GetFileName(this.FilePath);
            this.Status       = "";

            this.ShowSelector = new ShowSelector(this);
            this.ShowSelector.DoProcessFile();
        }