Skip to content

Commit

Permalink
Support all 3 different code format
Browse files Browse the repository at this point in the history
  • Loading branch information
LittlePox committed Jul 29, 2017
1 parent b1d6c7e commit 3bdc8aa
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
31 changes: 28 additions & 3 deletions EasyScrShot/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@ private void MatchPNG()

private enum OutputType
{
Html, Bbcode
Html, Bbcode, Markdown
}

private OutputType _outputType = OutputType.Html;

private string GenerateCode()
private string GenerateBbcode()
{
FList.Sort();
string url = "http://img.2222.moe/images/" + DateTime.Today.ToString("yyyy/MM/dd/");
Expand All @@ -149,6 +149,7 @@ private string GenerateCode()
rip = url + FList[i].RipName,
tbl = url + FList[i].FrameId + "s.png";
ret.AppendFormat("[URL={1}][IMG]{0}[/IMG][/URL] [URL={2}][IMG]{0}[/IMG][/URL]", tbl, src, rip);
ret.AppendLine();
}
}
return ret.ToString();
Expand All @@ -169,6 +170,28 @@ private string GenerateHTML()
var rip = baseUrl + img.RipName;
var tbl = baseUrl + img.FrameId + "s.png";
ret.AppendFormat("<a href=\"{1}\"><img src=\"{0}\"></a> <a href=\"{2}\"><img src=\"{0}\"></a><br/>", tbl, src, rip);
ret.AppendLine();
}

return ret.ToString();
}

private string GenerateMarkdown()
{
FList.Sort();
var baseUrl = "http://img.2222.moe/images/" + DateTime.Today.ToString("yyyy/MM/dd/");
var ret = new StringBuilder();

ret.AppendLine("Comparison (right click on the image and open it in a new tab to see the full-size one)");
ret.AppendLine("Source________________________________________________Encode");
ret.AppendLine();
foreach (var img in FList)
{
var src = baseUrl + img.SrcName;
var rip = baseUrl + img.RipName;
var tbl = baseUrl + img.FrameId + "s.png";
ret.AppendFormat("[![]({0})]({1}) [![]({0})]({2})", tbl, src, rip);
ret.AppendLine();
}

return ret.ToString();
Expand Down Expand Up @@ -296,7 +319,9 @@ private async void uploadButton_Click(object sender, EventArgs e)
{
file.WriteLine(GenerateHTML());
file.WriteLine();
file.WriteLine(GenerateCode());
file.WriteLine(GenerateBbcode());
file.WriteLine();
file.WriteLine(GenerateMarkdown());
}
if (flag) MessageBox.Show("截图代码已经写在url.txt里", "去丢发布组吧" + Utility.GetHappyEmotion());
}
Expand Down
4 changes: 2 additions & 2 deletions EasyScrShot/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.1.0.0")]
[assembly: AssemblyFileVersion("2.1.0.0")]
[assembly: AssemblyVersion("2.3.0.0")]
[assembly: AssemblyFileVersion("2.3.0.0")]

0 comments on commit 3bdc8aa

Please sign in to comment.