public override bool Init() { if (this._inited) { return(true); } if (this._async_loader == null) { this._async_loader = new XTableAsyncLoader(); this._async_loader.AddTask("Table/StringTable", this._reader); this._async_loader.Execute(null); } this._inited = this._async_loader.IsDone; return(this._inited); }
private void ReadFileAsync(XFileReadAsync xfra) { XTableAsyncLoader.AddTableScript(xfra.Location, xfra.Reader.GetType()); xfra.Data = new MemoryStream(); if (!XSingleton <XResourceLoaderMgr> .singleton.ReadText(xfra.Location, xfra.Data as MemoryStream, false)) { XResourceLoaderMgr.LoadErrorLog(xfra.Location); xfra.Data.Close(); xfra.Data = null; xfra.IsDone = true; this.currentXfra = null; return; } ThreadPool.QueueUserWorkItem(delegate(object state) { try { if (!xfra.Reader.ReadFile(xfra.Data)) { XSingleton <XDebug> .singleton.AddErrorLog("in File: ", xfra.Location, xfra.Reader.error, null, null, null); } else { xfra.IsDone = true; } } catch (Exception ex) { XSingleton <XDebug> .singleton.AddErrorLog(ex.Message, " in File: ", xfra.Location, xfra.Reader.error, null, null); } if (xfra.Data != null) { xfra.Data.Close(); xfra.Data = null; } this.currentXfra = null; }); }
public override void Uninit() { this._inited = false; this._async_loader = null; }