Exemple #1
0
 public static SmartDeviceConfig MergeWith(this SmartDeviceConfig first, SmartDeviceConfig second)
 {
     return(new SmartDeviceConfig
     {
         DeviceGroups = MergeLists(first.DeviceGroups, second.DeviceGroups, x => x.GroupName),
         Users = MergeLists(first.Users, second.Users, x => x.Username),
         TabConfig = MergeLists(first.TabConfig, second.TabConfig, x => x.Key),
         Uis = MergeLists(first.Uis, second.Uis, x => x.Id),
         Actions = MergeLists(first.Actions, second.Actions, x => x.Id),
         ValueDefinitions = MergeLists(first.ValueDefinitions, second.ValueDefinitions, x => x.Name),
         AppInfo = second.AppInfo ?? first.AppInfo,
     });
 }
Exemple #2
0
        static void Main(string[] args)
        {
            Logger.Debug($"{nameof(Main)} called with {string.Join(" ", args)}.");

            var config = new SmartDeviceConfig();

            config = config.MergeWith(new DefaultConfig().GenerateConfig());
//            config = config.MergeWith(new Uc1ToolBreakage().GenerateConfig());
//            config = config.MergeWith(new Uc2MachineSetUp().GenerateConfig());
            config = config.MergeWith(new Uc5LiveData().GenerateConfig());
            config = config.MergeWith(new Uc6ValueMonitoring().GenerateConfig());

            Logger.Info($"Config generated.");
            Logger.Info($"Writing config files...");

            Write(new UserConfig
            {
                Users = config.Users
            }, "UserConfig");

            Write(new SmartDevicesGateway.Model.Config.SDConfig.SmartDeviceConfig
            {
                DeviceGroups = config.DeviceGroups
            }, "SmartDeviceConfig");

            Write(new UiConfig
            {
                ActionDefinitions = config.Actions.Select(x => new UiAction(x)),
                Uis              = config.Uis,
                TabDefinitions   = config.TabConfig,
                ValueDefinitions = config.ValueDefinitions,

                Info = config.AppInfo
            }, "UiConfig");

            Logger.Info("All files written.");
            Logger.Info("Press any key to exit.");
            Console.ReadLine();
        }
Exemple #3
0
 public abstract SmartDeviceConfig GenerateConfig(SmartDeviceConfig conf);