Example #1
0
        public static T Clone <T> (this T source)
        {
            if (Object.ReferenceEquals(source, null))
            {
                return(default(T));
            }

            Stream s = new MemoryStream();

            using (s) {
                SerializableObject.Save <T>(source, s);
                s.Seek(0, SeekOrigin.Begin);
                return(SerializableObject.Load <T>(s));
            }
        }
Example #2
0
        public static PlayList Load(string filePath)
        {
            PlayList pl;
            string   filename = System.IO.Path.ChangeExtension(filePath, Constants.PLAYLIST_EXT);

            //For new Play List
            if (!System.IO.File.Exists(filePath))
            {
                pl = new PlayList();
            }
            else
            {
                pl = SerializableObject.Load <PlayList>(filePath);
            }
            pl.Filename = filename;
            return(pl);
        }
Example #3
0
 public void Save(string filePath)
 {
     SerializableObject.Save(this, filePath);
 }