コード例 #1
0
ファイル: ElfVariable.cs プロジェクト: DIVON/MCUHelper
        public static ElfUnsignedShort CreateUnsignedShort(String Name, String address)
        {
            ElfUnsignedShort variable = new ElfUnsignedShort();

            variable.Name    = Name;
            variable.Address = address;
            return(variable);
        }
コード例 #2
0
ファイル: SerialPortUpdater.cs プロジェクト: DIVON/MCUHelper
        void IValuesUpdater.AddWriteCommand(ElfVariable var, String newValue)
        {
            int value = 0;

            int.TryParse(newValue, out value);

            if (var is ElfEnum)
            {
                ElfEnum elfEnum = (ElfEnum)var;
                value = elfEnum.GetIntValue(newValue);
            }
            else if (var is ElfFloat)
            {
                ElfFloat elfVar = (ElfFloat)var;
                value = elfVar.GetBytes(newValue);
            }
            else if (var is ElfChar)
            {
                ElfChar elfVar = (ElfChar)var;
                value = elfVar.GetBytes(newValue);
            }
            else if (var is ElfUnsignedChar)
            {
                ElfUnsignedChar elfVar = (ElfUnsignedChar)var;
                value = elfVar.GetBytes(newValue);
            }
            else if (var is ElfShort)
            {
                ElfShort elfVar = (ElfShort)var;
                value = elfVar.GetBytes(newValue);
            }
            else if (var is ElfUnsignedShort)
            {
                ElfUnsignedShort elfVar = (ElfUnsignedShort)var;
                value = elfVar.GetBytes(newValue);
            }
            else if (var is ElfInt)
            {
                ElfInt elfVar = (ElfInt)var;
                value = elfVar.GetBytes(newValue);
            }
            else if (var is ElfUnsignedInt)
            {
                ElfUnsignedInt elfVar = (ElfUnsignedInt)var;
                value = elfVar.GetBytes(newValue);
            }
            else if (var is ElfLong)
            {
                ElfLong elfVar = (ElfLong)var;
                value = elfVar.GetBytes(newValue);
            }
            else if (var is ElfUnsignedLong)
            {
                ElfUnsignedLong elfVar = (ElfUnsignedLong)var;
                value = elfVar.GetBytes(newValue);
            }

            WriteCommand command = new WriteCommand(var, value);

            writeCommands.Enqueue(command);
        }