Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ChannelCore.cs « System.Runtime.Remoting.Channels « System.Runtime.Remoting « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 46375f69bfb520978277101b4cf0dd4b4d559244 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//
// System.Runtime.Remoting.Channels.ChannelCore.cs
//
// Author: Lluis Sanchez Gual (lluis@ximian.com)
//
// 2003 (C) Copyright, Novell, Inc.
//

using System;
using System.Reflection;
using System.Runtime.Serialization;

namespace System.Runtime.Remoting.Channels
{
	internal class ChannelCore
	{
		public static SerializationBinder SimpleBinder = new SimpleBinder();
	}
	
	internal class SimpleBinder: SerializationBinder
	{
		public override Type BindToType (String assemblyName, string typeName)
		{
			Assembly asm;
			
			if (assemblyName.IndexOf (',') != -1)
			{
				// Try using the full name
				try
				{
					asm = Assembly.Load (assemblyName);
					Type t = asm.GetType (typeName);
					if (t != null) return t;
				}
				catch {}
			}
			
			// Try using the simple name
			asm = Assembly.LoadWithPartialName (assemblyName);
			return asm.GetType (typeName, true);
		}
	}
}