Skip to content
This repository was archived by the owner on Jan 16, 2020. It is now read-only.

Commit c54eacb

Browse files
committed
Spring Cleaning
Remove unnecessary casts/parenthesis, readonly attributes that are only set during initialization, private variables that are only used within class, remove references that are not needed, added template .git files
1 parent 88a4b7a commit c54eacb

18 files changed

+681
-508
lines changed

.gitattributes

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto
3+
4+
# Custom for Visual Studio
5+
*.cs diff=csharp
6+
*.sln merge=union
7+
*.csproj merge=union
8+
*.vbproj merge=union
9+
*.fsproj merge=union
10+
*.dbproj merge=union
11+
12+
# Standard to msysgit
13+
*.doc diff=astextplain
14+
*.DOC diff=astextplain
15+
*.docx diff=astextplain
16+
*.DOCX diff=astextplain
17+
*.dot diff=astextplain
18+
*.DOT diff=astextplain
19+
*.pdf diff=astextplain
20+
*.PDF diff=astextplain
21+
*.rtf diff=astextplain
22+
*.RTF diff=astextplain

.gitignore

+243
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
1+
#################
2+
## Eclipse
3+
#################
4+
5+
*.pydevproject
6+
.project
7+
.metadata
8+
bin/
9+
tmp/
10+
*.tmp
11+
*.bak
12+
*.swp
13+
*~.nib
14+
local.properties
15+
.classpath
16+
.settings/
17+
.loadpath
18+
19+
# External tool builders
20+
.externalToolBuilders/
21+
22+
# Locally stored "Eclipse launch configurations"
23+
*.launch
24+
25+
# CDT-specific
26+
.cproject
27+
28+
# PDT-specific
29+
.buildpath
30+
31+
32+
#################
33+
## Visual Studio
34+
#################
35+
36+
## Ignore Visual Studio temporary files, build results, and
37+
## files generated by popular Visual Studio add-ons.
38+
39+
# User-specific files
40+
*.suo
41+
*.user
42+
*.sln.docstates
43+
44+
# Build results
45+
46+
[Dd]ebug/
47+
[Rr]elease/
48+
x64/
49+
build/
50+
[Bb]in/
51+
[Oo]bj/
52+
53+
# MSTest test Results
54+
[Tt]est[Rr]esult*/
55+
[Bb]uild[Ll]og.*
56+
57+
*_i.c
58+
*_p.c
59+
*.ilk
60+
*.meta
61+
*.obj
62+
*.pch
63+
*.pdb
64+
*.pgc
65+
*.pgd
66+
*.rsp
67+
*.sbr
68+
*.tlb
69+
*.tli
70+
*.tlh
71+
*.tmp
72+
*.tmp_proj
73+
*.log
74+
*.vspscc
75+
*.vssscc
76+
.builds
77+
*.pidb
78+
*.log
79+
*.scc
80+
81+
# Visual C++ cache files
82+
ipch/
83+
*.aps
84+
*.ncb
85+
*.opensdf
86+
*.sdf
87+
*.cachefile
88+
89+
# Visual Studio profiler
90+
*.psess
91+
*.vsp
92+
*.vspx
93+
94+
# Guidance Automation Toolkit
95+
*.gpState
96+
97+
# ReSharper is a .NET coding add-in
98+
_ReSharper*/
99+
*.[Rr]e[Ss]harper
100+
101+
# TeamCity is a build add-in
102+
_TeamCity*
103+
104+
# DotCover is a Code Coverage Tool
105+
*.dotCover
106+
107+
# NCrunch
108+
*.ncrunch*
109+
.*crunch*.local.xml
110+
111+
# Installshield output folder
112+
[Ee]xpress/
113+
114+
# DocProject is a documentation generator add-in
115+
DocProject/buildhelp/
116+
DocProject/Help/*.HxT
117+
DocProject/Help/*.HxC
118+
DocProject/Help/*.hhc
119+
DocProject/Help/*.hhk
120+
DocProject/Help/*.hhp
121+
DocProject/Help/Html2
122+
DocProject/Help/html
123+
124+
# Click-Once directory
125+
publish/
126+
127+
# Publish Web Output
128+
*.Publish.xml
129+
*.pubxml
130+
131+
# NuGet Packages Directory
132+
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
133+
#packages/
134+
135+
# Windows Azure Build Output
136+
csx
137+
*.build.csdef
138+
139+
# Windows Store app package directory
140+
AppPackages/
141+
142+
# Others
143+
sql/
144+
*.Cache
145+
ClientBin/
146+
[Ss]tyle[Cc]op.*
147+
~$*
148+
*~
149+
*.dbmdl
150+
*.[Pp]ublish.xml
151+
*.pfx
152+
*.publishsettings
153+
154+
# RIA/Silverlight projects
155+
Generated_Code/
156+
157+
# Backup & report files from converting an old project file to a newer
158+
# Visual Studio version. Backup files are not needed, because we have git ;-)
159+
_UpgradeReport_Files/
160+
Backup*/
161+
UpgradeLog*.XML
162+
UpgradeLog*.htm
163+
164+
# SQL Server files
165+
App_Data/*.mdf
166+
App_Data/*.ldf
167+
168+
169+
#############
170+
## Qt Creator
171+
#############
172+
173+
*.save
174+
*.autosave
175+
176+
#############
177+
## GNU Emacs
178+
#############
179+
180+
\#*
181+
.\#*
182+
*.elc
183+
184+
185+
#############
186+
## Windows detritus
187+
#############
188+
189+
# Windows image file caches
190+
Thumbs.db
191+
ehthumbs.db
192+
193+
# Folder config file
194+
Desktop.ini
195+
196+
# Recycle Bin used on file shares
197+
$RECYCLE.BIN/
198+
199+
200+
#############
201+
## OS X
202+
#############
203+
204+
.DS_Store
205+
206+
207+
#############
208+
## C#
209+
#############
210+
211+
*.resources
212+
213+
214+
#############
215+
## Python
216+
#############
217+
218+
*.py[co]
219+
220+
# Packages
221+
*.egg
222+
*.egg-info
223+
dist/
224+
build/
225+
eggs/
226+
parts/
227+
var/
228+
sdist/
229+
develop-eggs/
230+
.installed.cfg
231+
232+
# Installer logs
233+
pip-log.txt
234+
235+
# Unit test / coverage reports
236+
.coverage
237+
.tox
238+
239+
# Translations
240+
*.mo
241+
242+
# Mr Developer
243+
.mr.developer.cfg

Rhydon/Encoding.cs

+9-12
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
using System;
2-
using System.Linq;
1+
using System.Linq;
32
using System.Text;
43

54
namespace Rhydon
65
{
7-
public class RBY_Encoding
6+
public static class RBY_Encoding
87
{
9-
internal const byte CHAR_INVALID = 0xFF;
10-
internal const byte CHAR_TRAINER = 0xFE;
11-
internal const byte CHAR_PK_NUM = 0x7B;
12-
internal const byte CHAR_MN_NUM = 0x7D;
8+
private const byte CHAR_INVALID = 0xFF;
9+
private const byte CHAR_TRAINER = 0xFE;
10+
private const byte CHAR_PK_NUM = 0x7B;
11+
private const byte CHAR_MN_NUM = 0x7D;
1312
internal const byte CHAR_MAL_NUM = 0x7E;
1413
internal const byte CHAR_FEM_NUM = 0x60;
1514

@@ -35,12 +34,12 @@ public static byte[] GetBytes(string s)
3534
s = FixString(s);
3635
if (s == "[TRAINER]")
3736
return new[] { ASCII_To_RBY[CHAR_TRAINER] };
38-
return s.Select(c => ASCII_To_RBY[(int)c]).Concat(new[] { (byte)0x50 }).ToArray();
37+
return s.Select(c => ASCII_To_RBY[c]).Concat(new[] { (byte)0x50 }).ToArray();
3938
}
4039

4140
public static bool Validate(string s)
4241
{
43-
return !s.Any(c => ((int)c > 0xFF) || (ASCII_To_RBY[(int)c] == 0));
42+
return !s.Any(c => c > 0xFF || ASCII_To_RBY[c] == 0);
4443
}
4544

4645
public static string FixString(string s)
@@ -315,7 +314,7 @@ public static string FixString(string s)
315314
0x00 /* 0xFF */
316315
};
317316

