Skip to content

Instantly share code, notes, and snippets.

@bryc
Last active December 10, 2016 05:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bryc/18c1f976bb3ea5940c38f9fc191b5a76 to your computer and use it in GitHub Desktop.
Save bryc/18c1f976bb3ea5940c38f9fc191b5a76 to your computer and use it in GitHub Desktop.
C# Code
// 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());
}
}
}
//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