示例#1
0
    public void Add(string order)
    {
        SecurityElement se;

        if (FileUtils.Exist(PathUtils.RechargeOrderPath) == false)
        {
            se = MonoXmlUtils.Create();
        }
        else
        {
            se = MonoXmlUtils.LoadXmlSE(PathUtils.RechargeOrderPath);
        }

        SecurityElement item;
        bool            found = false;

        if (se.Children != null)
        {
            for (int i = 0, count = se.Children.Count; i < count; ++i)
            {
                item = se.Children[i] as SecurityElement;
                if (item.Text.CompareTo(order) == 0)
                {
                    found = true;
                }
            }
        }

        if (found == false)
        {
            MonoXmlUtils.Add(se, "order", order);

            MonoXmlUtils.SaveXml(PathUtils.RechargeOrderPath, se);
        }
    }
示例#2
0
    public List <string> GetAllOrder()
    {
        List <string> result = new List <string>();

        SecurityElement se;

        if (FileUtils.Exist(PathUtils.RechargeOrderPath) == false)
        {
            se = MonoXmlUtils.Create();
        }
        else
        {
            se = MonoXmlUtils.LoadXmlSE(PathUtils.RechargeOrderPath);
        }

        if (se.Children != null)
        {
            SecurityElement item;
            for (int i = 0, count = se.Children.Count; i < count; ++i)
            {
                item = se.Children[i] as SecurityElement;
                result.Add(item.Text);
            }
        }

        return(result);
    }
示例#3
0
    public List <string> GetAllPassward()
    {
        List <string> result = new List <string>();

        SecurityElement se;

        if (FileUtils.Exist(PathUtils.AccountInfo) == false)
        {
            se = MonoXmlUtils.Create();
        }
        else
        {
            se = MonoXmlUtils.LoadXmlSE(PathUtils.AccountInfo);
        }

        if (se.Children != null)
        {
            SecurityElement item;
            string          pwd;
            for (int i = 0, count = se.Children.Count; i < count; ++i)
            {
                item = se.Children[i] as SecurityElement;
                pwd  = item.Attributes["pwd"] as string;
                if (string.IsNullOrEmpty(item.Text) == false && string.IsNullOrEmpty(pwd) == false)
                {
                    result.Add(pwd);
                }
            }
        }

        return(result);
    }
示例#4
0
    public void Add(string account, string password)
    {
        if (string.IsNullOrEmpty(account) || string.IsNullOrEmpty(password))
        {
            return;
        }
        SecurityElement se;

        if (FileUtils.Exist(PathUtils.AccountInfo) == false)
        {
            se = MonoXmlUtils.Create();
        }
        else
        {
            se = MonoXmlUtils.LoadXmlSE(PathUtils.AccountInfo);
        }

        SecurityElement item;
        bool            found = false;

        if (se.Children != null)
        {
            int index = 0;
            for (int i = 0, count = se.Children.Count; i < count; ++i)
            {
                item = se.Children[i] as SecurityElement;
                if (string.IsNullOrEmpty(item.Text) == false && item.Text.CompareTo(account) == 0)
                {
                    found = true;
                    index = i;
                    item.SetAttribute("pwd", password);
                }
            }

            if (index != 0)
            {
                ///将本次登录的账号置于第一位,下次登录默认就是这个账号了
                string median = (se.Children[0] as SecurityElement).Text;
                (se.Children[0] as SecurityElement).Text     = (se.Children[index] as SecurityElement).Text;
                (se.Children[index] as SecurityElement).Text = median;
                median = (se.Children[0] as SecurityElement).Attributes["pwd"] as string;
                (se.Children[0] as SecurityElement).SetAttribute("pwd", (se.Children[index] as SecurityElement).Attributes["pwd"] as string);
                (se.Children[index] as SecurityElement).SetAttribute("pwd", median);
            }
        }

        if (found == false)
        {
            MonoXmlUtils.AddAttr(se, account, password);
        }
        MonoXmlUtils.SaveXml(PathUtils.AccountInfo, se);
    }