示例#1
0
        protected override void OnStart(string[] args)
        {
            _shareManager.Start();

            ShareConfiguration dataShare = new FileSystemShareConfiguration()
            {
                Name = "Data",
                Path = "X:\\"
            };

            ShareConfiguration backupShare = new FileSystemShareConfiguration()
            {
                Name = "Time Capsule",
                Path = "X:\\Backups\\Time Capsule"
            };

            ServerConfiguration afpServer = new AppleFilingProtocolServerConfiguration()
            {
                Name = "Skynet",
                TimeMachineShares = { "Time Capsule" }
            };

            ServiceConfiguration service = new ServiceConfiguration()
            {
                Servers = { afpServer },
                Shares  = { dataShare, backupShare }
            };

            _shareManager.Configuration = service;
        }
示例#2
0
        static void Main(string[] args)
        {
            try {
                Console.BackgroundColor = ConsoleColor.White;
                Console.ForegroundColor = ConsoleColor.Black;
                Console.BufferHeight    = 120;
                Console.BufferWidth     = 190;
                Console.WindowHeight    = 60;
                Console.WindowWidth     = 180;
            } catch { }

            Console.Clear();

            Log.EntryAdded += new Log.EntryAddedHandler(Log_EntryAdded);

            _shareManager = new ShareManager();

            _shareManager.Start();

            ShareConfiguration dataShare = new FileSystemShareConfiguration()
            {
                Name = "Data",
                Path = "X:\\"
            };

            ShareConfiguration backupShare = new FileSystemShareConfiguration()
            {
                Name = "Time Capsule",
                Path = "X:\\Backups\\Time Capsule"
            };

            ServerConfiguration afpServer = new AppleFilingProtocolServerConfiguration()
            {
                Name = "Skynet",
                TimeMachineShares = { "Time Capsule" }
            };

            ServiceConfiguration service = new ServiceConfiguration()
            {
                Servers = { afpServer },
                Shares  = { dataShare, backupShare }
            };

            _shareManager.Configuration = service;

            //IShareServer server = _shareManager.Servers[0];

            //server.AuthenticationProvider = new TestAuth();

            //AfpShareServer afpShareServer = (AfpShareServer)server;
            //afpShareServer.AuthenticationMethods.Clear();
            //afpShareServer.AuthenticationMethods.Add(new Afp.Protocol.Security.AfpCleartextUserAuthenticationMethod());

            for (; ;)
            {
                string line = Console.ReadLine();
                if (line == "x")
                {
                    if (_shareManager.IsRunning)
                    {
                        Console.WriteLine("Stopping...");
                        _shareManager.Stop();
                        Console.WriteLine("Stopped.");
                    }
                    else
                    {
                        Console.WriteLine("Starting...");
                        _shareManager.Start();
                    }
                }
                else
                {
                    break;
                }
            }

            _shareManager.Stop();
        }
示例#3
0
        static void Main(string[] args)
        {
            try {
                Console.BackgroundColor = ConsoleColor.White;
                Console.ForegroundColor = ConsoleColor.Black;
                Console.BufferHeight = 120;
                Console.BufferWidth = 190;
                Console.WindowHeight = 60;
                Console.WindowWidth = 180;
            } catch { }

            Console.Clear();

            Log.EntryAdded += new Log.EntryAddedHandler(Log_EntryAdded);

            _shareManager = new ShareManager();

            _shareManager.Start();

            ShareConfiguration dataShare = new FileSystemShareConfiguration() {
                Name = "Data",
                Path = "X:\\"
            };

            ShareConfiguration backupShare = new FileSystemShareConfiguration() {
                Name = "Time Capsule",
                Path = "X:\\Backups\\Time Capsule"
            };

            ServerConfiguration afpServer = new AppleFilingProtocolServerConfiguration() {
                Name = "Skynet",
                TimeMachineShares = { "Time Capsule" }
            };

            ServiceConfiguration service = new ServiceConfiguration() {
                Servers = { afpServer },
                Shares = { dataShare, backupShare }
            };

            _shareManager.Configuration = service;

            //IShareServer server = _shareManager.Servers[0];

            //server.AuthenticationProvider = new TestAuth();

            //AfpShareServer afpShareServer = (AfpShareServer)server;
            //afpShareServer.AuthenticationMethods.Clear();
            //afpShareServer.AuthenticationMethods.Add(new Afp.Protocol.Security.AfpCleartextUserAuthenticationMethod());

            for (; ; ) {
                string line = Console.ReadLine();
                if (line == "x") {
                    if (_shareManager.IsRunning) {
                        Console.WriteLine("Stopping...");
                        _shareManager.Stop();
                        Console.WriteLine("Stopped.");
                    } else {
                        Console.WriteLine("Starting...");
                        _shareManager.Start();
                    }
                } else {
                    break;
                }
            }

            _shareManager.Stop();
        }