コード例 #1
0
ファイル: FMOVViewModel.cs プロジェクト: hyzhappy/samsoarii
 public override void ParseValue(IList <string> valueStrings)
 {
     try
     {
         SourceValue = ValueParser.ParseWordValue(valueStrings[0]);
     }
     catch (ValueParseException)
     {
         SourceValue = WordValue.Null;
     }
     try
     {
         DestinationValue = ValueParser.ParseWordValue(valueStrings[1]);
     }
     catch (ValueParseException)
     {
         DestinationValue = WordValue.Null;
     }
     try
     {
         CountValue = ValueParser.ParseWordValue(valueStrings[2]);
     }
     catch (ValueParseException)
     {
         CountValue = WordValue.Null;
     }
 }
コード例 #2
0
        /*
         * public override IPropertyDialog PreparePropertyDialog()
         * {
         *  var dialog = new ElementPropertyDialog(3);
         *  dialog.ShowLine2("F:", FreqValue);
         *  dialog.ShowLine4("DC:", DutyCycleValue);
         *  dialog.ShowLine6("OUT:", OutputValue);
         *  return dialog;
         * }
         */
        public override void AcceptNewValues(IList <string> valueStrings, Device contextDevice)
        {
            var  oldvaluestring1 = FreqValue.ValueString;
            var  oldvaluestring2 = DutyCycleValue.ValueString;
            var  oldvaluestring3 = OutputValue.ValueString;
            bool check1          = ValueParser.CheckValueString(valueStrings[0], new Regex[] {
                ValueParser.VerifyWordRegex3, ValueParser.VerifyIntKHValueRegex
            });
            bool check2 = ValueParser.CheckValueString(valueStrings[2], new Regex[] {
                ValueParser.VerifyWordRegex3, ValueParser.VerifyIntKHValueRegex
            });
            bool check3 = ValueParser.CheckValueString(valueStrings[4], new Regex[] {
                ValueParser.VerifyBitRegex4
            });

            if (check1 && check2 && check3)
            {
                FreqValue      = ValueParser.ParseWordValue(valueStrings[0], contextDevice);
                DutyCycleValue = ValueParser.ParseWordValue(valueStrings[2], contextDevice);
                OutputValue    = ValueParser.ParseBitValue(valueStrings[4], contextDevice);
                InstructionCommentManager.ModifyValue(this, oldvaluestring1, FreqValue.ValueString);
                InstructionCommentManager.ModifyValue(this, oldvaluestring2, DutyCycleValue.ValueString);
                InstructionCommentManager.ModifyValue(this, oldvaluestring3, OutputValue.ValueString);
                ValueCommentManager.UpdateComment(FreqValue, valueStrings[1]);
                ValueCommentManager.UpdateComment(DutyCycleValue, valueStrings[3]);
                ValueCommentManager.UpdateComment(OutputValue, valueStrings[5]);
            }
        }
コード例 #3
0
ファイル: PLSRDViewModel.cs プロジェクト: hyzhappy/samsoarii
 public override void ParseValue(IList <string> valueStrings)
 {
     try
     {
         ArgumentValue = ValueParser.ParseWordValue(valueStrings[0]);
     }
     catch (ValueParseException)
     {
         ArgumentValue = WordValue.Null;
     }
     try
     {
         VelocityValue = ValueParser.ParseWordValue(valueStrings[1]);
     }
     catch (ValueParseException)
     {
         VelocityValue = WordValue.Null;
     }
     try
     {
         OutputValue1 = ValueParser.ParseBitValue(valueStrings[2]);
     }
     catch (ValueParseException)
     {
         OutputValue1 = BitValue.Null;
     }
     try
     {
         OutputValue2 = ValueParser.ParseBitValue(valueStrings[3]);
     }
     catch (ValueParseException)
     {
         OutputValue2 = BitValue.Null;
     }
 }
コード例 #4
0
ファイル: MBUSViewModel.cs プロジェクト: hyzhappy/samsoarii
        /*
         * public override IPropertyDialog PreparePropertyDialog()
         * {
         *  var dialog = new ElementPropertyDialog(3, ElementPropertyDialog.INST_MBUS);
         *  dialog.Title = InstructionName;
         *  dialog.ShowLine2("COM:", COMPort);
         *  dialog.ShowLine4("TABLE:");
         *  dialog.ValueString4 = Table;
         *  dialog.ShowLine6("WR:", Message);
         *  return dialog;
         * }
         */
        public override void AcceptNewValues(IList <string> valueStrings, Device contextDevice)
        {
            var  oldvaluestring1 = COMPort.ValueString;
            var  oldvaluestring2 = Table;
            var  oldvaluestring3 = Message.ValueString;
            bool check1          = ValueParser.CheckValueString(valueStrings[0], new Regex[] {
                ValueParser.VerifyWordRegex1, ValueParser.VerifyIntKHValueRegex
            });
            bool check3 = ValueParser.CheckValueString(valueStrings[4], new Regex[] {
                ValueParser.VerifyWordRegex3
            });

            if (check1 && check3)
            {
                COMPort = ValueParser.ParseWordValue(valueStrings[0], contextDevice);
                Table   = valueStrings[2];
                Message = ValueParser.ParseWordValue(valueStrings[4], contextDevice);
                InstructionCommentManager.ModifyValue(this, oldvaluestring1, COMPort.ValueString);
                InstructionCommentManager.ModifyValue(this, oldvaluestring2, Table);
                InstructionCommentManager.ModifyValue(this, oldvaluestring3, Message.ValueString);
                ValueCommentManager.UpdateComment(COMPort, valueStrings[1]);
                ValueCommentManager.UpdateComment(Message, valueStrings[5]);
            }
            else if (!check1)
            {
                throw new ValueParseException("COM格式错误!");
            }
            else if (!check3)
            {
                throw new ValueParseException("WR格式错误!");
            }
        }
