Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version
Go to top

Wrap Panel Virtualization

, 2 Jan 2012
WrapPanel doesn't support virtualization. But we can improve the performance by simulating virtualization.
MediaAssistant_bin.zip
MediaAssistant_src
DokanNet.dll
Id3Lib.dll
Media Assistant.exe
Media Assistant.exe.manifest
MediaAssistant.DAL.dll
MediaFS.dll
MefBasic.dll
Microsoft.Practices.Composite.dll
Microsoft.Practices.Composite.MefExtensions.dll
Microsoft.Practices.Composite.Presentation.dll
Microsoft.Practices.ServiceLocation.dll
Mp3Lib.dll
Newtonsoft.Json.Net35.dll
SharpZipLib.dll
Tags.dll
MediaAssistant_src.zip
DokanNet
Properties
Lib
CommonServiceLocation
Desktop
Microsoft.Practices.ServiceLocation.dll
CompositeApplicationLibrary
Desktop
Microsoft.Practices.Composite.dll
Microsoft.Practices.Composite.MefExtensions.dll
Microsoft.Practices.Composite.Presentation.dll
Dokan
dokan.lib
Moq
Desktop
Moq.dll
Mp3Lib
Id3Lib.dll
Mp3Lib.dll
SharpZipLib.dll
Newtonsoft
Newtonsoft.Json.Net35.dll
NUnit
nunit.framework.dll
MediaAssistant
MediaAssistant.csproj.user
MediaAssistant.ico
MusicAssistant_TemporaryKey.pfx
Constants
Controls
About
AddMovie
AlternativeLocation
BottomPanel
Dialog
LeftPanel
Library
MessageBox
MovieDetail
MovieList
MovieMiddlePanel
MovieResult
MovieSearchControl
MovieThumbnails
MusicList
MusicMiddlePanel
MusicSearchControl
PlayerControl
PlayingMusicInfo
PlaylistSelector
ProfileSelector
SendFeedback
SmartDJPreferance
SplashScreen
SplashPage.png
StatusMessageBar
TagEditor
TopPanel
WaitScreen
Converters
Data
EventArguments
HeaderImages
Close_act.png
Close_inact.png
Close_pr.png
Maximize_act.png
Maximize_inact.png
Maximize_pr.png
Minimize_act.png
Minimize_inact.png
Minimize_pr.png
Helper
Images
AcceptFolder.png
Actor.png
ActorLibrary.png
AddFolder.png
Album.png
Artist.png
Close.png
Composer.png
Default.png
DeleteFolder.png
Director.png
DrivesMovies.png
eye16.png
FailedToPlayMusic.png
Genre.png
IMDB.png
Library.png
ListView.png
Logo.png
Maximize.png
Menu.png
Mount.png
MovieBackground.jpg
MovieBackground.png
MovieFolder.png
MovieGenre.png
MovieLibrary.png
MoviePoster.png
Music.png
MusicAssistant.png
MusicLibrary.png
Mute.png
New.png
NewMovies.png
NoDJ.png
NonPlayingMusic.png
NormalShuffle.png
NoShuffle.png
NowPlayingMusic.png
PlayingMusic.png
playlist.png
PlayMovie.png
ProcessDone.png
ProcessFailed.png
Processing.png
Rated.png
Recent.png
RecommendedMovie.png
Restore.png
Runtime.png
SmartShuffle.png
Song.png
Star.png
Swap.png
ThumbnailView.png
Tools.png
TreeCollapse.png
TreeExpand.png
Unread.png
Volume.png
WatchList.png
WishList.png
Writer.png
Year.png
Management
MusicDJ
Properties
Settings.settings
Resources
MediaAssistant.DAL
MediaAssistant.sdf
MediaAssistantModels.edmx
Constants
DBUpdateScript
Helper
Properties
Settings.settings
DataSources
MusicAssistantEntities.datasource
TasteKidEntities.datasource
Virtualization
MediaAssistant.Setup
MusicAssistant.Setup.vdproj
MediaFS
DokanInstall_0.6.0.exe
Properties
MefBasic
Behaviors
Commans
Controls
Converters
Data
Extensions
Helper
Properties
Settings.settings
Themes
Threading
UserControls
Properties
TagClass
ASF Classes
Frames Classes
ID3
Properties
Text Files
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Diagnostics;

using Tags.ID3;
using System.Collections;

namespace Tags.Objects
{
    /// <summary>
    /// Provide a class to read and write ASF Content Description object
    /// 75B22633-668E-11CF-A6D9-00AA0062CE6C
    /// </summary>
    public class ContentDescriptionOb : ASFObject
    {
        /// <summary>
        /// GUID of content descriptor
        /// </summary>
        public const string GUIDst = "75B22633-668E-11CF-A6D9-00AA0062CE6C";
        private string _Title;
        private string _Author;
        private string _Copyright;
        private string _Description;
        private ArrayList _RatingList;

        /// <summary>
        /// Create new content descriptor from TagStream
        /// </summary>
        /// <param name="rd">TagStream to read frame</param>
        /// <param name="ObjectSize">Object size</param>
        public ContentDescriptionOb(TagStream rd, long ObjectSize)
        {
            _RatingList = new ArrayList();
            Read(rd, ObjectSize);            
        }

