コード例 #1
0
ファイル: M3uFormat.cs プロジェクト: zoeblack42/Mediags
 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);
     }
 }
コード例 #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);
                        }
                    }
                }
            }
コード例 #3
0
ファイル: M3uFormat.cs プロジェクト: zoeblack42/Mediags
            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);
                    }
                }
            }
コード例 #4
0
ファイル: FilesContainer.cs プロジェクト: kaosborn/Filebert
            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;
            }