pragma once namespace PlaymdDownloader using namespace System using na

  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
#pragma once
namespace PlaymdDownloader {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Сводка для Form1
///
/// Внимание! При изменении имени этого класса необходимо также изменить
/// свойство имени файла ресурсов ("Resource File Name") для средства компиляции управляемого ресурса,
/// связанного со всеми файлами с расширением .resx, от которых зависит данный класс. В противном случае,
/// конструкторы не смогут правильно работать с локализованными
/// ресурсами, сопоставленными данной форме.
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: добавьте код конструктора
//
}
protected:
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::TextBox^ videoURL;
private: System::Windows::Forms::CheckBox^ aviconvert;
private: System::Windows::Forms::CheckBox^ anonimDownload;
protected:
protected:
private: System::Windows::Forms::Label^ copyrightText;
private: System::Windows::Forms::ProgressBar^ downloadProgressBar;
private: System::Windows::Forms::Button^ downloadButton;
private:
/// <summary>
/// Требуется переменная конструктора.
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Обязательный метод для поддержки конструктора - не изменяйте
/// содержимое данного метода при помощи редактора кода.
/// </summary>
void InitializeComponent(void)
{
this->videoURL = (gcnew System::Windows::Forms::TextBox());
this->aviconvert = (gcnew System::Windows::Forms::CheckBox());
this->anonimDownload = (gcnew System::Windows::Forms::CheckBox());
this->copyrightText = (gcnew System::Windows::Forms::Label());
this->downloadProgressBar = (gcnew System::Windows::Forms::ProgressBar());
this->downloadButton = (gcnew System::Windows::Forms::Button());
this->SuspendLayout();
//
// videoURL
//
this->videoURL->Location = System::Drawing::Point(13, 13);
this->videoURL->Name = L"videoURL";
this->videoURL->Size = System::Drawing::Size(262, 20);
this->videoURL->TabIndex = 0;
//
// aviconvert
//
this->aviconvert->AutoSize = true;
this->aviconvert->Location = System::Drawing::Point(13, 40);
this->aviconvert->Name = L"aviconvert";
this->aviconvert->Size = System::Drawing::Size(95, 17);
this->aviconvert->TabIndex = 1;
this->aviconvert->Text = L"Convert to AVI";
this->aviconvert->UseVisualStyleBackColor = true;
//
// anonimDownload
//
this->anonimDownload->AutoSize = true;
this->anonimDownload->Location = System::Drawing::Point(13, 64);
this->anonimDownload->Name = L"anonimDownload";
this->anonimDownload->Size = System::Drawing::Size(127, 17);
this->anonimDownload->TabIndex = 2;
this->anonimDownload->Text = L"Anonimous download";
this->anonimDownload->UseVisualStyleBackColor = true;
//
// copyrightText
//
this->copyrightText->AutoSize = true;
this->copyrightText->Font = (gcnew System::Drawing::Font(L"Arial", 8));
this->copyrightText->Location = System::Drawing::Point(10, 122);
this->copyrightText->Name = L"copyrightText";
this->copyrightText->Size = System::Drawing::Size(162, 14);
this->copyrightText->TabIndex = 4;
this->copyrightText->Text = L"© Barttos — All rights reserved.";
//
// downloadProgressBar
//
this->downloadProgressBar->Location = System::Drawing::Point(13, 88);
this->downloadProgressBar->Name = L"downloadProgressBar";
this->downloadProgressBar->Size = System::Drawing::Size(262, 23);
this->downloadProgressBar->TabIndex = 5;
//
// downloadButton
//
this->downloadButton->Location = System::Drawing::Point(200, 117);
this->downloadButton->Name = L"downloadButton";
this->downloadButton->Size = System::Drawing::Size(75, 23);
this->downloadButton->TabIndex = 6;
this->downloadButton->Text = L"Download";
this->downloadButton->UseVisualStyleBackColor = true;
this->downloadButton->Click += gcnew System::EventHandler(this, &Form1::downloadButton_Click);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(287, 148);
this->Controls->Add(this->downloadButton);
this->Controls->Add(this->downloadProgressBar);
this->Controls->Add(this->copyrightText);
this->Controls->Add(this->anonimDownload);
this->Controls->Add(this->aviconvert);
this->Controls->Add(this->videoURL);
this->MaximumSize = System::Drawing::Size(303, 184);
this->MinimumSize = System::Drawing::Size(303, 184);
this->Name = L"Form1";
this->Opacity = 0.95;
this->ShowIcon = false;
this->Text = L"Play.md download";
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::String^ url;
private: System::String^ tempUrl;
private: System::String^ finalUrl;
private: System::Int64 is_good;
private: System::Void downloadButton_Click(System::Object^ sender, System::EventArgs^ e) {
url = this->videoURL->Text;
is_good = System::String::Compare(url, "http://play.md/");
if (is_good < 1) {
System::Windows::Forms::MessageBox::Show("Please insert proper URL!", "URL Error", MessageBoxButtons::OK, MessageBoxIcon::Exclamation);
} else {
//Prepare url for download
//http://play.md/video/f2fa9b93-3c19-4f94-9857-e77b53faab96
finalUrl = url->Substring(21);
finalUrl = '1' + finalUrl;
System::Windows::Forms::MessageBox::Show(finalUrl, "URL Error", MessageBoxButtons::OK, MessageBoxIcon::Exclamation);
}
}
};
}