/// <summary> /// This method returns the Publisher or Subscriber instances used by this Agent. /// </summary> /// <param name="agentType">Indicates whether Publisher or Subscriber instances are returned.</param> /// <returns>Collection of Publishers or Subscribers.</returns> protected internal IList <T> GetInstances <T>(AgentType agentType) where T : IAgentSettings { IList <T> instances = new List <T>(); string instanceTypesString = Properties.GetProperty(agentType.ToString().ToLower() + ".types", ""); IList <IElementDef> instanceTypes = PropertyUtils.ParseElementDefinitions(instanceTypesString); foreach (IElementDef instanceType in instanceTypes) { string instanceString = Properties.GetProperty(agentType.ToString().ToLower() + "." + instanceType.Name + ".implementation", null); if (!String.IsNullOrEmpty(instanceString)) { string assemblyName = PropertyUtils.ParseAssemblyName(instanceString); string className = PropertyUtils.ParseClassName(instanceString); try { if (!String.IsNullOrEmpty(className)) { Assembly assembly = null; if (String.IsNullOrEmpty(assemblyName)) { assembly = Assembly.GetEntryAssembly(); } else { assembly = Assembly.LoadFrom(assemblyName); } if (assembly != null) { // Create an instance of the Publisher or Subscriber. Type type = assembly.GetType(className); T instance = (T)Activator.CreateInstance(type); instance.AgentConfiguration = AgentConfiguration; instances.Add(instance); } } } catch (Exception e) { if (log.IsErrorEnabled) { log.Error("Unable to create an instance of " + agentType.ToString() + " " + className + ".", e); } } } } if (instances.Count == 0) { if (log.IsInfoEnabled) { log.Info("No " + agentType.ToString() + "s have been specified for Agent " + this.Id + "."); } } return(instances); }
/// <summary> /// Get array of performance properties. /// </summary> /// <returns></returns> public object[] GetItemArray() { return(new object[] { AgentType.ToString(), CounterName, ItemsCount, RequestCount, EnqueueCount, DequeueCount, DequeueCountPerHour, DequeueCountPerDay, DequeueCountPerMonth, SyncCount, StartTime, LastRequestTime, LastDequeueTime, LastSyncTime, MaxHitPerMinute, AvgHitPerMinute, //AvgDequeueTime, AvgSyncTime, MaxSize, MemoSize, FreeSize, GetMemoryUsage() }); }
private void updateParameters(AgentType agentType, string agentName, int frame) { if (string.IsNullOrEmpty(agentName)) { return; } string typeName = (agentType == null) ? agentName : agentType.ToString(); string agentFullname = (agentType == null) ? agentName : agentType.ToString() + "#" + agentName; List <AgentDataPool.ValueMark> values = AgentDataPool.GetValidValues(agentType, agentFullname, frame); foreach (AgentDataPool.ValueMark value in values) { ParametersDock.SetProperty(typeName, agentName, value.Name, value.Value); } }
public BindingSource GetList(AgentType anAgentType) { AgentDataHelper DH = new AgentDataHelper(); BindingSource BS = new BindingSource(); Hashtable HT = new Hashtable(); List <Agent> myList = DH.SelectAll(); if (myList != null) { foreach (var item in myList) { if (item.State == EntityState.Enabled) { if (item.AgentType == anAgentType) { HT.Add(item.ID, item.Name); } } } } HT.Add(-1, "Select " + anAgentType.ToString()); BS.DataSource = HT; return(BS); }
protected override void InternalBuild() { var agentComponents = AgentComponents.GetAgentComponents(AgentType, Configuration, Platform, RepoRootDirectory, HomeRootDirectory); agentComponents.ValidateComponents(); agentComponents.CopyComponents(StagingDirectory); var agentInfo = new AgentInfo { InstallType = $"ZipWin{Platform}{AgentType.ToString()}" }; agentInfo.WriteToDisk(StagingDirectory); var zipFilePath = AgentType == AgentType.Framework ? $@"{OutputDirectory}\newrelic-framework-agent_{agentComponents.Version}_{Platform}.zip" : $@"{OutputDirectory}\newrelic-netcore20-agent-win_{agentComponents.Version}_{Platform}.zip"; Directory.CreateDirectory(OutputDirectory); System.IO.Compression.ZipFile.CreateFromDirectory(StagingDirectory, zipFilePath); File.WriteAllText($@"{OutputDirectory}\checksum.sha256", FileHelpers.GetSha256Checksum(zipFilePath)); // For now, the DotNet-Core20-Agent-DeployToS3 job expects core agent artifacts to be in the following directory // At some point we should change the job to pull from the new location under the Build\BuildArtifacts directory if (AgentType == AgentType.Core) { FileHelpers.CopyFile(zipFilePath, $@"{RepoRootDirectory}\src\_build\CoreArtifacts"); } Console.WriteLine($"Successfully created artifact for {nameof(ZipArchive)}."); }
private void InspectObject(AgentType agentType, string agentName, string agentFullname) { Nodes.Node node = null; if (agentType == null && !string.IsNullOrEmpty(agentFullname)) { int frame = AgentDataPool.CurrentFrame > -1 ? AgentDataPool.CurrentFrame : 0; string behaviorFilename = FrameStatePool.GetBehaviorFilename(agentFullname, frame); List <string> highlightNodeIds = FrameStatePool.GetHighlightNodeIds(agentFullname, frame, behaviorFilename); List <string> updatedNodeIds = FrameStatePool.GetUpdatedNodeIds(agentFullname, frame, behaviorFilename); Dictionary <string, FrameStatePool.NodeProfileInfos.ProfileInfo> profileInfos = FrameStatePool.GetProfileInfos(frame, behaviorFilename); BehaviorNode behavior = UIUtilities.ShowBehaviorTree(agentFullname, frame, highlightNodeIds, updatedNodeIds, HighlightBreakPoint.Instance, profileInfos); node = behavior as Nodes.Node; } _agentType = agentType; _agentName = agentName; Hide(); setText(agentType, agentName); parametersPanel.InspectObject(agentType, agentFullname, node); if (AgentDataPool.CurrentFrame > -1 && !string.IsNullOrEmpty(agentName)) { List <AgentDataPool.ValueMark> valueSet = AgentDataPool.GetValidValues(node, agentType, agentFullname, AgentDataPool.CurrentFrame); foreach (AgentDataPool.ValueMark value in valueSet) { SetProperty(agentType != null ? agentType.ToString() : null, agentName, value.Name, value.Value); } } lostAnyFocus(); Show(); }
public AuthenticationResult Authenticate(string usernameOrEmailAddress, string password, AgentType agentType, int agentVersion) { AuthenticationRequest request = new AuthenticationRequest { Agent = new Agent { Name = agentType.ToString(), Version = agentVersion }, Username = usernameOrEmailAddress, Password = password, ClientToken = ClientToken.ToString(), RequestUser = true }; AuthenticationResult result = null; try { var resultStr = NetHandler.SendPostRequest(new Uri(AUTH_SERVER + "/authenticate"), UserAgent, "application/json", JsonSerializer.Serialize(request)); result = JsonSerializer.Deserialize <AuthenticationResult>(resultStr); } catch (WebException ex) { var response = new StreamReader((ex.Response as HttpWebResponse).GetResponseStream()).ReadToEnd(); Logger.Error($"{response}"); } return(result); }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == bulletColor.ToString()) { Destroy(collision.gameObject); Destroy(gameObject); } }
private void setText(AgentType agentType, string agentName) { // Par if (agentType == null) { Text = TabText = string.IsNullOrEmpty(agentName) ? Resources.Pars : string.Format(Resources.ParsOf, agentName); } // Global else if (Plugin.IsInstanceAgentType(agentType)) { Text = TabText = string.Format(Resources.PropertiesOf, agentType.ToString()); } // Agent else { Text = TabText = string.Format(Resources.PropertiesOf + "::{1}", agentType.ToString(), agentName); } }
private bool setProperty(string agentType, string agentName, string valueName, string valueStr) { if ((_agentType == null || _agentType.ToString() == agentType) && _agentName == agentName) { return(parametersPanel.SetProperty(valueName, valueStr)); } return(false); }
private void Start() { squareMaxSpeed = maxSpeed * maxSpeed; squareNeighborRadius = neighbornRadius * neighbornRadius; squareAvoidanceRadius = avoidanceRadiusMultiplayer * avoidanceRadiusMultiplayer * squareNeighborRadius; Vector2 offset = transform.position; for (int i = 0; i < amount; i++) { FlockAgent agent = Instantiate( prefab, (Random.insideUnitCircle * amount * agentDensity) + offset, Quaternion.Euler(new Vector3(0, 0, Random.Range(0, 360))), transform ); agent.name = "Agent" + i; agent.tag = agentColor.ToString(); agent.SetColor(agentColor); agents.Add(agent); } }
public void StartDriver() { WorkSpace.Instance.Telemetry.Add("startagent", new { AgentType = AgentType.ToString(), DriverType = DriverType.ToString() }); if (AgentType == eAgentType.Service) { StartPluginService(); GingerNodeProxy.StartDriver(); OnPropertyChanged(Fields.Status); } else { RepositoryItemHelper.RepositoryItemFactory.StartAgentDriver(this); } }
private void updateParameters(AgentType agentType, string agentName, int frame) { if (string.IsNullOrEmpty(agentName)) { return; } string typeName = (agentType == null) ? agentName : agentType.ToString(); string agentFullname = (agentType == null) ? agentName : agentType.ToString() + "#" + agentName; string behaviorFilename = FrameStatePool.GetBehaviorFilename(agentFullname, frame); BehaviorNode behavior = null; if (agentFullname == Plugin.DebugAgentInstance) { behavior = UIUtilities.ShowBehavior(behaviorFilename); } List <AgentDataPool.ValueMark> values = AgentDataPool.GetValidValues(agentType, agentFullname, frame); foreach (AgentDataPool.ValueMark value in values) { ParametersDock.SetProperty(behavior, typeName, agentName, value.Name, value.Value); } }
public string Register(CommunicationAgent communicationAgent, AgentType type) { Console.WriteLine("Register ", type.ToString()); String agentId = null; lock (agents) { switch (type) { case AgentType.Client: agentId = @"C" + last_client; last_client++; break; case AgentType.Seller: agentId = @"S" + last_seller; last_seller++; break; } agents[agentId] = communicationAgent; } return(agentId); }
public bool Proccess(UserSession session) { lock (_syncObj) { for (int i = 0; i < Capacity; i++) { if (_sessions[i] == null) { _sessions[i] = session; session.AgentInfo = _info ?? AgentType.ToString(); ProcessingSessionsCount++; return(true); } } } return(false); }
public override void InitializeAgent() { SetUnitAsDefualt(); var S = abObj.elements.Strings; foreach (var s in S) { if (s.CompareTag(agentType.ToString())) { _String.Add(s); } } AddJoint(); ChangeColor(); }
public static string ToString(AgentType agentType) { switch (agentType) { case AgentType.AGENT_TYPE_DESKTOP_ANALYTICS: return("Desktop Analytics"); case AgentType.AGENT_TYPE_SCREEN_AGENT: return("ScreenAgent"); case AgentType.AGENT_TYPE_VRA: return("VRA"); case AgentType.AGENT_TYPE_PO: return("PO Client"); default: return(agentType.ToString()); } }
///neighbor: Neighbor/cenlist public override void InitializeAgent() { _String.Clear(); Pos.Clear(); cenList.Clear(); eObj.SetAsDefualt(); //ResetTargetPosition(); var S = eObj.elements.Strings; foreach (var s in S) { if (s.CompareTag(agentType.ToString())) { _String.Add(s); } } SetPos(); ///unbaked SetCenter(); _neighborManager = GetComponentInParent <NeighborManager>(); var neigh = _neighborManager.GetNeighbor(); foreach (var n in neigh) { if (n.name != this.name) { Neighbor.Add(n); } } foreach (var n in Neighbor) { cenList.Add(n.center); } distanceRecord = prevDistance = Vector3.Distance(target.transform.position, center.transform.position); defColor = center.GetComponent <MeshRenderer>().material.color; }
public override string ToString() { // `new Uri ("/")` and `new Uri ("/a")` (but not `new Uri ("/aa")`) // throws UriFormatException on Mono, and Windows really does not // like it if you just prepend 'file://' to an absolute path... if (WorkbookPath != null) { var uri = new Uri(WorkbookPath, UriKind.RelativeOrAbsolute); if (uri.IsAbsoluteUri) { return(uri.ToString()); } // this should be okay for Mono for the '/' and '/a' cases... return("file://" + uri); } var builder = new StringBuilder(128 * (AssemblySearchPaths.Length + 2)); builder.Append(xamarinInteractiveScheme).Append("://"); // if Port is non-zero we will have explicitly // set both Port and Host in a constructor if (Port > 0) { builder.Append(Host).Append(':').Append(Port); } var qpCount = 0; void QP(string k, object v) => builder .Append(qpCount++ == 0 ? "/v1?" : "&") .Append(k) .Append('=') .Append(v); if (AgentType != AgentType.Unknown) { QP("agentType", AgentType.ToString()); } if (SessionKind != ClientSessionKind.Unknown) { QP("sessionKind", SessionKind.ToString()); } foreach (var path in AssemblySearchPaths) { if (!String.IsNullOrEmpty(path)) { QP("assemblySearchPath", Uri.EscapeDataString(path)); } } if (!String.IsNullOrEmpty(WorkingDirectory)) { QP("workingDirectory", Uri.EscapeDataString(WorkingDirectory)); } foreach (var parameter in Parameters) { if (!String.IsNullOrEmpty(parameter.Key)) { QP( Uri.EscapeDataString(parameter.Key), Uri.EscapeDataString(parameter.Value)); } } return(builder.ToString()); }
public static MethodDef parseMethodString(List <Nodes.Node.ErrorCheck> result, DefaultObject node, AgentType agentType, MethodType methodType, string str) { try { if (agentType != null) { int pos = str.IndexOf('('); if (pos < 0) { return(null); } string ownerName = agentType.ToString(); int pointIndex = str.IndexOf('.'); if (pointIndex > -1 && pointIndex < pos) { ownerName = str.Substring(0, pointIndex); if (ownerName != VariableDef.kSelf && !Plugin.IsInstanceName(ownerName)) { throw new Exception("The instance does not exist."); } str = str.Substring(pointIndex + 1, str.Length - pointIndex - 1); agentType = Plugin.GetInstanceAgentType(ownerName, agentType); //if (agentType == node.Behavior.AgentType) // ownerName = VariableDef.kSelf; pos = str.IndexOf('('); } IList <MethodDef> actions = agentType.GetMethods(methodType); string actionName = str.Substring(0, pos); foreach (MethodDef actionTypeIt in actions) { if (actionTypeIt.Name == actionName #if BEHAVIAC_NAMESPACE_FIX || actionTypeIt.Name.EndsWith(actionName) #endif ) { MethodDef method = new MethodDef(actionTypeIt); method.Owner = ownerName; List <string> paras = parseParams(str.Substring(pos + 1, str.Length - pos - 2)); //Debug.Check((paras.Count == actionTypeIt.Params.Count)); //if (paras.Count == actionTypeIt.Params.Count) { for (int i = 0; i < paras.Count; ++i) { if (i >= method.Params.Count) { break; } string param = paras[i]; MethodDef.Param par = method.Params[i]; bool bOk = parseParam(result, node, method, par, param); if (!bOk) { throw new Exception(string.Format(Resources.ExceptionDesignerAttributeIllegalFloatValue, str)); } } } return(method); } } } } catch (Exception) { //System.Windows.Forms.MessageBox.Show(str, Resources.LoadError, System.Windows.Forms.MessageBoxButtons.OK); if (result != null) { Nodes.Node n = node as Nodes.Node; string label = ""; if (n == null) { Attachments.Attachment a = node as Attachments.Attachment; if (a != null) { n = a.Node; label = a.Label; } } else { label = n.Label; } Nodes.Node.ErrorCheck error = new Nodes.Node.ErrorCheck(n, node.Id, label, Nodes.ErrorCheckLevel.Error, str); result.Add(error); } } return(null); }
protected VariableDef parsePropertyVar(NodeTag.DefaultObject node, string str) { Debug.Check(!str.StartsWith("const")); string[] tokens = str.Split(' '); if (tokens.Length < 2) { return(null); } string propertyType = string.Empty; string propertyName = string.Empty; if (tokens[0] == "static") { Debug.Check(tokens.Length == 3); //e.g. static int Property; propertyType = tokens[1]; propertyName = tokens[2]; } else { Debug.Check(tokens.Length == 2); //e.g. int Property; propertyType = tokens[0]; propertyName = tokens[1]; } VariableDef v = null; int pointIndex = propertyName.IndexOf('.'); if (pointIndex > -1) { string ownerName = propertyName.Substring(0, pointIndex); propertyName = propertyName.Substring(pointIndex + 1, propertyName.Length - pointIndex - 1); AgentType agentType = node.Behavior.AgentType; agentType = Plugin.GetInstanceAgentType(ownerName, agentType); string valueType = (agentType == node.Behavior.AgentType) ? VariableDef.kSelf : agentType.ToString(); v = setProperty(agentType, propertyName, valueType); } else { string className = Plugin.GetClassName(propertyName); // Assume it was World type. if (className != null) { v = setProperty(Plugin.GetInstanceAgentType(className), propertyName, className); if (v == null) { Nodes.Behavior behavior = node.Behavior as Nodes.Behavior; if (behavior != null) { // Assume it was Agent type. v = setProperty(behavior.AgentType, propertyName, VariableDef.kSelf); } } } } if (v == null) { // It should be Par type. v = setParameter(node, propertyType, propertyName); } return(v); }
public void SetAgentType(AgentType t) { AgentType = t.ToString(); }
public static MethodDef parseMethodString(List<Nodes.Node.ErrorCheck> result, DefaultObject node, AgentType agentType, MethodType methodType, string str) { try { if (agentType != null) { int pos = str.IndexOf('('); if (pos < 0) { return null; } string ownerName = agentType.ToString(); int pointIndex = str.IndexOf('.'); if (pointIndex > -1 && pointIndex < pos) { ownerName = str.Substring(0, pointIndex); Nodes.Behavior behavior = node.Behavior as Nodes.Behavior; if (ownerName != VariableDef.kSelf && !Plugin.IsInstanceName(ownerName, behavior)) { throw new Exception("The instance does not exist."); } str = str.Substring(pointIndex + 1, str.Length - pointIndex - 1); agentType = Plugin.GetInstanceAgentType(ownerName, behavior, agentType); //if (agentType == node.Behavior.AgentType) // ownerName = VariableDef.kSelf; pos = str.IndexOf('('); } IList<MethodDef> actions = agentType.GetMethods(methodType); string actionName = str.Substring(0, pos); foreach(MethodDef actionTypeIt in actions) { if (actionTypeIt.Name == actionName #if BEHAVIAC_NAMESPACE_FIX || actionTypeIt.Name.EndsWith(actionName) #endif ) { MethodDef method = new MethodDef(actionTypeIt); method.Owner = ownerName; List<string> paras = parseParams(str.Substring(pos + 1, str.Length - pos - 2)); //Debug.Check((paras.Count == actionTypeIt.Params.Count)); //if (paras.Count == actionTypeIt.Params.Count) { for (int i = 0; i < paras.Count; ++i) { if (i >= method.Params.Count) { break; } string param = paras[i]; MethodDef.Param par = method.Params[i]; bool bOk = parseParam(result, node, method, par, param); if (!bOk) { throw new Exception(string.Format(Resources.ExceptionDesignerAttributeIllegalFloatValue, str)); } } } return method; } } } } catch (Exception) { //System.Windows.Forms.MessageBox.Show(str, Resources.LoadError, System.Windows.Forms.MessageBoxButtons.OK); if (result != null) { Nodes.Node n = node as Nodes.Node; string label = ""; if (n == null) { Attachments.Attachment a = node as Attachments.Attachment; if (a != null) { n = a.Node; label = a.Label; } } else { label = n.Label; } Nodes.Node.ErrorCheck error = new Nodes.Node.ErrorCheck(n, node.Id, label, Nodes.ErrorCheckLevel.Error, str); result.Add(error); } } return null; }
public static MethodDef parseMethodString(NodeTag.DefaultObject node, AgentType agentType, MethodType methodType, string str) { try { if (agentType != null) { int pos = str.IndexOf('('); if (pos < 0) return null; string ownerName = agentType.ToString(); int pointIndex = str.IndexOf('.'); if (pointIndex > -1 && pointIndex < pos) { ownerName = str.Substring(0, pointIndex); str = str.Substring(pointIndex + 1, str.Length - pointIndex - 1); agentType = Plugin.GetInstanceAgentType(ownerName, agentType); if (agentType == node.Behavior.AgentType) ownerName = VariableDef.kSelf; pos = str.IndexOf('('); } IList<MethodDef> actions = agentType.GetMethods(methodType); string actionName = str.Substring(0, pos); foreach (MethodDef actionTypeIt in actions) { if (actionTypeIt.Name == actionName #if BEHAVIAC_NAMESPACE_FIX || actionTypeIt.Name.EndsWith(actionName) #endif ) { MethodDef method = new MethodDef(actionTypeIt); method.Owner = ownerName; List<string> paras = parseParams(str.Substring(pos + 1, str.Length - pos - 2)); //Debug.Check((paras.Count == actionTypeIt.Params.Count)); //if (paras.Count == actionTypeIt.Params.Count) { for (int i = 0; i < paras.Count; ++i) { string param = paras[i]; string[] tokens = null; if (param[0] == '\"') { param = param.Substring(1, param.Length - 2); } else if (param[0] == '{') { //struct //to set it as action.Method is used in the following parsing Nodes.Action action = node as Nodes.Action; if (action != null) { action.Method = method; } } else { tokens = param.Split(' '); } if (i < method.Params.Count) { MethodDef.Param par = method.Params[i]; if (tokens != null && tokens.Length > 1) { //par VariableDef var = setParameter(node, tokens[tokens.Length - 1]); if (var != null) par.Value = var; //else // throw new Exception(string.Format(Resources.ExceptionDesignerAttributeIllegalFloatValue, str)); } else { bool bOk = Plugin.InvokeTypeParser(par.Type, param, (object value) => par.Value = value, node, par.Name); if (!bOk) throw new Exception(string.Format(Resources.ExceptionDesignerAttributeIllegalFloatValue, str)); } } else { break; } } } return method; } } } } catch (Exception) { System.Windows.Forms.MessageBox.Show(str, Resources.LoadError, System.Windows.Forms.MessageBoxButtons.OK); } return null; }
//return true if breaked private bool update(int frame) { int _agenttype_index = 0; int _agentinstance_index = 0; ConsoleDock.SetMesssages(frame); if (Plugin.EditMode == EditModes.Connect) { if (Plugin.UpdateMode == UpdateModes.Continue) { SetTotalFrame(frame); AgentDataPool.CurrentFrame = AgentDataPool.TotalFrames; } updateUI(frame); } lock (_lockObject) { if (_agenttype_index != -1 && _agentinstance_index != -1) { //update could be entered multiple times for a 'frame' if there are multiple breakpoints in 'frame' if (_agenttype_index == 0 && _agentinstance_index == 0) { AgentDataPool.CurrentFrame = frame; // Global //foreach (Plugin.InstanceName_t agentType in Plugin.InstanceNames) //{ // updateParameters(agentType.agentType_, agentType.agentType_.AgentTypeName, frame); //} } this._break_prompt = ""; // Agent while (_agenttype_index < Plugin.AgentTypes.Count) { AgentType agentType = Plugin.AgentTypes[_agenttype_index]; if (!agentType.IsInherited) { List <string> instances = AgentInstancePool.GetInstances(agentType.ToString()); while (_agentinstance_index < instances.Count) { string instance = instances[_agentinstance_index]; _agentinstance_index++; // Parameters updateParameters(agentType, instance, frame); if (Plugin.EditMode == EditModes.Analyze) { string agentName = string.Format("{0}#{1}", agentType, instance); string behaviorFilename = FrameStatePool.GetBehaviorFilename(agentName, frame); if (_lastBreakFrame != frame) { _lastBreakPointIndex = 0; } // Breakpoint List <FrameStatePool.FrameState.Action> actions = FrameStatePool.GetActions(agentName, frame, behaviorFilename); HighlightBreakPoint.Instance = checkBreakpoint(behaviorFilename, actions, ref _lastBreakPointIndex); if (HighlightBreakPoint.Instance != null || agentName == Plugin.DebugAgentInstance) { // Highlights List <string> transitionIds = FrameStatePool.GetHighlightTransitionIds(agentName, frame, behaviorFilename); List <string> highlightNodeIds = FrameStatePool.GetHighlightNodeIds(agentName, frame, behaviorFilename); List <string> updatedNodeIds = FrameStatePool.GetUpdatedNodeIds(agentName, frame, behaviorFilename); Dictionary <string, FrameStatePool.NodeProfileInfos.ProfileInfo> profileInfos = FrameStatePool.GetProfileInfos(frame, behaviorFilename); updateHighlights(agentName, frame, transitionIds, highlightNodeIds, updatedNodeIds, HighlightBreakPoint.Instance, profileInfos); } // Return if there is breakpoint breaked. if (HighlightBreakPoint.Instance != null) { _lastBreakFrame = frame; return(true); } } } } _agenttype_index++; _agentinstance_index = 0; } _agenttype_index = -1; _agentinstance_index = -1; //after checking breakpoints, to check applog _log_index = 0; } } lock (_lockObject) { if (_log_index != -1) { if (Plugin.EditMode == EditModes.Analyze) { bool bCheckLog = (this.comboBoxLogFilter.Text != ""); if (bCheckLog) { if (Plugin.EditMode == EditModes.Analyze) { Debug.Check(true); } else if (MessageQueue.IsConnected) { Debug.Check(true); } else { bCheckLog = false; } } if (bCheckLog) { List <string> logs = FrameStatePool.GetAppLog(frame, this.comboBoxLogFilter.Text); if (logs != null && _log_index < logs.Count) { this._break_prompt = logs[_log_index++]; return(true); } } } _log_index = -1; } } return(false); }
public override string ToString() { return("AgentType: " + agentType.ToString()); }
public static MethodDef parseMethodString(NodeTag.DefaultObject node, AgentType agentType, MethodType methodType, string str) { try { if (agentType != null) { int pos = str.IndexOf('('); if (pos < 0) { return(null); } string ownerName = agentType.ToString(); int pointIndex = str.IndexOf('.'); if (pointIndex > -1 && pointIndex < pos) { ownerName = str.Substring(0, pointIndex); str = str.Substring(pointIndex + 1, str.Length - pointIndex - 1); agentType = Plugin.GetInstanceAgentType(ownerName, agentType); //if (agentType == node.Behavior.AgentType) // ownerName = VariableDef.kSelf; pos = str.IndexOf('('); } IList <MethodDef> actions = agentType.GetMethods(methodType); string actionName = str.Substring(0, pos); foreach (MethodDef actionTypeIt in actions) { if (actionTypeIt.Name == actionName #if BEHAVIAC_NAMESPACE_FIX || actionTypeIt.Name.EndsWith(actionName) #endif ) { MethodDef method = new MethodDef(actionTypeIt); method.Owner = ownerName; List <string> paras = parseParams(str.Substring(pos + 1, str.Length - pos - 2)); //Debug.Check((paras.Count == actionTypeIt.Params.Count)); //if (paras.Count == actionTypeIt.Params.Count) { for (int i = 0; i < paras.Count; ++i) { string param = paras[i]; string[] tokens = null; if (param[0] == '\"') { param = param.Substring(1, param.Length - 2); } else if (param[0] == '{') { //struct //to set it as action.Method is used in the following parsing Nodes.Action action = node as Nodes.Action; if (action != null) { action.Method = method; } } else { tokens = param.Split(' '); } if (i < method.Params.Count) { MethodDef.Param par = method.Params[i]; if (tokens != null && tokens.Length > 1) { //par VariableDef var = setParameter(node, tokens[tokens.Length - 1]); if (var != null) { par.Value = var; } //else // throw new Exception(string.Format(Resources.ExceptionDesignerAttributeIllegalFloatValue, str)); } else { bool bOk = Plugin.InvokeTypeParser(par.Type, param, (object value) => par.Value = value, node, par.Name); if (!bOk) { throw new Exception(string.Format(Resources.ExceptionDesignerAttributeIllegalFloatValue, str)); } } } else { break; } } } return(method); } } } } catch (Exception) { System.Windows.Forms.MessageBox.Show(str, Resources.LoadError, System.Windows.Forms.MessageBoxButtons.OK); } return(null); }
public override void Write(CustomFileWriter writer) { if (AgentType == JenkinsAgentType.None || AgentType == JenkinsAgentType.Any) { writer.WriteLine($"agent {AgentType.ToString().ToLowerInvariant()}"); } else { using (writer.WriteBlock($"agent")) { using (writer.WriteBlock($"{AgentType.ToString().ToLowerInvariant()}")) { if (!string.IsNullOrWhiteSpace(Label)) { writer.WriteLine($"label '{Label}'"); } if (!string.IsNullOrWhiteSpace(CustomWorkspace)) { writer.WriteLine($"customWorkspace '{CustomWorkspace}'"); } if (AgentType == JenkinsAgentType.Docker) { if (!string.IsNullOrWhiteSpace(DockerImage)) { writer.WriteLine($"image '{DockerImage}'"); } if (!string.IsNullOrWhiteSpace(DockerArgs)) { writer.WriteLine($"args '{DockerArgs}'"); } if (!string.IsNullOrWhiteSpace(DockerRegistryUrl)) { writer.WriteLine($"registryUrl '{DockerRegistryUrl}'"); } if (!string.IsNullOrWhiteSpace(DockerRegistryCredentialsId)) { writer.WriteLine($"registryCredentialsId '{DockerRegistryCredentialsId}'"); } } if (AgentType == JenkinsAgentType.DockerFile) { if (!string.IsNullOrWhiteSpace(DockerFileName)) { writer.WriteLine($"filename '{DockerFileName}'"); } if (!string.IsNullOrWhiteSpace(DockerContextDirectory)) { writer.WriteLine($"dir '{DockerContextDirectory}'"); } if (!string.IsNullOrWhiteSpace(DockerAdditionalBuildArgs)) { writer.WriteLine($"additionalBuildArgs '{DockerAdditionalBuildArgs}'"); } if (!string.IsNullOrWhiteSpace(DockerArgs)) { writer.WriteLine($"args '{DockerArgs}'"); } if (!string.IsNullOrWhiteSpace(DockerRegistryUrl)) { writer.WriteLine($"registryUrl '{DockerRegistryUrl}'"); } if (!string.IsNullOrWhiteSpace(DockerRegistryCredentialsId)) { writer.WriteLine($"registryCredentialsId '{DockerRegistryCredentialsId}'"); } } if (AgentType == JenkinsAgentType.Kubernetes) { if (!string.IsNullOrWhiteSpace(KubernetesYaml)) { writer.WriteLine($"yaml \"\"\"{KubernetesYaml}\"\"\""); } if (!string.IsNullOrWhiteSpace(KubernetesYamlFile)) { writer.WriteLine($"yamlFile '{KubernetesYamlFile}'"); } if (!string.IsNullOrWhiteSpace(KubernetesDefaultContainer)) { writer.WriteLine($"defaultContainer '{KubernetesDefaultContainer}'"); } } } } } }