-
Notifications
You must be signed in to change notification settings - Fork 0
/
TruncateSymbolFactory.cs
82 lines (68 loc) · 2.78 KB
/
TruncateSymbolFactory.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
using MusicFactory;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TagLib;
namespace Simile
{
public class TruncateSymbolFactory
{
// TruncateMaster truncateMaster = new TruncateMaster();
public void Process()
{
List<DirectoryInfo> lstDirectory = new DirectoryProcess().GetDirectories();
DirectoryProcess dirProcess = new DirectoryProcess();
foreach (DirectoryInfo dir in lstDirectory)
{
FileInfo[] flist = dir.GetFiles("*.mp3");
foreach (FileInfo finfo in flist)
{
try
{
//TagLib.File tagFile = TagLib.File.Create(finfo.FullName);
//check numeric value at begining of filename.
String tmp = finfo.Name.Substring(1, 1);
String symbolValue = StretchedMethod.GetFirstCharacter("");// truncateMaster.GetSymbolValue(TruncateMaster.Symbols.UnderscoreHyphen);
if (String.Equals (tmp, symbolValue))
{
String newName = "";
newName = finfo.Name.Substring(1, finfo.Name.Length-1);
System.IO.File.Move(finfo.Name, newName);
}
else if (String.Equals(tmp, symbolValue))
{
String newName = "";
newName = finfo.Name.Substring(1, finfo.Name.Length-1);
System.IO.File.Move(finfo.Name, newName);
}
}
catch (CorruptFileException errmsg)
{
throw errmsg;
}
}
}
}
public string GetNewName(string fileName,Int16 order, System.IO.FileInfo finfo)
{
String newName = "";
String tmp = StretchedMethod.GetFirstCharacter(fileName);
// Simile.TruncateMaster.Symbols symbolValue = truncateMaster.GetSymbolValue(order);
// newName = finfo.Name.Substring(1, finfo.Name.Length - 1);
// if (String.Equals(tmp, symbolValue))
// {
// newName = finfo.Name.Substring(1, finfo.Name.Length - 1);
// System.IO.File.Move(finfo.Name, newName);
// }
// else if (String.Equals(tmp, symbolValue))
// {
// newName = finfo.Name.Substring(1, finfo.Name.Length - 1);
// System.IO.File.Move(finfo.Name, newName);
// }
return "";
}
}
}