示例#1
0
        /// <summary>
        /// 下载规则文件。
        /// </summary>
        /// <param name="type">规则类型(国环、北环、CCC)。</param>
        /// <param name="versionName">规则版本(fill、detect、compare)</param>
        /// <param name="standard">排放标准。</param>
        /// <param name="carType">车辆类型。</param>
        /// <param name="filename">文件绝对路径。</param>
        public static void DownloadFillRule(string type, string versionName, string standard, string carType, string filename)
        {
            FileInfo info        = new FileInfo(filename);
            string   name        = info.Name;
            bool     useStandard = FileHelper.GetUseStandard(versionName, type);

            if (string.IsNullOrEmpty(standard) || useStandard == false)
            {
                standard = "All";
            }
            if (string.IsNullOrEmpty(carType))
            {
                carType = "All";
            }
            string version = FileHelper.GetFillVersionByName(versionName);

            byte[] bytes = client.fillRuleDowload(name, type, version, standard, carType);
            if (bytes == null)
            {
                return;
            }
            if (info.Directory.Exists == false)
            {
                info.Directory.Create();
            }
            using (FileStream stream = info.Create())
            {
                stream.Write(bytes, 0, bytes.Length);
            }
        }
示例#2
0
        /// <summary>
        /// 下载规则文件。
        /// </summary>
        /// <param name="type">规则类型(国环、北环、CCC)。</param>
        /// <param name="version">规则版本(fill、detect、compare)</param>
        /// <param name="standard">排放标准。</param>
        /// <param name="carType">车辆类型。</param>
        /// <param name="filename">文件绝对路径。</param>
        public static void DownloadFillRule(string type, string version, string standard, string carType, string filename)
        {
            FileInfo info = new FileInfo(filename);
            string   name = info.Name;

            if (string.IsNullOrEmpty(standard))
            {
                standard = "Default";
            }
            if (string.IsNullOrEmpty(carType))
            {
                carType = name;
            }
            byte[] bytes = client.fillRuleDowload(name, type, version, standard, carType);
            using (FileStream stream = info.Create())
            {
                stream.Write(bytes, 0, bytes.Length);
            }
        }