public int Generate() { if (Marks.Count == 0 && !File.Exists(Source) && !Directory.Exists(Target)) { return(0); } foreach (var mark in Marks) { if (!CreateMarkedFile(mark, Source, Target)) { var sourceName = Path.GetFileNameWithoutExtension(Source); throw new Exception($"创建水印文件:\n{sourceName}_{mark.Text}\n到\n{Target}\n失败。"); } } return(Marks.Count()); }