static QueryParametersDialogViewModel()
 {
     ParameterDataTypes.Add("string");
     ParameterDataTypes.Add("int");
     ParameterDataTypes.Add("dateTime");
     ParameterDataTypes.Add("boolean");
     ParameterDataTypes.Add("double");
 }
 public override bool Equals(Symbol?other)
 {
     if (other is null)
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(other is ConstructorSymbol otherConstructor &&
            ContainingSymbol == otherConstructor.ContainingSymbol &&
            Name == otherConstructor.Name &&
            ParameterDataTypes.SequenceEqual(otherConstructor.ParameterDataTypes));
 }
 public override bool Equals(Symbol?other)
 {
     if (other is null)
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(other is FunctionSymbol otherFunction &&
            ContainingSymbol == otherFunction.ContainingSymbol &&
            Name == otherFunction.Name &&
            ParameterDataTypes.SequenceEqual(otherFunction.ParameterDataTypes) &&
            ReturnDataType == otherFunction.ReturnDataType);
 }
示例#4
0
 public override bool Equals(Symbol?other)
 {
     if (other is null)
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(other is MethodSymbol otherMethod &&
            ContainingSymbol == otherMethod.ContainingSymbol &&
            Name == otherMethod.Name &&
            SelfDataType == otherMethod.SelfDataType &&
            ParameterDataTypes.SequenceEqual(otherMethod.ParameterDataTypes) &&
            ReturnDataType == otherMethod.ReturnDataType);
 }
示例#5
0
        /// <summary>
        /// Reads object parameters from the object from txt files
        /// in the "Parameters" folder that stores parameter types
        /// </summary>
        /// <param name="gObjectID">Object ID</param>
        public void ReadObjectParameters(string objName)
        {
            CommentInfo = new Dictionary <int, string>();
            CustomInfo  = new Dictionary <int, int>();
            ComboInfo   = new Dictionary <int, Dictionary <string, string> >();

            ObjName = objName;
            try
            {
                StreamReader sr = new StreamReader(SMSScene.BIN_PARAMPATH + objName + ".txt");
                DisplayName = sr.ReadLine();

                List <string>             datanames = new List <string>();
                List <ParameterDataTypes> datatypes = new List <ParameterDataTypes>();

                while (!sr.EndOfStream)
                {
                    string   line = sr.ReadLine();
                    string[] segs = line.Split(' ');

                    datanames.Add(segs[0]);

                    ParameterDataTypes t = DataManipulation.GetEnumFromString <ParameterDataTypes>(segs[1]);

                    ComboInfo.Add(datatypes.Count, new Dictionary <string, string>());

                    if (t == ParameterDataTypes.COMMENT)
                    {
                        string cust = "";
                        for (int i = 2; i < segs.Length; i++)
                        {
                            cust += segs[i] + " ";
                        }
                        CommentInfo.Add(datatypes.Count, cust.Substring(0, cust.Length - 1));
                    }
                    else if (t == ParameterDataTypes.BUFFER)
                    {
                        int size = 0;
                        if (segs.Length > 2)
                        {
                            int.TryParse(segs[2], out size);
                        }
                        CustomInfo.Add(datatypes.Count, size);
                    }
                    else if (segs.Length > 2)
                    {
                        //Default value
                        int    ptr = 2;
                        string def = "";
                        if (segs[ptr][0] == '\"')
                        {
                            //quote seperated
                            def += segs[ptr].Substring(1, segs[ptr].Length - 1);
                            if (segs[ptr][segs[ptr].Length - 1] != '\"')
                            {
                                do
                                {
                                    ptr++;
                                    if (ptr == segs.Length)
                                    {
                                        break;
                                    }
                                    def += " " + segs[ptr];
                                }while (segs[ptr][segs[ptr].Length - 1] != '\"');
                            }
                            ptr++;
                            def = def.Substring(0, def.Length - 1);
                        }
                        else //Normal seperated
                        {
                            def = segs[ptr++];
                        }

                        CommentInfo.Add(datatypes.Count, def);

                        while (ptr < segs.Length)
                        {
                            while (ptr < segs.Length && segs[ptr] == "")
                            {
                                ptr++;
                            }
                            if (ptr >= segs.Length)
                            {
                                break;
                            }

                            //ComboBox
                            string key = "";
                            if (segs[ptr][0] == '\"')
                            {
                                //quote seperated
                                key += segs[ptr].Substring(1, segs[ptr].Length - 1);
                                if (segs[ptr][segs[ptr].Length - 1] != '\"')
                                {
                                    do
                                    {
                                        ptr++;
                                        if (ptr == segs.Length)
                                        {
                                            break;
                                        }
                                        key += " " + segs[ptr];
                                    }while (segs[ptr][segs[ptr].Length - 1] != '\"');
                                }
                                ptr++;
                                key = key.Substring(0, key.Length - 1);
                            }
                            else //Normal seperated
                            {
                                key = segs[ptr++];
                            }
                            string entry = "";
                            if (segs[ptr][0] == '\"')
                            {
                                //quote seperated
                                entry += segs[ptr].Substring(1, segs[ptr].Length - 1);
                                if (segs[ptr][segs[ptr].Length - 1] != '\"')
                                {
                                    do
                                    {
                                        ptr++;
                                        if (ptr == segs.Length)
                                        {
                                            break;
                                        }
                                        entry += " " + segs[ptr];
                                    }while (segs[ptr][segs[ptr].Length - 1] != '\"');
                                }
                                ptr++;
                                entry = entry.Substring(0, entry.Length - 1);
                            }
                            else //Normal seperated
                            {
                                entry = segs[ptr++];
                            }
                            ComboInfo[datatypes.Count].Add(key, entry);
                        }
                    }

                    //Add datatype
                    datatypes.Add(t);
                }

                DataNames = datanames.ToArray();
                DataTypes = datatypes.ToArray();

                DataPositions = new int[0];

                sr.Close();
            }
            catch
            {
                DisplayName   = "Unknown";
                DataNames     = new string[0];
                DataTypes     = new ParameterDataTypes[0];
                DataPositions = new int[0];
            }
        }