Skip to content

Commit

Permalink
Merge pull request #66 from jitwxs/dev
Browse files Browse the repository at this point in the history
optimized for v3.9
  • Loading branch information
jitwxs committed Mar 31, 2022
2 parents 5879fc2 + ca6e38e commit de8bfc9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2017 jitwxs@foxmail.com

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
16 changes: 10 additions & 6 deletions WindowsFormsApp1/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ private List<long> RequestSongIdInAlbum(long albumId, out string errorMsg)
errorMsg = ErrorMsg.INPUT_ALBUM_ILLEGAL;
return null;
}

var set = albumResult.Songs.Select(song => song.Id);
songIds.AddRange(set);

Expand Down Expand Up @@ -184,7 +185,7 @@ private void SearchBySongId(IEnumerable<long> songIds, out Dictionary<long, stri
continue;
}
}

errorMsgDict.Add(songId, errorMsg);
}
}
Expand Down Expand Up @@ -220,6 +221,7 @@ private void InitInputSongIds(out string errorMsg)
MessageBox.Show(errorMsg, "提示");
return;
}

foreach (var songId in songIds)
{
_globalSearchInfo.SONG_IDS.Add(songId);
Expand All @@ -245,7 +247,7 @@ private void SingleSearch(long songId, out string errorMsg)
var message = resultMaps[songId];
errorMsg = message;
if (message != ErrorMsg.SUCCESS)
{
{
return;
}

Expand Down Expand Up @@ -306,7 +308,7 @@ private void searchBtn_Click(object sender, EventArgs e)
if (errorMsg != ErrorMsg.SUCCESS)
{
_logger.Info($"搜索失败, 搜索框内容: {search_id_text.Text}, 搜索模式: {_globalSearchInfo.SearchType}, " +
$"错误信息: {errorMsg}");
$"错误信息: {errorMsg}");
MessageBox.Show(errorMsg, "提示");
return;
}
Expand Down Expand Up @@ -334,8 +336,8 @@ private void searchBtn_Click(object sender, EventArgs e)
}
catch (WebException ex)
{
_logger.Error(ex, "网络错误");
MessageBox.Show("网络错误", "错误");
_logger.Error(ex, "网络错误");
}
catch (Exception ex)
{
Expand Down Expand Up @@ -426,13 +428,14 @@ private void SingleSave(long songId)
sw.Write(NetEaseMusicUtils.GetOutputContent(saveVo.LyricVo, _globalSearchInfo));
sw.Flush();
}

MessageBox.Show(ErrorMsg.SAVE_SUCCESS, "提示");
}
}
catch (Exception ew)
{
MessageBox.Show("保存失败!错误信息:\n" + ew.Message);
_logger.Error(ew, "单独保存歌词失败");
MessageBox.Show("保存失败!错误信息:\n" + ew.Message);
}
}

Expand Down Expand Up @@ -464,13 +467,14 @@ private void BatchSave()
sw.Flush();
sw.Close();
}

MessageBox.Show(ErrorMsg.SAVE_SUCCESS, "提示");
}
}
catch (Exception ew)
{
MessageBox.Show("批量保存失败,错误信息:\n" + ew.Message);
_logger.Error(ew, "批量保存失败");
MessageBox.Show("批量保存失败,错误信息:\n" + ew.Message);
}

// 输出日志
Expand Down
8 changes: 1 addition & 7 deletions WindowsFormsApp1/NLog.config
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>

<!--<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
internalLogLevel="Trace"
internalLogFile="D:\work\log.txt">-->

<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true">
Expand All @@ -15,7 +9,7 @@
<target name="file" xsi:type="AsyncWrapper" queueLimit="5000" overflowAction="Discard">
<target xsi:type="File"
fileName="${basedir}/Logs/${shortdate}.log"
layout="${date:format=HH\:mm\:ss} | ${level:uppercase=true:padding=-5} | ${message:exceptionSeparator=\r\n:withException=true}" />
layout="${longdate} | ${level:uppercase=true:padding=-5} | ${message:exceptionSeparator=\r\n:withException=true}" />
</target>

<target name="debugger" encoding="utf-8"
Expand Down

0 comments on commit de8bfc9

Please sign in to comment.