Exemplo n.º 1
0
        /// <summary>
        /// 将文件内容解析为VmparamsData。
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        public static VmparamsData ParseStringToData(string text)
        {
            VmparamsData data = new VmparamsData();

            data.rawVm = text;
            Regex regex = new Regex(@"(?<=\-xms)(.+?)\b", RegexOptions.IgnoreCase);

            data.xmsx = regex.Match(text).Value;
            return(data);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 从指定VmparamsData中将指定的内存字符串(如4096m)替换进应有的位置。
        /// </summary>
        /// <param name="data"></param>
        /// <param name="targetSetting"></param>
        /// <returns></returns>
        public static string ReplaceXMSetting(VmparamsData data, string targetSetting)
        {
            Regex regex = new Regex(@"(?<=\-xm[sx])(.+?)\b", RegexOptions.IgnoreCase);

            return(regex.Replace(data.rawVm, targetSetting));
        }