using ComPDFKit.PDFPage.Edit; using ComPDFKit.PDFPage; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Media; using ComPDFKitViewer.AnnotEvent; namespace PDFSettings { public class DefaultEditProperty { public bool IsItalic { get; set; } public bool ClipImage { get; set; } public bool HorizontalMirror { get; set; } public bool VerticalMirror { get; set; } public List SystemFontNameList { get; } public int Transparency { get; set; } public bool IsBold { get; set; } public string ReplaceImagePath { get; set; } public string FontName { get; set; } public TextAlignType TextAlign { get; set; } public Color FontColor { get; set; } public bool AutoBlock { get; set; } public double FontSize { get; set; } public CPDFEditType EditType { get; set; } public int Rotate { get; set; } = 0; public string SaveKey; public DefaultEditProperty() { EditType = CPDFEditType.None; } } public class DefaultEditProperties : List { public DefaultEditProperty GetEditProperty(CPDFEditType editType) { return this.AsEnumerable().Where(x => x.EditType == editType).FirstOrDefault(); } public DefaultEditProperty GetEditProperty(CPDFEditType editType, string saveKey) { return this.AsEnumerable().Where(x => x.EditType == editType && x.SaveKey == saveKey).FirstOrDefault(); } public void SetEditProperty(DefaultEditProperty editType) { DefaultEditProperty[] deleteArray = new DefaultEditProperty[0]; if (editType.SaveKey != null && editType.SaveKey != string.Empty) { deleteArray = this.AsEnumerable().Where(x => x.EditType == editType.EditType && x.SaveKey == editType.SaveKey).ToArray(); } else { deleteArray = this.AsEnumerable().Where(x => x.EditType == editType.EditType).ToArray(); } foreach (DefaultEditProperty deleteProperty in deleteArray) { this.Remove(deleteProperty); } this.Add(editType); } } }