Dreamine.PLC.Omron.CxComponent
1.0.1
Dreamine.PLC.Omron.CxComponent 산업 자동화 및 I/O 기능을 제공합니다.
Toggle main menu visibility
로딩중...
검색중...
일치하는것 없음
DefaultComObjectFactory.cs
이 파일의 문서화 페이지로 가기
1
namespace
Dreamine.PLC.Omron.CxComponent.Internal
;
2
11
public
sealed
class
DefaultComObjectFactory
:
IComObjectFactory
12
{
61
public
object
Create
(
string
progId)
62
{
63
if
(!OperatingSystem.IsWindows())
64
{
65
throw
new
PlatformNotSupportedException(
"CX-Compolet controls are supported on Windows only."
);
66
}
67
68
if
(
string
.IsNullOrWhiteSpace(progId))
69
{
70
throw
new
ArgumentException(
"COM ProgID must not be empty."
, nameof(progId));
71
}
72
73
Type? type;
74
try
75
{
76
type = Type.GetTypeFromProgID(progId, throwOnError:
false
);
77
}
78
catch
(Exception ex)
79
{
80
throw
CreateFriendlyException
(progId, ex);
81
}
82
83
if
(type is
null
)
84
{
85
throw
CreateFriendlyException
(progId);
86
}
87
88
try
89
{
90
return
Activator.CreateInstance(type)
91
??
throw
new
InvalidOperationException($
"Failed to create CX-Compolet COM object: {progId}"
);
92
}
93
catch
(Exception ex)
94
{
95
throw
CreateFriendlyException
(progId, ex);
96
}
97
}
98
131
private
static
InvalidOperationException
CreateFriendlyException
(
string
progId, Exception? innerException =
null
)
132
{
133
var bitness = Environment.Is64BitProcess ?
"x64"
:
"x86"
;
134
return
new
InvalidOperationException(
135
$
"CX-Compolet COM '{progId}' is not registered for the current {bitness} process. "
+
136
"Install/register Omron CX-Compolet for the same bitness, or run SampleSmart as x86 when only the 32-bit runtime is installed."
,
137
innerException);
138
}
139
}
Dreamine.PLC.Omron.CxComponent.Internal
Definition
ComInvoker.cs:5
Dreamine.PLC.Omron.CxComponent.Internal.DefaultComObjectFactory
Definition
DefaultComObjectFactory.cs:12
Dreamine.PLC.Omron.CxComponent.Internal.DefaultComObjectFactory.CreateFriendlyException
static InvalidOperationException CreateFriendlyException(string progId, Exception? innerException=null)
Definition
DefaultComObjectFactory.cs:131
Dreamine.PLC.Omron.CxComponent.Internal.DefaultComObjectFactory.Create
object Create(string progId)
Definition
DefaultComObjectFactory.cs:61
Dreamine.PLC.Omron.CxComponent.Internal.IComObjectFactory
Definition
IComObjectFactory.cs:12
Internal
DefaultComObjectFactory.cs
다음에 의해 생성됨 :
1.17.0