Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions UnlockECU/VisualUnlockECU/Definition.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UnlockECU
{
public class Definition
{
public string EcuName { get; set; }
public List<string> Aliases { get; set; }
public int AccessLevel { get; set; }
public int SeedLength { get; set; }
public int KeyLength { get; set; }
public string Provider { get; set; }
public string Origin { get; set; }
public List<Parameter> Parameters { get; set; }
public string InputType { get; set; } = "HEX"; // default

[System.Text.Json.Serialization.JsonIgnore]
public string ParamParent;

public override string ToString()
{
StringBuilder sb = new StringBuilder($"Name: {EcuName} ({Origin}), Level: {AccessLevel}, Seed Length: {SeedLength}, Key Length: {KeyLength}, Provider: {Provider}");
return sb.ToString();
/*
// uncomment and remove the return above to print verbose parameter data
foreach (Parameter row in Parameters)
{
sb.AppendLine();
sb.Append($"Parameter[{row.Key}] ({row.DataType}) : {row.Value}");
}
return sb.ToString();
*/
}
public static Definition FindDefinition(List<Definition> definitions, string ecuName, int accessLevel)

Check warning on line 38 in UnlockECU/VisualUnlockECU/Definition.cs

View workflow job for this annotation

GitHub Actions / build (Release)

The type 'Definition' in 'D:\a\UnlockECU\UnlockECU\UnlockECU\VisualUnlockECU\Definition.cs' conflicts with the imported type 'Definition' in 'UnlockECU, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'D:\a\UnlockECU\UnlockECU\UnlockECU\VisualUnlockECU\Definition.cs'.

Check warning on line 38 in UnlockECU/VisualUnlockECU/Definition.cs

View workflow job for this annotation

GitHub Actions / build (Release)

The type 'Definition' in 'D:\a\UnlockECU\UnlockECU\UnlockECU\VisualUnlockECU\Definition.cs' conflicts with the imported type 'Definition' in 'UnlockECU, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'D:\a\UnlockECU\UnlockECU\UnlockECU\VisualUnlockECU\Definition.cs'.
{
foreach (Definition d in definitions)

Check warning on line 40 in UnlockECU/VisualUnlockECU/Definition.cs

View workflow job for this annotation

GitHub Actions / build (Release)

The type 'Definition' in 'D:\a\UnlockECU\UnlockECU\UnlockECU\VisualUnlockECU\Definition.cs' conflicts with the imported type 'Definition' in 'UnlockECU, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'D:\a\UnlockECU\UnlockECU\UnlockECU\VisualUnlockECU\Definition.cs'.
{
if (accessLevel != d.AccessLevel)
{
continue;
}
if (ecuName != d.EcuName.ToUpper())
{
if (!d.Aliases.Contains(ecuName))
{
continue;
}
}
return d;
}
return null;
}
}
}
Loading
Loading