示例#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 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);
    }
示例#3
0
        /// <summary>
        /// 保存文件
        /// </summary>
        /// <param name="baseVersion"></param>
        /// <param name="patchVersion"></param>
        /// <param name="hasCopy"></param>
        /// <param name="appVersion"></param>
        /// <returns></returns>
        public int save(string baseVersion = "", string patchVersion = "", string hasCopy = "", string appVersion = "")
        {
            UpdateLog.INFO_LOG(_TAG + "save()");
            int  ret       = CodeDefine.RET_SUCCESS;
            bool hasChange = false;

            try
            {
                if (!"".Equals(baseVersion) && baseVersion != _baseResVersion)
                {
                    _baseResVersion = baseVersion;
                    set(dom, "local_info/local_base_res_version", baseVersion);
                    hasChange = true;
                }
                if (!"".Equals(patchVersion) && patchVersion != _patchResVersion)
                {
                    _patchResVersion = patchVersion;
                    hasChange        = true;
                    set(dom, "local_info/local_patch_res_version", patchVersion);
                }
                if (!"".Equals(hasCopy) && hasCopy != _hasCopy)
                {
                    _hasCopy  = hasCopy;
                    hasChange = true;
                    set(dom, "local_info/hasCopy", hasCopy);
                }
                if (!"".Equals(appVersion) && appVersion != _localAppVersion)
                {
                    _localAppVersion = appVersion;
                    hasChange        = true;
                    set(dom, "local_info/local_app_version", appVersion);
                }
                if (hasChange)
                {
                    MonoXmlUtils.SaveXml(_localVersionXml, dom);
                }
                else
                {
                    UpdateLog.DEBUG_LOG("没有改动,不保存localversion.xml");
                }
            }
            catch (System.Exception ex)
            {
                ret = CodeDefine.RET_FAIL_SAVE_LOCAL_XML_FILE;
                UpdateLog.ERROR_LOG(_TAG + ex.Message + "\n" + ex.StackTrace);
                UpdateLog.EXCEPTION_LOG(ex);
            }

            return(ret);
        }
示例#4
0
    public bool Remove(string order)
    {
        if (FileUtils.Exist(PathUtils.RechargeOrderPath) == false)
        {
            return(false);
        }

        SecurityElement se = MonoXmlUtils.LoadXmlSE(PathUtils.RechargeOrderPath);

        if (MonoXmlUtils.RemoveByValue(se, order))
        {
            MonoXmlUtils.SaveXml(PathUtils.RechargeOrderPath, se);
            return(true);
        }
        else
        {
            return(false);
        }
    }
示例#5
0
    public bool Remove(string account)
    {
        if (FileUtils.Exist(PathUtils.AccountInfo) == false)
        {
            return(false);
        }

        SecurityElement se = MonoXmlUtils.LoadXmlSE(PathUtils.AccountInfo);

        if (MonoXmlUtils.RemoveByValue(se, account))
        {
            MonoXmlUtils.SaveXml(PathUtils.AccountInfo, se);
            return(true);
        }
        else
        {
            return(false);
        }
    }
示例#6
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="localVersion"></param>
        /// <returns></returns>
        public int save(LocalVersionXml localVersion)
        {
            UpdateLog.INFO_LOG(_TAG + "save()");
            int ret = CodeDefine.RET_SUCCESS;

            try
            {
                set(dom, "local_info/local_base_res_version", localVersion.BaseResVersion);
                set(dom, "local_info/local_patch_res_version", localVersion.PatchResVersion);
                set(dom, "local_info/hasCopy", localVersion.HasCopy);
                set(dom, "local_info/local_app_version", localVersion.LocalAppVersion);
                MonoXmlUtils.SaveXml(_localVersionXml, dom);
            }
            catch (System.Exception ex)
            {
                ret = CodeDefine.RET_FAIL_SAVE_LOCAL_XML_FILE;
                UpdateLog.ERROR_LOG(_TAG + ex.Message + "\n" + ex.StackTrace);
                UpdateLog.EXCEPTION_LOG(ex);
            }

            return(ret);
        }