Skip to content

Commit

Permalink
Cleanup - and theoretical fix for local files not working
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieSinn committed Jan 22, 2022
1 parent 68b66f5 commit db02d99
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 140 deletions.
22 changes: 15 additions & 7 deletions CSAUSBTool.Base/FIRSTSeason.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,11 @@ public class FIRSTSeason
public List<ControlSystemsSoftware> Software { get; set; }
public FIRSTProgram Program { get; set; }

public FIRSTSeason(int year, FIRSTProgram program)
public FIRSTSeason(int year, FIRSTProgram program, string uri = "")
{
Year = year;
Program = program;
Software = GetWebList();
}

public List<ControlSystemsSoftware> GetWebList()
{
return GetWebList("https://raw.githubusercontent.com/JamieSinn/CSA-USB-Tool/master/" + Program + "Software"+ Year + ".csv");
Software = GetWebList(uri);
}

public List<ControlSystemsSoftware> GetWebList(string uri)
Expand Down Expand Up @@ -80,4 +75,17 @@ public override string ToString()
return $"{Program} - {Year}";
}
}
public class FRCSeason : FIRSTSeason
{
public FRCSeason(int year, string uri = "") : base(year, FIRSTProgram.FRC, uri)
{
}
}

public class FTCSeason : FIRSTSeason
{
public FTCSeason(int year, string uri = "") : base(year, FIRSTProgram.FTC, uri)
{
}
}
}
15 changes: 0 additions & 15 deletions CSAUSBTool.Base/FTCSeason.cs

This file was deleted.

15 changes: 0 additions & 15 deletions CSAUSBTool.Base/FrcSeason.cs

This file was deleted.

54 changes: 28 additions & 26 deletions CSAUSBTool/CSAUSBTool.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 7 additions & 11 deletions CSAUSBTool/CSAUSBTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@ public partial class CSAUSBTool : Form

private List<string> ValidSeasonsList { get; set; }

private readonly Dictionary<string, FIRSTSeason> seasons = new Dictionary<string, FIRSTSeason>();
private readonly Dictionary<string, FIRSTSeason> seasons = new();

private Dictionary<string, ControlSystemsSoftware> SelectedSoftware =
new Dictionary<string, ControlSystemsSoftware>();
private Dictionary<string, ControlSystemsSoftware> SelectedSoftware = new();

public CSAUSBTool(IReadOnlyList<string> args)
{
Text = @"CSA USB Tool v2022.1";

ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

InitializeComponent();

if (args.Count >= 1)
if (Directory.GetFiles(Directory.GetCurrentDirectory(), "*.csa").Length > 0)
{
Console.Out.WriteLine(args[0]);
seasons["FRC9999"] = new FIRSTSeason(9999, FIRSTProgram.FRC);
seasons["FRC9999"] = new FRCSeason(9999, $"local:{Directory.GetFiles(Directory.GetCurrentDirectory(), "*.csa")[0]}");
}

ValidSeasons().ContinueWith(async (years) => (await years));
Expand All @@ -43,14 +43,12 @@ public CSAUSBTool(IReadOnlyList<string> args)

ValidSeasonsList.ForEach(year =>
{
if (!Enum.TryParse(year.Substring(0, 3), true, out FIRSTProgram program))
if (!Enum.TryParse(year[..3], true, out FIRSTProgram program))
return;
seasons[year] = new FIRSTSeason(int.Parse(year[3..]), program);
});

Text = "CSA USB Tool v2022.1";

// Bind year objects to the selector.
yearSelection.DataSource = new BindingSource(seasons, null);
yearSelection.DisplayMember = "Key";
Expand Down Expand Up @@ -113,8 +111,6 @@ private void downloadBrowse_Click(object sender, EventArgs e)
DownloadFolderPath = folder;
}



private void downloadButton_Click(object sender, EventArgs e)
{
toolStripProgressBar.Value = 0;
Expand Down
4 changes: 4 additions & 0 deletions CSAUSBTool/CSAUSBTool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<Optimize>true</Optimize>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>firstrobotics_iconvert_rgb_tCt_icon.ico</ApplicationIcon>
Expand All @@ -49,6 +50,9 @@
<PropertyGroup>
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<Content Include=".gitignore" />
<Content Include="firstrobotics_iconvert_rgb_tCt_icon.ico" />
Expand Down
5 changes: 0 additions & 5 deletions CSAUSBTool/CSAUSBTool.csproj.DotSettings

This file was deleted.

65 changes: 4 additions & 61 deletions CSAUSBTool/CSAUSBTool.resx
Original file line number Diff line number Diff line change
@@ -1,64 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
Expand Down Expand Up @@ -123,6 +63,9 @@
<metadata name="statusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>180, 17</value>
</metadata>
<metadata name="colorDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>308, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
Expand Down

0 comments on commit db02d99

Please sign in to comment.