Skip to content

Commit

Permalink
Merge pull request #18 from FizzcodeSoftware/dev
Browse files Browse the repository at this point in the history
small fixes
  • Loading branch information
wickedmachinator authored Jan 19, 2024
2 parents c15f44d + f84102f commit b67a6bd
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 95 deletions.
7 changes: 2 additions & 5 deletions EtLast.LocalFiles/LocalJsonFileManifestProcessor.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System.Text;
using System.Text.Json;

namespace FizzCode.EtLast;
namespace FizzCode.EtLast;

public class LocalJsonFileManifestProcessor : IManifestProcessor
{
Expand All @@ -13,7 +10,7 @@ public class LocalJsonFileManifestProcessor : IManifestProcessor
WriteIndented = true,
};

private Stopwatch _lastSave = null;
private Stopwatch _lastSave;

public void RegisterToManifestEvents(ContextManifest manifest)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
namespace FizzCode.EtLast;

public sealed class CreateDirectoryJob : AbstractJob
{
[ProcessParameterMustHaveValue]
public required string Path { get; init; }

public override string GetTopic() => Path;

protected override void ExecuteImpl(Stopwatch netTimeStopwatch)
{
try
{
if (!Directory.Exists(Path))
Directory.CreateDirectory(Path);
}
catch (Exception ex)
{
var exception = new CreateDirectoryException(this, ex);
exception.Data["Path"] = Path;
throw exception;
}
}
}

[EditorBrowsable(EditorBrowsableState.Never)]
public static class CreateDirectoryJobFluent
{
public static IFlow CreateDirectory(this IFlow builder, string path)
{
return builder.ExecuteProcess(() => new CreateDirectoryJob()
{
Path = path,
});
}
namespace FizzCode.EtLast;

public sealed class CreateLocalDirectoryJob : AbstractJob
{
[ProcessParameterMustHaveValue]
public required string Path { get; init; }

public override string GetTopic() => Path;

protected override void ExecuteImpl(Stopwatch netTimeStopwatch)
{
try
{
if (!Directory.Exists(Path))
Directory.CreateDirectory(Path);
}
catch (Exception ex)
{
var exception = new CreateDirectoryException(this, ex);
exception.Data["Path"] = Path;
throw exception;
}
}
}

[EditorBrowsable(EditorBrowsableState.Never)]
public static class CreateLocalDirectoryJobFluent
{
public static IFlow CreateLocalDirectory(this IFlow builder, string path)
{
return builder.ExecuteProcess(() => new CreateLocalDirectoryJob()
{
Path = path,
});
}
}
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
namespace FizzCode.EtLast;

public sealed class MoveFileJob : AbstractJob
{
[ProcessParameterMustHaveValue]
public required string SourceFileName { get; init; }

[ProcessParameterMustHaveValue]
public required string TargetFileName { get; init; }

public required bool Overwrite { get; init; }

public override string GetTopic() => SourceFileName;

protected override void ExecuteImpl(Stopwatch netTimeStopwatch)
{
try
{
if (File.Exists(TargetFileName))
{
if (!Overwrite)
return;
}

File.Move(SourceFileName, TargetFileName, true);
}
catch (Exception ex)
{
var exception = new MoveFileException(this, ex);
exception.Data["SourceFileName"] = SourceFileName;
exception.Data["TargetFileName"] = TargetFileName;
exception.Data["Overwrite"] = Overwrite;
throw exception;
}
}
}

[EditorBrowsable(EditorBrowsableState.Never)]
public static class MoveFileJobFluent
{
public static IFlow MoveFile(this IFlow builder, string sourceFileName, string targetFileName, bool overwrite)
{
return builder.ExecuteProcess(() => new MoveFileJob()
{
SourceFileName = sourceFileName,
TargetFileName = targetFileName,
Overwrite = overwrite,
});
}
namespace FizzCode.EtLast;

public sealed class MoveLocalFileJob : AbstractJob
{
[ProcessParameterMustHaveValue]
public required string SourceFileName { get; init; }

[ProcessParameterMustHaveValue]
public required string TargetFileName { get; init; }

public required bool Overwrite { get; init; }

public override string GetTopic() => SourceFileName;

protected override void ExecuteImpl(Stopwatch netTimeStopwatch)
{
try
{
if (File.Exists(TargetFileName))
{
if (!Overwrite)
return;
}

File.Move(SourceFileName, TargetFileName, true);
}
catch (Exception ex)
{
var exception = new MoveFileException(this, ex);
exception.Data["SourceFileName"] = SourceFileName;
exception.Data["TargetFileName"] = TargetFileName;
exception.Data["Overwrite"] = Overwrite;
throw exception;
}
}
}

[EditorBrowsable(EditorBrowsableState.Never)]
public static class MoveLocalFileJobFluent
{
public static IFlow MoveLocalFile(this IFlow builder, string sourceFileName, string targetFileName, bool overwrite)
{
return builder.ExecuteProcess(() => new MoveLocalFileJob()
{
SourceFileName = sourceFileName,
TargetFileName = targetFileName,
Overwrite = overwrite,
});
}
}
1 change: 0 additions & 1 deletion EtLast/Global.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@
global using System.Security.Cryptography;
global using System.Text;
global using System.Text.Json;
global using System.Text.Json.Serialization.Metadata;
global using System.Threading;
global using System.Transactions;
3 changes: 1 addition & 2 deletions EtLast/Processes/Json/JsonArrayReader.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Text.Json;
using System.Threading.Tasks;
using System.Threading.Tasks;

namespace FizzCode.EtLast;

Expand Down
4 changes: 1 addition & 3 deletions EtLast/Processes/Json/JsonElementReader.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Text.Json;

namespace FizzCode.EtLast;
namespace FizzCode.EtLast;

public sealed class JsonElementReader<T> : AbstractRowSource
{
Expand Down

0 comments on commit b67a6bd

Please sign in to comment.