private void OnError() { this.bytes = null; this.error = "Error occurred."; this.refBinder = null; /* バインダの破棄 */ if (this.newBinder != null) { this.newBinder.Dispose(); this.newBinder = null; } /* ローダの破棄 */ if (this.loader != null) { this.loader.Dispose(); this.loader = null; } this.phase = Phase.Done; this.Done(); return; }
private void UpdateLoader() { /* ローダが確保済みかどうかチェック */ if (this.loader == null) { /* ロード要求の発行 */ this.loader = new CriFsLoader(); this.loader.SetReadUnitSize(readUnitSize); this.bytes = new byte[this.fileSize]; this.loader.Load(this.refBinder, this.path, 0, this.fileSize, this.bytes); } /* ローダのステータスをチェック */ CriFsLoader.Status loaderStatus = this.loader.GetStatus(); if (loaderStatus == CriFsLoader.Status.Loading) { /* ロード中は何もしない */ return; } /* エラーチェック */ switch (loaderStatus) { case CriFsLoader.Status.Stop: this.bytes = null; break; case CriFsLoader.Status.Error: /* エラーに遷移 */ this.phase = Phase.Error; return; default: break; } /* フェーズの更新 */ this.phase = Phase.Done; /* ローダの破棄 */ this.loader.Dispose(); this.loader = null; /* バインダの破棄 */ if (this.newBinder != null) { this.newBinder.Dispose(); this.newBinder = null; } /* 処理の完了を通知 */ this.Done(); }
public override void Dispose() { if (this.isDisposed) { return; } /* ローダの破棄 */ if (this.loader != null) { this.loader.Dispose(); this.loader = null; } /* バインダの破棄 */ if (this.newBinder != null) { this.newBinder.Dispose(); this.newBinder = null; } /* メモリの解放 */ this.bytes = null; GC.SuppressFinalize(this); this.isDisposed = true; }