Skip to content

Commit 2ab73d1

Browse files
author
brahn
committedOct 12, 2011
A bunch of new changes, fixes, etc. A couple of new libraries. Full details are in the release_notes.xml files!
1 parent 81d0564 commit 2ab73d1

File tree

118 files changed

+9706
-365
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+9706
-365
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
using System;
2+
using System.IO;
3+
using System.Reflection;
4+
using ICSharpCode.Core;
5+
6+
namespace ClarionAddins.AssemblyResolve
7+
{
8+
class RegisterHandler : AbstractCommand
9+
{
10+
static String _nameSpace;
11+
public override void Run()
12+
{
13+
_nameSpace = GetType().ToString();
14+
LoggingService.Debug(_nameSpace + " - Starting the Assembly resolver");
15+
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(currentDomain_AssemblyResolve);
16+
}
17+
18+
static System.Reflection.Assembly currentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
19+
{
20+
21+
//This handler is called only when the common language runtime tries to bind to the assembly and fails.
22+
LoggingService.Debug(_nameSpace + " - Assembly resolve requested for " + args.Name);
23+
Assembly MyAssembly = null;
24+
string strTempAssmbPath = String.Empty;
25+
26+
// I was doing this but it seems that some assemblies (Clarion.core!!!) are in the BaseDirectory (and in later versions of clarion, also the backenbindings...)
27+
//Path.Combine(currentDomain.BaseDirectory, @"Addins\BackendBindings\ClarionBinding\")
28+
strTempAssmbPath = FindAssembly(args.Name.Substring(0, args.Name.IndexOf(",")) + ".dll");
29+
if (strTempAssmbPath != String.Empty)
30+
{
31+
LoggingService.Debug(_nameSpace + " - @@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Inside ResolveEventHandler @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
32+
LoggingService.Debug(" args.Name=" + args.Name);
33+
LoggingService.Debug(" strTempAssmbPath=" + strTempAssmbPath);
34+
LoggingService.Debug(_nameSpace + " - @@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Inside ClarionEdge.SetTheme ResolveEventHandler @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
35+
36+
//Load the assembly from the specified path.
37+
MyAssembly = Assembly.LoadFrom(strTempAssmbPath);
38+
}
39+
//Return the loaded assembly.
40+
return MyAssembly;
41+
}
42+
43+
private static string FindAssembly(string pAssemblyName)
44+
{
45+
AppDomain currentDomain = AppDomain.CurrentDomain;
46+
string[] files;
47+
string path;
48+
// First attempt to find it in the BaseDirectory
49+
path = currentDomain.BaseDirectory;
50+
LoggingService.Debug(_nameSpace + " - Check BaseDirectory (" + path + ")");
51+
files = Directory.GetFiles(path, pAssemblyName, SearchOption.AllDirectories);
52+
if (files.Length > 0)
53+
{
54+
LoggingService.Debug(_nameSpace + " - Found in BaseDirectory, files[0]=" + files[0]);
55+
return files[0];
56+
}
57+
58+
// Or, try the addin directories
59+
// %appdata%\SoftVelocity\Clarion\8.0\Addins
60+
path = Path.Combine(PropertyService.ConfigDirectory, "AddIns");
61+
LoggingService.Debug(_nameSpace + " - Check ConfigDirectory (" + path + ")");
62+
files = Directory.GetFiles(path, pAssemblyName, SearchOption.AllDirectories);
63+
if (files.Length > 0)
64+
{
65+
LoggingService.Debug(_nameSpace + " - Found in ConfigDirectory, files[0]=" + files[0]);
66+
return files[0];
67+
}
68+
69+
// accessory
70+
path = FileUtility.Combine(new string[] { FileUtility.ApplicationRootPath, "Accessory", "AddIns" });
71+
LoggingService.Debug(_nameSpace + " - Check ApplicationRootPath (" + path + ")");
72+
files = Directory.GetFiles(path, pAssemblyName, SearchOption.AllDirectories);
73+
if (files.Length > 0)
74+
{
75+
LoggingService.Debug(_nameSpace + " - Found in ApplicationRootPath, files[0]=" + files[0]);
76+
return files[0];
77+
}
78+
79+
LoggingService.Debug(_nameSpace + " - Not Found!");
80+
return String.Empty;
81+
}
82+
83+
}
84+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProductVersion>8.0.30703</ProductVersion>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>{5BD25664-ABFE-4560-88F0-F5C3FC4D4C5D}</ProjectGuid>
9+
<OutputType>Library</OutputType>
10+
<AppDesignerFolder>Properties</AppDesignerFolder>
11+
<RootNamespace>ClarionAddins.AssemblyResolve</RootNamespace>
12+
<AssemblyName>AssemblyResolve</AssemblyName>
13+
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
14+
<FileAlignment>512</FileAlignment>
15+
<TargetFrameworkProfile />
16+
</PropertyGroup>
17+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
18+
<DebugSymbols>true</DebugSymbols>
19+
<DebugType>full</DebugType>
20+
<Optimize>false</Optimize>
21+
<OutputPath>bin\Debug\</OutputPath>
22+
<DefineConstants>DEBUG;TRACE</DefineConstants>
23+
<ErrorReport>prompt</ErrorReport>
24+
<WarningLevel>4</WarningLevel>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27+
<DebugType>pdbonly</DebugType>
28+
<Optimize>true</Optimize>
29+
<OutputPath>bin\Release\</OutputPath>
30+
<DefineConstants>TRACE</DefineConstants>
31+
<ErrorReport>prompt</ErrorReport>
32+
<WarningLevel>4</WarningLevel>
33+
</PropertyGroup>
34+
<ItemGroup>
35+
<Reference Include="ICSharpCode.Core">
36+
<HintPath>..\..\..\..\..\Clarion7\bin\ICSharpCode.Core.dll</HintPath>
37+
<Private>False</Private>
38+
</Reference>
39+
<Reference Include="System" />
40+
<Reference Include="System.Data" />
41+
<Reference Include="System.Xml" />
42+
</ItemGroup>
43+
<ItemGroup>
44+
<Compile Include="AssemblyResolve.cs" />
45+
<Compile Include="Properties\AssemblyInfo.cs" />
46+
</ItemGroup>
47+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
48+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
49+
Other similar extension points exist, see Microsoft.Common.targets.
50+
<Target Name="BeforeBuild">
51+
</Target>
52+
<Target Name="AfterBuild">
53+
</Target>
54+
-->
55+
</Project>

0 commit comments

Comments
 (0)
Please sign in to comment.