-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
1,643 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) + "..."; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { } | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
} |
Oops, something went wrong.