Exemple #1
0
        private Boolean Extract(string nhsfile)
        {
            // 用输入文件获取要解压缩的文件名
            string sfile = file.Replace(".nhs", ".sql");

            ReadOptions op = new ReadOptions();

            op.Encoding = Encoding.GetEncoding("gb2312");
            using (ZipFile zip = ZipFile.Read(nhsfile, op))
            {
                ZipEntry e = zip[sfile];
                // comment 的结构 hs_user|06版|1.4.1.4 productid 1, BL4, SP1PACK4
                string s = zip.Comment;
                user = s.Substring(0, s.IndexOf("|")); // 获取脚本用户

                // 确定CVSArg
                s = s.Substring(s.IndexOf("|") + 1);
                string Product = s.Substring(0, s.IndexOf("|"));
                s = s.Substring(s.IndexOf("|") + 1);
                string[] b = s.Split('.');
                cv = new CVSArg(Product, int.Parse(b[0]), int.Parse(b[1]), int.Parse(b[2]), int.Parse(b[3]));

                ms = new MemoryStream();
                e.ExtractWithPassword(ms, G_PASS);
            }

            return(true);
        }
Exemple #2
0
 private void button2_Click(object sender, EventArgs e)
 {
     CVSArg cv = new CVSArg("06版", 6, 11, 3, 4);
     Nhs nhs = new Nhs();
     nhs.TestEvent += new Nhs.TestEventHandler(nhs_TestEvent);
     DBUser d;
     foreach (ListViewItem l in lstFile.Items)
     {
         if (l.Checked && !l.SubItems[2].Text.Equals(string.Empty))
         {
             d = l.Tag as DBUser;
             nhs.file = d.file;
             nhs.RunNhs();
         }
     }
 }
Exemple #3
0
        private void button4_Click(object sender, EventArgs e)
        {
            CVSArg cv  = new CVSArg("06版", 6, 11, 3, 4);
            Nhs    nhs = new Nhs();

            nhs.TestEvent += new Nhs.TestEventHandler(nhs_TestEvent);
            DBUser d;

            foreach (ListViewItem l in lstFile.Items)
            {
                if (l.Checked && !l.SubItems[2].Text.Equals(string.Empty))
                {
                    d        = l.Tag as DBUser;
                    nhs.file = d.file;
                    nhs.ProcessSql(cv, d.name, nhs.sqlfile);
                }
            }
        }
Exemple #4
0
        /// <summary>
        /// 处理SQL,得到Nhs文件;处理的几步, 1-去注释 2-压缩
        /// </summary>
        /// <param name="cvs"></param>
        /// <param name="user"></param>
        /// <param name="sqlfile"></param>
        /// <returns></returns>
        public Boolean ProcessSql(CVSArg cvs, string user, string sqlfile)
        {
            this.cv   = cvs;
            this.user = user;
            //this.file = sqlfile.Replace(""); // 确定路径的名字
            sb.Clear();
            bool result = RemoveComment(sqlfile) && Compress(sqlfile);

            if (result)
            {
                RaiseEvent(sqlfile + "处理完成");
            }
            else
            {
                RaiseEvent(sqlfile + "处理失败");
            }

            return(result);
        }
Exemple #5
0
        private Boolean Extract(string nhsfile)
        {
            // 用输入文件获取要解压缩的文件名
            string sfile = file.Replace(".nhs", ".sql");

            ReadOptions op = new ReadOptions();
            op.Encoding = Encoding.GetEncoding("gb2312");
            using (ZipFile zip = ZipFile.Read(nhsfile, op))
            {
                ZipEntry e = zip[sfile];
                // comment 的结构 hs_user|06版|1.4.1.4 productid 1, BL4, SP1PACK4
                string s = zip.Comment;
                user = s.Substring(0, s.IndexOf("|")); // 获取脚本用户

                // 确定CVSArg
                s = s.Substring(s.IndexOf("|") + 1);
                string Product = s.Substring(0, s.IndexOf("|"));
                s = s.Substring(s.IndexOf("|") + 1);
                string[] b = s.Split('.');
                cv = new CVSArg(Product, int.Parse(b[0]), int.Parse(b[1]), int.Parse(b[2]), int.Parse(b[3]));

                ms = new MemoryStream();
                e.ExtractWithPassword(ms, G_PASS);
            }

            return true;
        }
Exemple #6
0
        /// <summary>
        /// 处理SQL,得到Nhs文件;处理的几步, 1-去注释 2-压缩
        /// </summary>
        /// <param name="cvs"></param>
        /// <param name="user"></param>
        /// <param name="sqlfile"></param>
        /// <returns></returns>
        public Boolean ProcessSql(CVSArg cvs, string user, string sqlfile)
        {
            this.cv = cvs;
            this.user = user;
            //this.file = sqlfile.Replace(""); // 确定路径的名字
            sb.Clear();
            bool result = RemoveComment(sqlfile) && Compress(sqlfile);

            if (result)
                RaiseEvent(sqlfile + "处理完成");
            else
                RaiseEvent(sqlfile + "处理失败");

            return result;
        }