Example #1
0
 public Model(Stream stream, string m3uPath, LogEacFormat log) : base(m3uPath)
 {
     base._data = Data = new M3uFormat(this, stream, m3uPath);
     foreach (var track in log.Tracks.Items)
     {
         FilesModel.Add(track.Match.Name);
     }
 }
Example #2
0
            public Model(Stream stream, string path) : base(path)
            {
                base._data = Data = new CueFormat(this, stream, path);

                SetIgnoredName("Range.wav");
                Data.fbs.Position = 0;
                TextReader tr = new StreamReader(Data.fbs, LogBuffer.cp1252);

                for (int line = 1; ; ++line)
                {
                    var lx = tr.ReadLine();
                    if (lx == null)
                    {
                        break;
                    }

                    lx = lx.TrimStart();
                    if (lx.Length == 0)
                    {
                        continue;
                    }

                    if (lx.StartsWith("CATALOG "))
                    {
                        Data.Catalog = lx.Substring(8).Trim();
                        if (Data.Catalog.Length != 13)
                        {
                            IssueModel.Add("Invalid CATALOG.");
                        }
                        continue;
                    }

                    if (lx.Length > 0 && lx.StartsWith("FILE "))
                    {
                        var name = Data.GetQuotedField(lx, 5);
                        if (name.Length == 0)
                        {
                            IssueModel.Add("Missing file name.");
                        }
                        else
                        {
                            FilesModel.Add(name);
                        }
                    }
                }
            }
Example #3
0
            public Model(Stream stream, string path) : base(path)
            {
                base._data = Data = new M3uFormat(this, stream, path);

                stream.Position = 0;
                TextReader tr = new StreamReader(stream, LogBuffer.cp1252);

                for (int line = 1; ; ++line)
                {
                    var lx = tr.ReadLine();
                    if (lx == null)
                    {
                        break;
                    }
                    lx = lx.TrimStart();
                    if (lx.Length > 0 && lx[0] != '#')
                    {
                        FilesModel.Add(lx);
                    }
                }
            }
Example #4
0
            protected void ReadPlaylist(Encoding codePage)
            {
                long fileSize = Data.FileSize;

                if (fileSize > 512 * 1024)
                {
                    IssueModel.Add("Oversized file", Severity.Fatal);
                    return;
                }

                Data.fBuf         = new byte[fileSize];
                Data.fbs.Position = 0;
                if (Data.fbs.Read(Data.fBuf, 0, (int)fileSize) != fileSize)
                {
                    IssueModel.Add("Read error", Severity.Fatal);
                    return;
                }

                using (TextReader reader = new StreamReader(new MemoryStream(Data.fBuf), codePage))
                {
                    for (;;)
                    {
                        var lx = reader.ReadLine();
                        if (lx == null)
                        {
                            break;
                        }
                        lx = lx.TrimStart();
                        if (lx.Length > 0 && lx[0] != '#')
                        {
                            FilesModel.Add(lx);
                        }
                    }
                }

                Data.Codepage = codePage;
            }