Beispiel #1
0
        /// <summary>
        /// 子线程实际执行函数
        /// </summary>
        private void BinUnzip(List <string> binfilenames, UnzipObject UnzipObject)
        {
            string    UnzipPath    = System.IO.Path.GetDirectoryName(binfilenames[0]);//获取文件所在路径
            ArrayList BinfileIndex = new ArrayList();

            switch (UnzipObject)
            {
            case UnzipObject.ImageBin:
                foreach (string file in binfilenames)
                {
                    BinfileIndex.Add(Convert.ToInt32(System.IO.Path.GetFileNameWithoutExtension(file)));            //获取文件编号
                }
                Program.UnzipMultiImgBins(UnzipPath, binfilenames.Count, (int[])BinfileIndex.ToArray(typeof(int))); //调用解包函数
                DevExpress.XtraEditors.XtraMessageBox.Show("解压完成");
                break;

            case UnzipObject.FeatureBin:
                foreach (string file in binfilenames)
                {
                    BinfileIndex.Add(Convert.ToInt32(System.IO.Path.GetFileNameWithoutExtension(file)));                //获取文件编号
                }
                Program.UnzipMultiFeatureBins(UnzipPath, binfilenames.Count, (int[])BinfileIndex.ToArray(typeof(int))); //调用解包函数
                DevExpress.XtraEditors.XtraMessageBox.Show("解压完成");
                break;

            default: break;
            }
        }
Beispiel #2
0
        /// <summary>
        /// 选择图片压缩文件事件
        /// </summary>
        private void ImgBinButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Multiselect = true;//等于true表示可以选择多个文件
            dlg.DefaultExt  = ".bin";
            dlg.Filter      = "图片打包文件|*.bin";
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                ImgUnzipList.Clear();     //图像打包文本框清空
                FeatureUnzipList.Clear(); //特征打包文件文本框清空
                ObjectChoose = UnzipObject.ImageBin;
                binfilenames.Clear();
                foreach (string file in dlg.FileNames)
                {
                    binfilenames.Add(file);
                    ImgUnzipList.AppendText(file);                //显示文件名
                    ImgUnzipList.AppendText(Environment.NewLine); //换行
                }
            }
        }