コード例 #5
0
        /*
         * public override IPropertyDialog PreparePropertyDialog()
         * {
         *  var dialog = new ElementPropertyDialog(2);
         *  dialog.Title = InstructionName;
         *  dialog.ShowLine3("IN:", InputValue);
         *  dialog.ShowLine5("OUT:", OutputValue);
         *  return dialog;
         * }
         */
        public override void AcceptNewValues(IList <string> valueStrings, Device contextDevice)
        {
            var  oldvaluestring1 = InputValue.ValueString;
            var  oldvaluestring2 = OutputValue.ValueString;
            bool check1          = ValueParser.CheckValueString(valueStrings[0], new Regex[] {
                ValueParser.VerifyWordRegex1, ValueParser.VerifyIntKHValueRegex
            });
            bool check2 = ValueParser.CheckValueString(valueStrings[2], new Regex[] {
                ValueParser.VerifyWordRegex1
            });

            if (check1 && check2)
            {
                InputValue  = ValueParser.ParseWordValue(valueStrings[0], contextDevice);
                OutputValue = ValueParser.ParseWordValue(valueStrings[2], contextDevice);
                InstructionCommentManager.ModifyValue(this, oldvaluestring1, InputValue.ValueString);
                InstructionCommentManager.ModifyValue(this, oldvaluestring2, OutputValue.ValueString);
                ValueCommentManager.UpdateComment(InputValue, valueStrings[1]);
                ValueCommentManager.UpdateComment(OutputValue, valueStrings[3]);
            }
            else if (!check1)
            {
                throw new ValueParseException("IN格式错误!");
            }
            else if (!check2)
            {
                throw new ValueParseException("OUT格式错误!");
            }
        }
コード例 #6
0
        /*
         * public override IPropertyDialog PreparePropertyDialog()
         * {
         *  var dialog = new ElementPropertyDialog(3);
         *  dialog.Title = InstructionName;
         *  dialog.ShowLine3("TV:", TimerValue);
         *  dialog.ShowLine5("SV:", EndValue);
         *  return dialog;
         * }
         */
        public override void AcceptNewValues(IList <string> valueStrings, Device contextDevice)
        {
            var  oldvaluestring1 = TimerValue.ValueString;
            var  oldvaluestring2 = EndValue.ValueString;
            bool check1          = ValueParser.CheckValueString(valueStrings[0], new Regex[] {
                ValueParser.VerifyWordRegex4
            });
            bool check2 = ValueParser.CheckValueString(valueStrings[2], new Regex[] {
                ValueParser.VerifyWordRegex3, ValueParser.VerifyIntKHValueRegex
            });

            if (check1 && check2)
            {
                TimerValue = ValueParser.ParseWordValue(valueStrings[0], contextDevice);
                EndValue   = ValueParser.ParseWordValue(valueStrings[2], contextDevice);
                InstructionCommentManager.ModifyValue(this, oldvaluestring1, TimerValue.ValueString);
                InstructionCommentManager.ModifyValue(this, oldvaluestring2, EndValue.ValueString);
                ValueCommentManager.UpdateComment(TimerValue, valueStrings[1]);
                ValueCommentManager.UpdateComment(EndValue, valueStrings[3]);
            }
            else if (!check1)
            {
                throw new ValueParseException("TV格式错误!");
            }
            else if (!check2)
            {
                throw new ValueParseException("SV格式错误!");
            }
        }
コード例 #7
0
 public override void ParseValue(IList <string> valueStrings)
 {
     try
     {
         COMPort = ValueParser.ParseWordValue(valueStrings[0]);
     }
     catch (ValueParseException)
     {
         COMPort = WordValue.Null;
     }
     try
     {
         BaseValue = ValueParser.ParseWordValue(valueStrings[2]);
     }
     catch (ValueParseException)
     {
         BaseValue = WordValue.Null;
     }
     try
     {
         CountValue = ValueParser.ParseWordValue(valueStrings[4]);
     }
     catch (ValueParseException)
     {
         CountValue = WordValue.Null;
     }
 }
コード例 #8
0
 public override void ParseValue(IList <string> valueStrings)
 {
     try
     {
         InputValue1 = ValueParser.ParseWordValue(valueStrings[0]);
     }
     catch (ValueParseException exception)
     {
         InputValue1 = WordValue.Null;
     }
     try
     {
         InputValue2 = ValueParser.ParseWordValue(valueStrings[1]);
     }
     catch (ValueParseException exception)
     {
         InputValue2 = WordValue.Null;
     }
     try
     {
         OutputValue = ValueParser.ParseWordValue(valueStrings[2]);
     }
     catch (ValueParseException exception)
     {
         OutputValue = WordValue.Null;
     }
 }
