-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathve-1B4.tmp
executable file
·481 lines (442 loc) · 16.4 KB
/
ve-1B4.tmp
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using CristiPotlog.Controls;
using Transcode;
using System.Collections;
using ImportManager;
using System.Configuration;
using System.Threading;
using System.Runtime.Remoting.Messaging;
using zbutt;
namespace zbutt
{
public partial class formMain : Form
{
private Thread myThread;
private string globalFileName;
private iController icon = new iController();
public const int HT_CAPTION = 0x2;
[DllImportAttribute("user32.dll")]
public static extern int SendMessage(IntPtr hWnd,
int Msg, int wParam, int lParam);
[DllImportAttribute("user32.dll")]
public static extern bool ReleaseCapture();
public const int WM_NCLBUTTONDOWN = 0xA1;
public formMain()
{
//icon.assign(this);
InitializeComponent();
}
public void miceMove()
{
ReleaseCapture();
SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
}
/// <summary>
/// Rtf
/// </summary>
private void rtf_SelectFile()
{
openFileDialog1.Filter = "Rich Text Format (*.rtf)|*.rtf";
if (icon.checkVersion())
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
globalFileName = openFileDialog1.FileName;
rtfloading.Active = true;
btnSelectRtf.Enabled = false;
if (openFileDialog1.FileNames.Length > 1)
{
RTFFileNames = openFileDialog1.FileNames;
lstRtfFont.Items.Clear();
RTFFileLoadDel dg = new RTFFileLoadDel(RTFFilesLoad);
dg.BeginInvoke(openFileDialog1.FileNames, RTFLoadFin, null);
GenericEncodingFramework gef = new GenericEncodingFramework();
if (!gef.loaded)
gef.Load();
enclist.Items.Clear();
enclist.Items.Add("No Action");
foreach (TEncoding t in gef.getEncodings())
enclist.Items.Add(t.getFrom());
}
else
{
RTFFileNames = openFileDialog1.FileNames;
pageRtf2Load();
}
}
}
}
private delegate void RTFFileLoadDel(String[] p);
private void RTFFilesLoad(string[] p)
{
RichTextParser rtp = new RichTextParser();
RTFFileFonts = new ArrayList();
fltran = new ArrayList();
for (int i = 0; i < p.Length; i++)
{
ArrayList al = rtp.GetFonts(p[i]);
RTFFileFonts.Add(al);
foreach (String s in al)
{
MethodInvoker mi = delegate
{
if (!FileExists(s))
{
fltran.Add(Transcode.Transcode.isTo(s));
lstRtfFont.Items.Add(s);
}
};
lstRtfFont.Invoke(mi);
}
}
}
private void RTFLoadFin(IAsyncResult ar)
{
AsyncResult result = (AsyncResult)ar;
MethodInvoker fin = delegate
{
rtfloading.Active = false;
loadword.Active = false;
btnSelectRtf.Enabled = true;
btnSelectWord.Enabled = true;
wizard1.gotoPage(2);
};
wizard1.Invoke(fin);
}
private ArrayList RTFFileFonts;
private bool FileExists(String font)
{
foreach (String s in lstRtfFont.Items)
{
if (s == font)
return true;
}
return false;
}
private ArrayList fltran;
private String output;
private void rtfConvert()
{
iController.start_transcode(globalFileName,fltran,output);
}
/// <summary>
/// Word
/// </summary>
private void word_Selectfile()
{
openFileDialog1.Filter = "Microsoft Word (*.doc;*.docx)|*.doc;*.docx";
if (icon.checkVersion())
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
btnSelectWord.Enabled = false;
loadword.Active = true;
if (openFileDialog1.FileNames.Length > 1)
{
WordFilesDel WFD = new WordFilesDel(Words2rtf);
WFD.BeginInvoke(openFileDialog1.FileNames, null, null);
}
else
{
globalFileName = openFileDialog1.FileName;
RTFFileNames = openFileDialog1.FileNames;
word2rtf(globalFileName);
}
}
}
}
private delegate void WordFilesDel(string[] filenames);
private string[] RTFFileNames;
private void Words2rtf(string[] filenames)
{
for (int i = 0; i < filenames.Length; i++)
{
formatConvert.iConverter FC = new formatConvert.iConverter(filenames[i], "rtf");
filenames[i] = filenames[i].Substring(0, filenames[i].LastIndexOf('.')) + ".rtf";
FC.convert();
}
RTFFileNames = filenames;
lstRtfFont.Items.Clear();
RTFFileLoadDel dg = new RTFFileLoadDel(RTFFilesLoad);
dg.BeginInvoke(filenames, RTFLoadFin, null);
GenericEncodingFramework gef = new GenericEncodingFramework();
if (!gef.loaded)
gef.Load();
enclist.Items.Clear();
enclist.Items.Add("No Action");
foreach (TEncoding t in gef.getEncodings())
enclist.Items.Add(t.getFrom());
}
private void word2rtf(string fileName)
{
formatConvert.iConverter formCov = new formatConvert.iConverter(fileName, "rtf");
MethodInvoker mk = new MethodInvoker(formCov.convert);
mk.BeginInvoke(new AsyncCallback(CallWordFinished),null);
//formCov.convert();
}
private void CallWordFinished(IAsyncResult ar)
{
AsyncResult result = (AsyncResult)ar;
MethodInvoker del = (MethodInvoker)result.AsyncDelegate;
string wordfilename = globalFileName.Substring(0, globalFileName.IndexOf('.'));
globalFileName = wordfilename + ".rtf";
pageRtf2Load();
}
private delegate ArrayList DelGetFons(String fname);
private DelGetFons dgf;
private void pageRtf2Load()
{
lstRtfFont.Items.Clear();
RichTextParser rtp = new RichTextParser();
dgf = new DelGetFons(rtp.GetFonts);
IAsyncResult a = dgf.BeginInvoke(globalFileName,new AsyncCallback(CallBack),null);
}
private void CallBack(IAsyncResult ar)
{
AsyncResult result = (AsyncResult)ar;
DelGetFons del =
(DelGetFons)result.AsyncDelegate;
ArrayList al = del.EndInvoke(ar);
fltran = new ArrayList();
MethodInvoker updatePages = delegate
{
foreach (String s in al)
{
fltran.Add(Transcode.Transcode.isTo(s));
lstRtfFont.Items.Add(s);
}
GenericEncodingFramework gef = new GenericEncodingFramework();
gef.Load();
enclist.Items.Clear();
enclist.Items.Add("No Action");
foreach (TEncoding te in gef.getEncodings())
{
enclist.Items.Add(te.getFrom());
}
rtfloading.Active = false;
loadword.Active = false;
btnSelectRtf.Enabled = true;
btnSelectWord.Enabled = true;
wizard1.gotoPage(2);
};
if (lstRtfFont.InvokeRequired)
{
this.Invoke(updatePages);
}
else
{
updatePages.Invoke();
}
}
private void wordConvert()
{
//?? icon.start_transcode(globalFileName,fltran);
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void pageWelcome_MouseDown(object sender, MouseEventArgs e)
{
miceMove();
}
private int RTFfindTranValue(String fontname)
{
for (int i = 0; i < lstRtfFont.Items.Count; i++)
{
if (fontname == lstRtfFont.Items[i].ToString())
return (int)fltran[i];
}
return -1;
}
private void btnRtfTrans_Click(object sender, EventArgs e)
{
if (RTFFileNames.Length > 1)
{
FolderBrowserDialog fbd = new FolderBrowserDialog();
fbd.SelectedPath = System.IO.Directory.GetCurrentDirectory();
if (fbd.ShowDialog() == DialogResult.OK)
{
MethodInvoker mk = delegate
{
for (int i = 0; i < RTFFileFonts.Count; i++)
{
ArrayList Fonts = (ArrayList)RTFFileFonts[i];
ArrayList FonTran = new ArrayList();
for (int j = 0; j < Fonts.Count; j++)
{
FonTran.Add(RTFfindTranValue(Fonts[j].ToString()));
}
string orgfile = RTFFileNames[i];
string file = orgfile.Substring(orgfile.LastIndexOf('\\'));
output = fbd.SelectedPath+ "\\" + file + ".txt";
iController.start_transcode(orgfile, FonTran, output);
}
};
loadingRtfCircle.Active = true;
mk.BeginInvoke(FinSaveRTFs, null);
}
}
else
{
saveFileDialog1.DefaultExt = ".txt";
saveFileDialog1.FileName = globalFileName.Substring(0, globalFileName.Length - 3) + "txt";
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
output = saveFileDialog1.FileName;
loadingRtfCircle.Active = true;
timerRtf.Enabled = true;
myThread = new Thread(new ThreadStart(rtfConvert));
myThread.IsBackground = true;
myThread.Priority = ThreadPriority.Lowest;
myThread.Start();
}
}
}
private void FinSaveRTFs(IAsyncResult ar)
{
MethodInvoker mk = delegate
{
loadingRtfCircle.Active = false;
wizard1.gotoPage(8);
};
wizard1.Invoke(mk);
}
private void btnSelectRtf_Click(object sender, EventArgs e)
{
rtf_SelectFile();
}
private void btnSelectWord_Click(object sender, EventArgs e)
{
word_Selectfile();
}
private void btnWordTrans_Click(object sender, EventArgs e)
{
loadingWordCircle.Active = true;
myThread = new Thread(new ThreadStart(wordConvert));
myThread.Start();
preloadrtf.Enabled = true;
}
private void btnRtf_Click(object sender, EventArgs e)
{
wizard1.gotoPage(1);
}
private void btnWord_Click(object sender, EventArgs e)
{
wizard1.gotoPage(3);
}
private void formMain_Load(object sender, EventArgs e)
{
}
private void timerRtf_Tick(object sender, EventArgs e)
{
if (myThread.IsAlive)
loadingRtfCircle.Active = true;
else
{
loadingRtfCircle.Active = false;
wizard1.gotoPage(8);
timerRtf.Enabled = false;
}
}
private void timerWord_Tick(object sender, EventArgs e)
{
if (myThread.IsAlive)
loadingWordCircle.Active = true;
else
{
loadingWordCircle.Active = false;
preloadrtf.Enabled = false;
}
}
private void pageRtf_Click(object sender, EventArgs e)
{
}
private void lstRtfFont_SelectedIndexChanged(object sender, EventArgs e)
{
if (lstRtfFont.SelectedIndex != -1)
{
enclist.SelectedIndex = (int)fltran[lstRtfFont.SelectedIndex] + 1;
}
}
private void enclist_SelectedIndexChanged(object sender, EventArgs e)
{
if (enclist.SelectedIndex != -1 && lstRtfFont.SelectedIndex != -1)
fltran[lstRtfFont.SelectedIndex] = enclist.SelectedIndex - 1;
}
private void glassButton1_Click(object sender, EventArgs e)
{
wizard1.gotoPage(0);
}
private void btnText_Click(object sender, EventArgs e)
{
ArrayList al = SQLParser.FetchColumns("INSERT INTO `dl_lnk` (`id`, `f_id`, `link`, `country`, `downed`) VALUES (20, 12, 'http://www.mymyanmar.net/font.zip', 'iHost', 0),");
foreach (string s in al)
MessageBox.Show(s);
}
private void btnSql_Click(object sender, EventArgs e)
{
wizard1.gotoPage(4);
}
private void glassButton2_Click(object sender, EventArgs e)
{
openFileDialog1.Filter = "SQL Dump File (*.sql)|*.sql";
openFileDialog1.Multiselect = false;
if (icon.checkVersion())
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
sqlloadbtn.Enabled = false;
sqlcircle.Active = true;
LoadSQLFile(openFileDialog1.FileName);
}
}
openFileDialog1.Multiselect = true;
}
private void LoadSQLFile(string p)
{
LoadSQLDel dl = new LoadSQLDel(SQLParser.getTables);
dl.BeginInvoke(p,SQLLoadCallBack,null);
}
private delegate ArrayList LoadSQLDel(string p);
private ArrayList SQLTables;
private void SQLLoadCallBack(IAsyncResult ar)
{
AsyncResult result = (AsyncResult)ar;
LoadSQLDel del =
(LoadSQLDel)result.AsyncDelegate;
SQLTables = del.EndInvoke(ar);
MethodInvoker mk = delegate
{
foreach (TSQLTable s in SQLTables)
{
lstsqltables.Items.Add(s.getname());
}
sqlloadbtn.Enabled = true;
sqlcircle.Active = false;
wizard1.gotoPage(6);
};
lstsqltables.Invoke(mk);
}
private void lstsqltables_SelectedIndexChanged(object sender, EventArgs e)
{
if (lstsqltables.SelectedIndex != -1)
{
sqlcols.Items.Clear();
TSQLTable t = (TSQLTable)SQLTables[lstsqltables.SelectedIndex];
foreach (String s in t.getcols())
{
sqlcols.Items.Add(s);
}
}
}
}
}