예제 #1
0
        private static void SetServerState()
        {
            Console.WriteLine("\n-- {0} --", MethodBase.GetCurrentMethod().Name);
            using (IFileZillaApi fileZillaApi = new FileZillaApi(IPAddress.Parse(Ip), Port)
            {
                Log = DebugLog
            })
            {
                fileZillaApi.Connect(ServerPassword);
                var serverState = fileZillaApi.GetServerState();
                Console.WriteLine("State is {0}", serverState);

                // Go offiline
                serverState = fileZillaApi.SetServerState(ServerState.GoOfflineNow);
                Console.WriteLine("GoOfflineNow State is {0}", serverState);
                Thread.Sleep(TimeSpan.FromSeconds(5));
                serverState = fileZillaApi.GetServerState();
                Console.WriteLine("State is {0}", serverState);

                // Go online
                serverState = fileZillaApi.SetServerState(ServerState.Online);
                Console.WriteLine("State is {0}", serverState);

                // Lock server
                serverState = fileZillaApi.SetServerState(ServerState.Online | ServerState.Locked);
                Console.WriteLine("Lock State is {0}", serverState);

                // Unlock
                serverState = fileZillaApi.SetServerState(ServerState.Online);
                Console.WriteLine("State is {0}", serverState);
            }
        }
예제 #2
0
        private static void SetServerState()
        {
            Console.WriteLine("-- {0} --", MethodBase.GetCurrentMethod().Name);
            using (IFileZillaApi fileZillaApi = new FileZillaApi(IPAddress.Parse(Ip), Port) { Log = new DebugTextWriter() })
            {
                fileZillaApi.Connect(ServerPassword);
                var serverState = fileZillaApi.GetServerState();
                Console.WriteLine("State is {0}", serverState);

                // Go offiline
                serverState = fileZillaApi.SetServerState(ServerState.GoOfflineNow);
                Console.WriteLine("GoOfflineNow State is {0}", serverState);
                Thread.Sleep(TimeSpan.FromSeconds(5));
                serverState = fileZillaApi.GetServerState();
                Console.WriteLine("State is {0}", serverState);

                // Go online
                serverState = fileZillaApi.SetServerState(ServerState.Online);
                Console.WriteLine("State is {0}", serverState);

                // Lock server
                serverState = fileZillaApi.SetServerState(ServerState.Online | ServerState.Locked);
                Console.WriteLine("Lock State is {0}", serverState);

                // Unlock
                serverState = fileZillaApi.SetServerState(ServerState.Online);
                Console.WriteLine("State is {0}", serverState);
            }
        }