コード例 #9
0
ファイル: SHLBViewModel.cs プロジェクト: hyzhappy/samsoarii
        /*
         * public override IPropertyDialog PreparePropertyDialog()
         * {
         *  var dialog = new ElementPropertyDialog(4);
         *  dialog.Title = InstructionName;
         *  dialog.ShowLine1("SRC", SourceValue);
         *  dialog.ShowLine3("DST", DestinationValue);
         *  dialog.ShowLine5("N1", CountValue);
         *  dialog.ShowLine7("N2", MoveValue);
         *  return dialog;
         * }
         */
        public override void AcceptNewValues(IList <string> valueStrings, Device contextDevice)
        {
            var  oldvaluestring1 = SourceValue.ValueString;
            var  oldvaluestring2 = DestinationValue.ValueString;
            var  oldvaluestring3 = CountValue.ValueString;
            var  oldvaluestring4 = MoveValue.ValueString;
            bool check1          = ValueParser.CheckValueString(valueStrings[0],
                                                                new Regex[] { ValueParser.VerifyBitRegex1 });
            bool check2 = ValueParser.CheckValueString(valueStrings[2],
                                                       new Regex[] { ValueParser.VerifyBitRegex2 });
            bool check3 = ValueParser.CheckValueString(valueStrings[4],
                                                       new Regex[] { ValueParser.VerifyWordRegex3, ValueParser.VerifyIntKHValueRegex });
            bool check4 = ValueParser.CheckValueString(valueStrings[6],
                                                       new Regex[] { ValueParser.VerifyWordRegex3, ValueParser.VerifyIntKHValueRegex });

            if (check1 && check2 && check3 && check4)
            {
                SourceValue      = ValueParser.ParseBitValue(valueStrings[0], contextDevice);
                DestinationValue = ValueParser.ParseBitValue(valueStrings[2], contextDevice);
                CountValue       = ValueParser.ParseWordValue(valueStrings[4], contextDevice);
                MoveValue        = ValueParser.ParseWordValue(valueStrings[6], contextDevice);
                InstructionCommentManager.ModifyValue(this, oldvaluestring1, SourceValue.ValueString);
                InstructionCommentManager.ModifyValue(this, oldvaluestring2, DestinationValue.ValueString);
                InstructionCommentManager.ModifyValue(this, oldvaluestring3, CountValue.ValueString);
                InstructionCommentManager.ModifyValue(this, oldvaluestring4, MoveValue.ValueString);
                ValueCommentManager.UpdateComment(SourceValue, valueStrings[1]);
                ValueCommentManager.UpdateComment(DestinationValue, valueStrings[3]);
                ValueCommentManager.UpdateComment(CountValue, valueStrings[5]);
                ValueCommentManager.UpdateComment(MoveValue, valueStrings[7]);
            }
        }
コード例 #10
0
        /// <summary>
        /// 获取一个监视表格内所有被监视的软元件
        /// </summary>
        /// <param name="table">监视表格</param>
        static private void GetRegisters(MonitorVariableTable table)
        {
            foreach (ElementModel emodel in table.Elements)
            {
                string ivname = emodel.ShowName;
                if (!regids.ContainsKey(ivname))
                {
                    IValueModel ivmodel = null;
                    switch (emodel.ShowType)
                    {
                    case "BOOL":
                        ivmodel = ValueParser.ParseBitValue(ivname);
                        break;

                    case "WORD":
                    case "UWORD":
                    case "BCD":
                        ivmodel = ValueParser.ParseWordValue(ivname);
                        break;

                    case "DWORD":
                    case "UDWORD":
                        ivmodel = ValueParser.ParseDoubleWordValue(ivname);
                        break;

                    case "FLOAT":
                        ivmodel = ValueParser.ParseFloatValue(ivname);
                        break;
                    }
                    regs.Add(ivmodel);
                    regids.Add(ivname, regids.Count());
                }
            }
        }
コード例 #11
0
 public override void ParseValue(IList <string> valueStrings)
 {
     try
     {
         FreqValue = ValueParser.ParseWordValue(valueStrings[0]);
     }
     catch (ValueParseException)
     {
         FreqValue = WordValue.Null;
     }
     try
     {
         PulseValue = ValueParser.ParseWordValue(valueStrings[1]);
     }
     catch (ValueParseException)
     {
         PulseValue = WordValue.Null;
     }
     try
     {
         OutputValue = ValueParser.ParseBitValue(valueStrings[2]);
     }
     catch (ValueParseException)
     {
         OutputValue = BitValue.Null;
     }
 }
コード例 #12
0
ファイル: XCHViewModel.cs プロジェクト: hyzhappy/samsoarii
        /*
         * public override IPropertyDialog PreparePropertyDialog()
         * {
         *  var dialog = new ElementPropertyDialog(2);
         *  dialog.Title = InstructionName;
         *  dialog.ShowLine3("L:", LeftValue);
         *  dialog.ShowLine5("R:", RightValue);
         *  return dialog;
         * }
         */
        public override void AcceptNewValues(IList <string> valueStrings, Device contextDevice)
        {
            var  oldvaluestring1 = LeftValue.ValueString;
            var  oldvaluestring2 = RightValue.ValueString;
            bool check1          = ValueParser.CheckValueString(valueStrings[0], new Regex[] {
                ValueParser.VerifyWordRegex1
            });
            bool check2 = ValueParser.CheckValueString(valueStrings[2], new Regex[] {
                ValueParser.VerifyWordRegex1
            });

            if (check1 && check2)
            {
                LeftValue  = ValueParser.ParseWordValue(valueStrings[0], contextDevice);
                RightValue = ValueParser.ParseWordValue(valueStrings[2], contextDevice);
                InstructionCommentManager.ModifyValue(this, oldvaluestring1, LeftValue.ValueString);
                InstructionCommentManager.ModifyValue(this, oldvaluestring2, RightValue.ValueString);
                ValueCommentManager.UpdateComment(LeftValue, valueStrings[1]);
                ValueCommentManager.UpdateComment(RightValue, valueStrings[3]);
            }
            else if (!check1)
            {
                throw new ValueParseException("L格式错误!");
            }
            else if (!check2)
            {
                throw new ValueParseException("R格式错误!");
            }
        }
