Skip to content

Commit e95ec97

Browse files
authored
Merge pull request #3 from Lothindir/Jo
Jo
2 parents eacfd7f + cd17a94 commit e95ec97

3 files changed

Lines changed: 119 additions & 29 deletions

File tree

ThemePacker/MainForm.cs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ public partial class ThemePacker : Form
2727
private Dictionary<string, bool> _shownImages;
2828
private string _path;
2929
private int _currentPic;
30-
30+
private bool _isFolderBased;
31+
private OptionDialogBox _opb;
3132
private CustomProgressBar _pbProgression;
3233

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

236237
private void BtnGenerate_Click(object sender, EventArgs e)
237238
{
238-
OptionDialogBox opb = new OptionDialogBox();
239-
opb.ShowDialog();
240-
opb.Focus();
241-
Generate();
239+
_opb = new OptionDialogBox();
240+
if (_opb.ShowDialog() == DialogResult.OK)
241+
{
242+
Generate();
243+
}
242244
}
243245

244246
public void Generate()
@@ -267,6 +269,13 @@ public void Generate()
267269
theme["Control Panel_Desktop"]["WallpaperStyle"] = "2";
268270
theme["Slideshow"]["Interval"] = "60000";
269271

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

ThemePacker/OptionDialogBox.Designer.cs

Lines changed: 37 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ThemePacker/OptionDialogBox.cs

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using System.ComponentModel;
44
using System.Data;
5+
using System.Diagnostics;
56
using System.Drawing;
67
using System.Linq;
78
using System.Text;
@@ -12,6 +13,9 @@ namespace ThemePacker
1213
{
1314
public partial class OptionDialogBox : Form
1415
{
16+
public string TimeChange { get; private set; }
17+
public string TileWallpaper { get; private set; }
18+
public string WallPaperStyle { get; private set; }
1519
public OptionDialogBox()
1620
{
1721
InitializeComponent();
@@ -22,11 +26,74 @@ private void OptionDialogBox_Load(object sender, EventArgs e)
2226
this.MaximizeBox = false;
2327
this.MinimizeBox = false;
2428
this.FormBorderStyle = FormBorderStyle.FixedDialog;
29+
cbPicPos.SelectedItem = "Tile";
30+
cbTimeChange.SelectedItem = "1 minute";
2531
}
2632

2733
private void BtnGenerateFromDB_Click(object sender, EventArgs e)
2834
{
29-
35+
this.DialogResult = DialogResult.OK;
36+
this.Close();
37+
}
38+
39+
private void CbPicPos_SelectedIndexChanged(object sender, EventArgs e)
40+
{
41+
string wallpaper = cbPicPos.SelectedItem.ToString();
42+
switch (wallpaper)
43+
{
44+
case "Fill":
45+
TileWallpaper = "0";
46+
WallPaperStyle = "10";
47+
break;
48+
case "Fit":
49+
TileWallpaper = "0";
50+
WallPaperStyle = "6";
51+
break;
52+
case "Stretch":
53+
TileWallpaper = "0";
54+
WallPaperStyle = "2";
55+
break;
56+
case "Tile":
57+
TileWallpaper = "1";
58+
WallPaperStyle = "0";
59+
break;
60+
case "Center":
61+
TileWallpaper = "0";
62+
WallPaperStyle = "0";
63+
break;
64+
}
65+
}
66+
67+
private void CbTimeChange_SelectedIndexChanged(object sender, EventArgs e)
68+
{
69+
string time = cbTimeChange.SelectedItem.ToString();
70+
switch (time)
71+
{
72+
case "10 seconds":
73+
TimeChange = "10000";
74+
break;
75+
case "30 seconds":
76+
TimeChange = "30000";
77+
break;
78+
case "1 minute":
79+
TimeChange = "60000";
80+
break;
81+
case "5 minutes":
82+
TimeChange = "300000";
83+
break;
84+
case "10 minutes":
85+
TimeChange = "600000";
86+
break;
87+
case "20 minutes":
88+
TimeChange = "1200000";
89+
break;
90+
case "30 minutes":
91+
TimeChange = "1800000";
92+
break;
93+
case "1 hour":
94+
TimeChange = "3600000";
95+
break;
96+
}
3097
}
3198
}
3299
}

0 commit comments

Comments
 (0)