Inheritance: ICloneable
 public AcquisitorPlugin PluginForString(Profile p, String pluginType)
 {
     AcquisitorPlugin plugin = null;
     switch(pluginType)
     {
         case "out":
             plugin = p.AcquisitorConfig.outputPlugin;
             break;
         case "pg":
             plugin = p.AcquisitorConfig.pgPlugin;
             break;
         case "switch":
             plugin = p.AcquisitorConfig.switchPlugin;
             break;
         case "shot":
             plugin = p.AcquisitorConfig.shotGathererPlugin;
             break;
         case "analog":
             plugin = p.AcquisitorConfig.analogPlugin;
             break;
         case "yag":
             plugin = p.AcquisitorConfig.yagPlugin;
             break;
     }
     return plugin;
 }
Beispiel #2
0
        // When a new setting is introduced into a plugin, there needs to be a way to introduce it into existing
        // profile sets. This is the code that does it.
        // For each profile, p, a dummy profile, d, is created whose plugins are the same as those of p.
        // Because d is constructed anew, all plugin settings will have their default values and any newly
        // introduced settings will be present in d. Any settings that are in d, but not in p, are then copied over
        // into p. This is done for all the profiles in the set.
        public void UpdateProfiles()
        {
            Type pluginType;
            System.Reflection.ConstructorInfo info;

            Profile tempProfile = new Profile();

            foreach (Profile prof in profiles)
            {
                // analog input plugin
                pluginType = (Type)prof.AcquisitorConfig.analogPlugin.GetType();
                info = pluginType.GetConstructor(new Type[] { });
                tempProfile.AcquisitorConfig.analogPlugin = (AnalogInputPlugin)info.Invoke(new object[] { });
                updateSettings(prof.AcquisitorConfig.analogPlugin.Settings, tempProfile.AcquisitorConfig.analogPlugin.Settings);

                // scan output plugin
                pluginType = (Type)prof.AcquisitorConfig.outputPlugin.GetType();
                info = pluginType.GetConstructor(new Type[] { });
                tempProfile.AcquisitorConfig.outputPlugin = (ScanOutputPlugin)info.Invoke(new object[] { });
                updateSettings(prof.AcquisitorConfig.outputPlugin.Settings, tempProfile.AcquisitorConfig.outputPlugin.Settings);

                // pattern plugin
                pluginType = (Type)prof.AcquisitorConfig.pgPlugin.GetType();
                info = pluginType.GetConstructor(new Type[] { });
                tempProfile.AcquisitorConfig.pgPlugin = (PatternPlugin)info.Invoke(new object[] { });
                updateSettings(prof.AcquisitorConfig.pgPlugin.Settings, tempProfile.AcquisitorConfig.pgPlugin.Settings);

                // shot gatherer plugin
                pluginType = (Type)prof.AcquisitorConfig.shotGathererPlugin.GetType();
                info = pluginType.GetConstructor(new Type[] { });
                tempProfile.AcquisitorConfig.shotGathererPlugin = (ShotGathererPlugin)info.Invoke(new object[] { });
                updateSettings(prof.AcquisitorConfig.shotGathererPlugin.Settings, tempProfile.AcquisitorConfig.shotGathererPlugin.Settings);

                // switch plugin
                pluginType = (Type)prof.AcquisitorConfig.switchPlugin.GetType();
                info = pluginType.GetConstructor(new Type[] { });
                tempProfile.AcquisitorConfig.switchPlugin = (SwitchOutputPlugin)info.Invoke(new object[] { });
                updateSettings(prof.AcquisitorConfig.switchPlugin.Settings, tempProfile.AcquisitorConfig.switchPlugin.Settings);

                // yag plugin
                pluginType = (Type)prof.AcquisitorConfig.yagPlugin.GetType();
                info = pluginType.GetConstructor(new Type[] { });
                tempProfile.AcquisitorConfig.yagPlugin = (YAGPlugin)info.Invoke(new object[] { });
                updateSettings(prof.AcquisitorConfig.yagPlugin.Settings, tempProfile.AcquisitorConfig.yagPlugin.Settings);
            }
        }
Beispiel #3
0
 public void LoadProfileSetFromXml(FileStream stream)
 {
     // load the settings; xml format
     XmlSerializer s = new XmlSerializer(typeof(ProfileSet));
     ProfileSet ps = (ProfileSet)s.Deserialize(stream);
     profiles = ps.Profiles;
     currentProfile = null;
     // Xml serialization cannot handle circular referencing, so each of the plugins need to be
     // assigned their AquisitorConfigurations 'by hand'.
     foreach(Profile p in profiles)
     {
         p.AcquisitorConfig.outputPlugin.Config = p.AcquisitorConfig;
         p.AcquisitorConfig.switchPlugin.Config = p.AcquisitorConfig;
         p.AcquisitorConfig.shotGathererPlugin.Config = p.AcquisitorConfig;
         p.AcquisitorConfig.pgPlugin.Config = p.AcquisitorConfig;
         p.AcquisitorConfig.yagPlugin.Config = p.AcquisitorConfig;
         p.AcquisitorConfig.analogPlugin.Config = p.AcquisitorConfig;
     }
     window.UpdateUI();
 }
Beispiel #4
0
        public void SelectProfile(int index)
        {
            // no changing profiles while the thing is running - just too confusing !
            if (Controller.GetController().appState == Controller.AppState.running) return;

            currentProfile = (Profile)profiles[index];
            window.WriteLine("Profile changed");
            if (processor.groupEditMode)
            {
                window.WriteLine("Group changed to " + currentProfile.Group);
                window.Prompt = currentProfile.Group + ":>";
            }
            window.UpdateUI();
        }
Beispiel #5
0
 public void LoadProfileSetFromSoap(FileStream stream)
 {
     // load the settings; soap format
     SoapFormatter s = new SoapFormatter();
     profiles = (ArrayList)s.Deserialize(stream);
     currentProfile = null;
     window.UpdateUI();
 }