Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <vector>
- #include <iostream>
- #include <string>
- #include <msclr\marshal_cppstd.h>
- #define WINVER 0x0600
- #define _WIN32_WINNT 0x0600
- #include <windows.h>
- #pragma once
- namespace SymlinkGenerator {
- 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>
- /// Zusammenfassung für MyForm
- /// </summary>
- public ref class MyForm : public System::Windows::Forms::Form
- {
- public:
- MyForm(void)
- {
- InitializeComponent();
- //
- //TODO: Konstruktorcode hier hinzufügen.
- //
- }
- protected:
- /// <summary>
- /// Verwendete Ressourcen bereinigen.
- /// </summary>
- ~MyForm()
- {
- if (components)
- {
- delete components;
- }
- }
- private: String^ sSourcePath;
- private: System::Windows::Forms::Button^ btnCreateSymlinks;
- private: System::Windows::Forms::Label^ lblInfo;
- String^ sDestinationPath;
- public: void SetSourcePath(String^ a) {
- sSourcePath = a;
- }
- public: void SetDestinationPath(String^ a) {
- sDestinationPath = a;
- }
- public: String^ GetSourcePath() {
- return sSourcePath;
- }
- public: String^ GetDestinationPath() {
- return sDestinationPath;
- }
- private: System::Windows::Forms::Button^ btnSourcePath;
- protected:
- private: System::Windows::Forms::Label^ lblSourcePath;
- private: System::Windows::Forms::Button^ btnDestinationPath;
- private: System::Windows::Forms::Label^ lblDestinationPath;
- private:
- /// <summary>
- /// Erforderliche Designervariable.
- /// </summary>
- System::ComponentModel::Container ^components;
- #pragma region Windows Form Designer generated code
- /// <summary>
- /// Erforderliche Methode für die Designerunterstützung.
- /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
- /// </summary>
- void InitializeComponent(void)
- {
- this->btnSourcePath = (gcnew System::Windows::Forms::Button());
- this->lblSourcePath = (gcnew System::Windows::Forms::Label());
- this->btnDestinationPath = (gcnew System::Windows::Forms::Button());
- this->lblDestinationPath = (gcnew System::Windows::Forms::Label());
- this->btnCreateSymlinks = (gcnew System::Windows::Forms::Button());
- this->lblInfo = (gcnew System::Windows::Forms::Label());
- this->SuspendLayout();
- //
- // btnSourcePath
- //
- this->btnSourcePath->Location = System::Drawing::Point(394, 48);
- this->btnSourcePath->Name = L"btnSourcePath";
- this->btnSourcePath->Size = System::Drawing::Size(192, 53);
- this->btnSourcePath->TabIndex = 0;
- this->btnSourcePath->Text = L"Source Path";
- this->btnSourcePath->UseVisualStyleBackColor = true;
- this->btnSourcePath->Click += gcnew System::EventHandler(this, &MyForm::btnSourcePath_Click);
- //
- // lblSourcePath
- //
- this->lblSourcePath->AutoSize = true;
- this->lblSourcePath->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D;
- this->lblSourcePath->Location = System::Drawing::Point(49, 68);
- this->lblSourcePath->Name = L"lblSourcePath";
- this->lblSourcePath->Size = System::Drawing::Size(2, 15);
- this->lblSourcePath->TabIndex = 1;
- //
- // btnDestinationPath
- //
- this->btnDestinationPath->Location = System::Drawing::Point(394, 147);
- this->btnDestinationPath->Name = L"btnDestinationPath";
- this->btnDestinationPath->Size = System::Drawing::Size(192, 53);
- this->btnDestinationPath->TabIndex = 2;
- this->btnDestinationPath->Text = L"Destination Path";
- this->btnDestinationPath->UseVisualStyleBackColor = true;
- this->btnDestinationPath->Click += gcnew System::EventHandler(this, &MyForm::btnDestinationPath_Click);
- //
- // lblDestinationPath
- //
- this->lblDestinationPath->AutoSize = true;
- this->lblDestinationPath->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D;
- this->lblDestinationPath->Location = System::Drawing::Point(49, 167);
- this->lblDestinationPath->Name = L"lblDestinationPath";
- this->lblDestinationPath->Size = System::Drawing::Size(2, 15);
- this->lblDestinationPath->TabIndex = 3;
- //
- // btnCreateSymlinks
- //
- this->btnCreateSymlinks->Location = System::Drawing::Point(94, 251);
- this->btnCreateSymlinks->Name = L"btnCreateSymlinks";
- this->btnCreateSymlinks->Size = System::Drawing::Size(433, 100);
- this->btnCreateSymlinks->TabIndex = 4;
- this->btnCreateSymlinks->Text = L"Symlinks erstellen...";
- this->btnCreateSymlinks->UseVisualStyleBackColor = true;
- this->btnCreateSymlinks->Click += gcnew System::EventHandler(this, &MyForm::btnCreateSymlinks_Click);
- //
- // lblInfo
- //
- this->lblInfo->AutoSize = true;
- this->lblInfo->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D;
- this->lblInfo->Location = System::Drawing::Point(49, 387);
- this->lblInfo->Name = L"lblInfo";
- this->lblInfo->Size = System::Drawing::Size(2, 15);
- this->lblInfo->TabIndex = 5;
- //
- // MyForm
- //
- this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
- this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
- this->ClientSize = System::Drawing::Size(638, 448);
- this->Controls->Add(this->lblInfo);
- this->Controls->Add(this->btnCreateSymlinks);
- this->Controls->Add(this->lblDestinationPath);
- this->Controls->Add(this->btnDestinationPath);
- this->Controls->Add(this->lblSourcePath);
- this->Controls->Add(this->btnSourcePath);
- this->Name = L"MyForm";
- this->Text = L"Symlink Generator";
- this->Load += gcnew System::EventHandler(this, &MyForm::MyForm_Load);
- this->ResumeLayout(false);
- this->PerformLayout();
- }
- #pragma endregion
- private: System::Void btnSourcePath_Click(System::Object^ sender, System::EventArgs^ e) {
- FolderBrowserDialog^ SourceFolderDialog;
- SourceFolderDialog = gcnew System::Windows::Forms::FolderBrowserDialog;
- System::Windows::Forms::DialogResult result = SourceFolderDialog->ShowDialog();
- if (result == System::Windows::Forms::DialogResult::OK)
- {
- String^ path = SourceFolderDialog->SelectedPath;
- SetSourcePath(path);
- lblSourcePath->Text = path;
- }
- }
- private: System::Void btnDestinationPath_Click(System::Object^ sender, System::EventArgs^ e) {
- FolderBrowserDialog^ DestinationFolderDialog;
- DestinationFolderDialog = gcnew System::Windows::Forms::FolderBrowserDialog;
- System::Windows::Forms::DialogResult result = DestinationFolderDialog->ShowDialog();
- if (result == System::Windows::Forms::DialogResult::OK)
- {
- String^ path = DestinationFolderDialog->SelectedPath;
- SetDestinationPath(path);
- lblDestinationPath->Text = path;
- }
- }
- private: System::Void MyForm_Load(System::Object^ sender, System::EventArgs^ e) {
- }
- private: System::Void btnCreateSymlinks_Click(System::Object^ sender, System::EventArgs^ e) {
- String^ pathSource = GetSourcePath();
- String^ pathDest = GetDestinationPath();
- String^ folder = System::IO::Path::GetFileName(pathSource);
- lblInfo->Text = pathSource + " -> " + pathDest + "" + folder;
- }
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement