示例#1
0
        public TreeWalker()
        {
            Mq = BlockingMq.GetMq();

            FileTaskScheduler = SnaffCon.GetFileTaskScheduler();
            TreeTaskScheduler = SnaffCon.GetTreeTaskScheduler();
            FileScanner       = SnaffCon.GetFileScanner();
        }
示例#2
0
        internal void GetComputerShares(string computer)
        {
            // find the shares
            HostShareInfo[]             hostShareInfos    = GetHostShareInfo(computer);
            BlockingStaticTaskScheduler treeTaskScheduler = SnaffCon.GetTreeTaskScheduler();

            foreach (HostShareInfo hostShareInfo in hostShareInfos)
            {
                string shareName = GetShareName(hostShareInfo, computer);
                if (!String.IsNullOrWhiteSpace(shareName))
                {
                    bool matched = false;

                    // classify them
                    foreach (ClassifierRule classifier in MyOptions.ShareClassifiers)
                    {
                        ShareClassifier shareClassifier = new ShareClassifier(classifier);
                        if (shareClassifier.ClassifyShare(shareName))
                        {
                            matched = true;
                            break;
                        }
                    }
                    // by default all shares should go on to TreeWalker unless the classifier pulls them out.
                    // send them to TreeWalker
                    if (!matched)
                    {
                        if (IsShareReadable(shareName))
                        {
                            ShareResult shareResult = new ShareResult()
                            {
                                Listable  = true,
                                SharePath = shareName
                            };
                            Mq.ShareResult(shareResult);

                            Mq.Info("Creating a TreeWalker task for " + shareResult.SharePath);
                            treeTaskScheduler.New(() =>
                            {
                                try
                                {
                                    new TreeWalker(shareResult.SharePath);
                                }
                                catch (Exception e)
                                {
                                    Mq.Trace(e.ToString());
                                }
                            });
                        }
                    }
                }
            }
        }
示例#3
0
 public ShareFinder()
 {
     Mq = BlockingMq.GetMq();
     TreeTaskScheduler = SnaffCon.GetTreeTaskScheduler();
     TreeWalker        = SnaffCon.GetTreeWalker();
 }