public static void Serialize(Subscription obj, string path) { string dirName = System.IO.Path.GetDirectoryName(path); if ((dirName != null) && !Directory.Exists(dirName)) Directory.CreateDirectory(dirName); else if (File.Exists(path)) File.Delete(path); XmlSerializer serializer = new XmlSerializer(typeof(Subscription)); using (Stream s = File.OpenWrite(path)) { serializer.Serialize(s, obj); } }
public static Subscription GetQuickSubscription(string playlist, Subscription prototype) { return GetQuickSubscription(playlist, prototype.DeviceMediaRoot, prototype.DeviceId); }
public static void SaveSubscription(Subscription obj) { if(obj != null) Subscription.Serialize(obj, GetSubscriptionPath(obj.SafeDeviceId)); }