Skip to content

Commit

Permalink
2.3.0 Released.
Browse files Browse the repository at this point in the history
-fix #15 #17.
  • Loading branch information
ludoux committed Jan 4, 2022
1 parent 58df67b commit 6754fde
Show file tree
Hide file tree
Showing 6 changed files with 139 additions and 42 deletions.
71 changes: 47 additions & 24 deletions LrcHelper/LrcDownloader.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 38 additions & 2 deletions LrcHelper/LrcDownloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,24 @@ private void GETbutton_Click(object sender, EventArgs e)
};
Task.Factory.StartNew(() =>
{
Playlist pl = new Playlist(id);
Playlist pl = new Playlist(id, CookietextBox.Text);
try
{
pl.PreCheck();
}
catch (NeedLoginException ex)
{
MessageBox.Show(ex.Message,"请填写高级选项-登录cookie", MessageBoxButtons.OK, MessageBoxIcon.Error);
this.Invoke((Action)delegate
{
StatusInfolabel.Text = "请填写高级选项-登录cookie后重试";
GETbutton.Enabled = true;
IDtextBox.Clear();
});
return;
}
LogFileWriter logWriter = new LogFileWriter(@".\\" + FormatFileName.CleanInvalidFileName(pl.Name) + @"\");
List<long> idList = pl.SongidInPlaylist;
logWriter.AppendLyricsDownloadTaskDetail();
Expand Down Expand Up @@ -154,6 +171,23 @@ private void GETbutton_Click(object sender, EventArgs e)
Task.Factory.StartNew(() =>
{
Album a = new Album(id);
try
{
a.PreCheck();
}
catch (NeedLoginException ex)
{
MessageBox.Show(ex.Message, "请填写高级选项-登录cookie", MessageBoxButtons.OK, MessageBoxIcon.Error);
this.Invoke((Action)delegate
{
StatusInfolabel.Text = "请填写高级选项-登录cookie后重试";
GETbutton.Enabled = true;
IDtextBox.Clear();
});
return;
}
LogFileWriter logWriter = new LogFileWriter(@".\\" + FormatFileName.CleanInvalidFileName(a.Name) + @"\");
List<long> idList = a.SongidInAlbum;
logWriter.AppendLyricsDownloadTaskDetail();
Expand Down Expand Up @@ -288,7 +322,7 @@ private void Savelabel_Click(object sender, EventArgs e)
{
try
{
File.WriteAllText(".\\AdvancedSettings.txt", string.Format("Version:{0}\r\nTime:{1}\r\nLyricsStyle:{2}\r\nDelayMsec:{3}\r\nFilenamePattern:{4}\r\nEncoding:{5}\r\n***DO NOT CHANGE ANY TEXT AND/OR ENCODING***\r\n***If you don't want to use these settings ever, just delete this file.***", FileVersionInfo.GetVersionInfo(Application.ExecutablePath).FileVersion, DateTime.Now.ToString(), LyricsStylenumericUpDown.Value.ToString(), DelayMsecnumericUpDown.Value.ToString(), FilenamePatterncomboBox.Text, EncodingcomboBox.Text), Encoding.UTF8);
File.WriteAllText(".\\AdvancedSettings.txt", string.Format("Version:{0}\r\nTime:{1}\r\nLyricsStyle:{2}\r\nDelayMsec:{3}\r\nFilenamePattern:{4}\r\nEncoding:{5}\r\nCookie:{6}\r\n***DO NOT CHANGE ANY TEXT AND/OR ENCODING***\r\n***If you don't want to use these settings ever, just delete this file.***", FileVersionInfo.GetVersionInfo(Application.ExecutablePath).FileVersion, DateTime.Now.ToString(), LyricsStylenumericUpDown.Value.ToString(), DelayMsecnumericUpDown.Value.ToString(), FilenamePatterncomboBox.Text, EncodingcomboBox.Text,CookietextBox.Text), Encoding.UTF8);
}
catch (Exception)
{
Expand All @@ -308,12 +342,14 @@ private void LrcDownloader_Load(object sender, EventArgs e)
DelayMsecnumericUpDown.Value = Convert.ToDecimal(Regex.Match(settings, @"(?<=DelayMsec:)(-)*\d+?(?=\r\n)", RegexOptions.IgnoreCase).Value.ToString()); //05-13 修正数值为负数的时候无匹配(变成""),不能进行Convert.ToDecimal("")。
FilenamePatterncomboBox.Text = Regex.Match(settings, @"(?<=FilenamePattern:).+?(?=\r\n)", RegexOptions.IgnoreCase).Value.ToString();
EncodingcomboBox.Text = Regex.Match(settings, @"(?<=Encoding:).+?(?=\r\n)", RegexOptions.IgnoreCase).Value.ToString();
CookietextBox.Text = Regex.Match(settings, @"(?<=Cookie:).+?(?=\r\n)", RegexOptions.IgnoreCase).Value.ToString();
}
}

private void StatusInfolabel_MouseHover(object sender, EventArgs e)
{
toolTip1.SetToolTip(StatusInfolabel, StatusInfolabel.Text);//防止label显示不完文本,专门浮动出来
}

}
}
4 changes: 4 additions & 0 deletions LrcHelper/LrcHelper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
Expand Down Expand Up @@ -127,6 +130,7 @@
<DesignTime>True</DesignTime>
</Compile>
<None Include="app.manifest" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
Expand Down
Loading

0 comments on commit 6754fde

Please sign in to comment.