Пример #1
0
        public override bool HandleCommand(CommandContext context)
        {
            if (UsedCommand == "listd")
            {
                ListDirectories(context);
            }
            else if (UsedCommand == "mounts")
            {
                ServerLists fileLister = new ServerLists();

                CommandContext listContext = context.Clone();

                listContext.Command = "list";

                fileLister.HandleCommand(listContext);

                ListDirectories(context);

            }
            else
            {
                MountDirectories(context);
            }

            return true;
        }
Пример #2
0
        public override bool HandleCommand(CommandContext context)
        {
            bool listed = false;
            string command = context.Command;

            if (HasArguments && Arguments == "all")
            {
                DirectoryMounter mounter = new DirectoryMounter();

                CommandContext context2 = context.Clone();
                context2.Command = "listd";

                mounter.HandlesCommand(context2);
                mounter.HandleCommand(context2);
            }

            EventHandler<FileListEventArgs> handler = delegate(object sender, ObviousCode.Interlace.BitTunnelLibrary.Events.FileListEventArgs e)
                {
                    FullFileListReceived(e.FileList);

                    listed = true;
                };

            context.LocalClient.FullFileListReceived += new EventHandler<FileListEventArgs>(handler);

            context.LocalClient.RequestFullFileList();

            while (!listed)
            {
                Thread.Sleep(100);
            }

            context.LocalClient.FullFileListReceived -= new EventHandler<FileListEventArgs>(handler);

            return true;
        }