Skip to content

Commit

Permalink
Fixed: Negative enumeration values not working
Browse files Browse the repository at this point in the history
  • Loading branch information
hfedcba committed May 26, 2016
1 parent d115f4f commit ae876c7
Show file tree
Hide file tree
Showing 4 changed files with 1,547 additions and 1,532 deletions.
6 changes: 3 additions & 3 deletions HomegearLib.NET/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HomegearLib.NET")]
[assembly: AssemblyCopyright("Copyright © Lopeware 2015")]
[assembly: AssemblyCopyright("Copyright © Lopeware 2015-2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.4.5")]
[assembly: AssemblyFileVersion("0.1.4.5")]
[assembly: AssemblyVersion("0.1.5.0")]
[assembly: AssemblyFileVersion("0.1.5.0")]
14 changes: 8 additions & 6 deletions HomegearLib.NET/Variable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ public virtual String StringValue
}
}

protected String[] _valueList = new String[0];
public String[] ValueList { get { return _valueList; } internal set {_valueList = value; } }
protected Dictionary<int, string> _valueList = new Dictionary<int, string>();
public Dictionary<int, string> ValueList { get { return _valueList; } internal set { _valueList = value; } }

public Variable(Int32 peerID, Int32 channel, String name) : this(null, peerID, channel, name)
{
Expand Down Expand Up @@ -312,11 +312,13 @@ internal void SetValue(Variable variable)
internal void SetValueList(RPCVariable valueList)
{
if (_type == VariableType.tInteger) _type = VariableType.tEnum;
_valueList = new String[valueList.ArrayValue.Count];
for(int i = 0; i < valueList.ArrayValue.Count; i++)
_valueList = new Dictionary<int, string>();
int offset = (int)((_minInteger < 0) ? _minInteger : 0);
int x = 0;
for (int i = (int)_minInteger; i < valueList.ArrayValue.Count + offset; i++, x++)
{
if (valueList.ArrayValue[i].Type != RPCVariableType.rpcString) continue;
_valueList[i] = valueList.ArrayValue[i].StringValue;
if (valueList.ArrayValue[x].Type != RPCVariableType.rpcString) continue;
_valueList[i] = valueList.ArrayValue[x].StringValue;
}
}

Expand Down
Loading

0 comments on commit ae876c7

Please sign in to comment.