TVSorter.Model.FileResult.GetFullPath C# (CSharp) 메소드

GetFullPath() 개인적인 메소드

Gets the full path of the file for the specified destination.
private GetFullPath ( IDirectoryInfo destination, IStorageProvider provider ) : IFileInfo
destination IDirectoryInfo /// The destination directory. ///
provider IStorageProvider /// The storage provider. ///
리턴 IFileInfo
        internal IFileInfo GetFullPath(IDirectoryInfo destination, IStorageProvider provider)
        {
            if (this.Incomplete)
            {
                throw new InvalidOperationException("There is not enough data to get the file path.");
            }

            return destination.GetFile(this.FormatOutputPath(this.GetOuptutFormat(provider)));
        }

Usage Example

예제 #1
0
        /// <summary>
        /// Processes a single file.
        /// </summary>
        /// <param name="type">
        /// The sort type to use.
        /// </param>
        /// <param name="file">
        /// The file to process.
        /// </param>
        /// <param name="destination">
        /// The destination to process the files to.
        /// </param>
        private void ProcessFile(SortType type, FileResult file, IDirectoryInfo destination)
        {
            IFileInfo destinationInfo = file.GetFullPath(destination, this.storageProvider);
            if (destinationInfo.Directory != null && !destinationInfo.Directory.Exists)
            {
                destinationInfo.Directory.Create();
            }
            else
            {
                if (!this.HandleRenameAndOverwrite(file, destination, ref destinationInfo))
                {
                    return;
                }
            }

            if (destinationInfo.Exists)
            {
                Logger.OnLogMessage(this, "Skipping {0}. Already exists.", LogType.Info, destinationInfo.Name.Truncate());
                return;
            }

            switch (type)
            {
                case SortType.Move:
                    file.InputFile.MoveTo(destinationInfo.FullName);
                    Logger.OnLogMessage(this, "Moved {0}", LogType.Info, file.InputFile.Name.Truncate());
                    if (this.settings.DeleteEmptySubdirectories)
                    {
                        this.DeleteEmptySubdirectories(file);
                    }

                    break;
                case SortType.Copy:
                    file.InputFile.CopyTo(destinationInfo.FullName);
                    Logger.OnLogMessage(this, "Copied {0}", LogType.Info, file.InputFile.Name.Truncate());
                    break;
            }

            foreach (var episode in file.Episodes)
            {
                episode.FileCount++;
                episode.Save(this.storageProvider);
            }
        }
All Usage Examples Of TVSorter.Model.FileResult::GetFullPath