├── .gitattributes
├── .gitignore
├── App.config
├── Form1.Designer.cs
├── Form1.cs
├── Form1.resx
├── LICENSE
├── Program.cs
├── Programmer.csproj
├── Programmer.sln
├── Properties
├── AssemblyInfo.cs
├── Resources.Designer.cs
├── Resources.resx
├── Settings.Designer.cs
└── Settings.settings
├── README.md
└── programmer.ico
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Build results
17 | [Dd]ebug/
18 | [Dd]ebugPublic/
19 | [Rr]elease/
20 | [Rr]eleases/
21 | x64/
22 | x86/
23 | [Aa][Rr][Mm]/
24 | [Aa][Rr][Mm]64/
25 | bld/
26 | [Bb]in/
27 | [Oo]bj/
28 | [Ll]og/
29 |
30 | # Visual Studio 2015/2017 cache/options directory
31 | .vs/
32 | # Uncomment if you have tasks that create the project's static files in wwwroot
33 | #wwwroot/
34 |
35 | # Visual Studio 2017 auto generated files
36 | Generated\ Files/
37 |
38 | # MSTest test Results
39 | [Tt]est[Rr]esult*/
40 | [Bb]uild[Ll]og.*
41 |
42 | # NUNIT
43 | *.VisualState.xml
44 | TestResult.xml
45 |
46 | # Build Results of an ATL Project
47 | [Dd]ebugPS/
48 | [Rr]eleasePS/
49 | dlldata.c
50 |
51 | # Benchmark Results
52 | BenchmarkDotNet.Artifacts/
53 |
54 | # .NET Core
55 | project.lock.json
56 | project.fragment.lock.json
57 | artifacts/
58 |
59 | # StyleCop
60 | StyleCopReport.xml
61 |
62 | # Files built by Visual Studio
63 | *_i.c
64 | *_p.c
65 | *_h.h
66 | *.ilk
67 | *.meta
68 | *.obj
69 | *.iobj
70 | *.pch
71 | *.pdb
72 | *.ipdb
73 | *.pgc
74 | *.pgd
75 | *.rsp
76 | *.sbr
77 | *.tlb
78 | *.tli
79 | *.tlh
80 | *.tmp
81 | *.tmp_proj
82 | *_wpftmp.csproj
83 | *.log
84 | *.vspscc
85 | *.vssscc
86 | .builds
87 | *.pidb
88 | *.svclog
89 | *.scc
90 |
91 | # Chutzpah Test files
92 | _Chutzpah*
93 |
94 | # Visual C++ cache files
95 | ipch/
96 | *.aps
97 | *.ncb
98 | *.opendb
99 | *.opensdf
100 | *.sdf
101 | *.cachefile
102 | *.VC.db
103 | *.VC.VC.opendb
104 |
105 | # Visual Studio profiler
106 | *.psess
107 | *.vsp
108 | *.vspx
109 | *.sap
110 |
111 | # Visual Studio Trace Files
112 | *.e2e
113 |
114 | # TFS 2012 Local Workspace
115 | $tf/
116 |
117 | # Guidance Automation Toolkit
118 | *.gpState
119 |
120 | # ReSharper is a .NET coding add-in
121 | _ReSharper*/
122 | *.[Rr]e[Ss]harper
123 | *.DotSettings.user
124 |
125 | # JustCode is a .NET coding add-in
126 | .JustCode
127 |
128 | # TeamCity is a build add-in
129 | _TeamCity*
130 |
131 | # DotCover is a Code Coverage Tool
132 | *.dotCover
133 |
134 | # AxoCover is a Code Coverage Tool
135 | .axoCover/*
136 | !.axoCover/settings.json
137 |
138 | # Visual Studio code coverage results
139 | *.coverage
140 | *.coveragexml
141 |
142 | # NCrunch
143 | _NCrunch_*
144 | .*crunch*.local.xml
145 | nCrunchTemp_*
146 |
147 | # MightyMoose
148 | *.mm.*
149 | AutoTest.Net/
150 |
151 | # Web workbench (sass)
152 | .sass-cache/
153 |
154 | # Installshield output folder
155 | [Ee]xpress/
156 |
157 | # DocProject is a documentation generator add-in
158 | DocProject/buildhelp/
159 | DocProject/Help/*.HxT
160 | DocProject/Help/*.HxC
161 | DocProject/Help/*.hhc
162 | DocProject/Help/*.hhk
163 | DocProject/Help/*.hhp
164 | DocProject/Help/Html2
165 | DocProject/Help/html
166 |
167 | # Click-Once directory
168 | publish/
169 |
170 | # Publish Web Output
171 | *.[Pp]ublish.xml
172 | *.azurePubxml
173 | # Note: Comment the next line if you want to checkin your web deploy settings,
174 | # but database connection strings (with potential passwords) will be unencrypted
175 | *.pubxml
176 | *.publishproj
177 |
178 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
179 | # checkin your Azure Web App publish settings, but sensitive information contained
180 | # in these scripts will be unencrypted
181 | PublishScripts/
182 |
183 | # NuGet Packages
184 | *.nupkg
185 | # The packages folder can be ignored because of Package Restore
186 | **/[Pp]ackages/*
187 | # except build/, which is used as an MSBuild target.
188 | !**/[Pp]ackages/build/
189 | # Uncomment if necessary however generally it will be regenerated when needed
190 | #!**/[Pp]ackages/repositories.config
191 | # NuGet v3's project.json files produces more ignorable files
192 | *.nuget.props
193 | *.nuget.targets
194 |
195 | # Microsoft Azure Build Output
196 | csx/
197 | *.build.csdef
198 |
199 | # Microsoft Azure Emulator
200 | ecf/
201 | rcf/
202 |
203 | # Windows Store app package directories and files
204 | AppPackages/
205 | BundleArtifacts/
206 | Package.StoreAssociation.xml
207 | _pkginfo.txt
208 | *.appx
209 |
210 | # Visual Studio cache files
211 | # files ending in .cache can be ignored
212 | *.[Cc]ache
213 | # but keep track of directories ending in .cache
214 | !?*.[Cc]ache/
215 |
216 | # Others
217 | ClientBin/
218 | ~$*
219 | *~
220 | *.dbmdl
221 | *.dbproj.schemaview
222 | *.jfm
223 | *.pfx
224 | *.publishsettings
225 | orleans.codegen.cs
226 |
227 | # Including strong name files can present a security risk
228 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
229 | #*.snk
230 |
231 | # Since there are multiple workflows, uncomment next line to ignore bower_components
232 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
233 | #bower_components/
234 |
235 | # RIA/Silverlight projects
236 | Generated_Code/
237 |
238 | # Backup & report files from converting an old project file
239 | # to a newer Visual Studio version. Backup files are not needed,
240 | # because we have git ;-)
241 | _UpgradeReport_Files/
242 | Backup*/
243 | UpgradeLog*.XML
244 | UpgradeLog*.htm
245 | ServiceFabricBackup/
246 | *.rptproj.bak
247 |
248 | # SQL Server files
249 | *.mdf
250 | *.ldf
251 | *.ndf
252 |
253 | # Business Intelligence projects
254 | *.rdl.data
255 | *.bim.layout
256 | *.bim_*.settings
257 | *.rptproj.rsuser
258 | *- Backup*.rdl
259 |
260 | # Microsoft Fakes
261 | FakesAssemblies/
262 |
263 | # GhostDoc plugin setting file
264 | *.GhostDoc.xml
265 |
266 | # Node.js Tools for Visual Studio
267 | .ntvs_analysis.dat
268 | node_modules/
269 |
270 | # Visual Studio 6 build log
271 | *.plg
272 |
273 | # Visual Studio 6 workspace options file
274 | *.opt
275 |
276 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
277 | *.vbw
278 |
279 | # Visual Studio LightSwitch build output
280 | **/*.HTMLClient/GeneratedArtifacts
281 | **/*.DesktopClient/GeneratedArtifacts
282 | **/*.DesktopClient/ModelManifest.xml
283 | **/*.Server/GeneratedArtifacts
284 | **/*.Server/ModelManifest.xml
285 | _Pvt_Extensions
286 |
287 | # Paket dependency manager
288 | .paket/paket.exe
289 | paket-files/
290 |
291 | # FAKE - F# Make
292 | .fake/
293 |
294 | # JetBrains Rider
295 | .idea/
296 | *.sln.iml
297 |
298 | # CodeRush personal settings
299 | .cr/personal
300 |
301 | # Python Tools for Visual Studio (PTVS)
302 | __pycache__/
303 | *.pyc
304 |
305 | # Cake - Uncomment if you are using it
306 | # tools/**
307 | # !tools/packages.config
308 |
309 | # Tabs Studio
310 | *.tss
311 |
312 | # Telerik's JustMock configuration file
313 | *.jmconfig
314 |
315 | # BizTalk build output
316 | *.btp.cs
317 | *.btm.cs
318 | *.odx.cs
319 | *.xsd.cs
320 |
321 | # OpenCover UI analysis results
322 | OpenCover/
323 |
324 | # Azure Stream Analytics local run output
325 | ASALocalRun/
326 |
327 | # MSBuild Binary and Structured Log
328 | *.binlog
329 |
330 | # NVidia Nsight GPU debugger configuration file
331 | *.nvuser
332 |
333 | # MFractors (Xamarin productivity tool) working folder
334 | .mfractor/
335 |
336 | # Local History for Visual Studio
337 | .localhistory/
338 |
339 | # BeatPulse healthcheck temp database
340 | healthchecksdb
--------------------------------------------------------------------------------
/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Programmer
2 | {
3 | partial class Form1
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.components = new System.ComponentModel.Container();
32 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
33 | this.groupBox1 = new System.Windows.Forms.GroupBox();
34 | this.btn_mc_gen = new System.Windows.Forms.Button();
35 | this.btn_gen_seed = new System.Windows.Forms.Button();
36 | this.btn_pp = new System.Windows.Forms.Button();
37 | this.btn_mc_clc = new System.Windows.Forms.Button();
38 | this.label6 = new System.Windows.Forms.Label();
39 | this.tb_mf = new System.Windows.Forms.TextBox();
40 | this.btn_write = new System.Windows.Forms.Button();
41 | this.cb_timer = new System.Windows.Forms.CheckBox();
42 | this.cb_dis_auto = new System.Windows.Forms.CheckBox();
43 | this.tb_dis = new System.Windows.Forms.TextBox();
44 | this.label5 = new System.Windows.Forms.Label();
45 | this.cb_ovr_set = new System.Windows.Forms.CheckBox();
46 | this.tb_seed = new System.Windows.Forms.TextBox();
47 | this.label4 = new System.Windows.Forms.Label();
48 | this.tb_sync = new System.Windows.Forms.TextBox();
49 | this.label3 = new System.Windows.Forms.Label();
50 | this.btn_gen_ser = new System.Windows.Forms.Button();
51 | this.tb_ser = new System.Windows.Forms.TextBox();
52 | this.label2 = new System.Windows.Forms.Label();
53 | this.btn_gen_key = new System.Windows.Forms.Button();
54 | this.label1 = new System.Windows.Forms.Label();
55 | this.tb_key = new System.Windows.Forms.TextBox();
56 | this.groupBox2 = new System.Windows.Forms.GroupBox();
57 | this.btn_connect = new System.Windows.Forms.Button();
58 | this.btn_update_port = new System.Windows.Forms.Button();
59 | this.cb_port = new System.Windows.Forms.ComboBox();
60 | this.menuStrip1 = new System.Windows.Forms.MenuStrip();
61 | this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
62 | this.saveLogToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
63 | this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
64 | this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
65 | this.sERToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
66 | this.discriminationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
67 | this.bitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
68 | this.bitToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
69 | this.bitToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
70 | this.learnModeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
71 | this.noneToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
72 | this.simpleLearningToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
73 | this.normalLearningToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
74 | this.secureLearnToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
75 | this.deviceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
76 | this.hCS301ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
77 | this.hCS300ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
78 | this.hCS200ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
79 | this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
80 | this.reportProblemToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
81 | this.updateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
82 | this.contaToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
83 | this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
84 | this.serial_port = new System.IO.Ports.SerialPort(this.components);
85 | this.statusStrip1 = new System.Windows.Forms.StatusStrip();
86 | this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
87 | this.splitContainer1 = new System.Windows.Forms.SplitContainer();
88 | this.groupBox5 = new System.Windows.Forms.GroupBox();
89 | this.cb_br = new System.Windows.Forms.ComboBox();
90 | this.groupBox4 = new System.Windows.Forms.GroupBox();
91 | this.rb_6v = new System.Windows.Forms.RadioButton();
92 | this.rb_9or12v = new System.Windows.Forms.RadioButton();
93 | this.groupBox3 = new System.Windows.Forms.GroupBox();
94 | this.rtb = new System.Windows.Forms.RichTextBox();
95 | this.timer1 = new System.Windows.Forms.Timer(this.components);
96 | this.groupBox1.SuspendLayout();
97 | this.groupBox2.SuspendLayout();
98 | this.menuStrip1.SuspendLayout();
99 | this.statusStrip1.SuspendLayout();
100 | ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
101 | this.splitContainer1.Panel1.SuspendLayout();
102 | this.splitContainer1.Panel2.SuspendLayout();
103 | this.splitContainer1.SuspendLayout();
104 | this.groupBox5.SuspendLayout();
105 | this.groupBox4.SuspendLayout();
106 | this.groupBox3.SuspendLayout();
107 | this.SuspendLayout();
108 | //
109 | // groupBox1
110 | //
111 | this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
112 | | System.Windows.Forms.AnchorStyles.Left)
113 | | System.Windows.Forms.AnchorStyles.Right)));
114 | this.groupBox1.Controls.Add(this.btn_mc_gen);
115 | this.groupBox1.Controls.Add(this.btn_gen_seed);
116 | this.groupBox1.Controls.Add(this.btn_pp);
117 | this.groupBox1.Controls.Add(this.btn_mc_clc);
118 | this.groupBox1.Controls.Add(this.label6);
119 | this.groupBox1.Controls.Add(this.tb_mf);
120 | this.groupBox1.Controls.Add(this.btn_write);
121 | this.groupBox1.Controls.Add(this.cb_timer);
122 | this.groupBox1.Controls.Add(this.cb_dis_auto);
123 | this.groupBox1.Controls.Add(this.tb_dis);
124 | this.groupBox1.Controls.Add(this.label5);
125 | this.groupBox1.Controls.Add(this.cb_ovr_set);
126 | this.groupBox1.Controls.Add(this.tb_seed);
127 | this.groupBox1.Controls.Add(this.label4);
128 | this.groupBox1.Controls.Add(this.tb_sync);
129 | this.groupBox1.Controls.Add(this.label3);
130 | this.groupBox1.Controls.Add(this.btn_gen_ser);
131 | this.groupBox1.Controls.Add(this.tb_ser);
132 | this.groupBox1.Controls.Add(this.label2);
133 | this.groupBox1.Controls.Add(this.btn_gen_key);
134 | this.groupBox1.Controls.Add(this.label1);
135 | this.groupBox1.Controls.Add(this.tb_key);
136 | this.groupBox1.Location = new System.Drawing.Point(172, 3);
137 | this.groupBox1.Name = "groupBox1";
138 | this.groupBox1.Size = new System.Drawing.Size(474, 218);
139 | this.groupBox1.TabIndex = 1;
140 | this.groupBox1.TabStop = false;
141 | this.groupBox1.Text = "Main";
142 | //
143 | // btn_mc_gen
144 | //
145 | this.btn_mc_gen.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
146 | this.btn_mc_gen.Enabled = false;
147 | this.btn_mc_gen.Location = new System.Drawing.Point(390, 30);
148 | this.btn_mc_gen.Name = "btn_mc_gen";
149 | this.btn_mc_gen.Size = new System.Drawing.Size(75, 23);
150 | this.btn_mc_gen.TabIndex = 24;
151 | this.btn_mc_gen.Text = "Generate";
152 | this.btn_mc_gen.UseVisualStyleBackColor = true;
153 | this.btn_mc_gen.Click += new System.EventHandler(this.btn_mc_gen_Click);
154 | //
155 | // btn_gen_seed
156 | //
157 | this.btn_gen_seed.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
158 | this.btn_gen_seed.Location = new System.Drawing.Point(390, 134);
159 | this.btn_gen_seed.Name = "btn_gen_seed";
160 | this.btn_gen_seed.Size = new System.Drawing.Size(75, 23);
161 | this.btn_gen_seed.TabIndex = 23;
162 | this.btn_gen_seed.Text = "Generate";
163 | this.btn_gen_seed.UseVisualStyleBackColor = true;
164 | this.btn_gen_seed.Click += new System.EventHandler(this.btn_gen_seed_Click);
165 | //
166 | // btn_pp
167 | //
168 | this.btn_pp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
169 | this.btn_pp.Location = new System.Drawing.Point(357, 82);
170 | this.btn_pp.Name = "btn_pp";
171 | this.btn_pp.Size = new System.Drawing.Size(30, 23);
172 | this.btn_pp.TabIndex = 22;
173 | this.btn_pp.Text = "+1";
174 | this.btn_pp.UseVisualStyleBackColor = true;
175 | this.btn_pp.Click += new System.EventHandler(this.btn_pp_Click);
176 | //
177 | // btn_mc_clc
178 | //
179 | this.btn_mc_clc.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
180 | this.btn_mc_clc.Enabled = false;
181 | this.btn_mc_clc.Location = new System.Drawing.Point(312, 30);
182 | this.btn_mc_clc.Name = "btn_mc_clc";
183 | this.btn_mc_clc.Size = new System.Drawing.Size(75, 23);
184 | this.btn_mc_clc.TabIndex = 20;
185 | this.btn_mc_clc.Text = "Apply";
186 | this.btn_mc_clc.UseVisualStyleBackColor = true;
187 | this.btn_mc_clc.Click += new System.EventHandler(this.btn_mc_clc_Click);
188 | //
189 | // label6
190 | //
191 | this.label6.AutoSize = true;
192 | this.label6.Location = new System.Drawing.Point(7, 34);
193 | this.label6.Name = "label6";
194 | this.label6.Size = new System.Drawing.Size(101, 13);
195 | this.label6.TabIndex = 17;
196 | this.label6.Text = "Manufacturer Code:";
197 | //
198 | // tb_mf
199 | //
200 | this.tb_mf.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
201 | | System.Windows.Forms.AnchorStyles.Right)));
202 | this.tb_mf.Enabled = false;
203 | this.tb_mf.Location = new System.Drawing.Point(107, 31);
204 | this.tb_mf.MaxLength = 16;
205 | this.tb_mf.Name = "tb_mf";
206 | this.tb_mf.Size = new System.Drawing.Size(202, 20);
207 | this.tb_mf.TabIndex = 19;
208 | this.tb_mf.Text = "0123456789ABCDEF";
209 | this.tb_mf.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
210 | this.tb_mf.TextChanged += new System.EventHandler(this.tb_mf_TextChanged);
211 | this.tb_mf.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tb_mf_KeyDown);
212 | this.tb_mf.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tb_mf_KeyPress);
213 | //
214 | // btn_write
215 | //
216 | this.btn_write.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
217 | this.btn_write.Enabled = false;
218 | this.btn_write.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
219 | this.btn_write.Location = new System.Drawing.Point(390, 171);
220 | this.btn_write.Name = "btn_write";
221 | this.btn_write.Size = new System.Drawing.Size(75, 37);
222 | this.btn_write.TabIndex = 16;
223 | this.btn_write.Text = "Write";
224 | this.btn_write.UseVisualStyleBackColor = true;
225 | this.btn_write.Click += new System.EventHandler(this.btn_write_Click);
226 | //
227 | // cb_timer
228 | //
229 | this.cb_timer.AutoSize = true;
230 | this.cb_timer.Checked = true;
231 | this.cb_timer.CheckState = System.Windows.Forms.CheckState.Checked;
232 | this.cb_timer.Location = new System.Drawing.Point(219, 86);
233 | this.cb_timer.Name = "cb_timer";
234 | this.cb_timer.Size = new System.Drawing.Size(133, 17);
235 | this.cb_timer.TabIndex = 8;
236 | this.cb_timer.Text = "ShutOFF Timer Enable";
237 | this.cb_timer.UseVisualStyleBackColor = true;
238 | this.cb_timer.CheckedChanged += new System.EventHandler(this.cb_timer_CheckedChanged);
239 | //
240 | // cb_dis_auto
241 | //
242 | this.cb_dis_auto.AutoSize = true;
243 | this.cb_dis_auto.Checked = true;
244 | this.cb_dis_auto.CheckState = System.Windows.Forms.CheckState.Checked;
245 | this.cb_dis_auto.Location = new System.Drawing.Point(220, 166);
246 | this.cb_dis_auto.Name = "cb_dis_auto";
247 | this.cb_dis_auto.Size = new System.Drawing.Size(145, 17);
248 | this.cb_dis_auto.TabIndex = 12;
249 | this.cb_dis_auto.Text = "Auto Gen From SER LSB";
250 | this.cb_dis_auto.UseVisualStyleBackColor = true;
251 | this.cb_dis_auto.CheckedChanged += new System.EventHandler(this.cb_dis_auto_CheckedChanged);
252 | //
253 | // tb_dis
254 | //
255 | this.tb_dis.Enabled = false;
256 | this.tb_dis.Location = new System.Drawing.Point(108, 164);
257 | this.tb_dis.MaxLength = 3;
258 | this.tb_dis.Name = "tb_dis";
259 | this.tb_dis.Size = new System.Drawing.Size(101, 20);
260 | this.tb_dis.TabIndex = 13;
261 | this.tb_dis.Text = "000";
262 | this.tb_dis.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
263 | this.tb_dis.TextChanged += new System.EventHandler(this.tb_dis_TextChanged);
264 | this.tb_dis.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tb_dis_KeyDown);
265 | this.tb_dis.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tb_dis_KeyPress);
266 | //
267 | // label5
268 | //
269 | this.label5.AutoSize = true;
270 | this.label5.Location = new System.Drawing.Point(8, 168);
271 | this.label5.Name = "label5";
272 | this.label5.Size = new System.Drawing.Size(75, 13);
273 | this.label5.TabIndex = 11;
274 | this.label5.Text = "Discrimination:";
275 | //
276 | // cb_ovr_set
277 | //
278 | this.cb_ovr_set.AutoSize = true;
279 | this.cb_ovr_set.Checked = true;
280 | this.cb_ovr_set.CheckState = System.Windows.Forms.CheckState.Checked;
281 | this.cb_ovr_set.Location = new System.Drawing.Point(219, 112);
282 | this.cb_ovr_set.Name = "cb_ovr_set";
283 | this.cb_ovr_set.Size = new System.Drawing.Size(68, 17);
284 | this.cb_ovr_set.TabIndex = 10;
285 | this.cb_ovr_set.Text = "OVR Set";
286 | this.cb_ovr_set.UseVisualStyleBackColor = true;
287 | this.cb_ovr_set.CheckedChanged += new System.EventHandler(this.cb_ovr_set_CheckedChanged);
288 | //
289 | // tb_seed
290 | //
291 | this.tb_seed.Location = new System.Drawing.Point(108, 136);
292 | this.tb_seed.MaxLength = 8;
293 | this.tb_seed.Name = "tb_seed";
294 | this.tb_seed.Size = new System.Drawing.Size(101, 20);
295 | this.tb_seed.TabIndex = 11;
296 | this.tb_seed.Text = "00000000";
297 | this.tb_seed.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
298 | this.tb_seed.TextChanged += new System.EventHandler(this.tb_seed_TextChanged);
299 | this.tb_seed.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tb_seed_KeyDown);
300 | this.tb_seed.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tb_seed_KeyPress);
301 | //
302 | // label4
303 | //
304 | this.label4.AutoSize = true;
305 | this.label4.Location = new System.Drawing.Point(7, 141);
306 | this.label4.Name = "label4";
307 | this.label4.Size = new System.Drawing.Size(39, 13);
308 | this.label4.TabIndex = 8;
309 | this.label4.Text = "SEED:";
310 | //
311 | // tb_sync
312 | //
313 | this.tb_sync.Location = new System.Drawing.Point(108, 110);
314 | this.tb_sync.MaxLength = 4;
315 | this.tb_sync.Name = "tb_sync";
316 | this.tb_sync.Size = new System.Drawing.Size(101, 20);
317 | this.tb_sync.TabIndex = 9;
318 | this.tb_sync.Text = "0000";
319 | this.tb_sync.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
320 | this.tb_sync.TextChanged += new System.EventHandler(this.tb_sync_TextChanged);
321 | this.tb_sync.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tb_sync_KeyDown);
322 | this.tb_sync.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tb_sync_KeyPress);
323 | //
324 | // label3
325 | //
326 | this.label3.AutoSize = true;
327 | this.label3.Location = new System.Drawing.Point(7, 115);
328 | this.label3.Name = "label3";
329 | this.label3.Size = new System.Drawing.Size(39, 13);
330 | this.label3.TabIndex = 6;
331 | this.label3.Text = "SYNC:";
332 | //
333 | // btn_gen_ser
334 | //
335 | this.btn_gen_ser.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
336 | this.btn_gen_ser.Location = new System.Drawing.Point(390, 82);
337 | this.btn_gen_ser.Name = "btn_gen_ser";
338 | this.btn_gen_ser.Size = new System.Drawing.Size(75, 23);
339 | this.btn_gen_ser.TabIndex = 6;
340 | this.btn_gen_ser.Text = "Generate";
341 | this.btn_gen_ser.UseVisualStyleBackColor = true;
342 | this.btn_gen_ser.Click += new System.EventHandler(this.btn_gen_ser_Click);
343 | //
344 | // tb_ser
345 | //
346 | this.tb_ser.Location = new System.Drawing.Point(108, 84);
347 | this.tb_ser.MaxLength = 8;
348 | this.tb_ser.Name = "tb_ser";
349 | this.tb_ser.Size = new System.Drawing.Size(101, 20);
350 | this.tb_ser.TabIndex = 7;
351 | this.tb_ser.Text = "FFFFFFFF";
352 | this.tb_ser.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
353 | this.tb_ser.TextChanged += new System.EventHandler(this.tb_ser_TextChanged);
354 | this.tb_ser.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tb_ser_KeyDown);
355 | this.tb_ser.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tb_ser_KeyPress);
356 | //
357 | // label2
358 | //
359 | this.label2.AutoSize = true;
360 | this.label2.Location = new System.Drawing.Point(6, 88);
361 | this.label2.Name = "label2";
362 | this.label2.Size = new System.Drawing.Size(32, 13);
363 | this.label2.TabIndex = 3;
364 | this.label2.Text = "SER:";
365 | //
366 | // btn_gen_key
367 | //
368 | this.btn_gen_key.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
369 | this.btn_gen_key.Location = new System.Drawing.Point(390, 56);
370 | this.btn_gen_key.Name = "btn_gen_key";
371 | this.btn_gen_key.Size = new System.Drawing.Size(75, 23);
372 | this.btn_gen_key.TabIndex = 4;
373 | this.btn_gen_key.Text = "Generate";
374 | this.btn_gen_key.UseVisualStyleBackColor = true;
375 | this.btn_gen_key.Click += new System.EventHandler(this.btn_gen_Click);
376 | //
377 | // label1
378 | //
379 | this.label1.AutoSize = true;
380 | this.label1.Location = new System.Drawing.Point(7, 61);
381 | this.label1.Name = "label1";
382 | this.label1.Size = new System.Drawing.Size(31, 13);
383 | this.label1.TabIndex = 1;
384 | this.label1.Text = "KEY:";
385 | //
386 | // tb_key
387 | //
388 | this.tb_key.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
389 | | System.Windows.Forms.AnchorStyles.Right)));
390 | this.tb_key.Location = new System.Drawing.Point(107, 57);
391 | this.tb_key.MaxLength = 16;
392 | this.tb_key.Name = "tb_key";
393 | this.tb_key.Size = new System.Drawing.Size(202, 20);
394 | this.tb_key.TabIndex = 5;
395 | this.tb_key.Text = "FFFFFFFFFFFFFFFF";
396 | this.tb_key.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
397 | this.tb_key.TextChanged += new System.EventHandler(this.tb_key_TextChanged);
398 | this.tb_key.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tb_key_KeyDown);
399 | this.tb_key.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tb_key_KeyPress);
400 | //
401 | // groupBox2
402 | //
403 | this.groupBox2.Controls.Add(this.btn_connect);
404 | this.groupBox2.Controls.Add(this.btn_update_port);
405 | this.groupBox2.Controls.Add(this.cb_port);
406 | this.groupBox2.Location = new System.Drawing.Point(3, 3);
407 | this.groupBox2.Name = "groupBox2";
408 | this.groupBox2.Size = new System.Drawing.Size(163, 78);
409 | this.groupBox2.TabIndex = 0;
410 | this.groupBox2.TabStop = false;
411 | this.groupBox2.Text = "Port";
412 | //
413 | // btn_connect
414 | //
415 | this.btn_connect.Location = new System.Drawing.Point(7, 48);
416 | this.btn_connect.Name = "btn_connect";
417 | this.btn_connect.Size = new System.Drawing.Size(150, 23);
418 | this.btn_connect.TabIndex = 2;
419 | this.btn_connect.Text = "Connect";
420 | this.btn_connect.UseVisualStyleBackColor = true;
421 | this.btn_connect.Click += new System.EventHandler(this.btn_connect_Click);
422 | //
423 | // btn_update_port
424 | //
425 | this.btn_update_port.Location = new System.Drawing.Point(95, 19);
426 | this.btn_update_port.Name = "btn_update_port";
427 | this.btn_update_port.Size = new System.Drawing.Size(63, 23);
428 | this.btn_update_port.TabIndex = 1;
429 | this.btn_update_port.Text = "Refresh";
430 | this.btn_update_port.UseVisualStyleBackColor = true;
431 | this.btn_update_port.Click += new System.EventHandler(this.btn_update_port_Click);
432 | //
433 | // cb_port
434 | //
435 | this.cb_port.FormattingEnabled = true;
436 | this.cb_port.Location = new System.Drawing.Point(7, 20);
437 | this.cb_port.Name = "cb_port";
438 | this.cb_port.Size = new System.Drawing.Size(82, 21);
439 | this.cb_port.TabIndex = 0;
440 | //
441 | // menuStrip1
442 | //
443 | this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
444 | this.fileToolStripMenuItem,
445 | this.optionsToolStripMenuItem,
446 | this.helpToolStripMenuItem});
447 | this.menuStrip1.Location = new System.Drawing.Point(0, 0);
448 | this.menuStrip1.Name = "menuStrip1";
449 | this.menuStrip1.Size = new System.Drawing.Size(649, 24);
450 | this.menuStrip1.TabIndex = 2;
451 | this.menuStrip1.Text = "menuStrip1";
452 | //
453 | // fileToolStripMenuItem
454 | //
455 | this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
456 | this.saveLogToolStripMenuItem,
457 | this.exitToolStripMenuItem});
458 | this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
459 | this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
460 | this.fileToolStripMenuItem.Text = "File";
461 | //
462 | // saveLogToolStripMenuItem
463 | //
464 | this.saveLogToolStripMenuItem.Name = "saveLogToolStripMenuItem";
465 | this.saveLogToolStripMenuItem.Size = new System.Drawing.Size(121, 22);
466 | this.saveLogToolStripMenuItem.Text = "Save Log";
467 | this.saveLogToolStripMenuItem.Click += new System.EventHandler(this.saveLogToolStripMenuItem_Click);
468 | //
469 | // exitToolStripMenuItem
470 | //
471 | this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
472 | this.exitToolStripMenuItem.Size = new System.Drawing.Size(121, 22);
473 | this.exitToolStripMenuItem.Text = "Exit";
474 | this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
475 | //
476 | // optionsToolStripMenuItem
477 | //
478 | this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
479 | this.sERToolStripMenuItem,
480 | this.discriminationToolStripMenuItem,
481 | this.learnModeToolStripMenuItem,
482 | this.deviceToolStripMenuItem});
483 | this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
484 | this.optionsToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
485 | this.optionsToolStripMenuItem.Text = "Options";
486 | //
487 | // sERToolStripMenuItem
488 | //
489 | this.sERToolStripMenuItem.Name = "sERToolStripMenuItem";
490 | this.sERToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
491 | this.sERToolStripMenuItem.Text = "SER++ if Done!";
492 | this.sERToolStripMenuItem.Click += new System.EventHandler(this.sERToolStripMenuItem_Click);
493 | //
494 | // discriminationToolStripMenuItem
495 | //
496 | this.discriminationToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
497 | this.bitToolStripMenuItem,
498 | this.bitToolStripMenuItem1,
499 | this.bitToolStripMenuItem2});
500 | this.discriminationToolStripMenuItem.Name = "discriminationToolStripMenuItem";
501 | this.discriminationToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
502 | this.discriminationToolStripMenuItem.Text = "Discrimination Crop";
503 | //
504 | // bitToolStripMenuItem
505 | //
506 | this.bitToolStripMenuItem.Name = "bitToolStripMenuItem";
507 | this.bitToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
508 | this.bitToolStripMenuItem.Text = "8 Bit";
509 | this.bitToolStripMenuItem.Click += new System.EventHandler(this.bitToolStripMenuItem_Click);
510 | //
511 | // bitToolStripMenuItem1
512 | //
513 | this.bitToolStripMenuItem1.Checked = true;
514 | this.bitToolStripMenuItem1.CheckState = System.Windows.Forms.CheckState.Checked;
515 | this.bitToolStripMenuItem1.Name = "bitToolStripMenuItem1";
516 | this.bitToolStripMenuItem1.Size = new System.Drawing.Size(180, 22);
517 | this.bitToolStripMenuItem1.Text = "10 Bit";
518 | this.bitToolStripMenuItem1.Click += new System.EventHandler(this.bitToolStripMenuItem1_Click);
519 | //
520 | // bitToolStripMenuItem2
521 | //
522 | this.bitToolStripMenuItem2.Name = "bitToolStripMenuItem2";
523 | this.bitToolStripMenuItem2.Size = new System.Drawing.Size(180, 22);
524 | this.bitToolStripMenuItem2.Text = "12 Bit";
525 | this.bitToolStripMenuItem2.Click += new System.EventHandler(this.bitToolStripMenuItem2_Click);
526 | //
527 | // learnModeToolStripMenuItem
528 | //
529 | this.learnModeToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
530 | this.noneToolStripMenuItem,
531 | this.simpleLearningToolStripMenuItem,
532 | this.normalLearningToolStripMenuItem,
533 | this.secureLearnToolStripMenuItem});
534 | this.learnModeToolStripMenuItem.Name = "learnModeToolStripMenuItem";
535 | this.learnModeToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
536 | this.learnModeToolStripMenuItem.Text = "Learn mode";
537 | //
538 | // noneToolStripMenuItem
539 | //
540 | this.noneToolStripMenuItem.Checked = true;
541 | this.noneToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
542 | this.noneToolStripMenuItem.Name = "noneToolStripMenuItem";
543 | this.noneToolStripMenuItem.Size = new System.Drawing.Size(163, 22);
544 | this.noneToolStripMenuItem.Text = "None";
545 | this.noneToolStripMenuItem.Click += new System.EventHandler(this.noneToolStripMenuItem_Click);
546 | //
547 | // simpleLearningToolStripMenuItem
548 | //
549 | this.simpleLearningToolStripMenuItem.Name = "simpleLearningToolStripMenuItem";
550 | this.simpleLearningToolStripMenuItem.Size = new System.Drawing.Size(163, 22);
551 | this.simpleLearningToolStripMenuItem.Text = "Simple Learning";
552 | this.simpleLearningToolStripMenuItem.Click += new System.EventHandler(this.simpleLearningToolStripMenuItem_Click);
553 | //
554 | // normalLearningToolStripMenuItem
555 | //
556 | this.normalLearningToolStripMenuItem.Name = "normalLearningToolStripMenuItem";
557 | this.normalLearningToolStripMenuItem.Size = new System.Drawing.Size(163, 22);
558 | this.normalLearningToolStripMenuItem.Text = "Normal Learning";
559 | this.normalLearningToolStripMenuItem.Click += new System.EventHandler(this.normalLearningToolStripMenuItem_Click);
560 | //
561 | // secureLearnToolStripMenuItem
562 | //
563 | this.secureLearnToolStripMenuItem.Name = "secureLearnToolStripMenuItem";
564 | this.secureLearnToolStripMenuItem.Size = new System.Drawing.Size(163, 22);
565 | this.secureLearnToolStripMenuItem.Text = "Secure Learn";
566 | this.secureLearnToolStripMenuItem.Click += new System.EventHandler(this.secureLearnToolStripMenuItem_Click);
567 | //
568 | // deviceToolStripMenuItem
569 | //
570 | this.deviceToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
571 | this.hCS301ToolStripMenuItem,
572 | this.hCS300ToolStripMenuItem,
573 | this.hCS200ToolStripMenuItem});
574 | this.deviceToolStripMenuItem.Name = "deviceToolStripMenuItem";
575 | this.deviceToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
576 | this.deviceToolStripMenuItem.Text = "Device";
577 | //
578 | // hCS301ToolStripMenuItem
579 | //
580 | this.hCS301ToolStripMenuItem.Checked = true;
581 | this.hCS301ToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
582 | this.hCS301ToolStripMenuItem.Name = "hCS301ToolStripMenuItem";
583 | this.hCS301ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
584 | this.hCS301ToolStripMenuItem.Text = "HCS301";
585 | this.hCS301ToolStripMenuItem.Click += new System.EventHandler(this.hCS301ToolStripMenuItem_Click);
586 | //
587 | // hCS300ToolStripMenuItem
588 | //
589 | this.hCS300ToolStripMenuItem.Name = "hCS300ToolStripMenuItem";
590 | this.hCS300ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
591 | this.hCS300ToolStripMenuItem.Text = "HCS300";
592 | this.hCS300ToolStripMenuItem.Click += new System.EventHandler(this.hCS300ToolStripMenuItem_Click);
593 | //
594 | // hCS200ToolStripMenuItem
595 | //
596 | this.hCS200ToolStripMenuItem.Name = "hCS200ToolStripMenuItem";
597 | this.hCS200ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
598 | this.hCS200ToolStripMenuItem.Text = "HCS200";
599 | this.hCS200ToolStripMenuItem.Click += new System.EventHandler(this.hCS200ToolStripMenuItem_Click);
600 | //
601 | // helpToolStripMenuItem
602 | //
603 | this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
604 | this.reportProblemToolStripMenuItem,
605 | this.updateToolStripMenuItem,
606 | this.contaToolStripMenuItem,
607 | this.aboutToolStripMenuItem});
608 | this.helpToolStripMenuItem.Name = "helpToolStripMenuItem";
609 | this.helpToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
610 | this.helpToolStripMenuItem.Text = "Help";
611 | //
612 | // reportProblemToolStripMenuItem
613 | //
614 | this.reportProblemToolStripMenuItem.Name = "reportProblemToolStripMenuItem";
615 | this.reportProblemToolStripMenuItem.Size = new System.Drawing.Size(157, 22);
616 | this.reportProblemToolStripMenuItem.Text = "Report Problem";
617 | this.reportProblemToolStripMenuItem.Click += new System.EventHandler(this.reportProblemToolStripMenuItem_Click);
618 | //
619 | // updateToolStripMenuItem
620 | //
621 | this.updateToolStripMenuItem.Name = "updateToolStripMenuItem";
622 | this.updateToolStripMenuItem.Size = new System.Drawing.Size(157, 22);
623 | this.updateToolStripMenuItem.Text = "Update";
624 | this.updateToolStripMenuItem.Click += new System.EventHandler(this.updateToolStripMenuItem_Click);
625 | //
626 | // contaToolStripMenuItem
627 | //
628 | this.contaToolStripMenuItem.Name = "contaToolStripMenuItem";
629 | this.contaToolStripMenuItem.Size = new System.Drawing.Size(157, 22);
630 | this.contaToolStripMenuItem.Text = "Contact";
631 | this.contaToolStripMenuItem.Click += new System.EventHandler(this.contaToolStripMenuItem_Click);
632 | //
633 | // aboutToolStripMenuItem
634 | //
635 | this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
636 | this.aboutToolStripMenuItem.Size = new System.Drawing.Size(157, 22);
637 | this.aboutToolStripMenuItem.Text = "About";
638 | this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click);
639 | //
640 | // serial_port
641 | //
642 | this.serial_port.ReadBufferSize = 256;
643 | this.serial_port.ReadTimeout = 1000;
644 | this.serial_port.WriteBufferSize = 256;
645 | this.serial_port.WriteTimeout = 1000;
646 | this.serial_port.DataReceived += new System.IO.Ports.SerialDataReceivedEventHandler(this.serial_port_DataReceived);
647 | //
648 | // statusStrip1
649 | //
650 | this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
651 | this.toolStripStatusLabel1});
652 | this.statusStrip1.Location = new System.Drawing.Point(0, 384);
653 | this.statusStrip1.Name = "statusStrip1";
654 | this.statusStrip1.Size = new System.Drawing.Size(649, 22);
655 | this.statusStrip1.TabIndex = 3;
656 | this.statusStrip1.Text = "statusStrip1";
657 | //
658 | // toolStripStatusLabel1
659 | //
660 | this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
661 | this.toolStripStatusLabel1.Size = new System.Drawing.Size(39, 17);
662 | this.toolStripStatusLabel1.Text = "Ready";
663 | //
664 | // splitContainer1
665 | //
666 | this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
667 | | System.Windows.Forms.AnchorStyles.Left)
668 | | System.Windows.Forms.AnchorStyles.Right)));
669 | this.splitContainer1.Location = new System.Drawing.Point(0, 27);
670 | this.splitContainer1.Name = "splitContainer1";
671 | this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
672 | //
673 | // splitContainer1.Panel1
674 | //
675 | this.splitContainer1.Panel1.Controls.Add(this.groupBox5);
676 | this.splitContainer1.Panel1.Controls.Add(this.groupBox4);
677 | this.splitContainer1.Panel1.Controls.Add(this.groupBox1);
678 | this.splitContainer1.Panel1.Controls.Add(this.groupBox2);
679 | //
680 | // splitContainer1.Panel2
681 | //
682 | this.splitContainer1.Panel2.AutoScroll = true;
683 | this.splitContainer1.Panel2.Controls.Add(this.groupBox3);
684 | this.splitContainer1.Size = new System.Drawing.Size(649, 354);
685 | this.splitContainer1.SplitterDistance = 224;
686 | this.splitContainer1.TabIndex = 5;
687 | //
688 | // groupBox5
689 | //
690 | this.groupBox5.Controls.Add(this.cb_br);
691 | this.groupBox5.Location = new System.Drawing.Point(3, 154);
692 | this.groupBox5.Name = "groupBox5";
693 | this.groupBox5.Size = new System.Drawing.Size(163, 50);
694 | this.groupBox5.TabIndex = 3;
695 | this.groupBox5.TabStop = false;
696 | this.groupBox5.Text = "Baud Rate";
697 | //
698 | // cb_br
699 | //
700 | this.cb_br.FormattingEnabled = true;
701 | this.cb_br.Items.AddRange(new object[] {
702 | "00 400uS ALL",
703 | "01 200uS 1/2",
704 | "10 100uS 1/2",
705 | "11 100uS 1/4"});
706 | this.cb_br.Location = new System.Drawing.Point(6, 20);
707 | this.cb_br.Name = "cb_br";
708 | this.cb_br.Size = new System.Drawing.Size(152, 21);
709 | this.cb_br.TabIndex = 15;
710 | this.cb_br.SelectedIndexChanged += new System.EventHandler(this.cb_br_SelectedIndexChanged);
711 | //
712 | // groupBox4
713 | //
714 | this.groupBox4.Controls.Add(this.rb_6v);
715 | this.groupBox4.Controls.Add(this.rb_9or12v);
716 | this.groupBox4.Location = new System.Drawing.Point(3, 85);
717 | this.groupBox4.Name = "groupBox4";
718 | this.groupBox4.Size = new System.Drawing.Size(163, 63);
719 | this.groupBox4.TabIndex = 2;
720 | this.groupBox4.TabStop = false;
721 | this.groupBox4.Text = "VDD";
722 | //
723 | // rb_6v
724 | //
725 | this.rb_6v.AutoSize = true;
726 | this.rb_6v.Location = new System.Drawing.Point(7, 39);
727 | this.rb_6v.Name = "rb_6v";
728 | this.rb_6v.Size = new System.Drawing.Size(41, 17);
729 | this.rb_6v.TabIndex = 14;
730 | this.rb_6v.Text = "6 V";
731 | this.rb_6v.UseVisualStyleBackColor = true;
732 | this.rb_6v.CheckedChanged += new System.EventHandler(this.rb_6v_CheckedChanged);
733 | //
734 | // rb_9or12v
735 | //
736 | this.rb_9or12v.AutoSize = true;
737 | this.rb_9or12v.Checked = true;
738 | this.rb_9or12v.Location = new System.Drawing.Point(7, 18);
739 | this.rb_9or12v.Name = "rb_9or12v";
740 | this.rb_9or12v.Size = new System.Drawing.Size(65, 17);
741 | this.rb_9or12v.TabIndex = 14;
742 | this.rb_9or12v.TabStop = true;
743 | this.rb_9or12v.Text = "9 or12 V";
744 | this.rb_9or12v.UseVisualStyleBackColor = true;
745 | this.rb_9or12v.CheckedChanged += new System.EventHandler(this.rb_9or12v_CheckedChanged);
746 | //
747 | // groupBox3
748 | //
749 | this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
750 | | System.Windows.Forms.AnchorStyles.Left)
751 | | System.Windows.Forms.AnchorStyles.Right)));
752 | this.groupBox3.Controls.Add(this.rtb);
753 | this.groupBox3.Location = new System.Drawing.Point(3, -1);
754 | this.groupBox3.Name = "groupBox3";
755 | this.groupBox3.Size = new System.Drawing.Size(643, 120);
756 | this.groupBox3.TabIndex = 0;
757 | this.groupBox3.TabStop = false;
758 | this.groupBox3.Text = "Log";
759 | //
760 | // rtb
761 | //
762 | this.rtb.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
763 | | System.Windows.Forms.AnchorStyles.Left)
764 | | System.Windows.Forms.AnchorStyles.Right)));
765 | this.rtb.Location = new System.Drawing.Point(6, 14);
766 | this.rtb.Name = "rtb";
767 | this.rtb.Size = new System.Drawing.Size(631, 99);
768 | this.rtb.TabIndex = 17;
769 | this.rtb.Text = "";
770 | //
771 | // timer1
772 | //
773 | this.timer1.Interval = 200;
774 | this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
775 | //
776 | // Form1
777 | //
778 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
779 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
780 | this.ClientSize = new System.Drawing.Size(649, 406);
781 | this.Controls.Add(this.splitContainer1);
782 | this.Controls.Add(this.statusStrip1);
783 | this.Controls.Add(this.menuStrip1);
784 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
785 | this.MainMenuStrip = this.menuStrip1;
786 | this.MinimumSize = new System.Drawing.Size(665, 445);
787 | this.Name = "Form1";
788 | this.Text = "HCS Programmer V0.2.8";
789 | this.groupBox1.ResumeLayout(false);
790 | this.groupBox1.PerformLayout();
791 | this.groupBox2.ResumeLayout(false);
792 | this.menuStrip1.ResumeLayout(false);
793 | this.menuStrip1.PerformLayout();
794 | this.statusStrip1.ResumeLayout(false);
795 | this.statusStrip1.PerformLayout();
796 | this.splitContainer1.Panel1.ResumeLayout(false);
797 | this.splitContainer1.Panel2.ResumeLayout(false);
798 | ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
799 | this.splitContainer1.ResumeLayout(false);
800 | this.groupBox5.ResumeLayout(false);
801 | this.groupBox4.ResumeLayout(false);
802 | this.groupBox4.PerformLayout();
803 | this.groupBox3.ResumeLayout(false);
804 | this.ResumeLayout(false);
805 | this.PerformLayout();
806 |
807 | }
808 |
809 | #endregion
810 |
811 | private System.Windows.Forms.GroupBox groupBox1;
812 | private System.Windows.Forms.GroupBox groupBox2;
813 | private System.Windows.Forms.MenuStrip menuStrip1;
814 | private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
815 | private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem;
816 | private System.IO.Ports.SerialPort serial_port;
817 | private System.Windows.Forms.StatusStrip statusStrip1;
818 | private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
819 | private System.Windows.Forms.Button btn_connect;
820 | private System.Windows.Forms.Button btn_update_port;
821 | private System.Windows.Forms.ComboBox cb_port;
822 | private System.Windows.Forms.SplitContainer splitContainer1;
823 | private System.Windows.Forms.GroupBox groupBox3;
824 | private System.Windows.Forms.RichTextBox rtb;
825 | private System.Windows.Forms.Label label1;
826 | private System.Windows.Forms.TextBox tb_key;
827 | private System.Windows.Forms.Button btn_gen_key;
828 | private System.Windows.Forms.TextBox tb_ser;
829 | private System.Windows.Forms.Label label2;
830 | private System.Windows.Forms.Button btn_gen_ser;
831 | private System.Windows.Forms.TextBox tb_sync;
832 | private System.Windows.Forms.Label label3;
833 | private System.Windows.Forms.TextBox tb_seed;
834 | private System.Windows.Forms.Label label4;
835 | private System.Windows.Forms.CheckBox cb_ovr_set;
836 | private System.Windows.Forms.GroupBox groupBox4;
837 | private System.Windows.Forms.RadioButton rb_6v;
838 | private System.Windows.Forms.RadioButton rb_9or12v;
839 | private System.Windows.Forms.GroupBox groupBox5;
840 | private System.Windows.Forms.ComboBox cb_br;
841 | private System.Windows.Forms.CheckBox cb_dis_auto;
842 | private System.Windows.Forms.TextBox tb_dis;
843 | private System.Windows.Forms.Label label5;
844 | private System.Windows.Forms.CheckBox cb_timer;
845 | private System.Windows.Forms.Button btn_write;
846 | private System.Windows.Forms.Timer timer1;
847 | private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
848 | private System.Windows.Forms.ToolStripMenuItem reportProblemToolStripMenuItem;
849 | private System.Windows.Forms.ToolStripMenuItem updateToolStripMenuItem;
850 | private System.Windows.Forms.ToolStripMenuItem contaToolStripMenuItem;
851 | private System.Windows.Forms.ToolStripMenuItem saveLogToolStripMenuItem;
852 | private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
853 | private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem;
854 | private System.Windows.Forms.ToolStripMenuItem sERToolStripMenuItem;
855 | private System.Windows.Forms.ToolStripMenuItem discriminationToolStripMenuItem;
856 | private System.Windows.Forms.ToolStripMenuItem bitToolStripMenuItem;
857 | private System.Windows.Forms.ToolStripMenuItem bitToolStripMenuItem1;
858 | private System.Windows.Forms.Label label6;
859 | private System.Windows.Forms.TextBox tb_mf;
860 | private System.Windows.Forms.ToolStripMenuItem learnModeToolStripMenuItem;
861 | private System.Windows.Forms.ToolStripMenuItem simpleLearningToolStripMenuItem;
862 | private System.Windows.Forms.ToolStripMenuItem normalLearningToolStripMenuItem;
863 | private System.Windows.Forms.ToolStripMenuItem secureLearnToolStripMenuItem;
864 | private System.Windows.Forms.Button btn_mc_clc;
865 | private System.Windows.Forms.Button btn_pp;
866 | private System.Windows.Forms.ToolStripMenuItem noneToolStripMenuItem;
867 | private System.Windows.Forms.Button btn_gen_seed;
868 | private System.Windows.Forms.Button btn_mc_gen;
869 | private System.Windows.Forms.ToolStripMenuItem deviceToolStripMenuItem;
870 | private System.Windows.Forms.ToolStripMenuItem hCS301ToolStripMenuItem;
871 | private System.Windows.Forms.ToolStripMenuItem hCS300ToolStripMenuItem;
872 | private System.Windows.Forms.ToolStripMenuItem hCS200ToolStripMenuItem;
873 | private System.Windows.Forms.ToolStripMenuItem bitToolStripMenuItem2;
874 | }
875 | }
876 |
877 |
--------------------------------------------------------------------------------
/Form1.cs:
--------------------------------------------------------------------------------
1 | /*
2 | HCS Programmer Soft
3 | By Liyanboy74
4 |
5 | https://github.com/liyanboy74
6 | https://github.com/liyanboy74/KeeLoq
7 | https://github.com/hnhkj/documents/tree/master/KEELOQ/docs
8 | https://github.com/ihydrad/Keeloq-decrypt/tree/master/readme
9 | */
10 |
11 | using System;
12 | using System.Collections.Generic;
13 | using System.ComponentModel;
14 | using System.Data;
15 | using System.Drawing;
16 | using System.Linq;
17 | using System.Text;
18 | using System.Threading.Tasks;
19 | using System.Windows.Forms;
20 | using System.IO;
21 | using System.IO.Ports;
22 | using System.Diagnostics;
23 | using System.Globalization;
24 |
25 | namespace Programmer
26 | {
27 | public partial class Form1 : Form
28 | {
29 | string RxData;
30 | bool vbat_sel = true;
31 | bool ovr_set = true;
32 | bool bsl_0 = false, bsl_1 = false;
33 | bool ser_pp = false;
34 | int dc = 10;
35 | int learn_mode = 0;
36 |
37 | int tim1_c = 0;
38 | int[] Data = new int[12];
39 |
40 | public void print_log(string str)
41 | {
42 | string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
43 | str.Replace('\r', '\0');
44 | str.Replace('\n', '\0');
45 | rtb.AppendText(time + " " + str+ "\n");
46 | rtb.ScrollToCaret();
47 | }
48 |
49 | private void update_serial_port_list()
50 | {
51 | cb_port.Items.Clear();
52 | foreach (string str_getPortsName in SerialPort.GetPortNames())
53 | {
54 | cb_port.Items.Add(str_getPortsName);
55 | }
56 | print_log("COM Ports Reloaded");
57 | }
58 |
59 | public Form1()
60 | {
61 | InitializeComponent();
62 | update_serial_port_list();
63 | cb_br.SelectedIndex = 0;
64 | }
65 |
66 |
67 | private void btn_update_port_Click(object sender, EventArgs e)
68 | {
69 | update_serial_port_list();
70 | }
71 |
72 | public void get_dev_ver()
73 | {
74 |
75 | tim1_c = 0;
76 | timer1.Start();
77 | }
78 |
79 | private void btn_connect_Click(object sender, EventArgs e)
80 | {
81 | if (btn_connect.Text == "Connect")
82 | {
83 | try
84 | {
85 | serial_port.PortName = cb_port.Text;
86 |
87 | serial_port.Open();
88 |
89 | cb_port.Enabled = false;
90 | btn_update_port.Enabled = false;
91 |
92 | btn_connect.Text = "Disconect";
93 | print_log("Connected to " + serial_port.PortName);
94 | btn_write.Enabled = true;
95 |
96 | get_dev_ver();
97 | }
98 | catch (Exception err)
99 | {
100 | print_log("ERROR! " + err.Message);
101 | }
102 | }
103 | else
104 | {
105 |
106 | serial_port.Close();
107 |
108 | timer1.Stop();
109 | tim1_c = 0;
110 |
111 | btn_connect.Text = "Connect";
112 |
113 | cb_port.Enabled = true;
114 | btn_update_port.Enabled = true;
115 | print_log("Disconected");
116 | btn_write.Enabled = false;
117 | }
118 | }
119 |
120 | static Random random = new Random();
121 | public static string GetRandomHexNumber(int digits)
122 | {
123 | byte[] buffer = new byte[digits / 2];
124 | random.NextBytes(buffer);
125 | string result = String.Concat(buffer.Select(x => x.ToString("X2")).ToArray());
126 | if (digits % 2 == 0)
127 | return result;
128 | return result + random.Next(16).ToString("X");
129 | }
130 |
131 |
132 | private void btn_gen_Click(object sender, EventArgs e)
133 | {
134 | tb_key.Text = GetRandomHexNumber(16);
135 | print_log("KEY Generated "+tb_key.Text);
136 | }
137 |
138 | private void hex_KeyPress(object sender, KeyPressEventArgs e)
139 | {
140 | char c = e.KeyChar;
141 |
142 | if (c != '\b' && !((c <= 0x66 && c >= 61) || (c <= 0x46 && c >= 0x41) || (c >= 0x30 && c <= 0x39)))
143 | {
144 | e.Handled = true;
145 | }
146 | }
147 |
148 | private void tb_key_KeyPress(object sender, KeyPressEventArgs e)
149 | {
150 | hex_KeyPress(sender, e);
151 | }
152 |
153 | private void tb_ser_KeyPress(object sender, KeyPressEventArgs e)
154 | {
155 | hex_KeyPress(sender, e);
156 | }
157 |
158 | private void tb_sync_KeyPress(object sender, KeyPressEventArgs e)
159 | {
160 | hex_KeyPress(sender, e);
161 | }
162 |
163 | public void check_msb_ser()
164 | {
165 | if (tb_ser.Text.Length == 8)
166 | {
167 | int nser = 0;
168 | int ser = 0;
169 |
170 | ser = int.Parse(tb_ser.Text, System.Globalization.NumberStyles.HexNumber);
171 |
172 | if (cb_timer.Checked)
173 | {
174 | nser = (int)(ser | 0x80000000);
175 | }
176 | else
177 | {
178 | nser = (int)(ser & 0x7fffffff);
179 | }
180 | tb_ser.Text = nser.ToString("X").PadLeft(8, '0');
181 |
182 | if (cb_dis_auto.Checked)
183 | {
184 | int sser = int.Parse(tb_ser.Text, System.Globalization.NumberStyles.HexNumber);
185 | if(dc==10)
186 | {
187 | sser = sser & 0x3ff;
188 | tb_dis.Text = sser.ToString("X").PadLeft(3, '0');
189 | }
190 | else if(dc==8)
191 | {
192 | sser = sser & 0xff;
193 | tb_dis.Text = sser.ToString("X").PadLeft(2, '0');
194 | }
195 | else if (dc == 12)
196 | {
197 | sser = sser & 0xfff;
198 | tb_dis.Text = sser.ToString("X").PadLeft(3, '0');
199 | }
200 |
201 | }
202 | }
203 | }
204 |
205 | private void btn_gen_ser_Click(object sender, EventArgs e)
206 | {
207 | tb_ser.Text = GetRandomHexNumber(8);
208 | check_msb_ser();
209 | mc_clc();
210 |
211 | print_log("SER Generated " + tb_ser.Text);
212 | }
213 |
214 | private void tb_seed_KeyPress(object sender, KeyPressEventArgs e)
215 | {
216 | hex_KeyPress(sender, e);
217 | }
218 |
219 | private void rb_9or12v_CheckedChanged(object sender, EventArgs e)
220 | {
221 | if(rb_9or12v.Checked)
222 | {
223 | vbat_sel = true;
224 | }
225 | }
226 |
227 | private void rb_6v_CheckedChanged(object sender, EventArgs e)
228 | {
229 | if (rb_6v.Checked)
230 | {
231 | vbat_sel = false;
232 | }
233 | }
234 |
235 | private void cb_ovr_set_CheckedChanged(object sender, EventArgs e)
236 | {
237 | if(cb_ovr_set.Checked)
238 | {
239 | ovr_set = true;
240 | }
241 | else
242 | {
243 | ovr_set = false;
244 | }
245 | }
246 |
247 | private void tb_dis_KeyPress(object sender, KeyPressEventArgs e)
248 | {
249 | hex_KeyPress(sender, e);
250 | }
251 |
252 | private void cb_dis_auto_CheckedChanged(object sender, EventArgs e)
253 | {
254 | if(cb_dis_auto.Checked)
255 | {
256 | tb_dis.Enabled = false;
257 | check_msb_ser();
258 | }
259 | else
260 | {
261 | tb_dis.Enabled = true;
262 | }
263 | }
264 |
265 | private void tb_ser_TextChanged(object sender, EventArgs e)
266 | {
267 | check_msb_ser();
268 | }
269 |
270 | private void cb_timer_CheckedChanged(object sender, EventArgs e)
271 | {
272 | check_msb_ser();
273 | }
274 |
275 | private void tb_dis_TextChanged(object sender, EventArgs e)
276 | {
277 | if (tb_dis.Text.Length == 3) tb_dis.Text = tb_dis.Text.ToUpper();
278 | }
279 |
280 | private void tb_key_TextChanged(object sender, EventArgs e)
281 | {
282 | if (tb_key.Text.Length == 16) tb_key.Text=tb_key.Text.ToUpper();
283 | }
284 |
285 | private void tb_sync_TextChanged(object sender, EventArgs e)
286 | {
287 | if(tb_sync.Text.Length==4)
288 | {
289 | tb_sync.Text = tb_sync.Text.ToUpper();
290 | }
291 | }
292 |
293 | private void tb_seed_TextChanged(object sender, EventArgs e)
294 | {
295 | if(tb_seed.Text.Length==8)
296 | {
297 | tb_seed.Text = tb_seed.Text.ToUpper();
298 | }
299 | }
300 |
301 | public void decode_data()
302 | {
303 | Int64 key = Int64.Parse(tb_key.Text, System.Globalization.NumberStyles.HexNumber);
304 | Int32 ser = Int32.Parse(tb_ser.Text, System.Globalization.NumberStyles.HexNumber);
305 | int seed = int.Parse(tb_seed.Text, System.Globalization.NumberStyles.HexNumber);
306 | int sync = int.Parse(tb_sync.Text, System.Globalization.NumberStyles.HexNumber);
307 | int dis = int.Parse(tb_dis.Text, System.Globalization.NumberStyles.HexNumber);
308 |
309 |
310 | Data[0] = (int)((key >> (16 * 0)) & 0xffff);
311 | Data[1] = (int)((key >> (16 * 1)) & 0xffff);
312 | Data[2] = (int)((key >> (16 * 2)) & 0xffff);
313 | Data[3] = (int)((key >> (16 * 3)) & 0xffff);
314 |
315 | Data[4] = sync;
316 |
317 | Data[5] = 0;
318 |
319 | Data[6] = (int)((ser >> (16 * 0)) & 0xffff);
320 | Data[7] = (int)((ser >> (16 * 1)) & 0xffff);
321 |
322 | Data[8] = (int)((seed >> (16 * 0)) & 0xffff);
323 | Data[9] = (int)((seed >> (16 * 1)) & 0xffff);
324 |
325 | Data[10] = 0;
326 |
327 | if (hCS200ToolStripMenuItem.Checked == true)
328 | {
329 | Data[11] = ((bsl_0 ? 1 : 0) << 13) | ((vbat_sel ? 1 : 0) << 12) | dis;
330 | }
331 | else
332 | {
333 | Data[11] = ((bsl_1 ? 1 : 0) << 14) | ((bsl_0 ? 1 : 0) << 13) | ((vbat_sel ? 1 : 0) << 12) | ((ovr_set ? 1 : 0) << 11) | ((ovr_set ? 1 : 0) << 10) | dis;
334 | }
335 | }
336 |
337 | public void write_data()
338 | {
339 | int i;
340 | string ptolog = "WRITE ";
341 | byte[] buffer = new byte[2];
342 | buffer[0] = (byte)'>';
343 | serial_port.Write(buffer, 0, 1);
344 | for (i = 0; i < 12; i++)
345 | {
346 | buffer[0] = (byte)((Data[i] >> 8) & 0xff);
347 | buffer[1] = (byte)((Data[i] >> 0) & 0xff);
348 | serial_port.Write(buffer, 0, 2);
349 | ptolog += string.Format("{0,2:X2}{1,2:X2} ", buffer[0], buffer[1]);
350 | }
351 | print_log(ptolog);
352 | }
353 |
354 | private void btn_write_Click(object sender, EventArgs e)
355 | {
356 | if (serial_port.IsOpen)
357 | {
358 | try
359 | {
360 | decode_data();
361 | write_data();
362 | }
363 | catch (Exception err)
364 | {
365 | print_log("ERROR! " + err.Message);
366 | }
367 | }
368 | else print_log("ERROR! Serial Port not Open");
369 | }
370 |
371 | public void ser_pp_check()
372 | {
373 | uint ser = uint.Parse(tb_ser.Text, System.Globalization.NumberStyles.HexNumber);
374 | ser++;
375 | if (ser >= 0xffffffff) ser = 0;
376 | tb_ser.Text = ser.ToString("X").PadLeft(8,'0');
377 | check_msb_ser();
378 | print_log("SER Generated " + tb_ser.Text);
379 | mc_clc();
380 | }
381 |
382 | public void print_RxData_to_log(object sender, EventArgs e)
383 | {
384 | print_log(RxData);
385 | if (ser_pp)
386 | {
387 | if (RxData.Contains("Done"))
388 | {
389 | ser_pp_check();
390 | }
391 | }
392 | }
393 |
394 | public void print_RxData_to_Warning(object sender, EventArgs e)
395 | {
396 | print_log("WARNING! " + RxData);
397 | MessageBox.Show(RxData, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
398 | }
399 |
400 | public void print_RxData_to_error(object sender, EventArgs e)
401 | {
402 | print_log("ERROR! " + RxData);
403 | MessageBox.Show(RxData, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
404 | }
405 |
406 | public void print_RxData_to_info(object sender, EventArgs e)
407 | {
408 | print_log("INFO " + RxData);
409 | MessageBox.Show(RxData, "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
410 | }
411 |
412 | public void print_device_version(object sender, EventArgs e)
413 | {
414 | print_log("DEVICE " + RxData);
415 | timer1.Stop();
416 | }
417 |
418 | private void serial_port_DataReceived(object sender, SerialDataReceivedEventArgs e)
419 | {
420 | int ch = serial_port.ReadByte();
421 | if (ch == '<')
422 | {
423 | RxData = serial_port.ReadLine();
424 | this.Invoke(new EventHandler(print_RxData_to_log));
425 | }
426 | else if(ch=='w')
427 | {
428 | RxData = serial_port.ReadLine();
429 | this.Invoke(new EventHandler(print_RxData_to_Warning));
430 | }
431 | else if (ch == 'i')
432 | {
433 | RxData = serial_port.ReadLine();
434 | this.Invoke(new EventHandler(print_RxData_to_info));
435 | }
436 | else if (ch == 'e')
437 | {
438 | RxData = serial_port.ReadLine();
439 | this.Invoke(new EventHandler(print_RxData_to_error));
440 | }
441 | else if (ch == '!')
442 | {
443 |
444 | RxData = serial_port.ReadLine();
445 | this.Invoke(new EventHandler(print_device_version));
446 |
447 | }
448 | else serial_port.ReadExisting();
449 | }
450 |
451 | private void timer1_Tick(object sender, EventArgs e)
452 | {
453 | tim1_c++;
454 | if(tim1_c%3==0)
455 | {
456 | try
457 | {
458 | string TxData = "!";
459 | serial_port.WriteLine(TxData);
460 | }
461 | catch (Exception err)
462 | {
463 | print_log("ERROR! " + err.Message);
464 | }
465 | }
466 |
467 | if(tim1_c>11)
468 | {
469 | tim1_c = 0;
470 | timer1.Stop();
471 | print_log("WARNING! UNKNOWN Device");
472 | }
473 | }
474 |
475 | private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
476 | {
477 | System.Diagnostics.Process.Start("https://github.com/ioelectro/hcs-programmer-soft");
478 | }
479 |
480 | private void contaToolStripMenuItem_Click(object sender, EventArgs e)
481 | {
482 | System.Diagnostics.Process.Start("https://ioelectro.ir/contacts");
483 | }
484 |
485 | private void updateToolStripMenuItem_Click(object sender, EventArgs e)
486 | {
487 | System.Diagnostics.Process.Start("https://github.com/ioelectro/hcs-programmer-soft/releases");
488 | }
489 |
490 | private void reportProblemToolStripMenuItem_Click(object sender, EventArgs e)
491 | {
492 | System.Diagnostics.Process.Start("https://github.com/ioelectro/hcs-programmer-soft/issues");
493 | }
494 |
495 | private void exitToolStripMenuItem_Click(object sender, EventArgs e)
496 | {
497 | this.Close();
498 | }
499 |
500 | private void saveLogToolStripMenuItem_Click(object sender, EventArgs e)
501 | {
502 |
503 | SaveFileDialog saveFileDialog1 = new SaveFileDialog();
504 | saveFileDialog1.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*";
505 | saveFileDialog1.Title = "Save Log File";
506 |
507 | saveFileDialog1.FileName = DateTime.Now.ToString("yyyyMMddHHmmss");
508 |
509 | if(saveFileDialog1.ShowDialog()== DialogResult.OK)
510 | {
511 | // If the file name is not an empty string open it for saving.
512 | if (saveFileDialog1.FileName != "")
513 | {
514 | // Saves the Image via a FileStream created by the OpenFile method.
515 | System.IO.FileStream fs =
516 | (System.IO.FileStream)saveFileDialog1.OpenFile();
517 |
518 | for (int i = 0; i < rtb.Text.Length; i++)
519 | {
520 | fs.WriteByte((byte)rtb.Text[i]);
521 | }
522 |
523 | print_log("LOG Saved in " + fs.Name);
524 | fs.Close();
525 | }
526 | }
527 |
528 | }
529 |
530 | private void tb_key_KeyDown(object sender, KeyEventArgs e)
531 | {
532 | if (e.Control && e.KeyCode == Keys.C)
533 | {
534 | tb_key.Copy();
535 | e.SuppressKeyPress = true;
536 | }
537 | else if(e.Control&&e.KeyCode==Keys.A)
538 | {
539 | tb_key.SelectAll();
540 | e.SuppressKeyPress = true;
541 | }
542 | else if (e.Control && e.KeyCode == Keys.V)
543 | {
544 | tb_key.Paste();
545 | e.SuppressKeyPress = true;
546 | }
547 | else if (e.Control && e.KeyCode == Keys.X)
548 | {
549 | tb_key.Cut();
550 | e.SuppressKeyPress = true;
551 | }
552 | }
553 |
554 | private void tb_ser_KeyDown(object sender, KeyEventArgs e)
555 | {
556 | if (e.Control && e.KeyCode == Keys.C)
557 | {
558 | tb_ser.Copy();
559 | e.SuppressKeyPress = true;
560 | }
561 | else if (e.Control && e.KeyCode == Keys.A)
562 | {
563 | tb_ser.SelectAll();
564 | e.SuppressKeyPress = true;
565 | }
566 | else if (e.Control && e.KeyCode == Keys.V)
567 | {
568 | tb_ser.Paste();
569 | e.SuppressKeyPress = true;
570 | }
571 | else if (e.Control && e.KeyCode == Keys.X)
572 | {
573 | tb_ser.Cut();
574 | e.SuppressKeyPress = true;
575 | }
576 | }
577 |
578 | private void tb_sync_KeyDown(object sender, KeyEventArgs e)
579 | {
580 | if (e.Control && e.KeyCode == Keys.C)
581 | {
582 | tb_sync.Copy();
583 | e.SuppressKeyPress = true;
584 | }
585 | else if (e.Control && e.KeyCode == Keys.A)
586 | {
587 | tb_sync.SelectAll();
588 | e.SuppressKeyPress = true;
589 | }
590 | else if (e.Control && e.KeyCode == Keys.V)
591 | {
592 | tb_sync.Paste();
593 | e.SuppressKeyPress = true;
594 | }
595 | else if (e.Control && e.KeyCode == Keys.X)
596 | {
597 | tb_sync.Cut();
598 | e.SuppressKeyPress = true;
599 | }
600 | }
601 |
602 | private void tb_seed_KeyDown(object sender, KeyEventArgs e)
603 | {
604 | if (e.Control && e.KeyCode == Keys.C)
605 | {
606 | tb_seed.Copy();
607 | e.SuppressKeyPress = true;
608 | }
609 | else if (e.Control && e.KeyCode == Keys.A)
610 | {
611 | tb_seed.SelectAll();
612 | e.SuppressKeyPress = true;
613 | }
614 | else if (e.Control && e.KeyCode == Keys.V)
615 | {
616 | tb_seed.Paste();
617 | e.SuppressKeyPress = true;
618 | }
619 | else if (e.Control && e.KeyCode == Keys.X)
620 | {
621 | tb_seed.Cut();
622 | e.SuppressKeyPress = true;
623 | }
624 | }
625 |
626 | private void tb_dis_KeyDown(object sender, KeyEventArgs e)
627 | {
628 | if (e.Control && e.KeyCode == Keys.C)
629 | {
630 | tb_dis.Copy();
631 | e.SuppressKeyPress = true;
632 | }
633 | else if (e.Control && e.KeyCode == Keys.A)
634 | {
635 | tb_dis.SelectAll();
636 | e.SuppressKeyPress = true;
637 | }
638 | else if (e.Control && e.KeyCode == Keys.V)
639 | {
640 | tb_dis.Paste();
641 | e.SuppressKeyPress = true;
642 | }
643 | else if (e.Control && e.KeyCode == Keys.X)
644 | {
645 | tb_dis.Cut();
646 | e.SuppressKeyPress = true;
647 | }
648 | }
649 |
650 | private void tb_mf_KeyDown(object sender, KeyEventArgs e)
651 | {
652 | if (e.Control && e.KeyCode == Keys.C)
653 | {
654 | tb_mf.Copy();
655 | e.SuppressKeyPress = true;
656 | }
657 | else if (e.Control && e.KeyCode == Keys.A)
658 | {
659 | tb_mf.SelectAll();
660 | e.SuppressKeyPress = true;
661 | }
662 | else if (e.Control && e.KeyCode == Keys.V)
663 | {
664 | tb_mf.Paste();
665 | e.SuppressKeyPress = true;
666 | }
667 | else if (e.Control && e.KeyCode == Keys.X)
668 | {
669 | tb_mf.Cut();
670 | e.SuppressKeyPress = true;
671 | }
672 | }
673 |
674 | private void sERToolStripMenuItem_Click(object sender, EventArgs e)
675 | {
676 | if (sERToolStripMenuItem.Checked == false)
677 | {
678 | sERToolStripMenuItem.Checked = true;
679 | ser_pp = true;
680 | }
681 | else
682 | {
683 | sERToolStripMenuItem.Checked = false;
684 | ser_pp = false;
685 | }
686 | }
687 |
688 | void set_dc(int value)
689 | {
690 | dc = value;
691 | if(dc==12)
692 | {
693 | bitToolStripMenuItem2.Checked = true;
694 | bitToolStripMenuItem1.Checked = false;
695 | bitToolStripMenuItem.Checked = false;
696 | }
697 | else if(dc==10)
698 | {
699 | bitToolStripMenuItem2.Checked = false;
700 | bitToolStripMenuItem1.Checked = true;
701 | bitToolStripMenuItem.Checked = false;
702 | }
703 | else if(dc==8)
704 | {
705 | bitToolStripMenuItem2.Checked = false;
706 | bitToolStripMenuItem1.Checked = false;
707 | bitToolStripMenuItem.Checked = true;
708 | }
709 |
710 | if (cb_dis_auto.Checked) check_msb_ser();
711 | }
712 | private void bitToolStripMenuItem2_Click(object sender, EventArgs e) // 11Bit
713 | {
714 | set_dc(12);
715 | }
716 |
717 |
718 | private void bitToolStripMenuItem1_Click(object sender, EventArgs e) // 10 Bit
719 | {
720 | set_dc(10);
721 | }
722 |
723 | private void bitToolStripMenuItem_Click(object sender, EventArgs e) //8 Bit
724 | {
725 | set_dc(8);
726 | }
727 |
728 | private void noneToolStripMenuItem_Click(object sender, EventArgs e)
729 | {
730 | learn_mode = 0;
731 | noneToolStripMenuItem.Checked = true;
732 | simpleLearningToolStripMenuItem.Checked = false;
733 | normalLearningToolStripMenuItem.Checked = false;
734 | secureLearnToolStripMenuItem.Checked = false;
735 |
736 | tb_mf.Enabled = false;
737 | btn_mc_clc.Enabled = false;
738 | btn_mc_gen.Enabled = false;
739 |
740 |
741 | tb_seed.Enabled = true;
742 | btn_gen_seed.Enabled = true;
743 |
744 | tb_key.Enabled = true;
745 | btn_gen_key.Enabled = true;
746 | }
747 |
748 |
749 | private void simpleLearningToolStripMenuItem_Click(object sender, EventArgs e)
750 | {
751 | learn_mode = 1;
752 | noneToolStripMenuItem.Checked = false;
753 | simpleLearningToolStripMenuItem.Checked = true;
754 | normalLearningToolStripMenuItem.Checked = false;
755 | secureLearnToolStripMenuItem.Checked = false;
756 |
757 | tb_mf.Enabled = false;
758 | btn_mc_clc.Enabled = false;
759 | btn_mc_gen.Enabled = false;
760 |
761 |
762 | tb_seed.Enabled = false;
763 | btn_gen_seed.Enabled = false;
764 | tb_seed.Text = "00000000";
765 |
766 | tb_key.Enabled = true;
767 | btn_gen_key.Enabled = true;
768 | }
769 |
770 | private void normalLearningToolStripMenuItem_Click(object sender, EventArgs e)
771 | {
772 | learn_mode = 2;
773 | noneToolStripMenuItem.Checked = false;
774 | simpleLearningToolStripMenuItem.Checked = false;
775 | normalLearningToolStripMenuItem.Checked = true;
776 | secureLearnToolStripMenuItem.Checked = false;
777 |
778 | tb_mf.Enabled = true;
779 | btn_mc_clc.Enabled = true;
780 | btn_mc_gen.Enabled = true;
781 |
782 | tb_seed.Enabled = false;
783 | btn_gen_seed.Enabled = false;
784 | tb_seed.Text = "00000000";
785 |
786 | tb_key.Enabled = false;
787 | btn_gen_key.Enabled = false;
788 | }
789 |
790 | private void secureLearnToolStripMenuItem_Click(object sender, EventArgs e)
791 | {
792 | learn_mode = 3;
793 | noneToolStripMenuItem.Checked = false;
794 | simpleLearningToolStripMenuItem.Checked = false;
795 | normalLearningToolStripMenuItem.Checked = false;
796 | secureLearnToolStripMenuItem.Checked = true;
797 |
798 | tb_mf.Enabled = true;
799 | btn_mc_clc.Enabled = true;
800 | btn_mc_gen.Enabled = true;
801 |
802 |
803 | tb_seed.Enabled = true;
804 | btn_gen_seed.Enabled = true;
805 |
806 | tb_key.Enabled = false;
807 | btn_gen_key.Enabled = false;
808 | }
809 |
810 | public static byte[] StringToByteArray(string hex)
811 | {
812 | return Enumerable.Range(0, hex.Length)
813 | .Where(x => x % 2 == 0)
814 | .Select(x => Convert.ToByte(hex.Substring(x, 2), 16))
815 | .ToArray();
816 | }
817 |
818 | const UInt16 KEELOQ_NROUNDS = 528;
819 | const UInt32 NLF_LOOKUP_CONSTANT = 0x3a5c742e;
820 |
821 | public UInt16 nlf(UInt16 d)
822 | {
823 | return (UInt16)(((UInt32)(NLF_LOOKUP_CONSTANT) >> d) & 0x1);
824 | }
825 |
826 | /*
827 | public UInt32 keeloq_encrypt(UInt64 key, UInt32 plaintext, UInt16 nrounds)
828 | {
829 | UInt32 ciphertext;
830 | UInt16 o, xor, nlf_input,i,k,ki;
831 | ciphertext = plaintext;
832 | for (i = 0; i < nrounds; i++)
833 | {
834 | nlf_input = (UInt16)(((ciphertext >> 31) & 0x1) << 4);
835 | nlf_input |= (UInt16)(((ciphertext >> 26) & 0x1) << 3);
836 | nlf_input |= (UInt16) (((ciphertext >> 20) & 0x1) << 2);
837 | nlf_input |= (UInt16)(((ciphertext >> 9) & 0x1) << 1);
838 | nlf_input |= (UInt16)((ciphertext >> 1) & 0x1);
839 |
840 | o = nlf(nlf_input);
841 |
842 | ki =(UInt16)( i % 64);
843 |
844 | k = (UInt16)(( key >> ki) & 0x1);
845 |
846 | xor = (UInt16)(k ^ ((ciphertext >> 16) & 0x1) ^ (ciphertext & 0x1) ^ o);
847 | ciphertext = (ciphertext >> 1) | ((UInt32)(xor) << 31);
848 | }
849 | return ciphertext;
850 | }
851 | */
852 |
853 | public UInt32 keeloq_decrypt(UInt64 key, UInt32 ciphertext, UInt16 nrounds)
854 | {
855 | UInt32 plaintext;
856 | UInt16 o, xor, nlf_input,i,k,ki;
857 | plaintext = ciphertext;
858 | for (i = 0; i < nrounds; i++)
859 | {
860 | nlf_input = (UInt16)(((plaintext >> 30) & 0x1) << 4);
861 | nlf_input |= (UInt16)(((plaintext >> 25) & 0x1) << 3);
862 | nlf_input |= (UInt16)(((plaintext >> 19) & 0x1) << 2);
863 | nlf_input |= (UInt16)(((plaintext >> 8) & 0x1) << 1);
864 | nlf_input |= (UInt16)(plaintext & 0x1);
865 |
866 | o = nlf(nlf_input);
867 |
868 | ki = (UInt16)((15 - i) % 64);
869 |
870 | k = (UInt16)((key >> ki) & 0x1);
871 |
872 | xor =(UInt16) (k ^ ((plaintext >> 31) & 0x1) ^ ((plaintext >> 15) & 0x1) ^ o);
873 | plaintext = (plaintext << 1) | xor;
874 | }
875 | return plaintext;
876 | }
877 |
878 |
879 | public ulong gen_normal_key(ulong mf_key,UInt32 ser)
880 | {
881 | ulong ret = 0;
882 | UInt32 temp;
883 |
884 | ser &= 0x0fffffff;// mask out function codes
885 |
886 | temp = ser;
887 | temp |= 0x20000000;
888 | ret = keeloq_decrypt(mf_key, temp, KEELOQ_NROUNDS);
889 |
890 | temp = ser;
891 | temp |= 0x60000000;
892 | ret |= ((UInt64)keeloq_decrypt(mf_key,temp,KEELOQ_NROUNDS)<<32);
893 |
894 | return ret;
895 | }
896 |
897 | public ulong gen_secure_key(ulong mf_key,UInt32 seed,UInt32 ser)
898 | {
899 | ulong ret = 0;
900 |
901 | ret = keeloq_decrypt(mf_key, seed, KEELOQ_NROUNDS);
902 | ser &= 0x0fffffff;
903 | ret |= ((UInt64)keeloq_decrypt(mf_key, ser, KEELOQ_NROUNDS) << 32);
904 |
905 | return ret;
906 | }
907 |
908 | public void mc_clc()
909 | {
910 | if (learn_mode>1)
911 | {
912 | UInt64 mkey = UInt64.Parse(tb_mf.Text, System.Globalization.NumberStyles.HexNumber);
913 | UInt32 ser = UInt32.Parse(tb_ser.Text, System.Globalization.NumberStyles.HexNumber);
914 | UInt32 seed = UInt32.Parse(tb_seed.Text, System.Globalization.NumberStyles.HexNumber);
915 |
916 | ulong hash = 0;
917 |
918 | if (learn_mode==2)
919 | {
920 | hash = gen_normal_key(mkey, ser);
921 | }
922 | else if(learn_mode==3)
923 | {
924 | hash = gen_secure_key(mkey, seed,ser);
925 | }
926 |
927 |
928 | tb_key.Text = hash.ToString("X").PadLeft(16, '0');
929 | print_log("KEY Generated " + tb_key.Text);
930 | }
931 | }
932 |
933 | private void btn_mc_clc_Click(object sender, EventArgs e)
934 | {
935 | mc_clc();
936 | }
937 |
938 | private void btn_pp_Click(object sender, EventArgs e)
939 | {
940 | ser_pp_check();
941 | }
942 |
943 | private void tb_mf_KeyPress(object sender, KeyPressEventArgs e)
944 | {
945 | hex_KeyPress(sender, e);
946 | }
947 |
948 | private void tb_mf_TextChanged(object sender, EventArgs e)
949 | {
950 | if (tb_mf.Text.Length == 16) tb_mf.Text = tb_mf.Text.ToUpper();
951 | }
952 |
953 | private void btn_gen_seed_Click(object sender, EventArgs e)
954 | {
955 | tb_seed.Text = GetRandomHexNumber(8);
956 | print_log("SEED Generated " + tb_seed.Text);
957 |
958 | mc_clc();
959 |
960 | }
961 |
962 | private void btn_mc_gen_Click(object sender, EventArgs e)
963 | {
964 | tb_mf.Text = GetRandomHexNumber(16);
965 | print_log("Manufacturer Code Generated " + tb_mf.Text);
966 | }
967 |
968 | private void hCS301ToolStripMenuItem_Click(object sender, EventArgs e)
969 | {
970 | hCS301ToolStripMenuItem.Checked = true;
971 | hCS300ToolStripMenuItem.Checked = false;
972 | hCS200ToolStripMenuItem.Checked = false;
973 |
974 | cb_ovr_set.Checked = true;
975 | cb_ovr_set.Enabled = true;
976 |
977 | rb_9or12v.Text= "9 or 12 V";
978 | rb_6v.Text= "6 V";
979 |
980 | string[] obj = new string[] { "00 400uS ALL", "01 200uS 1 / 2", "10 100uS 1 / 2", "11 100uS 1 / 4" };
981 | cb_br.Items.Clear();
982 | cb_br.Items.AddRange(obj);
983 | cb_br.SelectedIndex = 0;
984 |
985 | set_dc(10);
986 | }
987 |
988 | private void hCS300ToolStripMenuItem_Click(object sender, EventArgs e)
989 | {
990 | hCS301ToolStripMenuItem.Checked = false;
991 | hCS300ToolStripMenuItem.Checked = true;
992 | hCS200ToolStripMenuItem.Checked = false;
993 |
994 | cb_ovr_set.Checked = true;
995 | cb_ovr_set.Enabled = true;
996 |
997 | rb_9or12v.Text = "5 or 6 V";
998 | rb_6v.Text = "3.0 V";
999 |
1000 | string[] obj = new string[] { "00 400uS ALL", "01 200uS 1 / 2", "10 100uS 1 / 2", "11 100uS 1 / 4" };
1001 | cb_br.Items.Clear();
1002 | cb_br.Items.AddRange(obj);
1003 | cb_br.SelectedIndex = 0;
1004 |
1005 | set_dc(10);
1006 | }
1007 |
1008 | private void hCS200ToolStripMenuItem_Click(object sender, EventArgs e)
1009 | {
1010 | hCS301ToolStripMenuItem.Checked = false;
1011 | hCS300ToolStripMenuItem.Checked = false;
1012 | hCS200ToolStripMenuItem.Checked = true;
1013 |
1014 | cb_ovr_set.Checked = false;
1015 | cb_ovr_set.Enabled = false;
1016 |
1017 | rb_9or12v.Text = "9 or 12 V";
1018 | rb_6v.Text = "6 V";
1019 |
1020 | string[] obj= new string[]{ "0 400uS ALL", "1 200uS 1 / 2" };
1021 | cb_br.Items.Clear();
1022 | cb_br.Items.AddRange(obj);
1023 | cb_br.SelectedIndex = 0;
1024 |
1025 | set_dc(12);
1026 |
1027 | }
1028 |
1029 |
1030 | private void cb_br_SelectedIndexChanged(object sender, EventArgs e)
1031 | {
1032 | switch(cb_br.SelectedIndex)
1033 | {
1034 | case 0: bsl_0 = false;bsl_1 = false;break;
1035 | case 1: bsl_0 = true; bsl_1 = false; break;
1036 | case 2: bsl_0 = false; bsl_1 = true; break;
1037 | case 3: bsl_0 = true; bsl_1 = true; break;
1038 | default:break;
1039 | }
1040 | }
1041 | }
1042 | }
1043 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 IOElectro
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace Programmer
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// The main entry point for the application.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new Form1());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Programmer.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {917791B5-231E-4832-9E8C-FE4E65DAC6FB}
8 | WinExe
9 | Programmer
10 | HCS-Programmer-v0.2.8
11 | v4.7.2
12 | 512
13 | true
14 | true
15 | false
16 | publish\
17 | true
18 | Disk
19 | false
20 | Foreground
21 | 7
22 | Days
23 | false
24 | false
25 | true
26 | 8
27 | 1.0.2.8
28 | false
29 | true
30 |
31 |
32 | AnyCPU
33 | true
34 | full
35 | false
36 | bin\Debug\
37 | DEBUG;TRACE
38 | prompt
39 | 4
40 |
41 |
42 | AnyCPU
43 | pdbonly
44 | true
45 | bin\Release\
46 | TRACE
47 | prompt
48 | 4
49 |
50 |
51 | programmer.ico
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 | Form
71 |
72 |
73 | Form1.cs
74 |
75 |
76 |
77 |
78 | Form1.cs
79 |
80 |
81 | ResXFileCodeGenerator
82 | Resources.Designer.cs
83 | Designer
84 |
85 |
86 | True
87 | Resources.resx
88 |
89 |
90 | SettingsSingleFileGenerator
91 | Settings.Designer.cs
92 |
93 |
94 | True
95 | Settings.settings
96 | True
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 | False
105 | Microsoft .NET Framework 4.7.2 %28x86 and x64%29
106 | true
107 |
108 |
109 | False
110 | .NET Framework 3.5 SP1
111 | false
112 |
113 |
114 |
115 |
116 |
117 |
118 |
--------------------------------------------------------------------------------
/Programmer.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.30330.147
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Programmer", "Programmer.csproj", "{917791B5-231E-4832-9E8C-FE4E65DAC6FB}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {917791B5-231E-4832-9E8C-FE4E65DAC6FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {917791B5-231E-4832-9E8C-FE4E65DAC6FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {917791B5-231E-4832-9E8C-FE4E65DAC6FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {917791B5-231E-4832-9E8C-FE4E65DAC6FB}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {12188F2C-4CF4-42EF-8865-F130D146FADF}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("HCS301 Programmer")]
9 | [assembly: AssemblyDescription("Application for programming HCS301 EEPROM Code Hopping")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("IOElectro")]
12 | [assembly: AssemblyProduct("Programmer")]
13 | [assembly: AssemblyCopyright("Copyright © 2022")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("917791b5-231e-4832-9e8c-fe4e65dac6fb")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("0.1.0.0")]
36 | [assembly: AssemblyFileVersion("0.1.0.0")]
37 |
--------------------------------------------------------------------------------
/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Programmer.Properties
12 | {
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// Returns the cached ResourceManager instance used by this class.
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Programmer.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// Overrides the current thread's CurrentUICulture property for all
56 | /// resource lookups using this strongly typed resource class.
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Programmer.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # HCS Programmer Software
2 | An open source application for programming HCS EEPROM Code Hopping.
3 | Support keeloq key generation from manufacturer code for Simple, Normal and Secure learning algorithm.
4 |
5 | **Supported device:**
6 | - HCS301
7 | - HCS300
8 | - HCS200
9 |
10 | 
11 | ## Download
12 | **[Download latest release](https://github.com/ioelectro/hcs-programmer-soft/releases)**
13 |
14 | *Required .NET Framework 4.7.2 or Upper.*
15 |
16 | ## Description
17 | This software requires an interface hardware that can write information to the HCS.The information is sent to the interface via the com port using a usb to serial converter.
18 |
19 | ### Hardware
20 | Any hardware that supports UART serial communication can be used as an interface and hardware. For example, ARDUINO PIC AVR STM8 are a good choice.
21 |
22 | - [Arduino HCS Programmer](https://github.com/ioelectro/arduino-hcs-programmer)
23 |
24 | ### Protocol
25 | `UART`,`8 Data`,`1 StopBit`,`No Parity`,`BaudRate 9600`
26 |
27 | ### Transmit
28 | - Device identification *(Optional)*
29 | - Information to be programmed
30 |
31 |
32 | #### Device identification
33 | Immediately after opening the port, the software sends the character `!` and if it does not receive a response, it does so up to three times.
34 | response must send at below format:
35 | `!` `DEVICE-NAME-(STRING)` `\n`
36 |
37 | #### Information to be programmed
38 | According to the information in the HCS datasheet, 12 WORD 16-bit should be set.
39 | The sending packet contains 25 bytes that are sent as follows:
40 | `>` `WORD0` `WORD1` `WORD2` `WORD3` `WORD4` `WORD5` `WORD6` `WORD7` `WORD8` `WORD9` `WORD10` `WORD11`
41 |
42 | Sending this package does not require a response. Instead, the programmer can display the result, error or any message that is described in the following section.
43 |
44 | ### Receive
45 | The received packages consist of three main sections, which are shown below:
46 | `TYPE-(Char)` `MESSAGE-(STRING)` `\n`
47 |
48 | #### Packet TYPE
49 | - Log `<`
50 | - Info `i`
51 | - Warning `w`
52 | - Error `e`
53 |
54 | #### Example
55 | Print data to log:
56 | `<` `HELLO` `\n`
57 |
58 | Show Warning message:
59 | `w` `Warning!` `\n`
60 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/programmer.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ioelectro/hcs-programmer-soft/802fef8b24feac62812d0e3b62097f0a92a4ec69/programmer.ico
--------------------------------------------------------------------------------