コード例 #13
0
ファイル: JMPViewModel.cs プロジェクト: hyzhappy/samsoarii
 public override void ParseValue(IList <string> valueStrings)
 {
     try
     {
         LBLIndex = ValueParser.ParseWordValue(valueStrings[0]);
     }
     catch (ValueParseException exception)
     {
         LBLIndex = WordValue.Null;
     }
 }
コード例 #14
0
 public override void ParseValue(IList <string> valueStrings)
 {
     try
     {
         IDValue = ValueParser.ParseWordValue(valueStrings[0]);
     }
     catch (ValueParseException)
     {
         IDValue = WordValue.Null;
     }
     FuncName = valueStrings[2];
 }
コード例 #15
0
        /*
         * public override IPropertyDialog PreparePropertyDialog()
         * {
         *  var dialog = new ElementPropertyDialog(4);
         *  dialog.Title = InstructionName;
         *  dialog.ShowLine1("IN1:", InputValue1);
         *  dialog.ShowLine3("IN2:", InputValue2);
         *  dialog.ShowLine5("IN3:", InputValue3);
         *  dialog.ShowLine7("OUT:", OutputValue);
         *  return dialog;
         * }
         */
        public override void AcceptNewValues(IList <string> valueStrings, Device contextDevice)
        {
            var  oldvaluestring1 = InputValue1.ValueString;
            var  oldvaluestring2 = InputValue2.ValueString;
            var  oldvaluestring3 = InputValue3.ValueString;
            var  oldvaluestring4 = OutputValue.ValueString;
            bool check1          = ValueParser.CheckValueString(valueStrings[0], new Regex[] {
                ValueParser.VerifyWordRegex1, ValueParser.VerifyIntKHValueRegex
            });
            bool check2 = ValueParser.CheckValueString(valueStrings[2], new Regex[] {
                ValueParser.VerifyWordRegex1, ValueParser.VerifyIntKHValueRegex
            });
            bool check3 = ValueParser.CheckValueString(valueStrings[4], new Regex[] {
                ValueParser.VerifyWordRegex1, ValueParser.VerifyIntKHValueRegex
            });
            bool check4 = ValueParser.CheckValueString(valueStrings[6], new Regex[] {
                ValueParser.VerifyBitRegex3
            });

            if (check1 && check2 && check3 && check4)
            {
                InputValue1 = ValueParser.ParseWordValue(valueStrings[0], contextDevice);
                InputValue2 = ValueParser.ParseWordValue(valueStrings[2], contextDevice);
                InputValue3 = ValueParser.ParseWordValue(valueStrings[4], contextDevice);
                OutputValue = ValueParser.ParseBitValue(valueStrings[6], contextDevice);
                InstructionCommentManager.ModifyValue(this, oldvaluestring1, InputValue1.ValueString);
                InstructionCommentManager.ModifyValue(this, oldvaluestring2, InputValue2.ValueString);
                InstructionCommentManager.ModifyValue(this, oldvaluestring3, InputValue3.ValueString);
                InstructionCommentManager.ModifyValue(this, oldvaluestring4, OutputValue.ValueString);
                ValueCommentManager.UpdateComment(InputValue1, valueStrings[1]);
                ValueCommentManager.UpdateComment(InputValue2, valueStrings[3]);
                ValueCommentManager.UpdateComment(InputValue3, valueStrings[5]);
                ValueCommentManager.UpdateComment(OutputValue, valueStrings[7]);
            }
            else if (!check1)
            {
                throw new ValueParseException("IN1格式错误!");
            }
            else if (!check2)
            {
                throw new ValueParseException("IN2格式错误!");
            }
            else if (!check3)
            {
                throw new ValueParseException("IN3格式错误!");
            }
            else if (!check4)
            {
                throw new ValueParseException("OUT格式错误!");
            }
        }
コード例 #16
0
ファイル: PLSRDViewModel.cs プロジェクト: hyzhappy/samsoarii
        /*
         * public override IPropertyDialog PreparePropertyDialog()
         * {
         *  var dialog = new ElementPropertyDialog(4);
         *  dialog.ShowLine1("D:", ArgumentValue);
         *  dialog.ShowLine3("V:", VelocityValue);
         *  dialog.ShowLine5("OUT1:", OutputValue1);
         *  dialog.ShowLine7("OUT2:", OutputValue2);
         *  return dialog;
         * }
         */
        public override void AcceptNewValues(IList <string> valueStrings, Device contextDevice)
        {
            var  oldvaluestring1 = ArgumentValue.ValueString;
            var  oldvaluestring2 = VelocityValue.ValueString;
            var  oldvaluestring3 = OutputValue1.ValueString;
            var  oldvaluestring4 = OutputValue2.ValueString;
            bool check1          = ValueParser.CheckValueString(valueStrings[0], new Regex[] {
                ValueParser.VerifyWordRegex3
            });
            bool check2 = ValueParser.CheckValueString(valueStrings[2], new Regex[] {
                ValueParser.VerifyWordRegex3, ValueParser.VerifyIntKHValueRegex
            });
            bool check3 = ValueParser.CheckValueString(valueStrings[4], new Regex[] {
                ValueParser.VerifyBitRegex4
            });
            bool check4 = ValueParser.CheckValueString(valueStrings[6], new Regex[] {
                ValueParser.VerifyBitRegex4
            });

            if (check1 && check2 && check3)
            {
                ArgumentValue = ValueParser.ParseWordValue(valueStrings[0], contextDevice);
                VelocityValue = ValueParser.ParseWordValue(valueStrings[2], contextDevice);
                OutputValue1  = ValueParser.ParseBitValue(valueStrings[4], contextDevice);
                OutputValue2  = ValueParser.ParseBitValue(valueStrings[6], contextDevice);
                InstructionCommentManager.ModifyValue(this, oldvaluestring1, ArgumentValue.ValueString);
                InstructionCommentManager.ModifyValue(this, oldvaluestring2, VelocityValue.ValueString);
                InstructionCommentManager.ModifyValue(this, oldvaluestring3, OutputValue1.ValueString);
                InstructionCommentManager.ModifyValue(this, oldvaluestring3, OutputValue2.ValueString);
                ValueCommentManager.UpdateComment(ArgumentValue, valueStrings[1]);
                ValueCommentManager.UpdateComment(VelocityValue, valueStrings[3]);
                ValueCommentManager.UpdateComment(OutputValue1, valueStrings[5]);
                ValueCommentManager.UpdateComment(OutputValue2, valueStrings[7]);
            }
            else if (!check1)
            {
                throw new ValueParseException("D格式非法!");
            }
            else if (!check2)
            {
                throw new ValueParseException("V格式非法");
            }
            else if (!check3)
            {
                throw new ValueParseException("OUT1格式非法!");
            }
            else if (!check4)
            {
                throw new ValueParseException("OUT2格式非法!");
            }
        }
