[longomatch] Copy some properties when replacing and preserver order.
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Copy some properties when replacing and preserver order.
- Date: Wed, 18 Mar 2015 14:36:24 +0000 (UTC)
commit 5fbbcb891405a7b2a39c718e5c031a1b1c0a6118
Author: Julien Moutte <julien fluendo com>
Date: Fri Mar 6 16:06:40 2015 +0100
Copy some properties when replacing and preserver order.
LongoMatch.Core/Store/MediaFileSet.cs | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/LongoMatch.Core/Store/MediaFileSet.cs b/LongoMatch.Core/Store/MediaFileSet.cs
index 3dc64e0..8e8d4d7 100644
--- a/LongoMatch.Core/Store/MediaFileSet.cs
+++ b/LongoMatch.Core/Store/MediaFileSet.cs
@@ -116,6 +116,7 @@ namespace LongoMatch.Core.Store
/// <summary>
/// Search for a file in the set and replace it with a new one.
/// If old file is not found, this is equivalent to adding new file to the set.
+ /// Some properties from the old file are copied to the new file such as Name and Offset.
/// </summary>
/// <param name="old_file">Old file.</param>
/// <param name="new_file">New file.</param>
@@ -124,13 +125,17 @@ namespace LongoMatch.Core.Store
bool found = false;
if (Contains (old_file)) {
- Remove (old_file);
+ if (new_file != null && old_file != null) {
+ new_file.Name = old_file.Name;
+ new_file.Offset = old_file.Offset;
+ }
+
+ this [IndexOf (old_file)] = new_file;
found = true;
+ } else {
+ Add (new_file);
}
- //FIXME: Should we copy some properties from the previous file such as Offset ?
- Add (new_file);
-
return found;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]