/// <summary> /// Initializes a new instance of the class. /// </summary> public FrmBasicEAO(AppDirs appDirs, ArchiveConfig archiveConfig) : this() { this.appDirs = appDirs ?? throw new ArgumentNullException(nameof(appDirs)); this.archiveConfig = archiveConfig ?? throw new ArgumentNullException(nameof(archiveConfig)); options = new BasicEAO(archiveConfig.CustomOptions); }
/// <summary> /// Initializes a new instance of the class. /// </summary> public ServerEnvironment(AppDirs appDirs, Log errLog) { moduleViews = new Dictionary <string, ModView>(); AppDirs = appDirs ?? throw new ArgumentNullException("appDirs"); ErrLog = errLog ?? throw new ArgumentNullException("errLog"); }
/// <summary> /// Конструктор /// </summary> public ModLogic() { appDirs = new AppDirs(); Settings = null; WriteToLog = null; PassCommand = null; }
/// <summary> /// Initializes a new instance of the class. /// </summary> public FrmArcDir(AppDirs appDirs) : this() { this.appDirs = appDirs ?? throw new ArgumentNullException(nameof(appDirs)); configFileName = Path.Combine(appDirs.ConfigDir, ModuleConfig.DefaultFileName); moduleConfig = new ModuleConfig(); }
private string[] lineCaptions; // обозначения линий связи /// <summary> /// Конструктор /// </summary> public Manager() { kpTypes = new Dictionary <string, Type>(); commLines = new List <CommLine>(); lineCmdLock = new object(); commandReader = null; infoThread = null; infoFileName = ""; startThread = null; startDT = DateTime.MinValue; workState = ""; linesStarted = false; lineCaptions = null; AppDirs = new AppDirs(); Settings = new Settings(); ServerComm = null; AppLog = new Log(Log.Formats.Full) { Encoding = Encoding.UTF8 }; AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; }
private ArcUploadState taskUploadState; // the state of uploading archives according to the task /// <summary> /// Initializes a new instance of the class. /// </summary> public Exporter(ExportTargetConfig exporterConfig, EntityMap entityMap, IServerData serverData, AppDirs appDirs, string arcDir) { this.exporterConfig = exporterConfig ?? throw new ArgumentNullException(nameof(exporterConfig)); this.entityMap = entityMap ?? throw new ArgumentNullException(nameof(entityMap)); this.serverData = serverData ?? throw new ArgumentNullException(nameof(serverData)); this.arcDir = arcDir ?? throw new ArgumentNullException(nameof(arcDir)); GeneralOptions generalOptions = exporterConfig.GeneralOptions; dataLifetime = TimeSpan.FromSeconds(generalOptions.DataLifetime); string prefix = FilePrefix + "_" + generalOptions.ID.ToString("D3"); log = new Log(Log.Formats.Simple) { FileName = Path.Combine(appDirs.LogDir, prefix + ".log") }; infoFileName = Path.Combine(appDirs.LogDir, prefix + ".txt"); stateFileName = Path.Combine(appDirs.StorageDir, prefix + "_State.xml"); exporterTitle = string.Format("[{0}] {1}", generalOptions.ID, generalOptions.Name); dataSource = DataSourceFactory.GetDataSource(exporterConfig.ConnectionOptions); triggers = new ClassifiedTriggers(exporterConfig.Triggers, dataSource); thread = null; terminated = false; connStatus = ConnStatus.Undefined; CreateQueues(); InitArcUploading(); }
/// <summary> /// Initializes the common data. /// </summary> public void Init(string exeDir) { AppDirs.Init(exeDir); ErrLog.FileName = AppDirs.LogDir + ErrFileName; ErrLog.Encoding = Encoding.UTF8; }
/// <summary> /// Initializes a new instance of the class. /// </summary> public CommEnvironment(AppDirs appDirs, Log errLog) { kpViews = new Dictionary <string, KPView>(); AppDirs = appDirs ?? throw new ArgumentNullException("appDirs"); ErrLog = errLog ?? throw new ArgumentNullException("errLog"); }
/// <summary> /// Initializes a new instance of the class. /// </summary> public FrmScadaServerDSO(ConfigDataset configDataset, AppDirs appDirs, DataSourceConfig dataSourceConfig) : this() { this.configDataset = configDataset ?? throw new ArgumentNullException(nameof(configDataset)); this.appDirs = appDirs ?? throw new ArgumentNullException(nameof(appDirs)); this.dataSourceConfig = dataSourceConfig ?? throw new ArgumentNullException(nameof(dataSourceConfig)); options = new ScadaServerDSO(dataSourceConfig.CustomOptions); }
/// <summary> /// Конструктор для настройки конкретного КП /// </summary> public KPView(int number) { appDirs = new AppDirs(); CanShowProps = false; Number = number; KPProps = null; }
/// <summary> /// Отобразить форму модально /// </summary> public static void ShowDialog(AppDirs appDirs, ServerComm serverComm) { FrmAlarmConfig frmAlarmConfig = new FrmAlarmConfig(); frmAlarmConfig.appDirs = appDirs; frmAlarmConfig.serverComm = serverComm; frmAlarmConfig.ShowDialog(); }
/// <summary> /// Initializes a new instance of the class. /// </summary> public FrmDeviceProps(AppDirs appDirs, LineConfig lineConfig, DeviceConfig deviceConfig, CustomUi customUi) : this() { this.appDirs = appDirs ?? throw new ArgumentNullException(nameof(appDirs)); this.lineConfig = lineConfig ?? throw new ArgumentNullException(nameof(lineConfig)); this.deviceConfig = deviceConfig ?? throw new ArgumentNullException(nameof(deviceConfig)); this.customUi = customUi ?? throw new ArgumentNullException(nameof(customUi)); }
private AppDirs appDirs; // директории приложения /// <summary> /// Конструктор /// </summary> public ModLogic() { appDirs = new AppDirs(); Settings = null; WriteToLog = null; ServerData = null; ServerCommands = null; }
private int kpNum; // номер настраиваемого КП #endregion Fields #region Constructors /// <summary> /// Конструктор, ограничивающий создание формы без параметров /// </summary> private FrmConfig() { InitializeComponent(); appDirs = null; kpNum = 0; config = new Config(); configFileName = ""; }
/// <summary> /// Initializes a new instance of the class. /// </summary> public FrmConfig(AppDirs appDirs, int deviceNum) : this() { this.appDirs = appDirs ?? throw new ArgumentNullException(nameof(appDirs)); this.deviceNum = deviceNum; config = new NotifDeviceConfig(); configFileName = Path.Combine(appDirs.ConfigDir, NotifDeviceConfig.GetFileName(deviceNum)); modified = false; }
/// <summary> /// Initializes a new instance of the class. /// </summary> private FrmConfig(AppDirs appDirs, int kpNum) : this() { config = new KpConfig(); this.appDirs = appDirs ?? throw new ArgumentNullException("appDirs"); this.kpNum = kpNum; configFileName = ""; prevUser = ""; }
/// <summary> /// Initializes the common data. /// </summary> public void Init(string exeDir) { AppDirs.Init(exeDir); ErrLog = new LogFile(LogFormat.Full) { FileName = Path.Combine(AppDirs.LogDir, ErrFileName) }; }
/// <summary> /// Initializes a new instance of the class. /// </summary> public FrmConfig(AppDirs appDirs, int kpNum) : this() { this.appDirs = appDirs ?? throw new ArgumentNullException("appDirs"); this.kpNum = kpNum; configFileName = ""; config = new Config(); connChanging = false; }
/// <summary> /// Initializes a new instance of the class. /// </summary> public FrmConfig(AppDirs appDirs, int deviceNum) : this() { this.appDirs = appDirs ?? throw new ArgumentNullException(nameof(appDirs)); this.deviceNum = deviceNum; config = new EmailDeviceConfig(); configFileName = Path.Combine(appDirs.ConfigDir, EmailDeviceConfig.GetFileName(deviceNum)); prevUsername = ""; }
private string configFileName; // KP configuration file name /// <inheritdoc /> /// <summary> /// Constructor restricting form creation without parameters /// </summary> private FrmConfig() { InitializeComponent(); appDirs = null; kpNum = 0; config = new Config(); configFileName = ""; }
/// <summary> /// Initializes a new instance of the class. /// </summary> public FrmConfig(AppDirs appDirs, int kpNum) : this() { this.appDirs = appDirs ?? throw new ArgumentNullException("appDirs"); this.kpNum = kpNum; config = new DeviceConfig(); configFileName = ""; modified = false; }
/// <summary> /// Конструктор, ограничивающий создание объекта из других классов /// </summary> private CompManager() { appDirs = null; log = new LogStub(); allSpecs = new List <CompLibSpec>(); factsByPrefix = new Dictionary <string, CompFactory>(); specsByType = new Dictionary <string, CompLibSpec>(); LoadErrors = new List <string>(); }
/// <summary> /// Display the form modally /// </summary> public static void ShowDialog(AppDirs appDirs, ServerComm serverComm) { var frmDBExportConfig = new FrmDBExportConfig { appDirs = appDirs, serverComm = serverComm }; frmDBExportConfig.ShowDialog(); }
private TreeNode rootNode; // корневой узел дерева /// <summary> /// Конструктор, ограничивающий создание формы без параметров /// </summary> private FrmAddressBook() { InitializeComponent(); appDirs = null; addressBook = new AddressBook(); modified = false; rootNode = treeView.Nodes["rootNode"]; rootNode.Tag = addressBook; }
/// <summary> /// Отобразить форму модально /// </summary> public static void ShowDialog(AppDirs appDirs, int kpNum) { if (appDirs == null) throw new ArgumentNullException("appDirs"); FrmConfig frmConfig = new FrmConfig(); frmConfig.appDirs = appDirs; frmConfig.kpNum = kpNum; frmConfig.ShowDialog(); }
/// <summary> /// Initializes a new instance of the class. /// </summary> public FrmAddressBook(AppDirs appDirs) : this() { this.appDirs = appDirs ?? throw new ArgumentNullException(nameof(appDirs)); addressBook = new AddressBook(); rootNode = treeView.Nodes[0]; rootNode.Tag = addressBook; fileName = Path.Combine(appDirs.ConfigDir, AddressBook.DefaultFileName); modified = false; }
internal void InitAppDirs(out bool dirsExist, out bool logDirExists) { AppDirs.Init(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); AppLog.FileName = AppDirs.LogDir + LogFileName; infoFileName = AppDirs.LogDir + InfoFileName; logDirExists = Directory.Exists(AppDirs.LogDir); dirsExist = Directory.Exists(AppDirs.ConfigDir) && Directory.Exists(AppDirs.LangDir) && logDirExists && Directory.Exists(AppDirs.ModDir); }
private TreeNode nodePhonebook; // узел справочника /// <summary> /// Конструктор, ограничивающий создание формы без параметров /// </summary> private FrmPhonebook() { InitializeComponent(); appDirs = null; phonebook = new Phonebook(); modified = false; copiedNumber = null; nodePhonebook = tvPhonebook.Nodes["nodePhonebook"]; }
private readonly bool isLogicRuntime; // the runtime kind /// <summary> /// Initializes a new instance of the class. /// </summary> public OpcHelper(AppDirs appDirs, ILog log, int deviceNum, bool isLogicRuntime) { this.appDirs = appDirs ?? throw new ArgumentNullException(nameof(appDirs)); this.log = log ?? throw new ArgumentNullException(nameof(log)); deviceNumStr = deviceNum.ToString("D3"); this.isLogicRuntime = isLogicRuntime; AutoAccept = false; OpcSession = null; }
private readonly RuntimeKind runtime; // the runtime kind /// <summary> /// Initializes a new instance of the class. /// </summary> public OpcUaHelper(AppDirs appDirs, int kpNum, RuntimeKind runtime) { this.appDirs = appDirs ?? throw new ArgumentNullException("appDirs"); kpNumStr = CommUtils.AddZeros(kpNum, 3); this.runtime = runtime; AutoAccept = false; OpcSession = null; CertificateValidation = null; WriteToLog = (string text) => { }; // stub }
/// <summary> /// Отобразить форму модально /// </summary> public static void ShowDialog(AppDirs appDirs, int kpNum, string cmdLine) { FrmConfig frmConfig = new FrmConfig { appDirs = appDirs ?? throw new ArgumentNullException("appDirs"), kpNum = kpNum, cmdLine = cmdLine }; frmConfig.ShowDialog(); }
/// <summary> /// Инициализировать директории приложения /// </summary> private void InitAppDirs(out bool dirsExist, out bool logDirExists) { AppDirs.Init(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); AppLog.FileName = AppDirs.LogDir + CommUtils.AppLogFileName; infoFileName = AppDirs.LogDir + CommUtils.AppStateFileName; logDirExists = Directory.Exists(AppDirs.LogDir); dirsExist = Directory.Exists(AppDirs.ConfigDir) && Directory.Exists(AppDirs.LangDir) && logDirExists && Directory.Exists(AppDirs.KPDir) && Directory.Exists(AppDirs.CmdDir); }
private TreeNode rootNode; // корневой узел дерева #endregion Fields #region Constructors /// <summary> /// Конструктор, ограничивающий создание формы без параметров /// </summary> private FrmConfig() { InitializeComponent(); appDirs = null; kpNum = 0; config = new Config(); configFileName = ""; modified = false; rootNode = treeView.Nodes["nodeDevice"]; rootNode.Tag = config; }
/// <summary> /// Отобразить форму модально /// </summary> public static void ShowDialog(int kpNum, KPView.KPProperties kpProps, AppDirs appDirs) { if (kpProps == null) throw new ArgumentNullException("kpProps"); if (appDirs == null) throw new ArgumentNullException("appDirs"); FrmDevProps frmDevProps = new FrmDevProps(); frmDevProps.kpNum = kpNum; frmDevProps.kpProps = kpProps; frmDevProps.appDirs = appDirs; frmDevProps.ShowDialog(); }
private TreeNode selNode; // выбранный узел дерева #endregion Fields #region Constructors /// <summary> /// Конструктор, ограничивающий создание формы без параметров /// </summary> private FrmDevTemplate() { InitializeComponent(); appDirs = null; initialFileName = ""; fileName = ""; saveOnly = false; devTemplate = null; modified = false; selElemGroup = null; selElemInfo = null; selCmd = null; selNode = null; grsNode = treeView.Nodes["grsNode"]; cmdsNode = treeView.Nodes["cmdsNode"]; procChangedEv = false; }
/// <summary> /// Отобразить форму модально /// </summary> public static void ShowDialog(AppDirs appDirs) { string fileName = ""; ShowDialog(appDirs, false, ref fileName); }
private string workState; // состояние работы #endregion Fields #region Constructors /// <summary> /// Конструктор /// </summary> public MainLogic() { AppDirs = new AppDirs(); AppLog = new Log(Log.Formats.Full); AppLog.Encoding = Encoding.UTF8; Settings = new Settings(); infoFileName = ""; thread = null; terminated = false; serverIsReady = false; startDT = DateTime.MinValue; workState = ""; comm = new Comm(this); calculator = new Calculator(this); inCnls = new SortedList<int, InCnl>(); drCnls = null; drmCnls = null; drhCnls = null; drCnlNums = null; drmCnlNums = null; drhCnlNums = null; avgCnlInds = null; ctrlCnls = new SortedList<int, CtrlCnl>(); users = new SortedList<string, User>(); formulas = new List<string>(); curSrez = null; curSrezMod = false; srezDescr = null; minAvgData = null; hrAvgData = null; activeDTs = null; curSrezAdapter = null; curSrezCopyAdapter = null; eventAdapter = null; eventCopyAdapter = null; minSrezTableCache = null; hrSrezTableCache = null; modules = new List<ModLogic>(); }
/// <summary> /// Отобразить форму модально /// </summary> public static void ShowDialog(AppDirs appDirs) { if (appDirs == null) throw new ArgumentNullException("appDirs"); FrmPhonebook frmPhonebook = new FrmPhonebook(); frmPhonebook.appDirs = appDirs; frmPhonebook.ShowDialog(); }
private AppDirs appDirs; // директории приложения /// <summary> /// Конструктор /// </summary> public ModView() { appDirs = new AppDirs(); ServerComm = null; CanShowProps = false; }
/// <summary> /// Отобразить форму модально /// </summary> public static void ShowDialog(AppDirs appDirs, ServerComm serverComm) { FrmDBExportConfig frmDBExportConfig = new FrmDBExportConfig(); frmDBExportConfig.appDirs = appDirs; frmDBExportConfig.serverComm = serverComm; frmDBExportConfig.ShowDialog(); }
private Log.WriteLineDelegate writeToLog; // метод записи в журнал линии связи #endregion Fields #region Constructors /// <summary> /// Конструктор /// </summary> public KPLogic(int number) { // private fields conn = null; appDirs = new AppDirs(); writeToLog = text => { }; // заглушка terminated = false; caption = ""; sessText = ""; sendCmdText = ""; tagTable = null; tagTableColLen = null; // protected fields curData = new SrezTableLight.CnlData[0]; curDataModified = new bool[0]; arcSrezList = new List<TagSrez>(); eventList = new List<KPEvent>(); lastArcSrezList = new List<TagSrez>(); lastEventList = new List<KPEvent>(); lastCmdList = new List<Command>(); lastCommSucc = false; kpStats.Reset(); // public properties Bind = false; Number = number; Name = ""; Dll = Assembly.GetCallingAssembly().GetName().Name; Address = 0; CallNum = ""; ReqParams = KPReqParams.Default; ReqTriesCnt = 1; SerialPort = null; CustomParams = null; CommonProps = null; CommLineSvc = null; CanSendCmd = false; ConnRequired = true; KPTags = new KPTag[0]; TagGroups = new TagGroup[0]; WorkState = WorkStates.Undefined; LastSessDT = DateTime.MinValue; LastCmdDT = DateTime.MinValue; }
private Thread startThread; // поток повторения попыток запуска #endregion Fields #region Constructors /// <summary> /// Конструктор /// </summary> public Manager() { kpTypes = new Dictionary<string, Type>(); commLines = new List<CommLine>(); commandReader = null; infoThread = null; infoFileName = ""; startThread = null; startDT = DateTime.MinValue; linesStarted = false; lineCaptions = null; lineCmdLock = new object(); AppDirs = new AppDirs(); Settings = new Settings(); ServerComm = null; AppLog = new Log(Log.Formats.Full) { Encoding = Encoding.UTF8 }; AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; }
private bool fullLoad2; // загружать 2-й журнал полностью /// <summary> /// Конструктор /// </summary> public FrmMain() { Application.EnableVisualStyles(); InitializeComponent(); // установка формата времени опроса КП timeKpTime.CustomFormat = Localization.Culture.DateTimeFormat.LongTimePattern; // установка имён столбцов списков для перевода формы colParamName.Name = "colParamName"; colParamValue.Name = "colParamValue"; colKpOrder.Name = "colKpOrder"; colKpActive.Name = "colKpActive"; colKpBind.Name = "colKpBind"; colKpNumber.Name = "colKpNumber"; colKpName.Name = "colKpName"; colKpDll.Name = "colKpDll"; colKpAddress.Name = "colKpAddress"; colCallNum.Name = "colCallNum"; colKpTimeout.Name = "colKpTimeout"; colKpDelay.Name = "colKpDelay"; colKpTime.Name = "colKpTime"; colKpPeriod.Name = "colKpPeriod"; colKpCmdLine.Name = "colKpCmdLine"; // инициализация полей appDirs = new AppDirs(); errLog = new Log(Log.Formats.Simple); errLog.Encoding = Encoding.UTF8; mutex = null; icoStart = Icon.FromHandle((ilMain.Images["star_on.ico"] as Bitmap).GetHicon()); icoStop = Icon.FromHandle((ilMain.Images["star_off.ico"] as Bitmap).GetHicon()); svcContr = null; prevSvcStatus = ServiceControllerStatus.Stopped; nodeCommonParams = treeView.Nodes["nodeCommonParams"]; nodeKpDlls = treeView.Nodes["nodeKpDlls"]; nodeLines = treeView.Nodes["nodeLines"]; nodeStats = treeView.Nodes["nodeStats"]; origSettings = new Settings(); modSettings = null; lastNode = null; lastLine = null; lastParam = null; lastParamItem = null; lastKP = null; lastKpItem = null; copiedKP = null; changing = false; serverComm = null; baseTablesReceived = false; tblCommLine = new DataTable(); tblKP = new DataTable(); tblKPType = new DataTable(); kpDllInfoList = new SortedList<string, KpDllInfo>(); commCnlParamsBuf = new Dictionary<string, SortedList<string, string>>(); lbLog1 = null; lbLog2 = null; logFileName1 = ""; logFileName2 = ""; logFileAge1 = DateTime.MinValue; logFileAge2 = DateTime.MinValue; fullLoad1 = false; fullLoad2 = false; Application.ThreadException += Application_ThreadException; }
private ModView lastModView; // пользовательский интерфейс последнего выбранного модуля /// <summary> /// Конструктор /// </summary> public FrmMain() { InitializeComponent(); // установка формата дат и времени элементов управления dtpSrezDate.CustomFormat = dtpEvDate1.CustomFormat = dtpEvDate2.CustomFormat = Localization.Culture.DateTimeFormat.ShortDatePattern; dtpSrezTime.CustomFormat = dtpEvTime.CustomFormat = Localization.Culture.DateTimeFormat.LongTimePattern; // инициализация полей appDirs = new AppDirs(); errLog = new Log(Log.Formats.Simple); errLog.Encoding = Encoding.UTF8; mutex = null; svcContr = null; prevSvcStatus = ServiceControllerStatus.Stopped; notifyIcons = new Icon[ilNotify.Images.Count]; for (int i = 0; i < notifyIcons.Length; i++) notifyIcons[i] = Icon.FromHandle(((Bitmap)ilNotify.Images[i]).GetHicon()); notifyIconIndex = 0; stateFileName = ""; logFileName = ""; stateFileAge = DateTime.MinValue; logFileAge = DateTime.MinValue; nodeCommonParams = treeView.Nodes["nodeCommonParams"]; nodeSaveParams = treeView.Nodes["nodeSaveParams"]; nodeDirectories = treeView.Nodes["nodeDirectories"]; nodeFiles = treeView.Nodes["nodeFiles"]; nodeBase = nodeFiles.Nodes["nodeBase"]; nodeCurSrez = nodeFiles.Nodes["nodeCurSrez"]; nodeMinSrez = nodeFiles.Nodes["nodeMinSrez"]; nodeHrSrez = nodeFiles.Nodes["nodeHrSrez"]; nodeEvents = nodeFiles.Nodes["nodeEvents"]; nodeModules = treeView.Nodes["nodeModules"]; nodeGenerator = treeView.Nodes["nodeGenerator"]; nodeStats = treeView.Nodes["nodeStats"]; lastNode = null; settings = new Settings(); commSettings = new CommSettings(); serverComm = null; changing = false; modViewDict = new Dictionary<string, ModView>(); lastModView = null; Application.ThreadException += Application_ThreadException; }
/// <summary> /// Отобразить форму модально, открыв заданный файл /// </summary> public static void ShowDialog(AppDirs appDirs, bool saveOnly, ref string fileName) { if (appDirs == null) throw new ArgumentNullException("appDirs"); FrmDevTemplate frmDevTemplate = new FrmDevTemplate(); frmDevTemplate.appDirs = appDirs; frmDevTemplate.initialFileName = fileName; frmDevTemplate.saveOnly = saveOnly; frmDevTemplate.ShowDialog(); fileName = frmDevTemplate.fileName; }