private void AnalyzeCompilationStart(CompilationStartAnalysisContext context) { var compilation = context.Compilation; bool tMod13 = compilation.References.Any(x => x.Display.EndsWith("tModLoader.exe")); bool tMod14 = compilation.References.Any(x => x.Display.EndsWith("tModLoader.dll")); if (tMod13) { tModLoaderVersion = tModLoaderVersion.tModLoader_1_3; } if (tMod14) { tModLoaderVersion = tModLoaderVersion.tModLoader_1_4; } Console.WriteLine("tModLoaderVersion is " + tModLoaderVersion); //var tmodReference = compilation.References.FirstOrDefault(x => x.Display.EndsWith("tModLoader.exe")); // TODO: can possibly check .png files if <AdditionalFiles Include="**\*.png" /> added //var b = context.Options.AdditionalFiles.Length; //foreach (var item in context.Options.AdditionalFiles) //{ // var a = item.Path; // //context.Compilation.SourceModule.Locations. //} }
public MethodParameterToIDTypeBinding(string fullyQualifiedMethodName, string fullMethodWithParameters, string[] parameterNames, int parameterIndex, string idType, IdDictionary idDictionary, tModLoaderVersion appliesToVersion = tModLoaderVersion.tModLoader_1_3_Or_1_4) { this.fullyQualifiedMethodName = fullyQualifiedMethodName; this.methodName = fullyQualifiedMethodName.Substring(fullyQualifiedMethodName.LastIndexOf(".") + 1); this.fullMethodWithParameters = fullMethodWithParameters; this.parameterNames = parameterNames; this.parameterIndex = parameterIndex; this.idType = idType; this.idDictionary = idDictionary; this.appliesToVersion = appliesToVersion; }
public FieldToIDTypeBinding(string fullName, string field, string idType, IdDictionary idDictionary, tModLoaderVersion appliesToVersion = tModLoaderVersion.tModLoader_1_3_Or_1_4) { this.fullyQualifiedClassName = fullName; this.className = fullName.Substring(fullName.LastIndexOf(".") + 1); this.field = field; this.idType = idType; this.idDictionary = idDictionary; this.appliesToVersion = appliesToVersion; //if (idType == "TileID") // idDictionary = TileID.Search; //if (idType == "ItemID") // idDictionary = ItemID.Search; }