Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

minor cleanup of code

  • Loading branch information...
commit 22fe60a89fbdb171820a56f02559513d7001bc8d 1 parent b25d99a
@srushti authored
View
10 Azazel.4.5.resharper
@@ -75,10 +75,16 @@
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="Other" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="PrivateInstanceFields" />
<PredefinedRule Inspect="True" Prefix="_" Suffix="" Style="aaBb" ElementKind="PrivateStaticFields" />
- <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateConstants" />
- <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateStaticReadonly" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateConstants">
+ <ExtraRule Prefix="" Suffix="" Style="AA_BB" />
+ </PredefinedRule>
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateStaticReadonly">
+ <ExtraRule Prefix="" Suffix="" Style="aaBb" />
+ </PredefinedRule>
<Abbreviation Text="FF" />
<Abbreviation Text="WPF" />
+ <Abbreviation Text="SHFILEINFO" />
+ <Abbreviation Text="SH" />
</Naming2>
</CodeStyleSettings>
<SharedSolutionTemplateManager>
View
6 Azazel/AppSettings.cs
@@ -17,11 +17,11 @@ public class AppSettings {
public delegate void HotkeysChangedHandler(Hotkeys hotkeys);
public class Hotkeys {
- public readonly Hotkey DisplayHotKey;
+ public Hotkey DisplayHotKey;
- protected Hotkeys() {}
+ private Hotkeys() {}
- public Hotkeys(Hotkey displayHotKey) {
+ public Hotkeys(Hotkey displayHotKey) : this() {
DisplayHotKey = displayHotKey;
}
}
View
1  Azazel/Azazel.csproj
@@ -144,6 +144,7 @@
<Compile Include="FileSystem\PersistanceHelper.cs" />
<Compile Include="FileSystem\Runner.cs" />
<Compile Include="History.cs" />
+ <Compile Include="KeyboardShortcutChangeCommand.cs" />
<Compile Include="KeyHookup\InterceptKeys.cs" />
<Compile Include="KeyHookup\NativeMethods.cs" />
<Compile Include="KeyHookup\WPFHotkeyManager.cs" />
View
4 Azazel/FileSystem/File.cs
@@ -22,7 +22,7 @@ public class File : FileSystemElement<FileInfo, File>, Launchable {
}
public virtual ImageSource Icon {
- get { return IconExtractor.Instance.Extract(this, IconSize.Large); }
+ get { return IconExtractor.Instance.Extract(this); }
}
public Folder ParentFolder {
@@ -68,7 +68,7 @@ private class NullFile : File {
return nullFile != null;
}
- public override bool Equals(FileSystemElement<FileInfo, File> fileSystemElement) {
+ protected override bool Equals(FileSystemElement<FileInfo, File> fileSystemElement) {
return Equals(((object) fileSystemElement));
}
View
2  Azazel/FileSystem/FileSystemElement.cs
@@ -29,7 +29,7 @@ public abstract class FileSystemElement<T, U> where T : FileSystemInfo where U :
public abstract string Name { get; }
- public virtual bool Equals(FileSystemElement<T, U> fileSystemElement) {
+ protected virtual bool Equals(FileSystemElement<T, U> fileSystemElement) {
if (fileSystemElement == null) return false;
return Equals(FullName, fileSystemElement.FullName);
}
View
1  Azazel/FileSystem/Folders.cs
@@ -30,6 +30,7 @@ public class Folders : List<Folder>, LaunchablePlugin {
}
public new void Add(Folder folder) {
+ if (Contains(folder)) return;
base.Add(folder);
WatchFolder(folder);
}
View
68 Azazel/FileSystem/IconExtractor.cs
@@ -10,16 +10,10 @@
using IWshRuntimeLibrary;
namespace Azazel.FileSystem {
- public enum IconSize {
- Small,
- Large
- }
-
public class IconExtractor {
public static readonly IconExtractor Instance = new IconExtractor();
private const uint SHGFI_ICON = 0x100;
private const uint SHGFI_LARGEICON = 0x0;
- private const uint SHGFI_SMALLICON = 0x1;
private IconExtractor() {}
[DllImport("shell32.dll")]
@@ -28,42 +22,13 @@ public class IconExtractor {
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern bool DestroyIcon(IntPtr handle);
- private static Icon ExtractIcon(File file, IconSize size) {
+ private static Icon ExtractIcon(File file) {
var shinfo = new SHFILEINFO();
- if (size == IconSize.Large)
- SHGetFileInfo(file.FullName, 0, ref shinfo, (uint) Marshal.SizeOf(shinfo), SHGFI_ICON | SHGFI_LARGEICON);
- else
- SHGetFileInfo(file.FullName, 0, ref shinfo, (uint) Marshal.SizeOf(shinfo), SHGFI_ICON | SHGFI_SMALLICON);
+ SHGetFileInfo(file.FullName, 0, ref shinfo, (uint) Marshal.SizeOf(shinfo), SHGFI_ICON | SHGFI_LARGEICON);
return Icon.FromHandle(shinfo.hIcon);
}
- public ImageSource Extract(File file, IconSize iconSize) {
- try {
- if (new List<string> {".ico", ".png", ".jpg", ".gif"}.Contains(file.Extension.ToLower())) return new BitmapImage(new Uri(file.FullName));
- var icon = ExtractIcon(ActualFile(file), iconSize);
- var bmp = icon.ToBitmap();
- DestroyIcon(icon.Handle);
- var strm = new MemoryStream();
- bmp.Save(strm, ImageFormat.Png);
- return Extract(strm);
- }
- catch (ExternalException exception) {
- LogManager.WriteLog(exception);
- return new BitmapImage();
- }
- catch (DirectoryNotFoundException exception) {
- LogManager.WriteLog("Requested file: {0}", file);
- LogManager.WriteLog(exception);
- return new BitmapImage();
- }
- catch (ArgumentException exception) {
- LogManager.WriteLog("Requested file: {0}", file);
- LogManager.WriteLog(exception);
- return new BitmapImage();
- }
- }
-
private static ImageSource Extract(Stream strm) {
try {
var bmpImage = new BitmapImage();
@@ -80,7 +45,7 @@ public class IconExtractor {
private static File ActualFile(File file) {
if (!file.FullName.EndsWith(".lnk")) return file;
- var linkPathName = file.FullName;
+ string linkPathName = file.FullName;
var link = (IWshShortcut) new WshShell().CreateShortcut(linkPathName);
if (string.IsNullOrEmpty(link.TargetPath) || !File.Exists(link.TargetPath)) return file;
return new File(link.TargetPath);
@@ -96,7 +61,32 @@ private struct SHFILEINFO {
} ;
public ImageSource Extract(File file) {
- return Extract(file, IconSize.Large);
+ try {
+ if (new List<string> {".ico", ".png", ".jpg", ".gif"}.Contains(file.Extension.ToLower())) {
+ if (!file.Exists()) return new BitmapImage();
+ return new BitmapImage(new Uri(file.FullName));
+ }
+ Icon icon = ExtractIcon(ActualFile(file));
+ Bitmap bmp = icon.ToBitmap();
+ DestroyIcon(icon.Handle);
+ var strm = new MemoryStream();
+ bmp.Save(strm, ImageFormat.Png);
+ return Extract(strm);
+ }
+ catch (ExternalException exception) {
+ LogManager.WriteLog(exception);
+ return new BitmapImage();
+ }
+ catch (DirectoryNotFoundException exception) {
+ LogManager.WriteLog("Requested file: {0}", file);
+ LogManager.WriteLog(exception);
+ return new BitmapImage();
+ }
+ catch (ArgumentException exception) {
+ LogManager.WriteLog("Requested file: {0}", file);
+ LogManager.WriteLog(exception);
+ return new BitmapImage();
+ }
}
}
}
View
15 Azazel/FileSystem/PersistanceHelper.cs
@@ -5,24 +5,29 @@
namespace Azazel.FileSystem {
public class PersistanceHelper {
private XStream xStream;
+ protected PersistanceHelper() {}
- public PersistanceHelper(XStream xStream) {
+ public PersistanceHelper(XStream xStream) : this() {
this.xStream = xStream;
}
- public T LoadOrSaveAndLoad<T>(string filePath, T defaultObject) {
+ public virtual T LoadOrSaveAndLoad<T>(string filePath, Func<T> defaultObjectCreator) {
if (!File.Exists(filePath))
- Save(filePath, xStream, defaultObject);
+ Save(filePath, xStream, defaultObjectCreator());
try {
return (T) xStream.FromXml(((LoadFile) (() => File.Contents(filePath)))().Trim());
}
catch (Exception e) {
LogManager.WriteLog(e);
- return SaveAndLoad(filePath, defaultObject);
+ return SaveAndLoad(filePath, defaultObjectCreator());
}
}
- public T SaveAndLoad<T>(string filePath, T defaultObject) {
+ public T LoadOrSaveAndLoad<T>(string filePath, T defaultObject) {
+ return LoadOrSaveAndLoad(filePath, () => defaultObject);
+ }
+
+ private T SaveAndLoad<T>(string filePath, T defaultObject) {
var file = new File(filePath);
File.WriteAllText(file.FullName + DateTime.Now.ToString().Replace("/", "").Replace("\\", "").Replace(" ", "").Replace(":", "") + file.Extension,
File.Contents(filePath));
View
18 Azazel/KeyboardShortcutChangeCommand.cs
@@ -0,0 +1,18 @@
+using Azazel.PluggingIn;
+
+namespace Azazel {
+ internal class KeyboardShortcutChangeCommand {
+ private readonly AppSettings settings;
+
+ public KeyboardShortcutChangeCommand(AppSettings settings) {
+ this.settings = settings;
+ }
+
+ public Hotkeys Execute() {
+ var hotkeys = new Hotkeys(null);
+ var window = new KeyboardShortcut(hotkeys);
+ window.ShowDialog();
+ return hotkeys;
+ }
+ }
+}
View
4 Azazel/MainWindowCommand.cs
@@ -19,8 +19,8 @@ public class MainWindowCommand {
var selfPlugin = new SelfPlugin();
var loader = new PluginLoader(selfPlugin);
var persistanceHelper = new PersistanceHelper(selfPlugin.XStream);
- appSettings.AppHotkeys = persistanceHelper.LoadOrSaveAndLoad(Paths.Instance.AppHotkeys,
- new Hotkeys(new Hotkey(Modifiers.Alt, Keys.F2)));
+ appSettings.AppHotkeys = persistanceHelper.LoadOrSaveAndLoad<Hotkeys>(Paths.Instance.AppHotkeys,
+ new KeyboardShortcutChangeCommand(appSettings).Execute);
Hotkeys hotkeys = appSettings.AppHotkeys;
displayHotkey = hotkeys.DisplayHotKey;
controller = new MainWindowController(loader.LaunchablePlugins, loader.CharacterPlugins, loader.LaunchableHandlers, selfPlugin, persistanceHelper,
View
18 Azazel/MainWindowController.cs
@@ -25,7 +25,7 @@ public class MainWindowController {
appFinder = new AppFinder(launchablePlugins, characterPlugins, selfPlugin.XStream, persistanceHelper);
selfPlugin.RefreshRequested += (() => appFinder.LoadFiles(launchablePlugins));
selfPlugin.AddAFolder += (() => appFinder.AddFolder(launchablePlugins));
- selfPlugin.ChangeShortcut += (() => new KeyboardShortcutChangeCommand(settings, persistanceHelper).Execute());
+ selfPlugin.ChangeShortcut += (() => new KeyboardShortcutChangeCommand(settings).Execute());
}
public void SetInput(string value, bool asynchronous) {
@@ -107,20 +107,4 @@ public class MainWindowController {
thread.Abort();
}
}
-
- internal class KeyboardShortcutChangeCommand {
- private readonly AppSettings settings;
- private readonly PersistanceHelper persistanceHelper;
-
- public KeyboardShortcutChangeCommand(AppSettings settings, PersistanceHelper persistanceHelper) {
- this.settings = settings;
- this.persistanceHelper = persistanceHelper;
- }
-
- public void Execute() {
- var window = new KeyboardShortcut(settings, persistanceHelper);
- window.Show();
- window.Activate();
- }
- }
}
View
17 Azazel/PluggingIn/KeyboardShortcut.xaml.cs
@@ -3,22 +3,19 @@
using System.Text;
using System.Windows.Forms;
using System.Windows.Input;
-using Azazel.FileSystem;
using Azazel.KeyHookup;
namespace Azazel.PluggingIn {
public partial class KeyboardShortcut {
- private readonly AppSettings settings;
- private readonly PersistanceHelper persistanceHelper;
+ private readonly Hotkeys hotkeys;
private Hotkey newHotkey;
protected KeyboardShortcut() {
InitializeComponent();
}
- public KeyboardShortcut(AppSettings settings, PersistanceHelper persistanceHelper) : this() {
- this.settings = settings;
- this.persistanceHelper = persistanceHelper;
+ public KeyboardShortcut(Hotkeys hotkeys) : this() {
+ this.hotkeys = hotkeys;
HookEvents();
}
@@ -26,6 +23,7 @@ public partial class KeyboardShortcut {
Activated += delegate { new WindowHider(this).Hide(); };
KeyUp += ((sender, e) => KeyPressed(e.Key, Modifiers.Current));
useWindowsKey.Checked += delegate { OnUseWindowsCheckedChanged(); };
+ Deactivated += delegate { Close(); };
}
private void OnUseWindowsCheckedChanged() {
@@ -34,8 +32,8 @@ public partial class KeyboardShortcut {
private void KeyPressed(Key key, Modifiers modifiers) {
if (useWindowsKey.IsChecked ?? false) modifiers = new Modifiers(modifiers, Modifiers.Windows);
- if (key == Key.Enter) SaveAsKeyboardShortcut();
- else if (key == Key.Escape) Close();
+ if (Equals(key, Key.Enter)) SaveAsKeyboardShortcut();
+ else if (Equals(key, Key.Escape)) Close();
else {
var keyboardCombo = new StringBuilder();
if (modifiers.HasCtrl) keyboardCombo.Append("Ctrl + ");
@@ -53,7 +51,8 @@ public partial class KeyboardShortcut {
}
private void SaveAsKeyboardShortcut() {
- settings.AppHotkeys = persistanceHelper.SaveAndLoad(Paths.Instance.AppHotkeys, new Hotkeys(newHotkey));
+ hotkeys.DisplayHotKey = newHotkey;
+ DialogResult = false;
Close();
}
}
View
25 AzazelTests/App.config
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <configSections>
+ <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
+ </configSections>
+ <log4net>
+ <appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender">
+ <param name="File" value="azazel.log" />
+ <param name="AppendToFile" value="true" />
+ <param name="RollingStyle" value="Size"/>
+ <param name="MaxSizeRollBackups" value="10" />
+ <param name="maximumFileSize" value="1024KB" />
+ <param name="staticLogFileName" value="true" />
+ <layout type="log4net.Layout.PatternLayout">
+ <param name="Header" value="" />
+ <param name="Footer" value="" />
+ <param name="ConversionPattern" value="%d [%t] %-5p %m%n" />
+ </layout>
+ </appender>
+ <root>
+ <level value="DEBUG" />
+ <appender-ref ref="LogFileAppender" />
+ </root>
+ </log4net>
+</configuration>
View
181 AzazelTests/AzazelTests.csproj
@@ -1,90 +1,93 @@
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>9.0.30729</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{1586CC3E-8261-4AC0-B1BC-72558A313A25}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Azazel</RootNamespace>
- <AssemblyName>AzazelTests</AssemblyName>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <UpgradeBackupLocation>
- </UpgradeBackupLocation>
- <OldToolsVersion>2.0</OldToolsVersion>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\lib\nunit\log4net.dll</HintPath>
- </Reference>
- <Reference Include="nunit.framework, Version=2.4.6.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\lib\nunit\nunit.framework.dll</HintPath>
- </Reference>
- <Reference Include="Rhino.Mocks, Version=3.0.498.0, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\lib\Rhino.Mocks.dll</HintPath>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.configuration" />
- <Reference Include="System.Core">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- <Reference Include="XStream, Version=0.9.0.0, Culture=neutral, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\lib\XStream.dll</HintPath>
- </Reference>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="AppFinderTest.cs" />
- <Compile Include="FileSystem\FilesTest.cs" />
- <Compile Include="FileSystem\FoldersTest.cs" />
- <Compile Include="HistoryTest.cs" />
- <Compile Include="PluggingIn\LoadPluginTest.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Should.cs" />
- <Compile Include="Threading\TimerTest.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\Azazel\Azazel.csproj">
- <Project>{832572F6-F3D9-46C7-B922-E7F69D35FE6A}</Project>
- <Name>Azazel</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\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>
- -->
- <PropertyGroup>
- <PostBuildEvent>
- </PostBuildEvent>
- </PropertyGroup>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.30729</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{1586CC3E-8261-4AC0-B1BC-72558A313A25}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Azazel</RootNamespace>
+ <AssemblyName>AzazelTests</AssemblyName>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ <OldToolsVersion>2.0</OldToolsVersion>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\lib\nunit\log4net.dll</HintPath>
+ </Reference>
+ <Reference Include="nunit.framework, Version=2.4.6.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\lib\nunit\nunit.framework.dll</HintPath>
+ </Reference>
+ <Reference Include="Rhino.Mocks, Version=3.0.498.0, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\lib\Rhino.Mocks.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.configuration" />
+ <Reference Include="System.Core">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ <Reference Include="XStream, Version=0.9.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\lib\XStream.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="AppFinderTest.cs" />
+ <Compile Include="FileSystem\FilesTest.cs" />
+ <Compile Include="FileSystem\FoldersTest.cs" />
+ <Compile Include="HistoryTest.cs" />
+ <Compile Include="PluggingIn\LoadPluginTest.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Should.cs" />
+ <Compile Include="Threading\TimerTest.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Azazel\Azazel.csproj">
+ <Project>{832572F6-F3D9-46C7-B922-E7F69D35FE6A}</Project>
+ <Name>Azazel</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="App.config" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\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>
+ -->
+ <PropertyGroup>
+ <PostBuildEvent>
+ </PostBuildEvent>
+ </PropertyGroup>
</Project>
View
26 AzazelTests/FileSystem/FoldersTest.cs
@@ -1,14 +1,14 @@
-using NUnit.Framework;
-
-namespace Azazel.FileSystem {
- [TestFixture]
- public class FoldersTest {
- [Test]
- public void CannotAddTheSameFolder() {
- var folders = new Folders();
- folders.Add(new Folder("."));
- folders.Add(new Folder("."));
- folders.ShouldHaveCount(1);
- }
- }
+using NUnit.Framework;
+
+namespace Azazel.FileSystem {
+ [TestFixture]
+ public class FoldersTest {
+ [Test]
+ public void CannotAddTheSameFolder() {
+ var folders = new Folders();
+ folders.Add(new Folder("."));
+ folders.Add(new Folder("."));
+ folders.ShouldHaveCount(1);
+ }
+ }
}
View
41 AzazelTests/PluggingIn/LoadPluginTest.cs
@@ -1,26 +1,17 @@
-using System;
-using System.Configuration;
-using Microsoft.Win32;
-using NUnit.Framework;
-
-namespace Azazel.PluggingIn {
- [TestFixture]
- public class LoadPluginTest {
- [SetUp]
- public void SetUp() {
- ConfigurationManager.AppSettings[""] = "";
- }
-
- [Test]
- public void MethodName() {
- var registryKey = Registry.ClassesRoot.OpenSubKey(@"http\shell\open\command", false);
- var browserCommand = ((string) registryKey.GetValue(null, null));
- Console.WriteLine(browserCommand);
- }
-
- [Test]
- public void LoadsPluginsDynamically() {
- Assert.AreNotEqual(null, new PluginLoader(new SelfPlugin()).LaunchablePlugins);
- }
- }
+using System.Configuration;
+using NUnit.Framework;
+
+namespace Azazel.PluggingIn {
+ [TestFixture]
+ public class LoadPluginTest {
+ [SetUp]
+ public void SetUp() {
+ ConfigurationManager.AppSettings[""] = "";
+ }
+
+ [Test]
+ public void LoadsPluginsDynamically() {
+ Assert.AreNotEqual(null, new PluginLoader(new SelfPlugin()).LaunchablePlugins);
+ }
+ }
}
View
74 VenusTests/Browser/FirefoxSearchPluginTest.cs
@@ -1,38 +1,38 @@
-using NUnit.Framework;
-
-namespace Venus.Browser {
- [TestFixture]
- public class FirefoxSearchPluginTest {
- private const string searchPluginXml =
- @"<SearchPlugin xmlns=""http://www.mozilla.org/2006/browser/search/"">
- <ShortName>Google</ShortName>
- <Description>Google Search</Description>
- <InputEncoding>UTF-8</InputEncoding>
- <Image width=""16"" height=""16"">data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAaRJREFUeNpiVIg5JRURw0A0YAHio943kYV%2B%2Ff33%2BdvvX7%2F%2FMjEx8nKycrGzwKXOiPKzICvdeezLhCV3jp15%2Bfv%2FX0YGhv8MDDxMX2qKTIw0RK10eYD6QYqATvoPBkt3f5K0W9Ew4fjTFz%2F%2Bw8Dm3W8UPeZxqFa%2BevsFyD0twgfVsOfkRxHrtfV9u5BVQ8Crd98%2FffkGYQM1QJ20%2FfSPv79eNxQGYfpSVJADmcvEAHbr7oOX2dj%2FERNKIA2%2F%2F%2Fz%2FxfCDhYVoDUDw5P6vf9%2B5iY0HVmZGQWm%2BN3fff%2Fn2k4eLHS739x%2FDiRs%2Ff%2F%2F5x8HO%2FOHzN3djfqgNjIwMgc6qzLx%2Fpy47j2zY%2Feff06tXhOUucgxeun33AUZGpHh4%2Bvo7t8EyIJqz%2FhpasD59%2B5dNrqdnznZIsEL9ICXCsWuBCwvTv%2FymS5PWPP32ExEALz%2F%2BB5r848cPCJcRaMP9xaYQzofPPzfuvrnj0Jst%2B5%2F8%2Bc4sLPeDkYlRgJc93VPE18NIXkYUmJYQSQMZ%2FP3379uPH7%2F%2F%2FEETBzqJ0WqLGvFpe2LCC4AAAwAyjg7ENzDDWAAAAABJRU5ErkJggg%3D%3D</Image>
- <Url type=""application/x-suggestions+json"" method=""GET"" template=""http://suggestqueries.google.com/complete/search?output=firefox&amp;client=firefox&amp;hl={moz:locale}&amp;q={searchTerms}""/>
- <Url type=""text/html"" method=""GET"" template=""http://www.google.com/search"">
- <Param name=""q"" value=""{searchTerms}""/>
- <Param name=""ie"" value=""utf-8""/>
- <Param name=""oe"" value=""utf-8""/>
- <Param name=""aq"" value=""t""/>
- <!-- Dynamic parameters -->
- <Param name=""rls"" value=""{moz:distributionID}:{moz:locale}:{moz:official}""/>
- <MozParam name=""client"" condition=""defaultEngine"" trueValue=""firefox-a"" falseValue=""firefox""/>
- </Url>
- <SearchForm>http://www.google.com/firefox</SearchForm>
-</SearchPlugin>";
-
- [Test]
- public void LoadsASearchPlugin() {
- var googleSearch = new FirefoxSearchPlugin().CreateSearchPlugin(searchPluginXml);
- Assert.AreEqual("Google", googleSearch.Name);
- Assert.AreEqual("http://www.google.com/firefox", googleSearch.FullName);
- Assert.AreEqual("http://www.google.com/search?q=%s&ie=utf-8&oe=utf-8&aq=t&", googleSearch.SearchQuery);
- }
-
- [Test]
- public void LoadsAllSearchPlugins() {
- Assert.AreEqual(7, new FirefoxSearchPlugin().Launchables().Count);
- }
- }
+using NUnit.Framework;
+
+namespace Venus.Browser {
+ [TestFixture]
+ public class FirefoxSearchPluginTest {
+ private const string searchPluginXml =
+ @"<SearchPlugin xmlns=""http://www.mozilla.org/2006/browser/search/"">
+ <ShortName>Google</ShortName>
+ <Description>Google Search</Description>
+ <InputEncoding>UTF-8</InputEncoding>
+ <Image width=""16"" height=""16"">data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAaRJREFUeNpiVIg5JRURw0A0YAHio943kYV%2B%2Ff33%2BdvvX7%2F%2FMjEx8nKycrGzwKXOiPKzICvdeezLhCV3jp15%2Bfv%2FX0YGhv8MDDxMX2qKTIw0RK10eYD6QYqATvoPBkt3f5K0W9Ew4fjTFz%2F%2Bw8Dm3W8UPeZxqFa%2BevsFyD0twgfVsOfkRxHrtfV9u5BVQ8Crd98%2FffkGYQM1QJ20%2FfSPv79eNxQGYfpSVJADmcvEAHbr7oOX2dj%2FERNKIA2%2F%2F%2Fz%2FxfCDhYVoDUDw5P6vf9%2B5iY0HVmZGQWm%2BN3fff%2Fn2k4eLHS739x%2FDiRs%2Ff%2F%2F5x8HO%2FOHzN3djfqgNjIwMgc6qzLx%2Fpy47j2zY%2Feff06tXhOUucgxeun33AUZGpHh4%2Bvo7t8EyIJqz%2FhpasD59%2B5dNrqdnznZIsEL9ICXCsWuBCwvTv%2FymS5PWPP32ExEALz%2F%2BB5r848cPCJcRaMP9xaYQzofPPzfuvrnj0Jst%2B5%2F8%2Bc4sLPeDkYlRgJc93VPE18NIXkYUmJYQSQMZ%2FP3379uPH7%2F%2F%2FEETBzqJ0WqLGvFpe2LCC4AAAwAyjg7ENzDDWAAAAABJRU5ErkJggg%3D%3D</Image>
+ <Url type=""application/x-suggestions+json"" method=""GET"" template=""http://suggestqueries.google.com/complete/search?output=firefox&amp;client=firefox&amp;hl={moz:locale}&amp;q={searchTerms}""/>
+ <Url type=""text/html"" method=""GET"" template=""http://www.google.com/search"">
+ <Param name=""q"" value=""{searchTerms}""/>
+ <Param name=""ie"" value=""utf-8""/>
+ <Param name=""oe"" value=""utf-8""/>
+ <Param name=""aq"" value=""t""/>
+ <!-- Dynamic parameters -->
+ <Param name=""rls"" value=""{moz:distributionID}:{moz:locale}:{moz:official}""/>
+ <MozParam name=""client"" condition=""defaultEngine"" trueValue=""firefox-a"" falseValue=""firefox""/>
+ </Url>
+ <SearchForm>http://www.google.com/firefox</SearchForm>
+</SearchPlugin>";
+
+ [Test]
+ public void LoadsASearchPlugin() {
+ var googleSearch = new FirefoxSearchPlugin().CreateSearchPlugin(searchPluginXml);
+ Assert.AreEqual("Google", googleSearch.Name);
+ Assert.AreEqual("http://www.google.com/firefox", googleSearch.FullName);
+ Assert.AreEqual("http://www.google.com/search?q=%s&ie=utf-8&oe=utf-8&aq=t&", googleSearch.SearchQuery);
+ }
+
+ [Test]
+ public void LoadsAllSearchPlugins() {
+ Assert.AreEqual(8, new FirefoxSearchPlugin().Launchables().Count);
+ }
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.