mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 15:42:48 -05:00
Turn on file scoped namespaces (#2225)
This commit is contained in:
@ -1,39 +1,38 @@
|
||||
namespace Bit.Core.Test
|
||||
namespace Bit.Core.Test;
|
||||
|
||||
public class TempDirectory : IDisposable
|
||||
{
|
||||
public class TempDirectory : IDisposable
|
||||
public string Directory { get; private set; }
|
||||
|
||||
public TempDirectory()
|
||||
{
|
||||
public string Directory { get; private set; }
|
||||
|
||||
public TempDirectory()
|
||||
{
|
||||
Directory = Path.Combine(Path.GetTempPath(), $"bitwarden_{Guid.NewGuid().ToString().Replace("-", "")}");
|
||||
}
|
||||
|
||||
public override string ToString() => Directory;
|
||||
|
||||
#region IDisposable implementation
|
||||
~TempDirectory()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
public void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
try
|
||||
{
|
||||
System.IO.Directory.Delete(Directory, true);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
# endregion
|
||||
Directory = Path.Combine(Path.GetTempPath(), $"bitwarden_{Guid.NewGuid().ToString().Replace("-", "")}");
|
||||
}
|
||||
|
||||
public override string ToString() => Directory;
|
||||
|
||||
#region IDisposable implementation
|
||||
~TempDirectory()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
public void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
try
|
||||
{
|
||||
System.IO.Directory.Delete(Directory, true);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
# endregion
|
||||
}
|
||||
|
Reference in New Issue
Block a user