Add WebCms
This commit is contained in:
+7
-2
@@ -30,8 +30,12 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="AutoMapper, Version=4.2.1.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\AutoMapper.4.2.1\lib\net45\AutoMapper.dll</HintPath>
|
||||
<Reference Include="AutoMapper, Version=3.3.1.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\AutoMapper.3.3.1\lib\net40\AutoMapper.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="AutoMapper.Net4, Version=3.3.1.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\AutoMapper.3.3.1\lib\net40\AutoMapper.Net4.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="CsvHelper, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8c4959082be5c823, processorArchitecture=MSIL">
|
||||
@@ -169,6 +173,7 @@
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\AutoMapper.3.3.1\tools\AutoMapper.targets" Condition="Exists('..\packages\AutoMapper.3.3.1\tools\AutoMapper.targets')" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
|
||||
@@ -7,7 +7,6 @@ namespace LeafWeb.Core.Remote
|
||||
{
|
||||
public class PiscalLeafInput
|
||||
{
|
||||
private static readonly IMapper Mapper;
|
||||
public int LeafInputId { get; set; }
|
||||
public string PhotosyntheticType { get; set; }
|
||||
public string PiscalDirectoryName { get; set; }
|
||||
@@ -17,19 +16,15 @@ namespace LeafWeb.Core.Remote
|
||||
|
||||
static PiscalLeafInput()
|
||||
{
|
||||
var config =
|
||||
new MapperConfiguration(cfg =>
|
||||
{
|
||||
cfg.CreateMap<LeafInput, PiscalLeafInput>()
|
||||
.ForMember(dest => dest.PiscalDirectoryName,
|
||||
opt => opt.MapFrom(src => PiscalUtility.GetPiscalDirectoryName(src)))
|
||||
.ForMember(dest => dest.LeafInputId, opt => opt.MapFrom(src => src.Id))
|
||||
.ForMember(dest => dest.InputFiles, opt => opt.MapFrom(src => src.InputFiles.Select(f => new PiscalLeafInputFile(f)).ToArray()))
|
||||
.ForMember(
|
||||
dest => dest.PhotosyntheticType,
|
||||
opt => opt.MapFrom(src => src.PhotosynthesisType.Id.WhitespaceToUnderscore()));
|
||||
});
|
||||
Mapper = config.CreateMapper();
|
||||
Mapper.CreateMap<LeafInput, PiscalLeafInput>()
|
||||
.ForMember(dest => dest.PiscalDirectoryName,
|
||||
opt => opt.MapFrom(src => PiscalUtility.GetPiscalDirectoryName(src)))
|
||||
.ForMember(dest => dest.LeafInputId, opt => opt.MapFrom(src => src.Id))
|
||||
.ForMember(dest => dest.InputFiles, opt => opt.MapFrom(src => src.InputFiles.Select(f => new PiscalLeafInputFile(f)).ToArray()))
|
||||
.ForMember(
|
||||
dest => dest.PhotosyntheticType,
|
||||
opt => opt.MapFrom(src => src.PhotosynthesisType.Id.WhitespaceToUnderscore()));
|
||||
|
||||
}
|
||||
|
||||
public PiscalLeafInput() { }
|
||||
|
||||
@@ -6,20 +6,14 @@ namespace LeafWeb.Core.Remote
|
||||
{
|
||||
public class PiscalLeafInputFile
|
||||
{
|
||||
private static readonly IMapper Mapper;
|
||||
public string Filename { get; set; }
|
||||
public byte[] Contents { get; set; }
|
||||
|
||||
static PiscalLeafInputFile()
|
||||
{
|
||||
var config =
|
||||
new MapperConfiguration(cfg =>
|
||||
{
|
||||
cfg.CreateMap<LeafInputFile, PiscalLeafInputFile>()
|
||||
.ForMember(dest => dest.Filename, opt =>
|
||||
opt.MapFrom(src => src.Filename.WhitespaceToUnderscore().FilterValidFilename()));
|
||||
});
|
||||
Mapper = config.CreateMapper();
|
||||
Mapper.CreateMap<LeafInputFile, PiscalLeafInputFile>()
|
||||
.ForMember(dest => dest.Filename, opt =>
|
||||
opt.MapFrom(src => src.Filename.WhitespaceToUnderscore().FilterValidFilename()));
|
||||
}
|
||||
|
||||
public PiscalLeafInputFile() { }
|
||||
|
||||
@@ -6,8 +6,6 @@ namespace LeafWeb.Core.Remote
|
||||
{
|
||||
public class PiscalLeafOutputFile
|
||||
{
|
||||
private static readonly IMapper Mapper;
|
||||
|
||||
public string Filename { get; set; }
|
||||
public byte[] Contents { get; set; }
|
||||
public string PiscalDirectoryName { get; set; }
|
||||
@@ -17,30 +15,25 @@ namespace LeafWeb.Core.Remote
|
||||
|
||||
static PiscalLeafOutputFile()
|
||||
{
|
||||
var config =
|
||||
new MapperConfiguration(cfg =>
|
||||
{
|
||||
cfg.CreateMap<PiscalLeafOutputFile, LeafOutputFile>()
|
||||
.ForMember(dest => dest.FileContents, opt =>
|
||||
opt.ResolveUsing(src => new LeafOutputFileContents {Contents = src.Contents}))
|
||||
.ForMember(dest => dest.FileType, opt =>
|
||||
opt.ResolveUsing(src =>
|
||||
{
|
||||
switch (src.OutputFileType)
|
||||
{
|
||||
case "touser":
|
||||
return LeafOutputFileType.ToUser;
|
||||
case "nottouser":
|
||||
return LeafOutputFileType.NotToUser;
|
||||
case "clninput":
|
||||
return LeafOutputFileType.CleanedInput;
|
||||
default:
|
||||
throw new ArgumentException();
|
||||
}
|
||||
Mapper.CreateMap<PiscalLeafOutputFile, LeafOutputFile>()
|
||||
.ForMember(dest => dest.FileContents, opt =>
|
||||
opt.ResolveUsing(src => new LeafOutputFileContents {Contents = src.Contents}))
|
||||
.ForMember(dest => dest.FileType, opt =>
|
||||
opt.ResolveUsing(src =>
|
||||
{
|
||||
switch (src.OutputFileType)
|
||||
{
|
||||
case "touser":
|
||||
return LeafOutputFileType.ToUser;
|
||||
case "nottouser":
|
||||
return LeafOutputFileType.NotToUser;
|
||||
case "clninput":
|
||||
return LeafOutputFileType.CleanedInput;
|
||||
default:
|
||||
throw new ArgumentException();
|
||||
}
|
||||
|
||||
}));
|
||||
});
|
||||
Mapper = config.CreateMapper();
|
||||
}));
|
||||
}
|
||||
|
||||
public PiscalLeafOutputFile() { }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="AutoMapper" version="4.2.1" targetFramework="net45" />
|
||||
<package id="AutoMapper" version="3.3.1" targetFramework="net45" />
|
||||
<package id="CsvHelper" version="2.14.2" targetFramework="net45" />
|
||||
<package id="EntityFramework" version="6.1.3" targetFramework="net45" />
|
||||
<package id="fasterflect" version="2.1.3" targetFramework="net45" />
|
||||
|
||||
Reference in New Issue
Block a user