Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: remove obsolete factory methods #1104

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions System.IO.Abstractions.sln
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_", "_", "{BBF7AD8D-5522-48
Directory.Build.props = Directory.Build.props
global.json = global.json
README.md = README.md
version.json = version.json
EndProjectSection
EndProject
Global
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ public MockDirectoryInfoFactory(IMockFileDataAccessor mockFileSystem)
public IFileSystem FileSystem
=> mockFileSystem;


/// <inheritdoc />
[Obsolete("Use `IDirectoryInfoFactory.New(string)` instead")]
public IDirectoryInfo FromDirectoryName(string directoryName)
{
return New(directoryName);
}

/// <inheritdoc />
public IDirectoryInfo New(string path)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,6 @@ public IDriveInfo Wrap(DriveInfo driveInfo)
return New(driveInfo.Name);
}

/// <inheritdoc />
[Obsolete("Use `IDirectoryInfoFactory.New(string)` instead")]
public IDriveInfo FromDriveName(string driveName)
{
return New(driveName);
}

private string NormalizeDriveName(string driveName)
{
if (driveName.Length == 3 && mockFileSystem.StringOperations.EndsWith(driveName, @":\"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@ public MockFileInfoFactory(IMockFileDataAccessor mockFileSystem)
public IFileSystem FileSystem
=> mockFileSystem;

/// <inheritdoc />
[Obsolete("Use `IFileInfoFactory.New(string)` instead")]
public IFileInfo FromFileName(string fileName)
{
return New(fileName);
}

/// <inheritdoc />
public IFileInfo New(string fileName)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,71 +19,6 @@ public MockFileStreamFactory(IMockFileDataAccessor mockFileSystem)
public IFileSystem FileSystem
=> mockFileSystem;

/// <inheritdoc />
[Obsolete("Use `IFileStreamFactory.New(string, FileMode)` instead.")]
public Stream Create(string path, FileMode mode)
=> New(path, mode);

/// <inheritdoc />
[Obsolete("Use `IFileStreamFactory.New(string, FileMode, FileAccess)` instead.")]
public Stream Create(string path, FileMode mode, FileAccess access)
=> New(path, mode, access);

/// <inheritdoc />
[Obsolete("Use `IFileStreamFactory.New(string, FileMode, FileAccess, FileShare)` instead.")]
public Stream Create(string path, FileMode mode, FileAccess access, FileShare share)
=> New(path, mode, access, share);

/// <inheritdoc />
[Obsolete("Use `IFileStreamFactory.New(string, FileMode, FileAccess, FileShare, int)` instead.")]
public Stream Create(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize)
=> New(path, mode, access, share, bufferSize);

/// <inheritdoc />
[Obsolete("Use `IFileStreamFactory.New(string, FileMode, FileAccess, FileShare, int, FileOptions)` instead.")]
public Stream Create(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options)
=> New(path, mode, access, share, bufferSize, options);

/// <inheritdoc />
[Obsolete("Use `IFileStreamFactory.New(string, FileMode, FileAccess, FileShare, int, bool)` instead.")]
public Stream Create(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, bool useAsync)
=> New(path, mode, access, share, bufferSize, useAsync);

/// <inheritdoc />
[Obsolete("This method has been deprecated. Please use new Create(SafeFileHandle handle, FileAccess access) instead. http://go.microsoft.com/fwlink/?linkid=14202")]
public Stream Create(IntPtr handle, FileAccess access)
=> new MockFileStream(mockFileSystem, handle.ToString(), FileMode.Open, access: access);

/// <inheritdoc />
[Obsolete("This method has been deprecated. Please use new Create(SafeFileHandle handle, FileAccess access) instead, and optionally make a new SafeFileHandle with ownsHandle=false if needed. http://go.microsoft.com/fwlink/?linkid=14202")]
public Stream Create(IntPtr handle, FileAccess access, bool ownsHandle)
=> new MockFileStream(mockFileSystem, handle.ToString(), FileMode.Open, access: access);

/// <inheritdoc />
[Obsolete("This method has been deprecated. Please use new Create(SafeFileHandle handle, FileAccess access, int bufferSize) instead, and optionally make a new SafeFileHandle with ownsHandle=false if needed. http://go.microsoft.com/fwlink/?linkid=14202")]
public Stream Create(IntPtr handle, FileAccess access, bool ownsHandle, int bufferSize)
=> new MockFileStream(mockFileSystem, handle.ToString(), FileMode.Open, access: access);

/// <inheritdoc />
[Obsolete("This method has been deprecated. Please use new Create(SafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync) instead, and optionally make a new SafeFileHandle with ownsHandle=false if needed. http://go.microsoft.com/fwlink/?linkid=14202")]
public Stream Create(IntPtr handle, FileAccess access, bool ownsHandle, int bufferSize, bool isAsync)
=> new MockFileStream(mockFileSystem, handle.ToString(), FileMode.Open, access: access);

/// <inheritdoc />
[Obsolete("Use `IFileStreamFactory.New(SafeFileHandle, FileAccess)` instead.")]
public Stream Create(SafeFileHandle handle, FileAccess access)
=> New(handle, access);

/// <inheritdoc />
[Obsolete("Use `IFileStreamFactory.New(SafeFileHandle, FileAccess, int)` instead.")]
public Stream Create(SafeFileHandle handle, FileAccess access, int bufferSize)
=> New(handle, access, bufferSize);

/// <inheritdoc />
[Obsolete("Use `IFileStreamFactory.New(SafeFileHandle, FileAccess, int, bool)` instead.")]
public Stream Create(SafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync)
=> New(handle, access, bufferSize, isAsync);

/// <inheritdoc />
public FileSystemStream New(SafeFileHandle handle, FileAccess access)
=> new MockFileStream(mockFileSystem, handle.ToString(), FileMode.Open, access: access);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,6 @@ public MockFileSystemWatcherFactory(MockFileSystem mockFileSystem)
/// <inheritdoc />
public IFileSystem FileSystem { get; }

/// <inheritdoc />
[Obsolete("Use `IFileSystemWatcherFactory.New()` instead")]
public IFileSystemWatcher CreateNew()
=> New();

/// <inheritdoc />
[Obsolete("Use `IFileSystemWatcherFactory.New(string)` instead")]
public IFileSystemWatcher CreateNew(string path)
=> New(path);

/// <inheritdoc />
[Obsolete("Use `IFileSystemWatcherFactory.New(string, string)` instead")]
public IFileSystemWatcher CreateNew(string path, string filter)
=> New(path, filter);

/// <inheritdoc />
public IFileSystemWatcher New()
=> throw new NotImplementedException(StringResources.Manager.GetString("FILE_SYSTEM_WATCHER_NOT_IMPLEMENTED_EXCEPTION"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@ public DirectoryInfoFactory(IFileSystem fileSystem)
public IFileSystem FileSystem
=> fileSystem;

/// <inheritdoc />
[Obsolete("Use `IDirectoryInfoFactory.New(string)` instead")]
public IDirectoryInfo FromDirectoryName(string directoryName)
{
return New(directoryName);
}

/// <inheritdoc />
public IDirectoryInfo New(string path)
{
Expand Down
10 changes: 0 additions & 10 deletions src/TestableIO.System.IO.Abstractions.Wrappers/DriveInfoFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,5 @@ public IDriveInfo Wrap(DriveInfo driveInfo)

return new DriveInfoWrapper(fileSystem, driveInfo);
}

/// <summary>
/// Initializes a new instance of the <see cref="DriveInfoBase"/> class, which acts as a wrapper for a logical drive.
/// </summary>
/// <param name="driveName">A valid drive path or drive letter.</param>
[Obsolete("Use `IDriveInfoFactory.New(string)` instead")]
public IDriveInfo FromDriveName(string driveName)
{
return New(driveName);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ public FileInfoFactory(IFileSystem fileSystem)
public IFileSystem FileSystem
=> fileSystem;

/// <inheritdoc />
[Obsolete("Use `IFileInfoFactory.New(string)` instead")]
public IFileInfo FromFileName(string fileName)
{
return New(fileName);
}

/// <inheritdoc />
public IFileInfo New(string fileName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,66 +15,6 @@ public FileStreamFactory(IFileSystem fileSystem)
/// <inheritdoc />
public IFileSystem FileSystem { get; }

[Obsolete("Use `IFileStreamFactory.New(string, FileMode)` instead.")]
public Stream Create(string path, FileMode mode)
=> New(path, mode);

/// <inheritdoc />
[Obsolete("Use `IFileStreamFactory.New(string, FileMode, FileAccess)` instead.")]
public Stream Create(string path, FileMode mode, FileAccess access)
=> New(path, mode, access);

/// <inheritdoc />
[Obsolete("Use `IFileStreamFactory.New(string, FileMode, FileAccess, FileShare)` instead.")]
public Stream Create(string path, FileMode mode, FileAccess access, FileShare share)
=> New(path, mode, access, share);

/// <inheritdoc />
[Obsolete("Use `IFileStreamFactory.New(string, FileMode, FileAccess, FileShare, int)` instead.")]
public Stream Create(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize)
=> New(path, mode, access, share, bufferSize);

/// <inheritdoc />
[Obsolete("Use `IFileStreamFactory.New(string, FileMode, FileAccess, FileShare, int, FileOptions)` instead.")]
public Stream Create(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options)
=> New(path, mode, access, share, bufferSize, options);

/// <inheritdoc />
[Obsolete("Use `IFileStreamFactory.New(string, FileMode, FileAccess, FileShare, int, bool)` instead.")]
public Stream Create(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, bool useAsync)
=> New(path, mode, access, share, bufferSize, useAsync);

/// <inheritdoc />
[Obsolete("Use `IFileStreamFactory.New(SafeFileHandle, FileAccess)` instead.")]
public Stream Create(SafeFileHandle handle, FileAccess access)
=> New(handle, access);

/// <inheritdoc />
[Obsolete("Use `IFileStreamFactory.New(SafeFileHandle, FileAccess, int)` instead.")]
public Stream Create(SafeFileHandle handle, FileAccess access, int bufferSize)
=> New(handle, access, bufferSize);

/// <inheritdoc />
[Obsolete("Use `IFileStreamFactory.New(SafeFileHandle, FileAccess, int, bool)` instead.")]
public Stream Create(SafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync)
=> New(handle, access, bufferSize, isAsync);

[Obsolete("This method has been deprecated. Please use new Create(SafeFileHandle handle, FileAccess access) instead. http://go.microsoft.com/fwlink/?linkid=14202")]
public Stream Create(IntPtr handle, FileAccess access)
=> new FileStream(handle, access);

[Obsolete("This method has been deprecated. Please use new Create(SafeFileHandle handle, FileAccess access) instead, and optionally make a new SafeFileHandle with ownsHandle=false if needed. http://go.microsoft.com/fwlink/?linkid=14202")]
public Stream Create(IntPtr handle, FileAccess access, bool ownsHandle)
=> new FileStream(handle, access, ownsHandle);

[Obsolete("This method has been deprecated. Please use new Create(SafeFileHandle handle, FileAccess access, int bufferSize) instead, and optionally make a new SafeFileHandle with ownsHandle=false if needed. http://go.microsoft.com/fwlink/?linkid=14202")]
public Stream Create(IntPtr handle, FileAccess access, bool ownsHandle, int bufferSize)
=> new FileStream(handle, access, ownsHandle, bufferSize);

[Obsolete("This method has been deprecated. Please use new Create(SafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync) instead, and optionally make a new SafeFileHandle with ownsHandle=false if needed. http://go.microsoft.com/fwlink/?linkid=14202")]
public Stream Create(IntPtr handle, FileAccess access, bool ownsHandle, int bufferSize, bool isAsync)
=> new FileStream(handle, access, ownsHandle, bufferSize, isAsync);

/// <inheritdoc />
public FileSystemStream New(SafeFileHandle handle, FileAccess access)
=> new FileStreamWrapper(new FileStream(handle, access));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,6 @@ public FileSystemWatcherFactory(IFileSystem fileSystem)
/// <inheritdoc />
public IFileSystem FileSystem { get; }

/// <inheritdoc />
[Obsolete("Use `IFileSystemWatcherFactory.New()` instead")]
public IFileSystemWatcher CreateNew()
=> New();

/// <inheritdoc />
[Obsolete("Use `IFileSystemWatcherFactory.New(string)` instead")]
public IFileSystemWatcher CreateNew(string path)
=> New(path);

/// <inheritdoc />
[Obsolete("Use `IFileSystemWatcherFactory.New(string, string)` instead")]
public IFileSystemWatcher CreateNew(string path, string filter)
=> New(path, filter);

/// <inheritdoc />
public IFileSystemWatcher New()
=> new FileSystemWatcherWrapper(FileSystem);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@ namespace System.IO.Abstractions
/// </summary>
public interface IDirectoryInfoFactory : IFileSystemEntity
{
/// <summary>
/// Initializes a new instance of a wrapper for <see cref="DirectoryInfo"/> which implements <see cref="IDirectoryInfo"/>.
/// </summary>
/// <param name="directoryName">The fully qualified name of the new directory, or the relative directory name.</param>
[Obsolete("Use `IDirectoryInfoFactory.New(string)` instead")]
IDirectoryInfo FromDirectoryName(string directoryName);

/// <summary>
/// Initializes a new instance of a wrapper for <see cref="DirectoryInfo"/> which implements <see cref="IDirectoryInfo"/>.
/// </summary>
Expand Down
7 changes: 0 additions & 7 deletions src/TestableIO.System.IO.Abstractions/IDriveInfoFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@ namespace System.IO.Abstractions
/// </summary>
public interface IDriveInfoFactory : IFileSystemEntity
{
/// <summary>
/// Initializes a new instance of a wrapper for <see cref="DriveInfo"/> which implements <see cref="IDriveInfo"/>.
/// </summary>
/// <param name="driveName">A valid drive path or drive letter.</param>
[Obsolete("Use `IDriveInfoFactory.New(string)` instead")]
IDriveInfo FromDriveName(string driveName);

/// <summary>
/// Retrieves the drive names of all logical drives on a computer.
/// </summary>
Expand Down
7 changes: 0 additions & 7 deletions src/TestableIO.System.IO.Abstractions/IFileInfoFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@ namespace System.IO.Abstractions
/// </summary>
public interface IFileInfoFactory : IFileSystemEntity
{
/// <summary>
/// Initializes a new instance of a wrapper for <see cref="FileInfo"/> which implements <see cref="IFileInfo"/>.
/// </summary>
/// <param name="fileName">The fully qualified name of the new file, or the relative file name.</param>
[Obsolete("Use `IFileInfoFactory.New(string)` instead")]
IFileInfo FromFileName(string fileName);

/// <summary>
/// Initializes a new instance of a wrapper for <see cref="FileInfo"/> which implements <see cref="IFileInfo"/>.
/// </summary>
Expand Down
Loading
Loading