コード例 #1
0
        private void Handle(ValidateArgs msg)
        {
            IncrementMessagesReceived();
            var child = Context.Child("directoryCrawler");
            if (child.Equals(ActorRefs.Nobody))
            {
                child = Context.ActorOf<DirectoryCrawler>("directoryCrawler");
            }

            child.Tell(new DirectoryToSearchMessage(msg.Folders, msg.Extension, _vm.TextSearch));
        }
コード例 #2
0
        private void Handle(ValidateArgs msg)
        {
            IncrementMessagesReceived();
            if (String.IsNullOrEmpty(msg.Folders))
            {
                Sender.Tell(new InvalidArgs("Folders argument is empty."));
            }
            else
            if (Directory.Exists(msg.Folders))
            {
                var extension = msg.Extension;
                if (String.IsNullOrEmpty(extension))
                {
                    extension = "*.txt";
                }
                Sender.Tell(new ValidateArgs(msg.Folders, extension));
            }
            else
            {
                Sender.Tell(new InvalidArgs(String.Format("Invalid Folder [{0}] [{1}]", msg.Folders, msg.Extension)));
            }

            Context.Stop(Self);
        }