|
@@ -9,7 +9,7 @@ using System.Threading.Tasks;
|
|
|
|
|
|
namespace VideoImageBuilder.Service
|
|
|
{
|
|
|
- public class VideoImageBuilerService
|
|
|
+ public class ImageBuilerService
|
|
|
{
|
|
|
public static readonly string ZIP_SOURCE_DIRECTORY = Environment.CurrentDirectory + @"\ZipSource";
|
|
|
public static readonly string ZIP_FILE_DIRECTORY = Environment.CurrentDirectory + @"\ZipFile";
|
|
@@ -17,11 +17,13 @@ namespace VideoImageBuilder.Service
|
|
|
|
|
|
public const string ZIP_Video1_Name = "97_ScreenSave.mp4";
|
|
|
public const string ZIP_Video2_Name = "99_AD.mp4";
|
|
|
+ public const string ZIP_Image1_Name = "300_SelectGun";
|
|
|
|
|
|
public Result Generate(
|
|
|
string chargeboxId,
|
|
|
string videoPath1,
|
|
|
string videoPath2,
|
|
|
+ string imagePath1,
|
|
|
string outputFolderPath
|
|
|
)
|
|
|
{
|
|
@@ -32,7 +34,7 @@ namespace VideoImageBuilder.Service
|
|
|
}
|
|
|
|
|
|
string temZipPath = Path.Combine(ZIP_FILE_DIRECTORY, TEMP_ZIP_FILE_NAME);
|
|
|
- var createZipFileResult = CreateZipFile(temZipPath, videoPath1, videoPath2);
|
|
|
+ var createZipFileResult = CreateZipFile(temZipPath, videoPath1, videoPath2, imagePath1);
|
|
|
if (!createZipFileResult)
|
|
|
{
|
|
|
return new Result() { Success = false, Message = "CreateZipFile Failed" };
|
|
@@ -64,7 +66,7 @@ namespace VideoImageBuilder.Service
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private static bool CreateZipFile(string zipPath, string videoPath1, string videoPath2)
|
|
|
+ private static bool CreateZipFile(string zipPath, string videoPath1, string videoPath2, string imagePath1)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
@@ -78,6 +80,12 @@ namespace VideoImageBuilder.Service
|
|
|
File.Copy(videoPath2, Path.Combine(ZIP_SOURCE_DIRECTORY, ZIP_Video2_Name), true);
|
|
|
}
|
|
|
|
|
|
+ if (!string.IsNullOrEmpty(imagePath1) && File.Exists(imagePath1))
|
|
|
+ {
|
|
|
+ var extention = Path.GetExtension(imagePath1);
|
|
|
+ File.Copy(imagePath1, Path.Combine(ZIP_SOURCE_DIRECTORY, ZIP_Image1_Name + extention), true);
|
|
|
+ }
|
|
|
+
|
|
|
ZipFile.CreateFromDirectory(ZIP_SOURCE_DIRECTORY, zipPath, CompressionLevel.Fastest, false);
|
|
|
return true;
|
|
|
}
|