-
Notifications
You must be signed in to change notification settings - Fork 0
/
DecodeForm.cs
86 lines (74 loc) · 2.25 KB
/
DecodeForm.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using RestSharp;
namespace ImageSteganoApp
{
public partial class DecodeForm : Form
{
RestClient client = new RestClient("https://gkwebsite.herokuapp.com/");
string key = "";
bool image_given = false;
string image_name = "";
public DecodeForm()
{
InitializeComponent();
}
private void label1_Click(object sender, EventArgs e)
{
}
private void MessageBox_TextChanged(object sender, EventArgs e) //keybox
{
key = MessageBox.Text;
}
private void button2_Click(object sender, EventArgs e) //submit
{
RestRequest request = new RestRequest("api/decode");
if (image_given)
{
request.AddFile("photo_upload", image_name);
request.AddQueryParameter("key", key);
string filePath = "Decodedmessage.txt";
var writer = File.OpenWrite(filePath);
request.ResponseWriter = responseStream =>
{
using (responseStream)
{
responseStream.CopyTo(writer);
}
};
var response = client.Post(request);
writer.Close();
}
}
private void button1_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
image_name = openFileDialog1.FileName;
Console.WriteLine(image_name);
image_given = true;
}
}
private void openFileDialog1_FileOk(object sender, CancelEventArgs e)
{
}
private void tableLayoutPanel1_Paint(object sender, PaintEventArgs e)
{
}
private void button4_Click(object sender, EventArgs e)
{
MainForm mForm = new MainForm();
this.Hide();
mForm.ShowDialog();
this.Close();
}
}
}