Ejemplo n.º 1
0
        public void VerifyDefaultPropertyValues()
        {
            var provider = new FtpProvider(_model);

            provider.InitialPath.Should().Be("/");

            provider.CanCreateFolder.Should().BeTrue();
            provider.Created.Should().Be(_model.Created);
            provider.Name.Should().Be("Ftp");
            provider.Id.Should().Be(_model.Id);

            provider.SupportsDirectAuth.Should().BeFalse();
            provider.SupportsHostAuth.Should().BeTrue();
            provider.SupportsOAuth.Should().BeFalse();
        }
Ejemplo n.º 2
0
 public GetVersionDetailsResponse GetVersionDetails()
 {
     return(HandleRequest(() =>
     {
         Logger.Verbose($"Get version details from {Ip}.");
         FtpProvider ftp = new FtpProvider();
         int version2 = ftp.GetVersion();
         return new GetVersionDetailsResponse
         {
             Ok = true,
             Version = Lobby.Instance.Version,
             VersionString = Lobby.Instance.VersionStr,
             Version2 = version2,
             VersionString2 = Version.ToString(version2)
         };
     }));
 }
Ejemplo n.º 3
0
 private void btnConnect_Click(object sender, EventArgs e)
 {
     _ftp = new FtpProvider(tbServer.Text, tbLogin.Text, tbPassword.Text);
     _ftp.FtpProgressChanged += new FtpProgressEventHandler(_ftp_FtpProgressChanged);
     ChangeDirectory("");
 }
Ejemplo n.º 4
0
        void ItemDropped(string item)
        {
            Console.WriteLine("Item dropped: {0}", item);

            //var provider = ProviderFactory.GetInstance();
            //if (provider.IsAuthenticated) {

            //}

            var provider = new FtpProvider();

            if (provider.Authenticated)
            {
                Console.WriteLine("Uploading...");
                provider.Upload(item, "asdf", (url) => {
                    Console.WriteLine("very nice => " + url);
                });
            }
            else
            {
                Console.WriteLine("authenticating...");
                var username = ConfigurationSettings.AppSettings["FtpUsername"];
                var password = ConfigurationSettings.AppSettings["FtpPassword"];
                provider.Authenticate(username, password, account => {
                    Console.WriteLine("cool. got: " + account);
                    var fileInfo = new System.IO.FileInfo(item);
                    provider.Upload(item, fileInfo.Name, (url) => {
                        Console.WriteLine("very nice => " + url);
                        BeginInvokeOnMainThread(() => {
                            // placing link into clipboard
                            NSPasteboard pb = NSPasteboard.GeneralPasteboard;
                            pb.DeclareTypes(new string[] { NSPasteboard.NSStringType }, null);
                            pb.SetStringForType(url, NSPasteboard.NSStringType);
                            Console.WriteLine("File will be available for download from {0}", url);

                            var sound = NSSound.FromName("Pop");
                            sound.Play();
                        });
                    });
                }, err => {
                    Console.WriteLine("not cool -- failed with: " + err);
                });
            }


            //if (Account.IsAuthenticated) {
            //	CreateShare(Account, item.Replace("file://localhost", "").Replace("%20", " "));
            //}
            //else {
            //	GettProvider.Instance.Authenticate(Account.Email, Account.Password, (account) => {
            //		// user is logged in

            //		// store retrieved access token for future requests
            //		Account.AccessToken = account.AccessToken;

            //		CreateShare(account, item.Replace("file://localhost", "").Replace("%20", " "));
            //	}, (error) => {
            //		// TODO: handle error message when uploading
            //		Console.WriteLine("Got an error: {0}", error);
            //	});
            //}
        }
Ejemplo n.º 5
0
 public async Task <IActionResult> Get()
 {
     //var progressHandler = new Progress<int>() as IProgress<int>;
     int count = 0;
     // 1. Ftp Provider
     FtpProvider Ftp = new FtpProvider("", Request) /*Url="", Parameters = Request*/ }