Exemple #1
0
        public Action(Configuration config, ISerial serial, ActionType type, String user = "", String outputfile = "")
        {
            // outputfile = new FileInfo ( outputfile ).Name; // NO
            // System.IO.Path.GetFileName(outputfile)); // NO

            configuration = config;
            logger        = new Logger(config, outputfile.Substring(outputfile.LastIndexOf('\\') + 1));
            comm          = new MTUComm(serial, config);
            this.type     = type;
            this.user     = user;
            comm.OnError += Comm_OnError;
        }
Exemple #2
0
        public Action(Configuration config, ISerial serial, ActionType type, String user = "", String outputfile = "")
        {
            // outputfile = new FileInfo ( outputfile ).Name; // NO
            // System.IO.Path.GetFileName(outputfile)); // NO

            configuration = config;
            logger        = new Logger(outputfile.Substring(outputfile.LastIndexOf('\\') + 1));
            comm          = new MTUComm(serial, config);
            this.type     = type;
            this.user     = user;
            comm.OnError += Comm_OnError;

            this.config = Singleton.Get.Configuration;

            // Only save reference for the current action,
            // not for nested or auxiliary actions ( as BasicRead )
            if (this.type != ActionType.BasicRead &&
                !Singleton.Has <Action> ())
            {
                Singleton.Set = this;
            }
        }