public void Terminate() { foreach (var layer in layers) { layer.Dispose(); } layers.Clear(); if (doc != null) { doc.Dispose(); } doc = null; }
void Reset() { foreach (var layer in layers) { layer.Dispose(); } layers.Clear(); if (doc != null) { doc.Dispose(); } doc = null; // 画像を完全に破棄する。 System.GC.Collect(); System.GC.Collect(); System.GC.WaitForFullGCComplete(); System.GC.Collect(); System.GC.Collect(); }
public unsafe ErrorCode Load(string path) { Reset(); if (!System.IO.File.Exists(path)) { return(ErrorCode.FileIsNotFound); } var buf = System.IO.File.ReadAllBytes(path); fixed(byte *p = buf) { doc = swig.Document.Create((IntPtr)p, buf.Count()); } if (doc == null) { return(ErrorCode.FailedToParse); } var depth = doc.GetDepth(); if (depth > 8) { doc.Dispose(); doc = null; return(ErrorCode.DepthIs16); } for (int i = 0; i < doc.GetLayerCount(); i++) { layers.Add(new Layer(doc.GetLayer(i))); } return(ErrorCode.Succeed); }
void Reset() { layers.Clear(); if (doc != null) { doc.Release(); } doc = null; }
public void Terminate() { layers.Clear(); if(doc != null) { doc.Release(); } doc = null; }
public unsafe ErrorCode Load(string path) { Reset(); if (!System.IO.File.Exists(path)) return ErrorCode.FileIsNotFound; var buf = System.IO.File.ReadAllBytes(path); fixed(byte* p = buf) { doc = swig.Document.Create((IntPtr)p, buf.Count()); } if (doc == null) return ErrorCode.FailedToParse; var depth = doc.GetDepth(); if(depth > 8) { doc.Release(); doc = null; return ErrorCode.DepthIs16; } for (int i = 0; i < doc.GetLayerCount(); i++ ) { layers.Add(new Layer(doc.GetLayer(i))); } return ErrorCode.Succeed; }