
17.10.2009, 01:11
|
|
Познающий
Регистрация: 16.10.2009
Сообщений: 40
Провел на форуме: 152013
Репутация:
14
|
|
M3U Copying
Простенькая консольная программа для копирования музыки из M3U списка в заданную папку, полезна при необходимости выделения музыки из списка для дальнейшей обработки
Язык C#
Код:
using System; using System.Collections.Generic; using System.Text; using System.IO; namespace M3UCopyer { class Program { static void Main(string[] args) { string filePath; //Path to M3U File string collectionPath; //Path to end folder List<string> fNamesCol = new List<string>(); //File names int i = 0; //i string s = ""; //Temporary /*****************************************************************COPYRIGHT*************************************************************/ Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Green; Console.Write("======================================================"); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("-------"); System.Threading.Thread.Sleep(250); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(">>>>>>>>>>>>>"); System.Threading.Thread.Sleep(250); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine(); Console.WriteLine("|-----------------------COPYRIGHT (C) ICHECHEN-------------------------|"); System.Threading.Thread.Sleep(250); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Red; Console.Write("<<<<<<<<<<<<<"); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("-------"); System.Threading.Thread.Sleep(250); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("======================================================"); System.Threading.Thread.Sleep(250); Console.WriteLine(); /***************************************************************************************************************************************/ Console.WriteLine(); if (args.Length < 1) { Console.ForegroundColor = ConsoleColor.DarkYellow; Console.WriteLine("Please enter M3U file address: "); Console.ForegroundColor = ConsoleColor.Yellow; filePath = Console.ReadLine(); Console.ForegroundColor = ConsoleColor.DarkYellow; Console.WriteLine("Please enter path to you collection: "); collectionPath = Console.ReadLine(); try { StreamReader sr = new StreamReader(filePath, System.Text.Encoding.GetEncoding(1251)); /*******************************Extracting to fNameCol*******************************/ sr.ReadLine(); while (!sr.EndOfStream) { if (i == 1) { s = sr.ReadLine(); if (s.Substring(1, 1) != ":") { s = filePath.Substring(0, 3) + s; } fNamesCol.Add(s); i = 0; } else { sr.ReadLine(); i++; } } sr.Close();// /****************************************FILE COPY************************************/ if (fNamesCol.Count > 0) { FileInfo f; if (collectionPath.Substring(collectionPath.Length - 1, 1) != Convert.ToString('\\')) { collectionPath = collectionPath + Convert.ToString('\\'); } foreach (string fp in fNamesCol) { f = new FileInfo(fp); Console.WriteLine(fp); File.Copy(f.FullName, collectionPath + f.Name, true); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("OK!"); Console.ForegroundColor = ConsoleColor.DarkYellow; } Console.ReadLine(); } } catch { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Bad M3U filename!"); System.Threading.Thread.Sleep(1000); } } } } }
Скачать .exe => http://depositfiles.com/files/l1v0cmmwb
|
|
|