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; } }
public WaveWriter(AudioFile AF, string TargetFile) { InitializeComponent(); this.prbBytesWritten.Select(); this.txtSource.Text = AF.Path; this.txtTarget.Text = TargetFile; this.AF = AF; this.AFS = AF.OpenStream(false); this.FS = new FileStream(TargetFile, FileMode.Create, FileAccess.Write); }
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; }
private void ScanDataPath(XmlNode App, string DataPath, TreeNode AppNode) { if (!Directory.Exists(DataPath)) return; this.txtDirectory.Text = String.Format("[{0}/{1}] {2}", this.prbDirectory.Value + 1, this.prbDirectory.Maximum, DataPath); Application.DoEvents(); foreach (string File in Directory.GetFiles(DataPath, this.FilePattern_)) { this.txtFile.Text = String.Format("[{0}/{1}] {2}", this.prbFile.Value + 1, this.prbFile.Maximum, Path.GetFileName(File)); Application.DoEvents(); AudioFile AF = new AudioFile(File); if (AF.Type != AudioFileType.Unknown) { FileInfo FI = new FileInfo(App, AF); TreeNode FileNode = new TreeNode(String.Format("[{0}] {1}", AF.ID, ((FI.Title == null) ? Path.GetFileName(File) : FI.Title))); FileNode.ImageIndex = 3; FileNode.SelectedImageIndex = 3; FileNode.Tag = FI; AppNode.Nodes.Add(FileNode); } ++this.prbFile.Value; } ++this.prbDirectory.Value; // Recurse foreach (string SubDir in Directory.GetDirectories(DataPath)) { TreeNode DirNode = new TreeNode(Path.GetFileName(SubDir)); DirNode.ImageIndex = 1; DirNode.SelectedImageIndex = 1; FileInfo FI = new FileInfo(App, SubDir); DirNode.Tag = FI; if (FI.Title != null) DirNode.Text += String.Format(" - {0}", FI.Title); this.ScanDataPath(App, SubDir, DirNode); if (DirNode.Nodes.Count > 0) AppNode.Nodes.Add(DirNode); } }