Skip to content

Commit

Permalink
Inital commit
Browse files Browse the repository at this point in the history
  • Loading branch information
MrX13415 committed Jun 8, 2014
1 parent 1b374fd commit 7131f06
Show file tree
Hide file tree
Showing 14 changed files with 1,643 additions and 0 deletions.
22 changes: 22 additions & 0 deletions CursorAreaLock.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CursorAreaLock", "CursorAreaLock\CursorAreaLock.csproj", "{E78579D9-B748-4BC8-B054-C2A13B55772B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E78579D9-B748-4BC8-B054-C2A13B55772B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E78579D9-B748-4BC8-B054-C2A13B55772B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E78579D9-B748-4BC8-B054-C2A13B55772B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E78579D9-B748-4BC8-B054-C2A13B55772B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
113 changes: 113 additions & 0 deletions CursorAreaLock/ConsoleEx.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace System.ConsoleExtentions
{
public class ConsoleEx
{
public static ConsoleColor DefaultForegroundColor{ get; set; }
public static ConsoleColor DefaultBackgroundColor{ get; set; }

static ConsoleEx(){
DefaultForegroundColor = Console.ForegroundColor;
DefaultBackgroundColor = Console.BackgroundColor;
}

public static void ResetColors()
{
Console.ForegroundColor = DefaultForegroundColor;
Console.BackgroundColor = DefaultBackgroundColor;
}

public static void Write(string text, ConsoleColor color)
{
Console.ForegroundColor = color;
Console.Write(text);
ResetColors();
}

public static void WriteKeyValue(string key, string value, ConsoleColor valueColor)
{
WriteKeyValue(key, value, valueColor, DefaultForegroundColor);
}

public static void WriteKeyValue(string key, string value, ConsoleColor valueColor, string seperator)
{
WriteKeyValue(key, value, valueColor, DefaultForegroundColor, seperator);
}

public static void WriteKeyValue(string key, string value, ConsoleColor valueColor, ConsoleColor keyColor)
{
_WriteKeyValue(key, value, valueColor, keyColor, ": ");
}

public static void WriteKeyValue(string key, string value, ConsoleColor valueColor, ConsoleColor keyColor, string seperator)
{
_WriteKeyValue(key, value, valueColor, keyColor, seperator);
}

private static string _WriteKeyValue(string key, string value, ConsoleColor valueColor, ConsoleColor keyColor, string template)
{
Console.ForegroundColor = keyColor;
Console.Write(key);
Console.Write(template);
Console.ForegroundColor = valueColor;
Console.Write(value);
ResetColors();
return key + template + value;
}

public static void WriteKeyValueLine(string key, string value, ConsoleColor valueColor)
{
WriteKeyValueLine(key, value, valueColor, DefaultForegroundColor, ": ");
}

public static void WriteKeyValueLine(string key, string value, ConsoleColor valueColor, string seperator)
{
WriteKeyValueLine(key, value, valueColor, DefaultForegroundColor, seperator);
}

public static void WriteKeyValueLine(string key, string value, ConsoleColor valueColor, ConsoleColor keyColor, string seperator)
{
string text = _WriteKeyValue(key, value, valueColor, keyColor, seperator);
Console.WriteLine("".PadRight(Console.WindowWidth - text.Length - 1));
}

public static void WriteLine()
{
WriteLine("");
}

public static void WriteLine(String text)
{
WriteLine(text, DefaultForegroundColor);
}

public static void WriteLine(String text, ConsoleColor color)
{
Console.ForegroundColor = color;
Console.WriteLine(text.PadRight(Console.WindowWidth - 1));
ResetColors();
}

public static void WriteLineCenter(String text)
{
WriteLineCenter(text, DefaultForegroundColor);
}

public static void WriteLineCenter(String text, ConsoleColor color)
{
int lineWidth = Console.WindowWidth - text.Length - 1;
Console.ForegroundColor = color;
Console.WriteLine(String.Format("{0," + (lineWidth / 2 * -1) + "}{1," + (lineWidth / 2 * -1) + "}", "", text));
ResetColors();
}

public static string CutText(string text, int lenght)
{
if (text.Length <= lenght) return text;
return text.Substring(0, lenght - 3) + "...";
}
}
}
32 changes: 32 additions & 0 deletions CursorAreaLock/ConsolePage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace System.ConsoleExtentions
{
class ConsolePage<T>
{
public delegate void PrintHandler(T data);
private PrintHandler _printHandler;
public HotkeyBar Hotkeys { get; set; }
public T DataProvider { get; set; }

public ConsolePage(PrintHandler handler, T data, HotkeyBar hotkeybar)
{
this._printHandler = handler;
this.DataProvider = data;
this.Hotkeys = hotkeybar;
}

public void Print()
{
try
{
//print this page ...
_printHandler(DataProvider);
}
catch (Exception) { }
}

}
}
117 changes: 117 additions & 0 deletions CursorAreaLock/CursorAreaLock.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E78579D9-B748-4BC8-B054-C2A13B55772B}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CursorAreaLock</RootNamespace>
<AssemblyName>CursorAreaLock</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>2.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<DelaySign>false</DelaySign>
</PropertyGroup>
<PropertyGroup>
<SignManifests>false</SignManifests>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>MrX13415.pfx</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup>
<TargetZone>LocalIntranet</TargetZone>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>false</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup>
<StartupObject>CursorAreaLock.Program</StartupObject>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ConsoleEx.cs" />
<Compile Include="ConsolePage.cs" />
<Compile Include="Executable.cs" />
<Compile Include="ItemList.cs" />
<Compile Include="Kernel32.cs" />
<Compile Include="HotkeyBar.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Service.cs" />
<Compile Include="User32.cs" />
</ItemGroup>
<ItemGroup>
<None Include="MrX13415.pfx" />
<None Include="Properties\app.manifest" />
<None Include="README.md" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
33 changes: 33 additions & 0 deletions CursorAreaLock/Executable.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace CursorAreaLock
{
class Executable
{
public string DisplayName { get; set; }
public string ExecutablePath { get; set; }

public Executable(string exe) : this(exe, Path.GetFileName(exe)) { }
public Executable(string exe, string displayName)
{
ExecutablePath = exe;
DisplayName = displayName;
}

public override bool Equals(object obj)
{
if (obj is Executable)
return this.ExecutablePath.ToLower().Equals(((Executable)obj).ExecutablePath.ToLower());
else
return false;
}

public override int GetHashCode()
{
return this.ExecutablePath.ToLower().GetHashCode();
}
}
}
Loading

0 comments on commit 7131f06

Please sign in to comment.