private static string[] GetStageMapFileLines(IBuildTarget target, string resultingFragmentName, out bool preprocessed) { preprocessed = false; string sourcePath = target.GetSourceFromPath(resultingFragmentName); //ToLower() is needed for Linux's case-sensitive file system since these files seem to all be lowercase. string scriptName = Path.GetFileNameWithoutExtension(sourcePath).ToLower(); string?sourceDirectory = Path.GetDirectoryName(sourcePath); if (sourceDirectory == null) { throw new NullableException(nameof(sourceDirectory)); } string stageMapFile = Path.Combine(sourceDirectory, scriptName + ".map"); string[] stageMapFileLines; try { stageMapFileLines = File.ReadAllLines(stageMapFile); } catch (IOException) { preprocessed = true; stageMapFile = Path.Combine(sourceDirectory, scriptName + ".map2"); stageMapFileLines = File.ReadAllLines(stageMapFile); } return(stageMapFileLines); }
private static IEnumerable <string> GetReferenceAliases(IBuildTarget target, string resultingFragmentName) { /* * Add ReferenceAlias"es * At some point, we might port the conversion so it doesn"t use the directly injected property, * but instead has a map to aliases and we"ll map accordingly and have references point to aliases instead */ string sourcePath = target.GetSourceFromPath(resultingFragmentName); string scriptName = Path.GetFileNameWithoutExtension(sourcePath); string?sourceDirectory = Path.GetDirectoryName(sourcePath); if (sourceDirectory == null) { throw new NullableException(nameof(sourceDirectory)); } string aliasesFile = Path.Combine(sourceDirectory, scriptName + ".aliases"); string[] aliasesLines = File.ReadAllLines(aliasesFile); return(aliasesLines.Select(a => a.Trim()).Where(a => a != "").Select(a => { //WTM: Change: This used to build an alias like this: //Alias_[FormID]_p //I changed it to generate this: //Alias_[EditorID]_p /*const string Alias_ = "Alias_"; * if (!trimmedAlias.StartsWith(Alias_)) { throw new ConversionException(nameof(trimmedAlias) + " did not start with " + Alias_ + ": " + trimmedAlias); } * string formIDString = trimmedAlias.Substring(Alias_.Length); * int formID = Convert.ToInt32(formIDString, 16); * string? edid = esmAnalyzer.GetEDIDByFormIDNullable(formID); * string innerName = edid != null ? edid : formIDString; * string propertyName = Alias_ + innerName;*/ //WTM: Note: The above didn't work. GECKFrontend couldn't seem to associate the properties correctly. return a; }).Distinct()); }