예제 #1
0
        public override FileInfo GetFile(Sheet sheet)
        {
            FileInfo _file = new FileInfo(Path.FullName + "\\" + FileNameResolver.GetFileName(sheet));

            if (_file.Exists)
            {
                return(_file);
            }
            else
            {
                throw new FileNotFoundException("File does not exist in Archive.", Path.FullName + "\\" + FileNameResolver.GetFileName(sheet));
            }
        }
예제 #2
0
        public override void PushFile(FileInfo file, Sheet sheet, FileImportMode mode = FileImportMode.Copy, bool _override = false)
        {
            //Check if destination file already exists
            //if (File.Exists(Path.FullName + "\\" + FileNameResolver.GetFileName(sheet)) && _override == false)
            //{
            //    throw new System.IO.IOException("File already exists");
            //}

            switch (mode)
            {
            case FileImportMode.Copy:
                //if (!Directory.Exists(Path.FullName + "\\" + sheet.Piece.PieceID)) Directory.CreateDirectory(Path.FullName + "\\" + sheet.Piece.PieceID);
                file.CopyTo(Path.FullName + "\\" + FileNameResolver.GetFileName(sheet), _override);
                break;

            case FileImportMode.Move:
                file.MoveTo(Path.FullName + "\\" + FileNameResolver.GetFileName(sheet), _override);
                break;

            default:
                break;
            }
        }