26 lines
654 B
C#
26 lines
654 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace BeWoLauncher.Extensions
|
|
{
|
|
public static class FileExtension
|
|
{
|
|
public static void ClearFolder(this string path) => ClearFolder(new DirectoryInfo(path));
|
|
public static void ClearFolder(this DirectoryInfo di)
|
|
{
|
|
foreach (FileInfo file in di.EnumerateFiles())
|
|
{
|
|
file.Delete();
|
|
}
|
|
foreach (DirectoryInfo dir in di.EnumerateDirectories())
|
|
{
|
|
dir.Delete(true);
|
|
}
|
|
}
|
|
}
|
|
}
|