Skip to content

Commit 5e511a3

Browse files
committed
Initial
1 parent 4ebe748 commit 5e511a3

File tree

12 files changed

+709
-0
lines changed

12 files changed

+709
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
bin/
2+
obj/
3+
.vs/

GIF-Studio/App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1" />
5+
</startup>
6+
</configuration>

GIF-Studio/Form1.Designer.cs

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

GIF-Studio/Form1.cs

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel;
4+
using System.Data;
5+
using System.Drawing;
6+
using System.Linq;
7+
using System.Text;
8+
using System.Threading.Tasks;
9+
using System.Windows.Forms;
10+
using System.IO;
11+
12+
namespace GIF_Studio
13+
{
14+
public partial class Form1 : Form
15+
{
16+
public ImageList imgs = new ImageList();
17+
public int curr_img = 0;
18+
19+
public Form1()
20+
{
21+
InitializeComponent();
22+
23+
listView1.DragDrop += listView1_DragDrop;
24+
listView1.DragEnter += listView1_DragEnter;
25+
listView1_Initialize();
26+
27+
}
28+
29+
private void listView1_Initialize()
30+
{
31+
imgs.ImageSize = new Size(50, 50);
32+
listView1.View = View.Details;
33+
listView1.Columns.Add("Files", listView1.Width - 10);
34+
}
35+
36+
private void DragDrop_GetFiles(DragEventArgs e)
37+
{
38+
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
39+
Array.Sort(files);
40+
imgs.Images.Clear();
41+
curr_img = 0;
42+
foreach (string img_path in files)
43+
{
44+
imgs.Images.Add(Image.FromFile(img_path));
45+
}
46+
47+
listView1.SmallImageList = imgs;
48+
listView1.Items.Clear();
49+
//listView1.Items.Add("first image", 0);
50+
for (int i = 0; i < files.Length; i++)
51+
{
52+
listView1.Items.Add(files[i].ToString(), i);
53+
}
54+
/*foreach (ListViewItem item in listView1.Items)
55+
{
56+
MessageBox.Show(item.ToString());
57+
}*/
58+
pictureBox1.Image = Image.FromFile(listView1.Items[curr_img].Text);
59+
}
60+
61+
private void listView1_DragEnter(object sender, DragEventArgs e)
62+
{
63+
if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.Copy;
64+
}
65+
66+
private void listView1_DragDrop(object sender, DragEventArgs e)
67+
{
68+
DragDrop_GetFiles(e);
69+
}
70+
71+
//next image preview
72+
private void button3_Click(object sender, EventArgs e)
73+
{
74+
if (curr_img + 1 < listView1.Items.Count)
75+
{
76+
curr_img++;
77+
pictureBox1.Image = Image.FromFile(listView1.Items[curr_img].Text);
78+
}
79+
else
80+
{
81+
curr_img = 0;
82+
pictureBox1.Image = Image.FromFile(listView1.Items[curr_img].Text);
83+
}
84+
}
85+
86+
//previus image preview
87+
private void button2_Click(object sender, EventArgs e)
88+
{
89+
if (curr_img - 1 >= 0)
90+
{
91+
curr_img--;
92+
pictureBox1.Image = Image.FromFile(listView1.Items[curr_img].Text);
93+
}
94+
else
95+
{
96+
curr_img = listView1.Items.Count - 1;
97+
pictureBox1.Image = Image.FromFile(listView1.Items[curr_img].Text);
98+
}
99+
}
100+
101+
private void button1_Click(object sender, EventArgs e)
102+
{
103+
//copy each images into temporary folder
104+
DirectoryInfo di = new DirectoryInfo(".\\images\\");
105+
foreach (FileInfo file in di.GetFiles())
106+
{
107+
file.Delete();
108+
}
109+
foreach (ListViewItem element in listView1.Items)
110+
{
111+
File.Copy(element.Text, ".\\images\\" + element.Index.ToString() + ".jpg", true);
112+
}
113+
if (File.Exists("settings.txt"))
114+
{
115+
File.Delete("settings.txt");
116+
}
117+
if (textBox1.Text == null || !int.TryParse(textBox1.Text, out int value))
118+
{
119+
File.WriteAllText("settings.txt", "1");
120+
}
121+
else
122+
{
123+
File.WriteAllText("settings.txt", textBox1.Text);
124+
}
125+
System.Diagnostics.Process proc = new System.Diagnostics.Process();
126+
if (checkBox1.Checked)
127+
{
128+
proc.StartInfo.FileName = "ToGIFHQ.bat";
129+
}
130+
else
131+
{
132+
proc.StartInfo.FileName = "ToGIF.bat";
133+
}
134+
proc.Start();
135+
}
136+
}
137+
}

0 commit comments

Comments
 (0)