FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
examples/S7.Net.Examples/S7.Net.Examples/Program.cs at master · rapha-dev/examples · GitHub
rapha-dev
examples
Repository navigation
Code
Issues
1
(1)
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
examples
/
S7.Net.Examples
/
S7.Net.Examples
/
Program.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
42 lines (35 loc) · 1.12 KB
Breadcrumbs
examples
/
S7.Net.Examples
/
S7.Net.Examples
/
Program.cs
Copy path
File metadata and controls
42 lines (35 loc) · 1.12 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
using
System
;
using
System
.
Collections
.
Generic
;
using
System
.
Linq
;
using
System
.
Reflection
;
using
System
.
Text
;
using
System
.
Threading
.
Tasks
;
namespace
S7
.
Net
.
Examples
{
class
Program
{
static
void
Main
(
string
[
]
args
)
{
var
ip
=
"10.10.11.38"
;
var
plc
=
new
S7
.
Net
.
Plc
(
CpuType
.
S7300
,
ip
,
0
,
2
)
;
Console
.
WriteLine
(
"Connecting "
+
ip
)
;
plc
.
Open
(
)
;
Console
.
WriteLine
(
"Reading items"
)
;
var
tc
=
new
ByteTest
(
)
;
plc
.
ReadClass
(
tc
,
800
,
0
)
;
plc
.
Close
(
)
;
// result
Console
.
WriteLine
(
"Results: "
)
;
var
t
=
typeof
(
ByteTest
)
;
PropertyInfo
[
]
propInfos
=
t
.
GetProperties
(
BindingFlags
.
Public
|
BindingFlags
.
Instance
)
;
foreach
(
var
item
in
propInfos
)
{
var
val
=
tc
.
GetType
(
)
.
GetProperty
(
item
.
Name
)
.
GetValue
(
tc
,
null
)
;
Console
.
WriteLine
(
"{0}: {1}"
,
item
.
Name
,
val
.
ToString
(
)
)
;
}
// keep console open
Console
.
WriteLine
(
"Press [Enter] to exit."
)
;
Console
.
Read
(
)
;
}
}
}
Back
|
FazBrowse Home
|
New Git URL