public void Dispose() { Scene = null; BackImage.ForEach(b => b.Dispose()); BackImage = null; Material.ForEach(m => m.Dispose()); Material = null; Object.ForEach(o => o.Dispose()); Object = null; }
public void Dispose() { Scene = null; BackImage.ForEach(b => b.Dispose()); BackImage = null; Material.ForEach(m => m.Dispose()); Material = null; Object.ForEach(o => o.Dispose()); Object = null; }
private bool parse(TextReader tr, bool triangle_only = false) { try { if (!parseHeader(tr)) return false; string str; while ((str = tr.ReadLine()) != null) { str = str.Trim(); if (str.StartsWith("Eof")) return true; if (str.StartsWith("Scene")) { Scene = new MQOScene(); if (!Scene.parse(tr)) return false; continue; } if (str.StartsWith("BackImage")) { if (!parseBackImage(tr)) return false; continue; } if (str.StartsWith("Material")) { if (!parseMaterial(tr)) return false; continue; } if (str.StartsWith("Object")) { Match m = MQORegex.Object.Match(str); if (!m.Success) return false; MQOObject mo = new MQOObject(m.Groups[1].Value); if (!mo.parse(tr, triangle_only)) { mo.Dispose(); mo = null; return false; } Object.Add(mo); continue; } // unknown block if (str.EndsWith("{")) { if (!skipBlock(tr)) return false; continue; } // unknown line } // "Eof"行が出現する前に終端に達した場合 return false; } catch (Exception ex) { MessageBox.Show(ex.ToString(),"エラー",MessageBoxButtons.OK,MessageBoxIcon.Error); return false; } }
private bool parse(TextReader tr, bool triangle_only = false) { try { if (!parseHeader(tr)) { return(false); } string str; while ((str = tr.ReadLine()) != null) { str = str.Trim(); if (str.StartsWith("Eof")) { return(true); } if (str.StartsWith("Scene")) { Scene = new MQOScene(); if (!Scene.parse(tr)) { return(false); } continue; } if (str.StartsWith("BackImage")) { if (!parseBackImage(tr)) { return(false); } continue; } if (str.StartsWith("Material")) { if (!parseMaterial(tr)) { return(false); } continue; } if (str.StartsWith("Object")) { Match m = MQORegex.Object.Match(str); if (!m.Success) { return(false); } MQOObject mo = new MQOObject(m.Groups[1].Value); if (!mo.parse(tr, triangle_only)) { mo.Dispose(); mo = null; return(false); } Object.Add(mo); continue; } // unknown block if (str.EndsWith("{")) { if (!skipBlock(tr)) { return(false); } continue; } // unknown line } // "Eof"行が出現する前に終端に達した場合 return(false); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } }