Esempio n. 1
0
        /// <summary>
        /// 根据key值获取响应的param -key param
        /// </summary>
        /// <param name="args">命令行参数数组</param>
        /// <param name="key">目标key</param>
        /// <param name="value">转义结果, defalut=[-111000]转义失败</param>
        /// <returns>
        ///     [false]:转义失败
        /// </returns>
        public static bool TryParseCommandParam(string[] args, string key, out int value)
        {
            value = IntFailFlag;
            string strvalue;

            if (UdpHelper.TryParseCommandParam(args, key, out strvalue))
            {
                if (!int.TryParse(strvalue, out value))
                {
                    return(false);
                }
                return(true);
            }

            return(false);
        }
Esempio n. 2
0
 /*--------------------------------- Private Methods -------------------------------*/
 /// <summary>
 /// 将数组转义到确切的UDP配置定义
 /// </summary>
 /// <param name="args">命令参数</param>
 /// <param name="port">端口号</param>
 /// <param name="group">组地址</param>
 /// <param name="tag">识别标签</param>
 private static void ParseCommandOptions(string[] args, out int port, out string group, out string tag)
 {
     UdpHelper.TryParseCommandParam(args, "-p", out port);
     UdpHelper.TryParseCommandParam(args, "-g", out group);
     UdpHelper.TryParseCommandParam(args, "-t", out tag);
 }