public void SerializeXMLTest()
        {
            var commandList = new CommandDescriptions();
            List <CommandDescription> command = new List <CommandDescription>();

            CommandDescription commandDescription = new CommandDescription();

            commandDescription.Name           = "Phase A power consumption";
            commandDescription.TestTargetType = Production.PCBTest.TestTargetType.Meter;
            commandDescription.ResoureId      = "Item_PhaseAPowerConsumption";
            //commandDescription.CommandType = new MeasureActivePowerCommand();
            commandDescription.CommandType      = "MeasureActivePowerCommand";
            commandDescription.ErrorControlType = "RangeSelector";

            var commandParameter = new MeasureParameter();

            commandParameter.LowerLimit         = 0.6m;
            commandParameter.UpperLimit         = 1.0m;
            commandParameter.Phase              = Phase.A;
            commandParameter.PinNumber          = 0;
            commandParameter.CurrentRange       = CurrentRange.All;
            commandDescription.CommandParameter = commandParameter;


            command.Add(commandDescription);
            commandList.Command = command;
            SerializeHelper.SerializeXML <CommandDescriptions>(commandList, @"H:\WorkSpace\rPCBT\PCBTestUtility\Xml\XmlTest.xml");
            //Assert.Fail();
        }
Beispiel #2
0
        private void OnDestroy()
        {
#if DEBUG
            _hi?.UnpatchSelf();
#endif
            _watcher?.Dispose();

            // Only update saved descriptions if user used this plugin at all
            if (_commandDescriptions != null)
            {
                foreach (var commandInfo in AdvCommandInfo.AllCommands)
                {
                    CommandDescriptions[commandInfo.CommandName] = commandInfo.Description.Trim();
                }

                var vals      = CommandDescriptions.Select(x => x.Key.PadRight(24) + ", " + x.Value.Replace("\r", "").Escape());
                var localPath = Path.Combine(Paths.ConfigPath, DescrFileName);
                File.Delete(localPath + ".bak");
                File.Move(localPath, localPath + ".bak");
                File.WriteAllLines(localPath, vals.ToArray());
            }
        }