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; }
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; }
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)); }
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; }
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(); }
public abstract void SaveProfile(Profile profile);
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); } }
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); }
private void DetachFromProfile() { FileIOHandler.LoadEmbeddedData(FileName, this); _fullChannels.Clear(); _fullChannels.AddRange(_profile.FullChannels); _profile = null; UpdateEventValueArray(); }
public void ReloadProfile() { if (_profile == null) { return; } _profile = FileIOHandler.OpenProfile(_profile.FileName); LoadFromProfile(); }
public void AttachToProfile(Profile profile) { _profile = profile; _profile.Freeze(); LoadFromProfile(); }
public void SaveProfile(Profile profile) { throw new NotSupportedException("Format does not support profiles."); }
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); }
private void SetProfile(Profile profile) { _sequence.Profile = profile; _sequence.Groups = profile.Groups; UpdateGroups(); ReactToProfileAssignment(); IsDirty = true; }
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; }