private void SetChunkStateString(ChunkIndex index, string partState) { using (IStorageItem item = GetIndexItem()) { string state = item.GetUserProperty <string>(PROP_LAST_PROCESSED); string[] parts; if (string.IsNullOrEmpty(state)) { parts = new string[index.numberOfChunks]; } else { parts = state.Split(';'); } if (parts.Length != index.numberOfChunks) { Logger.Instance.Error(this, "Wrong number of chunks, got {0}, expected {1}: {2}", parts.Length, index.numberOfChunks, state); } parts[index.chunk] = partState; string combined = string.Join(";", parts); item.SetUserProperty(PROP_LAST_PROCESSED, combined); item.Save(); } }
private string GetChunkStateString(ChunkIndex index) { using (IStorageItem item = GetIndexItem()) { if (item == null) { return(null); } string state = item.GetUserProperty <string>(PROP_LAST_PROCESSED); if (string.IsNullOrEmpty(state)) { return(null); } string[] parts = state.Split(';'); if (parts.Length != index.numberOfChunks) { Logger.Instance.Error(this, "Wrong number of chunks, got {0}, expected {1}: {2}", parts.Length, index.numberOfChunks, state); } return(parts[index.chunk]); } }