Skip to content

Commit

Permalink
adding unsplash option
Browse files Browse the repository at this point in the history
  • Loading branch information
AdsonEsteves committed Sep 1, 2021
1 parent 81e6c42 commit ac2a592
Show file tree
Hide file tree
Showing 13 changed files with 7,374 additions and 235 deletions.
Binary file added AutoBGchanger/01g______Yeh_icon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions AutoBGchanger/AutoBGchanger.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<OutputType>Exe</OutputType>
<TargetFramework>net5.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<ApplicationIcon>01g______Yeh_icon.ico</ApplicationIcon>
</PropertyGroup>

<ItemGroup>
Expand Down
159 changes: 159 additions & 0 deletions AutoBGchanger/ImageForumControls/KonaChanControl.Designer.cs

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

107 changes: 107 additions & 0 deletions AutoBGchanger/ImageForumControls/KonaChanControl.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
using System;
using System.Diagnostics;
using System.Text;
using System.Threading;
using System.Windows.Forms;

namespace AutoBGchanger
{
public partial class KonaChanControl : UserControl
{
string apilink = "https://konachan.com/post.json?tags=order%3Arandom";
Thread timedBGThread = null;
WallpaperLoop wpl = new WallpaperLoop();

public KonaChanControl()
{
InitializeComponent();
}

public void executeKonaChanLoop(Decimal time)
{
StringBuilder builder = new StringBuilder();
builder.Append(apilink + "+");
builder.Append(getTags() + "+");
builder.Append(getRating() + "+");
builder.Append(getSize());
Debug.WriteLine(builder.ToString());

timedBGThread = new Thread(() => wpl.timedLoopBG(builder.ToString(), (int)time));
timedBGThread.Start();
}

public void executeOneTime()
{
StringBuilder builder = new StringBuilder();
builder.Append(apilink + "+");
builder.Append(getTags() + "+");
builder.Append(getRating() + "+");
builder.Append(getSize());
Debug.WriteLine(builder.ToString());


timedBGThread = new Thread(() => wpl.oneTimeBGChange(builder.ToString()));
timedBGThread.Start();
}

public void stopKonaChanLoop()
{
wpl.stopTimer();
}

private string getTags()
{
StringBuilder builder = new StringBuilder();

string tags = boxTags.Text;
builder.Append(tags.Replace(" ", "+"));

return builder.ToString();
}

private string getSize()
{
StringBuilder builder = new StringBuilder();

string width = boxWidth.Text;
string height = boxHeight.Text;

if (!width.Equals(""))
{
builder.Append("width%3A" + width + "..+");
}

if (!width.Equals(""))
{
builder.Append("height%3A" + height + "..");
}

return builder.ToString();
}

private string getRating()
{
string ratingInput = comboBoxRating.SelectedItem == null ? "" : comboBoxRating.SelectedItem.ToString();
switch (ratingInput)
{
case "Safe":
return "rating%3Asafe";

case "Safe - Questionable":
return "rating%3Aquestionableless";

case "Questionable":
return "rating%3Aquestionable";

case "Questionable - Explicit":
return "rating%3Aquestionableplus";

case "Explicit":
return "rating%3Aexplicit";

default:
return "";
}
}
}
}
60 changes: 60 additions & 0 deletions AutoBGchanger/ImageForumControls/KonaChanControl.resx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
Loading

0 comments on commit ac2a592

Please sign in to comment.