Example #1
0
        public static string GetAssetPathToCopy(bool isName = false, bool withExtension = true)
        {
            string treePath = TreeViewUtility.GetFullPath(FWindow.TVItem);
            string path     = treePath + "/" + FWindow.FCurrentAsset;

            path = path.Contains(".") ? path : path + ".uasset";

            if (isName)
            {
                path = Path.GetFileName(path);
            }

            if (!withExtension)
            {
                path = isName ? Path.GetFileNameWithoutExtension(path) : FoldersUtility.GetFullPathWithoutExtension(path);
            }
            if (path.StartsWith("/"))
            {
                path = path.Substring(1);
            }

            new UpdateMyConsole(path, CColors.Blue).Append();
            new UpdateMyConsole(" Copied!", CColors.White, true).Append();
            return(path);
        }
Example #2
0
        public static void ExportAssetData(string fPath = null)
        {
            string fullPath = fPath == null?TreeViewUtility.GetFullPath(FWindow.TVItem) + "/" + FWindow.FCurrentAsset : fPath;

            PakReader.PakReader reader = GetPakReader(fullPath);
            if (reader != null)
            {
                List <FPakEntry> entriesList = GetPakEntries(fullPath);
                foreach (FPakEntry entry in entriesList)
                {
                    string path       = FProp.Default.FOutput_Path + "\\Exports\\" + entry.Name;
                    string pWExt      = FoldersUtility.GetFullPathWithoutExtension(entry.Name);
                    string subfolders = pWExt.Substring(0, pWExt.LastIndexOf("/", StringComparison.InvariantCultureIgnoreCase));

                    Directory.CreateDirectory(FProp.Default.FOutput_Path + "\\Exports\\" + subfolders);
                    Stream stream = reader.GetPackageStream(entry);
                    using (var fStream = File.OpenWrite(path))
                        using (stream)
                        {
                            stream.CopyTo(fStream);
                        }

                    if (File.Exists(path))
                    {
                        new UpdateMyConsole(Path.GetFileName(path), CColors.Blue).Append();
                        new UpdateMyConsole(" successfully exported", CColors.White, true).Append();
                    }
                    else //just in case
                    {
                        new UpdateMyConsole("Bruh moment\nCouldn't export ", CColors.White).Append();
                        new UpdateMyConsole(Path.GetFileName(path), CColors.Blue, true).Append();
                    }
                }
            }
        }
Example #3
0
        public static async Task PopulateListBox(TreeViewItem sItem)
        {
            FilesListWithoutPath = null;
            FWindow.FMain.ListBox_Main.Items.Clear();
            FWindow.FMain.FilterTextBox_Main.Text = string.Empty;

            string path = TreeViewUtility.GetFullPath(sItem);

            FilesListWithoutPath = new List <IEnumerable <string> >();
            if (!string.IsNullOrEmpty(FWindow.FCurrentPAK))
            {
                IEnumerable <string> filesWithoutPath = PAKEntries.PAKToDisplay[FWindow.FCurrentPAK]
                                                        .Where(x => x.Name.Contains(path + "/" + Path.GetFileName(x.Name)))
                                                        .Select(x => Path.GetFileName(x.Name));

                if (filesWithoutPath != null)
                {
                    FilesListWithoutPath.Add(filesWithoutPath);
                }
            }
            else
            {
                foreach (FPakEntry[] PAKsFileInfos in PAKEntries.PAKToDisplay.Values)
                {
                    IEnumerable <string> filesWithoutPath = PAKsFileInfos
                                                            .Where(x => x.Name.Contains(path + "/" + Path.GetFileName(x.Name)))
                                                            .Select(x => Path.GetFileName(x.Name));

                    if (filesWithoutPath != null)
                    {
                        FilesListWithoutPath.Add(filesWithoutPath);
                    }
                }
            }

            if (FilesListWithoutPath != null && FilesListWithoutPath.Any())
            {
                await Task.Run(() =>
                {
                    FillMeThisPls();
                }).ContinueWith(TheTask =>
                {
                    TasksUtility.TaskCompleted(TheTask.Exception);
                });
            }

            FWindow.FMain.Button_Extract.IsEnabled = FWindow.FMain.ListBox_Main.SelectedIndex >= 0;
        }