Esempio n. 1
0
            private void AdjustConstructorName(JavaPToCpp instance)
            {
                string constructName = "";

                if (OriginalName.Contains('.'))
                {
                    string[] t = OriginalName.Split('.');
                    constructName = t[t.Length - 1];
                }
                else
                {
                    constructName = OriginalName;
                }

                if (Signature.Contains("()"))
                {
                    Name = instance.MethodPrefix + constructName + "_V" + instance.MethodSuffix;
                }
                else
                {
                    string append = "_" + Signature.Substring(1, Signature.IndexOf(')') - 1).Replace('/', '_').Replace(";", "").Replace("[", "_2");
                    Name = instance.MethodPrefix + constructName + append + instance.MethodSuffix;
                }

                OriginalName = "<init>";
            }
Esempio n. 2
0
            public bool IsAccessor; // We should check if user wants to include these. I feel like they aren't necessary & can cause issues with the VM, since they seem compiler created/dependent

            public Method(JavaPToCpp instance, string line, string n, string s, string declaringClass, bool isStatic)
            {
                ReadableName    = line;
                OriginalName    = n;
                Name            = instance.MethodPrefix + n + instance.MethodSuffix;
                Signature       = s;

                IsConstructor   = OriginalName == declaringClass;
                IsStatic        = isStatic;

                if (IsStatic && OriginalName.Contains("static {"))
                {
                    IsStaticBlock = true;
                    Name = instance.MethodPrefix + "StaticBlock_" + instance.StaticBlocks + instance.MethodSuffix;
                    instance.StaticBlocks++;
                }
                else if (IsConstructor)
                {
                    AdjustConstructorName(instance);
                }
                else if (IsStatic && Regex.IsMatch(n, @"access\$\d+"))
                {
                    IsAccessor = true;
                    Name = instance.MethodPrefix + n.Replace('$', '_') + instance.MethodSuffix;
                }
                
                if (Name.Contains('$'))
                {
                    Name = instance.MethodPrefix + n.Replace('$', '_') + instance.MethodSuffix;
                }
            }
Esempio n. 3
0
            public LineInfo(JavaPToCpp instance, string line, int start, int end)
            {
                Line    = line;
                Start   = start;
                End     = end;

                Instance = instance;
            }
Esempio n. 4
0
            public Variable(JavaPToCpp instance, string line, string n, string s, bool isStatic)
            {
                ReadableName    = line;
                OriginalName    = n;
                Name            = instance.VariablePrefix + n + instance.VariableSuffix;
                Signature       = s;

                IsStatic    = isStatic;
            }
Esempio n. 5
0
        private void JavaCppReflectionProcess_Exited(object sender, System.EventArgs e)
        {
            try
            {
                JavaCppReflectionProcess.CancelOutputRead();
            }
            catch (Exception ex) { }

            try
            {
                JavaCppReflectionProcess.CancelErrorRead();
            }
            catch (Exception ex) { }
            try
            {
                JavaCppReflectionProcess.CloseMainWindow();
            }
            catch (Exception ex) { }
            try
            {
                JavaCppReflectionProcess.Close();
            }
            catch (Exception ex) { }

            FileInfo file = new FileInfo(CurrentCppReflectionFile);
            string clsName = file.Name;

            if (clsName.Contains('.'))
            {
                clsName = clsName.Split('.')[0];
            }

            JavaPToCpp jniReflection = new JavaPToCpp(clsName, CurrentCppReflectionFile);
            jniReflection.SetInputText(JavaCppReflectionOutput);
            jniReflection.CreateCppReflection();

        }