-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.cpp
More file actions
130 lines (111 loc) · 3.36 KB
/
Main.cpp
File metadata and controls
130 lines (111 loc) · 3.36 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
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Main.h"
#include "Decoding/OGG_Decod.h"
#include "Encoding/OGG_Encoding.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
OGG_Decoder file_1;
OGG_Encoding file_2;
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
Button4->Enabled=false;
Button5->Enabled=false;
Button1->Enabled=false;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
ListBox1->Clear();
RichEdit1->Clear();
if(OpenDialog1->Execute())
{
try
{
if(file_1.f_open!=NULL)
{
fclose(file_1.f_open);
file_1.ov_clear(&file_1.vf);
}
}
catch(...){};
is_open=file_1.Open(OpenDialog1->FileName.c_str());
Button1->Enabled=true;
if(!is_open)
{
Application->MessageBoxA("Ôîðìàò ôàéëà íå ñîâïàäàåò ñ *.ogg","Îøèáêà");
Application->Terminate();
}
Edit1->Text=OpenDialog1->FileName;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ListBox1Click(TObject *Sender)
{
int number=ListBox1->ItemIndex;
RichEdit1->Lines->Clear();
//char *C=new char [file_1.header_com.razmer_com[number]+1];
char *C=file_1.header_com.dannye_com[number];
C[file_1.header_com.razmer_com[number]]='\0';
char *C2=strtok(C, "=");
int strl=strlen(C2);
RichEdit1->Lines->Text=AnsiString(C+strl+1);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
if(SaveDialog1->Execute())
{
ProgressBar1->Position=0;
file_1.Decoder(SaveDialog1->FileName.c_str());
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
if(OpenDialog2->Execute())
{
if(file_2.tfile_in.size!=0)
file_2.tfile_in.Close();
if(!file_2.Open(OpenDialog2->FileName.c_str()))
{
Application->MessageBoxA("Ôàéë, êîòîðûé âû õîòèòå êîäèðîâàòü \n ÿâëÿåòñÿ íå ôàéëîì ôîðìàòà .WAV", "Îøèáêà");
return;
}
LabeledEdit5->Text=OpenDialog2->FileName;
Button4->Enabled=false;
Button5->Enabled=true;
file_2.add_kod=false;
ProgressBar1->Enabled=true;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button4Click(TObject *Sender)
{
if(SaveDialog2->Execute())
{
ProgressBar1->Position=0;
file_2.tfile_in.Seek(0);
file_2.Encoding(SaveDialog2->FileName.c_str());
Button4->Enabled=false;
TrackBar1->Enabled=true;
//Button5->Enabled=false;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button5Click(TObject *Sender)
{
if(file_2.Add_comment(LabeledEdit6->Text.c_str(), RichEdit2->Text.c_str()))
{
LabeledEdit6->Clear();
RichEdit2->Clear();
Button4->Enabled=true;
ProgressBar1->Enabled=false;
}
}
//---------------------------------------------------------------------------