/// <summary> /// Initializes a new instance of the class. /// </summary> public FrmCnlCreate(ScadaProject project, RecentSelection recentSelection, AppData appData) : this() { this.project = project ?? throw new ArgumentNullException("project"); this.appData = appData ?? throw new ArgumentNullException("appData"); step = 1; }
/// <summary> /// Creates tree nodes according to the project structure. /// </summary> public void CreateNodes(ScadaProject project) { this.project = project ?? throw new ArgumentNullException("project"); ProjectNode = null; BaseNode = null; BaseTableNodes = new Dictionary <string, TreeNode>(); InterfaceNode = null; InstancesNode = null; try { treeView.BeginUpdate(); treeView.Nodes.Clear(); ProjectNode = TreeViewUtils.CreateNode(project.Name, "project.png", true); ProjectNode.ContextMenuStrip = contextMenus.ProjectMenu; ProjectNode.Tag = new TreeNodeTag { RelatedObject = project, NodeType = AppNodeType.Project }; treeView.Nodes.Add(ProjectNode); BaseNode = CreateBaseNode(project.ConfigBase); ProjectNode.Nodes.Add(BaseNode); InterfaceNode = TreeViewUtils.CreateNode(AppPhrases.InterfaceNode, "ui.png"); InterfaceNode.ContextMenuStrip = contextMenus.DirectoryMenu; InterfaceNode.Tag = new TreeNodeTag { RelatedObject = project.Interface, NodeType = AppNodeType.Interface }; ProjectNode.Nodes.Add(InterfaceNode); TreeNode emptyNode = TreeViewUtils.CreateNode(AppPhrases.EmptyNode, "empty.png"); InterfaceNode.Nodes.Add(emptyNode); InstancesNode = TreeViewUtils.CreateNode(AppPhrases.InstancesNode, "instances.png"); InstancesNode.ContextMenuStrip = contextMenus.InstanceMenu; InstancesNode.Tag = new TreeNodeTag { RelatedObject = project.Instances, NodeType = AppNodeType.Instances }; ProjectNode.Nodes.Add(InstancesNode); foreach (Instance instance in project.Instances) { InstancesNode.Nodes.Add(CreateInstanceNode(instance)); } ProjectNode.Expand(); InstancesNode.Expand(); } finally { treeView.EndUpdate(); } }
/// <summary> /// Initializes a new instance of the class. /// </summary> public FrmUploadConfig(AppData appData, ScadaProject project, Instance instance) : this() { this.appData = appData ?? throw new ArgumentNullException(nameof(appData)); this.project = project ?? throw new ArgumentNullException(nameof(project)); this.instance = instance ?? throw new ArgumentNullException(nameof(instance)); }
/// <summary> /// Initializes a new instance of the class. /// </summary> public FrmUploadConfig(AppData appData, ScadaProject project, Instance instance) : this() { this.appData = appData ?? throw new ArgumentNullException("appData"); this.project = project ?? throw new ArgumentNullException("project"); this.instance = instance ?? throw new ArgumentNullException("instance"); }
/// <summary> /// Initializes the control. /// </summary> public void Init(IAdminContext adminContext, ScadaProject project) { this.adminContext = adminContext ?? throw new ArgumentNullException(nameof(adminContext)); this.project = project ?? throw new ArgumentNullException(nameof(project)); lastStartCnlNum = 1; lastCnlCnt = 0; }
/// <summary> /// Initializes a new instance of the class. /// </summary> public CtrlLineSelect(IAdminContext adminContext, ScadaProject project, RecentSelection recentSelection) : this() { this.adminContext = adminContext ?? throw new ArgumentNullException(nameof(adminContext)); this.project = project ?? throw new ArgumentNullException(nameof(project)); this.recentSelection = recentSelection ?? throw new ArgumentNullException(nameof(recentSelection)); }
/// <summary> /// Initializes a new instance of the class. /// </summary> public FrmCommSync(ScadaProject project, Instance instance) : this() { this.project = project ?? throw new ArgumentNullException("project"); this.instance = instance ?? throw new ArgumentNullException("instance"); CommLineSettings = null; }
/// <summary> /// Initializes a new instance of the class. /// </summary> public FrmCnlCreate(IAdminContext adminContext, ScadaProject project, RecentSelection recentSelection) : this() { this.adminContext = adminContext ?? throw new ArgumentNullException(nameof(adminContext)); this.project = project ?? throw new ArgumentNullException(nameof(project)); this.recentSelection = recentSelection ?? throw new ArgumentNullException(nameof(recentSelection)); step = 1; }
private DataTable dataTable; // the table used by a grid view control /// <inheritdoc /> /// <summary> /// Initializes a new instance of the class. /// </summary> public FrmBaseTableGeneric(AppData appData, ScadaProject project, BaseTable <T> baseTable) : base(appData) { this.project = project ?? throw new ArgumentNullException(nameof(project)); this.baseTable = baseTable ?? throw new ArgumentNullException(nameof(baseTable)); dataTable = null; Text = baseTable.Title; }
private readonly RichTextBoxHelper logHelper; // provides access to log /// <summary> /// Initializes a new instance of the class. /// </summary> public ConfigBuilder(IAdminContext adminContext, ScadaProject project, RichTextBoxHelper logHelper) { this.adminContext = adminContext ?? throw new ArgumentNullException(nameof(adminContext)); this.project = project ?? throw new ArgumentNullException(nameof(project)); this.logHelper = logHelper ?? throw new ArgumentNullException(nameof(logHelper)); BuildResult = false; DeviceConfigs = new List <DeviceConfigEntry>(); }
/// <summary> /// Initializes the control. /// </summary> public void Init(ScadaProject project, AppData appData) { this.project = project ?? throw new ArgumentNullException("project"); this.appData = appData ?? throw new ArgumentNullException("appData"); CnlPrototypes = null; ScanCommSettings(); FillCommLineList(); }
private ScadaProject project; // the current project to build tree /// <summary> /// Initializes a new instance of the class. /// </summary> public ExplorerBuilder(AppData appData, ServerShell serverShell, CommShell commShell, TreeView treeView, ContextMenus contextMenus) { this.appData = appData ?? throw new ArgumentNullException("appData"); this.serverShell = serverShell ?? throw new ArgumentNullException("serverShell"); this.commShell = commShell ?? throw new ArgumentNullException("commShell"); this.treeView = treeView ?? throw new ArgumentNullException("treeView"); this.contextMenus = contextMenus ?? throw new ArgumentNullException("contextMenus"); project = null; }
/// <summary> /// Initializes the control. /// </summary> public void Init(IAdminContext adminContext, ScadaProject project, RecentSelection recentSelection) { this.adminContext = adminContext ?? throw new ArgumentNullException(nameof(adminContext)); this.project = project ?? throw new ArgumentNullException(nameof(project)); this.recentSelection = recentSelection ?? throw new ArgumentNullException(nameof(recentSelection)); CnlPrototypes = null; ScanCommSettings(); FillCommLineList(); }
/// <summary> /// Initializes a new instance of the class. /// </summary> public FrmCommImport(ScadaProject project, Instance instance, CommEnvironment commEnvironment) : this() { this.project = project ?? throw new ArgumentNullException("project"); this.instance = instance ?? throw new ArgumentNullException("instance"); this.commEnvironment = commEnvironment ?? throw new ArgumentNullException("commEnvironment"); CommLineSettings = null; ImportedCommLines = null; ImportedDevices = null; }
/// <summary> /// Initializes a new instance of the class. /// </summary> public FrmInstanceProfile(AppData appData, ScadaProject project, ProjectInstance instance) : this() { this.appData = appData ?? throw new ArgumentNullException(nameof(appData)); this.project = project ?? throw new ArgumentNullException(nameof(project)); this.instance = instance ?? throw new ArgumentNullException(nameof(instance)); initialProfile = null; ProfileChanged = false; ConnectionModified = false; }
/// <summary> /// Initializes a new instance of the class. /// </summary> public FrmLineAdd(ScadaProject project, RecentSelection recentSelection) : this() { this.project = project ?? throw new ArgumentNullException("project"); this.recentSelection = recentSelection ?? throw new ArgumentNullException("recentSelection"); InstanceName = ""; CommLineSettings = null; numCommLineNum.Maximum = ushort.MaxValue; txtName.MaxLength = ColumnLength.Name; txtDescr.MaxLength = ColumnLength.Description; }
/// <summary> /// Initializes a new instance of the class. /// </summary> public FrmSync(IAdminContext adminContext, ScadaProject project, CommApp commApp) : this() { this.adminContext = adminContext ?? throw new ArgumentNullException(nameof(adminContext)); this.project = project ?? throw new ArgumentNullException(nameof(project)); this.commApp = commApp ?? throw new ArgumentNullException(nameof(commApp)); commConfig = commApp.AppConfig; lastErrorMessage = ""; SelectedLineNum = 0; AddedToComm = false; }
/// <summary> /// Initializes a new instance of the class. /// </summary> public FrmLineAdd(ScadaProject project, RecentSelection recentSelection) : this() { this.project = project ?? throw new ArgumentNullException(nameof(project)); this.recentSelection = recentSelection ?? throw new ArgumentNullException(nameof(recentSelection)); Instance = null; LineConfig = null; numCommLineNum.Maximum = ConfigDatabase.MaxID; txtName.MaxLength = ExtensionUtils.NameLength; txtDescr.MaxLength = ExtensionUtils.DescrLength; }
private ScadaProject project; // the current project to build tree /// <summary> /// Initializes a new instance of the class. /// </summary> public ExplorerBuilder(AppData appData, TreeView treeView, ContextMenus contextMenus) { this.appData = appData ?? throw new ArgumentNullException(nameof(appData)); this.treeView = treeView ?? throw new ArgumentNullException(nameof(treeView)); this.contextMenus = contextMenus ?? throw new ArgumentNullException(nameof(contextMenus)); project = null; ProjectNode = null; ConfigDatabaseNode = null; BaseTableNodes = null; ViewsNode = null; InstancesNode = null; }
/// <summary> /// Initializes a new instance of the class. /// </summary> public Uploader(ScadaProject project, ProjectInstance instance, DeploymentProfile profile, ITransferControl transferControl) { this.project = project ?? throw new ArgumentNullException(nameof(project)); this.instance = instance ?? throw new ArgumentNullException(nameof(instance)); this.profile = profile ?? throw new ArgumentNullException(nameof(profile)); this.transferControl = transferControl ?? throw new ArgumentNullException(nameof(transferControl)); uploadOptions = profile.UploadOptions; progressTracker = new ProgressTracker(transferControl) { TaskCount = TaskCount }; conn = null; }
/// <summary> /// Initializes a new instance of the class. /// </summary> public FrmBaseTable(IBaseTable baseTable, TableFilter tableFilter, ScadaProject project, AppData appData) : this() { this.baseTable = baseTable ?? throw new ArgumentNullException("baseTable"); this.tableFilter = tableFilter; this.project = project ?? throw new ArgumentNullException("project"); this.appData = appData ?? throw new ArgumentNullException("appData"); dataTable = null; maxRowID = 0; frmFind = null; Text = baseTable.Title + (tableFilter == null ? "" : " - " + tableFilter); }
/// <summary> /// Initializes a new instance of the class. /// </summary> public FrmDownloadConfig(AppData appData, ScadaProject project, ProjectInstance instance) : this() { this.appData = appData ?? throw new ArgumentNullException(nameof(appData)); this.project = project ?? throw new ArgumentNullException(nameof(project)); this.instance = instance ?? throw new ArgumentNullException(nameof(instance)); initialProfile = null; transferOptionsModified = false; ProfileChanged = false; ConnectionModified = false; BaseModified = false; ViewModified = false; InstanceModified = false; }
private ScadaProject project; // the current project to build tree /// <summary> /// Initializes a new instance of the class. /// </summary> public ExplorerBuilder(AppData appData, /*ServerShell serverShell, CommShell commShell, */ TreeView treeView, ContextMenus contextMenus) { this.appData = appData ?? throw new ArgumentNullException(nameof(appData)); //this.serverShell = serverShell ?? throw new ArgumentNullException("serverShell"); //this.commShell = commShell ?? throw new ArgumentNullException("commShell"); this.treeView = treeView ?? throw new ArgumentNullException(nameof(treeView)); this.contextMenus = contextMenus ?? throw new ArgumentNullException(nameof(contextMenus)); project = null; ProjectNode = null; BaseNode = null; BaseTableNodes = null; ViewsNode = null; InstancesNode = null; }
/// <summary> /// Initializes a new instance of the class. /// </summary> public FrmDeviceAdd(IAdminContext adminContext, ScadaProject project, RecentSelection recentSelection) : this() { this.adminContext = adminContext ?? throw new ArgumentNullException(nameof(adminContext)); this.project = project ?? throw new ArgumentNullException(nameof(project)); this.recentSelection = recentSelection ?? throw new ArgumentNullException(nameof(recentSelection)); Instance = null; DeviceConfig = null; LineConfig = null; numDeviceNum.Maximum = ConfigDatabase.MaxID; txtName.MaxLength = ExtensionUtils.NameLength; txtStrAddress.MaxLength = ExtensionUtils.DefaultLength; txtDescr.MaxLength = ExtensionUtils.DescrLength; }
/// <summary> /// Initializes a new instance of the class. /// </summary> public FrmWirenBoardWizard(IAdminContext adminContext, ScadaProject project, RecentSelection recentSelection) : this() { this.adminContext = adminContext ?? throw new ArgumentNullException(nameof(adminContext)); this.project = project ?? throw new ArgumentNullException(nameof(project)); ctrlLineSelect = new CtrlLineSelect(adminContext, project, recentSelection); ctrlLog = new CtrlLog(); ctrlDeviceTree = new CtrlDeviceTree(); ctrlEntityID = new CtrlEntityID(adminContext, project, recentSelection); logHelper = new RichTextBoxHelper(ctrlLog.RichTextBox); AddUserControls(); step = Step.SelectLine; topicReader = null; configBuilder = null; }
/// <summary> /// Initializes a new instance of the class. /// </summary> public FrmTransfer(AppData appData, ScadaProject project, ProjectInstance instance, DeploymentProfile profile) : this() { this.appData = appData ?? throw new ArgumentNullException(nameof(appData)); this.project = project ?? throw new ArgumentNullException(nameof(project)); this.instance = instance ?? throw new ArgumentNullException(nameof(instance)); this.profile = profile ?? throw new ArgumentNullException(nameof(profile)); setCancelEnabledAction = b => SetCancelEnabled(b); setProgressAction = d => SetProgress(d); setResultAction = (b, d) => SetResult(b, d); logHelper = new RichTextBoxHelper(txtLog); extensionLogic = null; uploadMode = false; operationResult = false; tokenSource = null; }
/// <summary> /// Initializes a new instance of the class. /// </summary> public Downloader(AdminDirs appDirs, ScadaProject project, ProjectInstance instance, DeploymentProfile profile, ITransferControl transferControl) { this.appDirs = appDirs ?? throw new ArgumentNullException(nameof(appDirs)); this.project = project ?? throw new ArgumentNullException(nameof(project)); this.instance = instance ?? throw new ArgumentNullException(nameof(instance)); this.profile = profile ?? throw new ArgumentNullException(nameof(profile)); this.transferControl = transferControl ?? throw new ArgumentNullException(nameof(transferControl)); downloadOptions = profile.DownloadOptions; progressTracker = new ProgressTracker(transferControl) { TaskCount = TaskCount }; agentClient = null; tempFileNames = null; extractDirs = null; }
/// <summary> /// Fills the list of available templates. /// </summary> private void FillTemplateList() { try { cbTemplate.BeginUpdate(); DirectoryInfo templateDirInfo = new(appData.AppDirs.TemplateDir); if (templateDirInfo.Exists) { int selectedIndex = 0; string cultureTemplate = "." + Locale.Culture.Name + "."; // search for project files foreach (DirectoryInfo projectDirInfo in templateDirInfo.EnumerateDirectories("*", SearchOption.TopDirectoryOnly)) { foreach (FileInfo projectFileInfo in projectDirInfo.EnumerateFiles("*" + AdminUtils.ProjectExt, SearchOption.TopDirectoryOnly)) { if (ScadaProject.LoadDescription(projectFileInfo.FullName, out string description, out string errMsg)) { cbTemplate.Items.Add(new TemplateItem() { Name = projectFileInfo.Name, FileName = projectFileInfo.FullName, Descr = description }); if (projectFileInfo.Name.Contains(cultureTemplate)) { selectedIndex = cbTemplate.Items.Count - 1; } } else { appData.ErrLog.WriteError(errMsg); } } }
/// <summary> /// Initializes the control. /// </summary> public void Init(ScadaProject project, RecentSelection recentSelection) { this.project = project ?? throw new ArgumentNullException(nameof(project)); this.recentSelection = recentSelection ?? throw new ArgumentNullException(nameof(recentSelection)); FillObjectList(); }
/// <summary> /// Exports the configuration to the specified archive. /// </summary> public void ExportToArchive(string destFileName, ScadaProject project, Instance instance, TransferSettings transferSettings) { if (destFileName == null) { throw new ArgumentNullException("destFileName"); } if (project == null) { throw new ArgumentNullException("project"); } if (instance == null) { throw new ArgumentNullException("instance"); } FileStream fileStream = null; ZipArchive zipArchive = null; try { fileStream = new FileStream(destFileName, FileMode.Create, FileAccess.Write, FileShare.Read); zipArchive = new ZipArchive(fileStream, ZipArchiveMode.Create); bool ignoreRegKeys = transferSettings.IgnoreRegKeys; // add the configuration database to the archive if (transferSettings.IncludeBase) { foreach (IBaseTable srcTable in project.ConfigBase.AllTables) { string entryName = "BaseDAT/" + srcTable.Name.ToLowerInvariant() + ".dat"; var tableEntry = zipArchive.CreateEntry(entryName, CompressionLevel.Fastest); using (var entryStream = tableEntry.Open()) { // convert the table to DAT format BaseAdapter baseAdapter = new BaseAdapter() { Stream = entryStream }; baseAdapter.Update(srcTable); } } } // add the interface files to the archive if (transferSettings.IncludeInterface) { PackDirectory(zipArchive, project.Interface.InterfaceDir, DirectoryBuilder.GetDirectory(ConfigParts.Interface, '/'), ignoreRegKeys); } // add the Server settings to the archive if (transferSettings.IncludeServer && instance.ServerApp.Enabled) { PackDirectory(zipArchive, instance.ServerApp.AppDir, DirectoryBuilder.GetDirectory(ConfigParts.Server, '/'), ignoreRegKeys); } // add the Communicator settings to the archive if (transferSettings.IncludeServer && instance.ServerApp.Enabled) { PackDirectory(zipArchive, instance.CommApp.AppDir, DirectoryBuilder.GetDirectory(ConfigParts.Comm, '/'), ignoreRegKeys); } // add the Webstation settings to the archive if (transferSettings.IncludeServer && instance.ServerApp.Enabled) { PackDirectory(zipArchive, Path.Combine(instance.WebApp.AppDir, "config"), DirectoryBuilder.GetDirectory(ConfigParts.Web, AppFolder.Config, '/'), ignoreRegKeys); if (!transferSettings.IgnoreWebStorage) { PackDirectory(zipArchive, Path.Combine(instance.WebApp.AppDir, "storage"), DirectoryBuilder.GetDirectory(ConfigParts.Web, AppFolder.Storage, '/'), ignoreRegKeys); } } } catch (Exception ex) { throw new ScadaException(AdminPhrases.ExportToArchiveError, ex); } finally { zipArchive?.Dispose(); fileStream?.Dispose(); } }