Changeset 3500 for trunk/sources/HeuristicLab.Common
- Timestamp:
- 04/22/10 23:33:13 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Common
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Common/3.2/Content/ContentManager.cs
r3483 r3500 60 60 public static void Save(IStorableContent content, string filename, bool compressed) { 61 61 if (instance == null) throw new InvalidOperationException("ContentManager is not initialized."); 62 instance.SaveContent( content, filename, compressed);62 instance.SaveContent((IStorableContent)content.Clone(), filename, compressed); 63 63 content.Filename = filename; 64 64 } 65 65 public static void SaveAsync(IStorableContent content, string filename, bool compressed, Action<IStorableContent, Exception> savingCompletedCallback) { 66 66 if (instance == null) throw new InvalidOperationException("ContentManager is not initialized."); 67 var action = new Action<IStorableContent, string, bool>(instance.SaveContent); 68 action.BeginInvoke(content, filename, compressed, delegate(IAsyncResult result) { 69 Exception error = null; 70 try { 71 action.EndInvoke(result); 72 content.Filename = filename; 73 } 74 catch (Exception ex) { 75 error = ex; 76 } 77 savingCompletedCallback(content, error); 78 }, null); 67 68 IStorableContent clone = null; 69 try { 70 clone = (IStorableContent)content.Clone(); 71 } 72 catch (Exception ex) { 73 savingCompletedCallback(content, ex); 74 } 75 76 if (clone != null) { 77 var action = new Action<IStorableContent, string, bool>(instance.SaveContent); 78 action.BeginInvoke(clone, filename, compressed, delegate(IAsyncResult result) { 79 Exception error = null; 80 try { 81 action.EndInvoke(result); 82 content.Filename = filename; 83 } 84 catch (Exception ex) { 85 error = ex; 86 } 87 savingCompletedCallback(content, error); 88 }, null); 89 } 79 90 } 80 91 protected abstract void SaveContent(IStorableContent content, string filename, bool compressed); -
trunk/sources/HeuristicLab.Common/3.2/Content/IStorableContent.cs
r3483 r3500 23 23 24 24 namespace HeuristicLab.Common { 25 public interface IStorableContent : IContent {25 public interface IStorableContent : IContent, IDeepCloneable { 26 26 string Filename { get; set; } 27 27 -
trunk/sources/HeuristicLab.Common/3.2/Content/StorableContent.cs
r3483 r3500 23 23 24 24 namespace HeuristicLab.Common { 25 public class StorableContent : IStorableContent {25 public class StorableContent : DeepCloneable, IStorableContent { 26 26 private string filename; 27 27 public string Filename { -
trunk/sources/HeuristicLab.Common/3.3/Content/ContentManager.cs
r3483 r3500 60 60 public static void Save(IStorableContent content, string filename, bool compressed) { 61 61 if (instance == null) throw new InvalidOperationException("ContentManager is not initialized."); 62 instance.SaveContent( content, filename, compressed);62 instance.SaveContent((IStorableContent)content.Clone(), filename, compressed); 63 63 content.Filename = filename; 64 64 } 65 65 public static void SaveAsync(IStorableContent content, string filename, bool compressed, Action<IStorableContent, Exception> savingCompletedCallback) { 66 66 if (instance == null) throw new InvalidOperationException("ContentManager is not initialized."); 67 var action = new Action<IStorableContent, string, bool>(instance.SaveContent); 68 action.BeginInvoke(content, filename, compressed, delegate(IAsyncResult result) { 69 Exception error = null; 70 try { 71 action.EndInvoke(result); 72 content.Filename = filename; 73 } 74 catch (Exception ex) { 75 error = ex; 76 } 77 savingCompletedCallback(content, error); 78 }, null); 67 68 IStorableContent clone = null; 69 try { 70 clone = (IStorableContent)content.Clone(); 71 } 72 catch (Exception ex) { 73 savingCompletedCallback(content, ex); 74 } 75 76 if (clone != null) { 77 var action = new Action<IStorableContent, string, bool>(instance.SaveContent); 78 action.BeginInvoke(clone, filename, compressed, delegate(IAsyncResult result) { 79 Exception error = null; 80 try { 81 action.EndInvoke(result); 82 content.Filename = filename; 83 } 84 catch (Exception ex) { 85 error = ex; 86 } 87 savingCompletedCallback(content, error); 88 }, null); 89 } 79 90 } 80 91 protected abstract void SaveContent(IStorableContent content, string filename, bool compressed); -
trunk/sources/HeuristicLab.Common/3.3/Content/IStorableContent.cs
r3483 r3500 23 23 24 24 namespace HeuristicLab.Common { 25 public interface IStorableContent : IContent {25 public interface IStorableContent : IContent, IDeepCloneable { 26 26 string Filename { get; set; } 27 27 -
trunk/sources/HeuristicLab.Common/3.3/Content/StorableContent.cs
r3483 r3500 23 23 24 24 namespace HeuristicLab.Common { 25 public class StorableContent : IStorableContent {25 public class StorableContent : DeepCloneable, IStorableContent { 26 26 private string filename; 27 27 public string Filename {
Note: See TracChangeset
for help on using the changeset viewer.