Commit 28e52ffe by wangonghui

提交下载视频文件

parent e43f3f61
using DevExpress.Mvvm.Xpf; using DevExpress.ClipboardSource.SpreadsheetML;
using DevExpress.Mvvm.Xpf;
using DevExpress.Xpf.Core; using DevExpress.Xpf.Core;
using log4net; using log4net;
using System; using System;
...@@ -184,7 +185,7 @@ namespace VIZ.Package.Module ...@@ -184,7 +185,7 @@ namespace VIZ.Package.Module
{ {
selectedfileRecycleFileModel = value; selectedfileRecycleFileModel = value;
this.RaisePropertyChanged(nameof(SelectedfileRecycleFileModel)); this.RaisePropertyChanged(nameof(SelectedfileRecycleFileModel));
} }
} }
...@@ -388,7 +389,7 @@ namespace VIZ.Package.Module ...@@ -388,7 +389,7 @@ namespace VIZ.Package.Module
#region 文件列表 #region 文件列表
private Visibility visibilityList=Visibility.Hidden; private Visibility visibilityList = Visibility.Hidden;
public Visibility VisibilityList public Visibility VisibilityList
{ {
...@@ -691,7 +692,7 @@ namespace VIZ.Package.Module ...@@ -691,7 +692,7 @@ namespace VIZ.Package.Module
private void SortFileName() private void SortFileName()
{ {
this.FileModels = this.FileModels.OrderBy(a=>a.Name).ToObservableCollection(); this.FileModels = this.FileModels.OrderBy(a => a.Name).ToObservableCollection();
} }
#endregion #endregion
...@@ -702,7 +703,7 @@ namespace VIZ.Package.Module ...@@ -702,7 +703,7 @@ namespace VIZ.Package.Module
private void SortDate() private void SortDate()
{ {
this.FileModels = this.FileModels.OrderBy(a=>Convert.ToDateTime(a.Date)).ToObservableCollection(); this.FileModels = this.FileModels.OrderBy(a => Convert.ToDateTime(a.Date)).ToObservableCollection();
} }
#endregion #endregion
...@@ -733,15 +734,36 @@ namespace VIZ.Package.Module ...@@ -733,15 +734,36 @@ namespace VIZ.Package.Module
string url = string.Format("{0}GetFile?filePath={1}&isResize=false", ApplicationDomainEx.MediaConfig.Url, fileModel.Path); string url = string.Format("{0}GetFile?filePath={1}&isResize=false", ApplicationDomainEx.MediaConfig.Url, fileModel.Path);
var fileResult = await MediaResourceFileService.GetImage(url); var fileResult = await MediaResourceFileService.GetImage(url);
Image img = Image.FromStream(fileResult);
string filePath = String.Format("{0}\\{1}", path, fileModel.Name); string filePath = String.Format("{0}\\{1}", path, fileModel.Name);
if (!System.IO.File.Exists(filePath))
if (ThumbnailHelper.IsImageByName(fileModel.Name))
{ {
img.Save(filePath);
Image img = Image.FromStream(fileResult);
if (!System.IO.File.Exists(filePath))
{
img.Save(filePath);
}
} }
else if (ThumbnailHelper.IsVideo(fileModel.Name))
{
if (!System.IO.File.Exists(filePath))
{
FileStream file = new FileStream(filePath, FileMode.Create, FileAccess.Write);
fileResult.WriteTo(file);
file.Close();
fileResult.Close();
}
}
} }
DXMessageBox.Show("素材导出成功"); DXMessageBox.Show("素材导出成功");
...@@ -768,7 +790,7 @@ namespace VIZ.Package.Module ...@@ -768,7 +790,7 @@ namespace VIZ.Package.Module
private async void ExprotFile() private async void ExprotFile()
{ {
if (SelectedFileModel == null) return; if (SelectedFileModel == null) return;
...@@ -789,12 +811,29 @@ namespace VIZ.Package.Module ...@@ -789,12 +811,29 @@ namespace VIZ.Package.Module
var fileResult = await MediaResourceFileService.GetImage(url); var fileResult = await MediaResourceFileService.GetImage(url);
Image img = Image.FromStream(fileResult);
if (!System.IO.File.Exists(filePath)) if (ThumbnailHelper.IsImageByName(SelectedFileModel.Name))
{
Image img = Image.FromStream(fileResult);
if (!System.IO.File.Exists(filePath))
{
img.Save(filePath);
}
}
else if (ThumbnailHelper.IsVideo(SelectedFileModel.Name))
{ {
img.Save(filePath); if (!System.IO.File.Exists(filePath))
{
FileStream file = new FileStream(filePath, FileMode.Create, FileAccess.Write);
fileResult.WriteTo(file);
file.Close();
fileResult.Close();
}
} }
DXMessageBox.Show("素材导出成功"); DXMessageBox.Show("素材导出成功");
} }
} }
...@@ -857,7 +896,7 @@ namespace VIZ.Package.Module ...@@ -857,7 +896,7 @@ namespace VIZ.Package.Module
if (selectedFileModel == null || selectedFileModel.ThumbnailBitmap == null) return; if (selectedFileModel == null || selectedFileModel.ThumbnailBitmap == null) return;
ImageEditWindow imageEditWindow = new ImageEditWindow(); ImageEditWindow imageEditWindow = new ImageEditWindow();
ImageEditViewModel vm = imageEditWindow.ImageCut.DataContext as ImageEditViewModel; ImageEditViewModel vm = imageEditWindow.ImageCut.DataContext as ImageEditViewModel;
...@@ -865,7 +904,7 @@ namespace VIZ.Package.Module ...@@ -865,7 +904,7 @@ namespace VIZ.Package.Module
imageEditWindow.ShowDialog(); imageEditWindow.ShowDialog();
if(vm.IsEnter) if (vm.IsEnter)
{ {
string fileName = string.Format("{0}.png", GenerateStringID()); string fileName = string.Format("{0}.png", GenerateStringID());
...@@ -940,9 +979,9 @@ namespace VIZ.Package.Module ...@@ -940,9 +979,9 @@ namespace VIZ.Package.Module
{ {
if (SelectedfileRecycleFileModel == null) return; if (SelectedfileRecycleFileModel == null) return;
var result = await this.mediaResourceFileController.ReStoreRecycFile(SelectedfileRecycleFileModel.Name); var result = await this.mediaResourceFileController.ReStoreRecycFile(SelectedfileRecycleFileModel.Name);
if(result.status=="0") if (result.status == "0")
{ {
DXMessageBox.Show("文件还原成功!"); DXMessageBox.Show("文件还原成功!");
RefreshFile(); RefreshFile();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment