public GetChannelsDialog(SequenceContext _seqContext, ChannelType _channelType) { InitializeComponent(); seqContext = _seqContext; seqContextPO = seqContext.AsPropertyObject(); selectedTSSequence = seqContext.SelectedSequences[0]; selectedTSStep = seqContext.SelectedSteps[0]; stepID = selectedTSStep.UniqueStepId; seqFile = selectedTSSequence.SequenceFile; permSeqContext = selectedTSSequence.Locals; //Must get sequence context this way for variables to save if teststand is restarted propObjectFile = seqFile.AsPropertyObjectFile(); stepPropertyObject = selectedTSSequence.GetStepByUniqueId(stepID).AsPropertyObject(); //Set up dialog objects sysDefPath = seqContext.SequenceFile.FileGlobalsDefaultValues.GetValString("Veristand.SystemDefinitionPath", 1); //Get the System Definition path for the Client Sequence File. Create it if it does not exist. seqContext.SequenceFile.FileGlobalsDefaultValues.SetFlags("Veristand.SystemDefinitionPath", 0, 0x4400000); channelNamesList.AddRange(stepPropertyObject.GetValVariant("VeriStand.ChannelNames", 0)); //Get ChannelNames array of strings. channelType = _channelType; VSDialogs vsdiag = new VSDialogs(); this.loggingChannelSelection.ShowCheckBox = true; //If the file at path FileGlobals.Veristand.SystemDefinitionPath exists and the extension is ".nivssdf" use that System Definition file to initialize the TreeAliasBrowserWF. if (System.IO.File.Exists(StringUtilities.unparseFilePathString(sysDefPath)) && System.IO.Path.GetExtension(StringUtilities.unparseFilePathString(sysDefPath)) == ".nivssdf") { //File exists with correct extension so try and populate the tree InitializeListBox(sysDefPath); } //If FileGlobals.Veristand.SystemDefinitionPath is empty or the file does not exist at path FileGlobals.Veristand.SystemDefinitionPath. else //(sysDefPath == "" || !System.IO.File.Exists(StringUtilities.unparseFilePathString(sysDefPath))) { //Do nothing } }
public virtual ApplicationResult <T> Apply( Func <IViolation <T>, ISolution <T> > onViolation, params IAction <T>[] actions) { ApplicationResult <T> applicationResult = null; PropertyObject <bool> cancellationToken = new PropertyObject <bool>(false); // TODO: proper clone handling (https://github.com/jsc86/jsc.commons/issues/10) T subjectClone = (T)(Subject as ICloneable)?.Clone( ); foreach (IAction <T> action in actions) { action.Apply(subjectClone, _context); } ApplyInternal( subjectClone, new List <IAction <T> >(actions), ar => { applicationResult = ar; cancellationToken.Value = true; }, () => { Subject = applicationResult.ResultSubject; }, cancellationToken, onViolation ?? (v => v.Solutions.FirstOrDefault( ))); return(applicationResult); }
private void UpdatePropertyGrid() { // this updates the property grid if, and only if, the xml has changed. if (!refreshPropertyGrid) { return; } try { var obj = DeserializeInternal(PropertyObject == null ? null : PropertyObject.GetType(), Text); propertyGrid1.Enabled = false; PropertyObject = obj; propertyGrid1.Enabled = true; propertyGrid1.Update(); } catch (Exception ex) { FormUtil.WinException(ex); } finally { refreshPropertyGrid = false; } }
private NameValueObject CreateFromPropertyObject(PropertyObject propertyObject) { if (propertyObject.Property.Type == TemplateType.Object) { return(CreateFromObjectTemplate(propertyObject)); } if (propertyObject.Property.Type == TemplateType.Array) { int count = _randomFactory.GetArraySize(propertyObject); var arrayOfValues = new List <NameValueObject>(); if (propertyObject.Property.Pattern !.IsInExistingTemplates()) { var newPropertyObject = PropertyObject.CreateWithTypeAndPattern( propertyObject, propertyObject.Property.Pattern !, propertyObject.Property.SubTypePattern); for (int i = 0; i < count; i++) { arrayOfValues.Add(CreateValue(newPropertyObject)); } } else { for (int i = 0; i < count; i++) { arrayOfValues.Add(CreateFromObjectTemplate(propertyObject)); } } return(new NameValueObject(propertyObject.Property.Name, arrayOfValues)); }
/// <summary> /// This method has been never run. /// </summary> public void Show() { PropertyObject mainSequenceResult = null; // 1. Define column descriptions. IRowQuery columnNamesRow = FluentRowBuilder.CreateRowBuilder().AddColWithStr("No.") .AddColWithStr("Name") .AddColWithStr("Result") .AddColWithStr("Time") .BuildOneTimeRow(); // 2. Define rows made from NumericLimitTest steps. IRowQuery numericLimitTestRow = FluentRowBuilder.CreateRowBuilder().AddColCounter() .AddColWithFormattedValue("TS.StepName") .AddColWithFormattedValue("Value: ", "Numeric", string.Empty) .AddColNumericDiff(mainSequenceResult.GetValNumber("TS.StartTime", 0x0), "TS.StartTime") .BuildRowByStepType("NumericLimitTest"); // 3. Define rows made from MultipleNumericLimitTest steps. IRowQuery multipleNumericLimitTestRow = FluentRowBuilder.CreateRowBuilder().AddColCounter() .AddColWithFormattedValue("TS.StepName") .AddColWithRowsFromPropertyObject("Measurement", FluentRowBuilder.CreateRowBuilder().AddColWithFormattedValue("Data", "%.3f").BuildEveryRow()) .AddColNumericDiff(mainSequenceResult.GetValNumber("TS.StartTime", 0x0), "TS.StartTime") .BuildRowByStepType("NI_MultipleNumericLimitTest"); // 4. Report (the projection happens here). IColumn reportColumn = new Reporter().Report(mainSequenceResult, columnNamesRow, numericLimitTestRow, multipleNumericLimitTestRow); // 5. Format to textual table. string reportStr = new SimpleTextFormatter().Format(reportColumn); }
public ConfigureRTSequence(SequenceContext _seqContext, ConcurrentQueue <SequenceCallInfo[]> _cq) { InitializeComponent(); seqContext = _seqContext; seqContextPO = seqContext.AsPropertyObject(); selectedTSSequence = seqContext.SelectedSequences[0]; selectedTSStep = seqContext.SelectedSteps[0]; stepID = selectedTSStep.UniqueStepId; seqFile = selectedTSSequence.SequenceFile; permSeqContext = selectedTSSequence.Locals; propObjectFile = seqFile.AsPropertyObjectFile(); VSDialogs vsdiag = new VSDialogs(); cq = _cq; selectedSequence = 0; stepPropertyObject = selectedTSSequence.GetStepByUniqueId(stepID).AsPropertyObject(); //Get old values if they exist try { autostart = stepPropertyObject.GetValBoolean("Veristand.StimProfAutoStart", 0); this.auto_start.Checked = autostart; timeout = (uint)stepPropertyObject.GetValNumber("Veristand.StimProfTimeout", 0); this.rtseq_timeout.Value = timeout; this.sessionName_Control.Text = stepPropertyObject.GetValString("Veristand.RTSessionName", 0); sequenceNames = Array.ConvertAll((object[])stepPropertyObject.GetValVariant("Veristand.SequenceNames", 0), o => o.ToString()); parameterValues = Array.ConvertAll((object[])stepPropertyObject.GetValVariant("Veristand.ParamValues", 0), o => o.ToString()); parameterTypes = Array.ConvertAll((object[])stepPropertyObject.GetValVariant("Veristand.ParamTypes", 0), o => o.ToString()); parameterNames = Array.ConvertAll((object[])stepPropertyObject.GetValVariant("Veristand.ParamNames", 0), o => o.ToString()); numSequences = (int)stepPropertyObject.GetValNumber("Veristand.RTNumSequences", 0); try { InitializeDataGridView(sequenceNames[0], parameterValues, parameterTypes, numSequences, 0); //Initialize the data grid with the previously selected data this.FilePath.Text = sequenceNames[0]; } catch (System.ArgumentException ex) { //Intentially do nothing } catch (IndexOutOfRangeException ex) { //no sequences, don't need to initialize the data grid } } catch (System.Runtime.InteropServices.COMException ex) { //Variables are not already created in TestStand. They will be created later vsdiag.ShowWarningDialog(ex.Message + "------" + ex.StackTrace); autostart = false; StimProfilePathStr = ""; this.auto_start.Checked = autostart; this.FilePath.Text = StimProfilePathStr; timeout = 1000; this.rtseq_timeout.Value = timeout; this.sessionName_Control.Text = "Session 1"; } }
// public string dataGridView_ToolTipText = //@"Lists the File Properties written to the TDMS log file. // //For each property, the following information is stored: //Name (string) //Data type (tdsDataType) //Value (strings are encoded in UTF-8 Unicode). // //Strings in TDMS files can be null-terminated, but since the length //information is stored, the null terminator will be ignored when //you read from the file."; public AdvancedLoggingProperties(SequenceContext _seqContext, ConfigureLoggingFile CallingForm) { InitializeComponent(); CallingFormGlobal = CallingForm; //Set up Teststand objects seqContext = _seqContext; seqContextPO = seqContext.AsPropertyObject(); selectedTSSequence = seqContext.SelectedSequences[0]; selectedTSStep = seqContext.SelectedSteps[0]; stepID = selectedTSStep.UniqueStepId; seqFile = selectedTSSequence.SequenceFile; permSeqContext = selectedTSSequence.Locals; //Must get sequence context this way for variables to save if teststand is restarted propObjectFile = seqFile.AsPropertyObjectFile(); EvaluationTypes eval = seqContext.Engine.NewEvaluationTypes(); eval.PropertyValueTypeFlags = 0x4; //set string as the valid evaluation type EvaluationTypes evalNumeric = seqContext.Engine.NewEvaluationTypes(); stepPropertyObject = selectedTSSequence.GetStepByUniqueId(stepID).AsPropertyObject(); FileDescription_text.Text = CallingForm.fileDescription; filePropertyNames = CallingFormGlobal.filePropertyNames; filePropertyValues = CallingFormGlobal.filePropertyValues; InitializeFilePropertiesDataGridView(); VSDialogs vsdiag = new VSDialogs(); //this.OK.Click +=new EventHandler(OK_Click,new EventArgs(_fileAuthor)); }
// public virtual void PopulatePropertyList(ElementProperty prop) { // Remove Observer m_GridView.SetDataChangeObserver(null); m_GridView.RemoveAll(); PropertyObject propObj = null; GridViewItem itemSub = null; prop.InitPropertyMap(); // Use var keyword to enumerate dictionary foreach (var pair in prop.List) { propObj = pair.Value; m_GridView.AddItem(0, 0, propObj.Name); itemSub = m_GridView.AddItem(0, 1, "", propObj.Type); itemSub.m_ItemData = propObj; // May be not necessary if use this in the object itself.. //SetProValues(prop, propObj.Name, itemSub); itemSub.m_Data = propObj.List; } // Will be used as Adapter object's data m_GridView.Tag = prop; m_GridView.SetDataChangeObserver(this); }
/// <summary> /// ไปXML่็น่ทๅๆฐๆฎๅฎไน /// </summary> /// <param name="element"></param> /// <returns></returns> private ParamDef GetParamDefFromElement(XElement element) { ParamDef param = new ParamDef(); System.Diagnostics.Debug.Assert(element != null); param.ObjectBrief = element.Attributes("ObjectBrief").FirstOrDefault().Value; param.ObjectName = element.Attributes("ObjectName").FirstOrDefault().Value; param.ObjectRemark = element.Attributes("ObjectRemark").FirstOrDefault().Value; param.TypeName = element.Attributes("TypeName").FirstOrDefault().Value; param.TypeSort = element.Attributes("TypeSort").FirstOrDefault().Value; IEnumerable <XElement> subElements = element.Elements("PropertyObject"); PropertyObject p = null; if (subElements != null && subElements.Count() > 0) { param.properties = new List <PropertyObject>(); foreach (XElement elm in subElements) { p = new PropertyObject(); p.ObjectBrief = elm.Attributes("ObjectBrief").FirstOrDefault().Value; p.ObjectName = elm.Attributes("ObjectName").FirstOrDefault().Value; p.ObjectRemark = elm.Attributes("ObjectRemark").FirstOrDefault().Value; p.TypeName = elm.Attributes("TypeName").FirstOrDefault().Value; //p.TypeSort = element.Attributes("TypeSort").FirstOrDefault().Value; param.properties.Add(p); } } return(param); }
protected Random GetRandomInstance(PropertyObject propertyObject, string step = nameof(CreateImpl)) { return(RandomFactory.GetOrCreate( propertyObject.DefinitionName, propertyObject.Property.Name !, step)); }
public object?Create(PropertyObject propertyObject) { FailureType failureType = GetFailureType(propertyObject); return(failureType == FailureType.None ? CreateImpl(propertyObject) : CreateFailureImpl(propertyObject, failureType)); }
public void Handle(object sender, PropertyChangedEventArgs e) { PropertyObject mp = sender as PropertyObject; string p_name = e.PropertyName; Console.WriteLine("MotoreEventHandler->Handler --- sender: {0} proprieta: {1} valore: {2}", mp.path, p_name, mp.value); //methodToBeCalledWhenPropertyIsSet(); }
private object?CreateFailureImpl(PropertyObject propertyObject, FailureType failureType) { return(failureType switch { FailureType.Nullable => null, FailureType.Range => CreateRangeFailureImpl(propertyObject), _ => CreateCustomFailureImpl(propertyObject) });
public SequenceCallInfo[] ReinitializeSequenceCallInfo(NationalInstruments.TestStand.Interop.API.SequenceContext seqContext) { PropertyObject seqContextPO = seqContext.AsPropertyObject(); Step activeStep = seqContext.Step; string stepID = activeStep.UniqueStepId; return(ReinitializeSequenceCallInfo(seqContext, stepID)); }
public ConfigureSequenceName(SequenceContext _seqContext) { InitializeComponent(); seqContext = _seqContext; selectedTSSequence = seqContext.SelectedSequences[0]; selectedTSStep = seqContext.SelectedSteps[0]; stepID = selectedTSStep.UniqueStepId; seqFile = selectedTSSequence.SequenceFile; seqContextPO = selectedTSSequence.Locals; int thisStepIndex = selectedTSStep.StepIndex; propObjectFile = seqFile.AsPropertyObjectFile(); try { this.sequenceName_Control.Text = seqContextPO.GetValString("Veristand." + stepID + "RTSequenceName", 0); } catch (System.Runtime.InteropServices.COMException) { //If variables don't exist set default values this.sequenceName_Control.Text = ""; } int count = thisStepIndex; bool found = false; while (count >= 0 && found == false) { Step currentStep = selectedTSSequence.GetStep(count, StepGroups.StepGroup_Main); if (currentStep.Name == "Open and Deploy RT Sequence") //This will need to change if the name of the Open RT Sequence Name Step Changes { //this is the open RTSequence step that is the closes previous to this step name configuration string openRTSequenceStepID = currentStep.UniqueStepId; VSDialogs vsdiags = new VSDialogs(); try //When this does and does not exist is different from the RTSequenceName so it needs its own Try/Catch block { seqCallInfoArray = vsdiags.ReinitializeSequenceCallInfo(seqContext, openRTSequenceStepID); //Get the sequence info created by the Open RT Sequence Step allSequenceNames = ParseNamesFromSequenceCallInfo(seqCallInfoArray); //Populate the parsed list of sequence names if (allSequenceNames.Length > 0) { if (allSequenceNames[0] != null) { //Set the sequence name control to the first name we parsed this.sequenceName_Control.Text = allSequenceNames[0]; } else { this.sequenceName_Control.Text = ""; } } } catch (System.Runtime.InteropServices.COMException) { seqCallInfoArray = null; } } count--; } }
public NativeChannelSelectionDialog(SequenceContext _seqContext, ChannelType _channelType) { InitializeComponent(); channelType = _channelType; //Set up Teststand objects seqContext = _seqContext; seqContextPO = seqContext.AsPropertyObject(); selectedTSSequence = seqContext.SelectedSequences[0]; selectedTSStep = seqContext.SelectedSteps[0]; stepID = selectedTSStep.UniqueStepId; seqFile = selectedTSSequence.SequenceFile; permSeqContext = selectedTSSequence.Locals; //Must get sequence context this way for variables to save if teststand is restarted propObjectFile = seqFile.AsPropertyObjectFile(); EvaluationTypes eval = seqContext.Engine.NewEvaluationTypes(); eval.PropertyValueTypeFlags = 0x4; //set string as the valid evaluation type EvaluationTypes evalNumeric = seqContext.Engine.NewEvaluationTypes(); evalNumeric.PropertyValueTypeFlags = 0x2; //Set valid evaluation types to number value_exp.SetValidEvaluationTypes(evalNumeric); value_exp.Context = seqContextPO; stepPropertyObject = selectedTSSequence.GetStepByUniqueId(stepID).AsPropertyObject(); VSDialogs vsdiag = new VSDialogs(); try { value_exp.Text = stepPropertyObject.GetValString("Veristand.ValueToSet", 0); selectedChannelName = stepPropertyObject.GetValString("Veristand.ChannelName", 0); sysDefPath = seqContext.SequenceFile.FileGlobalsDefaultValues.GetValString("Veristand.SystemDefinitionPath", 1);//Try to get the specific system definition path associated with this step seqContext.SequenceFile.FileGlobalsDefaultValues.SetFlags("Veristand.SystemDefinitionPath", 0, 0x4400000); if (sysDefPath == null) { sysDefPath = ""; } if (channelType == ChannelType.paramChannel) { ModelListFullPath = stepPropertyObject.GetValString("Veristand.FullChannelPath", 0); } } catch (System.Runtime.InteropServices.COMException ex) { selectedChannelName = ""; } catch (System.NullReferenceException ex) { //Do Nothing } if (sysDefPath != null) { if (System.IO.File.Exists(StringUtilities.unparseFilePathString(sysDefPath)) && System.IO.Path.GetExtension(StringUtilities.unparseFilePathString(sysDefPath)) == ".nivssdf") { //File exists with correct extension so try and populate the tree InitializeListBox(sysDefPath); } } }
// PropertyArray list --> Remove private void removeToolStripMenuItem1_Click(object sender, EventArgs e) { ObjectBase obj = mValue.mPropertySelection.obj; PropertyArray vector = mValue.mPropertySelection.cp.mArray; PropertyObject po = new PropertyObject(obj); vector.remove(po); }
//add property to the list of aquired properties and subtract its price from the total amount of money public void BuyProperty() { PropertyObject property = BuyPropertyButton.property; properties.Add(property); MoneyManager.amount -= property.price; SetPossibleProperties(); property.AtBuying(); }
public IStimulusProfileSession StartStimulusProfile(NationalInstruments.TestStand.Interop.API.SequenceContext seqContext, SequenceCallInfo[] seqCallInfoArray, string gatewayIP) { seqCallInfoArray = Array.FindAll(seqCallInfoArray, isNotNull).ToArray(); Step activeStep = seqContext.Step; string stepID = activeStep.UniqueStepId; Sequence selectedTSSequence = seqContext.Sequence; PropertyObject stepPropertyObject = selectedTSSequence.GetStepByUniqueId(stepID).AsPropertyObject(); try { PropertyObject seqContextPO = seqContext.AsPropertyObject(); Factory vsFact = new Factory(); string sequenceName; try { sequenceName = stepPropertyObject.GetValString("Veristand.RTSessionName", 0); } catch (System.Runtime.InteropServices.COMException ex) { sequenceName = "CouldNotFindName"; VSDialogs dialogs = new VSDialogs(); dialogs.ShowWarningDialog("Could not find name of RT Sequence"); } IStimulusProfileSession stimProfSession = vsFact.GetIStimulusProfileSession(gatewayIP, sequenceName, seqCallInfoArray, "Teststand Stimulus Profile Session"); bool auto_start; try { auto_start = stepPropertyObject.GetValBoolean("Veristand.StimProfAutoStart", 0); } catch (System.Runtime.InteropServices.COMException ex) { auto_start = false; } string sessionName; NationalInstruments.VeriStand.Error vsError; stimProfSession.Deploy(auto_start, out sessionName, out vsError); if (vsError.Code != 0) { VSDialogs dialogs2 = new VSDialogs(); dialogs2.ShowWarningDialog(vsError.ResolvedErrorMessage); } return(stimProfSession); } catch (NationalInstruments.VeriStand.VeriStandException ex) { VSDialogs dialogs = new VSDialogs(); dialogs.ShowWarningDialog(ex.ResolvedErrorMessage + "------" + ex.StackTrace); } catch (System.InvalidCastException ex) { VSDialogs dialogs = new VSDialogs(); dialogs.ShowWarningDialog(ex.Message + "------" + ex.StackTrace); } return(null); }
public void ReadBinary(ArkArchive archive, ReadingOptions options) { readBinaryHeader(archive); if (SaveVersion > 5) { // Name table is located after the objects block, but will be needed to read the objects block readBinaryNameTable(archive); } readBinaryDataFiles(archive, options); readBinaryEmbeddedData(archive, options); readBinaryDataFilesObjectMap(archive, options); readBinaryObjects(archive, options); readBinaryObjectProperties(archive, options); if (SaveVersion > 6) { readBinaryHibernation(archive, options); } // Now parse cryo creature data foreach (GameObject cryo in Objects.Where(x => x.ClassName.ToString().Contains("Cryop")).ToList()) { StructPropertyList customData = cryo.GetPropertyValue <IArkArray, ArkArrayStruct>("CustomItemDatas")?.FirstOrDefault() as StructPropertyList; PropertyStruct customDataBytes = customData?.Properties.FirstOrDefault(p => p.NameString == "CustomDataBytes") as PropertyStruct; PropertyArray byteArrays = (customDataBytes?.Value as StructPropertyList)?.Properties.FirstOrDefault(property => property.NameString == "ByteArrays") as PropertyArray; ArkArrayStruct byteArraysValue = byteArrays?.Value as ArkArrayStruct; ArkArrayUInt8 creatureBytes = ((byteArraysValue?[0] as StructPropertyList)?.Properties.FirstOrDefault(p => p.NameString == "Bytes") as PropertyArray)?.Value as ArkArrayUInt8; if (creatureBytes == null) { continue; } MemoryStream cryoStream = new MemoryStream(creatureBytes.ToArray <byte>()); using (ArkArchive cryoArchive = new ArkArchive(cryoStream)) { cryoArchive.ReadBytes(4); GameObject dino = new GameObject(cryoArchive); GameObject statusObject = new GameObject(cryoArchive); dino.LoadProperties(cryoArchive, new GameObject(), 0); statusObject.LoadProperties(cryoArchive, new GameObject(), 0); dino.IsCryo = true; addObject(dino, true); addObject(statusObject, true); //hack the id's so that the dino points to the appropriate dino status component PropertyObject statusComponentRef = dino.GetTypedProperty <PropertyObject>("MyCharacterStatusComponent"); statusComponentRef.Value.ObjectId = statusObject.Id; } } OldNameList = archive.HasUnknownNames ? archive.NameTable : null; HasUnknownData = archive.HasUnknownData; }
protected override object CreateImpl(PropertyObject propertyObject) { Func <DateTime, int, DateTime> getDateTime = (min, days) => { int random = GetRandomInstance(propertyObject).GetInt(0, days); return(min.AddDays(random)); }; return(CreateImpl(propertyObject, getDateTime)); }
protected override object CreateImpl(PropertyObject propertyObject) { if (!(propertyObject is CalcPropertyObject calcPropertyObject)) { throw new ArgumentException($"{nameof(propertyObject)} " + $"should be of type {nameof(CalcPropertyObject)}"); } return(CreateImpl(calcPropertyObject)); }
private PropertyObject GetPropertyObjectFromElement(XElement element, string typeSort) { PropertyObject property = new PropertyObject(); property.ObjectBrief = element.Attributes("ObjectBrief").FirstOrDefault().Value; property.ObjectName = element.Attributes("ObjectName").FirstOrDefault().Value; property.ObjectRemark = element.Attributes("ObjectRemark").FirstOrDefault().Value; property.TypeName = element.Attributes("TypeName").FirstOrDefault().Value; property.TypeSort = typeSort; return(property); }
public void OnModify(object sender, EventArgs e) { if (sender is PropertyObject) { PropertyObject propObj = (PropertyObject)sender; ActionModifyProperty action = new ActionModifyProperty(this); action.m_PropObj = propObj; action.Model = ElementTracker.Instance.TrackObj; ControllerCommandHistory.Instance.ExcuteAction(action); } }
public ChannelSelectionDialog(SequenceContext _seqContext, bool _ModelList) { ModelList = _ModelList; InitializeComponent(); //Set up Teststand objects seqContext = _seqContext; seqContextPO = seqContext.AsPropertyObject(); selectedTSSequence = seqContext.SelectedSequences[0]; selectedTSStep = seqContext.SelectedSteps[0]; stepID = selectedTSStep.UniqueStepId; seqFile = selectedTSSequence.SequenceFile; permSeqContext = selectedTSSequence.Locals; //Must get sequence context this way for variables to save if teststand is restarted propObjectFile = seqFile.AsPropertyObjectFile(); stepPropertyObject = selectedTSSequence.GetStepByUniqueId(stepID).AsPropertyObject(); try { channelValue = stepPropertyObject.GetValNumber("Veristand.ValueToSet", 0); selectedChannelName = stepPropertyObject.GetValString("Veristand.ChannelName", 0); SystemDefinitionPath = seqContext.SequenceFile.FileGlobalsDefaultValues.GetValString("Veristand.SystemDefinitionPath", 1);//Try to get the specific system definition path associated with this step seqContext.SequenceFile.FileGlobalsDefaultValues.SetFlags("Veristand.SystemDefinitionPath", 0, 0x4400000); this.SystemDefinitionPathControl.Text = SystemDefinitionPath; this.set_value_control.Value = (decimal)channelValue; } catch (System.Runtime.InteropServices.COMException) { selectedChannelName = ""; SystemDefinitionPath = ""; //If there is no system definition path default to the empty string this.SystemDefinitionPathControl.Text = SystemDefinitionPath; } if (System.IO.File.Exists(SystemDefinitionPath) && System.IO.Path.GetExtension(SystemDefinitionPath) == ".nivssdf") { //File exists with correct extension so try and populate the grid TreeNodeCollection tempTreeNodeCollection = InitializeListBox(SystemDefinitionPath); treeNodes = new TreeNode[tempTreeNodeCollection.Count]; tempTreeNodeCollection.CopyTo(treeNodes, 0); } if (selectedChannelName != "") { TreeNode[] foundNodes = this.ChannelSelection.Nodes.Find(selectedChannelName, true); if (foundNodes.Length > 0) { this.ChannelSelection.SelectedNode = foundNodes[0];//Only one node should match exactly this.ChannelSelection.HideSelection = false; this.ChannelSelection.SelectedNode.BackColor = Color.Violet; this.ChannelSelection.Focus();//This does not seem to be working } } }
public object RpcRequestFromContainer(string method, PropertyObject ptyObj /*, int timeout = 30000*/) { object response = null; //m_cts.CancelAfter(timeout); m_JoinableTask.Run(async delegate { //response = await m_JsonRpc.InvokeWithParameterObjectAsync<object>(method, parameter, m_cts.Token); response = await m_JsonRpc.InvokeAsync <object>(method, getPropObjectValue(ptyObj)); }); return(response); }
public static void Load() { HorzMap = new Image("horz"); VertMap = new Image("vert"); PropertyObject complete = PropertyObject.Load("maps\\mapdata.txt"); AllData = new List <LevelData>(); foreach (PropertyObject o in complete.GetAllPropertyObjects()) { AllData.Add(new LevelData(o)); } }
public CompanionsPatrolsBehavior() { CompanionAiPatrolProperty = new PropertyObject("zenDzeeMods_patrol_player_lands"); PropertyObject tmp = ZenDzeeCompatibilityHelper.RegisterPresumedObject(CompanionAiPatrolProperty); if (tmp != null) { CompanionAiPatrolProperty = tmp; } CompanionAiPatrolProperty.Initialize(new TextObject("zenDzeeMods_patrol_player_lands"), new TextObject("Non-zero value tells companion to patrol player lands.")); }
/// <summary> /// Ricezione messaggio di valore di plctag sottoscritto cambiato /// se la property associata รจ sottoscritta invio messaggio di notifica al sottoscrittore /// </summary> /// <param name="Message"></param> /// <returns><c>true</c> if the tag is effectively subscribed; otherwise, <c>false</c>.</returns> private bool PLCTagChanged(IIncomingMessage Message) { bool RetValue = true; // get msg application data var MsgData = GeneralHelper.DeserializeObject(Message.MessageData) as PLCTagData; var plctag = MsgData.Tag; Logger.InfoFormat("{0} -> {1}/{2}:{3}", Message.SourceApplicationName, plctag.PLCName, plctag.Address, plctag.Value); // trova il tag corrispondente all'indirizzo sottoscritto TagItem tag; if ((tag = ListTagItems.FirstOrDefault(item => item.PLCName == plctag.PLCName && item.Address == plctag.Address)) != null) { // try { tag.Value = MsgData.Tag.Value; } catch (Exception exc) { Logger.WarnFormat("Errore in cambio Tag value {0} : {1}/{2}:{3} -> {4} {5}", tag.Name, tag.PLCName, tag.Address, tag.Type, tag.Value, exc.Message); RetValue = false; } // recupero la lista delle properties dell'impianto // LG: Ma la uso anche in SubscribePLCTags!!! Devo fare tutte le volte sta roba? List <PropertyObject> props = dataManager.PathObjectsDictionary.Values.Where(item => item.GetType() == typeof(PropertyObject)).Cast <PropertyObject>().ToList(); // trova la property associata e cambia il valore PropertyObject property = props.FirstOrDefault(prp => prp.bind == tag.Name); if (property != null) { try { property.value = tag.Value; } catch (Exception exc) { Logger.WarnFormat("Errore in cambio valore property {0}:{1} {2}", property.path, tag.Value, exc.Message); RetValue = false; } } } else { Logger.InfoFormat("Tag associato a : {0}/{1} non trovato", plctag.PLCName, plctag.Address); RetValue = false; } return(RetValue); }
static void resolveExpressions(ref string[] inputStrings, PropertyObject expSeqContextPO) { int i = 0; foreach (string currentInput in inputStrings) { PropertyObject evaluatedValuePO = expSeqContextPO.EvaluateEx(currentInput, 0); inputStrings[i] = evaluatedValuePO.GetValVariant(evaluatedValuePO.GetLocation(evaluatedValuePO), 0).ToString(); i++; } }
public void Should_render_template(string templateContent, string expected) { _template = new TemplateExpander(templateContent); var message = new PropertyObject("some"); //preheating. string actual = _template.Render(message); var stopwatch = new Stopwatch(); stopwatch.Start(); int count = 1000000; for (int i = 0; i < count; i++) { actual = _template.Render(message); } stopwatch.Stop(); Console.WriteLine("{0} - {1}", templateContent, stopwatch.Elapsed); Assert.That(actual, Is.EqualTo(expected)); }
private void OperCreateProperty() { int num = this.r.arg1; int id = this.r.arg2; int res = this.r.res; ClassObject classObject = this.GetClassObject(id); PropertyObject obj3 = new PropertyObject(this.scripter, num, id, res); obj3.PCodeLine = this.n; this.PutVal(num, obj3); classObject.AddMember(obj3); this.n++; }
public int RegisterProperty(PropertyInfo info, int type_id) { int num = this.AppVar(); this[num].Name = info.Name; this[num].Level = type_id; this[num].Kind = MemberKind.Property; this[num].TypeId = this.RegisterType(info.PropertyType, false); ParameterInfo[] indexParameters = info.GetIndexParameters(); PropertyObject m = new PropertyObject(this.scripter, num, type_id, indexParameters.Length); m.Imported = true; m.Property_Info = info; this[num].Val = m; ClassObject val = (ClassObject) this[type_id].Val; val.AddMember(m); m.OwnerType = val.ImportedType; MethodInfo getMethod = info.GetGetMethod(); if ((getMethod == null) && this.scripter.SearchProtected) { getMethod = info.GetGetMethod(true); } if (getMethod != null) { m.ReadId = this.RegisterMethod(getMethod, type_id); if (getMethod.IsPublic) { m.Modifiers.Add(Modifier.Public); } if (getMethod.IsStatic) { m.Modifiers.Add(Modifier.Static); } } MethodInfo setMethod = info.GetSetMethod(); if ((setMethod == null) && this.scripter.SearchProtected) { setMethod = info.GetSetMethod(true); } if (setMethod != null) { m.WriteId = this.RegisterMethod(setMethod, type_id); if (setMethod.IsPublic) { m.Modifiers.Add(Modifier.Public); } if (setMethod.IsStatic) { m.Modifiers.Add(Modifier.Static); } } return num; }
private void ConvertToDefaultPropertyCall(PropertyObject p, IntegerList a, IntegerList pos) { int num3; FunctionObject functionObject; int num = this.r.arg1; int num2 = 0; if ((this[this.n + 1].op == this.OP_ASSIGN) && (this[this.n + 1].arg1 == this[this.n].res)) { num2 = this.n + 1; } if (num2 > 0) { if (p.WriteId == 0) { this.scripter.CreateErrorObjectEx("CS0154. The property or indexer '{0}' cannot be used in this context because it lacks the get accessor.", new object[] { p.Name }); } else { functionObject = this.GetFunctionObject(p.WriteId); int num4 = this[num2].arg2; this.r.arg1 = p.WriteId; this[this.n - 1].arg1 = num; this.r.arg2++; if (functionObject.ParamCount != this.r.arg2) { this.scripter.CreateErrorObjectEx("CS1501. No overload for method '{0}' takes '{1}' arguments.", new object[] { functionObject.FullName, this.r.arg2 }); } for (num3 = 0; num3 < pos.Count; num3++) { this[pos[num3]].res = p.WriteId; } this.InsertOperators(this.n - 1, 1); this[this.n - 1].op = this.OP_PUSH; this[this.n - 1].arg1 = num4; this[this.n - 1].arg2 = 0; this[this.n - 1].res = p.WriteId; this.n++; this[this.n + 1].op = this.OP_NOP; } } else if (p.ReadId == 0) { this.scripter.CreateErrorObjectEx("CS0154. The property or indexer '{0}' cannot be used in this context because it lacks the get accessor.", new object[] { p.Name }); } else { this.r.arg1 = p.ReadId; if (this.r.res >= 0) { this.symbol_table[this.r.res].TypeId = this.symbol_table[this.r.arg1].TypeId; } this[this.n - 1].arg1 = num; for (num3 = 0; num3 < pos.Count; num3++) { this[pos[num3]].res = p.ReadId; } functionObject = this.GetFunctionObject(p.ReadId); if (functionObject.ParamCount != this.r.arg2) { this.scripter.CreateErrorObjectEx("CS1501. No overload for method '{0}' takes '{1}' arguments.", new object[] { functionObject.FullName, this.r.arg2 }); } } }