File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ using NewLife . IoT . Controllers ;
2+ using SmartA2 ;
3+
4+ namespace NewLife . Model ;
5+
6+ /// <summary>A2硬件工厂扩展</summary>
7+ public static class A2Extensions
8+ {
9+ /// <summary>在A2工业计算机中注册IBoard服务</summary>
10+ /// <param name="services"></param>
11+ /// <returns></returns>
12+ public static Boolean AddA2 ( this IObjectContainer services )
13+ {
14+ // 检测本机如果是A2,则注入服务
15+ var flag = false ;
16+ var machineName = Environment . MachineName ;
17+ if ( ! flag && ( machineName == "A2" || machineName . StartsWithIgnoreCase ( "A2-" ) ) ) flag = true ;
18+ if ( ! flag )
19+ {
20+ var mi = MachineInfo . GetCurrent ( ) ;
21+ if ( ! flag && ( mi . Product == "A2" || mi . Product . StartsWithIgnoreCase ( "A2-" ) ) ) flag = true ;
22+ if ( ! flag && mi . Board . StartsWithIgnoreCase ( "A2-" ) ) flag = true ;
23+ }
24+ if ( ! flag ) return false ;
25+
26+ services . AddSingleton < IBoard , A2 > ( ) ;
27+
28+ return true ;
29+ }
30+ }
You can’t perform that action at this time.
0 commit comments