示例#1
0
        public void CreateTest()
        {
            var frame = new UrlLinkFrame("W123", "URL");

            Assert.AreEqual(frame.Descriptor.ID, "W123");
            Assert.AreEqual(frame.URL, "URL");
        }
示例#2
0
        public void ConverterISO88591_Test()
        {
            var urlLinkFrame = new UrlLinkFrame
                                   {
                                       URL = "ABCD",
                                       Descriptor = {ID = "W123"}
                                   };

            var rawFrame = urlLinkFrame.Convert();

            Assert.AreEqual(rawFrame.ID, "W123");
            Assert.AreEqual(rawFrame.Payload.Length, 4);
            var refBytes = new byte[] {0x41, 0x42, 0x43, 0x44};
            Assert.IsTrue(ComparePayload(rawFrame.Payload, refBytes));
        }
示例#3
0
 private static IFrame AnalyseFrameId(RawFrame rawFrame)
 {
     IFrame frame;
     if (rawFrame.ID[0] == 'T' || rawFrame.ID[0] == 'W')
     {
         switch (rawFrame.ID[0])
         {
             case 'T':
                 if (rawFrame.ID != "TXXX")
                 {
                     frame = new TextFrame();
                 }
                 else
                 {
                     frame = new UserDefinedTextFrame();
                 }
                 break;
             case 'W':
                 if (rawFrame.ID != "WXXX")
                 {
                     frame = new UrlLinkFrame();
                 }
                 else
                 {
                     frame = new UserDefinedURLLinkFrame();
                 }
                 break;
             default:
                 throw new ID3TagException("Unknown Text or URL frame!");
         }
     }
     else
     {
         // Other frames
         switch (rawFrame.ID)
         {
             case "AENC":
                 frame = new AudioEncryptionFrame();
                 break;
             case "PRIV":
                 frame = new PrivateFrame();
                 break;
             case "MCDI":
                 frame = new MusicCdIdentifierFrame();
                 break;
             case "COMM":
                 frame = new CommentFrame();
                 break;
             case "APIC":
                 frame = new PictureFrame();
                 break;
             case "PCNT":
                 frame = new PlayCounterFrame();
                 break;
             case "POPM":
                 frame = new PopularimeterFrame();
                 break;
             case "UFID":
                 frame = new UniqueFileIdentifierFrame();
                 break;
             default:
                 frame = new UnknownFrame();
                 break;
         }
     }
     return frame;
 }