123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- using System;
- using System.Threading.Tasks;
- using System.Net;
- using System.IO;
- using System.Text;
- using Microsoft.AspNetCore.Components;
- namespace HyperCube.Pages
- {
- public partial class Blockchains
- {
- Models.AccountModel _currentAccount;
- [Parameter]
- public int Smart { get; set; }
- public string answer;
- public string myWallet;
- public string balanceToken
- {
- get { return HyperCube.Models.Blockchain.balanceToken; }
- set { }
- }
- //public partial class Blocchains
- //{
- // [Parameter]
- // public string Smart { get; set; }
- //}
- //public string mypath = @"Wallet";
- public string mypath = @"getfile";
- public string getFiles(string wallet, string cmd, string pwd = "")
- {
- mypath = @"c:\Users\Администратор\AppData\Local\Ethereum\rinkeby\keystore\";
- string ret = "";
- var files = Directory.GetFiles(mypath);
- foreach (var file in files)
- {
- string fileName = file.Substring(mypath.Length + 1);
- var name = fileName.Split("--");
- try
- {
- if ("0x" + name[2] == wallet)
- {
- if (cmd == "key")
- {
-
- Console.WriteLine($"pwd {pwd}");
- return Models.Blockchain.ExecuteCommand(name[2] + " " + pwd)[1];
- }
- else if (cmd == "json")
- {
- var content = File.ReadAllText(file);
- return content;
- }
- }
- }
- catch (Exception e)
- {
- Console.WriteLine($"Exception file {fileName}: {e.Message}");
- }
- }
- return ret;
- }
- }
- }
|