コード例 #17
0
        /*
         * public override IPropertyDialog PreparePropertyDialog()
         * {
         *  var dialog = new ElementPropertyDialog(4);
         *  dialog.ShowLine1("BV:", BackValue);
         *  dialog.ShowLine3("CV:", CrawValue);
         *  dialog.ShowLine5("SIGN:", SignalValue);
         *  dialog.ShowLine7("OUT:", OutputValue);
         *  return dialog;
         * }
         */
        public override void AcceptNewValues(IList <string> valueStrings, Device contextDevice)
        {
            var  oldvaluestring1 = BackValue.ValueString;
            var  oldvaluestring2 = CrawValue.ValueString;
            var  oldvaluestring3 = SignalValue.ValueString;
            var  oldvaluestring4 = OutputValue.ValueString;
            bool check1          = ValueParser.CheckValueString(valueStrings[0], new Regex[] {
                ValueParser.VerifyWordRegex3
            });
            bool check2 = ValueParser.CheckValueString(valueStrings[2], new Regex[] {
                ValueParser.VerifyWordRegex3, ValueParser.VerifyIntKHValueRegex
            });
            bool check3 = ValueParser.CheckValueString(valueStrings[4], new Regex[] {
                ValueParser.VerifyBitRegex5
            });
            bool check4 = ValueParser.CheckValueString(valueStrings[6], new Regex[] {
                ValueParser.VerifyBitRegex4
            });

            if (check1 && check2 && check3 && check4)
            {
                BackValue   = ValueParser.ParseWordValue(valueStrings[0], contextDevice);
                CrawValue   = ValueParser.ParseWordValue(valueStrings[2], contextDevice);
                SignalValue = ValueParser.ParseBitValue(valueStrings[4], contextDevice);
                OutputValue = ValueParser.ParseBitValue(valueStrings[6], contextDevice);
                InstructionCommentManager.ModifyValue(this, oldvaluestring1, BackValue.ValueString);
                InstructionCommentManager.ModifyValue(this, oldvaluestring2, CrawValue.ValueString);
                InstructionCommentManager.ModifyValue(this, oldvaluestring3, SignalValue.ValueString);
                InstructionCommentManager.ModifyValue(this, oldvaluestring3, OutputValue.ValueString);
                ValueCommentManager.UpdateComment(BackValue, valueStrings[1]);
                ValueCommentManager.UpdateComment(CrawValue, valueStrings[3]);
                ValueCommentManager.UpdateComment(SignalValue, valueStrings[5]);
                ValueCommentManager.UpdateComment(OutputValue, valueStrings[7]);
            }
            else if (!check1)
            {
                throw new ValueParseException("BV格式非法!");
            }
            else if (!check2)
            {
                throw new ValueParseException("CV格式非法");
            }
            else if (!check3)
            {
                throw new ValueParseException("SIGN格式非法!");
            }
            else if (!check4)
            {
                throw new ValueParseException("OUT格式非法!");
            }
        }
コード例 #18
0
ファイル: JMPViewModel.cs プロジェクト: hyzhappy/samsoarii
        /*
         * public override IPropertyDialog PreparePropertyDialog()
         * {
         *  var dialog = new ElementPropertyDialog(1);
         *  dialog.Title = InstructionName;
         *  dialog.ShowLine4("LBL",LBLIndex);
         *  return dialog;
         * }
         */
        public override void AcceptNewValues(IList <string> valueStrings, Device contextDevice)
        {
            var oldvaluestring = LBLIndex.ValueString;

            if (ValueParser.CheckValueString(valueStrings[0], new Regex[] { ValueParser.VerifyIntKHValueRegex }))
            {
                LBLIndex = ValueParser.ParseWordValue(valueStrings[0], contextDevice);
                InstructionCommentManager.ModifyValue(this, oldvaluestring, LBLIndex.ValueString);
                ValueCommentManager.UpdateComment(LBLIndex, valueStrings[1]);
            }
            else
            {
                throw new ValueParseException("Unexpected input");
            }
        }
コード例 #19
0
ファイル: SETIMViewModel.cs プロジェクト: hyzhappy/samsoarii
 public override void ParseValue(IList <string> valueStrings)
 {
     try
     {
         Value = ValueParser.ParseBitValue(valueStrings[0]);
     }
     catch (ValueParseException exception)
     {
         Value = BitValue.Null;
     }
     try
     {
         Count = ValueParser.ParseWordValue(valueStrings[1]);
     }
     catch (ValueParseException exception)
     {
         Count = WordValue.Null;
     }
 }
