static bool OfflineSyncGetStatus_PackDefault(IntPtr handle, ref OfflineSyncStatus status) { IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OfflineSyncStatus_PackDefault))); bool result = NativeMethods.sp_offline_sync_get_status(handle, ptr); if (result) { var statusRecord = (OfflineSyncStatus_PackDefault)Marshal.PtrToStructure(ptr, typeof(OfflineSyncStatus_Pack4)); status.queued_tracks = statusRecord.queued_tracks; status.queued_bytes = statusRecord.queued_bytes; status.done_tracks = statusRecord.done_tracks; status.done_bytes = statusRecord.done_bytes; status.copied_tracks = statusRecord.copied_tracks; status.copied_bytes = statusRecord.copied_bytes; status.error_tracks = statusRecord.error_tracks; status.willnotcopy_tracks = statusRecord.willnotcopy_tracks; status.syncing = statusRecord.syncing; } else { status = new OfflineSyncStatus(); } Marshal.FreeHGlobal(ptr); return(result); }
public bool OfflineSyncGetStatus(ref OfflineSyncStatus status) { return(PlatformOfflineSyncGetStatus(_handle, ref status)); }
public bool OfflineSyncGetStatus(ref OfflineSyncStatus status) { return PlatformOfflineSyncGetStatus(_handle, ref status); }
static bool OfflineSyncGetStatus_PackDefault(IntPtr handle, ref OfflineSyncStatus status) { IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(OfflineSyncStatus_PackDefault))); bool result = NativeMethods.sp_offline_sync_get_status(handle, ptr); if (result) { var statusRecord = (OfflineSyncStatus_PackDefault)Marshal.PtrToStructure(ptr, typeof(OfflineSyncStatus_Pack4)); status.queued_tracks = statusRecord.queued_tracks; status.queued_bytes = statusRecord.queued_bytes; status.done_tracks = statusRecord.done_tracks; status.done_bytes = statusRecord.done_bytes; status.copied_tracks = statusRecord.copied_tracks; status.copied_bytes = statusRecord.copied_bytes; status.error_tracks = statusRecord.error_tracks; status.willnotcopy_tracks = statusRecord.willnotcopy_tracks; status.syncing = statusRecord.syncing; } else { status = new OfflineSyncStatus(); } Marshal.FreeHGlobal(ptr); return result; }
public override void OfflineStatusUpdated(SpotifySession session) { OfflineSyncStatus status = new OfflineSyncStatus(); session.OfflineSyncGetStatus(ref status); if (status.syncing) { Console.WriteLine("Offline status: queued:{0}:{1} done:{2}:{3} copied:{4}:{5} nocopy:{6} err:{7}", status.queued_tracks, status.queued_bytes, status.done_tracks, status.done_bytes, status.copied_tracks, status.copied_bytes, status.willnotcopy_tracks, status.error_tracks); } else { Console.WriteLine("Offline status: Idle"); } }