Skip to content

Commit

Permalink
Merge pull request #17 from Ali-YousefiTelori/develop
Browse files Browse the repository at this point in the history
update packages
  • Loading branch information
Ali-YousefiTelori authored Sep 18, 2023
2 parents b26a8af + 4c24596 commit b76ad7b
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishSingleFile>true</PublishSingleFile>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\EasyMicroservices.MapGeneration.Logics\EasyMicroservices.MapGeneration.Logics.csproj" />
<PackageReference Include="EasyMicroservices.Serialization.Newtonsoft.Json" Version="0.0.0.1" />
</ItemGroup>

</Project>
32 changes: 23 additions & 9 deletions src/CSharp/EasyMicroservices.MapGeneration.ConsoleApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,18 @@ static async Task Main(string[] args)
{
try
{
Console.WriteLine("Please set Map.json (enter to generate last file openned)");
var jsonFilePath = Console.ReadLine();
var pathProvider = new SystemPathProvider();
string lastFileOppened = pathProvider.Combine(AppDomain.CurrentDomain.BaseDirectory, "LastFile.txt");
if (string.IsNullOrEmpty(jsonFilePath))
{
if (File.Exists(lastFileOppened))
jsonFilePath = await File.ReadAllTextAsync(lastFileOppened, Encoding.UTF8);
}

var jsonFilePath = await LoadFilePath(args, lastFileOppened);
Console.WriteLine($"File opend: {jsonFilePath}");
var appPath = AppDomain.CurrentDomain.BaseDirectory;
EnvironmentLoader loader = new EnvironmentLoader(new NewtonsoftJsonProvider(), new DiskFileProvider(new DiskDirectoryProvider(appPath, pathProvider)));
await loader.Load(jsonFilePath);
Generation generation = new Generation(loader.AppData.Environments.First());
var environmentSchemaBuild = await generation.Build();
CSharpBuilder cSharpBuilder = new CSharpBuilder();
var compiled = await cSharpBuilder.Build(environmentSchemaBuild);
string savedToPath = pathProvider.Combine(loader.AppData.Environments.First().GenerationPath, "CompileTimeClassesMappers.cs");
string savedToPath = pathProvider.Combine(loader.AppData.Environments.First().GetGenerationPath(), "CompileTimeClassesMappers.cs");
await File.WriteAllTextAsync(savedToPath, compiled.ToString(), Encoding.UTF8);
Console.WriteLine($"Generated to {savedToPath}");
await File.WriteAllTextAsync(lastFileOppened, jsonFilePath, Encoding.UTF8);
Expand All @@ -44,5 +38,25 @@ static async Task Main(string[] args)
Console.ReadLine();
await Main(args);
}

/// <summary>
///
/// </summary>
/// <param name="args"></param>
/// <param name="pathProvider"></param>
/// <returns></returns>
static async Task<string> LoadFilePath(string[] args, string lastFileOppened)
{
if (args != null && args.Any() && File.Exists(args[0]))
return args[0];
Console.WriteLine("Please set Map.json (enter to generate last file openned)");
var jsonFilePath = Console.ReadLine();
if (string.IsNullOrEmpty(jsonFilePath))
{
if (File.Exists(lastFileOppened))
jsonFilePath = await File.ReadAllTextAsync(lastFileOppened, Encoding.UTF8);
}
return jsonFilePath;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class EnvironmentInfo

public string GetGenerationPath()
{
return GenerationPath.Replace(PathConstants.ExecutionPath,AppDomain.CurrentDomain.BaseDirectory);
return GenerationPath.Replace(PathConstants.ExecutionPath, AppDomain.CurrentDomain.BaseDirectory);
}

public string GetBuildPath()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Platforms>AnyCPU;x64;x86</Platforms>
<Authors>EasyMicroservices</Authors>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.0.0.4</Version>
<Version>0.0.0.5</Version>
<Description>Map objects.</Description>
<Copyright>[email protected]</Copyright>
<PackageTags>map,mapper,clone,coppy</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Platforms>AnyCPU;x64;x86</Platforms>
<Authors>EasyMicroservices</Authors>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.0.0.5</Version>
<Version>0.0.0.6</Version>
<Description>Map objects.</Description>
<Copyright>[email protected]</Copyright>
<PackageTags>map,mapper,clone,coppy</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Platforms>AnyCPU;x64;x86</Platforms>
<Authors>EasyMicroservices</Authors>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.0.0.2</Version>
<Version>0.0.0.3</Version>
<Description>Map objects.</Description>
<Copyright>[email protected]</Copyright>
<PackageTags>map,mapper,clone,coppy</PackageTags>
Expand All @@ -16,7 +16,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EasyMicroservices.Serialization" Version="0.0.0.2" />
<PackageReference Include="EasyMicroservices.Serialization" Version="0.0.0.4" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ namespace EasyMicroservices.Mapper.SerializerMapper.Providers
/// </summary>
public class SerializerMapperProvider : BaseMapperProvider
{
private readonly ITextSerialization _textSerialization;
private readonly IBinarySerialization _binarySerialization;
private readonly ITextSerializationProvider _textSerialization;
private readonly IBinarySerializationProvider _binarySerialization;
/// <summary>
///
/// </summary>
/// <param name="textSerialization"></param>
public SerializerMapperProvider(ITextSerialization textSerialization)
public SerializerMapperProvider(ITextSerializationProvider textSerialization)
{
if (textSerialization == null)
throw new ArgumentNullException(nameof(textSerialization));
Expand All @@ -26,7 +26,7 @@ public SerializerMapperProvider(ITextSerialization textSerialization)
///
/// </summary>
/// <param name="binarySerialization"></param>
public SerializerMapperProvider(IBinarySerialization binarySerialization)
public SerializerMapperProvider(IBinarySerializationProvider binarySerialization)
{
if (binarySerialization == null)
throw new ArgumentNullException(nameof(binarySerialization));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net6.0;net5.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EasyMicroservices.Serialization.BinaryGo" Version="0.0.0.1" />
<PackageReference Include="EasyMicroservices.Serialization.Newtonsoft.Json" Version="0.0.0.3" />
<PackageReference Include="EasyMicroservices.Serialization.System.Text.Json" Version="0.0.0.4" />
<PackageReference Include="EasyMicroservices.Tests" Version="0.0.0.3" />
<PackageReference Include="EasyMicroservices.Serialization.BinaryGo" Version="0.0.0.4" />
<PackageReference Include="EasyMicroservices.Serialization.Newtonsoft.Json" Version="0.0.0.6" />
<PackageReference Include="EasyMicroservices.Serialization.System.Text.Json" Version="0.0.0.7" />
<PackageReference Include="EasyMicroservices.Tests" Version="0.0.0.7" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="xunit.assert" Version="2.5.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Platforms>AnyCPU;x64;x86</Platforms>
<Authors>EasyMicroservices</Authors>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.0.0.4</Version>
<Version>0.0.0.5</Version>
<Description>Map objects.</Description>
<Copyright>[email protected]</Copyright>
<PackageTags>map,mapper,clone,coppy</PackageTags>
Expand Down

0 comments on commit b76ad7b

Please sign in to comment.