Browse Source

enable upload only one video

Robert 1 year ago
parent
commit
6efaa6df1d

+ 1 - 1
GitVersion.yml

@@ -1,6 +1,6 @@
 assembly-versioning-scheme: MajorMinorPatch
 assembly-informational-format: '{ShortSha}'
-next-version: 1.0.2
+next-version: 1.0.3
 branches: {}
 ignore:
   sha: []

+ 1 - 1
VideoImageBuilder/Properties/AssemblyInfo.cs

@@ -53,4 +53,4 @@ using System.Windows;
 // [assembly: AssemblyVersion("1.0.2.0")]
 [assembly: AssemblyVersion("1.0.2.0")]
 [assembly: AssemblyFileVersion("1.0.2.0")]
-[assembly: AssemblyInformationalVersion("28af700")]
+[assembly: AssemblyInformationalVersion("df8a369")]

+ 2 - 2
VideoImageBuilder/Service/AppSettingService.cs

@@ -51,8 +51,8 @@ namespace VideoImageBuilder.Service
             }
 
             context.ChargeboxId = setting.ChargeboxId;
-            context.VideoPath1 = setting.VideoPath1;
-            context.VideoPath2 = setting.VideoPath2;
+            //context.VideoPath1 = setting.VideoPath1;
+            //context.VideoPath2 = setting.VideoPath2;
             context.OutPutFolderPath = setting.OutPutFolderPath;
         }
 

+ 4 - 9
VideoImageBuilder/Service/UiGenerateImageService.cs

@@ -57,22 +57,17 @@ namespace VideoImageBuilder.Service
                 MessageBox.Show("ChargeboxId shoud not be empty");
                 return false;
             }
-            if (string.IsNullOrEmpty(uiContext.VideoPath1))
+            if (string.IsNullOrEmpty(uiContext.VideoPath1) && string.IsNullOrEmpty(uiContext.VideoPath2))
             {
-                MessageBox.Show("Vertical screensave video file path should not be empty");
+                MessageBox.Show("video file path should not be empty");
                 return false;
             }
-            if (!File.Exists(uiContext.VideoPath1))
+            if (!string.IsNullOrEmpty(uiContext.VideoPath1) && !File.Exists(uiContext.VideoPath1))
             {
                 MessageBox.Show("Vertical screensave video file not found");
                 return false;
             }
-            if (string.IsNullOrEmpty(uiContext.VideoPath2))
-            {
-                MessageBox.Show("Horizonal AD video file path should not be empty");
-                return false;
-            }
-            if (!File.Exists(uiContext.VideoPath2))
+            if (!string.IsNullOrEmpty(uiContext.VideoPath2) && !File.Exists(uiContext.VideoPath2))
             {
                 MessageBox.Show("Horizontal AD video file not found");
                 return false;

+ 9 - 2
VideoImageBuilder/Service/VideoImageBuilerService.cs

@@ -68,8 +68,15 @@ namespace VideoImageBuilder.Service
         {
             try
             {
-                File.Copy(videoPath1, Path.Combine(ZIP_SOURCE_DIRECTORY, ZIP_Video1_Name), true);
-                File.Copy(videoPath2, Path.Combine(ZIP_SOURCE_DIRECTORY, ZIP_Video2_Name), true);
+                if (!string.IsNullOrEmpty(videoPath1) && File.Exists(videoPath1))
+                {
+                    File.Copy(videoPath1, Path.Combine(ZIP_SOURCE_DIRECTORY, ZIP_Video1_Name), true);
+                }
+
+                if (!string.IsNullOrEmpty(videoPath2) && File.Exists(videoPath2))
+                {
+                    File.Copy(videoPath2, Path.Combine(ZIP_SOURCE_DIRECTORY, ZIP_Video2_Name), true);
+                }
 
                 ZipFile.CreateFromDirectory(ZIP_SOURCE_DIRECTORY, zipPath, CompressionLevel.Fastest, false);
                 return true;