private static T SetFieldValue <T>(int mediaId, EListType listType, int atom, T newValue) { int[] columnIndexes = new int[] { atom }; object[] fieldValues = new object[] { newValue }; ZuneLibrary.SetFieldValues(mediaId, listType, 1, columnIndexes, fieldValues, new QueryPropertyBag()); return((T)fieldValues[0]); }
private void CommitLastStoredBookmark() { if (this.MediaType != MediaType.PodcastEpisode && this.MediaType != MediaType.Video) { return; } int[] columnIndexes = new int[1]; object[] fieldValues = new object[1]; columnIndexes[0] = 35; fieldValues[0] = _lastStoredBookmark; ZuneLibrary.SetFieldValues(this.MediaId, this.ListType, 1, columnIndexes, fieldValues, PlaylistManager.Instance.QueryContext); }
private static void UpdatePlayedStatesWorker(object o) { if (!(o is UpdatePlayedStatesTask playedStatesTask)) { return; } int num1 = 0; int num2 = 0; int num3 = 0; int[] columnIndexes = new int[7]; object[] fieldValues = new object[7]; if (playedStatesTask.IncrementPlayCount) { columnIndexes[0] = 367; fieldValues[0] = 0; ZuneLibrary.GetFieldValues(playedStatesTask.MediaID, playedStatesTask.ListType, 1, columnIndexes, fieldValues, PlaylistManager.Instance.QueryContext); num2 = (int)fieldValues[0]; columnIndexes[0] = 366; fieldValues[0] = 0; ZuneLibrary.GetFieldValues(playedStatesTask.MediaID, playedStatesTask.ListType, 1, columnIndexes, fieldValues, PlaylistManager.Instance.QueryContext); num1 = (int)fieldValues[0]; } if (playedStatesTask.IncrementSkipCount) { columnIndexes[0] = 374; fieldValues[0] = 0; ZuneLibrary.GetFieldValues(playedStatesTask.MediaID, playedStatesTask.ListType, 1, columnIndexes, fieldValues, PlaylistManager.Instance.QueryContext); num3 = (int)fieldValues[0]; } int cValues = 0; if (playedStatesTask.MarkPlayed) { columnIndexes[cValues] = 262; fieldValues[cValues] = 1; ++cValues; } if (playedStatesTask.IncrementPlayCount) { int num4 = num2 + 1; columnIndexes[cValues] = 367; fieldValues[cValues] = num4; int index1 = cValues + 1; int num5 = num1 + 1; columnIndexes[index1] = 366; fieldValues[index1] = num5; int index2 = index1 + 1; columnIndexes[index2] = 363; fieldValues[index2] = DateTime.UtcNow; cValues = index2 + 1; } if (playedStatesTask.IncrementSkipCount) { int num4 = num3 + 1; columnIndexes[cValues] = 374; fieldValues[cValues] = num4; int index = cValues + 1; columnIndexes[index] = 365; fieldValues[index] = DateTime.UtcNow; cValues = index + 1; } if (cValues > 0) { ZuneLibrary.SetFieldValues(playedStatesTask.MediaID, playedStatesTask.ListType, cValues, columnIndexes, fieldValues, PlaylistManager.Instance.QueryContext); } if (!playedStatesTask.IncrementPlayCount || playedStatesTask.ContainerPlayMarker == null) { return; } bool flag = false; lock (playedStatesTask.ContainerPlayMarker) { if (!playedStatesTask.ContainerPlayMarker.Marked) { playedStatesTask.ContainerPlayMarker.Marked = true; flag = true; } } if (!flag) { return; } if (playedStatesTask.ContainerPlayMarker.LibraryId == -1 && playedStatesTask.ListType == EListType.eTrackList) { fieldValues[0] = -1; if (playedStatesTask.ContainerPlayMarker.MediaType == MediaType.Album) { columnIndexes[0] = 11; ZuneLibrary.GetFieldValues(playedStatesTask.MediaID, playedStatesTask.ListType, 1, columnIndexes, fieldValues, PlaylistManager.Instance.QueryContext); playedStatesTask.ContainerPlayMarker.LibraryId = (int)fieldValues[0]; } else if (playedStatesTask.ContainerPlayMarker.MediaType == MediaType.Genre) { columnIndexes[0] = 399; ZuneLibrary.GetFieldValues(playedStatesTask.MediaID, playedStatesTask.ListType, 1, columnIndexes, fieldValues, PlaylistManager.Instance.QueryContext); playedStatesTask.ContainerPlayMarker.LibraryId = (int)fieldValues[0]; } else if (playedStatesTask.ContainerPlayMarker.MediaType == MediaType.Artist) { columnIndexes[0] = 11; ZuneLibrary.GetFieldValues(playedStatesTask.MediaID, playedStatesTask.ListType, 1, columnIndexes, fieldValues, PlaylistManager.Instance.QueryContext); int iMediaId = (int)fieldValues[0]; fieldValues[0] = -1; columnIndexes[0] = 78; ZuneLibrary.GetFieldValues(iMediaId, EListType.eAlbumList, 1, columnIndexes, fieldValues, PlaylistManager.Instance.QueryContext); playedStatesTask.ContainerPlayMarker.LibraryId = (int)fieldValues[0]; } } if (playedStatesTask.ContainerPlayMarker.LibraryId == -1) { return; } columnIndexes[0] = 363; fieldValues[0] = DateTime.UtcNow; EListType listType = PlaylistManager.MediaTypeToListType(playedStatesTask.ContainerPlayMarker.MediaType); ZuneLibrary.SetFieldValues(playedStatesTask.ContainerPlayMarker.LibraryId, listType, 1, columnIndexes, fieldValues, PlaylistManager.Instance.QueryContext); }