pluginitemdiagnostic.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  1. class PluginItemDiagnosticEventHandler extends ScriptedWidgetEventHandler
  2. {
  3. PluginItemDiagnostic m_Owner;
  4. override bool OnMouseEnter(Widget w, int x, int y)
  5. {
  6. if( ButtonWidget.Cast(w))
  7. {
  8. GetGame().GetMission().AddActiveInputExcludes({"menu"});
  9. }
  10. return true;
  11. }
  12. override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
  13. {
  14. if( ButtonWidget.Cast(w))
  15. {
  16. GetGame().GetMission().RemoveActiveInputExcludes({"menu"},true);
  17. }
  18. return true;
  19. }
  20. override bool OnClick( Widget w, int x, int y, int button )
  21. {
  22. return m_Owner.OnClick( w, x, y, button );
  23. }
  24. override bool OnMouseButtonDown(Widget w, int x, int y, int button)
  25. {
  26. return m_Owner.OnMouseButtonDown( w, x, y, button );
  27. }
  28. override bool OnMouseButtonUp(Widget w, int x, int y, int button)
  29. {
  30. return m_Owner.OnMouseButtonUp( w, x, y, button );
  31. }
  32. }
  33. class PluginItemDiagnostic extends PluginDeveloper
  34. {
  35. Object m_Entity;
  36. ref Timer myTimer1;
  37. ref map<PlayerBase,Object> m_ObserversMap = new map<PlayerBase,Object>;
  38. ref array<string> m_Agents = new array<string>;
  39. ref map<string,float> m_Floats = new map<string,float>;
  40. ref map<string,float> m_VarsNumbersFinalServer = new map<string,float>;
  41. ref map<string,float> m_VarsFinalClient = new map<string,float>;
  42. ref array<ref Param> m_Properties = new array<ref Param>;
  43. bool m_IsActive = false;
  44. bool m_ScriptMenuOpened;
  45. string m_NoteClient;
  46. ref PluginItemDiagnosticEventHandler m_EventHandler;
  47. bool m_IsDragging;
  48. PluginConfigDebugProfile m_ConfigDebugProfile;
  49. Widget m_DebugRootWidget;
  50. TextListboxWidget m_DebugAgentListWidget;
  51. TextWidget m_DebugOutputServer;
  52. TextWidget m_DebugOutputClient;
  53. TextListboxWidget m_DebugFloatsProperListWidget;
  54. TextListboxWidget m_DebugClientVarsWidget;
  55. TextWidget m_ClassNameWidget;
  56. TextWidget m_DistanceWidget;
  57. ItemPreviewWidget m_ItemPreviewWidget;
  58. ButtonWidget m_CloseButton;
  59. Shape m_ItemLine;
  60. vector m_DraggingOffset;
  61. void PluginItemDiagnostic()
  62. {
  63. #ifndef NO_GUI
  64. InitializeWidgets();
  65. ShowWidgets(false);
  66. #endif
  67. }
  68. void ~PluginItemDiagnostic()
  69. {
  70. ClearProperties();
  71. if (m_ItemLine)
  72. {
  73. m_ItemLine.Destroy();
  74. m_ItemLine = null;
  75. }
  76. }
  77. override void OnInit()
  78. {
  79. m_ConfigDebugProfile = PluginConfigDebugProfile.Cast( GetPlugin(PluginConfigDebugProfile) );
  80. if ( m_ConfigDebugProfile )
  81. {
  82. vector pos = m_ConfigDebugProfile.GetItemDebugPos();
  83. if (m_DebugRootWidget && pos != vector.Zero)
  84. {
  85. float wx = pos[0];
  86. float wy = pos[1];
  87. m_DebugRootWidget.SetPos(wx, wy);
  88. }
  89. }
  90. }
  91. bool OnMouseButtonDown(Widget w, int x, int y, int button)
  92. {
  93. if (button == 0)
  94. SetDragging(true);
  95. if (button == 1)
  96. {
  97. if (m_Entity)
  98. {
  99. float xx, yy;
  100. m_DebugRootWidget.GetPos(xx,yy);
  101. ContextMenu.DisplayContextMenu(x - xx, y - yy, EntityAI.Cast(m_Entity), m_DebugRootWidget, this);
  102. }
  103. }
  104. return true;
  105. }
  106. bool OnMouseButtonUp(Widget w, int x, int y, int button)
  107. {
  108. if (button == 0)
  109. SetDragging(false);
  110. return true;
  111. }
  112. void SetDragging(bool enable)
  113. {
  114. if(enable && !m_IsDragging)
  115. OnDraggingStart();
  116. else if (!enable && m_IsDragging)
  117. OnDraggingEnd();
  118. m_IsDragging = enable;
  119. }
  120. void OnDraggingStart()
  121. {
  122. int mx, my;
  123. float wx, wy;
  124. GetMousePos(mx,my);
  125. m_DebugRootWidget.GetScreenPos(wx,wy);
  126. m_DraggingOffset[0] = wx - mx;
  127. m_DraggingOffset[1] = wy - my;
  128. }
  129. void OnDraggingEnd()
  130. {
  131. float wx, wy;
  132. m_DebugRootWidget.GetScreenPos(wx,wy);
  133. if (m_ConfigDebugProfile)
  134. {
  135. m_ConfigDebugProfile.SetItemDebugPos(Vector(wx,wy,0));
  136. }
  137. }
  138. bool OnClick( Widget w, int x, int y, int button )
  139. {
  140. SetDragging(false);
  141. if (w == m_CloseButton)
  142. {
  143. ToggleDebugWindowEvent();
  144. return true;
  145. }
  146. return true;
  147. }
  148. void RegisterDebugItem(Object item, PlayerBase player)
  149. {
  150. if(!myTimer1)
  151. {
  152. myTimer1 = new Timer();
  153. myTimer1.Run(1, this, "Tick", NULL, true);
  154. }
  155. if(m_ObserversMap.Contains(player))
  156. {
  157. m_ObserversMap.Set(player,item);
  158. }
  159. else
  160. {
  161. m_ObserversMap.Insert(player,item);
  162. }
  163. #ifdef DEVELOPER
  164. SetDebugDeveloper_item(item);
  165. #endif
  166. }
  167. Object GetWatchedItem(PlayerBase player)
  168. {
  169. return m_ObserversMap.Get(player);
  170. }
  171. bool IsActive()
  172. {
  173. return m_IsActive;
  174. }
  175. void OnScriptMenuOpened(bool opened/*1 - opened , 0 - closed*/)
  176. {
  177. m_ScriptMenuOpened = opened;
  178. }
  179. void ShowWidgets(bool show)
  180. {
  181. m_IsActive = show;
  182. if(m_DebugRootWidget)
  183. m_DebugRootWidget.Show(show);
  184. }
  185. void OnSelectAction(EntityAI ent, int actionId)
  186. {
  187. #ifdef DIAG_DEVELOPER
  188. PlayerBase player = PlayerBase.Cast( GetGame().GetPlayer() );
  189. player.GetActionManager().OnInstantAction(ActionDebug,new Param2<EntityAI,int>(ent,actionId));
  190. #endif
  191. }
  192. void ReleaseFocus()
  193. {
  194. GetGame().GetInput().ResetGameFocus();
  195. GetGame().GetUIManager().ShowUICursor(false);
  196. if (GetGame().GetUIManager())
  197. {
  198. if (GetGame().GetUIManager().IsDialogVisible())
  199. {
  200. GetGame().GetUIManager().CloseDialog();
  201. }
  202. }
  203. }
  204. void ToggleDebugWindowEvent()
  205. {
  206. if (m_IsActive)
  207. {
  208. PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
  209. GetGame().RPCSingleParam(player, ERPCs.RPC_ITEM_DIAG_CLOSE,null, true);
  210. ShowWidgets(false);
  211. ClearWidgets();
  212. GetGame().GetCallQueue( CALL_CATEGORY_GUI ).CallLater( ReleaseFocus, 100);
  213. //m_IsActive = false;
  214. SetDragging(false);
  215. }
  216. else
  217. {
  218. ShowWidgets(true);
  219. //m_IsActive = true;
  220. }
  221. }
  222. void ClearWidgets()
  223. {
  224. m_DebugAgentListWidget.ClearItems();
  225. m_DebugOutputServer.SetText("");
  226. m_DebugOutputClient.SetText("");
  227. m_DebugFloatsProperListWidget.ClearItems();
  228. m_ItemPreviewWidget.SetItem(NULL);
  229. m_ClassNameWidget.SetText("");
  230. }
  231. void Tick()
  232. {
  233. for(int i = 0; i < m_ObserversMap.Count();i++)
  234. {
  235. Object item = m_ObserversMap.GetElement(i);
  236. PlayerBase player = m_ObserversMap.GetKey(i);
  237. if (item && player)
  238. {
  239. GeneratePropertiesObject(EntityAI.Cast(item));
  240. SendRPC(item, player);
  241. }
  242. else
  243. {
  244. Debug.LogError("PluginItemDiagnostic: dead debug record, removing record");
  245. m_ObserversMap.RemoveElement(i);
  246. }
  247. }
  248. }
  249. void ClearProperties()
  250. {
  251. m_Properties.Clear();
  252. }
  253. void GeneratePropertiesObject(EntityAI item)
  254. {
  255. ClearProperties();
  256. GetLocalProperties(item, m_Properties);
  257. }
  258. void SendRPC(Object item, PlayerBase player)
  259. {
  260. Param1<Object> p1 = new Param1<Object>(item);
  261. m_Properties.InsertAt(p1,0);
  262. GetGame().RPC(player,ERPCs.RPC_ITEM_DIAG,m_Properties,true,player.GetIdentity());
  263. if (!GetGame().IsMultiplayer())
  264. {
  265. m_Entity = item;
  266. }
  267. }
  268. void StopWatchRequest(PlayerBase player)//called from player after an RPC call
  269. {
  270. if( m_ObserversMap.Contains(player) )
  271. {
  272. m_ObserversMap.Remove(player);
  273. }
  274. }
  275. void OnRPC(Object entity, ParamsReadContext ctx)
  276. {
  277. if (!GetGame().IsMultiplayer())
  278. {
  279. entity = m_Entity;
  280. }
  281. else
  282. {
  283. m_Entity = entity;
  284. }
  285. ItemBase item = ItemBase.Cast(entity);
  286. #ifdef DEVELOPER
  287. SetDebugDeveloper_item(entity);
  288. #endif
  289. if(!IsActive())
  290. {
  291. ShowWidgets(true);
  292. }
  293. ctx.Read(CachedObjectsParams.PARAM1_STRING);
  294. string debug_output_server = CachedObjectsParams.PARAM1_STRING.param1;
  295. array<ref Param> vars_client;
  296. array<ref Param> vars_server;
  297. if (item)
  298. {
  299. ctx.Read(CachedObjectsParams.PARAM1_INT);//hardcoded to index 1
  300. int agents_count = CachedObjectsParams.PARAM1_INT.param1;
  301. ctx.Read(CachedObjectsParams.PARAM1_INT);//hardcoded to index 2
  302. int individual_items_count = CachedObjectsParams.PARAM1_INT.param1;
  303. FillAgentArray(ctx, agents_count);
  304. vars_server = new array<ref Param>;
  305. FillServerFinalVars(individual_items_count, ctx, vars_server);
  306. vars_client = new array<ref Param>;
  307. GetLocalProperties(item, vars_client, true);
  308. }
  309. if (EntityAI.Cast(entity))
  310. {
  311. DisplayAll(EntityAI.Cast(entity), vars_server, vars_client, debug_output_server );
  312. }
  313. if (GetDayZGame().IsInventoryOpen() || GetGame().GetUIManager().FindMenu(MENU_SCRIPTCONSOLE))
  314. {
  315. m_DebugRootWidget.SetSort(-1);
  316. }
  317. else
  318. {
  319. m_DebugRootWidget.SetSort(10);
  320. }
  321. m_DebugRootWidget.Show(true);
  322. }
  323. void FillServerFinalVars(int count, ParamsReadContext ctx, array<ref Param> params )
  324. {
  325. for(int i = 0; i < count; i++)
  326. {
  327. Param2<string,float> p2 = new Param2<string,float>("",0);
  328. ctx.Read(p2);
  329. /*
  330. string name = CachedObjectsParams.PARAM2_STRING_FLOAT.param1;
  331. float value = CachedObjectsParams.PARAM2_STRING_FLOAT.param2;
  332. PrintString(name+","+value.ToString());
  333. */
  334. params.Insert(p2);
  335. }
  336. //PrintString("----------------------------------------------------");
  337. }
  338. void InitializeWidgets()
  339. {
  340. m_EventHandler = new PluginItemDiagnosticEventHandler;
  341. m_EventHandler.m_Owner = this;
  342. if(!m_DebugRootWidget)
  343. m_DebugRootWidget = GetGame().GetWorkspace().CreateWidgets("gui/layouts/debug/debug_item.layout");
  344. m_DebugRootWidget.SetHandler(m_EventHandler);
  345. m_DebugAgentListWidget = TextListboxWidget.Cast(m_DebugRootWidget.FindAnyWidget("AgentsList"));
  346. m_DebugOutputServer = TextWidget.Cast(m_DebugRootWidget.FindAnyWidget("DebugOutputServer"));
  347. m_DebugOutputClient = TextWidget.Cast(m_DebugRootWidget.FindAnyWidget("DebugOutputClient"));
  348. m_DebugFloatsProperListWidget = TextListboxWidget.Cast(m_DebugRootWidget.FindAnyWidget("FloatsProperList"));
  349. m_ItemPreviewWidget = ItemPreviewWidget.Cast(m_DebugRootWidget.FindAnyWidget("ItemPreview"));
  350. m_ClassNameWidget = TextWidget.Cast(m_DebugRootWidget.FindAnyWidget("ClassName"));
  351. m_DistanceWidget = TextWidget.Cast(m_DebugRootWidget.FindAnyWidget("Distance"));
  352. m_CloseButton = ButtonWidget.Cast(m_DebugRootWidget.FindAnyWidget("CloseButton"));
  353. }
  354. override void OnUpdate(float delta_time)
  355. {
  356. super.OnUpdate(delta_time);
  357. if (!m_Entity || !m_IsActive)
  358. {
  359. if (m_ItemLine)
  360. {
  361. m_ItemLine.Destroy();
  362. m_ItemLine = null;
  363. }
  364. return;
  365. }
  366. m_ItemPreviewWidget.Show(!m_ScriptMenuOpened);
  367. if (m_IsDragging)
  368. {
  369. int x,y;
  370. GetMousePos(x,y);
  371. m_DebugRootWidget.SetPos(x + m_DraggingOffset[0], y + m_DraggingOffset[1]);
  372. }
  373. vector pts[2];
  374. pts[0] = GetGame().GetPlayer().GetPosition();
  375. pts[1] = m_Entity.GetPosition();
  376. if (m_ItemLine)
  377. {
  378. m_ItemLine.Destroy();
  379. m_ItemLine = null;
  380. }
  381. m_ItemLine = Shape.CreateLines(COLOR_BLUE, ShapeFlags.TRANSP|ShapeFlags.NOOUTLINE|ShapeFlags.NOZBUFFER, pts, 2);
  382. m_DistanceWidget.SetText(vector.Distance(pts[0], pts[1]).ToString()+"m.");
  383. }
  384. void DisplayAll(EntityAI item, array<ref Param> vars_server, array<ref Param> vars_client, string debug_text_server)
  385. {
  386. m_ClassNameWidget.SetText( item.GetType() );
  387. m_ItemPreviewWidget.SetItem(item);
  388. UpdateAgentWidget();
  389. //UpdateFloatWidget();
  390. if (vars_server && vars_client)
  391. UpdateNumericalVarsWidget(vars_server, vars_client);
  392. m_DebugOutputServer.SetText(debug_text_server);
  393. m_DebugOutputClient.SetText(item.GetDebugText());
  394. }
  395. void FillAgentArray(ParamsReadContext ctx, int agents_count)
  396. {
  397. m_Agents.Clear();
  398. for(int i = 0; i < agents_count; i++)
  399. {
  400. if(ctx.Read(CachedObjectsParams.PARAM1_STRING))
  401. {
  402. string agent = CachedObjectsParams.PARAM1_STRING.param1;
  403. m_Agents.Insert(agent);
  404. }
  405. }
  406. }
  407. void UpdateAgentWidget()
  408. {
  409. m_DebugAgentListWidget.ClearItems();
  410. for(int i = 0; i < m_Agents.Count(); i++)
  411. {
  412. string agent = m_Agents.Get(i);
  413. m_DebugAgentListWidget.AddItem(agent,NULL,0);
  414. }
  415. }
  416. void UpdateNumericalVarsWidget(array<ref Param> vars_server, array<ref Param> vars_client)
  417. {
  418. m_DebugFloatsProperListWidget.ClearItems();
  419. for(int i = 0; i < vars_server.Count(); i++)
  420. {
  421. Param param_server = vars_server.Get(i);
  422. Param2<string,float> p2_server = Param2<string,float>.Cast(param_server);
  423. Param param_client = vars_client.Get(i);
  424. Param2<string,float> p2_client = Param2<string,float>.Cast(param_client);
  425. string name = p2_server.param1;
  426. m_DebugFloatsProperListWidget.AddItem(name,NULL,0);
  427. m_DebugFloatsProperListWidget.SetItem(i,p2_server.param2.ToString(),NULL,1);
  428. m_DebugFloatsProperListWidget.SetItem(i,p2_client.param2.ToString(),NULL,2);
  429. }
  430. }
  431. void PrintOut()
  432. {
  433. Debug.LogArrayString(m_Agents,"ItemDebug");
  434. Debug.Log("----------------------","ItemDebug");
  435. }
  436. //-------------------------
  437. // QUERY FOR DEBUG PROPERTIES
  438. //-------------------------
  439. void GetLocalProperties(EntityAI entity, array<ref Param> properties, bool client = false)
  440. {
  441. if(!entity)
  442. return;
  443. ItemBase item = ItemBase.Cast(entity);
  444. if(!client)
  445. {
  446. // -------- DEBUG OUTPUT ------
  447. Param1<string> debug_output = new Param1<string>(entity.GetDebugText());
  448. properties.Insert(debug_output);
  449. if(!item)
  450. return;
  451. // -------- AGENTS ------------
  452. int num_of_agents = FillWithAgents(item, properties);
  453. Param1<int> agents_count = new Param1<int>(num_of_agents);
  454. properties.InsertAt(agents_count,1);// hard coded index 1 !!
  455. }
  456. if(!item)
  457. return;
  458. // ------ INDIVIDUAL VARS------
  459. int number_of_items = 0;
  460. Param2<string, float> quantity = new Param2<string, float>("quantity", item.GetQuantity() );
  461. properties.Insert(quantity);
  462. number_of_items++;
  463. //-----------------------------
  464. Param2<string, float> liquid_type = new Param2<string, float>("liquid_type", item.GetLiquidType() );
  465. properties.Insert(liquid_type);
  466. number_of_items++;
  467. //-----------------------------
  468. Param2<string, float> wetness = new Param2<string, float>("wetness", item.GetWet() );
  469. properties.Insert(wetness);
  470. number_of_items++;
  471. //-----------------------------
  472. Param2<string, float> temperature = new Param2<string, float>("temperature", item.GetTemperature() );
  473. properties.Insert(temperature);
  474. number_of_items++;
  475. //-----------------------------
  476. Param2<string, float> frozen = new Param2<string, float>("frozen", item.GetIsFrozen() );
  477. properties.Insert(frozen);
  478. number_of_items++;
  479. //-----------------------------
  480. Param2<string, float> FTProgress = new Param2<string, float>("F/T pgs", item.GetFreezeThawProgress() );
  481. properties.Insert(FTProgress);
  482. number_of_items++;
  483. //-----------------------------
  484. #ifdef DEVELOPER
  485. Param2<string, float> FTChangeTime = new Param2<string, float>("LastChangeTime", item.m_LastFTChangeTime );
  486. properties.Insert(FTChangeTime);
  487. number_of_items++;
  488. //-----------------------------
  489. Param2<string, float> FTRemainingTime = new Param2<string, float>("FTTimeRemaining", item.m_PresumedTimeRemaining );
  490. properties.Insert(FTRemainingTime);
  491. number_of_items++;
  492. #endif
  493. //-----------------------------
  494. Param2<string, float> OverheatPgs = new Param2<string, float>("Overheat pgs", item.GetItemOverheatProgress() );
  495. properties.Insert(OverheatPgs);
  496. number_of_items++;
  497. //-----------------------------
  498. Edible_Base food;
  499. if (Class.CastTo(food,item) && food.GetFoodStage() != null)
  500. {
  501. Param2<string, float> CookingTime = new Param2<string, float>("CookingTime", food.GetCookingTime() );
  502. properties.Insert(CookingTime);
  503. number_of_items++;
  504. //-----------------------------
  505. Param2<string, float> DecayTime = new Param2<string, float>("DecayTime (remaining)", food.GetDecayTimer() );
  506. properties.Insert(DecayTime);
  507. number_of_items++;
  508. //-----------------------------
  509. Param2<string, float> DecayDelta = new Param2<string, float>("DecayDelta (last)", food.GetDecayDelta() );
  510. properties.Insert(DecayDelta);
  511. number_of_items++;
  512. }
  513. //-----------------------------
  514. Param2<string, float> energy = new Param2<string, float>("energy", item.GetEnergy() );
  515. properties.Insert(energy);
  516. number_of_items++;
  517. //-----------------------------
  518. Param2<string, float> health;
  519. if(!client)
  520. {
  521. health = new Param2<string, float>("health", item.GetHealth("", "") );
  522. }
  523. else
  524. {
  525. health = new Param2<string, float>("NO SYNC",0 );
  526. }
  527. properties.Insert(health);
  528. number_of_items++;
  529. //-----------------------------
  530. /*int r,g,b,a;
  531. item.GetColor(r,g,b,a);
  532. Param2<string, float> p2r = new Param2<string, float>("R",r);
  533. properties.Insert(p2r);
  534. number_of_items++;
  535. Param2<string, float> p2g = new Param2<string, float>("G",g);
  536. properties.Insert(p2g);
  537. number_of_items++;
  538. Param2<string, float> p2b = new Param2<string, float>("B",b);
  539. properties.Insert(p2b);
  540. number_of_items++;
  541. Param2<string, float> p2a = new Param2<string, float>("A",a);
  542. properties.Insert(p2a);
  543. number_of_items++;*/
  544. //-----------------------------
  545. if(!client)
  546. {
  547. Param1<int> item_count = new Param1<int>(number_of_items);
  548. properties.InsertAt(item_count,2);
  549. }
  550. }
  551. int FillWithAgents(ItemBase item, array<ref Param> properties)
  552. {
  553. if (!item)
  554. {
  555. return 0;
  556. }
  557. int agents = item.GetAgents();
  558. if(agents == 0) return 0;
  559. int num_of_agents = 0;
  560. ref array<int> agents_aray = new array<int>;
  561. PluginTransmissionAgents.BuildAgentArray(agents, agents_aray);
  562. int agents_count = agents_aray.Count();
  563. for(int i = 0; i < agents_count; i++)
  564. {
  565. //PluginTransmissionAgents mta = PluginTransmissionAgents.Cast(GetPlugin(PluginTransmissionAgents));
  566. string agent_name = PluginTransmissionAgents.GetNameByID(agents_aray.Get(i));
  567. Param1<string> param1 = new Param1<string>(agent_name);
  568. properties.Insert(param1);
  569. num_of_agents++;
  570. }
  571. return num_of_agents;
  572. }
  573. }