コード例 #20
0
ファイル: DECViewModel.cs プロジェクト: hyzhappy/samsoarii
        /*
         * public override IPropertyDialog PreparePropertyDialog()
         * {
         *  var dialog = new ElementPropertyDialog(2);
         *  dialog.Title = InstructionName;
         *  dialog.ShowLine3("In",InputValue);
         *  dialog.ShowLine5("Out",OutputValue);
         *  return dialog;
         * }
         */
        public override void AcceptNewValues(IList <string> valueStrings, Device contextDevice)
        {
            var oldvaluestring1 = InputValue.ValueString;
            var oldvaluestring2 = OutputValue.ValueString;

            if (ValueParser.CheckValueString(valueStrings[0], new Regex[] { ValueParser.VerifyWordRegex1, ValueParser.VerifyIntKHValueRegex }) && ValueParser.CheckValueString(valueStrings[2], new Regex[] { ValueParser.VerifyWordRegex2 }))
            {
                InputValue  = ValueParser.ParseWordValue(valueStrings[0], contextDevice);
                OutputValue = ValueParser.ParseWordValue(valueStrings[2], contextDevice);
                InstructionCommentManager.ModifyValue(this, oldvaluestring1, InputValue.ValueString);
                InstructionCommentManager.ModifyValue(this, oldvaluestring2, OutputValue.ValueString);
                ValueCommentManager.UpdateComment(InputValue, valueStrings[1]);
                ValueCommentManager.UpdateComment(OutputValue, valueStrings[3]);
            }
            else
            {
                throw new ValueParseException("Unexpected input");
            }
        }
コード例 #21
0
 public override void ParseValue(IList <string> valueStrings)
 {
     try
     {
         TimerValue = ValueParser.ParseWordValue(valueStrings[0]);
     }
     catch (ValueParseException)
     {
         TimerValue = WordValue.Null;
     }
     try
     {
         EndValue = ValueParser.ParseWordValue(valueStrings[1]);
     }
     catch (ValueParseException)
     {
         EndValue = WordValue.Null;
     }
 }
コード例 #22
0
ファイル: MBUSViewModel.cs プロジェクト: hyzhappy/samsoarii
 public override void ParseValue(IList <string> valueStrings)
 {
     try
     {
         COMPort = ValueParser.ParseWordValue(valueStrings[0]);
     }
     catch (ValueParseException)
     {
         COMPort = WordValue.Null;
     }
     Table = valueStrings[1];
     try
     {
         Message = ValueParser.ParseWordValue(valueStrings[2]);
     }
     catch (ValueParseException)
     {
         Message = WordValue.Null;
     }
 }
コード例 #23
0
        /*
         * public override IPropertyDialog PreparePropertyDialog()
         * {
         *  var dialog = new ElementPropertyDialog(1);
         *  //dialog.ShowLine3("FUNC:", FuncName);
         *  dialog.ShowLine4("EVENT:", IDValue);
         *  return dialog;
         * }
         */
        public override void AcceptNewValues(IList <string> valueStrings, Device contextDevice)
        {
            var  oldvaluestring1 = IDValue.ValueString;
            bool check1          = ValueParser.CheckValueString(valueStrings[2], new Regex[] {
                ValueParser.VerifyIntKHValueRegex
            });

            if (check1)
            {
                IDValue = ValueParser.ParseWordValue(valueStrings[2], contextDevice);
                int id = int.Parse(IDValue.GetValue());
                if (id < 0 || id > 7)
                {
                    throw new ValueParseException("EV超出范围(0-7)");
                }
            }
            else
            {
                throw new ValueParseException("EV格式非法!");
            }
        }
コード例 #24
0
 public override void ParseValue(IList <string> valueStrings)
 {
     try
     {
         CountValue = ValueParser.ParseWordValue(valueStrings[0]);
         StartValue = ValueParser.ParseWordValue(valueStrings[1]);
     }
     catch (ValueParseException)
     {
         try
         {
             CountValue = ValueParser.ParseDoubleWordValue(valueStrings[0]);
             StartValue = ValueParser.ParseDoubleWordValue(valueStrings[1]);
         }
         catch (ValueParseException)
         {
             CountValue = WordValue.Null;
             StartValue = WordValue.Null;
         }
     }
 }
コード例 #25
0
ファイル: REVViewModel.cs プロジェクト: hyzhappy/samsoarii
        /*
         * public override IPropertyDialog PreparePropertyDialog()
         * {
         *  var dialog = new ElementPropertyDialog(3);
         *  dialog.Title = InstructionName;
         *  dialog.ShowLine2("COM:", COMPort);
         *  dialog.ShowLine4("ADDR:", BaseValue);
         *  dialog.ShowLine6("LEN:", CountValue);
         *  return dialog;
         * }
         */
        public override void AcceptNewValues(IList <string> valueStrings, Device contextDevice)
        {
            var  oldvaluestring1 = COMPort.ValueString;
            var  oldvaluestring2 = BaseValue.ValueString;
            var  oldvaluestring3 = CountValue.ValueString;
            bool check1          = ValueParser.CheckValueString(valueStrings[0], new Regex[] {
                ValueParser.VerifyIntKHValueRegex
            });
            bool check2 = ValueParser.CheckValueString(valueStrings[2], new Regex[] {
                ValueParser.VerifyWordRegex3
            });
            bool check3 = ValueParser.CheckValueString(valueStrings[4], new Regex[] {
                ValueParser.VerifyWordRegex3, ValueParser.VerifyIntKHValueRegex
            });

            if (check1 && check2 && check3)
            {
                COMPort    = ValueParser.ParseWordValue(valueStrings[0], contextDevice);
                BaseValue  = ValueParser.ParseWordValue(valueStrings[2], contextDevice);
                CountValue = ValueParser.ParseWordValue(valueStrings[4], contextDevice);
                InstructionCommentManager.ModifyValue(this, oldvaluestring1, COMPort.ValueString);
                InstructionCommentManager.ModifyValue(this, oldvaluestring2, BaseValue.ValueString);
                InstructionCommentManager.ModifyValue(this, oldvaluestring3, CountValue.ValueString);
                ValueCommentManager.UpdateComment(COMPort, valueStrings[1]);
                ValueCommentManager.UpdateComment(BaseValue, valueStrings[3]);
                ValueCommentManager.UpdateComment(CountValue, valueStrings[5]);
            }
            else if (!check1)
            {
                throw new ValueParseException("COM格式错误!");
            }
            else if (!check2)
            {
                throw new ValueParseException("ADDR格式错误!");
            }
            else if (!check3)
            {
                throw new ValueParseException("LEN格式错误!");
            }
        }
