Init
This commit is contained in:
29
Compressor/ImgPaths.cs
Normal file
29
Compressor/ImgPaths.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ImageCompressor
|
||||
{
|
||||
/// <summary>
|
||||
/// 一张照片的打开路径和储存路径
|
||||
/// </summary>
|
||||
class ImgPaths
|
||||
{
|
||||
public bool KeepOriginal { get; set; } = true;
|
||||
public FileInfo OriginalFileInfo { get; private set; }
|
||||
public FileInfo DuplicatedFileInfo { get; private set; }
|
||||
public ImgPaths(string readPath, string writePath)
|
||||
{
|
||||
OriginalFileInfo = new FileInfo(readPath);
|
||||
string extension = Path.GetExtension(writePath).ToLower();
|
||||
if(extension != ".jpg" || extension !=".jpeg")
|
||||
{
|
||||
Path.ChangeExtension(writePath, ".jpg");
|
||||
}
|
||||
this.DuplicatedFileInfo = new FileInfo(writePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user