Removed unused references

This commit is contained in:
Jaex 2014-10-18 18:42:33 +03:00
parent f178655a9d
commit a6ce4769f1
10 changed files with 0 additions and 354 deletions

View file

@ -50,8 +50,6 @@
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
</PropertyGroup>
<ItemGroup>
<Reference Include="Accessibility" />
<Reference Include="CustomMarshalers" />
<Reference Include="System" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
@ -299,7 +297,6 @@
<Compile Include="Interop\ComProgIdAttribute.cs" />
<Compile Include="Interop\COMWrapper.cs" />
<Compile Include="Interop\IAppVisibility.cs" />
<Compile Include="Interop\IDispatch.cs" />
<Compile Include="Interop\IOleCommandTarget.cs" />
<Compile Include="Interop\IOleWindow.cs" />
<Compile Include="Interop\IServiceProvider.cs" />

View file

@ -73,104 +73,6 @@ public sealed class COMWrapper : RealProxy, IDisposable, IRemotingTypeInfo
#region Construction
/// <summary>
/// Gets a COM object and returns the transparent proxy which intercepts all calls to the object
/// </summary>
/// <param name="type">Interface which defines the method and properties to intercept</param>
/// <returns>Transparent proxy to the real proxy for the object</returns>
/// <remarks>The <paramref name="type"/> must be an interface decorated with the <see cref="ComProgIdAttribute"/>attribute.</remarks>
public static T GetInstance<T>()
{
Type type = typeof(T);
if (null == type)
{
throw new ArgumentNullException("type");
}
if (!type.IsInterface)
{
throw new ArgumentException("The specified type must be an interface.", "type");
}
ComProgIdAttribute progIDAttribute = ComProgIdAttribute.GetAttribute(type);
if (null == progIDAttribute || null == progIDAttribute.Value || 0 == progIDAttribute.Value.Length)
{
throw new ArgumentException("The specified type must define a ComProgId attribute.", "type");
}
string progId = progIDAttribute.Value;
object comObject = null;
// Convert from clsid to Prog ID, if needed
if (progId.StartsWith("clsid:"))
{
Guid guid = new Guid(progId.Substring(6));
int result = ProgIDFromCLSID(ref guid, out progId);
if (result != 0)
{
// Restore progId, as it's overwritten
progId = progIDAttribute.Value;
try
{
GetActiveObject(ref guid, IntPtr.Zero, out comObject);
}
catch (Exception)
{
LOG.WarnFormat("Error {0} getting instance for class id {1}", result, progIDAttribute.Value);
}
if (comObject == null)
{
LOG.WarnFormat("Error {0} getting progId {1}", result, progIDAttribute.Value);
}
}
else
{
LOG.InfoFormat("Mapped {0} to progId {1}", progIDAttribute.Value, progId);
}
}
if (comObject == null)
{
try
{
comObject = Marshal.GetActiveObject(progId);
}
catch (COMException comE)
{
if (comE.ErrorCode == MK_E_UNAVAILABLE)
{
LOG.DebugFormat("No current instance of {0} object available.", progId);
}
else if (comE.ErrorCode == CO_E_CLASSSTRING)
{
LOG.WarnFormat("Unknown progId {0}", progId);
}
else
{
LOG.Warn("Error getting active object for " + progIDAttribute.Value, comE);
}
}
catch (Exception e)
{
LOG.Warn("Error getting active object for " + progIDAttribute.Value, e);
}
}
if (comObject != null)
{
if (comObject is IDispatch)
{
COMWrapper wrapper = new COMWrapper(comObject, type, progIDAttribute.Value);
return (T)wrapper.GetTransparentProxy();
}
else
{
return (T)comObject;
}
}
return default(T);
}
/// <summary>
/// A simple create instance, doesn't create a wrapper!!
/// </summary>
@ -240,145 +142,6 @@ public static T CreateInstance<T>()
return default(T);
}
/// <summary>
/// Gets or creates a COM object and returns the transparent proxy which intercepts all calls to the object
/// The ComProgId can be a normal ComProgId or a GUID prefixed with "clsid:"
/// </summary>
/// <param name="type">Interface which defines the method and properties to intercept</param>
/// <returns>Transparent proxy to the real proxy for the object</returns>
/// <remarks>The <paramref name="type"/> must be an interface decorated with the <see cref="ComProgIdAttribute"/>attribute.</remarks>
public static T GetOrCreateInstance<T>()
{
Type type = typeof(T);
if (null == type)
{
throw new ArgumentNullException("type");
}
if (!type.IsInterface)
{
throw new ArgumentException("The specified type must be an interface.", "type");
}
ComProgIdAttribute progIDAttribute = ComProgIdAttribute.GetAttribute(type);
if (null == progIDAttribute || null == progIDAttribute.Value || 0 == progIDAttribute.Value.Length)
{
throw new ArgumentException("The specified type must define a ComProgId attribute.", "type");
}
object comObject = null;
Type comType = null;
string progId = progIDAttribute.Value;
Guid guid = Guid.Empty;
// Convert from clsid to Prog ID, if needed
if (progId.StartsWith("clsid:"))
{
guid = new Guid(progId.Substring(6));
int result = ProgIDFromCLSID(ref guid, out progId);
if (result != 0)
{
// Restore progId, as it's overwritten
progId = progIDAttribute.Value;
try
{
GetActiveObject(ref guid, IntPtr.Zero, out comObject);
}
catch (Exception)
{
LOG.WarnFormat("Error {0} getting instance for class id {1}", result, progIDAttribute.Value);
}
if (comObject == null)
{
LOG.WarnFormat("Error {0} getting progId {1}", result, progIDAttribute.Value);
}
}
else
{
LOG.InfoFormat("Mapped {0} to progId {1}", progIDAttribute.Value, progId);
}
}
if (comObject == null)
{
if (!progId.StartsWith("clsid:"))
{
try
{
comObject = Marshal.GetActiveObject(progId);
}
catch (COMException comE)
{
if (comE.ErrorCode == MK_E_UNAVAILABLE)
{
LOG.DebugFormat("No current instance of {0} object available.", progId);
}
else if (comE.ErrorCode == CO_E_CLASSSTRING)
{
LOG.WarnFormat("Unknown progId {0} (application not installed)", progId);
return default(T);
}
else
{
LOG.Warn("Error getting active object for " + progId, comE);
}
}
catch (Exception e)
{
LOG.Warn("Error getting active object for " + progId, e);
}
}
}
// Did we get the current instance? If not, try to create a new
if (comObject == null)
{
try
{
comType = Type.GetTypeFromProgID(progId, true);
}
catch (Exception ex)
{
if (Guid.Empty != guid)
{
comType = Type.GetTypeFromCLSID(guid);
}
else
{
LOG.Warn("Error type for " + progId, ex);
}
}
if (comType != null)
{
try
{
comObject = Activator.CreateInstance(comType);
if (comObject != null)
{
LOG.DebugFormat("Created new instance of {0} object.", progId);
}
}
catch (Exception e)
{
LOG.Warn("Error creating object for " + progId, e);
}
}
}
if (comObject != null)
{
if (comObject is IDispatch)
{
COMWrapper wrapper = new COMWrapper(comObject, type, progIDAttribute.Value);
return (T)wrapper.GetTransparentProxy();
}
else
{
return (T)comObject;
}
}
return default(T);
}
/// <summary>
/// Wrap an object and return the transparent proxy which intercepts all calls to the object
/// </summary>
@ -579,49 +342,6 @@ public static T Cast<T>(object wrapperProxy)
throw new InvalidCastException(string.Format("{0} is not assignable from {1}", oldWrapper._InterceptType, newType));
}
/// <summary>
/// Returns the "com" type of the wrapperproxy, making it possible to perform reflection on it.
/// </summary>
/// <param name="wrapperProxy">wrapperProxy to get the type from</param>
/// <returns>Type</returns>
public static Type GetUnderlyingTypeForWrapper(object wrapperProxy)
{
Type returnType = null;
COMWrapper wrapper = RemotingServices.GetRealProxy(wrapperProxy) as COMWrapper;
if (wrapper != null)
{
IDispatch dispatch = wrapper._COMObject as IDispatch;
if (dispatch != null)
{
int result = dispatch.GetTypeInfo(0, 0, out returnType);
if (result != 0)
{
LOG.DebugFormat("GetTypeInfo : 0x{0} ({1})", result.ToString("X"), result);
}
}
}
return returnType;
}
/// <summary>
/// Return the Type of a IDispatch
/// </summary>
/// <param name="dispatch">IDispatch to get the type object for</param>
/// <returns>Type of the IDispatch</returns>
public static Type GetUnderlyingType(IDispatch dispatch)
{
Type returnType = null;
if (dispatch != null)
{
int result = dispatch.GetTypeInfo(0, 0, out returnType);
if (result != 0)
{
LOG.DebugFormat("GetTypeInfo : 0x{0} ({1})", result.ToString("X"), result);
}
}
return returnType;
}
/// <summary>
/// Dump the Type-Information for the Type to the log, this uses reflection
/// </summary>

