Ejemplo n.º 1
0
        private void ParsePrimitiveVectorMethode()
        {
            var m = RegularExpression.GetRegex(RegexEnum.ReadVectorMethodPrimitive).Match(FileToTranslate);

            while (m.Success)
            {
                foreach (var newClass in Class.Variables)
                {
                    if (newClass.Name != m.Groups["name"].Value)
                    {
                        continue;
                    }
                    if ((newClass.ObjectType == "int") & (m.Groups["methode"].Value == "readByte"))
                    {
                        newClass.ReadMethod  = "ReadSByte";
                        newClass.WriteMethod = "WriteSByte";
                        newClass.ObjectType  = "sbyte";
                    }
                    else if ((newClass.ObjectType == "uint") & (m.Groups["methode"].Value == "readByte"))
                    {
                        newClass.ReadMethod  = "ReadByte";
                        newClass.WriteMethod = "WriteByte";
                        newClass.ObjectType  = "byte";
                    }
                    else
                    {
                        newClass.ReadMethod  = ReadOrWriteMethod.GetReadMethode(m.Groups["methode"].Value, "read");
                        newClass.WriteMethod = ReadOrWriteMethod.GetWriteMethode(m.Groups["methode"].Value, "read");
                        newClass.ObjectType  = PrimitiveType.GetTypeByReadMethode(newClass.ReadMethod);
                    }
                    newClass.MethodType = ReadMethodType.VectorPrimitive;
                }
                m = m.NextMatch();
            }
        }
Ejemplo n.º 2
0
        private void ReadPrimitiveVectorMethode()
        {
            Match m = RegularExpression.GetRegex(RegexEnum.ReadVectorMetodePrimitive).Match(fileToTranslat);

            while (m.Success)
            {
                for (int i = 0; i < classTranslated.Variables.Length; i++)
                {
                    if (classTranslated.Variables[i].Name == m.Groups["name"].Value)
                    {
                        classTranslated.Variables[i].ReadMethode  = ReadOrWriteMethode.GetReadMethode(m.Groups["methode"].Value);
                        classTranslated.Variables[i].WriteMethode = ReadOrWriteMethode.GetWriteMethode(m.Groups["methode"].Value);
                        classTranslated.Variables[i].Type         = PrimitiveType.GetTypeByReadMethode(classTranslated.Variables[i].ReadMethode);
                        classTranslated.Variables[i].MethodeType  = ReadMethodeType.Primitive;
                    }
                }
                m = m.NextMatch();
            }
        }