예제 #1
0
 public void Start()
 {
     try
     {
         using (DBDocumentStorage ds = new DBDocumentStorage(_config.DBPath))
         {
             Threads = new Dictionary<Thread, ThreadContext>();
             Dictionary<Guid, string> docs = ds.GetDocumentsList();
             int c = 0;
             Dictionary<Guid, string> ThrList = new Dictionary<Guid, string>();
             foreach(var doc in docs)
             {
                 c++;
                 if(c>= docs.Count/ ThreadCount)
                 {
                     Thread th = new Thread(Indexate);
                     IndexatorThreadContext tc = new IndexatorThreadContext(ThrList, th, Thread.CurrentThread, this);
                     th.IsBackground = true;
                     th.Start(tc);
                     Threads.Add(th, tc);
                     ThrList = new Dictionary<Guid, string>();
                     c = 0;
                 }
                 ThrList.Add(doc.Key, doc.Value);
             }
             Log("Threads started", "", LogType.Message);
         }
     }
     catch (Exception ex)
     {
         Log(string.Format("{0} \r\n{1}", ex.Message, ex.StackTrace), "SpydeeCore", LogType.Error, "CoreConstructor");
     }
 }
예제 #2
0
파일: MainForm.cs 프로젝트: kos811/Spydee2
 private void LoadFromDB(string ConnectionString)
 {
     DBstorage = new DBDocumentStorage(ConnectionString);
     docs = DBstorage.GetDocumentsList();
 }