Esempio n. 1
0
        private static QSPVariable GetAllValues(string name)
        {
            QSPVariable newQSPVariable;
            var         valueCount = QSPWrapper.GetVariableValuesCount(name);
            var         indexCount = QSPWrapper.GetVariableIndexesCount(name);

            if (valueCount == 0)
            {
                int    intValue;
                string strValue;
                QSPWrapper.GetVariableValues(name, 0, out intValue, out strValue);
                newQSPVariable = new QSPVariable(name, strValue, intValue);
            }
            else
            {
                newQSPVariable = new QSPVariable(name, valueCount, indexCount);

                for (int i = 0; i < valueCount; i++)
                {
                    int    intValue;
                    string strValue;
                    QSPWrapper.GetVariableValues(name, i, out intValue, out strValue);
                    newQSPVariable.AddValue(i, strValue, intValue);
                }

                for (int i = 0; i < indexCount; i++)
                {
                    int    valueIndex;
                    string indexName;
                    QSPWrapper.GetIndexNameForVariable(name, i, out valueIndex, out indexName);
                    newQSPVariable.SetIndexName(valueIndex, indexName);
                }
            }
            return(newQSPVariable);
        }
Esempio n. 2
0
        public void PopulateVariableList()
        {
            var lst = new List <QSPVariable>();

            lst.Add(new QSPVariable("VARIANT", "this is a variant variable", 222));
            lst.Add(new QSPVariable("VARIANT2", "this is a variant variable\r\nwith superlong text\r\n that just keep going and going and going\r\n and going and going and goint", 333));

            for (int i = 0; i < 5; i++)
            {
                lst.Add(new QSPVariable($"IntVariable{i}", string.Empty, i));
            }

            for (int i = 0; i < 5; i++)
            {
                lst.Add(new QSPVariable($"StrVariable{i}", $"stringVariable{i}", 0));
            }

            var namedVariable = new QSPVariable("namedVariableParents", 10, 10);

            for (int i = 0; i < 10; i++)
            {
                namedVariable.AddValue(i, $"strValue{i}", i);
                namedVariable.SetIndexName(i, $"strIndexName{i}");
            }
            lst.Add(namedVariable);

            var indexVariable = new QSPVariable("indexVariableParents", 10, 0);

            for (int i = 0; i < 10; i++)
            {
                indexVariable.AddValue(i, $"strValue{i}", 0);
            }

            lst.Add(indexVariable);

            /*lst[0].StringValue = "6545645";
             *
             * lst[6].StringValue = "ModifiedValue";
             *
             * lst[1].NewValues(new QSPVariable("IntVariable3", "NewStringValue" ,9999));
             *
             * lst[11].StringValue = "ModifiedValue2";*/

            _lstVariables = lst;
        }