week
This commit is contained in:
@ -4,6 +4,7 @@ using Phares.Shared;
|
||||
using Serilog;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using View_by_Distance.Shared.Models;
|
||||
using View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
@ -85,7 +86,7 @@ public partial class UnitTestHardCoded
|
||||
[TestMethod]
|
||||
public void TestMethodDel()
|
||||
{
|
||||
string directory = @"F:\Tmp\Phares\Compare\Images 2022-09-15 - 7390c13 - III - Results\E) Distance\2022-09-15\7680 x 4320\7680x4320 - Hog - Large\()\(637992984751968513)";
|
||||
string directory = "F:/Tmp/Phares/Compare/Images 2022-09-15 - 7390c13 - III - Results/E) Distance/2022-09-15/7680 x 4320/7680x4320 - Hog - Large/()/(637992984751968513)";
|
||||
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
||||
{
|
||||
for (int i = 1; i < 11; i++)
|
||||
@ -98,7 +99,7 @@ public partial class UnitTestHardCoded
|
||||
[TestMethod]
|
||||
public void TestMethodGetApproximateYears()
|
||||
{
|
||||
string personDisplayDirectory = @"D:\1-Images-A\Images-dd514b88-Results\A2) People\dd514b88\{}\^\Sydney Dupray^9";
|
||||
string personDisplayDirectory = "D:/1-Images-A/Images-dd514b88-Results/A2) People/dd514b88/{}/^/Sydney Dupray^9";
|
||||
if (Directory.Exists(Directory.GetDirectoryRoot(personDisplayDirectory)) && Directory.Exists(personDisplayDirectory))
|
||||
{
|
||||
char numberSign = '#';
|
||||
@ -122,7 +123,7 @@ public partial class UnitTestHardCoded
|
||||
[TestMethod]
|
||||
public void TestMethodDel2()
|
||||
{
|
||||
string directory = @"F:\Tmp\Phares\Compare\Images 2022-09-15 - 7390c13 - III - Results\E) Distance\2022-09-15\7680 x 4320\7680x4320 - Hog - Large\()\(637992984751968513)";
|
||||
string directory = "F:/Tmp/Phares/Compare/Images 2022-09-15 - 7390c13 - III - Results/E) Distance/2022-09-15/7680 x 4320/7680x4320 - Hog - Large/()/(637992984751968513)";
|
||||
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
||||
{
|
||||
for (int i = 1; i < 11; i++)
|
||||
@ -201,7 +202,7 @@ public partial class UnitTestHardCoded
|
||||
[TestMethod]
|
||||
public void TestMethodRenameAbandoned()
|
||||
{
|
||||
string directory = @"D:\1-Images-A\Images-dd514b88-Results\A2) People\dd514b88\{}\!\Abandoned";
|
||||
string directory = "D:/1-Images-A/Images-dd514b88-Results/A2) People/dd514b88/{}/!/Abandoned";
|
||||
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
||||
{
|
||||
string checkFile;
|
||||
@ -221,7 +222,7 @@ public partial class UnitTestHardCoded
|
||||
[TestMethod]
|
||||
public void TestMethodRenameDelete()
|
||||
{
|
||||
string directory = @"D:\1-Images-A\Images-dd514b88-Results\A) Property\dd514b88\{}";
|
||||
string directory = "D:/1-Images-A/Images-dd514b88-Results/A) Property/dd514b88/{}";
|
||||
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
||||
{
|
||||
string checkFile;
|
||||
@ -241,7 +242,7 @@ public partial class UnitTestHardCoded
|
||||
[TestMethod]
|
||||
public void TestMethodRenameOld()
|
||||
{
|
||||
string directory = @"D:\2-Images-B\Not-Copy-Copy-dd514b88-Results\E) Distance\dd514b88\()";
|
||||
string directory = "D:/2-Images-B/Not-Copy-Copy-dd514b88-Results/E) Distance/dd514b88/()";
|
||||
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
||||
{
|
||||
string checkFile;
|
||||
@ -756,9 +757,9 @@ public partial class UnitTestHardCoded
|
||||
[TestMethod]
|
||||
public void TestMethodRename()
|
||||
{
|
||||
// string directory = @"D:\2-Images-B\Not-Copy-Copy-dd514b88";
|
||||
string directory = @"D:\1-Images-A\Images-dd514b88";
|
||||
// string directory = @"D:\2-Images-B\Not-Copy-Copy-dd514b88";
|
||||
// string directory = "D:/2-Images-B/Not-Copy-Copy-dd514b88";
|
||||
string directory = "D:/1-Images-A/Images-dd514b88";
|
||||
// string directory = "D:/2-Images-B/Not-Copy-Copy-dd514b88";
|
||||
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
||||
{
|
||||
string[] directories = Directory.GetDirectories(directory, "*;*", SearchOption.AllDirectories);
|
||||
@ -775,7 +776,7 @@ public partial class UnitTestHardCoded
|
||||
[TestMethod]
|
||||
public void TestMethodRenameForUnkown()
|
||||
{
|
||||
string directory = @"D:\1-Images-A\Images-dd514b88-Results\E) Distance\dd514b88\(RectInt-2023-06-19-less-0.99)";
|
||||
string directory = "D:/1-Images-A/Images-dd514b88-Results/E) Distance/dd514b88/(RectInt-2023-06-19-less-0.99)";
|
||||
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
||||
{
|
||||
string[] files = Directory.GetFiles(directory, "*.unk", SearchOption.AllDirectories);
|
||||
@ -785,4 +786,34 @@ public partial class UnitTestHardCoded
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestMethodRenameForTicks()
|
||||
{
|
||||
string directory = "D:/1-Images-A/Images-dd514b88-Results/A2) People/dd514b88/([])/ged";
|
||||
if (Directory.Exists(Path.GetPathRoot(directory)) && Directory.Exists(directory))
|
||||
{
|
||||
string checkName;
|
||||
DateTime dateTime;
|
||||
string weekOfYear;
|
||||
string checkDirectoy;
|
||||
Calendar calendar = new CultureInfo("en-US").Calendar;
|
||||
string[] files = Directory.GetFiles(directory, "*.ged", SearchOption.TopDirectoryOnly);
|
||||
foreach (string file in files)
|
||||
{
|
||||
if (!long.TryParse(Path.GetFileNameWithoutExtension(file), out long ticks))
|
||||
continue;
|
||||
dateTime = new(ticks);
|
||||
weekOfYear = calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
||||
checkDirectoy = Path.Combine(directory, dateTime.Year.ToString(), $"{dateTime.Year}-Week-{weekOfYear}");
|
||||
checkName = Path.Combine(checkDirectoy, Path.GetFileName(file));
|
||||
if (!Directory.Exists(checkDirectoy))
|
||||
_ = Directory.CreateDirectory(checkDirectoy);
|
||||
if (File.Exists(checkName))
|
||||
continue;
|
||||
File.Move(file, checkName);
|
||||
}
|
||||
}
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user