Example #1
0
        public void SetDashBox(string meanstring, string namestring, string datastring)
        {
            AppleDataBox data_box = GetDashAtoms(meanstring, namestring);

            if (data_box != null && string.IsNullOrEmpty(datastring))
            {
                AppleAnnotationBox dash_box = GetParentDashBox(meanstring, namestring);
                dash_box.ClearChildren();
                ilst_box.RemoveChild(dash_box);
                return;
            }
            if (data_box != null)
            {
                data_box.Text = datastring;
            }
            else
            {
                AppleAdditionalInfoBox amean_box = new AppleAdditionalInfoBox(BoxType.Mean);
                AppleAdditionalInfoBox aname_box = new AppleAdditionalInfoBox(BoxType.Name);
                AppleDataBox           adata_box = new AppleDataBox(BoxType.Data, 1);
                amean_box.Text = meanstring;
                aname_box.Text = namestring;
                adata_box.Text = datastring;
                AppleAnnotationBox whole_box = new AppleAnnotationBox(BoxType.DASH);
                whole_box.AddChild(amean_box);
                whole_box.AddChild(aname_box);
                whole_box.AddChild(adata_box);
                ilst_box.AddChild(whole_box);
            }
        }
Example #2
0
 /// <summary>
 ///    Gets all data boxes that match any of the provided types.
 /// </summary>
 /// <param name="types">
 ///    A <see cref="T:System.Collections.Generic.IEnumerable`1" /> object enumerating a list
 ///    of box types to match.
 /// </param>
 /// <returns>
 ///    A <see cref="T:System.Collections.Generic.IEnumerable`1" /> object enumerating the
 ///    matching boxes.
 /// </returns>
 public IEnumerable <AppleDataBox> DataBoxes(IEnumerable <ByteVector> types)
 {
     // Check each box to see if the match any of the
     // provided types. If a match is found, loop through the
     // children and add any data box.
     foreach (Box box in ilst_box.Children)
     {
         foreach (ByteVector v in types)
         {
             if (FixId(v) != box.BoxType)
             {
                 continue;
             }
             foreach (Box data_box in box.Children)
             {
                 AppleDataBox adb = data_box as
                                    AppleDataBox;
                 if (adb != null)
                 {
                     yield return(adb);
                 }
             }
         }
     }
 }
Example #3
0
        public string GetDashBox(string meanstring, string namestring)
        {
            AppleDataBox data_box = GetDashAtoms(meanstring, namestring);

            if (data_box != null)
            {
                return(data_box.Text);
            }
            else
            {
                return(null);
            }
        }
Example #4
0
 public void SetData(ByteVector type, ByteVectorCollection data, uint flags)
 {
     if (data == null || data.Count == 0)
     {
         ClearData(type);
         return;
     }
     AppleDataBox[] boxes = new AppleDataBox[data.Count];
     for (int i = 0; i < data.Count; i++)
     {
         boxes[i] = new AppleDataBox(data[i], flags);
     }
     SetData(type, boxes);
 }
Example #5
0
        /// <summary>
        ///    Gets all custom data boxes that match the specified mean
        ///    and name pair.
        /// </summary>
        /// <param name="mean">
        ///    A <see cref="string" /> object containing the "mean" to
        ///    match.
        /// </param>
        /// <param name="name">
        ///    A <see cref="string" /> object containing the name to
        ///    match.
        /// </param>
        /// <returns>
        ///    A <see cref="T:System.Collections.Generic.IEnumerable`1" /> object enumerating the
        ///    matching boxes.
        /// </returns>
        public IEnumerable <AppleDataBox> DataBoxes(string mean,
                                                    string name)
        {
            // These children will have a box type of "----"
            foreach (Box box in ilst_box.Children)
            {
                if (box.BoxType != BoxType.DASH)
                {
                    continue;
                }

                // Get the mean and name boxes, make sure
                // they're legit, and make sure that they match
                // what we want. Then loop through and add all
                // the data box children to our output.
                AppleAdditionalInfoBox mean_box =
                    (AppleAdditionalInfoBox)
                    box.GetChild(BoxType.Mean);
                AppleAdditionalInfoBox name_box =
                    (AppleAdditionalInfoBox)
                    box.GetChild(BoxType.Name);

                if (mean_box == null || name_box == null ||
                    mean_box.Text != mean ||
                    name_box.Text != name)
                {
                    continue;
                }

                foreach (Box data_box in box.Children)
                {
                    AppleDataBox adb =
                        data_box as AppleDataBox;

                    if (adb != null)
                    {
                        yield return(adb);
                    }
                }
            }
        }
