public PLCTwinController()
        {
            var adapter = new Vortex.Connector.ConnectorAdapter(typeof(DummyConnectorFactory));

            this.Connector = adapter.GetConnector(new object[] {});
            _MAIN          = new MAIN(this.Connector, "", "MAIN");
        }
Example #2
0
 public RoomControllerTwinController(Vortex.Connector.ConnectorAdapter adapter)
 {
     this.Connector       = adapter.GetConnector(adapter.Parameters);
     _IO                  = new IO(this.Connector, "", "IO");
     _Hardware_Simulation = new Hardware_Simulation(this.Connector, "", "Hardware_Simulation");
     _MAIN                = new MAIN(this.Connector, "", "MAIN");
 }
Example #3
0
        public RoomControllerTwinController()
        {
            var adapter = new Vortex.Connector.ConnectorAdapter(typeof(DummyConnectorFactory));

            this.Connector       = adapter.GetConnector(new object[] {});
            _IO                  = new IO(this.Connector, "", "IO");
            _Hardware_Simulation = new Hardware_Simulation(this.Connector, "", "Hardware_Simulation");
            _MAIN                = new MAIN(this.Connector, "", "MAIN");
        }
 public HansPlcTwinController(Vortex.Connector.ConnectorAdapter adapter)
 {
     this.Connector      = adapter.GetConnector(adapter.Parameters);
     _Utils              = new Utils(this.Connector, "", "Utils");
     _prgAddedProperties = new prgAddedProperties(this.Connector, "", "prgAddedProperties");
     _MAIN               = new MAIN(this.Connector, "", "MAIN");
     _prgSimple          = new prgSimple(this.Connector, "", "prgSimple");
     _prgWeatherStations = new prgWeatherStations(this.Connector, "", "prgWeatherStations");
 }
Example #5
0
        public IEnumerable <string> Export(Expression <Func <T, bool> > expression, char separator = ';')
        {
            var onliner = typeof(T).Name.Replace("Plain", string.Empty);

            var adapter        = new Vortex.Connector.ConnectorAdapter(typeof(DummyConnectorFactory));
            var dummyConnector = adapter.GetConnector(new object[] { });

            var onlinerType = Assembly.GetAssembly(typeof(T)).GetTypes().FirstOrDefault(p => p.Name == onliner);
            var prototype   = Activator.CreateInstance(onlinerType, new object[] { dummyConnector, string.Empty, string.Empty }) as IVortexObject;
            var exportables = this.Repository.Queryable.Where(expression);
            var itemExport  = new StringBuilder();
            var export      = new List <string>();

            // Create header
            var valueTags = prototype.RetrieveValueTags();

            foreach (var valueTag in valueTags)
            {
                itemExport.Append($"{valueTag.Symbol}{separator}");
            }

            export.Add(itemExport.ToString());
            itemExport.AppendLine();

            itemExport.Clear();
            foreach (var valueTag in valueTags)
            {
                itemExport.Append($"{valueTag.HumanReadable}{separator}");
            }

            export.Add(itemExport.ToString());
            itemExport.AppendLine();


            foreach (var document in exportables)
            {
                itemExport.Clear();
                ((dynamic)prototype).CopyPlainToShadow(document);
                var values = prototype.RetrieveValueTags();
                foreach (var @value in values)
                {
                    var val = (string)(((dynamic)@value).Shadow.ToString());
                    if (val.Contains(separator))
                    {
                        val = val.Replace(separator, '►');
                    }

                    itemExport.Append($"{val}{separator}");
                }

                export.Add(itemExport.ToString());
            }

            return(export);
        }
        public HansPlcTwinController()
        {
            var adapter = new Vortex.Connector.ConnectorAdapter(typeof(DummyConnectorFactory));

            this.Connector      = adapter.GetConnector(new object[] {});
            _Utils              = new Utils(this.Connector, "", "Utils");
            _prgAddedProperties = new prgAddedProperties(this.Connector, "", "prgAddedProperties");
            _MAIN               = new MAIN(this.Connector, "", "MAIN");
            _prgSimple          = new prgSimple(this.Connector, "", "prgSimple");
            _prgWeatherStations = new prgWeatherStations(this.Connector, "", "prgWeatherStations");
        }
Example #7
0
        public void Import(IEnumerable <string> records, IVortexObject crudDataObject = null, char separator = ';')
        {
            var documents = records.ToArray();
            var header    = documents[0];

            var headerItems = header.Split(separator);
            var dictionary  = new List <ImportItems>();

            // Prepare swappable object
            var onliner = typeof(T).Name.Replace("Plain", string.Empty);

            var adapter        = new Vortex.Connector.ConnectorAdapter(typeof(DummyConnectorFactory));
            var dummyConnector = adapter.GetConnector(new object[] { });

            var onlinerType = Assembly.GetAssembly(typeof(T)).GetTypes().FirstOrDefault(p => p.Name == onliner);

            IVortexObject prototype;

            if (crudDataObject == null)
            {
                prototype = Activator.CreateInstance(onlinerType, new object[] { dummyConnector, string.Empty, string.Empty }) as IVortexObject;
            }
            else
            {
                prototype = crudDataObject;
            }

            var valueTags = prototype.RetrieveValueTags();

            // Get headered dictionary
            foreach (var headerItem in headerItems)
            {
                dictionary.Add(new ImportItems()
                {
                    Key = headerItem
                });
            }


            // Load values
            for (int i = 2; i < documents.Count(); i++)
            {
                var documentItems = documents[i].Split(separator);
                for (int a = 0; a < documentItems.Count(); a++)
                {
                    dictionary[a].Value = documentItems[a];
                }

                UpdateDocument(dictionary, valueTags, prototype);
            }
        }
Example #8
0
 public MainPlcTwinController(Vortex.Connector.ConnectorAdapter adapter)
 {
     this.Connector = adapter.GetConnector(adapter.Parameters);
     _IO            = new IO(this.Connector, "", "IO");
     _MAIN          = new MAIN(this.Connector, "", "MAIN");
 }
 public PLCTwinController(Vortex.Connector.ConnectorAdapter adapter)
 {
     this.Connector = adapter.GetConnector(adapter.Parameters);
     _MAIN          = new MAIN(this.Connector, "", "MAIN");
 }
Example #10
0
 public PlcTwinController(Vortex.Connector.ConnectorAdapter adapter, object[] parameters)
 {
     this.Connector = adapter.GetConnector(parameters);
     _MAIN          = new MAIN(this.Connector, "", "MAIN");
 }