Skip to content

Commit 0364d00

Browse files
committed
2 parents cb93ea9 + 6621132 commit 0364d00

File tree

12 files changed

+357
-142
lines changed

12 files changed

+357
-142
lines changed

CSAUSBTool.CrossPlatform/Models/ControlSystemSoftware.cs

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33
using System.Diagnostics;
44
using System.IO;
55
using System.Linq;
6-
using System.Linq.Expressions;
7-
using System.Net.Http;
8-
using System.Net.Http.Json;
96
using System.Security.Cryptography;
10-
using System.Text;
117
using System.Threading;
128
using System.Threading.Tasks;
139
using CSAUSBTool.CrossPlatform.Core;
@@ -24,7 +20,13 @@ public class ControlSystemSoftware : ReactiveObject
2420
public string Uri { get; set; }
2521
public string? Hash { get; set; }
2622
public string Platform { get; set; }
27-
public double DownloadProgress { get; set; }
23+
24+
private double _DownloadProgress;
25+
public double DownloadProgress
26+
{
27+
get => _DownloadProgress;
28+
set => this.RaiseAndSetIfChanged(ref _DownloadProgress, value);
29+
}
2830

2931
public ControlSystemSoftware()
3032
{
@@ -50,6 +52,7 @@ public async Task Download(string outputPath, CancellationToken token)
5052
var currentHash = CalculateMD5(existingFile);
5153
if (currentHash == Hash)
5254
{
55+
DownloadProgress = 100;
5356
return;
5457
}
5558

@@ -82,4 +85,14 @@ private string CalculateMD5(FileStream stream)
8285
return BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant();
8386
}
8487
}
88+
89+
public class DesignControlSystemSoftware : ControlSystemSoftware
90+
{
91+
public DesignControlSystemSoftware()
92+
{
93+
Name = "FRC Driver Station";
94+
Tags = ["Driver Station", "FRC"];
95+
Description = "The FRC Driver Station is the software used to control your robot during a match.";
96+
}
97+
}
8598
}

CSAUSBTool.CrossPlatform/Models/ControlSystemSoftwareGroup.cs

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
using System.Collections.Generic;
2-
using System.Threading;
3-
using CSAUSBTool.CrossPlatform.Core;
42
using ReactiveUI;
53

64
namespace CSAUSBTool.CrossPlatform.Models;
@@ -16,4 +14,36 @@ public class ControlSystemSoftwareGroup : ReactiveObject
1614
public ControlSystemSoftwareGroup()
1715
{
1816
}
19-
}
17+
}
18+
public class DesignControlSystemSoftwareGroup : ControlSystemSoftwareGroup
19+
{
20+
public DesignControlSystemSoftwareGroup()
21+
{
22+
Tag = "DesignTag";
23+
DisplayName = "Design Display Name";
24+
Software =
25+
[
26+
new ControlSystemSoftware
27+
{
28+
Name = "FRC Driver Station",
29+
FileName = "File1.exe",
30+
Description = "The FRC Driver Station is the software used to control your robot during a match.",
31+
Tags = ["Driver Station", "FRC"],
32+
Uri = "http://example.com/file1",
33+
Hash = null,
34+
Platform = "Platform1"
35+
},
36+
new ControlSystemSoftware
37+
{
38+
Name = "Software2",
39+
FileName = "File2.exe",
40+
Description = "Description2",
41+
Tags = ["DesignTag", "Tag4"],
42+
Uri = "http://example.com/file2",
43+
Hash = null,
44+
Platform = "Platform2"
45+
}
46+
];
47+
SelectedSoftware = [];
48+
}
49+
}

CSAUSBTool.CrossPlatform/Views/ControlSystemSoftwareGroupView.axaml

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,35 +13,39 @@
1313
<Design.DataContext>
1414
<!-- This only sets the DataContext for the previewer in an IDE,
1515
to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
16-
<models:ControlSystemSoftwareGroup />
16+
<models:DesignControlSystemSoftwareGroup />
1717
</Design.DataContext>
1818

