Skip to content

Instantly share code, notes, and snippets.

@Cellane
Created October 12, 2012 12:09
Show Gist options
  • Save Cellane/3878906 to your computer and use it in GitHub Desktop.
Save Cellane/3878906 to your computer and use it in GitHub Desktop.
Only in /Volumes/BOOTCAMP/Users/Milan/Documents/Visual Studio 2010/Projects/HitTheKeys/HitTheKeys: Form1.Designer.cs
diff -ur Downloads/HeadFirstCSharp_All_Code/HFC#_ch4/p160 - Hit the keys/p160 - Hit the keys/Form1.cs /Volumes/BOOTCAMP/Users/Milan/Documents/Visual Studio 2010/Projects/HitTheKeys/HitTheKeys/Form1.cs
--- Downloads/HeadFirstCSharp_All_Code/HFC#_ch4/p160 - Hit the keys/p160 - Hit the keys/Form1.cs 2010-05-23 09:29:04.000000000 +0200
+++ /Volumes/BOOTCAMP/Users/Milan/Documents/Visual Studio 2010/Projects/HitTheKeys/HitTheKeys/Form1.cs 2012-10-11 13:57:37.000000000 +0200
@@ -7,7 +7,7 @@
using System.Text;
using System.Windows.Forms;
-namespace Hit_the_keys
+namespace HitTheKeys
{
public partial class Form1 : Form
{
@@ -21,8 +21,8 @@
private void timer1_Tick(object sender, EventArgs e)
{
- // Add a random key to the ListBox
- listBox1.Items.Add((Keys)random.Next(65, 90));
+ listBox1.Items.Add((Keys) random.Next(65, 90));
+
if (listBox1.Items.Count > 7)
{
listBox1.Items.Clear();
@@ -33,36 +33,38 @@
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
- // If the user pressed a key that's in the ListBox, remove it
- // and then make the game a little faster
if (listBox1.Items.Contains(e.KeyCode))
{
listBox1.Items.Remove(e.KeyCode);
listBox1.Refresh();
+
if (timer1.Interval > 400)
+ {
timer1.Interval -= 10;
+ }
+
if (timer1.Interval > 250)
+ {
timer1.Interval -= 7;
- if (timer1.Interval > 100)
+ }
+
+ if ( timer1.Interval > 100)
+ {
timer1.Interval -= 2;
- difficultyProgressBar.Value = 800 - timer1.Interval;
+ }
- // The user pressed a correct key, so update the Stats object
- // by calling its Update() method with the argument true
+ difficultyProgressBar.Value = 800 - timer1.Interval;
stats.Update(true);
}
else
{
- // The user pressed an incorrect key, so update the Stats object
- // by calling its Update() method with the argument false
stats.Update(false);
}
- // Update the labels on the StatusStrip
correctLabel.Text = "Correct: " + stats.Correct;
missedLabel.Text = "Missed: " + stats.Missed;
totalLabel.Text = "Total: " + stats.Total;
accuracyLabel.Text = "Accuracy: " + stats.Accuracy + "%";
}
}
-}
\ No newline at end of file
+}
Only in Downloads/HeadFirstCSharp_All_Code/HFC#_ch4/p160 - Hit the keys/p160 - Hit the keys/: Form1.designer.cs
diff -ur Downloads/HeadFirstCSharp_All_Code/HFC#_ch4/p160 - Hit the keys/p160 - Hit the keys/Form1.resx /Volumes/BOOTCAMP/Users/Milan/Documents/Visual Studio 2010/Projects/HitTheKeys/HitTheKeys/Form1.resx
--- Downloads/HeadFirstCSharp_All_Code/HFC#_ch4/p160 - Hit the keys/p160 - Hit the keys/Form1.resx 2010-05-23 09:29:04.000000000 +0200
+++ /Volumes/BOOTCAMP/Users/Milan/Documents/Visual Studio 2010/Projects/HitTheKeys/HitTheKeys/Form1.resx 2012-10-11 13:57:37.000000000 +0200
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
@@ -118,9 +118,9 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
- <value>133, 17</value>
+ <value>17, 17</value>
</metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
- <value>17, 17</value>
+ <value>104, 17</value>
</metadata>
</root>
\ No newline at end of file
Only in /Volumes/BOOTCAMP/Users/Milan/Documents/Visual Studio 2010/Projects/HitTheKeys/HitTheKeys: HitTheKeys.csproj
diff -ur Downloads/HeadFirstCSharp_All_Code/HFC#_ch4/p160 - Hit the keys/p160 - Hit the keys/Program.cs /Volumes/BOOTCAMP/Users/Milan/Documents/Visual Studio 2010/Projects/HitTheKeys/HitTheKeys/Program.cs
--- Downloads/HeadFirstCSharp_All_Code/HFC#_ch4/p160 - Hit the keys/p160 - Hit the keys/Program.cs 2010-05-15 13:40:32.000000000 +0200
+++ /Volumes/BOOTCAMP/Users/Milan/Documents/Visual Studio 2010/Projects/HitTheKeys/HitTheKeys/Program.cs 2012-10-11 13:24:21.000000000 +0200
@@ -3,7 +3,7 @@
using System.Linq;
using System.Windows.Forms;
-namespace Hit_the_keys
+namespace HitTheKeys
{
static class Program
{
diff -ur Downloads/HeadFirstCSharp_All_Code/HFC#_ch4/p160 - Hit the keys/p160 - Hit the keys/Properties/AssemblyInfo.cs /Volumes/BOOTCAMP/Users/Milan/Documents/Visual Studio 2010/Projects/HitTheKeys/HitTheKeys/Properties/AssemblyInfo.cs
--- Downloads/HeadFirstCSharp_All_Code/HFC#_ch4/p160 - Hit the keys/p160 - Hit the keys/Properties/AssemblyInfo.cs 2010-05-15 13:39:58.000000000 +0200
+++ /Volumes/BOOTCAMP/Users/Milan/Documents/Visual Studio 2010/Projects/HitTheKeys/HitTheKeys/Properties/AssemblyInfo.cs 2012-10-11 13:24:21.000000000 +0200
@@ -5,12 +5,12 @@
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
-[assembly: AssemblyTitle("p160 - Hit the keys")]
+[assembly: AssemblyTitle("HitTheKeys")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
-[assembly: AssemblyProduct("p160 - Hit the keys")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
+[assembly: AssemblyProduct("HitTheKeys")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -20,7 +20,7 @@
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("72ce0cf1-f507-4151-971a-95d35fef3fbf")]
+[assembly: Guid("bdc95738-9584-45cf-a4fd-4fa071188127")]
// Version information for an assembly consists of the following four values:
//
diff -ur Downloads/HeadFirstCSharp_All_Code/HFC#_ch4/p160 - Hit the keys/p160 - Hit the keys/Properties/Resources.Designer.cs /Volumes/BOOTCAMP/Users/Milan/Documents/Visual Studio 2010/Projects/HitTheKeys/HitTheKeys/Properties/Resources.Designer.cs
--- Downloads/HeadFirstCSharp_All_Code/HFC#_ch4/p160 - Hit the keys/p160 - Hit the keys/Properties/Resources.Designer.cs 2010-05-15 13:40:32.000000000 +0200
+++ /Volumes/BOOTCAMP/Users/Milan/Documents/Visual Studio 2010/Projects/HitTheKeys/HitTheKeys/Properties/Resources.Designer.cs 2012-10-11 13:24:21.000000000 +0200
@@ -8,10 +8,10 @@
// </auto-generated>
//------------------------------------------------------------------------------
-namespace Hit_the_keys.Properties {
- using System;
-
-
+namespace HitTheKeys.Properties
+{
+
+
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
@@ -22,40 +22,48 @@
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources {
-
+ internal class Resources
+ {
+
private static global::System.Resources.ResourceManager resourceMan;
-
+
private static global::System.Globalization.CultureInfo resourceCulture;
-
+
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources() {
+ internal Resources()
+ {
}
-
+
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Hit_the_keys.Properties.Resources", typeof(Resources).Assembly);
+ internal static global::System.Resources.ResourceManager ResourceManager
+ {
+ get
+ {
+ if ((resourceMan == null))
+ {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HitTheKeys.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
-
+
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
+ internal static global::System.Globalization.CultureInfo Culture
+ {
+ get
+ {
return resourceCulture;
}
- set {
+ set
+ {
resourceCulture = value;
}
}
diff -ur Downloads/HeadFirstCSharp_All_Code/HFC#_ch4/p160 - Hit the keys/p160 - Hit the keys/Properties/Settings.Designer.cs /Volumes/BOOTCAMP/Users/Milan/Documents/Visual Studio 2010/Projects/HitTheKeys/HitTheKeys/Properties/Settings.Designer.cs
--- Downloads/HeadFirstCSharp_All_Code/HFC#_ch4/p160 - Hit the keys/p160 - Hit the keys/Properties/Settings.Designer.cs 2010-05-15 13:40:32.000000000 +0200
+++ /Volumes/BOOTCAMP/Users/Milan/Documents/Visual Studio 2010/Projects/HitTheKeys/HitTheKeys/Properties/Settings.Designer.cs 2012-10-11 13:24:21.000000000 +0200
@@ -8,17 +8,21 @@
// </auto-generated>
//------------------------------------------------------------------------------
-namespace Hit_the_keys.Properties {
-
-
+namespace HitTheKeys.Properties
+{
+
+
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
- internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
-
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+ {
+
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
- public static Settings Default {
- get {
+
+ public static Settings Default
+ {
+ get
+ {
return defaultInstance;
}
}
diff -ur Downloads/HeadFirstCSharp_All_Code/HFC#_ch4/p160 - Hit the keys/p160 - Hit the keys/Stats.cs /Volumes/BOOTCAMP/Users/Milan/Documents/Visual Studio 2010/Projects/HitTheKeys/HitTheKeys/Stats.cs
--- Downloads/HeadFirstCSharp_All_Code/HFC#_ch4/p160 - Hit the keys/p160 - Hit the keys/Stats.cs 2010-05-15 13:42:00.000000000 +0200
+++ /Volumes/BOOTCAMP/Users/Milan/Documents/Visual Studio 2010/Projects/HitTheKeys/HitTheKeys/Stats.cs 2012-10-11 13:38:20.000000000 +0200
@@ -3,7 +3,7 @@
using System.Linq;
using System.Text;
-namespace Hit_the_keys
+namespace HitTheKeys
{
class Stats
{
@@ -12,7 +12,7 @@
public int Correct = 0;
public int Accuracy = 0;
- public void Update(bool correctKey)
+ public void Update (bool correctKey)
{
Total++;
@@ -25,7 +25,7 @@
Correct++;
}
- Accuracy = 100 * Correct / (Missed + Correct);
+ Accuracy = 100*Correct/(Missed + Correct);
}
}
}
Only in /Volumes/BOOTCAMP/Users/Milan/Documents/Visual Studio 2010/Projects/HitTheKeys/HitTheKeys: bin
Only in /Volumes/BOOTCAMP/Users/Milan/Documents/Visual Studio 2010/Projects/HitTheKeys/HitTheKeys: obj
Only in Downloads/HeadFirstCSharp_All_Code/HFC#_ch4/p160 - Hit the keys/p160 - Hit the keys/: p160 - Hit the keys.csproj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment