Exemplo n.º 1
0
        public static int Main(string[] args)
        {
            var logger = new LoggerConfiguration().WriteTo.Console().CreateLogger();

            var userOutput = new ConsoleUserOutput();

            userOutput.WriteLine("Catalyst Network Simulator");

            var passwordRegistry = new PasswordRegistry();

            Parser.Default.ParseArguments <Options>(args).WithParsed(options => passwordRegistry.SetFromOptions(options));

            var fileSystem            = new FileSystem();
            var userInput             = new ConsoleUserInput();
            var consolePasswordReader = new ConsolePasswordReader(userOutput, userInput);
            var certificateStore      = new CertificateStore(fileSystem, new PasswordManager(consolePasswordReader, passwordRegistry));
            var certificate           = certificateStore.ReadOrCreateCertificateFile("mycert.pfx");
            var signingContext        = new SigningContext {
                NetworkType = NetworkType.Devnet, SignatureType = SignatureType.ProtocolPeer
            };

            var clientRpcInfoList =
                ConfigHelper.GenerateClientRpcInfoFromConfig(userOutput, passwordRegistry, certificate, logger, signingContext
                                                             ).ToList();

            var simulation = new TransactionSimulation(userOutput);
            var simulator  = new Simulator(simulation, logger);

            simulator.SimulateAsync(clientRpcInfoList).Wait();

            return(Environment.ExitCode);
        }
Exemplo n.º 2
0
 public void GetPasswordTest()
 {
     if (!PasswordRegistry.GetPassword("HKEY_CURRENT_CONFIG", "TanganPassword", "HKEY_CURRENT_CONFIG//TanganPassword").Equals("TestOK"))
     {
         Assert.Fail();
     }
 }
Exemplo n.º 3
0
        public static void AddPassword(PasswordRegistry passwordRegistry, PasswordRegistryTypes passwordRegistryTypes, string password)
        {
            var secureString = new SecureString();

            foreach (var character in password)
            {
                secureString.AppendChar(character);
            }

            passwordRegistry.AddItemToRegistry(passwordRegistryTypes, secureString);
        }
Exemplo n.º 4
0
        public static PasswordRegistry SetFromOptions(this PasswordRegistry passwordRegistry, Options options)
        {
            if (!string.IsNullOrEmpty(options.NodePassword))
            {
                PasswordRegistryHelper.AddPassword(passwordRegistry, PasswordRegistryTypes.DefaultNodePassword,
                                                   options.NodePassword);
            }

            if (!string.IsNullOrEmpty(options.SslCertPassword))
            {
                PasswordRegistryHelper.AddPassword(passwordRegistry, PasswordRegistryTypes.CertificatePassword,
                                                   options.SslCertPassword);
            }

            return(passwordRegistry);
        }
Exemplo n.º 5
0
        public Statistic()
        {
            InitializeComponent();
            var mailBox = ImapMailBox.Singleton();
            var config  = ConfigService.Singleton();

            mailBox.Connect("tangantasktest",
                            PasswordRegistry.GetPassword("HKEY_CURRENT_CONFIG", "TanganPassword", "HKEY_CURRENT_CONFIG//TanganPassword"),
                            config.ImapServer,
                            config.ImapPort, config.ImapSSL);
            int unread = mailBox.CountUnread();
            var dal    = new DataAccessLayer("Database.db");

            dal.Check(mailBox.LastUnreadDate());
            this.label1.Text = "Количество непрочитанных сообщений: " + unread;
        }
Exemplo n.º 6
0
    protected void register_Click(object sender, EventArgs e)
    {
        string userEmail   = ((TextBox)EmailRegistry.FindControl("EmailRegistry")).Text;
        string firstName   = ((TextBox)FirstNameRegistry.FindControl("FirstNameRegistry")).Text;
        string lastName    = ((TextBox)LastNameRegistry.FindControl("LastNameRegistry")).Text;
        string dateOfBirth = ((TextBox)DateOfBirth.FindControl("DateOfBirth")).Text;
        string password    = ((TextBox)PasswordRegistry.FindControl("PasswordRegistry")).Text;
        string gender      = ((DropDownList)GenderList.FindControl("GenderList")).Text;

        Session["userEmail"] = userEmail;


        string registerSql = "insert into [User](Password, Email, FirstName, LastName, Gender, dateOfBirth) values ('" + password + "','" + userEmail + "','" + firstName + "','" + lastName + "','" + gender + "','" + dateOfBirth + "')";

        function.Create(registerSql);
        Response.Redirect("Homepage.aspx");
    }
Exemplo n.º 7
0
 public void Init()
 {
     _passwordRegistry = new PasswordRegistry();
 }
Exemplo n.º 8
0
 public PasswordRegistryTests()
 {
     _passwordRegistry = new PasswordRegistry();
 }