private static Dictionary <string, RomInfoData> Initialize() { var romInfos = new Dictionary <string, RomInfoData>(); IRomHelpers.InitializeCallbacks(GetRomInfo); return(romInfos); }
/// <summary> /// Gets the absolute path to the specified program. /// </summary> /// <param name="program">The program whose absolute path is being retrieved.</param> /// <returns>The absolute path of the program.</returns> /// <remarks>This method is not symmetric with SetProgramPath -- it returns the absolute path to the requested program in full.</remarks> public string GetProgramPath(ProgramFile program) { string programPath; if (_programPaths.TryGetValue(program, out programPath)) { programPath = System.IO.Path.Combine(programPath, program.ProgramName()) + ProgramSuffix; IRomHelpers.SetConfigurationEntry(program.ToString(), programPath); // ensure it's registered w/ INTV.Core } return(programPath); }
private static void AddItemsComplete(AsyncTaskData taskData) { var args = (AddRomsToMenuData)taskData; args.MenuLayout.FinishItemsUpdate(args.Error == null); if (args.Error == null) { if (args.Destination != null) { var insertFolder = args.MenuLayout.FindViewModelForModel(args.Destination); FileNodeViewModel highlightItem = insertFolder; // NOTE: Multi-Mode Tree will need to fix this! if (insertFolder.IsOpen || (insertFolder == args.MenuLayout)) { var items = insertFolder.Items; var highlightIndex = args.InsertLocation; if (highlightIndex < 0) { highlightIndex = System.Math.Max(0, items.Count - 1); } if (highlightIndex < items.Count) { highlightItem = items[highlightIndex]; highlightItem.IsSelected = true; ////args.MenuLayout.RetainFocus = items[highlightIndex].GetHashCode(); } } else { insertFolder.IsSelected = true; ////args.MenuLayout.RetainFocus = insertFolder.GetHashCode(); } ++args.MenuLayout.RetainFocus; #if MAC if (highlightItem != null) { args.MenuLayout.CurrentSelection = highlightItem; } #endif // MAC } } if ((args.Error != null) || args.FailedToAdd.Any()) { var exception = args.Error; if (exception == null) { exception = args.FirstFilePreparationError; } IRomHelpers.ReportAddItemsError(exception, args.FailedToAdd); } }
/// <summary> /// Registers the tools location. /// </summary> /// <param name="toolsFilesLocation">Receives the tools location directory.</param> /// <returns>This instance.</returns> public T WithDefaultToolsDirectory(out string toolsFilesLocation) { toolsFilesLocation = null; var codeBase = typeof(IRomHelpers).Assembly.CodeBase; var toolsFilesLocationUriPath = Path.Combine(Path.GetDirectoryName(codeBase), "tools\\"); Uri toolsFilesLocationUri; if (Uri.TryCreate(toolsFilesLocationUriPath, UriKind.Absolute, out toolsFilesLocationUri)) { toolsFilesLocation = Uri.UnescapeDataString(toolsFilesLocationUri.AbsolutePath); // Need to unescape spaces. IRomHelpers.SetConfigurationEntry(IRomHelpers.DefaultToolsDirectoryKey, toolsFilesLocation); } else { throw new InvalidOperationException(); } return(_self); }
private Configuration() { _programPaths = new Dictionary <ProgramFile, string>(); var toolsPath = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, ToolsDirectoryName); DefaultToolsDirectory = toolsPath; IRomHelpers.SetConfigurationEntry(IRomHelpers.DefaultToolsDirectoryKey, DefaultToolsDirectory + System.IO.Path.DirectorySeparatorChar); ProgramFile[] toolApps = { INTV.JzIntv.Model.ProgramFile.Bin2Rom, INTV.JzIntv.Model.ProgramFile.Rom2Bin, INTV.JzIntv.Model.ProgramFile.Bin2Luigi, INTV.JzIntv.Model.ProgramFile.Rom2Luigi, INTV.JzIntv.Model.ProgramFile.Luigi2Bin, INTV.JzIntv.Model.ProgramFile.IntvName, }; foreach (var toolApp in toolApps) { SetProgramPath(toolApp, toolsPath); } _instance = this; }