コード例 #26
0
ファイル: FMOVDViewModel.cs プロジェクト: hyzhappy/samsoarii
        /*
         * public override IPropertyDialog PreparePropertyDialog()
         * {
         *  var dialog = new ElementPropertyDialog(3);
         *  dialog.Title = InstructionName;
         *  dialog.ShowLine2("SV:", SourceValue);
         *  dialog.ShowLine4("TV:", DestinationValue);
         *  dialog.ShowLine6("CT:", CountValue);
         *  return dialog;
         * }
         */
        public override void AcceptNewValues(IList <string> valueStrings, Device contextDevice)
        {
            var  oldvaluestring1 = SourceValue.ValueString;
            var  oldvaluestring2 = DestinationValue.ValueString;
            var  oldvaluestring3 = CountValue.ValueString;
            bool check1          = ValueParser.CheckValueString(valueStrings[0], new Regex[] {
                ValueParser.VerifyDoubleWordRegex1, ValueParser.VerifyIntKHValueRegex
            });
            bool check2 = ValueParser.CheckValueString(valueStrings[2], new Regex[] {
                ValueParser.VerifyDoubleWordRegex1
            });
            bool check3 = ValueParser.CheckValueString(valueStrings[4], new Regex[] {
                ValueParser.VerifyWordRegex3, ValueParser.VerifyIntKHValueRegex
            });

            if (check1 && check2 && check3)
            {
                SourceValue      = ValueParser.ParseDoubleWordValue(valueStrings[0], contextDevice);
                DestinationValue = ValueParser.ParseDoubleWordValue(valueStrings[2], contextDevice);
                CountValue       = ValueParser.ParseWordValue(valueStrings[4], contextDevice);
                InstructionCommentManager.ModifyValue(this, oldvaluestring1, SourceValue.ValueString);
                InstructionCommentManager.ModifyValue(this, oldvaluestring2, DestinationValue.ValueString);
                InstructionCommentManager.ModifyValue(this, oldvaluestring3, CountValue.ValueString);
                ValueCommentManager.UpdateComment(SourceValue, valueStrings[1]);
                ValueCommentManager.UpdateComment(DestinationValue, valueStrings[3]);
                ValueCommentManager.UpdateComment(CountValue, valueStrings[5]);
            }
            else if (!check1)
            {
                throw new ValueParseException("SV格式错误!");
            }
            else if (!check2)
            {
                throw new ValueParseException("TV格式错误!");
            }
            else if (!check3)
            {
                throw new ValueParseException("CT格式错误!");
            }
        }
コード例 #27
0
        /*
         * public override IPropertyDialog PreparePropertyDialog()
         * {
         *  var dialog = new ElementPropertyDialog(3);
         *  dialog.Title = InstructionName;
         *  dialog.ShowLine2("S",SourceValue);
         *  dialog.ShowLine4("D",DestinationValue);
         *  dialog.ShowLine6("N",Count);
         *  return dialog;
         * }
         */
        public override void AcceptNewValues(IList <string> valueStrings, Device contextDevice)
        {
            var oldvaluestring1 = SourceValue.ValueString;
            var oldvaluestring2 = DestinationValue.ValueString;
            var oldvaluestring3 = Count.ValueString;

            if (ValueParser.CheckValueString(valueStrings[0], new Regex[] { ValueParser.VerifyWordRegex1 }) && ValueParser.CheckValueString(valueStrings[2], new Regex[] { ValueParser.VerifyWordRegex2 }) && ValueParser.CheckValueString(valueStrings[4], new Regex[] { ValueParser.VerifyWordRegex3, ValueParser.VerifyIntKHValueRegex }))
            {
                SourceValue      = ValueParser.ParseWordValue(valueStrings[0], contextDevice);
                DestinationValue = ValueParser.ParseWordValue(valueStrings[2], contextDevice);
                Count            = ValueParser.ParseWordValue(valueStrings[4], contextDevice);
                InstructionCommentManager.ModifyValue(this, oldvaluestring1, SourceValue.ValueString);
                InstructionCommentManager.ModifyValue(this, oldvaluestring2, DestinationValue.ValueString);
                InstructionCommentManager.ModifyValue(this, oldvaluestring3, Count.ValueString);
                ValueCommentManager.UpdateComment(SourceValue, valueStrings[1]);
                ValueCommentManager.UpdateComment(DestinationValue, valueStrings[3]);
                ValueCommentManager.UpdateComment(Count, valueStrings[5]);
            }
            else
            {
                throw new ValueParseException("Unexpected input");
            }
        }
