Files
ImageCompressor/Compressor/ImgPaths.cs
2026-02-02 21:56:45 +08:00

30 lines
882 B
C#

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);
}
}
}