示例#1
0
        private CoreLogic coreLogic; // the Agent logic instance


        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public Manager()
        {
            log       = LogStub.Instance;
            coreLogic = null;
            AppDirs   = new AppDirs();
            AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
        }
示例#2
0
        /// <summary>
        /// Конструктор
        /// </summary>
        public AgentLogic(SessionManager sessionManager, AppDirs appDirs, ILog log)
        {
            this.sessionManager = sessionManager ?? throw new ArgumentNullException("sessionManager");
            this.appDirs        = appDirs ?? throw new ArgumentNullException("appDirs");
            this.log            = log ?? throw new ArgumentNullException("log");

            thread       = null;
            terminated   = false;
            infoFileName = appDirs.LogDir + AppData.InfoFileName;
            utcStartDT   = startDT = DateTime.MinValue;
            workState    = WorkState.Undefined;
        }
示例#3
0
        /// <summary>
        /// Constructor restricting the creation of an object from other classes
        /// </summary>
        private AppData()
        {
            tempFileNameCntr = 0;

            AppDirs  = new AppDirs();
            Settings = new Settings();
            Log      = new Log(Log.Formats.Full)
            {
                Encoding = Encoding.UTF8
            };
            SessionManager  = new SessionManager(Log);
            InstanceManager = new InstanceManager(Settings, Log);
        }
示例#4
0
        private readonly ReaderWriterLockSlim configLock; // synchronizes access to the instance configuration


        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public ScadaInstance(AppDirs appDirs, ILog log, InstanceOptions instanceOptions, InstanceConfig instanceConfig)
        {
            if (appDirs == null)
            {
                throw new ArgumentNullException(nameof(appDirs));
            }

            this.log             = log ?? throw new ArgumentNullException(nameof(log));
            this.instanceOptions = instanceOptions ?? throw new ArgumentNullException(nameof(instanceOptions));
            this.instanceConfig  = instanceConfig ?? throw new ArgumentNullException(nameof(instanceConfig));
            configLock           = new ReaderWriterLockSlim();
            PathBuilder          = new PathBuilder(instanceOptions.Directory, instanceConfig.LogDir, appDirs.ExeDir);
        }
示例#5
0
        private Dictionary <string, ScadaInstance> instances; // the instances accessed by name


        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public CoreLogic(AgentConfig appConfig, AppDirs appDirs, ILog log)
        {
            this.appConfig = appConfig ?? throw new ArgumentNullException(nameof(appConfig));
            infoFileName   = Path.Combine(appDirs.LogDir, EngineUtils.InfoFileName);

            AppDirs = appDirs ?? throw new ArgumentNullException(nameof(appDirs));
            Log     = log ?? throw new ArgumentNullException(nameof(log));

            thread         = null;
            terminated     = false;
            utcStartDT     = DateTime.MinValue;
            startDT        = DateTime.MinValue;
            serviceStatus  = ServiceStatus.Undefined;
            lastInfoLength = 0;

            listener  = null;
            instances = null;
        }
示例#6
0
 /// <summary>
 /// Initialize general agent data
 /// </summary>
 public void Init(string exeDir)
 {
     AppDirs.Init(exeDir);
     Log.FileName = AppDirs.LogDir + LogFileName;
 }