forked from Windower/POLUtils
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileInfo.cs
More file actions
73 lines (69 loc) · 2.21 KB
/
Copy pathFileInfo.cs
File metadata and controls
73 lines (69 loc) · 2.21 KB
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
// $Id: FileInfo.cs 757 2010-07-04 13:05:45Z tim.vanholder $
using System;
using System.IO;
using System.Xml;
using PlayOnline.Core.Audio;
namespace PlayOnline.Utils.AudioManager
{
internal class FileInfo
{
public string Location;
public string Title;
public string Composer;
public AudioFile AudioFile;
public FileInfo(XmlNode App, string FullPath)
{
this.Location = FullPath;
this.Title = null;
this.Composer = null;
this.AudioFile = null;
string Directory = Path.GetFileName(FullPath);
XmlNode SubDir = App.SelectSingleNode(String.Format("subdir[@name = '{0}']", Directory));
if (SubDir != null)
{
this.Title = SubDir.InnerText;
}
}
public FileInfo(XmlNode App, AudioFile AudioFile)
{
this.Location = AudioFile.Path;
this.AudioFile = AudioFile;
XmlNode Track = null;
{
XmlNodeList Tracks = App.SelectNodes(String.Format("track[@id = {0}]", AudioFile.ID));
if (Tracks.Count > 1)
{
Track =
App.SelectSingleNode(String.Format("track[@id = {0} and @filename = '{1}']", AudioFile.ID,
Path.GetFileName(AudioFile.Path)));
}
else if (Tracks.Count > 0)
{
Track = Tracks[0];
}
}
if (Track != null)
{
XmlNode Title = Track.SelectSingleNode("title");
if (Title != null)
{
this.Title = Title.InnerText;
}
XmlNode Composer = Track.SelectSingleNode("composer");
if (Composer == null)
{
Composer = App.SelectSingleNode("composer");
}
if (Composer != null)
{
this.Composer = Composer.InnerText;
}
}
else
{
this.Title = null;
this.Composer = null;
}
}
}
}