Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        protected void CreateSubTree(CASCFolder root, ulong filehash, string file)
        {
            string[] parts = file.Split(PathDelimiters);

            CASCFolder folder = root;

            for (int i = 0; i < parts.Length; ++i)
            {
                bool isFile = (i == parts.Length - 1);

                string entryName = parts[i];

                ICASCEntry entry = folder.GetEntry(entryName);

                if (entry == null)
                {
                    if (isFile)
                    {
                        entry = new CASCFile(filehash);
                        CASCFile.FileNames[filehash] = file;
                    }
                    else
                    {
                        entry = new CASCFolder(entryName);
                    }

                    folder.Entries[entryName] = entry;
                }

                folder = entry as CASCFolder;
            }
        }
Ejemplo n.º 3
0
        private static void Explore(CASCFolder folder, string findFile, SearchType type, List <CASCFile> found)
        {
            foreach (KeyValuePair <string, ICASCEntry> node in folder.Entries)
            {
                ICASCEntry entry = node.Value;

                if (entry is CASCFolder)
                {
                    Explore((CASCFolder)entry, findFile, type, found);
                }
                else if (entry is CASCFile)
                {
                    CASCFile file     = (CASCFile)entry;
                    string   fileName = file.FullName.ToLower();

                    if (type == SearchType.COMPLETE && fileName.Equals(fileName))
                    {
                        found.Add(file);
                        break;
                    }

                    if (type == SearchType.STARTS_WITH && fileName.StartsWith(findFile))
                    {
                        found.Add(file);
                        continue;
                    }

                    if (type == SearchType.ENDS_WITH && fileName.EndsWith(findFile))
                    {
                        found.Add(file);
                        continue;
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public RunnerBuildMinimap(CASCFile[] files)
        {
            this.files = files;

            // Index used to prevent overlap.
            Index = index;
            index++;
        }
Ejemplo n.º 5
0
        private void OnExploreHit(CASCFile file)
        {
            string[] parts = file.FullName.Split(new char[] { '/', '\\' });

            // Ignore noLiquid tiles.
            string fileName = parts[parts.Length - 1];
            if (fileName.StartsWith("noLiquid"))
                return;

            string mapName = parts[2];
            if (!mapName.ToLower().Equals("wmo"))
            {
                if (!maps.ContainsKey(mapName))
                {
                    UI_FileList.Nodes.Add(mapName);
                    maps.Add(mapName, new List<CASCFile>());
                }

                maps[mapName].Add(file);
                UpdateSearchState(Constants.SEARCH_STATE_SEARCHING);

                // "Cheap" way to find the map entry point without
                // reading DBC files. Used by exporter for non-full exports.
                Point point;

                if (!mapStartPoints.ContainsKey(mapName))
                {
                    point = new Point(63, 63);
                    mapStartPoints.Add(mapName, point);
                }
                else
                {
                    point = mapStartPoints[mapName];
                }

                Match match = mapTilePattern.Match(fileName);
                if (match.Success)
                {
                    int lowX = int.Parse(match.Groups[1].Value);
                    int lowY = int.Parse(match.Groups[2].Value);

                    if (lowX < point.X) point.X = lowX;
                    if (lowY < point.Y) point.Y = lowY;

                    mapStartPoints[mapName] = point;
                }
            }
        }
Ejemplo n.º 6
0
 public FileExtractCompleteArgs(CASCFile file, bool success, int runnerID)
     : base(success, runnerID)
 {
     File = file;
 }
Ejemplo n.º 7
0
        protected void CreateSubTree(CASCFolder root, ulong filehash, string file)
        {
            string[] parts = file.Split(PathDelimiters);

            CASCFolder folder = root;

            for (int i = 0; i < parts.Length; ++i)
            {
                bool isFile = (i == parts.Length - 1);

                string entryName = parts[i];

                ICASCEntry entry = folder.GetEntry(entryName);

                if (entry == null)
                {
                    if (isFile)
                    {
                        entry = new CASCFile(filehash);
                        CASCFile.FileNames[filehash] = file;
                    }
                    else
                    {
                        entry = new CASCFolder(entryName);
                    }

                    folder.Entries[entryName] = entry;
                }

                folder = entry as CASCFolder;
            }
        }
Ejemplo n.º 8
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);
                }
            }
        }
Ejemplo n.º 9
0
        private bool IsValidExtension(CASCFile file)
        {
            foreach (string extension in extensions)
                if (file.Name.ToLower().EndsWith(extension))
                    return true;

            return false;
        }
Ejemplo n.º 10
0
        public void OnExploreHit(CASCFile file)
        {
            Match match = ignoreFilter.Match(file.Name);

            if (match.Success)
            {
                string nameBase = match.Groups[1].ToString();
                if (!groupFiles.ContainsKey(nameBase))
                    groupFiles.Add(nameBase, new List<CASCFile>());

                groupFiles[nameBase].Add(file);
            }
        }
Ejemplo n.º 11
0
 //public FileExploreHitArgs(string identifier, StringHashPair file)
 public FileExploreHitArgs(string identifier, CASCFile entry)
 {
     ID = identifier;
     //File = file;
     Entry = entry;
 }