View file

@ -1,36 +0,0 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2013 Thomas Braun, Jens Klingen, Robin Krom
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.CustomMarshalers;
namespace Greenshot.Interop
{
[ComImport, Guid("00020400-0000-0000-C000-000000000046"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IDispatch
{
void Reserved();
[PreserveSig]
int GetTypeInfo(uint nInfo, int lcid, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(TypeToTypeInfoMarshaler))] out Type typeInfo);
}
}

View file

@ -60,9 +60,7 @@
<HintPath>..\packages\Newtonsoft.Json.6.0.4\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Design" />
<Reference Include="System.Drawing.Design" />
<Reference Include="System.Management" />
<Reference Include="System.Runtime.Remoting" />
<Reference Include="System.Web" />

View file

@ -60,22 +60,10 @@
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.6.0.4\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Design" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data.DataSetExtensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Adjustments\Alpha.cs" />
@ -179,9 +167,6 @@
<DependentUpon>WatermarkForm.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View file

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net40" />
</packages>

View file

@ -42,11 +42,7 @@
<Reference Include="System.Core" />
<Reference Include="System.Design" />
<Reference Include="System.Drawing" />
<Reference Include="System.Drawing.Design" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>

View file

@ -46,11 +46,8 @@
<HintPath>..\packages\SevenZipSharp.0.64\lib\SevenZipSharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Enums.cs" />

View file

@ -79,14 +79,9 @@
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Design" />
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Controls\BeforeUploadControl.cs">

View file

@ -81,7 +81,6 @@
<HintPath>..\packages\SSH.NET.2014.4.6-beta1\lib\net40\Renci.SshNet.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Design" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.FtpClient, Version=1.0.5281.14359, Culture=neutral, PublicKeyToken=fa4be07daa57c2b7, processorArchitecture=MSIL">
@ -91,7 +90,6 @@
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel.Web" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>