Skip to content

Commit

Permalink
Merge pull request #3 from Lothindir/Jo
Browse files Browse the repository at this point in the history
Jo
  • Loading branch information
Lothindir authored Dec 13, 2019
2 parents eacfd7f + cd17a94 commit e95ec97
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 29 deletions.
19 changes: 14 additions & 5 deletions ThemePacker/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public partial class ThemePacker : Form
private Dictionary<string, bool> _shownImages;
private string _path;
private int _currentPic;

private bool _isFolderBased;
private OptionDialogBox _opb;
private CustomProgressBar _pbProgression;

private EventHandler _btnNextClick;
Expand Down Expand Up @@ -235,10 +236,11 @@ private void BtnLike_Click(object sender, EventArgs e)

private void BtnGenerate_Click(object sender, EventArgs e)
{
OptionDialogBox opb = new OptionDialogBox();
opb.ShowDialog();
opb.Focus();
Generate();
_opb = new OptionDialogBox();
if (_opb.ShowDialog() == DialogResult.OK)
{
Generate();
}
}

public void Generate()
Expand Down Expand Up @@ -267,6 +269,13 @@ public void Generate()
theme["Control Panel_Desktop"]["WallpaperStyle"] = "2";
theme["Slideshow"]["Interval"] = "60000";

//read and replace
string text = File.ReadAllText("temp\\super.theme");
text = text.Replace("DisplayName=Tinderspirobot", "DisplayName=" + fileName);
text = text.Replace("Interval=1000", "Interval=" + _opb.TimeChange);
text = text.Replace("TileWallpaper=1", "TileWallpaper="+ _opb.TileWallpaper);
text = text.Replace("WallpaperStyle=0", "WallpaperStyle=" + _opb.WallPaperStyle);
File.WriteAllText("temp\\super.theme", text);
tfs.JSON = theme;
tfs.JsonSerialize($"temp\\themepack\\{fileName}.theme");

Expand Down
60 changes: 37 additions & 23 deletions ThemePacker/OptionDialogBox.Designer.cs

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

69 changes: 68 additions & 1 deletion ThemePacker/OptionDialogBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
Expand All @@ -12,6 +13,9 @@ namespace ThemePacker
{
public partial class OptionDialogBox : Form
{
public string TimeChange { get; private set; }
public string TileWallpaper { get; private set; }
public string WallPaperStyle { get; private set; }
public OptionDialogBox()
{
InitializeComponent();
Expand All @@ -22,11 +26,74 @@ private void OptionDialogBox_Load(object sender, EventArgs e)
this.MaximizeBox = false;
this.MinimizeBox = false;
this.FormBorderStyle = FormBorderStyle.FixedDialog;
cbPicPos.SelectedItem = "Tile";
cbTimeChange.SelectedItem = "1 minute";
}

private void BtnGenerateFromDB_Click(object sender, EventArgs e)
{

this.DialogResult = DialogResult.OK;
this.Close();
}

private void CbPicPos_SelectedIndexChanged(object sender, EventArgs e)
{
string wallpaper = cbPicPos.SelectedItem.ToString();
switch (wallpaper)
{
case "Fill":
TileWallpaper = "0";
WallPaperStyle = "10";
break;
case "Fit":
TileWallpaper = "0";
WallPaperStyle = "6";
break;
case "Stretch":
TileWallpaper = "0";
WallPaperStyle = "2";
break;
case "Tile":
TileWallpaper = "1";
WallPaperStyle = "0";
break;
case "Center":
TileWallpaper = "0";
WallPaperStyle = "0";
break;
}
}

private void CbTimeChange_SelectedIndexChanged(object sender, EventArgs e)
{
string time = cbTimeChange.SelectedItem.ToString();
switch (time)
{
case "10 seconds":
TimeChange = "10000";
break;
case "30 seconds":
TimeChange = "30000";
break;
case "1 minute":
TimeChange = "60000";
break;
case "5 minutes":
TimeChange = "300000";
break;
case "10 minutes":
TimeChange = "600000";
break;
case "20 minutes":
TimeChange = "1200000";
break;
case "30 minutes":
TimeChange = "1800000";
break;
case "1 hour":
TimeChange = "3600000";
break;
}
}
}
}

0 comments on commit e95ec97

Please sign in to comment.