aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Utilities
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2021-04-08 14:24:39 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2021-04-08 14:24:39 +0300
commit0ede3b81fce26ca31ad71bd1a377e5893a2d6e9a (patch)
tree5d0f68640bc88ad76289a8cf2d2bb28bf250cd83 /Software/Visual_Studio/Utilities
parent4e8717ad956839c7f42c88985011e96c735c3a6a (diff)
downloadTango-0ede3b81fce26ca31ad71bd1a377e5893a2d6e9a.tar.gz
Tango-0ede3b81fce26ca31ad71bd1a377e5893a2d6e9a.zip
Updated BIT BL,PMR,DB.
Diffstat (limited to 'Software/Visual_Studio/Utilities')
-rw-r--r--Software/Visual_Studio/Utilities/Tango.BitTypesGenerator.CLI/Program.cs75
-rw-r--r--Software/Visual_Studio/Utilities/Tango.BitTypesGenerator.CLI/Tango.BitTypesGenerator.CLI.csproj4
2 files changed, 46 insertions, 33 deletions
diff --git a/Software/Visual_Studio/Utilities/Tango.BitTypesGenerator.CLI/Program.cs b/Software/Visual_Studio/Utilities/Tango.BitTypesGenerator.CLI/Program.cs
index e241c56f1..1d4a4f7fc 100644
--- a/Software/Visual_Studio/Utilities/Tango.BitTypesGenerator.CLI/Program.cs
+++ b/Software/Visual_Studio/Utilities/Tango.BitTypesGenerator.CLI/Program.cs
@@ -13,7 +13,7 @@ namespace Tango.BitTypesGenerator.CLI
{
class Program
{
- private static string BITS_FILE = "Built InTest List Rev1.0.xlsx";
+ private static string BITS_FILE = "Built InTest List Rev3.0.xlsx";
private class ExcelBitType
{
@@ -31,52 +31,61 @@ namespace Tango.BitTypesGenerator.CLI
static void Main(string[] args)
{
- Console.WriteLine("Generating BIT types...");
+ try
+ {
+ Console.WriteLine("Generating BIT types...");
- ExcelReader reader = new ExcelReader(PathHelper.GetStartupPath() + "\\" + BITS_FILE);
- var results = reader.GetDataByIndex<ExcelBitType>("Sheet1", 2);
+ ExcelReader reader = new ExcelReader(PathHelper.GetStartupPath() + "\\" + BITS_FILE);
+ var results = reader.GetDataByIndex<ExcelBitType>("Sheet1", 2);
- using (ObservablesContext db = ObservablesContext.CreateDefault())
- {
- foreach (var excelBit in results)
+ using (ObservablesContext db = ObservablesContext.CreateDefault())
{
- bool isNewBit = false;
+ foreach (var excelBit in results)
+ {
+ bool isNewBit = false;
- int code = int.Parse(excelBit.Code);
+ int code = int.Parse(excelBit.Code);
- BitType bitType = db.BitTypes.SingleOrDefault(x => x.Code == code);
+ BitType bitType = db.BitTypes.SingleOrDefault(x => x.Code == code);
- if (bitType == null)
- {
- Console.WriteLine("Inserting " + excelBit.ToString());
- bitType = new BitType();
- MapExcelBitToBitType(excelBit, bitType);
- isNewBit = true;
- }
- else
- {
- if (BitRequiresUpdate(excelBit, bitType))
+ if (bitType == null)
{
- BitType te = new BitType();
- MapExcelBitToBitType(excelBit, te);
- Console.WriteLine($"Updating {bitType.Name}\nSource:\n{te.ToJsonString()}\nTarget:\n{bitType.ToJsonString()}");
+ Console.WriteLine("Inserting " + excelBit.ToString());
+ bitType = new BitType();
MapExcelBitToBitType(excelBit, bitType);
+ isNewBit = true;
+ }
+ else
+ {
+ if (BitRequiresUpdate(excelBit, bitType))
+ {
+ BitType te = new BitType();
+ MapExcelBitToBitType(excelBit, te);
+ Console.WriteLine($"Updating {bitType.Name}\nSource:\n{te.ToJsonString()}\nTarget:\n{bitType.ToJsonString()}");
+ MapExcelBitToBitType(excelBit, bitType);
+ }
}
- }
- if (isNewBit)
- {
- db.BitTypes.Add(bitType);
+ if (isNewBit)
+ {
+ db.BitTypes.Add(bitType);
+ }
}
- }
- Console.WriteLine("Saving changes...");
- db.SaveChanges();
- }
+ Console.WriteLine("Saving changes...");
+ db.SaveChanges();
+ }
- Console.WriteLine("Done!");
- Console.ReadLine();
+ Console.ForegroundColor = ConsoleColor.Green;
+ Console.WriteLine("Done!");
+ Console.ReadLine();
+ }
+ catch (Exception ex)
+ {
+ Console.ForegroundColor = ConsoleColor.Red;
+ Console.WriteLine(ex);
+ }
}
private static void MapExcelBitToBitType(ExcelBitType evx, BitType bit)
diff --git a/Software/Visual_Studio/Utilities/Tango.BitTypesGenerator.CLI/Tango.BitTypesGenerator.CLI.csproj b/Software/Visual_Studio/Utilities/Tango.BitTypesGenerator.CLI/Tango.BitTypesGenerator.CLI.csproj
index e287bcfda..dfd5920ff 100644
--- a/Software/Visual_Studio/Utilities/Tango.BitTypesGenerator.CLI/Tango.BitTypesGenerator.CLI.csproj
+++ b/Software/Visual_Studio/Utilities/Tango.BitTypesGenerator.CLI/Tango.BitTypesGenerator.CLI.csproj
@@ -58,6 +58,10 @@
<Link>Built InTest List Rev1.0.xlsx</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
+ <None Include="..\..\Resources\BIT\Built InTest List Rev3.0.xlsx">
+ <Link>Built InTest List Rev3.0.xlsx</Link>
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
<None Include="..\..\Resources\BIT\BuiltInTest.xlsx">
<Link>BuiltInTest.xlsx</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>