private void god(string path, string dir) { using (Ftp client = new Ftp()) { try { // connect and login to the FTP client.Connect(path); client.Login("anonymous", "DONT-LOOK@MYCODE"); client.StateChanged += StateChanged; client.Traversing += Traversing; client.TransferProgressChanged += TransferProgressChanged; client.DeleteProgressChanged += DeleteProgressChanged; client.ProblemDetected += ProblemDetected; client.PutFile(dir, @"/user/app/temp.pkg"); client.SendCommand("installpkg"); var response = client.ReadResponse(); MessageBox.Show(response.Raw); SetText("Package Sent"); } catch (Exception ex) { MessageBox.Show(ex.Message); } client.Disconnect(); } }
private void btConnect_Click(object sender, EventArgs e) { if (_busy) { return; } if (_ftp != null) { _ftp.Disconnect(); _ftp.Dispose(); _ftp = null; SetConnectedState(false); return; } ConnectForm dlg = new ConnectForm(); if (dlg.ShowDialog() == DialogResult.OK) { _ftp = new Ftp(); _ftp.LogWriter = new RichTextBoxLogger(tbxLog, tbxLog.MaxLength, LogLevel.Info); // set event handlers _ftp.StateChanged += OnStateChanged; _ftp.Scanning += OnScanning; _ftp.TransferProgressChanged += OnTransferProgress; _ftp.DeleteProgressChanged += OnDeleteProgress; _ftp.FileTransferIssue += OnFileTransferIssue; try { _ftp.BeginConnect(dlg.Server, dlg.Port, dlg.SslMode, OnConnectFinish, dlg); } catch (Exception ex) { Log(ex); SetConnectedState(false); } } }
protected override void OnCreate(Bundle savedInstanceState) { _context = this; //first check if there are permsions to access files ext bool checks = true; #region << Check For Permisions >> // Android.Support.V4.Content.ContextCompat.CheckSelfPermission(this, Manifest.Permission.ReadExternalStorage) || ActivityCompat.CheckSelfPermission(this, Manifest.Permission.AccessWifiState) || Android.Support.V4.Content.ContextCompat.CheckSelfPermission(this, Manifest.Permission.Internet) if (Android.Support.V4.Content.ContextCompat.CheckSelfPermission(this, Manifest.Permission.Internet) != (int)Permission.Granted) { if (ActivityCompat.ShouldShowRequestPermissionRationale(this, Manifest.Permission.Internet)) { ActivityCompat.RequestPermissions(this, new String[] { Manifest.Permission.Internet, Manifest.Permission.Internet }, 1); // })).Show(); } while (ActivityCompat.CheckSelfPermission(this, Manifest.Permission.Internet) != (int)Permission.Granted) { Thread.Sleep(100); } } if (Android.Support.V4.Content.ContextCompat.CheckSelfPermission(this, Manifest.Permission.AccessWifiState) != (int)Permission.Granted) { if (ActivityCompat.ShouldShowRequestPermissionRationale(this, Manifest.Permission.AccessWifiState)) { ActivityCompat.RequestPermissions(this, new String[] { Manifest.Permission.AccessWifiState, Manifest.Permission.AccessWifiState }, 1); // })).Show(); } while (ActivityCompat.CheckSelfPermission(this, Manifest.Permission.AccessWifiState) != (int)Permission.Granted) { Thread.Sleep(100); } } if (Android.Support.V4.Content.ContextCompat.CheckSelfPermission(this, Manifest.Permission.AccessNetworkState) != (int)Permission.Granted) { if (ActivityCompat.ShouldShowRequestPermissionRationale(this, Manifest.Permission.AccessNetworkState)) { ActivityCompat.RequestPermissions(this, new String[] { Manifest.Permission.AccessNetworkState, Manifest.Permission.AccessNetworkState }, 1); // })).Show(); } while (ActivityCompat.CheckSelfPermission(this, Manifest.Permission.AccessNetworkState) != (int)Permission.Granted) { Thread.Sleep(100); } } if (Android.Support.V4.Content.ContextCompat.CheckSelfPermission(this, Manifest.Permission.ReadExternalStorage) != (int)Permission.Granted) { // Camera permission has not been granted RequestReadWirtePermission(); while (ActivityCompat.CheckSelfPermission(this, Manifest.Permission.ReadExternalStorage) != (int)Permission.Granted) { Thread.Sleep(100); } } #endregion << Check For Permisions >> base.OnCreate(savedInstanceState); //request the app to be full screen RequestWindowFeature(WindowFeatures.NoTitle); this.Window.ClearFlags(Android.Views.WindowManagerFlags.Fullscreen); //to hide Rebex.Licensing.Key = "==AnKxIZnJ2NXyRRk/MrXLh5vsLbImP/JhMGERReY23qIk=="; SetContentView(Resource.Layout.installer); refreshui(); retrieveset(); LoadPkg.Click += async delegate { try { String[] types = new String[] { ".pkg" }; FileData fileData = await CrossFilePicker.Current.PickFile(types); if (fileData == null) { return; // user canceled file picking } //com.android.externalstorage.documents System.Console.WriteLine("File name " + fileData.FileName); new Thread(new ThreadStart(delegate { RunOnUiThread(() => { progress = new ProgressDialog(this); progress.Indeterminate = true; progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner); progress.SetMessage("Loading... Getting Path..."); progress.SetCancelable(false); progress.Show(); }); FindFileByName(fileData.FileName); System.Console.WriteLine("Found File, Path= " + PKGLocation); RunOnUiThread(() => { progress.Hide(); try { var pkgfile = PS4_Tools.PKG.SceneRelated.Read_PKG(PKGLocation); ImageView pbPkg = FindViewById <ImageView>(Resource.Id.PKGIcon); pbPkg.SetImageBitmap(BytesToBitmap(pkgfile.Icon)); TextView lblPackageInfo = FindViewById <TextView>(Resource.Id.txtPKGInfo); lblPackageInfo.Text = pkgfile.PS4_Title + "\n" + pkgfile.PKG_Type.ToString() + "\n" + pkgfile.Param.TitleID; } catch (Exception ex) { MessageBox.Show("Invaild Package! or Path\n\n Location: " + PKGLocation); // MessageBox.Show("Exception choosing file: " + ex.ToString() + " " + PKGLocation); } }); })).Start(); } catch (Exception ex) { MessageBox.Show("Invaild Package! or Path\n\n Location: " + PKGLocation); // MessageBox.Show("Exception choosing file: " + ex.ToString() + " " + PKGLocation); } }; set.Click += async delegate { try { PKGLocation = manpath.Text; var pkgfile = PS4_Tools.PKG.SceneRelated.Read_PKG(PKGLocation); ImageView pbPkg = FindViewById <ImageView>(Resource.Id.PKGIcon); pbPkg.SetImageBitmap(BytesToBitmap(pkgfile.Icon)); TextView lblPackageInfo = FindViewById <TextView>(Resource.Id.txtPKGInfo); lblPackageInfo.Text = pkgfile.PS4_Title + "\n" + pkgfile.PKG_Type.ToString() + "\n" + pkgfile.Param.TitleID; } catch (Exception ex) { MessageBox.Show("Invaild Package! or Path\n\n Location: " + PKGLocation); // MessageBox.Show("Exception choosing file: " + ex.ToString() + " " + PKGLocation); } }; SendPayloadBtn.Click += delegate { new Thread(new ThreadStart(delegate { using (Ftp client = new Ftp()) { Rebex.Licensing.Key = "==AnKxIZnJ2NXyRRk/MrXLh5vsLbImP/JhMGERReY23qIk=="; try { // TextView IPAddressTextBox = FindViewById<TextView>(Resource.Id.IPAddressTextBox); if (IPAddressTextBox.Text == "") { RunOnUiThread(() => { MessageBox.Show("Enter an IP Address"); }); return; } saveset(); // string paths = GetPathToImage("sa"); // connect and login to the FTP client.Connect(IPAddressTextBox.Text); //TextView FTPPassword = FindViewById<TextView>(Resource.Id.FTPPassword); //TextView FTPUsername = FindViewById<TextView>(Resource.Id.FTPUsername); if (FTPPassword.Text == "" && FTPUsername.Text == "") { client.Login("anonymous", "DONT-LOOK@MYCODE"); } else { client.Login(FTPUsername.Text, FTPPassword.Text); } client.Traversing += Traversing; client.TransferProgressChanged += TransferProgressChanged; client.DeleteProgressChanged += DeleteProgressChanged; client.ProblemDetected += ProblemDetected; if (!client.DirectoryExists(@"/user/app/")) { client.CreateDirectory(@"/user/app/"); } if (client.FileExists(@"/user/app/temp.pkg")) { client.Delete(@"/user/app/temp.pkg", TraversalMode.NonRecursive); } client.ChangeDirectory(@"/user/app/"); client.PutFile(PKGLocation, "temp.pkg"); try { client.SendCommand("installpkg"); } catch (Exception ex) { SetTex("installpkg Failed\n Are you sure your using Inifinx?"); } SetTex("Package Sent"); } catch (Exception ex) { RunOnUiThread(() => { MessageBox.Show(ex.Message); }); } RunOnUiThread(() => { Toast.MakeText(Application.Context, "Package Sent!", ToastLength.Short).Show(); }); client.Disconnect(); } })).Start(); }; /* } * else * { * SendPayloadBtn.Visibility = ViewStates.Invisible; * LoadPkg.Visibility = ViewStates.Invisible; * }*/ }
protected override void OnCreate(Bundle savedInstanceState) { //first check if there are permsions to access files ext bool checks = true; _context = this; #region << Check For Permisions >> // Android.Support.V4.Content.ContextCompat.CheckSelfPermission(this, Manifest.Permission.ReadExternalStorage) || ActivityCompat.CheckSelfPermission(this, Manifest.Permission.AccessWifiState) || Android.Support.V4.Content.ContextCompat.CheckSelfPermission(this, Manifest.Permission.Internet) if (Android.Support.V4.Content.ContextCompat.CheckSelfPermission(this, Manifest.Permission.Internet) != (int)Permission.Granted) { if (ActivityCompat.ShouldShowRequestPermissionRationale(this, Manifest.Permission.Internet)) { ActivityCompat.RequestPermissions(this, new String[] { Manifest.Permission.Internet, Manifest.Permission.Internet }, 1); // })).Show(); } while (ActivityCompat.CheckSelfPermission(this, Manifest.Permission.Internet) != (int)Permission.Granted) { Thread.Sleep(100); } } if (Android.Support.V4.Content.ContextCompat.CheckSelfPermission(this, Manifest.Permission.AccessWifiState) != (int)Permission.Granted) { if (ActivityCompat.ShouldShowRequestPermissionRationale(this, Manifest.Permission.AccessWifiState)) { ActivityCompat.RequestPermissions(this, new String[] { Manifest.Permission.AccessWifiState, Manifest.Permission.AccessWifiState }, 1); // })).Show(); } while (ActivityCompat.CheckSelfPermission(this, Manifest.Permission.AccessWifiState) != (int)Permission.Granted) { Thread.Sleep(100); } } if (Android.Support.V4.Content.ContextCompat.CheckSelfPermission(this, Manifest.Permission.AccessNetworkState) != (int)Permission.Granted) { if (ActivityCompat.ShouldShowRequestPermissionRationale(this, Manifest.Permission.AccessNetworkState)) { ActivityCompat.RequestPermissions(this, new String[] { Manifest.Permission.AccessNetworkState, Manifest.Permission.AccessNetworkState }, 1); // })).Show(); } while (ActivityCompat.CheckSelfPermission(this, Manifest.Permission.AccessNetworkState) != (int)Permission.Granted) { Thread.Sleep(100); } } if (Android.Support.V4.Content.ContextCompat.CheckSelfPermission(this, Manifest.Permission.ReadExternalStorage) != (int)Permission.Granted) { // Camera permission has not been granted RequestReadWirtePermission(); while (ActivityCompat.CheckSelfPermission(this, Manifest.Permission.ReadExternalStorage) != (int)Permission.Granted) { Thread.Sleep(100); } } #endregion << Check For Permisions >> base.OnCreate(savedInstanceState); //request the app to be full screen RequestWindowFeature(WindowFeatures.NoTitle); this.Window.ClearFlags(Android.Views.WindowManagerFlags.Fullscreen); //to hide Rebex.Licensing.Key = "==AnKxIZnJ2NXyRRk/MrXLh5vsLbImP/JhMGERReY23qIk=="; SetContentView(Resource.Layout.plugin); refreshui(); retrieveset(); SendPayloadBtn.Click += delegate { new Thread(new ThreadStart(delegate { using (Ftp client = new Ftp()) { Rebex.Licensing.Key = "==AnKxIZnJ2NXyRRk/MrXLh5vsLbImP/JhMGERReY23qIk=="; try { // TextView IPAddressTextBox = FindViewById<TextView>(Resource.Id.IPAddressTextBox); if (IPAddressTextBox.Text == "") { RunOnUiThread(() => { MessageBox.Show("Enter an IP Address"); }); return; } saveset(); // connect and login to the FTP client.Connect(IPAddressTextBox.Text); //TextView FTPPassword = FindViewById<TextView>(Resource.Id.FTPPassword); //TextView FTPUsername = FindViewById<TextView>(Resource.Id.FTPUsername); if (FTPPassword.Text == "" && FTPUsername.Text == "") { client.Login("anonymous", "DONT-LOOK@MYCODE"); } else { client.Login(FTPUsername.Text, FTPPassword.Text); } client.Traversing += Traversing; client.TransferProgressChanged += TransferProgressChanged; client.DeleteProgressChanged += DeleteProgressChanged; client.ProblemDetected += ProblemDetected; string path = System.IO.Path.Combine(ApplicationContext.GetExternalFilesDir(Android.OS.Environment.DirectoryDownloads).AbsolutePath + @"/PayloadPlugin.prx"); // RunOnUiThread(() => { MessageBox.Show(path); }); bool exists = System.IO.Directory.Exists(System.IO.Path.Combine(ApplicationContext.GetExternalFilesDir(Android.OS.Environment.DirectoryDownloads).AbsolutePath)); if (!exists) { System.IO.Directory.CreateDirectory(System.IO.Path.Combine(ApplicationContext.GetExternalFilesDir(Android.OS.Environment.DirectoryDownloads).AbsolutePath)); } System.Console.WriteLine(path); SetTex("Downloading Plugin from DKS"); using (var clients = new WebClient()) { if (System.IO.Directory.Exists(path)) { System.IO.File.Delete(path); } clients.DownloadFile("https://psarchive.darksoftware.xyz/PayloadPlugin.prx", path); } if (!client.DirectoryExists(@"/user/app/")) { client.CreateDirectory(@"/user/app/"); } if (client.FileExists(@"/user/app/PayloadPlugin.prx")) { client.Delete(@"/user/app/PayloadPlugin.prx", TraversalMode.NonRecursive); } client.ChangeDirectory(@"/user/app/"); client.PutFile(path, @"PayloadPlugin.prx"); SetTex("Plugin Installed Successfully"); } catch (Exception ex) { RunOnUiThread(() => { MessageBox.Show(ex.Message); }); } RunOnUiThread(() => { Toast.MakeText(Application.Context, "Installed!", ToastLength.Short).Show(); }); client.Disconnect(); } })).Start(); }; /* } * else * { * SendPayloadBtn.Visibility = ViewStates.Invisible; * LoadPkg.Visibility = ViewStates.Invisible; * }*/ }