コード例 #1
0
        private void thread_DoWork(object sender, DoWorkEventArgs e)
        {
            if (isDemoProject)
            {
                string demoZipPath = System.Windows.Forms.Application.StartupPath + @"\APIDemo.lmg";
                if (File.Exists(demoZipPath))
                {
                    ZipFile zip = new ZipFile(demoZipPath);
                    if (Directory.Exists(dstPath + @"\APIDemo"))
                    {
                        createResult = false;
                        return;
                    }
                    IEnumerator <ZipEntry> entries = zip.GetEnumerator();

                    maxFileCount = 0;
                    while (entries.MoveNext())
                    {
                        ZipEntry entry = entries.Current;
                        maxFileCount++;
                    }

                    entries          = zip.GetEnumerator();
                    currentFileCount = 0;
                    while (entries.MoveNext())
                    {
                        ZipEntry entry = entries.Current;
                        entry.Extract(dstPath, ExtractExistingFileAction.OverwriteSilently);
                        pd.UpdateProgress((double)(++currentFileCount) / (double)maxFileCount);
                        pd.UpdateStatus(entry.FileName);
                    }
                }
                else
                {
                    createResult = false;
                }
            }
            else
            {
                maxFileCount     = fileCount(srcPath);
                currentFileCount = 0;
                Thread.Sleep(100);
                //dstPath += @"\" + projectName;
                if (Directory.Exists(dstPath))
                {
                    createResult = false;
                    return;
                }
                copyAll(srcPath, dstPath);

                if (isLandscape)
                {
                    File.Delete(dstPath + @"\assets\main_portrait.lua");
                }
                else
                {
                    File.Delete(dstPath + @"\assets\main.lua");
                    File.Move(dstPath + @"\assets\main_portrait.lua", dstPath + @"\assets\main.lua");
                }

                createProjectInformationFile();
            }
        }
コード例 #2
0
 private void zip_AddProgress(object sender, AddProgressEventArgs e)
 {
     if (e.EventType == ZipProgressEventType.Adding_AfterAddEntry)
     {
         pd.UpdateProgress((double)(e.EntriesTotal) / (double)(totalEntry));
         pd.UpdateStatus("Adding " + e.CurrentEntry.FileName);
     }
 }