public LightFixture(uint id, string name, LightGroup master)
 {
     _id   = id;
     _name = name;
     if (master != null)
     {
         _master = master;
         _master.AddLight(this);
         _master.IntensityChanged += new EventHandler <ReadOnlyEventArgs <ushort> >(masterIntensityChanged);
         _master.MuteChanged      += new EventHandler <ReadOnlyEventArgs <bool> >(masterMuteChanged);
     }
 }
Esempio n. 2
0
        public static string[] List(LightGroup lightGroup)
        {
            string[] files   = Directory.GetFiles(PresetsDirectoryName, lightGroup.Name + "-*.json");
            string[] presets = new string[files.Length];

            for (int i = 0; i < files.Length; i++)
            {
                presets[i] = Path.GetFileNameWithoutExtension(files[i]).Substring(lightGroup.Name.Length + 1);
            }

            return(presets);
        }
Esempio n. 3
0
        public static void Delete(string name, LightGroup lightGroup)
        {
            string presetFilePath = PresetFilePath(name, lightGroup);

            try
            {
                File.Delete(presetFilePath);
            }
            catch (Exception e)
            {
                CrestronConsole.PrintLine("Failed to delete the preset file `{0}` - Reason: {1}", presetFilePath, e.Message);
            }
            finally { }
        }
Esempio n. 4
0
        public static void Save(string name, LightGroup lightGroup)
        {
            string presetFilePath = PresetFilePath(name, lightGroup);

            try
            {
                using (StreamWriter writer = new StreamWriter(presetFilePath))
                {
                    writer.WriteLine(lightGroup.SavePreset());
                }
            }
            catch (Exception e)
            {
                CrestronConsole.PrintLine("Failed to write the preset file `{0}` - Reason = {1}", presetFilePath, e.Message);
            }
            finally { }
        }
Esempio n. 5
0
        public static void Load(string name, LightGroup lightGroup)
        {
            string presetFilePath = PresetFilePath(name, lightGroup);
            string presetData     = String.Empty;

            try
            {
                using (StreamReader reader = new StreamReader(presetFilePath))
                {
                    presetData = reader.ReadToEnd();
                }

                if (String.IsNullOrEmpty(presetData) != true)
                {
                    lightGroup.ApplyPreset(presetData);
                }
            }
            catch (Exception e)
            {
                CrestronConsole.PrintLine("Failed to read the preset file `{0}` - Reason: {1}", presetFilePath, e.Message);
            }
            finally { }
        }
 public DMXPTZFixture(LightGroup group, DMXFixtureConfig config, BasicTriList transport)
     : base(group, config, transport)
 {
 }
 public DMXFixture(LightGroup group, DMXFixtureConfig config, BasicTriList transport) : base(config.Id, config.Name, group)
 {
     _config    = config.Clone() as DMXFixtureConfig;
     _transport = transport;
 }
Esempio n. 8
0
 public static bool PresetFileExists(string presetName, LightGroup lightGroup)
 {
     return(File.Exists(PresetFilePath(presetName, lightGroup)));
 }
Esempio n. 9
0
 public static string PresetFilePath(string presetName, LightGroup lightGroup)
 {
     return(String.Format("{0}\\{1}-{2}.json", PresetsDirectoryName, lightGroup.Name, presetName));
 }