Microsoft Build Tools 2015
.NET Framework 4.6.2 targeting Pack
версия с библиотекой
» Нажмите, для открытия спойлера | Press to open the spoiler «
Code
using System;
using System.IO;
using ZetaLongPaths;
namespace ConsoleApp1
{
static class Program
{
private static byte[] _pattern;
private static int _offset;
static void Main(string[] args)
{
if (args.Length < 3)
{
Console.WriteLine("program.exe offset pattern directory");
return;
}
if (!int.TryParse(args[0], out _offset))
{
Console.WriteLine("offset must be integer");
return;
}
if (args[1].Length % 2 != 0)
{
Console.WriteLine("incorrect pattern length, must be a multiple of two");
return;
}
_pattern = new byte[args[1].Length / 2];
for (int i = 0; i < _pattern.Length; i++)
{
var hexValue = args[1].Substring(i * 2, 2);
try
{
_pattern[i] = Convert.ToByte(hexValue, 16);
}
catch (Exception e)
{
Console.WriteLine("{0} - {1}", hexValue, e.Message);
return;
}
}
if (!Directory.Exists(args[2]))
{
Console.WriteLine("Target directoty not found");
return;
}
DirSearch(args[2]);
}
private static void DirSearch(string dir)
{
var folderPath = new ZlpDirectoryInfo(dir);
ZlpFileInfo[] fileList = { };
try
{
fileList = folderPath.GetFiles();
}
catch (Exception e)
{
Console.WriteLine("{0} - {1}", dir, e.Message);
}
foreach (var path in fileList)
{
try
{
var flag = true;
using (var reader = new BinaryReader(path.OpenRead()))
{
var buffer = reader.ReadBytes(_pattern.Length + _offset);
if (buffer.Length - _offset != _pattern.Length)
{
continue;
}
for (int i = 0; i < _pattern.Length; i++)
{
if (_pattern[i] != buffer[i + _offset])
{
flag = false;
break;
}
}
}
if (flag)
{
Console.WriteLine(path);
}
}
catch (Exception e)
{
Console.WriteLine("{0} - {1}", path, e.Message);
}
}
ZlpDirectoryInfo[] dirList = { };
try
{
dirList = folderPath.GetDirectories();
}
catch (Exception e)
{
Console.WriteLine("{0} - {1}", dir, e.Message);
}
foreach (var d in dirList)
{
DirSearch(d.OriginalPath);
}
}
}
}
using System.IO;
using ZetaLongPaths;
namespace ConsoleApp1
{
static class Program
{
private static byte[] _pattern;
private static int _offset;
static void Main(string[] args)
{
if (args.Length < 3)
{
Console.WriteLine("program.exe offset pattern directory");
return;
}
if (!int.TryParse(args[0], out _offset))
{
Console.WriteLine("offset must be integer");
return;
}
if (args[1].Length % 2 != 0)
{
Console.WriteLine("incorrect pattern length, must be a multiple of two");
return;
}
_pattern = new byte[args[1].Length / 2];
for (int i = 0; i < _pattern.Length; i++)
{
var hexValue = args[1].Substring(i * 2, 2);
try
{
_pattern[i] = Convert.ToByte(hexValue, 16);
}
catch (Exception e)
{
Console.WriteLine("{0} - {1}", hexValue, e.Message);
return;
}
}
if (!Directory.Exists(args[2]))
{
Console.WriteLine("Target directoty not found");
return;
}
DirSearch(args[2]);
}
private static void DirSearch(string dir)
{
var folderPath = new ZlpDirectoryInfo(dir);
ZlpFileInfo[] fileList = { };
try
{
fileList = folderPath.GetFiles();
}
catch (Exception e)
{
Console.WriteLine("{0} - {1}", dir, e.Message);
}
foreach (var path in fileList)
{
try
{
var flag = true;
using (var reader = new BinaryReader(path.OpenRead()))
{
var buffer = reader.ReadBytes(_pattern.Length + _offset);
if (buffer.Length - _offset != _pattern.Length)
{
continue;
}
for (int i = 0; i < _pattern.Length; i++)
{
if (_pattern[i] != buffer[i + _offset])
{
flag = false;
break;
}
}
}
if (flag)
{
Console.WriteLine(path);
}
}
catch (Exception e)
{
Console.WriteLine("{0} - {1}", path, e.Message);
}
}
ZlpDirectoryInfo[] dirList = { };
try
{
dirList = folderPath.GetDirectories();
}
catch (Exception e)
{
Console.WriteLine("{0} - {1}", dir, e.Message);
}
foreach (var d in dirList)
{
DirSearch(d.OriginalPath);
}
}
}
}
»» Нажмите, для закрытия спойлера | Press to close the spoiler ««
сбоку manual download
скачивается nuget файл, который является обычным архивом
файл \lib\net40-full\ZetaLongPaths.dll надо положить рядом с исходным кодом.
собирается такой командой
c:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe /reference:ZetaLongPaths.dll Program.cs