예제 #1
0
        public void AddTask(string location, CVSReader reader)
        {
            XFileReadAsync xFileReadAsync = new XFileReadAsync();

            xFileReadAsync.Location = location;
            xFileReadAsync.Reader   = reader;
            this._task_list.Add(xFileReadAsync);
        }
예제 #2
0
 private bool InnerExecute()
 {
     if (this._task_list.Count <= 0)
     {
         return(true);
     }
     if (XTableAsyncLoader.currentThreadCount <= 0)
     {
         return(false);
     }
     XTableAsyncLoader.currentThreadCount--;
     this.currentXfra = this._task_list[this._task_list.Count - 1];
     this._task_list.RemoveAt(this._task_list.Count - 1);
     this.ReadFileAsync(this.currentXfra);
     return(false);
 }
예제 #3
0
 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;
     });
 }