Filesystem bugfixes
This commit is contained in:
parent
2db018c54b
commit
bb55c69108
@ -2,7 +2,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<!--package info-->
|
<!--package info-->
|
||||||
<PackageId>DTLib.Dtsod</PackageId>
|
<PackageId>DTLib.Dtsod</PackageId>
|
||||||
<Version>1.2.0</Version>
|
<Version>1.2.1</Version>
|
||||||
<Authors>Timerix</Authors>
|
<Authors>Timerix</Authors>
|
||||||
<Description>Definitely not json</Description>
|
<Description>Definitely not json</Description>
|
||||||
<RepositoryType>GIT</RepositoryType>
|
<RepositoryType>GIT</RepositoryType>
|
||||||
@ -33,7 +33,7 @@
|
|||||||
<ProjectReference Include="..\DTLib\DTLib.csproj" />
|
<ProjectReference Include="..\DTLib\DTLib.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Condition=" '$(Configuration)' != 'Debug' ">
|
<ItemGroup Condition=" '$(Configuration)' != 'Debug' ">
|
||||||
<PackageReference Include="DTLib" Version="1.2.0" />
|
<PackageReference Include="DTLib" Version="1.2.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<!--project files-->
|
<!--project files-->
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<!--package info-->
|
<!--package info-->
|
||||||
<PackageId>DTLib.Logging</PackageId>
|
<PackageId>DTLib.Logging</PackageId>
|
||||||
<Version>1.2.0</Version>
|
<Version>1.2.1</Version>
|
||||||
<Authors>Timerix</Authors>
|
<Authors>Timerix</Authors>
|
||||||
<Description>Loggers with dependency injection</Description>
|
<Description>Loggers with dependency injection</Description>
|
||||||
<RepositoryType>GIT</RepositoryType>
|
<RepositoryType>GIT</RepositoryType>
|
||||||
@ -30,7 +30,7 @@
|
|||||||
<ProjectReference Include="..\DTLib.Ben.Demystifier\DTLib.Ben.Demystifier.csproj" />
|
<ProjectReference Include="..\DTLib.Ben.Demystifier\DTLib.Ben.Demystifier.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Condition=" '$(Configuration)' != 'Debug' ">
|
<ItemGroup Condition=" '$(Configuration)' != 'Debug' ">
|
||||||
<PackageReference Include="DTLib" Version="1.2.0" />
|
<PackageReference Include="DTLib" Version="1.2.2" />
|
||||||
<PackageReference Include="DTLib.Ben.Demystifier" Version="1.0.4" />
|
<PackageReference Include="DTLib.Ben.Demystifier" Version="1.0.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<!--package info-->
|
<!--package info-->
|
||||||
<PackageId>DTLib.Network</PackageId>
|
<PackageId>DTLib.Network</PackageId>
|
||||||
<Version>1.2.0</Version>
|
<Version>1.2.1</Version>
|
||||||
<Authors>Timerix</Authors>
|
<Authors>Timerix</Authors>
|
||||||
<Description>Some sick network protocols</Description>
|
<Description>Some sick network protocols</Description>
|
||||||
<RepositoryType>GIT</RepositoryType>
|
<RepositoryType>GIT</RepositoryType>
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
<ProjectReference Include="..\DTLib\DTLib.csproj" />
|
<ProjectReference Include="..\DTLib\DTLib.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Condition=" '$(Configuration)' != 'Debug' ">
|
<ItemGroup Condition=" '$(Configuration)' != 'Debug' ">
|
||||||
<PackageReference Include="DTLib" Version="1.2.0" />
|
<PackageReference Include="DTLib" Version="1.2.2" />
|
||||||
<PackageReference Include="DTLib.Dtsod" Version="1.1.5" />
|
<PackageReference Include="DTLib.Dtsod" Version="1.1.5" />
|
||||||
<PackageReference Include="DTLib.Network" Version="1.1.5" />
|
<PackageReference Include="DTLib.Network" Version="1.1.5" />
|
||||||
<PackageReference Include="DTLib.Logging" Version="1.1.5" />
|
<PackageReference Include="DTLib.Logging" Version="1.1.5" />
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<!--package info-->
|
<!--package info-->
|
||||||
<PackageId>DTLib</PackageId>
|
<PackageId>DTLib</PackageId>
|
||||||
<Version>1.2.1</Version>
|
<Version>1.2.2</Version>
|
||||||
<Authors>Timerix</Authors>
|
<Authors>Timerix</Authors>
|
||||||
<Description>Library for all my C# projects</Description>
|
<Description>Library for all my C# projects</Description>
|
||||||
<RepositoryType>GIT</RepositoryType>
|
<RepositoryType>GIT</RepositoryType>
|
||||||
|
|||||||
@ -54,6 +54,7 @@ public static class Directory
|
|||||||
Delete(target_path);
|
Delete(target_path);
|
||||||
else throw new Exception($"directory {target_path} already exists");
|
else throw new Exception($"directory {target_path} already exists");
|
||||||
}
|
}
|
||||||
|
else Directory.Create(target_path.ParentDir());
|
||||||
System.IO.Directory.Move(current_path.Str, target_path.Str);
|
System.IO.Directory.Move(current_path.Str, target_path.Str);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,16 +63,16 @@ public static class Directory
|
|||||||
System.IO.Directory.Delete(dir.Str, true);
|
System.IO.Directory.Delete(dir.Str, true);
|
||||||
|
|
||||||
public static IOPath[] GetFiles(IOPath dir) =>
|
public static IOPath[] GetFiles(IOPath dir) =>
|
||||||
IOPath.ArrayCast(System.IO.Directory.GetFiles(dir.Str));
|
IOPath.ArrayCast(System.IO.Directory.GetFiles(dir.Str), true);
|
||||||
|
|
||||||
public static IOPath[] GetFiles(IOPath dir, string searchPattern) =>
|
public static IOPath[] GetFiles(IOPath dir, string searchPattern) =>
|
||||||
IOPath.ArrayCast(System.IO.Directory.GetFiles(dir.Str, searchPattern));
|
IOPath.ArrayCast(System.IO.Directory.GetFiles(dir.Str, searchPattern), true);
|
||||||
|
|
||||||
public static IOPath[] GetDirectories(IOPath dir) =>
|
public static IOPath[] GetDirectories(IOPath dir) =>
|
||||||
IOPath.ArrayCast(System.IO.Directory.GetDirectories(dir.Str));
|
IOPath.ArrayCast(System.IO.Directory.GetDirectories(dir.Str), true);
|
||||||
|
|
||||||
public static IOPath[] GetDirectories(IOPath dir, string searchPattern) =>
|
public static IOPath[] GetDirectories(IOPath dir, string searchPattern) =>
|
||||||
IOPath.ArrayCast(System.IO.Directory.GetDirectories(dir.Str, searchPattern));
|
IOPath.ArrayCast(System.IO.Directory.GetDirectories(dir.Str, searchPattern), true);
|
||||||
|
|
||||||
/// выдает список всех файлов
|
/// выдает список всех файлов
|
||||||
public static List<IOPath> GetAllFiles(IOPath dir)
|
public static List<IOPath> GetAllFiles(IOPath dir)
|
||||||
|
|||||||
@ -45,6 +45,7 @@ public static class File
|
|||||||
Delete(target_path);
|
Delete(target_path);
|
||||||
else throw new Exception($"file {target_path} already exists");
|
else throw new Exception($"file {target_path} already exists");
|
||||||
}
|
}
|
||||||
|
else Directory.Create(target_path.ParentDir());
|
||||||
System.IO.File.Move(current_path.Str, target_path.Str);
|
System.IO.File.Move(current_path.Str, target_path.Str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -40,18 +40,18 @@ public readonly struct IOPath
|
|||||||
return new string(fixed_path);
|
return new string(fixed_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IOPath[] ArrayCast(string[] a)
|
public static IOPath[] ArrayCast(string[] a, bool correct_separators=false)
|
||||||
{
|
{
|
||||||
IOPath[] b = new IOPath[a.Length];
|
IOPath[] b = new IOPath[a.Length];
|
||||||
for (int i = 0; i < a.Length; i++)
|
for (int i = 0; i < a.Length; i++)
|
||||||
b[i] = (IOPath)a[i];
|
b[i] = new IOPath(a[i], correct_separators);
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
public static IOPath[] ListCast(IList<string> a)
|
public static IOPath[] ListCast(IList<string> a, bool correct_separators=false)
|
||||||
{
|
{
|
||||||
IOPath[] b = new IOPath[a.Count];
|
IOPath[] b = new IOPath[a.Count];
|
||||||
for (int i = 0; i < a.Count; i++)
|
for (int i = 0; i < a.Count; i++)
|
||||||
b[i] = (IOPath)a[i];
|
b[i] = new IOPath(a[i], correct_separators);
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +62,12 @@ public readonly struct IOPath
|
|||||||
public static implicit operator IOPath(string s) => new(s);
|
public static implicit operator IOPath(string s) => new(s);
|
||||||
public static explicit operator string(IOPath p) => p.Str;
|
public static explicit operator string(IOPath p) => p.Str;
|
||||||
public override string ToString() => Str;
|
public override string ToString() => Str;
|
||||||
public override bool Equals(object obj) => Str.Equals(obj);
|
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
if (obj is null) return false;
|
||||||
|
return Str == obj.ToString();
|
||||||
|
}
|
||||||
public override int GetHashCode() => Str.GetHashCode();
|
public override int GetHashCode() => Str.GetHashCode();
|
||||||
|
|
||||||
public char this[int i] => Str[i];
|
public char this[int i] => Str[i];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user