Beispiel #1
0
        private void UI_FileList_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (UI_FileList.SelectedNode != null && UI_FileList.SelectedNode.Tag is CASCFile)
            {
                selectedFile    = null;
                selectedDbcFile = null;

                CASCFile cascFile = (CASCFile)UI_FileList.SelectedNode.Tag;
                string   tempPath = Path.Combine(Constants.TEMP_DIRECTORY, cascFile.FullName);
                selectedFile = cascFile;

                if (!File.Exists(tempPath))
                {
                    extractRunner = new RunnerExtractItem(cascFile);
                    runnerID      = extractRunner.runnerID;
                    extractRunner.Begin();

                    loadingWindow = new LoadingWindow("Loading DBC file: " + cascFile.Name, "Life advice: Avoid dragon's breath.", true, cancelCallback);
                    loadingWindow.ShowDialog();
                }
                else
                {
                    ShowDBCFile(tempPath);
                }
            }
        }
Beispiel #2
0
        private void LoadSelectedImage()
        {
            TreeNode selected = UI_FileList.SelectedNode;

            if (selected.Tag != null && selected.Tag is CASCFile)
            {
                CASCFile file = (CASCFile)selected.Tag;
                if (extractRunner != null)
                {
                    extractRunner.Kill();
                    extractRunner = null;
                }

                ClearImagePreview();

                UI_PreviewStatus.Text = "Loading...";
                UI_PreviewStatus.Show();

                string fullPath = Path.Combine(Constants.TEMP_DIRECTORY, file.FullName);
                if (File.Exists(fullPath))
                {
                    displayImage(fullPath);
                }
                else
                {
                    extractRunner = new RunnerExtractItem(file);
                    runnerID      = extractRunner.runnerID;
                    extractRunner.Begin();
                }
            }
        }
Beispiel #3
0
        public SoundPlayer(CASCFile file)
        {
            InitializeComponent();

            this.file = file;
            localPath = Path.Combine(Constants.TEMP_DIRECTORY, file.FullName);

            player = new ZPlay();
            if (!File.Exists(localPath))
            {
                EventManager.FileExtractComplete += OnFileExtractComplete;

                RunnerExtractItem extract = new RunnerExtractItem(file);
                runnerID = extract.runnerID;
                extract.Begin();

                SetState("Extracting file...");
            }
            else
            {
                ready = true;
                Play();
            }

            UI_TrackTitle.Text = file.Name;
            Text = file.Name + " - W3DT";

            UI_VolumeBar.Value = Program.Settings.SoundPlayerVolume;
            player.SetPlayerVolume(UI_VolumeBar.Value, UI_VolumeBar.Value);
        }
Beispiel #4
0
 private void CancelCallback()
 {
     if (extractRunner != null)
     {
         extractRunner.Kill();
         extractRunner = null;
     }
 }
Beispiel #5
0
        private void OnFileExtractComplete(object sender, EventArgs rawArgs)
        {
            FileExtractCompleteArgs args = (FileExtractCompleteArgs)rawArgs;

            if (args.RunnerID == runnerID)
            {
                extractRunner = null;

                loadingWindow.Close();
                loadingWindow = null;

                if (args.Success)
                {
                    ShowDBCFile(Path.Combine(Constants.TEMP_DIRECTORY, args.File.FullName));
                }
                else
                {
                    throw new Exception("Unable to extract DBC file -> " + args.File.FullName);
                }
            }
        }
Beispiel #6
0
        private void OnFileExtractComplete(object sender, EventArgs rawArgs)
        {
            FileExtractCompleteArgs args = (FileExtractCompleteArgs)rawArgs;

            if (args.RunnerID == runnerID)
            {
                currentImageName = null;

                UI_ExportButton.Hide();

                if (args.Success)
                {
                    displayImage(Path.Combine(Constants.TEMP_DIRECTORY, args.File.FullName));
                }
                else
                {
                    UI_PreviewStatus.Text = "Error loading image!";
                    UI_PreviewStatus.Show();
                }

                extractRunner = null;
            }
        }
Beispiel #7
0
        private void UI_FileList_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (UI_FileList.SelectedNode != null && UI_FileList.SelectedNode.Tag is CASCFile)
            {
                // Dispose current loaded file.
                if (loadedFile != null)
                {
                    loadedFile.flush();
                    loadedFile = null;
                }

                TerminateRunners();

                CASCFile entry    = (CASCFile)UI_FileList.SelectedNode.Tag;
                string   rootBase = Path.GetFileNameWithoutExtension(entry.FullName);

                currentFiles = new List <CASCFile>();
                currentFiles.Add(entry); // Root file.

                // Collect group files for extraction.
                if (groupFiles.ContainsKey(rootBase))
                {
                    foreach (CASCFile groupFile in groupFiles[rootBase])
                    {
                        currentFiles.Add(groupFile);
                    }
                }

                wmoDoneCount         = 0;
                wmoRunner            = new RunnerExtractItem(currentFiles.ToArray());
                wmoRunner.CacheCheck = true;
                wmoRunner.Begin();

                loadingWindow = new LoadingWindow("Loading WMO file: " + entry.Name, "No peons were harmed in the making of this software.", true, cancelCallback);
                loadingWindow.ShowDialog();
            }
        }