コード例 #1
0
ファイル: VixenPlusFileIO.cs プロジェクト: jmcadams/vplus
        public override void SaveProfile(Profile profile)
        {
            var profileXml = Xml.CreateXmlDocument("Profile");

            BaseSaveProfile(profileXml, profile, FormatChannel);
            Group.SaveToXml(profileXml.DocumentElement, profile.Groups);

            profileXml.Save(profile.FileName);
            profile.IsDirty = false;
        }
コード例 #2
0
ファイル: Vixen25FileIO.cs プロジェクト: jmcadams/vplus
        public override void SaveProfile(Profile profile)
        {
            var profileXml = Xml.CreateXmlDocument("Profile");

            BaseSaveProfile(profileXml, profile, FormatChannel);
            var profileNode = Xml.GetNodeAlways(profileXml, "Profile");
            BaseSaveSortOrders(profileNode, profile);
            BaseSaveNativeData(profile.FileName, profile.Groups);

            profileXml.Save(profile.FileName);
            profile.IsDirty = false;
        }
コード例 #3
0
ファイル: SequenceProgram.cs プロジェクト: jmcadams/vplus
 public SequenceProgram(EventSequence sequence)
 {
     _profile = null;
     UseSequencePluginData = false;
     TreatAsLocal = false;
     _key = Host.GetUniqueKey();
     _mask = null;
     FileName = sequence.FileName;
     ConstructUsing();
     SetupData = sequence.PlugInData;
     EventSequences.Add(new EventSequenceStub(sequence));
 }
コード例 #4
0
ファイル: VixenFileIOBase.cs プロジェクト: jmcadams/vplus
        protected static Profile BaseOpenProfile(string fileName, IFileIOHandler ioHandler)
        {
            var p = new Profile {FileIOHandler = ioHandler};

            var document = new XmlDocument();
            document.Load(fileName);
            XmlNode documentElement = document.DocumentElement;
            p.FileName = fileName;
            p.ClearChannels();
            if (documentElement != null) {
                var channelObjectsNode = documentElement.SelectNodes("ChannelObjects/*");
                if (channelObjectsNode != null) {
                    foreach (XmlNode channelObject in channelObjectsNode) {
                        p.AddChannelObject(new Channel(channelObject), false);
                    }
                }

                var outputNodes = documentElement.SelectSingleNode("Outputs");
                if (outputNodes != null) {
                    foreach (var outputChannel in outputNodes.InnerText.Split(',').Where(outputChannel => outputChannel.Length > 0)) {
                        p.AddChannelOutput(Convert.ToInt32(outputChannel));
                    }
                }
            }
            p.PlugInData.LoadFromXml(documentElement);
            p.Groups = Group.LoadFromXml(documentElement) ?? new Dictionary<string, GroupData>();
            p.IsDirty = Group.LoadFromFile(documentElement, p.Groups);
            if (documentElement != null) {
                var disabledChannelsNode = documentElement.SelectSingleNode("DisabledChannels");
                if (disabledChannelsNode != null) {
                    foreach (
                        var disabledChannel in disabledChannelsNode.InnerText.Split(',').Where(disabledChannel => disabledChannel != string.Empty)) {
                        p.Channels[Convert.ToInt32(disabledChannel)].Enabled = false;
                    }
                }
            }

            p.Freeze();

            return p;
        }
コード例 #5
0
ファイル: EventSequence.cs プロジェクト: jmcadams/vplus
 public EventSequence()
 {
     _fullChannels = new List<Channel>();
     Channels = new List<Channel>();
     PlugInData = new SetupData();
     Extensions = new SequenceExtensions();
     EventValues = null;
     _eventPeriod = 100;
     MinimumLevel = 0;
     MaximumLevel = 255;
     Audio = null;
     TotalEventPeriods = 0;
     WindowWidth = 0;
     WindowHeight = 0;
     ChannelWidth = 0;
     EngineType = EngineType.Standard;
     _profile = null;
     TreatAsLocal = false;
     AudioDeviceIndex = -1;
     AudioDeviceVolume = 0;
     Key = Host.GetUniqueKey();
 }
コード例 #6
0
ファイル: VixenFileIOBase.cs プロジェクト: jmcadams/vplus
 public abstract void SaveProfile(Profile profile);
