Skip to content

Commit

Permalink
partial release
Browse files Browse the repository at this point in the history
  • Loading branch information
theasern committed Oct 14, 2018
1 parent 800d977 commit ea649d4
Show file tree
Hide file tree
Showing 7 changed files with 3,268 additions and 3 deletions.
4 changes: 4 additions & 0 deletions YTDownloader/FodyWeavers.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?>
<Weavers>
<Costura />
</Weavers>
109 changes: 106 additions & 3 deletions YTDownloader/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions YTDownloader/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using VideoLibrary;

namespace YTDownloader
{
Expand All @@ -15,6 +17,41 @@ public partial class Form1 : Form
public Form1()
{
InitializeComponent();
var pathWithEnv = @"%USERPROFILE%\Videos\";
var path = Environment.ExpandEnvironmentVariables(pathWithEnv);
label2.Text = path;
}

public void button1_Click(object sender, EventArgs e)
{
var pathWithEnv = @"%USERPROFILE%\Videos";
var path = Environment.ExpandEnvironmentVariables(pathWithEnv);
using (var folderDialog = new FolderBrowserDialog())
{
if (folderDialog.ShowDialog() == DialogResult.OK)
{
path = folderDialog.SelectedPath;
label2.Text = path;
}
}
}

public void button2_Click(object sender, EventArgs e)
{
string path = label2.Text;
string link = textBox1.Text;
if (link == "Paste link here")
{
MessageBox.Show("Please input a youtube video URL");
}
else
{
var youTube = YouTube.Default; // starting point for YouTube actions
var video = youTube.GetVideo(link); // gets a Video object with info about the video
File.WriteAllBytes(path + @"\" + video.FullName, video.GetBytes());
MessageBox.Show("Downloaded!");
}

}
}
}
Loading

0 comments on commit ea649d4

Please sign in to comment.