19-
<Grid ColumnDefinitions="*" RowDefinitions="*,*">
20-
<SplitView IsPaneOpen="True" DisplayMode="Inline" OpenPaneLength="400" Grid.Column="0" Grid.Row="0">
21-
<SplitView.Pane>
22-
<ListBox Grid.Column="0" Grid.Row="0" x:Name="SoftwareSelectionList"
23-
DockPanel.Dock="Left"
24-
ItemsSource="{Binding Software}"
25-
SelectionMode="Multiple,Toggle"
26-
SelectedItems="{Binding SelectedSoftware}"
19+
<Grid ColumnDefinitions="*">
20+
<Grid.RowDefinitions>
21+
<RowDefinition Height="*" />
22+
<RowDefinition Height="50" />
23+
</Grid.RowDefinitions>
24+
<ScrollViewer Grid.Column="0" Grid.Row="0">
25+
<SplitView IsPaneOpen="True" DisplayMode="Inline" OpenPaneLength="400">
26+
<SplitView.Pane>
27+
<ListBox x:Name="SoftwareSelectionList"
28+
DockPanel.Dock="Left"
29+
ItemsSource="{Binding Software}"
30+
SelectionMode="Multiple,Toggle"
31+
SelectedItems="{Binding SelectedSoftware}"
2732
>
33+
<ListBox.ItemTemplate>
34+
<DataTemplate DataType="models:ControlSystemSoftware">
35+
<views:ControlSystemSoftwareView
36+
DataContext="{Binding}" />
37+
</DataTemplate>
38+
</ListBox.ItemTemplate>
39+
</ListBox>
40+
</SplitView.Pane>
2841

29-
<ListBox.ItemTemplate>
30-
<DataTemplate DataType="models:ControlSystemSoftware">
31-
<views:ControlSystemSoftwareView
32-
DataContext="{Binding}" />
33-
</DataTemplate>
34-
</ListBox.ItemTemplate>
35-
</ListBox>
36-
37-
</SplitView.Pane>
38-
39-
<Grid Name="BaseGrid" ColumnDefinitions="*,*" RowDefinitions="*">
40-
<!--TODO: Create some sort of view that indexes each item and its download status-->
41-
<TextBlock Name="TestText"></TextBlock>
42-
</Grid>
43-
</SplitView>
42+
<!--TODO: Create some sort of view that indexes each item and its download status-->
43+
<StackPanel Orientation="Vertical">
44+
<TextBlock x:Name="DownloadListTitle">Items to download</TextBlock>
45+
<TextBlock Name="TestText"></TextBlock>
46+
</StackPanel>
47+
</SplitView>
48+
</ScrollViewer>
4449
<Button Name="Download" Grid.Column="0" Grid.Row="1" Click="Download_OnClick">Download</Button>
4550
</Grid>
46-
47-
</UserControl>
51+
</UserControl>

CSAUSBTool.CrossPlatform/Views/ControlSystemSoftwareGroupView.axaml.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public ControlSystemSoftwareGroupView()
1919
{
2020
InitializeComponent();
2121
SoftwareSelectionList.SelectionChanged += ListSelectionChanged;
22+
SetFontSizePercentage(DownloadListTitle, 150);
2223
}
2324

2425
public void ListSelectionChanged(object? sender, SelectionChangedEventArgs e)
@@ -45,15 +46,24 @@ private async void Download_OnClick(object? sender, RoutedEventArgs e)
4546
AllowMultiple = false
4647
});
4748

49+
if (folder == null || folder.Count < 1) return;
50+
var downloadPath = folder[0].Path.ToString();
51+
4852
if (SoftwareSelectionList.SelectedItems == null) return;
4953
foreach (var selectedItem in SoftwareSelectionList.SelectedItems)
5054
{
5155
if (selectedItem as ControlSystemSoftware is { } s)
5256
{
53-
s.Download(folder[0].Path.ToString(),
57+
s.Download(downloadPath,
5458
new CancellationToken());
5559
}
5660
}
5761
}
62+
63+
private static void SetFontSizePercentage(TextBlock textBlock, double percentage)
64+
{
65+
double defaultFontSize = textBlock.FontSize;
66+
textBlock.FontSize = defaultFontSize * (percentage / 100.0);
67+
}
5868
}
5969
}

CSAUSBTool.CrossPlatform/Views/ControlSystemSoftwareView.axaml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,18 @@
55
xmlns:viewModels="clr-namespace:CSAUSBTool.CrossPlatform.ViewModels"
66
xmlns:vm="using:CSAUSBTool.CrossPlatform.ViewModels"
77
xmlns:models="clr-namespace:CSAUSBTool.CrossPlatform.Models"
8-
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
8+
mc:Ignorable="d" d:DesignWidth="600" d:DesignHeight="450"
99
x:Class="CSAUSBTool.CrossPlatform.Views.ControlSystemSoftwareView"
1010
x:DataType="models:ControlSystemSoftware">
1111

1212
<Design.DataContext>
1313
<!-- This only sets the DataContext for the previewer in an IDE,
1414
to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
15-
<models:ControlSystemSoftware />
15+
<models:DesignControlSystemSoftware />
1616
</Design.DataContext>
17-
<Grid ColumnDefinitions="*" RowDefinitions="*,*,*">
18-
<TextBlock Grid.Row="0" Text="{Binding Name}" />
19-
<!-- <TextBlock Grid.Row="1" Text="{Binding Description}" /> -->
20-
<ProgressBar Grid.Row="2"
17+
<Grid ColumnDefinitions="*" RowDefinitions="*,*">
18+
<TextBlock Grid.Row="0" Text="{Binding Name}" ToolTip.Tip="{Binding Description}" />
19+
<ProgressBar Grid.Row="1"
2120
Name="DownloadProgress"
2221
Minimum="0"
2322
Maximum="100"