コード例 #7
0
ファイル: VixenFileIOBase.cs プロジェクト: jmcadams/vplus
        protected static void BaseSaveSortOrders(XmlNode profileNode, Profile profile)
        {
            var sortOrders = Xml.GetEmptyNodeAlways(profileNode, "SortOrders");
            Xml.SetAttribute(sortOrders, "lastSort", "-1"); // always default to none since we don't track this anywhere.

            var ownerDoc = profileNode.OwnerDocument;

            if (ownerDoc == null) {
                throw new ArgumentNullException("profileNode", "Somehow your profile node is a lost child!  Sorry I have to exit.");
            }

            foreach (var g in profile.Groups.Where(g => g.Value.IsSortOrder)) {
                var groupValue = g.Value;

                var cso = ownerDoc.CreateElement("SortOrder");
                var originalName = groupValue.Name.Replace(" (Sort Order)", "").Trim();
                Xml.SetAttribute(cso, "name", originalName);
                cso.InnerText = groupValue.GroupChannels;

                sortOrders.AppendChild(cso);
            }
        }
コード例 #8
0
ファイル: VixenFileIOBase.cs プロジェクト: jmcadams/vplus
        protected static void BaseSaveProfile(XmlDocument doc, Profile profileObject, FormatChannelDelegate fc)
        {
            profileObject.Freeze(); // fix VIX-53
            XmlNode profileDoc = doc.DocumentElement;

            var channelObjectsNode = Xml.GetEmptyNodeAlways(profileDoc, "ChannelObjects");
            foreach (var channel in profileObject.Channels) {
                channelObjectsNode.AppendChild(fc(doc, channel));
            }

            var outputs = string.Join(",", (from c in profileObject.Channels select c.OutputChannel.ToString()).ToArray());
            Xml.GetEmptyNodeAlways(profileDoc, "Outputs").InnerText = outputs;

            if (profileDoc != null) {
                profileDoc.AppendChild(doc.ImportNode(profileObject.PlugInData.RootNode, true));
            }

            var disabledChannels = string.Join(",",
                (from c in profileObject.Channels where !c.Enabled select profileObject.Channels.FindIndex(i => i == c).ToString()).ToArray());
            Xml.SetValue(profileDoc, "DisabledChannels", disabledChannels);
        }
コード例 #9
0
ファイル: EventSequence.cs プロジェクト: jmcadams/vplus
 private void DetachFromProfile()
 {
     FileIOHandler.LoadEmbeddedData(FileName, this);
     _fullChannels.Clear();
     _fullChannels.AddRange(_profile.FullChannels);
     _profile = null;
     UpdateEventValueArray();
 }
コード例 #10
0
ファイル: EventSequence.cs プロジェクト: jmcadams/vplus
 public void ReloadProfile()
 {
     if (_profile == null) {
         return;
     }
     _profile = FileIOHandler.OpenProfile(_profile.FileName);
     LoadFromProfile();
 }
コード例 #11
0
ファイル: EventSequence.cs プロジェクト: jmcadams/vplus
 public void AttachToProfile(Profile profile)
 {
     _profile = profile;
     _profile.Freeze();
     LoadFromProfile();
 }
コード例 #12
0
ファイル: FPPfseq.cs プロジェクト: jmcadams/vplus
 public void SaveProfile(Profile profile)
 {
     throw new NotSupportedException("Format does not support profiles.");
 }
コード例 #13
0
ファイル: Engine8.cs プロジェクト: jmcadams/vplus
 private void Initialize(Profile profile)
 {
     if (Mode == EngineMode.Synchronous) {
         throw new Exception("Only an asynchronous engine instance can be initialized with a profile.");
     }
     profile.Freeze();
     InitializeForAsynchronous(profile);
 }
コード例 #14
0
ファイル: StandardSequence.cs プロジェクト: jmcadams/vplus
 private void SetProfile(Profile profile)
 {
     _sequence.Profile = profile;
     _sequence.Groups = profile.Groups;
     UpdateGroups();
     ReactToProfileAssignment();
     IsDirty = true;
 }
コード例 #15
0
ファイル: StandardSequence.cs プロジェクト: jmcadams/vplus
        private Profile GetContextProfile(string fileName = null)
        {
            var context = new Profile();
            if (null != fileName) {
                context.FileName = fileName;
            }
            context.InheritChannelsFrom(_sequence);
            context.InheritPlugInDataFrom(_sequence);
            context.Groups = _sequence.Groups;
            context.FileIOHandler = _sequence.FileIOHandler;

            return context;
        }