├── .gitattributes
├── .gitignore
├── ConfigWatcher
├── Config Watcher Guide.docx
├── ConfigWatcher.sln
└── ConfigWatcher
│ ├── ConfigWatcher.vbproj
│ ├── Form1.Designer.vb
│ ├── Form1.resx
│ ├── Form1.vb
│ ├── Logging.vb
│ ├── My Project
│ ├── Application.Designer.vb
│ ├── Application.myapp
│ ├── AssemblyInfo.vb
│ ├── Resources.Designer.vb
│ ├── Resources.resx
│ ├── Settings.Designer.vb
│ ├── Settings.settings
│ └── app.manifest
│ ├── Plug_and_play-icon.ico
│ ├── SplashScreen1.Designer.vb
│ ├── SplashScreen1.resx
│ ├── SplashScreen1.vb
│ └── app.config
├── CopyHis
├── CopyHis.sln
└── CopyHis
│ ├── CopyHis.vbproj
│ ├── Form1.Designer.vb
│ ├── Form1.resx
│ ├── Form1.vb
│ ├── My Project
│ ├── Application.Designer.vb
│ ├── Application.myapp
│ ├── AssemblyInfo.vb
│ ├── Resources.Designer.vb
│ ├── Resources.resx
│ ├── Settings.Designer.vb
│ └── Settings.settings
│ └── app.config
├── EventWatcher
├── App.config
├── EventWatcher.csproj
├── EventWatcher.sln
├── Program.cs
└── Properties
│ └── AssemblyInfo.cs
├── ExportHistoryToTSV(VB6)
├── ExportSCXHistoryToTSV.vbp
├── Main.frm
├── Main.frx
└── modSleep.bas
├── InsertHistoricData
├── App.config
├── InsertHistoricData.csproj
├── InsertHistoricData.sln
├── Program.cs
└── Properties
│ └── AssemblyInfo.cs
├── InsertHistoryCOMAPI
├── App.config
├── InsertHistoryCOMAPI.csproj
├── InsertHistoryCOMAPI.sln
├── Program.cs
└── Properties
│ └── AssemblyInfo.cs
├── InstanceParams
├── App.config
├── InstanceParams.csproj
├── InstanceParams.sln
├── Program.cs
└── Properties
│ └── AssemblyInfo.cs
├── LICENSE
├── ListAnimations
├── App.config
├── ListAnimations.csproj
├── ListAnimations.sln
├── Program.cs
└── Properties
│ └── AssemblyInfo.cs
├── ListReferences
├── App.config
├── ListReferences.csproj
├── ListReferences.sln
├── Program.cs
└── Properties
│ └── AssemblyInfo.cs
├── MimicGrabber
├── ApplicationEvents.vb
├── Form1.Designer.vb
├── Form1.resx
├── Form1.vb
├── MimicGrabber.sln
├── MimicGrabber.vbproj
├── My Project
│ ├── Application.Designer.vb
│ ├── Application.myapp
│ ├── AssemblyInfo.vb
│ ├── Resources.Designer.vb
│ ├── Resources.resx
│ ├── Settings.Designer.vb
│ ├── Settings.settings
│ └── app.manifest
├── README.md
└── app.config
├── PythonSamples
├── Geo SCADA Samples.py
├── GetHisAnnotationsExample.py
├── ListAllGroupACLs.py
├── ListAllReferencesToGroup.py
├── MoveAllGroupsToNewGroup.py
├── NetGeoSCADAExampleSetVQT.py
├── OverrideSimV1.py
├── README.md
├── SetPointValue.py
├── WeatherForecastToGeoSCADA.py
└── WeatherToGeoSCADA.py
├── README.md
├── SetAndWatchInternalPoint
├── App.config
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── SetAndWatchInternalPoint.csproj
└── SetAndWatchInternalPoint.sln
├── SetInternalPoint
├── App.config
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── SetInternalPoint.csproj
└── SetInternalPoint.sln
├── SetStaticLocation
├── App.config
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── SetStaticLocation.csproj
└── SetStaticLocation.sln
└── ViewXAPI1
├── App.config
├── Program.cs
├── Properties
└── AssemblyInfo.cs
├── ViewXAPI1.csproj
└── ViewXAPI1.sln
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/ConfigWatcher/Config Watcher Guide.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeoSCADA/Utilities-and-Examples/977e2dbb61fb968a39788400ac8754d6f1a68241/ConfigWatcher/Config Watcher Guide.docx
--------------------------------------------------------------------------------
/ConfigWatcher/ConfigWatcher.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.30804.86
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ConfigWatcher", "ConfigWatcher\ConfigWatcher.vbproj", "{951B410F-67EA-4226-A77A-665AB3331EC6}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {951B410F-67EA-4226-A77A-665AB3331EC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {951B410F-67EA-4226-A77A-665AB3331EC6}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {951B410F-67EA-4226-A77A-665AB3331EC6}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {951B410F-67EA-4226-A77A-665AB3331EC6}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {F6305DF6-BF99-462A-85F0-9DBA5D998BB6}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/ConfigWatcher/ConfigWatcher/ConfigWatcher.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 9.0.21022
7 | 2.0
8 | {951B410F-67EA-4226-A77A-665AB3331EC6}
9 | WinExe
10 | ConfigWatcher.My.MyApplication
11 | ConfigWatcher
12 | ConfigWatcher
13 | WindowsForms
14 |
15 |
16 | 3.5
17 |
18 |
19 | My Project\app.manifest
20 | false
21 | Plug_and_play-icon.ico
22 | publish\
23 | true
24 | Disk
25 | false
26 | Foreground
27 | 7
28 | Days
29 | false
30 | false
31 | true
32 | 0
33 | 1.4.0.%2a
34 | false
35 | true
36 | v4.8
37 |
38 |
39 |
40 | true
41 | full
42 | true
43 | true
44 | bin\Debug\
45 | ConfigWatcher.xml
46 | 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,42353,42354,42355
47 | false
48 |
49 |
50 | pdbonly
51 | false
52 | true
53 | true
54 | bin\Release\
55 | ConfigWatcher.xml
56 | 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,42353,42354,42355
57 | false
58 |
59 |
60 |
61 | ..\..\..\..\..\..\..\Program Files\Schneider Electric\ClearSCADA\ClearScada.Client.dll
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 | Form
83 |
84 |
85 | Form1.vb
86 | Form
87 |
88 |
89 |
90 |
91 | True
92 | Application.myapp
93 | True
94 |
95 |
96 | True
97 | True
98 | Resources.resx
99 |
100 |
101 | True
102 | Settings.settings
103 | True
104 |
105 |
106 | SplashScreen1.vb
107 |
108 |
109 | Form
110 |
111 |
112 |
113 |
114 | Designer
115 | Form1.vb
116 |
117 |
118 | VbMyResourcesResXFileCodeGenerator
119 | Resources.Designer.vb
120 | My.Resources
121 | Designer
122 |
123 |
124 | SplashScreen1.vb
125 | Designer
126 |
127 |
128 |
129 |
130 |
131 |
132 | MyApplicationCodeGenerator
133 | Application.Designer.vb
134 |
135 |
136 | SettingsSingleFileGenerator
137 | My
138 | Settings.Designer.vb
139 |
140 |
141 |
142 |
143 | False
144 | .NET Framework 2.0 %28x86%29
145 | true
146 |
147 |
148 | False
149 | .NET Framework 3.0 %28x86%29
150 | false
151 |
152 |
153 | False
154 | .NET Framework 3.5
155 | false
156 |
157 |
158 |
159 |
160 |
161 |
162 |
169 |
--------------------------------------------------------------------------------
/ConfigWatcher/ConfigWatcher/Logging.vb:
--------------------------------------------------------------------------------
1 | Module Logging
2 | Class Logger
3 | Private Writer As System.IO.StreamWriter
4 | Private logstatus As Boolean
5 | Private LogPrepend As String
6 |
7 | Public Sub New(ByVal PrePend As String)
8 | LogPrepend = PrePend
9 | logstatus = False
10 | End Sub
11 |
12 | Public Sub StartLogging(ByVal basename As String)
13 | Dim FileSearch() As System.IO.FileInfo
14 | Dim BaseFolder As New System.IO.DirectoryInfo(basename)
15 |
16 | FileSearch = BaseFolder.GetFiles("*.log")
17 |
18 | If FileSearch.Length = 0 Then
19 | 'case 1, no logs yet created
20 | Writer = System.IO.File.CreateText(basename & "\" & LogPrepend & "0.Log")
21 | logstatus = True
22 | ElseIf FileSearch.Length > 0 Then
23 | 'case 2, less than 10 logs are created
24 | Dim currentlog As Integer = 0
25 | Dim logfound As Boolean = False
26 | Do While logfound = False And currentlog < 9
27 | If System.IO.File.Exists(basename & "\" & LogPrepend & currentlog.ToString() & ".log") Then
28 | Dim Logattrib As New System.IO.FileInfo(basename & "\" & LogPrepend & currentlog.ToString() & ".log")
29 | If Logattrib.Length < 5242880 Then
30 | Try
31 | Writer = System.IO.File.AppendText(basename & "\" & LogPrepend & currentlog.ToString() & ".log")
32 | logfound = True
33 | Catch
34 | 'not found a file, probably in use
35 | End Try
36 | Else
37 | currentlog += 1
38 | End If
39 | Else
40 | 'Create new file
41 | Writer = System.IO.File.CreateText(basename & "\" & LogPrepend & currentlog.ToString() & ".log")
42 | logfound = True
43 | End If
44 | Loop
45 | logstatus = logfound
46 | If currentlog = 9 And logfound = False Then
47 | Dim Firstlog As Integer = 0
48 | Dim ThisFile As System.IO.FileInfo
49 | currentlog = 0
50 | For Each ThisFile In FileSearch
51 | If FileSearch(currentlog).LastWriteTime < FileSearch(Firstlog).LastWriteTime Then
52 | Firstlog = currentlog
53 | End If
54 | currentlog += 1
55 | Next
56 | Try
57 | System.IO.File.Delete(basename & "\" & LogPrepend & Firstlog.ToString() & ".log")
58 | Catch
59 | 'Cannot delete, possibly in use
60 | End Try
61 | Try
62 | Writer = System.IO.File.CreateText(basename & "\" & LogPrepend & Firstlog.ToString() & ".log")
63 | Catch
64 | 'Cannot create - unknown error, will not log
65 | End Try
66 |
67 | End If
68 | logstatus = logfound
69 | End If
70 |
71 | If logstatus = True Then
72 | Writer.WriteLine("")
73 | Writer.WriteLine(LogPrepend & " Execution at " & Now.ToString())
74 | Writer.WriteLine("---------------------------------------------------------------------")
75 | Writer.Flush()
76 | End If
77 |
78 | End Sub
79 |
80 | Public Sub WriteToLog(ByVal message As String)
81 | If logstatus = True Then
82 | Console.WriteLine(message)
83 | Writer.WriteLine(Now.ToString() & ": " & message)
84 | Writer.Flush()
85 | End If
86 | End Sub
87 |
88 | Public Sub StopLogging()
89 | If logstatus = True Then
90 | Writer.WriteLine("LOGGING TERMINATED")
91 | Writer.WriteLine("---------------------------------------------------------------------")
92 | Writer.Flush()
93 | Writer.Close()
94 | End If
95 | End Sub
96 | End Class
97 | End Module
98 |
--------------------------------------------------------------------------------
/ConfigWatcher/ConfigWatcher/My Project/Application.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | 'NOTE: This file is auto-generated; do not modify it directly. To make changes,
18 | ' or if you encounter build errors in this file, go to the Project Designer
19 | ' (go to Project Properties or double-click the My Project node in
20 | ' Solution Explorer), and make changes on the Application tab.
21 | '
22 | Partial Friend Class MyApplication
23 |
24 | _
25 | Public Sub New()
26 | MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
27 | Me.IsSingleInstance = false
28 | Me.EnableVisualStyles = true
29 | Me.SaveMySettingsOnExit = true
30 | Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
31 | End Sub
32 |
33 | _
34 | Protected Overrides Sub OnCreateMainForm()
35 | Me.MainForm = Global.ConfigWatcher.Form1
36 | End Sub
37 |
38 | _
39 | Protected Overrides Sub OnCreateSplashScreen()
40 | Me.SplashScreen = Global.ConfigWatcher.SplashScreen1
41 | End Sub
42 | End Class
43 | End Namespace
44 |
--------------------------------------------------------------------------------
/ConfigWatcher/ConfigWatcher/My Project/Application.myapp:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 | Form1
5 | false
6 | 0
7 | true
8 | 0
9 | SplashScreen1
10 | true
11 |
--------------------------------------------------------------------------------
/ConfigWatcher/ConfigWatcher/My Project/AssemblyInfo.vb:
--------------------------------------------------------------------------------
1 | Imports System
2 | Imports System.Reflection
3 | Imports System.Runtime.InteropServices
4 |
5 | ' General Information about an assembly is controlled through the following
6 | ' set of attributes. Change these attribute values to modify the information
7 | ' associated with an assembly.
8 |
9 | ' Review the values of the assembly attributes
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 'The following GUID is for the ID of the typelib if this project is exposed to COM
21 |
22 |
23 | ' Version information for an assembly consists of the following four values:
24 | '
25 | ' Major Version
26 | ' Minor Version
27 | ' Build Number
28 | ' Revision
29 | '
30 | ' You can specify all the values or you can default the Build and Revision Numbers
31 | ' by using the '*' as shown below:
32 | '
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/ConfigWatcher/ConfigWatcher/My Project/Resources.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 | Imports System
15 |
16 | Namespace My.Resources
17 |
18 | 'This class was auto-generated by the StronglyTypedResourceBuilder
19 | 'class via a tool like ResGen or Visual Studio.
20 | 'To add or remove a member, edit your .ResX file then rerun ResGen
21 | 'with the /str option, or rebuild your VS project.
22 | '''
23 | ''' A strongly-typed resource class, for looking up localized strings, etc.
24 | '''
25 | _
29 | Friend Module Resources
30 |
31 | Private resourceMan As Global.System.Resources.ResourceManager
32 |
33 | Private resourceCulture As Global.System.Globalization.CultureInfo
34 |
35 | '''
36 | ''' Returns the cached ResourceManager instance used by this class.
37 | '''
38 | _
39 | Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
40 | Get
41 | If Object.ReferenceEquals(resourceMan, Nothing) Then
42 | Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("ConfigWatcher.Resources", GetType(Resources).Assembly)
43 | resourceMan = temp
44 | End If
45 | Return resourceMan
46 | End Get
47 | End Property
48 |
49 | '''
50 | ''' Overrides the current thread's CurrentUICulture property for all
51 | ''' resource lookups using this strongly typed resource class.
52 | '''
53 | _
54 | Friend Property Culture() As Global.System.Globalization.CultureInfo
55 | Get
56 | Return resourceCulture
57 | End Get
58 | Set
59 | resourceCulture = value
60 | End Set
61 | End Property
62 | End Module
63 | End Namespace
64 |
--------------------------------------------------------------------------------
/ConfigWatcher/ConfigWatcher/My Project/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/ConfigWatcher/ConfigWatcher/My Project/Settings.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | _
20 | Partial Friend NotInheritable Class MySettings
21 | Inherits Global.System.Configuration.ApplicationSettingsBase
22 |
23 | Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
24 |
25 | #Region "My.Settings Auto-Save Functionality"
26 | #If _MyType = "WindowsForms" Then
27 | Private Shared addedHandler As Boolean
28 |
29 | Private Shared addedHandlerLockObject As New Object
30 |
31 | _
32 | Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs)
33 | If My.Application.SaveMySettingsOnExit Then
34 | My.Settings.Save()
35 | End If
36 | End Sub
37 | #End If
38 | #End Region
39 |
40 | Public Shared ReadOnly Property [Default]() As MySettings
41 | Get
42 |
43 | #If _MyType = "WindowsForms" Then
44 | If Not addedHandler Then
45 | SyncLock addedHandlerLockObject
46 | If Not addedHandler Then
47 | AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
48 | addedHandler = True
49 | End If
50 | End SyncLock
51 | End If
52 | #End If
53 | Return defaultInstance
54 | End Get
55 | End Property
56 | End Class
57 | End Namespace
58 |
59 | Namespace My
60 |
61 | _
64 | Friend Module MySettingsProperty
65 |
66 | _
67 | Friend ReadOnly Property Settings() As Global.ConfigWatcher.My.MySettings
68 | Get
69 | Return Global.ConfigWatcher.My.MySettings.Default
70 | End Get
71 | End Property
72 | End Module
73 | End Namespace
74 |
--------------------------------------------------------------------------------
/ConfigWatcher/ConfigWatcher/My Project/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ConfigWatcher/ConfigWatcher/My Project/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/ConfigWatcher/ConfigWatcher/Plug_and_play-icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeoSCADA/Utilities-and-Examples/977e2dbb61fb968a39788400ac8754d6f1a68241/ConfigWatcher/ConfigWatcher/Plug_and_play-icon.ico
--------------------------------------------------------------------------------
/ConfigWatcher/ConfigWatcher/SplashScreen1.Designer.vb:
--------------------------------------------------------------------------------
1 | _
2 | Partial Class SplashScreen1
3 | Inherits System.Windows.Forms.Form
4 |
5 | 'Form overrides dispose to clean up the component list.
6 | _
7 | Protected Overrides Sub Dispose(ByVal disposing As Boolean)
8 | Try
9 | If disposing AndAlso components IsNot Nothing Then
10 | components.Dispose()
11 | End If
12 | Finally
13 | MyBase.Dispose(disposing)
14 | End Try
15 | End Sub
16 |
17 | 'Required by the Windows Form Designer
18 | Private components As System.ComponentModel.IContainer
19 |
20 | 'NOTE: The following procedure is required by the Windows Form Designer
21 | 'It can be modified using the Windows Form Designer.
22 | 'Do not modify it using the code editor.
23 | _
24 | Private Sub InitializeComponent()
25 | Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(SplashScreen1))
26 | Me.ApplicationTitle = New System.Windows.Forms.Label()
27 | Me.Label1 = New System.Windows.Forms.Label()
28 | Me.Label3 = New System.Windows.Forms.Label()
29 | Me.PictureBox2 = New System.Windows.Forms.PictureBox()
30 | CType(Me.PictureBox2, System.ComponentModel.ISupportInitialize).BeginInit()
31 | Me.SuspendLayout()
32 | '
33 | 'ApplicationTitle
34 | '
35 | Me.ApplicationTitle.AutoSize = True
36 | Me.ApplicationTitle.BackColor = System.Drawing.Color.Transparent
37 | Me.ApplicationTitle.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
38 | Me.ApplicationTitle.ForeColor = System.Drawing.Color.FromArgb(CType(CType(98, Byte), Integer), CType(CType(100, Byte), Integer), CType(CType(105, Byte), Integer))
39 | Me.ApplicationTitle.Location = New System.Drawing.Point(12, 9)
40 | Me.ApplicationTitle.Name = "ApplicationTitle"
41 | Me.ApplicationTitle.Size = New System.Drawing.Size(270, 29)
42 | Me.ApplicationTitle.TabIndex = 3
43 | Me.ApplicationTitle.Text = "Config Watcher {0}.{1:0}"
44 | Me.ApplicationTitle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
45 | '
46 | 'Label1
47 | '
48 | Me.Label1.Anchor = System.Windows.Forms.AnchorStyles.None
49 | Me.Label1.AutoSize = True
50 | Me.Label1.BackColor = System.Drawing.Color.Transparent
51 | Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
52 | Me.Label1.ForeColor = System.Drawing.Color.FromArgb(CType(CType(98, Byte), Integer), CType(CType(100, Byte), Integer), CType(CType(105, Byte), Integer))
53 | Me.Label1.Location = New System.Drawing.Point(17, 43)
54 | Me.Label1.Name = "Label1"
55 | Me.Label1.Size = New System.Drawing.Size(147, 17)
56 | Me.Label1.TabIndex = 7
57 | Me.Label1.Text = "Manage Configuration"
58 | '
59 | 'Label3
60 | '
61 | Me.Label3.Anchor = System.Windows.Forms.AnchorStyles.None
62 | Me.Label3.BackColor = System.Drawing.Color.Transparent
63 | Me.Label3.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
64 | Me.Label3.ForeColor = System.Drawing.Color.FromArgb(CType(CType(98, Byte), Integer), CType(CType(100, Byte), Integer), CType(CType(105, Byte), Integer))
65 | Me.Label3.Location = New System.Drawing.Point(16, 244)
66 | Me.Label3.Name = "Label3"
67 | Me.Label3.Size = New System.Drawing.Size(237, 28)
68 | Me.Label3.TabIndex = 9
69 | Me.Label3.Text = "Loading ..."
70 | Me.Label3.TextAlign = System.Drawing.ContentAlignment.BottomLeft
71 | '
72 | 'PictureBox2
73 | '
74 | Me.PictureBox2.Image = CType(resources.GetObject("PictureBox2.Image"), System.Drawing.Image)
75 | Me.PictureBox2.Location = New System.Drawing.Point(165, 93)
76 | Me.PictureBox2.Name = "PictureBox2"
77 | Me.PictureBox2.Size = New System.Drawing.Size(128, 128)
78 | Me.PictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom
79 | Me.PictureBox2.TabIndex = 10
80 | Me.PictureBox2.TabStop = False
81 | '
82 | 'SplashScreen1
83 | '
84 | Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 16.0!)
85 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
86 | Me.BackColor = System.Drawing.Color.White
87 | Me.ClientSize = New System.Drawing.Size(444, 294)
88 | Me.ControlBox = False
89 | Me.Controls.Add(Me.PictureBox2)
90 | Me.Controls.Add(Me.Label3)
91 | Me.Controls.Add(Me.Label1)
92 | Me.Controls.Add(Me.ApplicationTitle)
93 | Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D
94 | Me.MaximizeBox = False
95 | Me.MinimizeBox = False
96 | Me.Name = "SplashScreen1"
97 | Me.ShowInTaskbar = False
98 | Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
99 | CType(Me.PictureBox2, System.ComponentModel.ISupportInitialize).EndInit()
100 | Me.ResumeLayout(False)
101 | Me.PerformLayout()
102 |
103 | End Sub
104 | Friend WithEvents ApplicationTitle As System.Windows.Forms.Label
105 | Friend WithEvents Label1 As System.Windows.Forms.Label
106 | Friend WithEvents Label3 As System.Windows.Forms.Label
107 | Friend WithEvents PictureBox2 As System.Windows.Forms.PictureBox
108 |
109 | End Class
110 |
--------------------------------------------------------------------------------
/ConfigWatcher/ConfigWatcher/SplashScreen1.vb:
--------------------------------------------------------------------------------
1 | Public NotInheritable Class SplashScreen1
2 |
3 | Private Sub SplashScreen1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
4 | 'Set up the dialog text at runtime according to the application's assembly information.
5 | ApplicationTitle.Text = System.String.Format(ApplicationTitle.Text, My.Application.Info.Version.Major, My.Application.Info.Version.Minor)
6 |
7 | End Sub
8 |
9 | End Class
10 |
--------------------------------------------------------------------------------
/ConfigWatcher/ConfigWatcher/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/CopyHis/CopyHis.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 11.00
3 | # Visual Studio 2010
4 | Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "CopyHis", "CopyHis\CopyHis.vbproj", "{29E17183-5641-4BF6-94E4-764B8D44B7C5}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Any CPU = Debug|Any CPU
9 | Release|Any CPU = Release|Any CPU
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {29E17183-5641-4BF6-94E4-764B8D44B7C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
13 | {29E17183-5641-4BF6-94E4-764B8D44B7C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
14 | {29E17183-5641-4BF6-94E4-764B8D44B7C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
15 | {29E17183-5641-4BF6-94E4-764B8D44B7C5}.Release|Any CPU.Build.0 = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/CopyHis/CopyHis/CopyHis.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 8.0.50727
7 | 2.0
8 | {29E17183-5641-4BF6-94E4-764B8D44B7C5}
9 | WinExe
10 | CopyHis.My.MyApplication
11 | CopyHis
12 | CopyHis
13 | WindowsForms
14 |
15 |
16 |
17 |
18 | 3.5
19 | v3.5
20 | Client
21 | publish\
22 | true
23 | Disk
24 | false
25 | Foreground
26 | 7
27 | Days
28 | false
29 | false
30 | true
31 | 0
32 | 1.0.0.%2a
33 | false
34 | false
35 | true
36 |
37 |
38 | true
39 | full
40 | true
41 | true
42 | bin\Debug\
43 | CopyHis.xml
44 | 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,42353,42354,42355
45 |
46 |
47 | pdbonly
48 | false
49 | true
50 | true
51 | bin\Release\
52 | CopyHis.xml
53 | 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,42353,42354,42355
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 | Form
76 |
77 |
78 | Form1.vb
79 | Form
80 |
81 |
82 |
83 | True
84 | Application.myapp
85 |
86 |
87 | True
88 | True
89 | Resources.resx
90 |
91 |
92 | True
93 | Settings.settings
94 | True
95 |
96 |
97 |
98 |
99 | Designer
100 | Form1.vb
101 |
102 |
103 | VbMyResourcesResXFileCodeGenerator
104 | Resources.Designer.vb
105 | My.Resources
106 | Designer
107 |
108 |
109 |
110 |
111 |
112 | MyApplicationCodeGenerator
113 | Application.Designer.vb
114 |
115 |
116 | SettingsSingleFileGenerator
117 | My
118 | Settings.Designer.vb
119 |
120 |
121 |
122 |
123 | False
124 | .NET Framework 3.5 SP1 Client Profile
125 | false
126 |
127 |
128 | False
129 | .NET Framework 3.5 SP1
130 | true
131 |
132 |
133 | False
134 | Windows Installer 3.1
135 | true
136 |
137 |
138 |
139 |
146 |
--------------------------------------------------------------------------------
/CopyHis/CopyHis/Form1.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | 17, 17
122 |
123 |
124 | 584, 13
125 |
126 |
--------------------------------------------------------------------------------
/CopyHis/CopyHis/My Project/Application.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.269
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | 'NOTE: This file is auto-generated; do not modify it directly. To make changes,
18 | ' or if you encounter build errors in this file, go to the Project Designer
19 | ' (go to Project Properties or double-click the My Project node in
20 | ' Solution Explorer), and make changes on the Application tab.
21 | '
22 | Partial Friend Class MyApplication
23 |
24 | _
25 | Public Sub New()
26 | MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
27 | Me.IsSingleInstance = false
28 | Me.EnableVisualStyles = true
29 | Me.SaveMySettingsOnExit = true
30 | Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
31 | End Sub
32 |
33 | _
34 | Protected Overrides Sub OnCreateMainForm()
35 | Me.MainForm = Global.CopyHis.Form1
36 | End Sub
37 | End Class
38 | End Namespace
39 |
--------------------------------------------------------------------------------
/CopyHis/CopyHis/My Project/Application.myapp:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 | Form1
5 | false
6 | 0
7 | true
8 | 0
9 | 0
10 | true
11 |
12 |
--------------------------------------------------------------------------------
/CopyHis/CopyHis/My Project/AssemblyInfo.vb:
--------------------------------------------------------------------------------
1 | Imports System
2 | Imports System.Reflection
3 | Imports System.Runtime.InteropServices
4 |
5 | ' General Information about an assembly is controlled through the following
6 | ' set of attributes. Change these attribute values to modify the information
7 | ' associated with an assembly.
8 |
9 | ' Review the values of the assembly attributes
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 'The following GUID is for the ID of the typelib if this project is exposed to COM
21 |
22 |
23 | ' Version information for an assembly consists of the following four values:
24 | '
25 | ' Major Version
26 | ' Minor Version
27 | ' Build Number
28 | ' Revision
29 | '
30 | ' You can specify all the values or you can default the Build and Revision Numbers
31 | ' by using the '*' as shown below:
32 | '
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/CopyHis/CopyHis/My Project/Resources.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.269
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 | Imports System
15 |
16 | Namespace My.Resources
17 |
18 | 'This class was auto-generated by the StronglyTypedResourceBuilder
19 | 'class via a tool like ResGen or Visual Studio.
20 | 'To add or remove a member, edit your .ResX file then rerun ResGen
21 | 'with the /str option, or rebuild your VS project.
22 | '''
23 | ''' A strongly-typed resource class, for looking up localized strings, etc.
24 | '''
25 | _
29 | Friend Module Resources
30 |
31 | Private resourceMan As Global.System.Resources.ResourceManager
32 |
33 | Private resourceCulture As Global.System.Globalization.CultureInfo
34 |
35 | '''
36 | ''' Returns the cached ResourceManager instance used by this class.
37 | '''
38 | _
39 | Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
40 | Get
41 | If Object.ReferenceEquals(resourceMan, Nothing) Then
42 | Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("CopyHis.Resources", GetType(Resources).Assembly)
43 | resourceMan = temp
44 | End If
45 | Return resourceMan
46 | End Get
47 | End Property
48 |
49 | '''
50 | ''' Overrides the current thread's CurrentUICulture property for all
51 | ''' resource lookups using this strongly typed resource class.
52 | '''
53 | _
54 | Friend Property Culture() As Global.System.Globalization.CultureInfo
55 | Get
56 | Return resourceCulture
57 | End Get
58 | Set
59 | resourceCulture = value
60 | End Set
61 | End Property
62 | End Module
63 | End Namespace
64 |
--------------------------------------------------------------------------------
/CopyHis/CopyHis/My Project/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/CopyHis/CopyHis/My Project/Settings.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.269
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | _
20 | Partial Friend NotInheritable Class MySettings
21 | Inherits Global.System.Configuration.ApplicationSettingsBase
22 |
23 | Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
24 |
25 | #Region "My.Settings Auto-Save Functionality"
26 | #If _MyType = "WindowsForms" Then
27 | Private Shared addedHandler As Boolean
28 |
29 | Private Shared addedHandlerLockObject As New Object
30 |
31 | _
32 | Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
33 | If My.Application.SaveMySettingsOnExit Then
34 | My.Settings.Save()
35 | End If
36 | End Sub
37 | #End If
38 | #End Region
39 |
40 | Public Shared ReadOnly Property [Default]() As MySettings
41 | Get
42 |
43 | #If _MyType = "WindowsForms" Then
44 | If Not addedHandler Then
45 | SyncLock addedHandlerLockObject
46 | If Not addedHandler Then
47 | AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
48 | addedHandler = True
49 | End If
50 | End SyncLock
51 | End If
52 | #End If
53 | Return defaultInstance
54 | End Get
55 | End Property
56 | End Class
57 | End Namespace
58 |
59 | Namespace My
60 |
61 | _
64 | Friend Module MySettingsProperty
65 |
66 | _
67 | Friend ReadOnly Property Settings() As Global.CopyHis.My.MySettings
68 | Get
69 | Return Global.CopyHis.My.MySettings.Default
70 | End Get
71 | End Property
72 | End Module
73 | End Namespace
74 |
--------------------------------------------------------------------------------
/CopyHis/CopyHis/My Project/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/CopyHis/CopyHis/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/EventWatcher/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/EventWatcher/EventWatcher.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {6566424C-A776-449F-9A54-73F5B546B494}
8 | Exe
9 | Properties
10 | EventWatcher
11 | EventWatcher
12 | v4.8
13 | 512
14 | true
15 |
16 |
17 |
18 | AnyCPU
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | AnyCPU
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 |
36 |
37 |
38 | c:\Program Files\Schneider Electric\ClearSCADA\ClearScada.Client.dll
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
64 |
--------------------------------------------------------------------------------
/EventWatcher/EventWatcher.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventWatcher", "EventWatcher.csproj", "{6566424C-A776-449F-9A54-73F5B546B494}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {6566424C-A776-449F-9A54-73F5B546B494}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {6566424C-A776-449F-9A54-73F5B546B494}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {6566424C-A776-449F-9A54-73F5B546B494}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {6566424C-A776-449F-9A54-73F5B546B494}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/EventWatcher/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Security;
3 | using System.Threading.Tasks;
4 | using System.Collections.Generic;
5 | using ClearScada.Client; // Find ClearSCADA.Client.dll in the Program Files\Schneider Electric\ClearSCADA folder
6 | using ClearScada.Client.Advanced;
7 |
8 | namespace EventWatcher
9 | {
10 | class Program
11 | {
12 | static bool WaitUntilStopped = true;
13 | async static Task Main(string[] args)
14 | {
15 | if (args.Length != 2)
16 | {
17 | Console.WriteLine("Usage: EventWatcher \"username\" \"password\" ");
18 | return;
19 | }
20 | string user = args[0];
21 | string pass = args[1];
22 |
23 | ClearScada.Client.Simple.Connection connection;
24 | // Make version-independent
25 | #pragma warning disable 612, 618
26 | var node = new ClearScada.Client.ServerNode(ConnectionType.Standard, "127.0.0.1", 5481);
27 | connection = new ClearScada.Client.Simple.Connection("Utility");
28 | IServer AdvConnection;
29 | try
30 | {
31 | connection.Connect(node);
32 | AdvConnection = node.Connect("SeverityCleaner");
33 | }
34 | catch (CommunicationsException)
35 | {
36 | Console.WriteLine("Unable to communicate with Geo SCADA server.");
37 | return;
38 | }
39 | #pragma warning restore 612, 618
40 | if (!connection.IsConnected)
41 | {
42 | Console.WriteLine("Not connected to Geo SCADA server.");
43 | return;
44 | }
45 | using (var spassword = new System.Security.SecureString())
46 | {
47 | foreach (var c in pass)
48 | {
49 | spassword.AppendChar(c);
50 | }
51 | try
52 | {
53 | connection.LogOn(user, spassword);
54 | AdvConnection.LogOn(user, spassword);
55 | }
56 | catch (AccessDeniedException)
57 | {
58 | Console.WriteLine("Access denied, incorrect user Id or password");
59 | return;
60 | }
61 | catch (PasswordExpiredException)
62 | {
63 | Console.WriteLine("Credentials expired.");
64 | return;
65 | }
66 | }
67 |
68 | // Set event callback
69 | // subscriptionId is just a unique Id, we just use a Guid (you can make many subscriptions if you want)
70 | var subscriptionId = Guid.NewGuid().ToString();
71 |
72 | // Filter string is the Server side Alarm Filter String that you can configure in ViewX
73 | var filter="Categories=\"PointState;Security;Action\"";
74 |
75 | // OPCEventCategory allows you to request properties are sent along with events.
76 | // The CategoryId 0x208 identifies the EventCategory and comes from the Database.
77 | // The opcvalue is a an OPC property number from the schema
78 | ///OPCEventCategory category1 = new OPCEventCategory(0x208); // Analogue alarm
79 | ///category1.OPCAttributes.Add(OPCAttr1);
80 | ///category1.OPCAttributes.Add(OPCAttr2);
81 | ///List OPCCategories = new List();
82 | ///OPCCategories.Add(category1);
83 | // And add OPCCategories to the AddEventSubscription call below
84 |
85 | // Register the Event Handler
86 | AdvConnection.EventsUpdated += OnEventSubscriptionEvents;
87 |
88 | // Disconnect Callback
89 | AdvConnection.StateChanged += DBStateChangeEvent;
90 | AdvConnection.AdviseStateChange();
91 |
92 |
93 | // Subscribe to Events
94 | AdvConnection.AddEventSubscription(subscriptionId, filter); ///, OPCCategories);
95 |
96 | // Wait and watch for changes
97 | Console.WriteLine("Waiting for changes");
98 | while (WaitUntilStopped)
99 | {
100 | await Task.Delay(1000);
101 | }
102 |
103 | connection.Disconnect();
104 | return;
105 | }
106 |
107 |
108 | static void OnEventSubscriptionEvents(object sender, EventsUpdatedEventArgs arg)
109 | {
110 | // If there are two different sub's open at the same time, they will both be seeing each others events.
111 | // if (string.CompareOrdinal(arg.ClientId, eventSubscriptionId) != 0)
112 | // return;
113 |
114 | foreach (EventData f in arg.Updates)
115 | {
116 | // Do stuff with the events
117 | string AttrList = "";
118 | foreach( var AttrItem in f.EventAttributes)
119 | {
120 | AttrList += ", " + (AttrItem ?? "-").ToString();
121 | }
122 | Console.WriteLine($"{f.Time} {f.Message}, {f.EventCategory}, {f.Severity}, {f.Source}, {f.EventCategory} {AttrList}");
123 | }
124 | }
125 |
126 | // Called when server state changes, stop the wait
127 | static void DBStateChangeEvent(object sender, StateChangeEventArgs stateChange)
128 | {
129 | if (stateChange.StateDetails.State != ServerState.Main)
130 | {
131 | WaitUntilStopped = false;
132 | }
133 | }
134 | }
135 | }
136 |
--------------------------------------------------------------------------------
/EventWatcher/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("EventWatcher")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("EventWatcher")]
13 | [assembly: AssemblyCopyright("Copyright © 2022")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("6566424c-a776-449f-9a54-73f5b546b494")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/ExportHistoryToTSV(VB6)/ExportSCXHistoryToTSV.vbp:
--------------------------------------------------------------------------------
1 | Type=Exe
2 | Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\..\..\WINDOWS\system32\stdole2.tlb#OLE Automation
3 | Reference=*\G{2A75196C-D9EB-4129-B803-931327F72D5C}#2.8#0#..\..\..\..\..\Program Files\Common Files\System\ado\msado15.dll#Microsoft ActiveX Data Objects 2.8 Library
4 | Reference=*\G{EEAD2000-0777-11D2-AF05-0000E82E7A14}#1.2#0#..\..\..\..\..\Program Files\Serck Controls\ScxV6\DBClient.dll#Scx V6 Automation Interface
5 | Form=Main.frm
6 | Module=modSleep; modSleep.bas
7 | IconForm="Main"
8 | Startup="Main"
9 | HelpFile=""
10 | Title="ExportSCXHistoryToTSV"
11 | ExeName32="ExportSCXHistoryToTSV.exe"
12 | Command32=""
13 | Name="Project1"
14 | HelpContextID="0"
15 | CompatibleMode="0"
16 | MajorVer=1
17 | MinorVer=0
18 | RevisionVer=31
19 | AutoIncrementVer=1
20 | ServerSupportFiles=0
21 | CompilationType=0
22 | OptimizationType=0
23 | FavorPentiumPro(tm)=0
24 | CodeViewDebugInfo=0
25 | NoAliasing=0
26 | BoundsCheck=0
27 | OverflowCheck=0
28 | FlPointCheck=0
29 | FDIVCheck=0
30 | UnroundedFP=0
31 | StartMode=0
32 | Unattended=0
33 | Retained=0
34 | ThreadPerObject=0
35 | MaxNumberOfThreads=1
36 |
37 | [MS Transaction Server]
38 | AutoRefresh=1
39 |
--------------------------------------------------------------------------------
/ExportHistoryToTSV(VB6)/Main.frx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeoSCADA/Utilities-and-Examples/977e2dbb61fb968a39788400ac8754d6f1a68241/ExportHistoryToTSV(VB6)/Main.frx
--------------------------------------------------------------------------------
/ExportHistoryToTSV(VB6)/modSleep.bas:
--------------------------------------------------------------------------------
1 | Attribute VB_Name = "modSleep"
2 | Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
3 |
4 |
--------------------------------------------------------------------------------
/InsertHistoricData/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/InsertHistoricData/InsertHistoricData.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {DD779E98-FED7-4CE9-9E45-D53466323471}
8 | Exe
9 | Properties
10 | InsertHistoricData
11 | InsertHistoricData
12 | v4.8
13 | 512
14 | true
15 |
16 |
17 |
18 | AnyCPU
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | AnyCPU
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 |
36 |
37 |
38 | ..\..\..\..\..\..\Program Files\Schneider Electric\ClearSCADA\ClearScada.Client.dll
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
64 |
--------------------------------------------------------------------------------
/InsertHistoricData/InsertHistoricData.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InsertHistoricData", "InsertHistoricData.csproj", "{DD779E98-FED7-4CE9-9E45-D53466323471}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {DD779E98-FED7-4CE9-9E45-D53466323471}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {DD779E98-FED7-4CE9-9E45-D53466323471}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {DD779E98-FED7-4CE9-9E45-D53466323471}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {DD779E98-FED7-4CE9-9E45-D53466323471}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/InsertHistoricData/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using ClearScada.Client;
3 | using System.Security;
4 |
5 | namespace InsertHistoricData
6 | {
7 | class Program
8 | {
9 | static void Main()
10 | {
11 | // EDIT YOUR CREDENTIALS, OR PASS IN AS ARGUMENTS - PLEASE CHOOSE YOUR OWN METHOD
12 | string user = "";
13 | string pass = "";
14 |
15 | ClearScada.Client.Simple.Connection connection;
16 | #pragma warning disable 612, 618
17 | var node = new ClearScada.Client.ServerNode(ConnectionType.Standard, "127.0.0.1", 5481);
18 | connection = new ClearScada.Client.Simple.Connection("Utility");
19 | connection.Connect(node);
20 | #pragma warning restore 612, 618
21 | var spassword = new System.Security.SecureString();
22 | foreach (var c in pass) spassword.AppendChar(c);
23 | connection.LogOn(user, spassword);
24 |
25 | // Insert point name here
26 | ClearScada.Client.Simple.DBObject PointObj = connection.GetObject("New Analog Point");
27 | DateTime now = DateTime.UtcNow;
28 |
29 | // Load a year's values
30 | DateTimeOffset Time = new DateTimeOffset(2022, 1, 1, 0, 30, 0, TimeSpan.Zero); // Start of last year + 30 Min
31 | double Value = 0;
32 | do
33 | {
34 | Object[] p1 = new Object[4];
35 | p1[0] = 1;
36 | p1[1] = 192;
37 | p1[2] = Time;
38 | p1[3] = Value;
39 | PointObj.Aggregates["Historic"].InvokeMethod("LoadDataValue", p1);
40 |
41 | Value += 0.01;
42 | if ((Value - Math.Floor(Value)) > 0.235) Value = Math.Floor(Value + 1);
43 | Time += new TimeSpan(1, 0, 0); // 1H
44 | } while (Time < DateTime.UtcNow);
45 |
46 | #if false
47 | // Various calls to read values back
48 | Object[] p2 = new Object[5];
49 | p2[0] = now.AddSeconds(-1);
50 | p2[1] = now.AddSeconds(1);
51 | p2[2] = 0;
52 | p2[3] = true;
53 | p2[4] = "All";
54 | object r = PointObj.Aggregates["Historic"].InvokeMethod("RawValue", p2);
55 | Console.WriteLine(r);
56 |
57 | Object[] p3 = new Object[6];
58 | p3[0] = now.AddSeconds(-1);
59 | p3[1] = now.AddSeconds(1);
60 | p3[2] = 0;
61 | p3[3] = 1;
62 | p3[4] = true;
63 | p3[5] = "All";
64 | object [] k = (object [])PointObj.Aggregates["Historic"].InvokeMethod("RawValues", p3);
65 | Console.WriteLine(k[0]);
66 |
67 | Object[] p4 = new Object[6];
68 | p4[0] = now.AddSeconds(-1);
69 | p4[1] = "2S";
70 | p4[2] = 0;
71 | p4[3] = 1;
72 | p4[4] = true;
73 | p4[5] = "All";
74 | object[] q = (object[])PointObj.Aggregates["Historic"].InvokeMethod("RawValuesRange", p4);
75 | Console.WriteLine(q[0]);
76 | #endif
77 | Console.ReadKey();
78 | }
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/InsertHistoricData/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("InsertHistoricData")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("InsertHistoricData")]
13 | [assembly: AssemblyCopyright("Copyright © 2020")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("dd779e98-fed7-4ce9-9e45-d53466323471")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/InsertHistoryCOMAPI/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/InsertHistoryCOMAPI/InsertHistoryCOMAPI.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {B2E48B8B-C2AC-43E8-8D2A-E91AAEFAE4A6}
8 | Exe
9 | Properties
10 | InsertHistoryCOMAPI
11 | InsertHistoryCOMAPI
12 | v4.7.2
13 | 512
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 | {EEAD2000-0777-11D2-AF05-0000E82E7A14}
55 | 1
56 | 2
57 | 0
58 | tlbimp
59 | False
60 | True
61 |
62 |
63 |
64 |
71 |
--------------------------------------------------------------------------------
/InsertHistoryCOMAPI/InsertHistoryCOMAPI.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InsertHistoryCOMAPI", "InsertHistoryCOMAPI.csproj", "{B2E48B8B-C2AC-43E8-8D2A-E91AAEFAE4A6}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {B2E48B8B-C2AC-43E8-8D2A-E91AAEFAE4A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {B2E48B8B-C2AC-43E8-8D2A-E91AAEFAE4A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {B2E48B8B-C2AC-43E8-8D2A-E91AAEFAE4A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {B2E48B8B-C2AC-43E8-8D2A-E91AAEFAE4A6}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/InsertHistoryCOMAPI/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using ScxV6DbClient;
7 |
8 | namespace InsertHistoryCOMAPI
9 | {
10 | class Program
11 | {
12 | static void Main(string[] args)
13 | {
14 | ScxV6Server objServer = new ScxV6Server();
15 | objServer.Connect("Local", "s", "s");
16 | ScxV6Object obj = objServer.FindObject("New Analog Point");
17 | ScxV6Aggregate His = obj.Aggregate["Historic"];
18 | His.Interface.LoadDataValue(1, 192, DateTime.UtcNow, 13);
19 | obj = null;
20 | objServer.Disconnect();
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/InsertHistoryCOMAPI/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("InsertHistoryCOMAPI")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("InsertHistoryCOMAPI")]
13 | [assembly: AssemblyCopyright("Copyright © 2020")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("b2e48b8b-c2ac-43e8-8d2a-e91aaefae4a6")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/InstanceParams/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/InstanceParams/InstanceParams.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {F766424C-A776-449F-9A54-73F5B546B494}
8 | Exe
9 | Properties
10 | InstanceParams
11 | InstanceParams
12 | v4.8
13 | 512
14 | true
15 |
16 |
17 |
18 | AnyCPU
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | AnyCPU
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 |
36 |
37 |
38 | ..\..\..\..\..\..\Program Files\Schneider Electric\ClearSCADA\ClearScada.Client.dll
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
64 |
--------------------------------------------------------------------------------
/InstanceParams/InstanceParams.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{0AE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InstanceParams", "InstanceParams.csproj", "{F766424C-A776-449F-9A54-73F5B546B494}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {F766424C-A776-449F-9A54-73F5B546B494}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {F766424C-A776-449F-9A54-73F5B546B494}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {F766424C-A776-449F-9A54-73F5B546B494}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {F766424C-A776-449F-9A54-73F5B546B494}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/InstanceParams/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Security;
4 | using ClearScada.Client;
5 |
6 | namespace InstanceParams
7 | {
8 | class Program
9 | {
10 | static int Main(string[] args)
11 | {
12 | if (args.Length != 5)
13 | {
14 | Console.WriteLine("Usage: InstanceParams \"username\" \"password\" \"Instance-Name\" \"Parameter-Name\" \"Value\" ");
15 | return 1;
16 | }
17 | string user = args[0];
18 | string pass = args[1];
19 | string instancename = args[2];
20 | string paramname = args[3];
21 | string valuetext = args[4];
22 | double valuedouble;
23 | if (!double.TryParse(valuetext, out valuedouble))
24 | {
25 | Console.WriteLine("Value is not numeric");
26 | //return 1;
27 | }
28 |
29 | ClearScada.Client.Simple.Connection connection;
30 | #pragma warning disable 612, 618
31 | var node = new ClearScada.Client.ServerNode(ConnectionType.Standard, "127.0.0.1", 5481);
32 | connection = new ClearScada.Client.Simple.Connection("Utility");
33 | try
34 | {
35 | connection.Connect(node);
36 | }
37 | catch (CommunicationsException)
38 | {
39 | Console.WriteLine("Unable to communicate with Geo SCADA server.");
40 | return 1;
41 | }
42 | #pragma warning restore 612, 618
43 | if (!connection.IsConnected)
44 | {
45 | Console.WriteLine("Not connected to Geo SCADA server.");
46 | return 1;
47 | }
48 | using (var spassword = new System.Security.SecureString())
49 | {
50 | foreach (var c in pass)
51 | {
52 | spassword.AppendChar(c);
53 | }
54 | try
55 | {
56 | connection.LogOn(user, spassword);
57 | }
58 | catch (AccessDeniedException)
59 | {
60 | Console.WriteLine("Access denied, incorrect user Id or password");
61 | return 1;
62 | }
63 | catch (PasswordExpiredException)
64 | {
65 | Console.WriteLine("Credentials expired.");
66 | return 1;
67 | }
68 | }
69 | // Get instance object
70 | ClearScada.Client.Simple.DBObject instanceobject = null;
71 | try
72 | {
73 | instanceobject = connection.GetObject(instancename);
74 | }
75 | catch (Exception e)
76 | {
77 | Console.WriteLine("Cannot get instance object. " + e.Message);
78 | return 1;
79 | }
80 | // Set find parameter
81 | InstanceVariablesCollection evars = null;
82 | try
83 | {
84 | evars = instanceobject.GetInstanceVariables();
85 | }
86 | catch (Exception e)
87 | {
88 | Console.WriteLine("Error reading variables - is this an instance?" + e.Message);
89 | return 1;
90 | }
91 | foreach( var expVar in evars)
92 | {
93 | Console.WriteLine("Parameter: " + expVar.Key + ", Current Value: " + expVar.Value.ToString() + ", Type: " + expVar.Value.VariableType);
94 | if (expVar.Key == paramname)
95 | {
96 | InstanceVariablesCollection newVarCol = new InstanceVariablesCollection();
97 | if (expVar.Value.VariableType == ExpressionVariableType.String)
98 | {
99 | InstanceVariable newVar = new InstanceVariable(valuetext, "", "", ExpressionVariableType.String);
100 | Console.WriteLine("Changing to: " + valuetext);
101 | newVarCol.Add(paramname, newVar);
102 | instanceobject.SetInstanceVariables(newVarCol);
103 | }
104 | if (expVar.Value.VariableType == ExpressionVariableType.Double)
105 | {
106 | InstanceVariable newVar = new InstanceVariable(valuedouble, "", "", ExpressionVariableType.Double);
107 | Console.WriteLine("Changing to: " + valuedouble);
108 | newVarCol.Add(paramname, newVar);
109 | instanceobject.SetInstanceVariables(newVarCol);
110 | }
111 | }
112 | }
113 |
114 | connection.Disconnect();
115 | return 0;
116 | }
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/InstanceParams/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("InstanceParams")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("InstanceParams")]
13 | [assembly: AssemblyCopyright("Copyright © 2024")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("F766424c-a776-449f-9a54-73f5b546b494")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Schneider Electric
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/ListAnimations/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ListAnimations/ListAnimations.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {4A0C2614-CB61-48E2-A4D0-681E6DC18C58}
8 | Exe
9 | Properties
10 | ListAnimations
11 | ListAnimations
12 | v4.7.2
13 | 512
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 | {EEAD2000-0777-11D2-AF05-0000E82E7A14}
55 | 1
56 | 2
57 | 0
58 | tlbimp
59 | False
60 | True
61 |
62 |
63 | {EEAD1000-0777-11D2-AF05-0000E82E7A14}
64 | 1
65 | 30
66 | 0
67 | tlbimp
68 | False
69 | True
70 |
71 |
72 |
73 |
80 |
--------------------------------------------------------------------------------
/ListAnimations/ListAnimations.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ListAnimations", "ListAnimations.csproj", "{4A0C2614-CB61-48E2-A4D0-681E6DC18C58}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {4A0C2614-CB61-48E2-A4D0-681E6DC18C58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {4A0C2614-CB61-48E2-A4D0-681E6DC18C58}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {4A0C2614-CB61-48E2-A4D0-681E6DC18C58}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {4A0C2614-CB61-48E2-A4D0-681E6DC18C58}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/ListAnimations/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using ViewX;
7 |
8 | namespace ListAnimations
9 | {
10 | class Program
11 | {
12 | static void Main(string[] args)
13 | {
14 | string SystemName = args[0];
15 | string UserName = args[1];
16 | string Password = args[2];
17 | string MimicName = "";
18 | if (args.Count() == 4)
19 | {
20 | MimicName = args[3];
21 | }
22 |
23 | ViewX.Application vwx = new ViewX.Application();
24 | vwx.Logon(SystemName, UserName, Password);
25 | Console.WriteLine("Logged in to ViewX");
26 |
27 | ScxV6DbClient.ScxV6Server db = new ScxV6DbClient.ScxV6Server();
28 | db.Connect(SystemName, UserName, Password);
29 | Console.WriteLine("Logged in to Server");
30 |
31 | // Hide ViewX for performance
32 | vwx.Visible = false;
33 | if (MimicName == "")
34 | {
35 | var root = db.RootObject;
36 | Console.WriteLine("Got root object");
37 | FindAllMimics(root, vwx, SystemName, db);
38 | }
39 | else
40 | {
41 | var mimic = db.FindObject(MimicName);
42 | ProcessMimic(vwx, SystemName, mimic, db);
43 | }
44 | vwx.Visible = true;
45 | Console.ReadKey();
46 | }
47 |
48 | static void FindAllMimics( ScxV6DbClient.IScxV6Object group, ViewX.Application vwx, String SystemName, ScxV6DbClient.ScxV6Server db)
49 | {
50 | var groups = group.List("CGroup");
51 | foreach( ScxV6DbClient.IScxV6Object childgroup in groups)
52 | {
53 | Console.WriteLine("Group, " + childgroup.FullName.Replace("\"", "\"\""));
54 | FindAllMimics(childgroup, vwx, SystemName, db);
55 | }
56 | var mimics = group.List("CMimic");
57 | foreach (ScxV6DbClient.IScxV6Object mimic in mimics)
58 | {
59 | ProcessMimic(vwx, SystemName, mimic, db);
60 | }
61 | }
62 |
63 | private static void ProcessMimic(Application vwx, string SystemName, ScxV6DbClient.IScxV6Object mimic, ScxV6DbClient.ScxV6Server db)
64 | {
65 | Console.WriteLine("Mimic, " + mimic.FullName.Replace("\"", "\"\""));
66 | try
67 | {
68 |
69 | // Open in ViewX
70 | ViewX.Mimic mim = (Mimic)vwx.Mimics.OpenFromServer(true, SystemName, mimic.FullName);
71 |
72 | // List animations
73 | foreach (ViewX.DrwGroup Layer in mim.Layers)
74 | {
75 | mim.ActiveLayer = Layer;
76 | foreach (ViewX.DrwObject Item in Layer)
77 | {
78 | if (Item.Type == DrwType.DrwEmbeddedList)
79 | {
80 | ViewX.DrwEmbeddedList List = (ViewX.DrwEmbeddedList)Item;
81 | Console.WriteLine("\"" + mim.FullName.Replace("\"", "\"\"") + "\",\"" + Layer.Name.Replace("\"", "\"\"") + "\",\"" + Item.Name.Replace("\"", "\"\"") + "\",\"" + List.Sql.Replace("\"", "\"\"") + "\"");
82 | }
83 | foreach (ViewX.DrwAnimation Ani in Item.Animations)
84 | {
85 | Console.WriteLine("\"" + mim.FullName.Replace("\"", "\"\"") + "\",\"" + Layer.Name.Replace("\"", "\"\"") + "\",\"" + Item.Name.Replace("\"", "\"\"") + "\",\"" + Ani.Property.Replace("\"", "\"\"") + "\",\"" + Ani.Expression.Replace("\"", "\"\"") + "\"");
86 | }
87 | // Process embedded objects
88 | if (Item.Type == DrwType.DrwEmbeddedMimic)
89 | {
90 | ViewX.DrwEmbeddedMimic mimic1 = (ViewX.DrwEmbeddedMimic)Item;
91 | Console.WriteLine("\"" + mim.FullName.Replace("\"", "\"\"") + "\",Embeds,\"" + Layer.Name.Replace("\"", "\"\"") + "\",\"" + Item.Name.Replace("\"", "\"\"") + "\",\"" + mimic1.Shared + "\",\"" + mimic1.Definition.Replace("\"", "\"\"") + "\"");
92 | string MimicName = mimic1.Definition; // Starts SCX:////CMimic/
93 | int NameStart = MimicName.IndexOf("/CMimic/") + 8;
94 | MimicName = MimicName.Substring(NameStart);
95 | if (MimicName.StartsWith("."))
96 | {
97 | //'need to convert relative to absolute, using path of mimicName
98 | //'get # of dots to left of mName e.g. ..A.B -> ,,A,B
99 | //'e.g. if .A then i=1, if ..A.B then i = 2
100 | string[] mNameArr = MimicName.Split('.');
101 | int j = 0;
102 | for (int i = 0; i < mNameArr.Count(); i++)
103 | {
104 | if (mNameArr[i] != "")
105 | {
106 | j = i;
107 | break;
108 | }
109 | }
110 | //'now split parent mimic path, e.g. a.b.c -> a,b,c
111 | string[] mParentPath = mimic.FullName.Split('.');
112 | MimicName = "";
113 | //'Path folder names but not mimic name (-1), remove 1 more for each .
114 | for (int i = 0; i < mParentPath.Count() - j - 1; i++)
115 | {
116 | MimicName = MimicName + mParentPath[i] + ".";
117 | }
118 | //'now append non-blank names from relative path
119 | for (int i = 0; i < mNameArr.Count(); i++)
120 | {
121 | if (mNameArr[i] != "")
122 | {
123 | MimicName = MimicName + mNameArr[i] + ".";
124 | }
125 | }
126 | //'remove extra .
127 | MimicName = MimicName.Substring(0, MimicName.Length - 1);
128 | }
129 |
130 | var embeddedmimic = db.FindObject(MimicName);
131 | if (embeddedmimic != null)
132 | {
133 | ProcessMimic(vwx, SystemName, embeddedmimic, db);
134 | }
135 | else
136 | {
137 | Console.WriteLine("Error, cannot open embedded" );
138 | }
139 | }
140 | }
141 | }
142 |
143 | // Close
144 | mim.Close();
145 | Console.WriteLine();
146 | }
147 | catch (Exception e)
148 | {
149 | Console.WriteLine("Error, " + e.Message.Replace("\"", "\"\""));
150 | }
151 | }
152 | }
153 | }
154 |
--------------------------------------------------------------------------------
/ListAnimations/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("ViewXAPI1")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("ViewXAPI1")]
13 | [assembly: AssemblyCopyright("Copyright © 2020")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("4a0c2614-cb61-48e2-a4d0-681e6dc18c58")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/ListReferences/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/ListReferences/ListReferences.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {6CEA5BBE-3766-450C-9D03-431992007C65}
8 | Exe
9 | Properties
10 | ListReferences
11 | ListReferences
12 | v4.8
13 | 512
14 | true
15 |
16 |
17 |
18 | AnyCPU
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | AnyCPU
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 |
36 |
37 | ListReferences.Program
38 |
39 |
40 |
41 | ..\..\..\..\..\..\Program Files\Schneider Electric\ClearSCADA\ClearScada.Client.dll
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
70 |
--------------------------------------------------------------------------------
/ListReferences/ListReferences.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ListReferences", "ListReferences.csproj", "{6CEA5BBE-3766-450C-9D03-431992007C65}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {6CEA5BBE-3766-450C-9D03-431992007C65}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {6CEA5BBE-3766-450C-9D03-431992007C65}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {6CEA5BBE-3766-450C-9D03-431992007C65}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {6CEA5BBE-3766-450C-9D03-431992007C65}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/ListReferences/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using ClearScada.Client;
7 |
8 | namespace ListReferences
9 | {
10 | class Program
11 | {
12 | static void Main(string[] args)
13 | {
14 | if ( args.Length != 5)
15 | {
16 | Console.WriteLine("List the referenced items and types of all objects matching an SQL query\n" +
17 | "Arguments:\n" +
18 | "1 - Server IP/host\n" +
19 | "2 - Port\n" +
20 | "3 - User\n" +
21 | "4 - Password\n" +
22 | "5 - SQL query returning a list of FullNames\n" +
23 | " Example: ListReferences localhost 5481 freddy password \"select fullname from clogiccore\" \n" +
24 | " Output: object name, type, referenced object name, type ");
25 | return;
26 | }
27 | #pragma warning disable 612, 618
28 | var node = new ClearScada.Client.ServerNode(ConnectionType.Standard, args[0], int.Parse(args[1]));
29 | var connection = new ClearScada.Client.Simple.Connection("Utility");
30 | connection.Connect(node);
31 | var AdvConnection = node.Connect("UtilityA" );
32 | using (var spassword = new System.Security.SecureString())
33 | {
34 | foreach (var c in args[3])
35 | {
36 | spassword.AppendChar(c);
37 | }
38 | connection.LogOn(args[2], spassword);
39 | AdvConnection.LogOn(args[2], spassword);
40 | }
41 | #pragma warning restore 612, 618
42 | string sql = args[4];
43 | ClearScada.Client.Advanced.IQuery serverQuery = AdvConnection.PrepareQuery(sql, new ClearScada.Client.Advanced.QueryParseParameters());
44 | ClearScada.Client.Advanced.QueryResult queryResult = serverQuery.ExecuteSync(new ClearScada.Client.Advanced.QueryExecuteParameters());
45 | if (queryResult.Status == ClearScada.Client.Advanced.QueryStatus.Succeeded || queryResult.Status == ClearScada.Client.Advanced.QueryStatus.NoDataFound)
46 | {
47 | if (queryResult.Rows.Count > 0)
48 | {
49 | IEnumerator e = queryResult.Rows.GetEnumerator();
50 | while (e.MoveNext())
51 | {
52 | string fullname = (string)e.Current.Data[0];
53 | var dbobject = connection.GetObject(fullname);
54 | ///
55 | var classdef = dbobject.ClassDefinition;
56 | var bc = classdef.BaseClass;
57 | var dc = classdef.DerivedClasses;
58 | var am = AdvConnection.GetMetadata(true, true);
59 | var af = dbobject.Aggregates;
60 | var af2 = dbobject.ClassDefinition;
61 | var af3 = bc.ConfigurationProperties;
62 | var af4 = bc.DataProperties;
63 |
64 | ///
65 | var reflist = dbobject.GetReferencesFrom();
66 | if (reflist.Count == 0)
67 | {
68 | Console.WriteLine(fullname + "," + dbobject.ClassDefinition.Name + "," );
69 | }
70 | else
71 | {
72 | foreach ( var refobject in reflist)
73 | {
74 | Console.Write(fullname + "," + dbobject.ClassDefinition.Name + "," );
75 | Console.WriteLine(refobject.FullName + ", " + refobject.ClassDefinition.Name);
76 | }
77 | }
78 | }
79 | }
80 | }
81 | serverQuery.Dispose();
82 | }
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/ListReferences/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("ListReferences")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("ListReferences")]
13 | [assembly: AssemblyCopyright("Copyright © 2019")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("6cea5bbe-3766-450c-9d03-431992007c65")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/MimicGrabber/ApplicationEvents.vb:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/MimicGrabber/Form1.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/MimicGrabber/Form1.vb:
--------------------------------------------------------------------------------
1 | Imports System
2 | Imports System.Drawing
3 | Imports System.Drawing.Imaging
4 | Imports ViewX
5 | Imports ClearScada.Client
6 | Imports ClearScada.Client.Simple
7 | Imports ClearScada.Client.Advanced
8 |
9 | Public Class Form1
10 |
11 | Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
12 | Private xvw As New ViewX.Application
13 |
14 | Private Sub StartViewX(ByVal system As String, ByVal username As String, ByVal password As String)
15 | 'try
16 | xvw.Logon(system, username, password)
17 | ''xvw.WindowState = ViewX.WndState.WndFullScreen ''No longer implemented
18 | 'Hide this app's window
19 | End Sub
20 |
21 | Private Sub CaptureScreen(ByVal system As String, ByVal mimic As String, ByVal filename As String)
22 | Dim mim As Mimic
23 |
24 | Me.Hide()
25 |
26 | mim = xvw.Mimics.OpenFromServer(True, system, mimic)
27 |
28 | Dim bmpScreenshot As Bitmap
29 | Dim gfxScreenshot As Graphics
30 |
31 | bmpScreenshot = New Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb)
32 | gfxScreenshot = Graphics.FromImage(bmpScreenshot)
33 |
34 | Threading.Thread.Sleep(Int(txtTime.Text))
35 |
36 | gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy)
37 |
38 | bmpScreenshot.Save(filename & ".png", ImageFormat.Png)
39 | Threading.Thread.Sleep(500)
40 |
41 | On Error Resume Next 'Mim may not be closable!
42 | mim.Close()
43 |
44 | Me.Show()
45 | #Disable Warning BC42025 ' Access of shared member, constant member, enum member or nested type through an instance
46 | If Me.ModifierKeys = Keys.Control Then
47 | #Enable Warning BC42025 ' Access of shared member, constant member, enum member or nested type through an instance
48 | End
49 | End If
50 | End Sub
51 |
52 | Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
53 | Button1.Enabled = False
54 |
55 | StartViewX(txtSystem.Text, txtUsername.Text, txtPassword.Text)
56 |
57 | Dim Filename As String = ""
58 |
59 | If GetAll.CheckState = False Then
60 | Filename = txtMimic.Text
61 | Filename = Filename.Replace("*", "$")
62 | Filename = txtFolder.Text & "\" & Filename
63 |
64 | CaptureScreen(txtSystem.Text, txtMimic.Text, Filename)
65 | Else
66 | #Disable Warning BC40000, BC40008
67 | Dim Node As New ClearScada.Client.ServerNode(ConnectionType.Standard, txtNode.Text, txtPort.Text)
68 | #Enable Warning BC40000, BC40008
69 | Dim CSconnection As Connection = New Connection(txtSystem.Text)
70 | CSconnection.Connect(Node)
71 | Dim SPassword As New System.Security.SecureString
72 | For i As Integer = 0 To Len(txtPassword.Text) - 1
73 | SPassword.AppendChar(CChar(txtPassword.Text.Substring(i, 1)))
74 | Next
75 |
76 | CSconnection.LogOn(txtUsername.Text, SPassword)
77 | Dim Exclusions() As String = Split(txtExclude.Text, ",")
78 |
79 | Dim gobj As DBObject = CSconnection.GetObject(txtMimic.Text)
80 | Do
81 | RecurseGroups(gobj, Exclusions)
82 | Loop While chkRepeat.CheckState = True
83 | End If
84 | Button1.Enabled = True
85 |
86 | End Sub
87 | Private Sub RecurseGroups(ByRef gobj As DBObject, Exclusions() As String)
88 | Dim objs As DBObjectCollection = gobj.GetChildren("CMimic", "")
89 | CaptureMimics(objs, Exclusions)
90 | Dim gobjs As DBObjectCollection = gobj.GetChildren("CGroup", "")
91 | Dim obj As DBObject
92 | For Each obj In gobjs
93 | RecurseGroups(obj, Exclusions)
94 | Next
95 | End Sub
96 | Private Sub CaptureMimics(ByRef objs As DBObjectCollection, Exclusions() As String)
97 | Dim Filename As String = ""
98 | Dim obj As DBObject
99 | For Each obj In objs
100 | If obj.ClassDefinition.DisplayName = "Mimic" Then
101 | If Not Exclusions.Contains(obj.Name) Then
102 | Filename = obj.FullName
103 | Filename = Filename.Replace("*", "$")
104 | Filename = txtFolder.Text & "\" & Filename
105 | End If
106 | CaptureScreen(txtSystem.Text, obj.FullName, Filename)
107 | End If
108 | Next
109 |
110 | End Sub
111 | Private Sub Quit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Quit.Click
112 | End
113 | End Sub
114 |
115 | End Class
116 |
117 |
--------------------------------------------------------------------------------
/MimicGrabber/MimicGrabber.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 11.00
3 | # Visual Basic Express 2010
4 | Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "MimicGrabber", "MimicGrabber.vbproj", "{3A5221D8-9898-4F4D-99D9-665B69C25CB7}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Any CPU = Debug|Any CPU
9 | Release|Any CPU = Release|Any CPU
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {3A5221D8-9898-4F4D-99D9-665B69C25CB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
13 | {3A5221D8-9898-4F4D-99D9-665B69C25CB7}.Debug|Any CPU.Build.0 = Debug|Any CPU
14 | {3A5221D8-9898-4F4D-99D9-665B69C25CB7}.Release|Any CPU.ActiveCfg = Release|Any CPU
15 | {3A5221D8-9898-4F4D-99D9-665B69C25CB7}.Release|Any CPU.Build.0 = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/MimicGrabber/My Project/Application.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | 'NOTE: This file is auto-generated; do not modify it directly. To make changes,
18 | ' or if you encounter build errors in this file, go to the Project Designer
19 | ' (go to Project Properties or double-click the My Project node in
20 | ' Solution Explorer), and make changes on the Application tab.
21 | '
22 | Partial Friend Class MyApplication
23 |
24 | _
25 | Public Sub New()
26 | MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
27 | Me.IsSingleInstance = false
28 | Me.EnableVisualStyles = true
29 | Me.SaveMySettingsOnExit = true
30 | Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
31 | End Sub
32 |
33 | _
34 | Protected Overrides Sub OnCreateMainForm()
35 | Me.MainForm = Global.MimicGrabber.Form1
36 | End Sub
37 | End Class
38 | End Namespace
39 |
--------------------------------------------------------------------------------
/MimicGrabber/My Project/Application.myapp:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 | Form1
5 | false
6 | 0
7 | true
8 | 0
9 | 0
10 | true
11 |
12 |
--------------------------------------------------------------------------------
/MimicGrabber/My Project/AssemblyInfo.vb:
--------------------------------------------------------------------------------
1 | Imports System
2 | Imports System.Reflection
3 | Imports System.Runtime.InteropServices
4 |
5 | ' General Information about an assembly is controlled through the following
6 | ' set of attributes. Change these attribute values to modify the information
7 | ' associated with an assembly.
8 |
9 | ' Review the values of the assembly attributes
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 'The following GUID is for the ID of the typelib if this project is exposed to COM
21 |
22 |
23 | ' Version information for an assembly consists of the following four values:
24 | '
25 | ' Major Version
26 | ' Minor Version
27 | ' Build Number
28 | ' Revision
29 | '
30 | ' You can specify all the values or you can default the Build and Revision Numbers
31 | ' by using the '*' as shown below:
32 | '
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/MimicGrabber/My Project/Resources.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 | Imports System
15 |
16 | Namespace My.Resources
17 |
18 | 'This class was auto-generated by the StronglyTypedResourceBuilder
19 | 'class via a tool like ResGen or Visual Studio.
20 | 'To add or remove a member, edit your .ResX file then rerun ResGen
21 | 'with the /str option, or rebuild your VS project.
22 | '''
23 | ''' A strongly-typed resource class, for looking up localized strings, etc.
24 | '''
25 | _
29 | Friend Module Resources
30 |
31 | Private resourceMan As Global.System.Resources.ResourceManager
32 |
33 | Private resourceCulture As Global.System.Globalization.CultureInfo
34 |
35 | '''
36 | ''' Returns the cached ResourceManager instance used by this class.
37 | '''
38 | _
39 | Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
40 | Get
41 | If Object.ReferenceEquals(resourceMan, Nothing) Then
42 | Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("MimicGrabber.Resources", GetType(Resources).Assembly)
43 | resourceMan = temp
44 | End If
45 | Return resourceMan
46 | End Get
47 | End Property
48 |
49 | '''
50 | ''' Overrides the current thread's CurrentUICulture property for all
51 | ''' resource lookups using this strongly typed resource class.
52 | '''
53 | _
54 | Friend Property Culture() As Global.System.Globalization.CultureInfo
55 | Get
56 | Return resourceCulture
57 | End Get
58 | Set
59 | resourceCulture = value
60 | End Set
61 | End Property
62 | End Module
63 | End Namespace
64 |
--------------------------------------------------------------------------------
/MimicGrabber/My Project/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/MimicGrabber/My Project/Settings.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | _
20 | Partial Friend NotInheritable Class MySettings
21 | Inherits Global.System.Configuration.ApplicationSettingsBase
22 |
23 | Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
24 |
25 | #Region "My.Settings Auto-Save Functionality"
26 | #If _MyType = "WindowsForms" Then
27 | Private Shared addedHandler As Boolean
28 |
29 | Private Shared addedHandlerLockObject As New Object
30 |
31 | _
32 | Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs)
33 | If My.Application.SaveMySettingsOnExit Then
34 | My.Settings.Save()
35 | End If
36 | End Sub
37 | #End If
38 | #End Region
39 |
40 | Public Shared ReadOnly Property [Default]() As MySettings
41 | Get
42 |
43 | #If _MyType = "WindowsForms" Then
44 | If Not addedHandler Then
45 | SyncLock addedHandlerLockObject
46 | If Not addedHandler Then
47 | AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
48 | addedHandler = True
49 | End If
50 | End SyncLock
51 | End If
52 | #End If
53 | Return defaultInstance
54 | End Get
55 | End Property
56 | End Class
57 | End Namespace
58 |
59 | Namespace My
60 |
61 | _
64 | Friend Module MySettingsProperty
65 |
66 | _
67 | Friend ReadOnly Property Settings() As Global.MimicGrabber.My.MySettings
68 | Get
69 | Return Global.MimicGrabber.My.MySettings.Default
70 | End Get
71 | End Property
72 | End Module
73 | End Namespace
74 |
--------------------------------------------------------------------------------
/MimicGrabber/My Project/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/MimicGrabber/My Project/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/MimicGrabber/README.md:
--------------------------------------------------------------------------------
1 | # Utility-Examples - MimicGrabber
2 |
3 |
4 | **********************************************************************
5 | SAMPLE CODE FOR EDUCATION ONLY. THIS CODE MAY NOT BE CYBER-SECURE.
6 | YOU ARE RESPONSIBLE FOR IMPLEMENTING CYBER-SECURITY FEATURES.
7 | **********************************************************************
8 |
9 | The source code is available for you to freely use, modify and extend to
10 | suit your requirements or that of your clients. It is perhaps not the
11 | most optimized, efficient or elegant code but we hope that its simplicity
12 | will encourage engagement with Geo SCADA.
13 |
14 | When building, don't forget to remove and re-add ClearSCADA references so they match your installed version!
15 |
16 | # MimicGrabber
17 | Get a screenshot of one or more mimics automatically. This program will let you select which mimics to get screenshots, and save then in PNG format.
18 |
19 | It will run ViewX and display/copy each mimic in turn.
20 |
21 |
22 |
--------------------------------------------------------------------------------
/MimicGrabber/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/PythonSamples/Geo SCADA Samples.py:
--------------------------------------------------------------------------------
1 | # Import .Net runtime support - needs "pip install pythonnet", supported by Python 3.8, 3.12
2 | import clr
3 | # Get Geo SCADA Library
4 | CS = clr.AddReference( "c:\Program Files\Schneider Electric\ClearSCADA\ClearSCADA.Client.dll" )
5 | import ClearScada.Client as CSClient
6 |
7 | # Create node and connect, then log in. (Could read net parameters from SYSTEMS.XML)
8 | node = CSClient.ServerNode( CSClient.ConnectionType.Standard, "127.0.0.1", 5481 )
9 | connection = CSClient.Simple.Connection( "Utility" )
10 | connection.Connect( node )
11 | connection.LogOn( "AdminExample", "AdminExample" ) # ENTER YOUR USERNAME AND PASSWORD HERE
12 |
13 | # Read Security ACLs
14 | R = connection.GetObject("$Root")
15 | ACL = R.GetSecurity()
16 | if (ACL.InheritedFromParent == False):
17 | print( "ACL ", ACL.Count, " entries")
18 | for user in ACL.Keys:
19 | print( "Key: ", user, " ACL: ", ACL[ user] )
20 |
21 | # instance a template
22 | P = connection.GetObject("Test") #parent
23 | T = connection.GetObject("Test.Test Bulk Data.Ten Points") # A template
24 | I = P.CreateInstance(T, "New Instance") # Create an instance
25 |
26 | # set string point value
27 | P = connection.GetObject("Test.New String Point") # A string point
28 | P.InvokeMethod("CurrentValue", "fred" )
29 |
30 | # get object children
31 | FieldDevice = connection.GetObject("Test")
32 | Children = FieldDevice.GetChildren("CDBPoint","")
33 | for value in Children:
34 | print(value.FullName)
35 |
36 | # set an object's Geo Location
37 | FieldDevice = connection.GetObject("SELogger.2820015789 DLLTE4-SA.Logger" )
38 | GeoAgg = FieldDevice.Aggregates["GISLocationSource"];
39 | print( GeoAgg.Enabled);
40 | GeoAgg.ClassName = "CGISLocationSrcDynamic"
41 | print( GeoAgg.ClassName);
42 | GeoAgg["Latitude"] = 3
43 | GeoAgg["Longitude"] = 4
44 |
45 | # Find and set internal point values
46 | pointObject = connection.GetObject("Example Projects.Oil and Gas.Transportation.Graphics.End Station.Valve 3.Position Control" )
47 | for i in range(1,100,30):
48 | pointObject.InvokeMethod("CurrentValue", i )
49 | print( "Point set to: " + str(pointObject.GetProperty("CurrentValue" ) ) )
50 |
51 | # Find a historic point
52 | pointObject2 = connection.GetObject("Example Projects.Oil and Gas.Transportation.Inflow Computer.GasFlow" )
53 | from System import DateTime # To support .Net date/time
54 | # Historic arguments are start, end, index(=0), maxrecords, forwards=true, reason="All"
55 | hisStart = DateTime( 2021,1,19,0,0,0 )
56 | hisEnd = DateTime( 2021,1,20,0,0,0 )
57 | hisArgs = [ hisStart, hisEnd, 0, 100, True, "All" ]
58 | # Call methods to get values and times. Could also read quality, or use .ProcessedValue to get fixed interval data
59 | hisValues = pointObject2.InvokeMethod("Historic.RawValues", hisArgs )
60 | hisQualities = pointObject2.InvokeMethod("Historic.RawQualities", hisArgs )
61 | hisTimeStamps = pointObject2.InvokeMethod("Historic.RawTimestamps", hisArgs )
62 | for i in range( hisTimeStamps.Length):
63 | print( hisTimeStamps[i], hisValues[i], hisQualities[i] )
64 |
65 |
--------------------------------------------------------------------------------
/PythonSamples/GetHisAnnotationsExample.py:
--------------------------------------------------------------------------------
1 | # Import .Net runtime support - needs "pip install pythonnet", supported by Python 3.8, 3.12
2 | import clr
3 | CS = clr.AddReference( "c:\Program Files\Schneider Electric\ClearSCADA\ClearSCADA.Client.dll" )
4 | import ClearScada.Client as CSClient
5 | import time
6 | from System import DateTime # Support .Net date/time
7 |
8 | # Create node and connect, then log in. (Could read net parameters from SYSTEMS.XML)
9 | node = CSClient.ServerNode( CSClient.ConnectionType.Standard, "127.0.0.1", 5481 )
10 | connection = CSClient.Simple.Connection( "Utility" )
11 | connection.Connect( node )
12 | connection.LogOn( "", "" ) # ENTER YOUR USERNAME AND PASSWORD HERE
13 |
14 | # Find a historic point
15 | pointObject2 = connection.GetObject("Test.New Analog Point" )
16 |
17 | hisStart = DateTime( 2021, 1, 1,0,0,0 ) # 2 years
18 | hisEnd = DateTime( 2022,12,31,0,0,0 )
19 |
20 | hisArgs = [ hisStart, hisEnd ]
21 | annCount = pointObject2.InvokeMethod("Historic.AnnCount", hisArgs )
22 | print("Annotations: ", annCount)
23 |
24 | if annCount > 0:
25 | print( "Data time", "User", "Comment Time", "Comment")
26 | for i in range(0, annCount):
27 | hisArgs = [ hisStart, hisEnd, i, True ]
28 | annComment = pointObject2.InvokeMethod("Historic.AnnComment", hisArgs )
29 | annModifyTime = pointObject2.InvokeMethod("Historic.AnnModifyTime", hisArgs )
30 | annTimestamp = pointObject2.InvokeMethod("Historic.AnnTimestamp", hisArgs )
31 | annUser = pointObject2.InvokeMethod("Historic.AnnUser", hisArgs )
32 | print( annTimestamp, annUser, annModifyTime, annComment )
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/PythonSamples/ListAllGroupACLs.py:
--------------------------------------------------------------------------------
1 | # Import .Net runtime support - needs "pip install pythonnet", supported by Python 3.8, 3.12
2 | import clr
3 | # Get Geo SCADA Library
4 | CS = clr.AddReference( "c:\Program Files\Schneider Electric\ClearSCADA\ClearSCADA.Client.dll" )
5 | import ClearScada.Client as CSClient
6 |
7 | # Create node and connect, then log in. (Could read net parameters from SYSTEMS.XML)
8 | node = CSClient.ServerNode( CSClient.ConnectionType.Standard, "127.0.0.1", 5481 )
9 | connection = CSClient.Simple.Connection( "Utility" )
10 | connection.Connect( node )
11 | connection.LogOn( "", "" ) # ENTER YOUR USERNAME AND PASSWORD HERE
12 |
13 | # Functions to iterate over all groups and return permissions applied
14 | # Note that for a large database this can take a long time to run and
15 | # could affect other operations.
16 |
17 | PermissionNames = ["Browse", "Configure", "Security", "SystemAdmin", "Control", "AcceptAlarms", "DisableAlarms", "Override", "Notes", "RetrieveData", "DisableControl", "Promote", "SwitchLine", "Tune", "Diagnostics", "ModifyHistoric", "AnnotateHistoric", "ValidateHistoric", "ViewAlarms", "Read", "ExclusiveControl", "ManageExclusiveControl", "RemoveAlarms", "EnableDisable", "ManualRedirect", "UnacceptAlarms", "AssignAlarms", "OnOffScan", "CancelRequest"]
18 | def PermissionMaskToName( mask):
19 | p = ""
20 | for b in range(0,32):
21 | if (mask & (1< fclasttime):
76 | print ("Daily: ", i["dt"], i["wind_speed"] )
77 | fclasttime = i["dt"]
78 | fcvalues.append( i["wind_speed"] )
79 | fctimes.append( DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified).AddSeconds(fclasttime) )
80 | fcqualities.append( 192)
81 |
82 | #Set values
83 | fctime = DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified).AddSeconds(fcfirsttime) # time of first sample
84 | fcname = "Forecasted " + fctime.ToString("s").replace("T"," ") + " UTC" # Forecast time name is in UTC
85 | # name, times, values, qualities
86 | ForecastObj.InvokeMethod("SetForecastEx", fcname, fctimes, fcvalues, fcqualities)
87 | print ("Forecast Set")
88 |
89 |
90 |
--------------------------------------------------------------------------------
/PythonSamples/WeatherToGeoSCADA.py:
--------------------------------------------------------------------------------
1 | # Import .Net runtime support - needs "pip install pythonnet", supported by Python 3.8, 3.12
2 | import clr
3 | # Get Geo SCADA Library
4 | CS = clr.AddReference( "c:\Program Files\Schneider Electric\ClearSCADA\ClearSCADA.Client.dll" )
5 | import ClearScada.Client as CSClient
6 |
7 | # Create node and connect, then log in. (Could read net parameters from SYSTEMS.XML)
8 | node = CSClient.ServerNode( CSClient.ConnectionType.Standard, "127.0.0.1", 5481 )
9 | connection = CSClient.Simple.Connection( "Utility" )
10 | connection.Connect( node )
11 | # Add your credentials to Geo SCADA here:
12 | connection.LogOn( "", "" ) # ENTER YOUR USERNAME AND PASSWORD HERE
13 |
14 | # Web request library - needs "pip install requests"
15 | import requests
16 |
17 | # Get the key by registering at openweathermap.org
18 | API_key = "enter your openweathermap key here"
19 | base_url = "http://api.openweathermap.org/data/2.5/weather?"
20 |
21 | # Here we are using Lat and Long to get the data, you can use city/town names
22 | # (You could read a list of Geo SCADA points with their locations and use those too)
23 | # This is the location of SE offices in Bogota, Colombia
24 | latitude = 4.70960
25 | longitude = -74.06192
26 |
27 | # Make the web request
28 | Final_url = base_url + "appid=" + API_key + "&lat=" + str(latitude) + "&lon=" + str(longitude)
29 | weather_data = requests.get(Final_url).json()
30 |
31 | # Print out
32 | print(weather_data)
33 |
34 | # Get Wind speed (default in meters/sec) and Direction (degrees)
35 | wind_speed = weather_data["wind"]["speed"]
36 | wind_dir = weather_data["wind"]["deg"]
37 |
38 | # Find an internal named according to the signal - create this Internal point first with ViewX
39 | WindSpeedObj = connection.GetObject("Wind Speed in Bogota" )
40 | WindDirObj = connection.GetObject("Wind Dir in Bogota" )
41 |
42 | WindSpeedObj.InvokeMethod("CurrentValue", wind_speed )
43 | WindDirObj.InvokeMethod("CurrentValue", wind_dir )
44 |
45 | # Echo value back as a test
46 | print( "Speed set to: " + str(WindSpeedObj.GetProperty("CurrentValue" ) ) )
47 | print( "Direc set to: " + str(WindDirObj.GetProperty("CurrentValue" ) ) )
48 |
49 | #Sample output from OpenWeatherMap API
50 | #{
51 | # "coord": {
52 | # "lon": -74.0619,
53 | # "lat": 4.7096
54 | # },
55 | # "weather": [
56 | # {
57 | # "id": 803,
58 | # "main": "Clouds",
59 | # "description": "broken clouds",
60 | # "icon": "04n"
61 | # }
62 | # ],
63 | # "base": "stations",
64 | # "main": {
65 | # "temp": 283.15,
66 | # "feels_like": 282.19,
67 | # "temp_min": 283.15,
68 | # "temp_max": 283.15,
69 | # "pressure": 1025,
70 | # "humidity": 93
71 | # },
72 | # "visibility": 10000,
73 | # "wind": {
74 | # "speed": 1.03,
75 | # "deg": 0
76 | # },
77 | # "clouds": {
78 | # "all": 75
79 | # },
80 | # "dt": 1615974896,
81 | # "sys": {
82 | # "type": 1,
83 | # "id": 8582,
84 | # "country": "CO",
85 | # "sunrise": 1615978896,
86 | # "sunset": 1616022449
87 | # },
88 | # "timezone": -18000,
89 | # "id": 7033249,
90 | # "name": "Santa Barbara Central",
91 | # "cod": 200
92 | #}
93 |
94 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Utility-Examples
2 | Geo SCADA Utilities and Example Code
3 |
4 | Sample code of useful and example utilities using the ClearSCADA / Geo SCADA APIs.
5 |
6 | API Documentation is a help file installed by Geo SCADA. Find this on the Start menu in the EcoStruxure Geo SCADA group. It is called 'Client API Guide'.
7 |
8 | When building, don't forget to remove and re-add ClearSCADA references so they match your installed version!
9 |
10 |
11 | **********************************************************************
12 | SAMPLE CODE FOR EDUCATION ONLY. THIS CODE MAY NOT BE CYBER-SECURE.
13 | YOU ARE RESPONSIBLE FOR IMPLEMENTING CYBER-SECURITY FEATURES.
14 | **********************************************************************
15 | This is offered as source code which you can build with Visual
16 | Studio. It is not supported or warranted in any way by Schneider Electric.
17 | **********************************************************************
18 |
19 | The source code is available for you to freely use, modify and extend to
20 | suit your requirements or that of your clients. It is perhaps not the
21 | most optimized, efficient or elegant code but we hope that its simplicity
22 | will encourage engagement with Geo SCADA.
23 |
24 | # EventWatcher
25 | Register interest in the stream of Events from a server, and receive callbacks when events match.
26 |
27 | # InsertHistoricData
28 | Shows how to insert data into a historic stream using the .Net API, and also some retrieval methods.
29 |
30 | # InsertHistoryCOMAPI
31 | Shows inserting data with the same object Method, but using the COM Automation API.
32 |
33 | # ListAnimations
34 | A utility to find the animations on a mimic and export to a script you can use to change them.
35 |
36 | # ListReferences
37 | A utility to find the references from an object in the Geo SCADA database.
38 |
39 | # MimicGrabber
40 | Get a screenshot of one or more mimics automatically. This program will let you select which mimics to get screenshots, and save then in PNG format.
41 |
42 | # PythonSample
43 | How to use Python to interact with Geo SCADA using the .Net Client API.
44 |
45 | # SetAndWatchInternalPoint
46 | Simple Example to show how a command line tool can update SCADA values and get callbacks for updates.
47 |
48 | # SetInternalPoint
49 | Simple Example to show how a command line tool can update SCADA values.
50 | Error handling is included to show the different error cases.
51 |
52 | # ViewXAPI1
53 | Shows the basics of opening ViewX using it's API and then editing a mimic.
54 |
55 |
--------------------------------------------------------------------------------
/SetAndWatchInternalPoint/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/SetAndWatchInternalPoint/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Security;
3 | using System.Threading.Tasks;
4 | using ClearScada.Client; // Find ClearSCADA.Client.dll in the Program Files\Schneider Electric\ClearSCADA folder
5 | using ClearScada.Client.Advanced;
6 |
7 | namespace SetInternalPoint
8 | {
9 | class Program
10 | {
11 | static bool WaitUntilStopped = true;
12 | async static Task Main(string[] args)
13 | {
14 | if (args.Length != 5)
15 | {
16 | Console.WriteLine("Usage: SetAndWatchInternalPoint \"username\" \"password\" \"Point-Name\" \"Value\" \"Watch-Point-Name\" ");
17 | return;
18 | }
19 | string user = args[0];
20 | string pass = args[1];
21 | string pointname = args[2];
22 | string valuetext = args[3];
23 | string watchpointname = args[4];
24 | double valuedouble;
25 | if (!double.TryParse(valuetext, out valuedouble))
26 | {
27 | Console.WriteLine("Value is not numeric");
28 | return;
29 | }
30 |
31 | ClearScada.Client.Simple.Connection connection;
32 | #pragma warning disable 612, 618
33 | var node = new ClearScada.Client.ServerNode(ConnectionType.Standard, "127.0.0.1", 5481);
34 | connection = new ClearScada.Client.Simple.Connection("Utility");
35 | IServer AdvConnection;
36 | try
37 | {
38 | connection.Connect(node);
39 | AdvConnection = node.Connect("Utility");
40 | }
41 | catch (CommunicationsException)
42 | {
43 | Console.WriteLine("Unable to communicate with Geo SCADA server.");
44 | return;
45 | }
46 | #pragma warning restore 612, 618
47 | if (!connection.IsConnected)
48 | {
49 | Console.WriteLine("Not connected to Geo SCADA server.");
50 | return;
51 | }
52 | using (var spassword = new System.Security.SecureString())
53 | {
54 | foreach (var c in pass)
55 | {
56 | spassword.AppendChar(c);
57 | }
58 | try
59 | {
60 | connection.LogOn(user, spassword);
61 | AdvConnection.LogOn(user, spassword);
62 | }
63 | catch (AccessDeniedException)
64 | {
65 | Console.WriteLine("Access denied, incorrect user Id or password");
66 | return;
67 | }
68 | catch (PasswordExpiredException)
69 | {
70 | Console.WriteLine("Credentials expired.");
71 | return;
72 | }
73 | }
74 |
75 | // Set event callback
76 | AdvConnection.TagsUpdated += TagUpdateEvent;
77 |
78 | // Disconnect Callback
79 | AdvConnection.StateChanged += DBStateChangeEvent;
80 | AdvConnection.AdviseStateChange();
81 |
82 | // Register for change for this point
83 | // ReadSeconds is the interval for the Server to watch for change. Be careful not to set this small
84 | int ReadSeconds = 10;
85 | try
86 | {
87 | int RegisterId = 1; // Use a unique number for each point waited for (not needed to be same as Object Id)
88 | // Registration is by point name, specify the field which has to change (could use CurrentTime to catch every change).
89 | AdvConnection.AddTags(new TagDetails(RegisterId, watchpointname + ".CurrentValue", new TimeSpan(0, 0, ReadSeconds)));
90 | }
91 | catch (ClearScada.Client.CommunicationsException)
92 | {
93 | Console.WriteLine("*** Comms exception (AddTags)");
94 | return;
95 | }
96 |
97 | // Get point object to be modified
98 | ClearScada.Client.Simple.DBObject pointobject = null;
99 | try
100 | {
101 | pointobject = connection.GetObject(pointname);
102 | }
103 | catch (Exception e)
104 | {
105 | Console.WriteLine("Cannot get point object. " + e.Message);
106 | return;
107 | }
108 | // Set value
109 | try
110 | {
111 | pointobject.InvokeMethod("CurrentValue", valuedouble);
112 | }
113 | catch (Exception e)
114 | {
115 | Console.WriteLine("Error setting value. " + e.Message);
116 | return;
117 | }
118 |
119 | // Wait and watch for changes
120 | Console.WriteLine("Waiting for changes");
121 | while (WaitUntilStopped)
122 | {
123 | await Task.Delay(1000);
124 | }
125 |
126 |
127 |
128 | // Demo to read historic data
129 | /*
130 | var pointObject2 = connection.GetObject("Example Projects.Oil and Gas.Transportation.Inflow Computer.GasFlow");
131 | DateTime hisStart = new DateTime(2021, 1, 19, 0, 0, 0);
132 | DateTime hisEnd = new DateTime(2021, 1, 20, 0, 0, 0);
133 | object[] hisArgs = { hisStart, hisEnd, 0, 1000, true, "All" };
134 | var hisResult = pointObject2.InvokeMethod("Historic.RawValues", hisArgs);
135 | Console.WriteLine(hisResult);
136 | Console.ReadKey();
137 | */
138 | connection.Disconnect();
139 | return;
140 | }
141 |
142 |
143 | // Callback - Tag Update
144 | static void TagUpdateEvent(object sender, TagsUpdatedEventArgs EventArg)
145 | {
146 | Console.WriteLine($"Received {EventArg.Updates.Count} update(s).");
147 | foreach (var Update in EventArg.Updates)
148 | {
149 | // You cannot call any Geo SCADA Client interface methods here
150 | // So if you want to read more data as a result of this change,
151 | // Please use a queue and process data later.
152 | Console.WriteLine($"Update: Id {Update.Id}, Status {Update.Status}, Value {Update.Value}, Quality {(long)Update.Quality}, Time {Update.Timestamp}");
153 | }
154 | }
155 |
156 |
157 | // Called when server state changes, stop the wait
158 | static void DBStateChangeEvent(object sender, StateChangeEventArgs stateChange)
159 | {
160 | if (stateChange.StateDetails.State != ServerState.Main)
161 | {
162 | WaitUntilStopped = false;
163 | }
164 | }
165 | }
166 | }
167 |
--------------------------------------------------------------------------------
/SetAndWatchInternalPoint/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("SetAndWatchInternalPoint")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SetInternalPoint")]
13 | [assembly: AssemblyCopyright("Copyright © 2021")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("1766424c-a776-449f-9a54-73f5b546b494")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/SetAndWatchInternalPoint/SetAndWatchInternalPoint.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {1766424C-A776-449F-9A54-73F5B546B494}
8 | Exe
9 | Properties
10 | SetAndWatchInternalPoint
11 | SetAndWatchInternalPoint
12 | v4.8
13 | 512
14 | true
15 |
16 |
17 |
18 | AnyCPU
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | AnyCPU
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 |
36 |
37 |
38 | False
39 | ..\..\..\..\..\..\Program Files\Schneider Electric\ClearSCADA\ClearScada.Client.dll
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
65 |
--------------------------------------------------------------------------------
/SetAndWatchInternalPoint/SetAndWatchInternalPoint.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{EAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SetAndWatchInternalPoint", "SetAndWatchInternalPoint.csproj", "{1766424C-A776-449F-9A54-73F5B546B494}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {1766424C-A776-449F-9A54-73F5B546B494}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {1766424C-A776-449F-9A54-73F5B546B494}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {1766424C-A776-449F-9A54-73F5B546B494}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {1766424C-A776-449F-9A54-73F5B546B494}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/SetInternalPoint/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/SetInternalPoint/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Security;
3 | using ClearScada.Client;
4 |
5 | namespace SetInternalPoint
6 | {
7 | class Program
8 | {
9 | static int Main(string[] args)
10 | {
11 | if (args.Length != 4)
12 | {
13 | Console.WriteLine("Usage: SetInternalPoint \"username\" \"password\" \"Point-Name\" \"Value\" ");
14 | return 1;
15 | }
16 | string user = args[0];
17 | string pass = args[1];
18 | string pointname = args[2];
19 | string valuetext = args[3];
20 | double valuedouble;
21 | if (!double.TryParse(valuetext, out valuedouble))
22 | {
23 | Console.WriteLine("Value is not numeric");
24 | return 1;
25 | }
26 |
27 | ClearScada.Client.Simple.Connection connection;
28 | #pragma warning disable 612, 618
29 | var node = new ClearScada.Client.ServerNode(ConnectionType.Standard, "127.0.0.1", 5481);
30 | connection = new ClearScada.Client.Simple.Connection("Utility");
31 | try
32 | {
33 | connection.Connect(node);
34 | }
35 | catch (CommunicationsException)
36 | {
37 | Console.WriteLine("Unable to communicate with Geo SCADA server.");
38 | return 1;
39 | }
40 | #pragma warning restore 612, 618
41 | if (!connection.IsConnected)
42 | {
43 | Console.WriteLine("Not connected to Geo SCADA server.");
44 | return 1;
45 | }
46 | using (var spassword = new System.Security.SecureString())
47 | {
48 | foreach (var c in pass)
49 | {
50 | spassword.AppendChar(c);
51 | }
52 | try
53 | {
54 | connection.LogOn(user, spassword);
55 | }
56 | catch (AccessDeniedException)
57 | {
58 | Console.WriteLine("Access denied, incorrect user Id or password");
59 | return 1;
60 | }
61 | catch (PasswordExpiredException)
62 | {
63 | Console.WriteLine("Credentials expired.");
64 | return 1;
65 | }
66 | }
67 | // Get point object
68 | ClearScada.Client.Simple.DBObject pointobject = null;
69 | try
70 | {
71 | pointobject = connection.GetObject(pointname);
72 | }
73 | catch (Exception e)
74 | {
75 | Console.WriteLine("Cannot get point object. " + e.Message);
76 | return 1;
77 | }
78 | // Set value
79 | try
80 | {
81 | object [] callparam = new object [1];
82 | callparam[0] = valuedouble;
83 | pointobject.InvokeMethod("CurrentValue", valuedouble);
84 | }
85 | catch (Exception e)
86 | {
87 | Console.WriteLine("Error setting value. " + e.Message);
88 | return 1;
89 | }
90 | // Demo to read historic
91 | /*
92 | var pointObject2 = connection.GetObject("Example Projects.Oil and Gas.Transportation.Inflow Computer.GasFlow");
93 | DateTime hisStart = new DateTime(2021, 1, 19, 0, 0, 0);
94 | DateTime hisEnd = new DateTime(2021, 1, 20, 0, 0, 0);
95 | object[] hisArgs = { hisStart, hisEnd, 0, 1000, true, "All" };
96 | var hisResult = pointObject2.InvokeMethod("Historic.RawValues", hisArgs);
97 | Console.WriteLine(hisResult);
98 | Console.ReadKey();
99 | */
100 | connection.Disconnect();
101 | return 0;
102 | }
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/SetInternalPoint/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("SetInternalPoint")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SetInternalPoint")]
13 | [assembly: AssemblyCopyright("Copyright © 2020")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("0766424c-a776-449f-9a54-73f5b546b494")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/SetInternalPoint/SetInternalPoint.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {0766424C-A776-449F-9A54-73F5B546B494}
8 | Exe
9 | Properties
10 | SetInternalPoint
11 | SetInternalPoint
12 | v4.7.2
13 | 512
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 | ..\..\..\..\..\..\Program Files\Schneider Electric\ClearSCADA\ClearScada.Client.dll
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
63 |
--------------------------------------------------------------------------------
/SetInternalPoint/SetInternalPoint.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SetInternalPoint", "SetInternalPoint.csproj", "{0766424C-A776-449F-9A54-73F5B546B494}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {0766424C-A776-449F-9A54-73F5B546B494}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {0766424C-A776-449F-9A54-73F5B546B494}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {0766424C-A776-449F-9A54-73F5B546B494}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {0766424C-A776-449F-9A54-73F5B546B494}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/SetStaticLocation/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/SetStaticLocation/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using ClearScada;
7 |
8 | namespace SetStaticLocation
9 | {
10 | class Program
11 | {
12 | static void Main(string[] args)
13 | {
14 | if ( args.Length != 7)
15 | {
16 | Console.WriteLine("Sets the static location of an object\n" +
17 | "Arguments:\n" +
18 | "0 - Server IP/host\n" +
19 | "1 - Port\n" +
20 | "2 - User\n" +
21 | "3 - Password\n" +
22 | "4 - Object Full Name\n" +
23 | "5 - Latitude\n" +
24 | "6 - Longitude\n" +
25 | " Example: SetStaticLocation localhost 5481 user password \"group1.group2.objectname\" 1.234 5.678");
26 | return;
27 | }
28 | #pragma warning disable 612, 618
29 | var node = new ClearScada.Client.ServerNode(ClearScada.Client.ConnectionType.Standard, args[0], int.Parse(args[1]));
30 | var connection = new ClearScada.Client.Simple.Connection("UtilityB1");
31 | connection.Connect(node);
32 | var AdvConnection = node.Connect("UtilityB2");
33 | #pragma warning restore 612, 618
34 | using (var spassword = new System.Security.SecureString())
35 | {
36 | foreach (var c in args[3])
37 | {
38 | spassword.AppendChar(c);
39 | }
40 | connection.LogOn(args[2], spassword);
41 | AdvConnection.LogOn(args[2], spassword);
42 | }
43 | string fullname = args[4];
44 | var dbobject = connection.GetObject(fullname);
45 | ClearScada.Client.Simple.Aggregate agg = dbobject.Aggregates["GISLocationSource"];
46 | agg.ClassName = "CGISLocationSrcStatic";
47 | //Console.WriteLine(fullname + "," + dbobject.ClassDefinition.Name + "," );
48 | double lat;
49 | double.TryParse(args[5], out lat);
50 | double lon;
51 | double.TryParse(args[6], out lon);
52 | agg.SetProperty("Latitude", lat);
53 | agg.SetProperty("Longitude", lon);
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/SetStaticLocation/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("ListReferences")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("ListReferences")]
13 | [assembly: AssemblyCopyright("Copyright © 2019")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("6cea5bbe-3766-450c-9d03-431992007c65")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/SetStaticLocation/SetStaticLocation.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {6CEA5BBE-3766-450C-9D03-431992007C65}
8 | Exe
9 | Properties
10 | SetStaticLocation
11 | SetStaticLocation
12 | v4.8
13 | 512
14 | true
15 |
16 |
17 |
18 | AnyCPU
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | AnyCPU
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 |
36 |
37 | SetStaticLocation.Program
38 |
39 |
40 |
41 | False
42 | ..\..\..\..\..\..\Program Files\Schneider Electric\ClearSCADA\ClearScada.Client.dll
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
71 |
--------------------------------------------------------------------------------
/SetStaticLocation/SetStaticLocation.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SetStaticLocation", "SetStaticLocation.csproj", "{6CEA5BBE-3766-450C-9D03-431992007C65}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {6CEA5BBE-3766-450C-9D03-431992007C65}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {6CEA5BBE-3766-450C-9D03-431992007C65}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {6CEA5BBE-3766-450C-9D03-431992007C65}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {6CEA5BBE-3766-450C-9D03-431992007C65}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/ViewXAPI1/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ViewXAPI1/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using ViewX;
7 |
8 | namespace ViewXAPI1
9 | {
10 | class Program
11 | {
12 | static void Main(string[] args)
13 | {
14 | ViewX.Application a = new ViewX.Application();
15 | a.Logon("Local", "", ""); // ENTER USERNAME AND PASSWORD HERE
16 | a.Mimics.OpenFromServer(false, "Local", "");
17 | a.Visible = true;
18 | ViewX.Mimic oMimic = (Mimic) a.Mimics.OpenFromServer(false, "Local", "New Mimic");
19 | ViewX.DrwLayers oLayers = oMimic.Layers;
20 | oLayers.Add("Extra");
21 | var oSquareRef = oLayers["Extra"].AddRectangle(100000, 150000, 500000, 650000);
22 | oLayers["Extra"].SelectObject( (DrwObject) oSquareRef);
23 | oMimic.ActiveLayer = oLayers["Extra"];
24 | oMimic.DeleteSelected();
25 | oMimic.Save();
26 | oMimic.Close();
27 |
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/ViewXAPI1/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("ViewXAPI1")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("ViewXAPI1")]
13 | [assembly: AssemblyCopyright("Copyright © 2020")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("4a0c2614-cb61-48e2-a4d0-681e6dc18c58")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/ViewXAPI1/ViewXAPI1.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {4A0C2614-CB61-48E2-A4D0-681E6DC18C58}
8 | Exe
9 | Properties
10 | ViewXAPI1
11 | ViewXAPI1
12 | v4.7.2
13 | 512
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 | {EEAD1000-0777-11D2-AF05-0000E82E7A14}
55 | 1
56 | 30
57 | 0
58 | tlbimp
59 | False
60 | True
61 |
62 |
63 |
64 |
71 |
--------------------------------------------------------------------------------
/ViewXAPI1/ViewXAPI1.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ViewXAPI1", "ViewXAPI1.csproj", "{4A0C2614-CB61-48E2-A4D0-681E6DC18C58}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {4A0C2614-CB61-48E2-A4D0-681E6DC18C58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {4A0C2614-CB61-48E2-A4D0-681E6DC18C58}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {4A0C2614-CB61-48E2-A4D0-681E6DC18C58}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {4A0C2614-CB61-48E2-A4D0-681E6DC18C58}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------