318-
internal static readonly byte[] RBY_To_ASCII = new[] {
317+
internal static readonly byte[] RBY_To_ASCII = {
319318
CHAR_INVALID, /* 0x00 */
320319
CHAR_INVALID, /* 0x01 */
321320
CHAR_INVALID, /* 0x02 */
@@ -574,7 +573,5 @@ public static string FixString(string s)
574573
(byte) '9' /* 0xFF */
575574
};
576575
#endregion
577-
578576
}
579-
580577
}

Rhydon/ItemList.cs

+6-15
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,26 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading;
6-
using System.Threading.Tasks;
72

83
namespace Rhydon
94
{
105
public class ItemList
116
{
12-
private int Capacity;
7+
private readonly int Capacity;
138
private int Count;
149

15-
private ItemEntry[] items;
10+
private readonly ItemEntry[] items;
1611

1712
public ItemList(byte[] Source, int c)
1813
{
1914
Capacity = c;
2015
Count = Source[0];
21-
Count = Source[0];
2216
if (Count > Capacity)
23-
throw new ArgumentOutOfRangeException("Invalid Item List (count > Capacity)");
17+
throw new ArgumentOutOfRangeException();
2418
items = new ItemEntry[Capacity];
2519
for (int i = 0; i < Capacity; i++)
2620
{
27-
if (i < Count)
28-
items[i] = new ItemEntry(Source[1 + 2*i], Source[2 + 2*i]);
29-
else
30-
{
31-
items[i] = new ItemEntry(0, 0);
32-
}
21+
items[i] = i < Count
22+
? new ItemEntry(Source[1 + 2*i], Source[2 + 2*i])
23+
: new ItemEntry(0, 0);
3324
}
3425
}
3526

0 commit comments

Comments
 (0)