Esempio n. 1
56
        private APKNode InitializeAPKRoot()
        {
            string rootPublicKey = File.ReadAllText(@"D:\CashierKeys\public.xml");
            APKNode node = new APKNode();
            node.publicKey = rootPublicKey;
            node.value = "WORLD";
            node.siblingIndex = -1;

            return node;
        }
Esempio n. 2
35
        public List<APKNode> InserUser(string address, string userPublicKey)
        {
            string[] addressArray = address.Split('/');
            int j = 1;
            int i = 0;

            if (apkList == null)
            {
                apkList = new List<APKNode>();
                apkList.Add(InitializeAPKRoot());
            }

            while (i < addressArray.Length && j < apkList.Count)
            {
                if (string.Compare(apkList[j].value, addressArray[i], true) == 0)
                {
                    j++;
                    i++;
                }
                else if (apkList[j].siblingIndex != -1)
                    j = apkList[j].siblingIndex;
                else
                {
                    apkList[j].siblingIndex = apkList.Count;
                    j = apkList.Count;
                    break;
                }
            }
            while (i < addressArray.Length)
            {
                APKNode node = new APKNode();
                node.value = addressArray[i];
                node.siblingIndex = -1;
                if (++i == addressArray.Length)
                    node.publicKey = userPublicKey;
                apkList.Add(node);
            }
            apkdbTool.Store(apkList);
            return apkList;
        }