static public void DisplayNode(ProfileNode node, int indent = 0, bool displayValues = true, bool recurse = true) { String itxt = ""; for (int i = 0; i < indent; i++) { itxt += "\t"; } string path = sys.NodePath(node.ProfileNodeId); Console.WriteLine($"{itxt}[{path}]: {node.Description}"); if (displayValues) { foreach (var attr in sys.SubValues(node.ProfileNodeId)) { Console.WriteLine($"{itxt}\t{attr.Key}: {attr.Value}"); } } if (recurse) { foreach (ProfileNode subnode in sys.Nodes(node.ProfileNodeId)) { DisplayNode(subnode, indent + 1, displayValues); } } }
public static IProfileSymbol CreateEntry( ISymbol containingSymbol, ProfileNode item, DiagnosticBag diagnostics) { return(new ProfileSymbol(containingSymbol, item, diagnostics)); }
public void ProfileNodeCompare() { string msg; debug.WriteLine("ProfileNodeCompare:"); ProfileNode p1 = new ProfileNode("ptest ") { ParentProfileNodeId = 13 }; ProfileNode p2 = new ProfileNode("PTest") { ParentProfileNodeId = p1.ParentProfileNodeId }; msg = $"[TEST Keys Compare]: '{p1?.Name}' == '{p2?.Name}'"; debug.WriteLine(msg); Assert.IsTrue(p1.Equals(p2), msg); p2.ParentProfileNodeId++; msg = $"[TEST Keys Compare (Parent different)]: '{p1?.Name}' != '{p2?.Name}'"; debug.WriteLine(msg); Assert.IsTrue(!p1.Equals(p2), msg); p2.ParentProfileNodeId--; p2.Name = "not same "; msg = $"[TEST Keys Compare (Parent different)]: '{p1?.Name}' != '{p2?.Name}'"; debug.WriteLine(msg); Assert.IsTrue(!p1.Equals(p2), msg); }
public IProfile this[string profilepath] { get { ProfilePath path = ProfilePath.RootPath.ResolvePath(profilepath); ProfileNode node = new ProfileNode(this, path); return(node.IsRoot ? (IProfile)node : (IProfile) new VirtualNode(node)); } }
public IProfile this[string profilepath] { get { ProfilePath path = ProfilePath.RootPath.ResolvePath(profilepath); ProfileNode node = new ProfileNode(this, path); return node.IsRoot ? (IProfile) node : (IProfile) new VirtualNode(node); } }
private void DisposeList(ProfileNode node) { while (node != null) { var next = node.Next; node.Value.Dispose( ); node = next; } }
private ProfileSymbol?GetProfileSymbol(ProfileNode node, Binder outerBinder) { if (containingSymbol is ProfileSymbol profileSymbol && profileSymbol.Declaration == node) { return(profileSymbol); } var container = GetContainerEntry(outerBinder, node); return(container?.Resources.OfType <ProfileSymbol>().FirstOrDefault(x => x.Declaration == node)); }
public void ListDriverTypes() { Console.WriteLine($"TEST: {nameof(ListDriverTypes)}"); //RaciRepository repo = new RaciRepository(); SystemHelper sys = new SystemHelper(); ProfileNode ascom = sys.Ascom; List <string> driverNames = sys.AscomDrivers?.Select(t => t.Name).ToList(); Assert.IsTrue((driverNames?.Count ?? 0) > 0, "No drivers found"); Assert.IsTrue(driverNames.Any(t => t == "Telescope Drivers"), "Telescope driver not found"); foreach (var drv in driverNames.OrderBy(t => t)) { Console.WriteLine($"\t{drv}"); } }
public Catalogue(BattleScribeXml.Catalogue xml) : base(xml) { _gameSystemLink = new IdLink <IGameSystem>( XmlBackend.GameSystemGuid, newGuid => { XmlBackend.GameSystemGuid = newGuid; }, () => XmlBackend.GameSystemId); _entries = new RootEntryNode(() => XmlBackend.Entries, this) { Controller = XmlBackend.Controller }; _entryLinks = new RootLinkNode(() => XmlBackend.Links.EntryLinks, this) { Controller = XmlBackend.Controller }; _ruleLinks = new RuleLinkNode(() => XmlBackend.Links.RuleLinks, this) { Controller = XmlBackend.Controller }; _rules = new RuleNode(() => XmlBackend.Rules, this) { Controller = XmlBackend.Controller }; _sharedEntries = new EntryNode(() => XmlBackend.SharedEntries, this) { Controller = XmlBackend.Controller }; _sharedGroups = new GroupNode(() => XmlBackend.SharedEntryGroups, this) { Controller = XmlBackend.Controller }; _sharedProfiles = new ProfileNode(() => XmlBackend.SharedProfiles, this) { Controller = XmlBackend.Controller }; _sharedRules = new RuleNode(() => XmlBackend.SharedRules, this) { Controller = XmlBackend.Controller }; }
void DisplayProfileDataNode(ProfileNode node) { var key = node.key; if (key == null) { if (node == _profilerResultRootNode) { key = "TOTAL"; } else { key = "?"; } } var nodeText = key + ": " + node.ownReport; if (node.hasChildren) { node.openInUI = EditorGUILayout.Foldout(node.openInUI, nodeText); if (node.openInUI) { EditorGUI.indentLevel++; foreach (var childNode in node.descendingOrderedNodes) { DisplayProfileDataNode(childNode.Value); } EditorGUI.indentLevel--; } } else { EditorGUILayout.LabelField(nodeText); } }
public void ListDevices() { string[] drvTypes = new string[] { "Telescope", "Camera" }; Console.WriteLine($"TEST: {nameof(ListDevices)}"); //RaciRepository repo = new RaciRepository(); SystemHelper sys = new SystemHelper(); foreach (string drv in sys.AscomDrivers.Select(t => t.Name.Replace(" Drivers", ""))) { Console.WriteLine($"Driver: {drv}"); ProfileNode driverNode = sys.AscomDriver(drv); Assert.IsNotNull(driverNode, $"Driver '{drv}' is not registered"); List <AscomDeviceNode> devices = sys.AscomDevices(drv).ToList(); Assert.IsNotNull(devices, $"Driver '{drv}' returned no devices"); Assert.IsTrue(devices.Count > 0, $"Driver '{drv}' returned no devices"); foreach (string devName in devices.Select(t => t.Name)) { Console.WriteLine($"\t{devName}"); } Console.WriteLine(); } }
protected ProfileNode(XmlProfileStore store, ProfileNode parent, string child) : base(parent, child) { _store = store; }
public static InfoLinkNode InfoLink(ProfileNode profile, string id = null) { return(InfoLink(profile, InfoLinkKind.Profile, id)); }
public IList <MirasysDeviceDetails> getCamDeviceList() { string strResponce = ""; InsertLog.AddLog("MirasysInterface getCamDeviceList() Start:"); List <MirasysDeviceDetails> MirasysDeviceDetailsList = new List <MirasysDeviceDetails>(); try { ProfileNode _aProfileNode = session.ProfileService.CurrentProfile; var _SiteNode = (SiteNode)_aProfileNode; if (_SiteNode != null) { var _Count = _SiteNode.Children.Count(); if (_Count > 0) { var _CamerasNodelist = _SiteNode.Children.Where(X => X.Name == "Cameras" || X.Name.Contains("Recorder"));// NodeType.Camera || X.NodeType == NodeType.PtzCamera);//"Cameras" foreach (var _CamerasNoderecval in _CamerasNodelist) { var _CamerasNoderec = (SiteNode)_CamerasNoderecval; foreach (var _CamerasNodelocval in _CamerasNoderec.Children) { //var _CamerasNodeloc = (SiteNode)_CamerasNodelocval; // foreach (var _CamerasNode in _CamerasNodeloc.Children) //{ InsertLog.AddLog("MirasysInterface getCamDeviceList() Location name: " + _CamerasNodelocval.Name); var _SiteNodeCameras = (SiteNode)_CamerasNodelocval; if (_SiteNodeCameras.Children.Count() == 0) { } else { var streamingService = _connection.SessionContext.StreamingService; var playbackGroup = streamingService.CreatePlaybackStreamingGroup(); var RealtimeGroup = session.StreamingService.CreateRealtimeStreamingGroup(); foreach (var _DeviceNode in _SiteNodeCameras.Children) { try { CameraNode aCamera = _DeviceNode as CameraNode; if (aCamera.State != DeviceStatus.NotConfigured) { MirasysDeviceDetails _MirasysDeviceDetails = new MirasysDeviceDetails(); string strCmName = ""; string strCamGuid = ""; string strCamType = "";//1- camera 2- PTZ Camera string strCamChannelNumber = ""; string strCamIp = ""; string strCamUserName = ""; string strCamPass = ""; string strCamPortNum = ""; string strCamWidth = ""; string strCamHeight = ""; // InsertLog.AddLog("MirasysInterface getCamDeviceList() Camera name: " + aCamera.Name); strCmName = aCamera.Name; strCamGuid = aCamera.ProfileId; strCamType = aCamera.NodeType.ToString(); //1- camera 2- PTZ Camera strCamChannelNumber = ""; strCamIp = ""; strCamUserName = ""; strCamPass = ""; strCamPortNum = ""; strCamWidth = ""; strCamHeight = ""; if (strCmName != "" && _MirasysDeviceDetails != null) { _MirasysDeviceDetails.CameraName = strCmName; } if (strCamGuid != "" && strCamGuid != null) { _MirasysDeviceDetails.CameraGuid = strCamGuid; } if (strCamType != "" && strCamType != null) { _MirasysDeviceDetails.CameraType = strCamType; } MirasysDeviceDetailsList.Add(_MirasysDeviceDetails); // } } catch (Exception ex) { InsertLog.AddLog("MirasysInterface getCamDeviceList() Exception:" + ex.ToString()); } } } // } } } // } } // } catch (Exception ex) { InsertLog.AddLog("MirasysInterface getCamDeviceList() Exception Final:" + ex.ToString()); } return(MirasysDeviceDetailsList); }
public void CameraStateChangeEventListen() { try { ProfileNode _aProfileNode = session.ProfileService.CurrentProfile; var _SiteNode = (SiteNode)_aProfileNode; if (_SiteNode != null) { var _Count = _SiteNode.Children.Count(); if (_Count > 0) { var _CamerasNodelist = _SiteNode.Children.Where(X => X.Name == "Cameras" || X.Name.Contains("Recorder"));// NodeType.Camera || X.NodeType == NodeType.PtzCamera);//"Cameras" foreach (var _CamerasNoderecval in _CamerasNodelist) { var _CamerasNoderec = (SiteNode)_CamerasNoderecval; foreach (var _CamerasNodelocval in _CamerasNoderec.Children) { //var _CamerasNodeloc = (SiteNode)_CamerasNodelocval; // foreach (var _CamerasNode in _CamerasNodeloc.Children) //{ InsertLog.AddLog("MirasysInterface getCamDeviceList() Location name: " + _CamerasNodelocval.Name); var _SiteNodeCameras = (SiteNode)_CamerasNodelocval; if (_SiteNodeCameras.Children.Count() == 0) { } else { var streamingService = _connection.SessionContext.StreamingService; var playbackGroup = streamingService.CreatePlaybackStreamingGroup(); var RealtimeGroup = session.StreamingService.CreateRealtimeStreamingGroup(); foreach (var _DeviceNode in _SiteNodeCameras.Children) { try { CameraNode aCamera = _DeviceNode as CameraNode; aCamera.StateChanged += aCamera_StateChanged; } catch (Exception ex) { InsertLog.AddLog("MirasysInterface getCamDeviceList() Exception:" + ex.ToString()); } } } // } } } //var _CamerasNodelist = _SiteNode.Children.Where(X => X.Name == "Cameras" || X.Name.Contains("Recorder"));// NodeType.Camera || X.NodeType == NodeType.PtzCamera);//"Cameras" //foreach (var _CamerasNoderecval in _CamerasNodelist) //{ // var _CamerasNoderec = (SiteNode)_CamerasNoderecval; // foreach (var _CamerasNodelocval in _CamerasNoderec.Children) // { // //at office // try // { // CameraNode aCamera = _CamerasNodelocval as CameraNode; // aCamera.StateChanged += aCamera_StateChanged; // } // catch (Exception ex) // { // InsertLog.AddLog("MirasysInterface getCamDeviceList() Exception:" + ex.ToString()); // } // } //} // } } // } catch (Exception ex) { } }
internal IProfileTypeSymbol BindProfileTypeSymbol(ProfileNode node, DiagnosticBag diagnostics) => BindSimple <IProfileTypeSymbol, ErrorSymbols.ErrorProfileTypeSymbol>( node, diagnostics, node.TypeId, LookupOptions.ProfileTypeOnly);
public virtual Boolean Initialize(XmlDocument Map) { try { m_Remapping = false; m_Mapper.Clear(); XmlNode Node = Map.SelectSingleNode("/ScpMapper"); m_Description = Node.SelectSingleNode("Description").FirstChild.Value; m_Version = Node.SelectSingleNode("Version").FirstChild.Value; m_Active = Node.SelectSingleNode("Active").FirstChild.Value; foreach (XmlNode ProfileNode in Node.SelectNodes("Mapping/Profile")) { String Name = ProfileNode.SelectSingleNode("Name").FirstChild.Value; String Type = ProfileNode.SelectSingleNode("Type").FirstChild.Value; String Qualifier = String.Empty; try { XmlNode QualifierNode = ProfileNode.SelectSingleNode("Value"); if (QualifierNode.HasChildNodes) { Qualifier = QualifierNode.FirstChild.Value; } } catch { } Profile Profile = new Profile(Name == m_Active, Name, Type, Qualifier); try { foreach (XmlNode Mapping in ProfileNode.SelectSingleNode("DS3/Button")) { foreach (XmlNode Item in Mapping.ChildNodes) { Ds3Button Target = (Ds3Button)Enum.Parse(typeof(Ds3Button), Item.ParentNode.Name); Ds3Button Mapped = (Ds3Button)Enum.Parse(typeof(Ds3Button), Item.Value); Profile.Ds3Button[Target] = Mapped; } } } catch { } try { foreach (XmlNode Mapping in ProfileNode.SelectSingleNode("DS3/Axis")) { foreach (XmlNode Item in Mapping.ChildNodes) { Ds3Axis Target = (Ds3Axis)Enum.Parse(typeof(Ds3Axis), Item.ParentNode.Name); Ds3Axis Mapped = (Ds3Axis)Enum.Parse(typeof(Ds3Axis), Item.Value); Profile.Ds3Axis[Target] = Mapped; } } } catch { } try { foreach (XmlNode Mapping in ProfileNode.SelectSingleNode("DS4/Button")) { foreach (XmlNode Item in Mapping.ChildNodes) { Ds4Button Target = (Ds4Button)Enum.Parse(typeof(Ds4Button), Item.ParentNode.Name); Ds4Button Mapped = (Ds4Button)Enum.Parse(typeof(Ds4Button), Item.Value); Profile.Ds4Button[Target] = Mapped; } } } catch { } try { foreach (XmlNode Mapping in ProfileNode.SelectSingleNode("DS4/Axis")) { foreach (XmlNode Item in Mapping.ChildNodes) { Ds4Axis Target = (Ds4Axis)Enum.Parse(typeof(Ds4Axis), Item.ParentNode.Name); Ds4Axis Mapped = (Ds4Axis)Enum.Parse(typeof(Ds4Axis), Item.Value); Profile.Ds4Axis[Target] = Mapped; } } } catch { } m_Mapper[Profile.Name] = Profile; } Int32 Mappings = m_Mapper[m_Active].Ds3Button.Count + m_Mapper[m_Active].Ds3Axis.Count + m_Mapper[m_Active].Ds4Button.Count + m_Mapper[m_Active].Ds4Axis.Count; LogDebug(String.Format("## Mapper.Initialize() - Profiles [{0}] Active [{1}] Mappings [{2}]", m_Mapper.Count, m_Active, Mappings)); m_Remapping = true; } catch { } return(m_Remapping); }
public virtual bool Initialize(XmlDocument Map) { try { m_Remapping = false; m_Mapper.Clear(); var Node = Map.SelectSingleNode("/ScpMapper"); m_Description = Node.SelectSingleNode("Description").FirstChild.Value; m_Version = Node.SelectSingleNode("Version").FirstChild.Value; m_Active = Node.SelectSingleNode("Active").FirstChild.Value; foreach (XmlNode ProfileNode in Node.SelectNodes("Mapping/Profile")) { var Name = ProfileNode.SelectSingleNode("Name").FirstChild.Value; var Type = ProfileNode.SelectSingleNode("Type").FirstChild.Value; var Qualifier = string.Empty; var QualifierNode = ProfileNode.SelectSingleNode("Value"); if (QualifierNode.HasChildNodes) { Qualifier = QualifierNode.FirstChild.Value; } var Profile = new Profile(Name == m_Active, Name, Type, Qualifier); foreach (XmlNode Mapping in ProfileNode.SelectSingleNode("DS3/Button")) { foreach (XmlNode Item in Mapping.ChildNodes) { var Target = (Ds3Button)Enum.Parse(typeof(Ds3Button), Item.ParentNode.Name); var Mapped = (Ds3Button)Enum.Parse(typeof(Ds3Button), Item.Value); Profile.Ds3Button[Target] = Mapped; } } foreach (XmlNode Mapping in ProfileNode.SelectSingleNode("DS3/Axis")) { foreach (XmlNode Item in Mapping.ChildNodes) { var Target = (Ds3Axis)Enum.Parse(typeof(Ds3Axis), Item.ParentNode.Name); var Mapped = (Ds3Axis)Enum.Parse(typeof(Ds3Axis), Item.Value); Profile.Ds3Axis[Target] = Mapped; } } foreach (XmlNode Mapping in ProfileNode.SelectSingleNode("DS4/Button")) { foreach (XmlNode Item in Mapping.ChildNodes) { var Target = (Ds4Button)Enum.Parse(typeof(Ds4Button), Item.ParentNode.Name); var Mapped = (Ds4Button)Enum.Parse(typeof(Ds4Button), Item.Value); Profile.Ds4Button[Target] = Mapped; } } foreach (XmlNode Mapping in ProfileNode.SelectSingleNode("DS4/Axis")) { foreach (XmlNode Item in Mapping.ChildNodes) { var Target = (Ds4Axis)Enum.Parse(typeof(Ds4Axis), Item.ParentNode.Name); var Mapped = (Ds4Axis)Enum.Parse(typeof(Ds4Axis), Item.Value); Profile.Ds4Axis[Target] = Mapped; } } m_Mapper[Profile.Name] = Profile; } var Mappings = m_Mapper[m_Active].Ds3Button.Count + m_Mapper[m_Active].Ds3Axis.Count + m_Mapper[m_Active].Ds4Button.Count + m_Mapper[m_Active].Ds4Axis.Count; Log.DebugFormat("## Mapper.Initialize() - Profiles [{0}] Active [{1}] Mappings [{2}]", m_Mapper.Count, m_Active, Mappings); m_Remapping = true; } catch (Exception ex) { Log.ErrorFormat("Error in XML Initialize: {0}", ex); } return(m_Remapping); }