Beispiel #1
0
        public bool DeleteFile(string fileName, string path)
        {
            if (String.IsNullOrEmpty(fileName))
            {
                throw new ArgumentNullException(nameof(fileName));
            }

            if (String.IsNullOrEmpty(path))
            {
                throw new ArgumentNullException(nameof(path));
            }

            if (!path.EndsWith("\\"))
            {
                path = path + "\\";
            }


            var fullPath = path + fileName;

            if (_fileSystem.FileExists(fullPath))
            {
                try
                {
                    _fileSystem.DeleteFile(fullPath);
                }
                catch (Exception)
                {
                    return(false);
                }

                return(true);
            }

            return(false);
        }
Beispiel #2
0
 public void DeleteFile(string path)
 {
     _fileSystem.DeleteFile(path);
 }