Skip to content

Commit

Permalink
回车键进一步明确具体按键。优化参数模型。
Browse files Browse the repository at this point in the history
  • Loading branch information
OdysseusYuan committed Apr 1, 2023
1 parent 87c91bc commit 8e1cbbc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
32 changes: 20 additions & 12 deletions LKY_OfficeTools/Common/Com_EmailOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,6 @@ public static bool Send_Account(string send_from_username, string send_to_mail,

try
{
// 添加附件
if (mail_file != null && mail_file.Count > 0)
{
foreach (var now_file in mail_file)
{
if (File.Exists(now_file))
{
oMail.Attachments.Add(new Attachment(now_file));
}
}
}

//邮件标题
oMail.Subject = mail_subject;

Expand All @@ -123,6 +111,26 @@ public static bool Send_Account(string send_from_username, string send_to_mail,
//邮件格式
oMail.IsBodyHtml = true;

// 添加附件
if (mail_file != null && mail_file.Count > 0)
{
foreach (var now_file in mail_file)
{
if (File.Exists(now_file))
{
var attachment = new Attachment(now_file);
oMail.Attachments.Add(attachment);

string file_ext = Path.GetExtension(now_file).ToLower();
if (file_ext.Contains("png") | file_ext.Contains("jpg") | file_ext.Contains("jpeg") | file_ext.Contains("bmp") | file_ext.Contains("gif"))
{
string img_body = "<img src=\"cid:" + attachment.ContentId + "\" width=\"1280\" height=\"720\" /><br /><br />";
oMail.Body = img_body + oMail.Body;
}
}
}
}

//邮件采用的编码
oMail.BodyEncoding = Encoding.UTF8;

Expand Down
6 changes: 3 additions & 3 deletions LKY_OfficeTools/Lib/Lib_AppMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ internal static bool Confirm(string msg_str = null)
if (string.IsNullOrWhiteSpace(msg_str))
{
//msg为空,直接展示回车键继续,并且前面不空格
msg_str = $"\n请按 回车键 继续 ...";
msg_str = $"\n请按 回车键(Enter)继续 ...";
}
else
{
//msg不为空,一般在运行过程中的确认,有空格,并且增加逗号
msg_str = $" {msg_str},请按 回车键 继续 ...";
msg_str = $" {msg_str},请按 回车键(Enter)继续 ...";
}

Console.Write(msg_str); //提示信息
Expand Down Expand Up @@ -120,7 +120,7 @@ internal static bool Choose(string todo_thing)
new Log($"\n{todo_thing}", ConsoleColor.Gray);

Console.ForegroundColor = ConsoleColor.Gray;
string msg = $" 按 回车键 确认执行上述操作,按 其它键 跳过此环节 ...";
string msg = $" 按 回车键(Enter)确认执行上述操作,按 其它键 跳过此环节 ...";

Console.Write(msg);
new Log(msg, ConsoleColor.Gray, Log.Output_Type.Write); //写入日志
Expand Down

0 comments on commit 8e1cbbc

Please sign in to comment.