Last active
December 10, 2016 05:29
-
-
Save bryc/18c1f976bb3ea5940c38f9fc191b5a76 to your computer and use it in GitHub Desktop.
C# Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// csc /target:winexe /nowin32manifest cbdropr.cs | |
using System; | |
using System.Windows.Forms; | |
namespace QWERTY { | |
public class cbdropr:Form { | |
void onEnter(object sender, DragEventArgs e) { | |
e.Effect = DragDropEffects.Copy; | |
} | |
void onDrop(object sender, DragEventArgs e) { | |
string url = e.Data.GetData(typeof(string)) as string; | |
System.Diagnostics.Process.Start("f.bat", url); | |
} | |
public cbdropr() { | |
this.AllowDrop = true; | |
this.DragEnter += new DragEventHandler(this.onEnter); | |
this.DragDrop += new DragEventHandler(this.onDrop); | |
} | |
[STAThread] | |
public static void Main(String[] args) { | |
Application.Run(new cbdropr()); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Compile using csc test.cs | |
using System; | |
using System.IO; | |
using System.Text; | |
using System.Linq; | |
public class Program | |
{ | |
static void Main(string[] args) | |
{ | |
if (args.Any() &&File.Exists(args[0])) | |
{ | |
var fs = new FileStream(args[0], FileMode.Open); | |
var len = (int)fs.Length; | |
var bits = new byte[len]; | |
fs.Read(bits, 0, len); | |
int i =0, j = 0; | |
for(i = 0; i < len; i++) | |
{ | |
if((bits[i] & 0xF0) == 0x90) | |
{ | |
j++; | |
} | |
} | |
Console.Write("Reading "+i+ " bytes.."); | |
Console.Write(" Count: "+j+"\n"); | |
Console.ReadLine(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment