コード例 #1
0
        /// <summary>
        /// 处理封包的线程函数
        /// </summary>
        private void packThreadHandler(object packageData)
        {
            PackageData pd = (PackageData)packageData;

            PackageUtils.Pack(pd.flist, pd.savefile, pd.pak, pd.sign);
            this.finishFlag = true;
        }
コード例 #2
0
        /// <summary>
        /// 生成封包文件按钮
        /// </summary>
        private void button1_Click(object sender, EventArgs e)
        {
            if (this.listBox1.Items.Count == 0)
            {
                MessageBox.Show("先加入文件");
                return;
            }
            string packName = String.Empty;

            switch (this.comboBox1.SelectedIndex)
            {
            case 0:
                packName = PackageUtils.PackURI_PA_BACKGROUND + PackageUtils.PackPostfix;
                break;

            case 1:
                packName = PackageUtils.PackURI_PA_CHARASTAND + PackageUtils.PackPostfix;
                break;

            case 2:
                packName = PackageUtils.PackURI_PA_PICTURES + PackageUtils.PackPostfix;
                break;

            case 3:
                packName = PackageUtils.PackURI_SO_BGM + PackageUtils.PackPostfix;
                break;

            case 4:
                packName = PackageUtils.PackURI_SO_BGS + PackageUtils.PackPostfix;
                break;

            case 5:
                packName = PackageUtils.PackURI_SO_SE + PackageUtils.PackPostfix;
                break;

            case 6:
                packName = PackageUtils.PackURI_SO_VOCAL + PackageUtils.PackPostfix;
                break;
            }
            PackageData swapData = new PackageData()
            {
                flist    = this.pendingList,
                savefile = Halation.projectFolder + "\\" + packName,
                pak      = this.comboBox1.SelectedItem.ToString(),
                sign     = String.Format("{0}?{1}", Halation.project.Config.GameProjKey, Halation.project.Config.GameProjVersion)
            };

            this.progressBar1.Style = ProgressBarStyle.Marquee;
            this.listBox1.Enabled   = this.button1.Enabled = false;
            this.Text = "包管理器 [正在生成封包文件]";
            paker     = new Thread(new ParameterizedThreadStart(this.packThreadHandler))
            {
                IsBackground = true
            };
            paker.Start(swapData);
            while (!finishFlag)
            {
                Application.DoEvents();
            }
            MessageBox.Show("打包完毕");
            this.listBox1.Enabled   = this.button1.Enabled = true;
            this.progressBar1.Style = ProgressBarStyle.Continuous;
            this.progressBar1.Value = 0;
            this.Text  = "包管理器";
            finishFlag = false;
        }