public static OutputLocation CreateFromString(string OutputLocationString) { //Decode String string path = ""; OutputLocation ol = new OutputLocation(OutputType.File_Location, ""); OutputType ot = OutputType.File_Location; if (OutputLocationString.Substring(0, "##".Length) == "L#") { path = OutputLocationString.Substring("##".Length); ol.Type = OutputType.File_Location; } else { path = OutputLocationString.Substring(OutputLocationString.IndexOf(";") + 1); ol.Type = OutputType.FTP; string usr = ""; string pas = ""; foreach (char thisChar in OutputLocationString.Substring("F#".Length)) { if (thisChar != '@') { usr += thisChar.ToString(); } else { break; } } foreach (char thisChar in OutputLocationString.Substring("F#".Length + usr.Length + 1, OutputLocationString.IndexOf(';') + 1)) { if (thisChar != ';') { pas += thisChar.ToString(); } else { break; } } ol.creds = new NetworkCredential(usr, pas); } ol.Path = path; //ol.Type = ot; return(ol); }
public Output_Designer(string code) { InitializeComponent(); ol = OutputLocation.CreateFromString(code); tb_path.Text = ol.Path; if (ol.Type == OutputLocation.OutputType.File_Location) { rb_folder.Checked = true; } else { rb_ftp.Checked = true; gb_login.Visible = true; try { tb_pass.Text = ol.creds.Password; tb_user.Text = ol.creds.UserName; } catch { } } }
void DoConvert(object sender, EventArgs e) { int intCode = 0; if (rb_youtube.Checked) { switch (cb_singleType.SelectedItem.ToString()) { case "Audio": intCode = 0; break; case "Video": intCode = 1; break; case "Mixed": intCode = 2; break; } List <OutputLocation> ols = new List <OutputLocation>(); foreach (string code in listBox2.Items) { ols.Add(OutputLocation.CreateFromString(code)); } GetMediaFromYoutube(l_youtubepath.Text, intCode, ols.ToArray()); } else { //Load YPS File try { BinaryFormatter bin = new BinaryFormatter(); using (FileStream s = File.OpenRead(l_filepath.Text)) { List <InputSource> fileSorces = bin.Deserialize(s) as List <InputSource>; foreach (InputSource source in fileSorces) { int typeCode = 0; List <OutputLocation> ols = new List <OutputLocation>(); foreach (string code in listBox2.Items) { ols.Add(OutputLocation.CreateFromString(code)); } //Get typeCode from source enum switch (source.ExportAs) { case InputSource.SaveType.Audio: typeCode = 0; break; case InputSource.SaveType.Video: typeCode = 1; break; case InputSource.SaveType.Mixed: typeCode = 2; break; } LogInfo($"Starting work on \'{source.Url}\'"); GetMediaFromYoutube(source.Url, typeCode, ols.ToArray()); } } } catch (Exception ex) { LogInfo(ex.ToString()); } } }
public Output_Designer() { InitializeComponent(); ol = new OutputLocation(OutputLocation.OutputType.File_Location, Environment.GetFolderPath(Environment.SpecialFolder.Desktop)); }