Example #6
0
 public IEnumerable <AppleDataBox> DataBoxes(IEnumerable <ByteVector> types)
 {
     foreach (Box box in ilst_box.Children)
     {
         foreach (ByteVector v in types)
         {
             if (FixId(v) != box.BoxType)
             {
                 continue;
             }
             foreach (Box data_box in box.Children)
             {
                 AppleDataBox adb = data_box as AppleDataBox;
                 if (adb != null)
                 {
                     yield return(adb);
                 }
             }
         }
     }
 }
Example #7
0
        /// <summary>
        /// Sets a specific strings in Dash (----) atom.  This method updates
        /// and existing atom, or creates a new one.
        /// </summary>
        /// <param name="meanstring">String specifying text for mean box</param>
        /// <param name="namestring">String specifying text for name box</param>
        /// <param name="datastring">String specifying text for data box</param>
        public void SetDashBox(string meanstring, string namestring, string datastring)
        {
            AppleDataBox data_box = GetDashAtoms(meanstring, namestring);

            if (data_box != null)
            {
                data_box.Text = datastring;
            }
            else
            {
                AppleAdditionalInfoBox amean_box = new AppleAdditionalInfoBox(BoxType.Mean, 0, 0);
                AppleAdditionalInfoBox aname_box = new AppleAdditionalInfoBox(BoxType.Name, 0, 0);
                AppleDataBox           adata_box = new AppleDataBox(BoxType.Data, 0);
                amean_box.Text = meanstring;
                aname_box.Text = namestring;
                adata_box.Text = datastring;
                AppleAnnotationBox whole_box = new AppleAnnotationBox(BoxType.DASH);
                whole_box.AddChild(amean_box);
                whole_box.AddChild(aname_box);
                whole_box.AddChild(adata_box);
                ilst_box.AddChild(whole_box);
            }
        }
Example #8
0
 public IEnumerable <AppleDataBox> DataBoxes(string mean, string name)
 {
     foreach (Box box in ilst_box.Children)
     {
         if (box.BoxType != BoxType.DASH)
         {
             continue;
         }
         AppleAdditionalInfoBox mean_box = (AppleAdditionalInfoBox)box.GetChild(BoxType.Mean);
         AppleAdditionalInfoBox name_box = (AppleAdditionalInfoBox)box.GetChild(BoxType.Name);
         if (mean_box == null || name_box == null || mean_box.Text != mean || name_box.Text != name)
         {
             continue;
         }
         foreach (Box data_box in box.Children)
         {
             AppleDataBox adb = data_box as AppleDataBox;
             if (adb != null)
             {
                 yield return(adb);
             }
         }
     }
 }
Example #9
0
		private void SetTags (Mpeg4.AppleTag tag)
		{
			tag.Title = "TEST title";
			tag.Performers = new string[] {"TEST performer 1", "TEST performer 2"};
			tag.Comment = "TEST comment";
			tag.Copyright = "TEST copyright";
			tag.Genres = new string [] {"TEST genre 1", "TEST genre 2"};
			tag.Year = 1999;

			Mpeg4.AppleTag atag = (Mpeg4.AppleTag)tag;
			Assert.IsNotNull(atag);

			Mpeg4.AppleDataBox newbox1 = new Mpeg4.AppleDataBox (
				ByteVector.FromString ("TEST Long Description", StringType.UTF8),
				(int) Mpeg4.AppleDataBox.FlagType.ContainsText);
			Mpeg4.AppleDataBox newbox2 = new Mpeg4.AppleDataBox (
				ByteVector.FromString ("TEST TV Show", StringType.UTF8),
				(int) Mpeg4.AppleDataBox.FlagType.ContainsText);
			atag.SetData (BOXTYPE_LDES, new Mpeg4.AppleDataBox[] {newbox1});
			atag.SetData (BOXTYPE_TVSH, new Mpeg4.AppleDataBox[] {newbox2});
		}