|
|
|
ช่วยด้วยครับ ต้องการทำโค๊ดให้เป็น Thread ต้องเขียนยังไงครับ |
|
|
|
|
|
|
|
Code (C#)
public static System.Collections.Generic.List<string> GetFilesRecursive(string initial)
{
System.Collections.Generic.List<string> result = new System.Collections.Generic.List<string>();
System.Collections.Generic.Stack<string> stack = new System.Collections.Generic.Stack<string>();
stack.Push(initial);
while ((stack.Count > 0))
{
string dir = stack.Pop();
result.AddRange(System.IO.Directory.GetFiles(dir, "*.lyr")); //ตรงนี้อยากแยกไฟล์ออกมาเพื่อโยนไป private void _ArtisSong(string pathFileName)
string directoryName = null;
foreach (string directoryName_loopVariable in System.IO.Directory.GetDirectories(dir))
{
directoryName = directoryName_loopVariable;
stack.Push(directoryName);
}
}
return result;
}
private void _ArtisSong(string pathFileName)
{
Random rnd = new Random();
string result = "" + rnd.Next(1, 99999) + rnd.Next(1, 99999) + rnd.Next(1, 99999) + rnd.Next(1, 99999) + rnd.Next(1, 99999) + rnd.Next(1, 99999) + rnd.Next(1, 99999) + rnd.Next(1, 99999);
try
{
result = (string)System.IO.File.ReadLines(pathFileName, System.Text.Encoding.GetEncoding(874)).Skip(1).Take(1).First() + " ; " + (string)System.IO.File.ReadLines(pathFileName, System.Text.Encoding.GetEncoding(874)).Skip(0).Take(1).First(); ;
}
catch { }
songTableAdapter.Insert(pathFileName, result.Replace("(G)", "").Replace("( C )", "").
Replace("( Cm )", "").Replace("( C# )", "").Replace("( C#m )", "").
Replace("( D )", "").Replace("( Dm )", "").Replace("( E )", "").
Replace("( Eb )", "").Replace("( Ebm )", "").Replace("( Em )", "").
Replace("( F )", "").Replace("( Fm )", "").Replace("( F# )", "").
Replace("( F#m )", "").Replace("( G )", "").Replace("( Gb )", "").
Replace("( Gm )", "").Replace("( A )", "").Replace("( Ab )", "").
Replace("( Am )", "").Replace("( Abm )", "").Replace("( B )", "").
Replace("( Bb )", "").Replace("( Bm )", "").Replace("( Bbm )", "").Trim());
}
Tag : .NET, Ms Access, Win (Windows App), Console App, C#, Windows
|
|
|
|
|
|
Date :
2014-08-07 14:14:43 |
By :
lamaka.tor |
View :
865 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ได้แล้วครับ
และแล้วก็สำเร็จโปรแกรมตัดเพลงซ้ำใน NCN
ถ้าจะกรุณาขอ โค๊ดอ่านชื่อเพลงกะคนร้องใน EMK หน่อยครับ
ไม่รู้ใช้อะไรอ่าน
|
|
|
|
|
Date :
2014-08-07 16:15:54 |
By :
lamaka.tor |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|