コード例 #1
0
ファイル: Ledger.cs プロジェクト: dipamchang/tnetd-open
        /// <summary>
        /// TODO: PROPER TESTBENCH { CRITICAL }
        /// </summary>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        public TreeResponseType AddUserToLedger(AccountInfo userInfo)
        {
            TreeResponseType response = LedgerTree.AddUpdate(userInfo);

            if (response == TreeResponseType.Added || response == TreeResponseType.Updated)
            {
                string address = userInfo.GetAddress();
                if (AddressAccountInfoMap.ContainsKey(address))
                {
                    AddressAccountInfoMap[address] = userInfo; // Update
                }
                else
                {
                    AddressAccountInfoMap.Add(address, userInfo); // Add
                }

                if (Utils.ValidateUserName( userInfo.Name))
                {
                    if (NameAccountInfoMap.ContainsKey(userInfo.Name))
                    {
                        NameAccountInfoMap[userInfo.Name] = userInfo; // Update
                    }
                    else
                    {
                        NameAccountInfoMap.Add(userInfo.Name, userInfo); // Add
                    }
                }

                if (initialLoading)
                {
                    if ((_load_stats % 100 == 0) && (LedgerEvent != null))
                        LedgerEvent(LedgerEventType.Progress, "Loaded " + _load_stats + " Accounts.");

                    _load_stats++;
                }

            }

            return response;
        }
コード例 #2
0
ファイル: JS_Structs.cs プロジェクト: dipamchang/tnetd-open
        public JS_AccountReply(AccountInfo accountInfo)
        {
            PublicKey = accountInfo.PublicKey.Hex;
            Money = accountInfo.Money;
            Name = accountInfo.Name;

            Address = accountInfo.GetAddress();

            NetworkType = accountInfo.NetworkType;
            AccountType = accountInfo.AccountType;

            AccountState = accountInfo.AccountState;
            LastTransactionTime = accountInfo.LastTransactionTime;
        }