CSAUSBTool.CrossPlatform/Views/MainWindow.axaml

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,8 @@
99
Icon="/Assets/reuven.ico"
1010
Title="CSAUSBTool v2"
1111
x:DataType="vm:MainWindowViewModel"
12-
SizeToContent="WidthAndHeight">
13-
<StackPanel>
14-
<DockPanel>
15-
<!-- <Menu> -->
16-
<!-- <MenuItem Header="_File"></MenuItem> -->
17-
<!-- <MenuItem Header="_Edit"></MenuItem> -->
18-
<!-- <MenuItem Header="_Programs" ItemsSource="{Binding Programs}"> -->
19-
<!-- <MenuItem.ItemTemplate> -->
20-
<!-- <DataTemplate> -->
21-
<!-- <MenuItem -->
22-
<!-- Header="{Binding Header}" -->
23-
<!-- IsEnabled="True" -->
24-
<!-- Focusable="True" -->
25-
<!-- ItemsSource="{Binding MenuItems}"/> -->
26-
<!-- </DataTemplate> -->
27-
<!-- </MenuItem.ItemTemplate> -->
28-
<!-- <MenuItem.Styles> -->
29-
<!-- <Style Selector="MenuItem.SubItems MenuItem" x:DataType="vm:MenuItemViewModel"> -->
30-
<!-- <Setter Property="Header" Value="{Binding Header}" /> -->
31-
<!-- <Setter Property="ItemsSource" Value="{Binding MenuItems}" /> -->
32-
<!-- <Setter Property="Command" Value="{Binding Command}" /> -->
33-
<!-- <Setter Property="IsEnabled" Value="True"></Setter> -->
34-
<!-- </Style> -->
35-
<!-- </MenuItem.Styles> -->
36-
<!-- </MenuItem> -->
37-
<!-- </Menu> -->
38-
</DockPanel>
39-
<views:ProgramYearView />
40-
</StackPanel>
12+
SizeToContent="Manual">
13+
<Grid>
14+
<views:ProgramYearView />
15+
</Grid>
4116
</Window>

CSAUSBTool.CrossPlatform/Views/ProgramYearView.axaml

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,19 @@
88
mc:Ignorable="d" d:DesignWidth="1280" d:DesignHeight="720"
99
x:Class="CSAUSBTool.CrossPlatform.Views.ProgramYearView"
1010
x:DataType="vm:ProgramYearViewModel">
11-
<Grid Name="BaseGrid" ColumnDefinitions="*" RowDefinitions="*">
12-
<TabControl Name="Tabs" Grid.Column="0" Grid.Row="0" ItemsSource="{Binding SoftwareGroups}">
13-
<TabControl.ItemTemplate>
14-
<DataTemplate>
15-
<TextBlock Text="{Binding DisplayName}" />
16-
</DataTemplate>
17-
</TabControl.ItemTemplate>
18-
<TabControl.ContentTemplate>
19-
<DataTemplate DataType="models:ControlSystemSoftwareGroup">
20-
<DockPanel DockPanel.Dock="Top">
21-
<views:ControlSystemSoftwareGroupView
22-
DataContext="{Binding}" />
23-
</DockPanel>
24-
</DataTemplate>
25-
</TabControl.ContentTemplate>
26-
</TabControl>
27-
</Grid>
28-
11+
<TabControl Name="Tabs" ItemsSource="{Binding SoftwareGroups}" Height="{Binding Height, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}">
12+
<TabControl.ItemTemplate>
13+
<DataTemplate>
14+
<TextBlock Text="{Binding DisplayName}" />
15+
</DataTemplate>
16+
</TabControl.ItemTemplate>
17+
<TabControl.ContentTemplate>
18+
<DataTemplate DataType="models:ControlSystemSoftwareGroup">
19+
<DockPanel DockPanel.Dock="Top">
20+
<views:ControlSystemSoftwareGroupView
21+
DataContext="{Binding}" />
22+
</DockPanel>
23+
</DataTemplate>
24+
</TabControl.ContentTemplate>
25+
</TabControl>
2926
</UserControl>

