Beispiel #1
0
 // replace method_505 with the actual string
 public override void VisitInvocationExpression(InvocationExpression invocation)
 {
     base.VisitInvocationExpression(invocation);
     if (Program.Strings.Count() > 0)
     {
         // maybe it'd be better to reference the original name, or ensure this gets a unique name... or just don't map it? assuming it never comes up
         if (invocation.Target.LastChild is Identifier id)
         {
             // maybe it'd be better to reference the original name, or ensure this gets a unique name... or just don't map it? assuming it never comes up
             if (RemappingVisitor.IntermediaryWhenMapped(id.Name).Equals("method_505"))
             {
                 if (invocation.Arguments.Count == 1 && invocation.Arguments.First() is PrimitiveExpression p && p.Value is int val)
                 {
                     if (Program.Strings.ContainsKey(val))
                     {
                         invocation.ReplaceWith(new PrimitiveExpression(Program.Strings[val]));
                     }
                     else
                     {
                         Console.WriteLine("Missing string for " + val + "!");
                     }
                 }
             }
         }
     }
 }
Beispiel #2
0
        // remove annotations at start of file

        // classes 207-213 should be public
        public override void VisitTypeDeclaration(TypeDeclaration typeDeclaration)
        {
            base.VisitTypeDeclaration(typeDeclaration);
            // give these unique names too
            string id = RemappingVisitor.IntermediaryWhenMapped(typeDeclaration.Name);

            if (id == "class_207" || id == "class_208" || id == "class_209" || id == "class_210" || id == "class_211" || id == "class_212" || id == "class_213")
            {
                typeDeclaration.Modifiers = Modifiers.Public;
            }
        }