forked from CANKOLCAK/SmartRender
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMedia_Sign.cs
More file actions
131 lines (121 loc) · 4.31 KB
/
Media_Sign.cs
File metadata and controls
131 lines (121 loc) · 4.31 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using SmartRender.Render;
using System.Diagnostics;
using SmartRender.MainClass;
using System.IO;
using System.Threading;
using System;
namespace SmartRender
{
public partial class Media_Sign : Form
{
int _index = 0;
public Media_Sign()
{
InitializeComponent();
WorkList.Columns[0].Width = WorkList.Width - 105;
}
private void WorkList_DragEnter(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.All;
}
private void WorkList_DragDrop(object sender, DragEventArgs e)
{
String[] videos = (String[])e.Data.GetData(DataFormats.FileDrop);
foreach (string video in videos)
{
Video._addF(video, WorkList);
}
}
public void Apply_Completing(object sender, EventArgs e)
{
if(_index != WorkList.Items.Count -1)
{
_index++;
thr = new Thread(Imzala);
thr.Start();
}
else
{
timer1.Stop();
BeginInvoke(new Action(() => info.Text = string.Format("Devam Ediyor.. {1}/{1}", _index, WorkList.Items.Count)));
SendMessage.Success(Messages.MSG_14[Language.ViewingLanguage], "Success");
}
}
public void Imzala()
{
string dosya = WorkList.Items[_index].Text;
string dosya_adi = Path.GetFileName(WorkList.Items[_index].Text);
string klasor = t1.Text;
ProcessStartInfo s = new ProcessStartInfo
{
RedirectStandardError = true,
UseShellExecute = false,
LoadUserProfile = true,
CreateNoWindow = true,
FileName = Variables.FFMPEG,
Arguments = string.Format(@"-y -i ""{0}"" -codec:v libx264 ""{1}/_{2}""",dosya,klasor,dosya_adi)
};
Process p = new Process { StartInfo = s };
p.EnableRaisingEvents = true;
p.Exited += new EventHandler(Apply_Completing);
if (p.Start())
{
p.Refresh();
StreamReader testReader = p.StandardError;
while (testReader.ReadLine() != null)
{
try
{
string satir = testReader.ReadLine().Substring(0, 6);
if (satir == "frame=")
{
/*int t_index = testReader.ReadLine().IndexOf("time=");
string saniye = testReader.ReadLine().Substring(t_index + 5, 8);
double seconds = TimeSpan.Parse(saniye).TotalSeconds;
double toplam = TimeSpan.Parse(total.Text).TotalSeconds;
double process = (seconds / toplam) * 100;
string normal = process.ToString().Substring(0, process.ToString().IndexOf(","));
Console.WriteLine("%{0}", normal);
Application.DoEvents();*/
}
}
catch (Exception ex)
{
}
}
}
else
{ Console.WriteLine("Error"); }
}
Thread thr;
private void purpleButton1_Click(object sender, EventArgs e)
{
if (Directory.Exists(t1.Text))
{
thr = new Thread(Imzala);
thr.Start();
timer1.Start();
}
else
{
SendMessage.Success("Çıktı Klasörünün Var Olduğundan Emin Olun","Warning");
}
}
private void timer1_Tick(object sender, EventArgs e)
{
info.Text = string.Format("Devam Ediyor.. {0}/{1}",_index,WorkList.Items.Count);
}
private void selectfolder_Click(object sender, EventArgs e)
{
FolderBrowserDialog fd = new FolderBrowserDialog();
if(fd.ShowDialog() == DialogResult.OK)
{ t1.Text = fd.SelectedPath; }
}
}
}