Skip to content

Commit

Permalink
Merge pull request #64 from Whitehouse112/obsolete_stuff
Browse files Browse the repository at this point in the history
Removed obsolete property CycleTime
  • Loading branch information
Adhara3 authored Apr 15, 2024
2 parents 2bbfd45 + eeab1a8 commit f8debe9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
1 change: 0 additions & 1 deletion DbcParserLib.Tests/PropertiesLineParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ public void MsgCycleTimePropertyIsParsedTest()

var dbc = builder.Build();
Assert.AreEqual(true, dbc.Messages.First().CycleTime(out var cycleTime));
Assert.AreEqual(100, dbc.Messages.First().CycleTime);
Assert.AreEqual(100, cycleTime);
}

Expand Down
16 changes: 5 additions & 11 deletions DbcParserLib/Model/Message.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@ internal class ImmutableMessage

internal ImmutableMessage(Message message, IReadOnlyList<ImmutableSignal> signals)
{
message.CycleTime(out var cycleTime);

ID = message.ID;
IsExtID = message.IsExtID;
Name = message.Name;
DLC = message.DLC;
Transmitter = message.Transmitter;
Comment = message.Comment;
CycleTime= message.CycleTime;
CycleTime = cycleTime;
Signals = signals;

//TODO: remove explicit cast (CustomProperty in Message class should be Dictionary instead IDictionary)
CustomProperties = (IReadOnlyDictionary<string, CustomProperty>)message.CustomProperties;
}
Expand All @@ -38,16 +41,7 @@ public class Message
public ushort DLC;
public string Transmitter;
public string Comment;
[Obsolete("Please use CycleTime(out int cycleTime) instead. CycleTime property will be removed and will be accessible only through extension method")]
public int CycleTime
{
get
{
this.CycleTime(out var cycleTime);
return cycleTime;
}
}


public List<Signal> Signals = new List<Signal>();
public IDictionary<string, CustomProperty> CustomProperties = new Dictionary<string, CustomProperty>();

Expand Down
3 changes: 2 additions & 1 deletion Demo/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ public void PopulateView(Dbc dbc)
dtMessages.Columns.Add("CycleTime");
foreach (var msg in dbc.Messages)
{
dtMessages.Rows.Add("0x" + msg.ID.ToString("X"), msg.Name, msg.DLC, msg.Transmitter, msg.CycleTime);
msg.CycleTime(out var cycleTime);
dtMessages.Rows.Add("0x" + msg.ID.ToString("X"), msg.Name, msg.DLC, msg.Transmitter, cycleTime);
}

// Signals
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ Below you can find a list of obsolete stuff that are going to be removed in the
| Signal | IsSigned | v1.3.0 | **v1.5.0** | `ValueType` | Byte property replaced by `DbcValueType` property which provides <br> more informations about signal type |
| Signal | ValueTable | v1.3.0 | **v1.5.0** | `ValueTableMap` | String property replaced by a `IDictionary<int,string>` property |
| Signal | ToPairs() | v1.3.0 | **v1.4.2** | - | Extension method used to convert ValueTable into ValueTableMap |
| Message | CycleTime | v1.4.2 | planned in **1.6.0** | `bool CycleTime(out int cycleTime)` | CycleTime is no more a message property (replaced by an extension method) |
| Message | CycleTime | v1.4.2 | **1.6.0** | `bool CycleTime(out int cycleTime)` | CycleTime is no more a message property (replaced by an extension method) |

<br>

Expand Down

0 comments on commit f8debe9

Please sign in to comment.