コード例 #28
0
        /*
         * public override IPropertyDialog PreparePropertyDialog()
         * {
         *  var dialog = new ElementPropertyDialog(2);
         *  dialog.Title = InstructionName;
         *  dialog.ShowLine3("CT:", CountValue);
         *  dialog.ShowLine5("SV:", StartValue);
         *  return dialog;
         * }
         */
        public override void AcceptNewValues(IList <string> valueStrings, Device contextDevice)
        {
            var  oldvaluestring1 = CountValue.ValueString;
            var  oldvaluestring2 = StartValue.ValueString;
            bool check1          = ValueParser.CheckValueString(valueStrings[0], new Regex[] {
                ValueParser.VerifyDoubleWordRegex3
            });
            bool check2 = ValueParser.CheckValueString(valueStrings[2], new Regex[] {
                ValueParser.VerifyWordRegex1, ValueParser.VerifyIntKHValueRegex
            });

            if (check1 && check2)
            {
                try
                {
                    CountValue = ValueParser.ParseWordValue(valueStrings[0], contextDevice);
                    StartValue = ValueParser.ParseWordValue(valueStrings[2], contextDevice);
                }
                catch (ValueParseException)
                {
                    CountValue = ValueParser.ParseDoubleWordValue(valueStrings[0], contextDevice);
                    StartValue = ValueParser.ParseDoubleWordValue(valueStrings[2], contextDevice);
                }
                InstructionCommentManager.ModifyValue(this, oldvaluestring1, CountValue.ValueString);
                InstructionCommentManager.ModifyValue(this, oldvaluestring2, StartValue.ValueString);
                ValueCommentManager.UpdateComment(CountValue, valueStrings[1]);
                ValueCommentManager.UpdateComment(StartValue, valueStrings[3]);
            }
            else if (!check1)
            {
                throw new ValueParseException("计数器输入错误!");
            }
            else if (!check2)
            {
                throw new ValueParseException("最大值输入错误!");
            }
        }
コード例 #29
0
        /*
         * public override IPropertyDialog PreparePropertyDialog()
         * {
         *  var dialog = new ElementPropertyDialog(5);
         *  dialog.Title = InstructionName;
         *  dialog.ShowLine1("SV:", SourceValue);
         *  dialog.ShowLine2("SS:", SourceStart);
         *  dialog.ShowLine4("SC:", SourceCount);
         *  dialog.ShowLine6("DV:", DestinationValue);
         *  dialog.ShowLine7("DS:", DestinationStart);
         *  return dialog;
         * }
         */
        public override void AcceptNewValues(IList <string> valueStrings, Device contextDevice)
        {
            var  oldvaluestring1 = SourceValue.ValueString;
            var  oldvaluestring2 = SourceStart.ValueString;
            var  oldvaluestring3 = SourceCount.ValueString;
            var  oldvaluestring4 = DestinationValue.ValueString;
            var  oldvaluestring5 = DestinationStart.ValueString;
            bool check1          = ValueParser.CheckValueString(valueStrings[0], new Regex[] {
                ValueParser.VerifyWordRegex1
            });
            bool check2 = ValueParser.CheckValueString(valueStrings[2], new Regex[] {
                ValueParser.VerifyIntKHValueRegex
            });
            bool check3 = ValueParser.CheckValueString(valueStrings[4], new Regex[] {
                ValueParser.VerifyIntKHValueRegex
            });
            bool check4 = ValueParser.CheckValueString(valueStrings[6], new Regex[] {
                ValueParser.VerifyWordRegex1
            });
            bool check5 = ValueParser.CheckValueString(valueStrings[8], new Regex[] {
                ValueParser.VerifyIntKHValueRegex
            });

            if (check1 && check2 && check3 && check4 && check5)
            {
                SourceValue      = ValueParser.ParseWordValue(valueStrings[0], contextDevice);
                SourceStart      = ValueParser.ParseWordValue(valueStrings[2], contextDevice);
                SourceCount      = ValueParser.ParseWordValue(valueStrings[4], contextDevice);
                DestinationValue = ValueParser.ParseWordValue(valueStrings[6], contextDevice);
                DestinationStart = ValueParser.ParseWordValue(valueStrings[8], contextDevice);
                InstructionCommentManager.ModifyValue(this, oldvaluestring1, SourceValue.ValueString);
                InstructionCommentManager.ModifyValue(this, oldvaluestring2, SourceStart.ValueString);
                InstructionCommentManager.ModifyValue(this, oldvaluestring3, SourceCount.ValueString);
                InstructionCommentManager.ModifyValue(this, oldvaluestring4, DestinationValue.ValueString);
                InstructionCommentManager.ModifyValue(this, oldvaluestring5, DestinationStart.ValueString);
                ValueCommentManager.UpdateComment(SourceValue, valueStrings[1]);
                ValueCommentManager.UpdateComment(SourceStart, valueStrings[3]);
                ValueCommentManager.UpdateComment(SourceCount, valueStrings[5]);
                ValueCommentManager.UpdateComment(DestinationValue, valueStrings[7]);
                ValueCommentManager.UpdateComment(DestinationStart, valueStrings[9]);
            }
            else if (!check1)
            {
                throw new ValueParseException("SV格式错误!");
            }
            else if (!check2)
            {
                throw new ValueParseException("SS格式错误!");
            }
            else if (!check3)
            {
                throw new ValueParseException("SC格式错误!");
            }
            else if (!check4)
            {
                throw new ValueParseException("DV格式错误!");
            }
            else if (!check5)
            {
                throw new ValueParseException("DS格式错误!");
            }
        }