public ImportBatch(AssetWorkspace workspace, List <AssetContainer> selection, string directory, string extension) : this() { this.workspace = workspace; this.directory = directory; List <string> filesInDir = Directory.GetFiles(directory, "*" + extension).ToList(); List <ImportBatchDataGridItem> gridItems = new List <ImportBatchDataGridItem>(); foreach (AssetContainer cont in selection) { Extensions.GetUABENameFast(cont, workspace.am.classFile, out string assetName, out string _); ImportBatchDataGridItem gridItem = new ImportBatchDataGridItem() { importInfo = new ImportBatchInfo() { assetName = assetName, assetFile = Path.GetFileName(cont.FileInstance.path), pathId = cont.PathId, cont = cont } }; string endWith = gridItem.GetMatchName(extension); List <string> matchingFiles = filesInDir.Where(f => f.EndsWith(endWith)).Select(f => Path.GetFileName(f)).ToList(); gridItem.matchingFiles = matchingFiles; gridItem.selectedIndex = matchingFiles.Count > 0 ? 0 : -1; gridItems.Add(gridItem); } dataGrid.Items = gridItems; }
//for assets files public ModMakerDialog(AssetWorkspace workspace) : this() { assetWs = workspace; isBundle = false; BuildTreeAssets(); }
public PluginWindow(Window win, AssetWorkspace workspace, List <AssetExternal> selection, PluginManager plugLoader) : this() { this.win = win; this.workspace = workspace; this.selection = selection; plugInfs = plugLoader.GetPluginsThatSupport(workspace.am, selection); boxPluginList.Items = plugInfs; }
public GoToAssetDialog(AssetWorkspace workspace) : this() { this.workspace = workspace; int index = 0; List <string> loadedFiles = new List <string>(); foreach (AssetsFileInstance inst in workspace.LoadedFiles) { loadedFiles.Add($"{index++} - {Path.GetFileName(inst.path)}"); } ddFileId.Items = loadedFiles; ddFileId.SelectedIndex = 0; boxPathId.Text = "1"; //todo get last id (including new assets) }
public DataWindow(AssetWorkspace workspace, AssetContainer cont) : this() { this.workspace = workspace; AssetTypeValueField baseField = workspace.GetBaseField(cont); TreeViewItem baseItem = CreateTreeItem($"{baseField.GetFieldType()} {baseField.GetName()}"); TreeViewItem arrayIndexTreeItem = CreateTreeItem("Loading..."); baseItem.Items = new List <TreeViewItem>() { arrayIndexTreeItem }; treeView.Items = new List <TreeViewItem>() { baseItem }; SetTreeItemEvents(baseItem, cont.FileInstance, baseField); }