Lists/FRC2025.json

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,9 @@
184184
"Team",
185185
"CSA"
186186
],
187-
"FileName": "REV-Hardware-Client-Setup-1.7.2-offline-FRC-2025-02-11.exe",
188-
"Uri": "https://github.com/REVrobotics/REV-Software-Binaries/releases/download/rhc-1.7.2/REV-Hardware-Client-Setup-1.7.2-offline-FRC-2025-02-11.exe",
189-
"Hash": "7a16eb34431ca803b8615c33f25771be",
187+
"FileName": "REV-Hardware-Client-Setup-1.7.3-offline-FRC-2025-02-14.exe",
188+
"Uri": "https://github.com/REVrobotics/REV-Software-Binaries/releases/download/rhc-1.7.3/REV-Hardware-Client-Setup-1.7.3-offline-FRC-2025-02-14.exe",
189+
"Hash": "f7bc0e38c1e215886f7b5c04eb1fd33d",
190190
"Platform": "Windows"
191191
},
192192
{
@@ -210,9 +210,9 @@
210210
"Team",
211211
"CSA"
212212
],
213-
"FileName": "REVLib-offline-v2025.0.2.zip",
214-
"Uri": "https://github.com/REVrobotics/REV-Software-Binaries/releases/download/revlib-2025.0.2/REVLib-offline-v2025.0.2.zip",
215-
"Hash": "c0ca044a0fc1832b789bdde98f0633ad",
213+
"FileName": "REVLib-offline-v2025.0.3.zip",
214+
"Uri": "https://github.com/REVrobotics/REV-Software-Binaries/releases/download/revlib-2025.0.3/REVLib-offline-v2025.0.3.zip",
215+
"Hash": "5ee350f310c7a3bdb0640808e9815279",
216216
"Platform": "Windows"
217217
},
218218
{
@@ -262,9 +262,9 @@
262262
"Team",
263263
"CSA"
264264
],
265-
"FileName": "limelight2_2025_0.zip",
266-
"Uri": "https://downloads.limelightvision.io/images/limelight2_2025_0.zip",
267-
"Hash": "d1ce74f1c9a0641ce9fc8e8354a91d62",
265+
"FileName": "limelight2_2025_1_release.zip",
266+
"Uri": "https://downloads.limelightvision.io/images/limelight2_2025_1_release.zip",
267+
"Hash": "13eb694116b3a85edb9ef11a7ba51b57",
268268
"Platform": "Windows"
269269
},
270270
{
@@ -275,9 +275,9 @@
275275
"Team",
276276
"CSA"
277277
],
278-
"FileName": "limelight3_2025_0.zip",
279-
"Uri": "https://downloads.limelightvision.io/images/limelight3_2025_0.zip",
280-
"Hash": "736045d4c248e6cdb5abb938002cf607",
278+
"FileName": "limelight3_2025_1_release.zip",
279+
"Uri": "https://downloads.limelightvision.io/images/limelight3_2025_1_release.zip",
280+
"Hash": "3ae5f15e1ddeeb66f43ca60d141bcf8c",
281281
"Platform": "Windows"
282282
},
283283
{
@@ -288,9 +288,9 @@
288288
"Team",
289289
"CSA"
290290
],
291-
"FileName": "limelight3g_2025_0.zip",
292-
"Uri": "https://downloads.limelightvision.io/images/limelight3g_2025_0.zip",
293-
"Hash": "26b1a9a92d7d42c235fbe1319975dba1",
291+
"FileName": "limelight3g_2025_1_release.zip",
292+
"Uri": "https://downloads.limelightvision.io/images/limelight3g_2025_1_release.zip",
293+
"Hash": "8652721d7c2e5ee71dfb0387c549403f",
294294
"Platform": "Windows"
295295
},
296296
{
@@ -301,9 +301,9 @@
301301
"Team",
302302
"CSA"
303303
],
304-
"FileName": "limelight4_2025_0.zip",
305-
"Uri": "https://downloads.limelightvision.io/images/limelight4_2025_0.zip",
306-
"Hash": "485b8ff5d0613cbb5d2b922ed07fce8f",
304+
"FileName": "limelight4_2025_1_release.zip",
305+
"Uri": "https://downloads.limelightvision.io/images/limelight4_2025_1_release.zip",
306+
"Hash": "7bddd51a9af0c7792e025792555ef6c3",
307307
"Platform": "Windows"
308308
},
309309
{
@@ -333,4 +333,4 @@
333333
"Platform": "Windows"
334334
}
335335
]
336-
}
336+
}

archive/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Archives of older files and scripts.
2+
#
3+
# The version of pyusbtool.py here works with the CSV format files.

pyusbtool.py renamed to archive/scripts/pyusbtool.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ def md5_file(fname: pathlib.Path) -> str:
118118
print(name, "exists and has valid checksum")
119119
present += 1
120120
continue
121+
print(name, "is invalid")
121122
is_invalid = True
122123

123124
if args.download:

0 commit comments

Comments
 (0)