Example #1
0
        /// <summary>
        /// Create and return a copy of this MediaCollection
        /// </summary>
        /// <returns></returns>
        public MediaCollection Copy()
        {
            MediaCollection newCollection = new MediaCollection();

            newCollection.UserName = UserName;
            foreach (string mediaFolder in Folders.Keys)
            {
                newCollection.AddMediaFolder(mediaFolder);
                newCollection.Folders[mediaFolder].AudioFiles = Folders[mediaFolder].AudioFiles.Copy();
            }

            return(newCollection);
        }
Example #2
0
        /// <summary>
        /// Serialize a MediaCollection to a byte array
        /// </summary>
        /// <param name="mc"></param>
        /// <returns></returns>
        public static byte[] Serialize(MediaCollection mc)
        {
            MemoryStream ms = new MemoryStream();
            BinaryFormatter bf = new BinaryFormatter();
            bf.Serialize(ms, mc);

            ms.Position = 0;
            byte[] abyteRet = new byte[ms.Length];
            ms.Read(abyteRet, 0, abyteRet.Length);
            ms.Flush();
            ms.Close();

            return abyteRet;
        }
Example #3
0
        /// <summary>
        /// Serialize a MediaCollection to a byte array
        /// </summary>
        /// <param name="mc"></param>
        /// <returns></returns>
        public static byte[] Serialize(MediaCollection mc)
        {
            MemoryStream    ms = new MemoryStream();
            BinaryFormatter bf = new BinaryFormatter();

            bf.Serialize(ms, mc);

            ms.Position = 0;
            byte[] abyteRet = new byte[ms.Length];
            ms.Read(abyteRet, 0, abyteRet.Length);
            ms.Flush();
            ms.Close();

            return(abyteRet);
        }
Example #4
0
        /// <summary>
        /// Create and return a copy of this MediaCollection
        /// </summary>
        /// <returns></returns>
        public MediaCollection Copy()
        {
            MediaCollection newCollection = new MediaCollection();
            newCollection.UserName = UserName;
            foreach (string mediaFolder in Folders.Keys)
            {
                newCollection.AddMediaFolder(mediaFolder);
                newCollection.Folders[mediaFolder].AudioFiles = Folders[mediaFolder].AudioFiles.Copy();
            }

            return newCollection;
        }