private AzureHubConfiguration GetConfiguration(ISerializer serializer, ILogger _logger)
        {
            var configHandler = new ConfigurationJsonFileHandler(@".\azure_communication_agent.json", serializer, _logger);

            if (configHandler.IsConfigFileExisting())
            {
                return(configHandler.Load <AzureHubConfiguration>());
            }
            var config = AzureHubConfiguration.PstConfig(serializer);

            configHandler.Backup(config);
            return(config);
        }
        public static M2MgoCloudAgentConfiguration GetConfiguration(ISerializer serializer, ILogger _logger)
        {
            var configHandler = new ConfigurationJsonFileHandler(@".\m2mgo_communication_agnet.json", serializer, _logger);

            if (configHandler.IsConfigFileExisting())
            {
                return(configHandler.Load <M2MgoCloudAgentConfiguration>());
            }
            var config = M2MgoCloudAgentConfiguration.PstConfig();

            configHandler.Backup(config);
            return(config);
        }
        private static UicConfiguartion GetConfiguration(ISerializer serializer)
        {
            var configHandler = new ConfigurationJsonFileHandler(@".\uic_config.json", serializer, _logger);
            UicConfiguartion config;

            if (configHandler.IsConfigFileExisting())
            {
                config = configHandler.Load <SGeTUicConfiguartion>();
            }
            else
            {
                config = new PstUicConfiguartion();
                configHandler.Backup(config);
            }
            return(config);
        }
Exemple #4
0
        private AzureProjectAgentConfiguration GetConfiguration(ISerializer serializer)
        {
            var configHandler = new ConfigurationJsonFileHandler(@".\azure_project_agent.json", serializer, _logger);
            AzureProjectAgentConfiguration config;

            if (configHandler.IsConfigFileExisting())
            {
                config = configHandler.Load <AzureProjectAgentConfiguration>();
            }
            else
            {
                config = new AzureProjectAgentConfiguration();
                configHandler.Backup(config);
            }
            return(config);
        }
Exemple #5
0
        private UicProject LoadUicProject()
        {
            UicProject project;
            var        serializedProjectFilepath = _uicConfiguartion.ProjectJsonFilePath;
            var        jsonFileHandler           = new ConfigurationJsonFileHandler(serializedProjectFilepath, _serializer, _logger);

            if (_uicConfiguartion.IsRemoteProjectLoadingEnabled)
            {
                project = _projectAgent.LoadProject(_uicConfiguartion);
                jsonFileHandler.Backup(project);
            }
            else
            {
                /*'using (StreamReader r = new StreamReader("file.json"))
                 * {
                 *  string json = r.ReadToEnd();
                 *  List<Item> items = JsonConvert.DeserializeObject<List<Item>>(json);
                 * }*/


                if (jsonFileHandler.IsConfigFileExisting())
                {
                    project = jsonFileHandler.Load <ProjectConfigImpl>();
                    Console.WriteLine("[HAW DEBUG] Name:" + project.Name);
                    Console.WriteLine("[HAW DEBUG] Project Key:" + project.ProjectKey);
                    Console.WriteLine("[HAW DEBUG] Description:" + project.Description);
                    Console.WriteLine("[HAW DEBUG] Owner:" + project.Owner);
                    Console.WriteLine("[HAW DEBUG] Attributes:" + project.Attributes);
                    Console.WriteLine("[HAW DEBUG] DataPointsTaks:" + project.DatapointTasks);
                    Console.WriteLine("local config was loaded successfully");
                }
                else
                {
                    Console.WriteLine("[ERROR CRITICAL] Configfile is missing: " + serializedProjectFilepath);
                    project = null;
                }
            }

            if (project == null)
            {
                throw new ApplicationException("no project could be loaded");
            }
            return(project);
        }
Exemple #6
0
        private M2mgoProjectAgentConfiguration GetConfiguration(ISerializer serializer)
        {
            var configHandler = new ConfigurationJsonFileHandler(@".\m2mgo_project_agent.json", serializer, _logger);
            M2mgoProjectAgentConfiguration config;

            if (configHandler.IsConfigFileExisting())
            {
                config = configHandler.Load <M2mgoProjectAgentConfiguration>();
            }
            else
            {
                config = new M2mgoProjectAgentConfiguration
                {
                    RemoteProjectConfigurationUrl = "https://pst.m2mgo.com/api/sget/project/board/",
                    EdmSnychronizationUrl         = "https://pst.m2mgo.com/api/sget/embedded-modules/synch/"
                };
                configHandler.Backup(config);
            }
            return(config);
        }
        private UicProject LoadUicProject()
        {
            UicProject project;
            var        serializedProjectFilepath = _uicConfiguartion.ProjectJsonFilePath;
            var        jsonFileHandler           = new ConfigurationJsonFileHandler(serializedProjectFilepath, _serializer, _logger);

            if (_uicConfiguartion.IsRemoteProjectLoadingEnabled)
            {
                project = _projectAgent.LoadProject(_uicConfiguartion);
                jsonFileHandler.Backup(project);
            }
            else
            {
                project = jsonFileHandler.Load <SgetUicProject>();
            }

            if (project == null)
            {
                throw new ApplicationException("no project could be loaded");
            }
            return(project);
        }