Skip to content

Commit

Permalink
Fix favorites, prevent doubles
Browse files Browse the repository at this point in the history
  • Loading branch information
Codeusa committed Jan 12, 2014
1 parent e32d933 commit 50f98de
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 11 deletions.
18 changes: 13 additions & 5 deletions Borderless.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ private void RemoveBorder(String procName) //actually make it frameless

if (proc.ProcessName.Equals(procName))
{
Console.WriteLine(proc.ProcessName);

var pFoundWindow = proc.MainWindowHandle;
var style = GetWindowLong(pFoundWindow, GWL_STYLE);

Expand Down Expand Up @@ -306,11 +306,19 @@ private void workerTimer_Tick(object sender, EventArgs e)

private void sendGameName(object sender, EventArgs e)
{
if (selectedProcessName != null)
if (selectedProcessName != null && Favorites.canAdd(selectedProcessName))
{
Favorites.AddGame(selectedProcessName);
Favorites.Save("./Favorites.json");
MessageBox.Show(processList.GetItemText(processList.SelectedItem) + " added to favorites", "Victory!",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
Favorites.Save("./Favorites.json");
MessageBox.Show(selectedProcessName + " added to favorites", "Victory!",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
else
{
MessageBox.Show("Unable to add " + selectedProcessName + " already added!", "Uh oh!",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}

}
}
9 changes: 9 additions & 0 deletions Favorites.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ public static void Remove(string path, string item)
Save(path);
}

public static bool canAdd(string item)
{
if (_favoriteGames.Contains(item))
{
return false;
}
return true;
}

public static List<string> List
{
get { return _favoriteGames; }
Expand Down
14 changes: 8 additions & 6 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Resources;

// 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("WindowsFormsApplication2")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyTitle("Borderless Gaming")]
[assembly: AssemblyDescription("Play your favorite games in a borderless window; no more time consuming alt-tabs")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WindowsFormsApplication2")]
[assembly: AssemblyCompany("Codeusa Software")]
[assembly: AssemblyProduct("BorderlessGaming")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
Expand All @@ -32,5 +33,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: NeutralResourcesLanguageAttribute("en-US")]

0 comments on commit 50f98de

Please sign in to comment.