// Token: 0x060002DC RID: 732 RVA: 0x0001D2B4 File Offset: 0x0001B4B4
    public override void OnGUI(GUIContent label)
    {
        GenericVariable genericVariable = this.value as GenericVariable;

        EditorGUILayout.BeginVertical(new GUILayoutOption[0]);
        if (FieldInspector.DrawFoldout(genericVariable.GetHashCode(), label))
        {
            EditorGUI.indentLevel++;
            if (SharedGenericVariableDrawer.variableNames == null)
            {
                List <Type> list = VariableInspector.FindAllSharedVariableTypes(true);
                SharedGenericVariableDrawer.variableNames = new string[list.Count];
                for (int i = 0; i < list.Count; i++)
                {
                    SharedGenericVariableDrawer.variableNames[i] = list[i].Name.Remove(0, 6);
                }
            }
            int    num   = 0;
            string value = genericVariable.type.Remove(0, 6);
            for (int j = 0; j < SharedGenericVariableDrawer.variableNames.Length; j++)
            {
                if (SharedGenericVariableDrawer.variableNames[j].Equals(value))
                {
                    num = j;
                    break;
                }
            }
            int  num2 = EditorGUILayout.Popup("Type", num, SharedGenericVariableDrawer.variableNames, BehaviorDesignerUtility.SharedVariableToolbarPopup, new GUILayoutOption[0]);
            Type type = VariableInspector.FindAllSharedVariableTypes(true)[num2];
            if (num2 != num)
            {
                num = num2;
                genericVariable.value = (Activator.CreateInstance(type) as SharedVariable);
            }
            GUILayout.Space(3f);
            genericVariable.type  = "Shared" + SharedGenericVariableDrawer.variableNames[num];
            genericVariable.value = FieldInspector.DrawSharedVariable(null, new GUIContent("Value"), null, type, genericVariable.value);
            EditorGUI.indentLevel--;
        }
        EditorGUILayout.EndVertical();
    }
        public T GetVariableValueInternal <T>(string name)
        {
            if (_myVariables.TryGetValue(name, out IVariable variable))
            {
                if (variable is IGenericVariable <T> generic)
                {
                    return((T)generic.GetValue());
                }
            }

            GenericVariable <T>           result = new GenericVariable <T>();
            GenericVariable <T>           vTemp  = new GenericVariable <T>();
            ResolveVariableValueEventArgs args   = new ResolveVariableValueEventArgs(name, typeof(T));

            ResolveVariableValue?.Invoke(this, args);

            ValidateSetValueType(typeof(T), args.VariableValue);
            vTemp.ValueAsObject = args.VariableValue;
            result = vTemp;
            return((T)result.GetValue());
        }
Esempio n. 3
0
        /// <summary>
        /// Updates the status of a paper test and writes it back out to the QA
        /// system for processing.
        /// </summary>
        /// <param name="newSatus"></param>
        /// <param name="destinationEnvironment"></param>
        public void UpdateStatus(TestResult testResult, string newStatus, long?appealRequestId, ITestResultSerializerFactory serializerFactory)
        {
            // if there's an appeal requestId gen var, remove it.  A fresh one will be added below if
            //  appealRequestId is not null.  This is done to handle resets and invalidations through the DoR website.
            //  Those are not appeals and therefore should not have a requestId.  If a rescore appeal is reset through
            //  the DoR website, the appeal request id that will be found here is that of the rescore appeal.
            //  This will cause confusion downstream, since the status would be "reset".
            //TODO: consider making resets/invalidations through the DoR website appeals as well.
            GenericVariable appealRequestIdGenVar =
                testResult.Opportunity.GetGenericVariableByContextName(GenericVariable.VariableContext.APPEAL, GenericVariable.APPEAL_REQUEST_ID_VAR_NAME);

            if (appealRequestIdGenVar != null)
            {
                testResult.Opportunity.GenericVariables.Remove(appealRequestIdGenVar);
            }

            // if an appeal requestid was provided, embed it in the file as a generic variable
            if (appealRequestId != null)
            {
                testResult.Opportunity.AddGenericVariable(GenericVariable.VariableContext.APPEAL, GenericVariable.APPEAL_REQUEST_ID_VAR_NAME, appealRequestId.Value.ToString());
            }

            // set the status of the TestResult to the new one
            //  also set the status date to reflect when this action was taken
            testResult.Opportunity.Status     = newStatus;
            testResult.Opportunity.StatusDate = DateTime.Now;

            // also clear out any qaLevel.  Currently, the only one we're using is "BatchReport".
            //  If a test was batch-reported but is being resubmitted with a different status, the
            //  resubmitted opp should be considered a new version which has not been reported yet.
            //TODO: as other uses of qaLevel arise, revisit this.
            testResult.Opportunity.QALevel = null;

            // now write the test to the
            XmlRepositoryBL.InsertXml(XmlRepository.Location.source, testResult, serializerFactory);
        }
Esempio n. 4
0
 public void SetValue(GenericVariable <T> value)
 {
     Value = value.Value;
 }
 private string replaceStrings(string expression)
 {
     foreach (var op in ExpressionKeywords.StringGroupOperators) {
         if (expression.Count(s => s == op[0]) % 2 != 0) {
             throw new ExpressionException(
                 "String grouping error! \"" + op + "\" use incorrectly.");
         }
         var pattern = string.Format("{0}.*?{0}", op);
         var regex = new Regex(pattern);
         expression = regex.Replace(
             expression, m => {
                 var name = Guid.NewGuid()
                     .ToString("N");
                 var value = m.Value.Substring(1, m.Value.Length - 2)
                     .ToLower();
                 var newVar = new GenericVariable<string>(name, value);
                 AutoVariables.Add(name, newVar);
                 return " " + name + " ";
             });
     }
     return expression;
 }