        /// <summary>
        /// Create new Content Description object from specific information
        /// </summary>
        /// <param name="Title">Title of current file</param>
        /// <param name="Author">Author of current file</param>
        /// <param name="Copyright">Copyright notice of current file</param>
        /// <param name="Description">Description of current file</param>
        public ContentDescriptionOb(string Title, string Author, string Copyright,
            string Description)
        {
            this._Title = Title;
            this._Author = Author;
            this._Copyright = Copyright;
            this._Description = Description;
            this._RatingList = new ArrayList();
        }

        #region -> Properties <-

        /// <summary>
        /// Title of current file
        /// </summary>
        public string Title
        {
            get { return _Title; }
            set { _Title = value; }
        }

        /// <summary>
        /// Author of current file
        /// </summary>
        public string Author
        {
            get { return _Author; }
            set { _Author = value; }
        }

        /// <summary>
        /// Copyright notice for this file
        /// </summary>
        public string Copyright
        {
            get { return _Copyright; }
            set { _Copyright = value; }
        }

        /// <summary>
        /// Description of current file
        /// </summary>
        public string Description
        {
            get { return _Description; }
            set { _Description = value; }
        }

        /// <summary>
        /// Gets or sets list of ratings
        /// </summary>
        public ArrayList Ratings
        {
            get
            { return _RatingList; }
        }

        #endregion

        /// <summary>
        /// Get Guid of current class
        /// </summary>
        /// <returns></returns>
        protected override string OnGetGUID()
        {
            return GUIDst;
        }

        /// <summary>
        /// Write this tag to specific TagStream
        /// </summary>
        /// <param name="wr">TagStream to write data</param>
        /// <returns>true if write successfull otherwise false</returns>
        protected override bool OnWritingData(TagStream wr)
        {
            wr.WriteGUID(GUIDst);
            wr.AsBinaryWriter.Write((long)Length);

            wr.AsBinaryWriter.Write(TagStream.StringLength(Title));
            wr.AsBinaryWriter.Write(TagStream.StringLength(Author));
            wr.AsBinaryWriter.Write(TagStream.StringLength(Copyright));
            wr.AsBinaryWriter.Write(TagStream.StringLength(Description));
            wr.AsBinaryWriter.Write(RatingLength);

            /* Some Applications like Jet Audio need string seprator to
             * show last character of text. unlike Media player
             */
            if (Title.Length > 0)
                wr.WriteText(Title, TextEncodings.UTF_16, true);
            if (Author.Length > 0)
                wr.WriteText(Author, TextEncodings.UTF_16, true);
            if (Copyright.Length > 0)
                wr.WriteText(Copyright, TextEncodings.UTF_16, true);
            if (Description.Length > 0)
                wr.WriteText(Description, TextEncodings.UTF_16, true);
            if (_RatingList.Count > 0)
            {
                foreach (string st in _RatingList)
                    wr.WriteText(st, TextEncodings.UTF_16, true);
            }

            return true;
        }

        /// <summary>
        /// Read tag dat afrom specific TagStream
        /// </summary>
        /// <param name="rd">TagStream to read data from</param>
        /// <param name="ObjectSize">Maximum size of object</param>
        /// <returns>true if read successfull otherwise false</returns>
        protected override bool OnReadingData(TagStream rd, long ObjectSize)
        {
            int TitleLen, AuthorLen, CopyrightLen, DescriptionLen, RatingLen;
            _Title = _Author = _Copyright = _Description = string.Empty;

            TitleLen = rd.AsBinaryReader.ReadInt16();
            AuthorLen = rd.AsBinaryReader.ReadInt16();
            CopyrightLen = rd.AsBinaryReader.ReadInt16();
            DescriptionLen = rd.AsBinaryReader.ReadInt16();
            RatingLen = rd.AsBinaryReader.ReadInt16();

            if (TitleLen > 0)
                _Title = rd.ReadText(TitleLen * 2, TextEncodings.UTF_16);
            if (AuthorLen > 0)
                _Author = rd.ReadText(AuthorLen * 2, TextEncodings.UTF_16);
            if (CopyrightLen > 0)
                _Copyright = rd.ReadText(CopyrightLen * 2, TextEncodings.UTF_16);
            if (DescriptionLen > 0)
                _Description = rd.ReadText(DescriptionLen * 2, TextEncodings.UTF_16);

            string temp;
            while (RatingLen > 0)
            {
                temp = rd.ReadText(RatingLen, TextEncodings.UTF_16, ref RatingLen, false);
                _RatingList.Add(temp);
            }

            return true;
        }

        /// <summary>
        /// Gets length of current frame
        /// </summary>
        /// <returns>long contains current frame size</returns>
        protected override long OnGetLength()
        {
            int Length = 34; // 16(GUID) + 8(Size) + 10(Object Sizes)

            Length += TagStream.StringLength(Title);
            Length += TagStream.StringLength(Author);
            Length += TagStream.StringLength(Copyright);
            Length += TagStream.StringLength(Description);
            Length += RatingLength;

            return Length;
        }

        private Int16 RatingLength
        {
            get
            {
                Int16 Length = 0;
                foreach (string st in _RatingList)
                    Length += TagStream.StringLength(st);
                return Length;
            }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

H. S. Masud
Software Developer (Senior) KAZ Software Limited
Bangladesh Bangladesh
No Biography provided

| Advertise | Privacy | Mobile
Web01 | 2.8.140905.1 | Last Updated 2 Jan 2012
Article Copyright 2012 by H. S. Masud
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid