{"id":94252,"date":"2015-12-13T12:50:51","date_gmt":"2015-12-13T08:50:51","guid":{"rendered":"http:\/\/blagovest.org.ru\/?p=94252"},"modified":"2015-12-13T12:50:51","modified_gmt":"2015-12-13T08:50:51","slug":"c-problema-s-system-management","status":"publish","type":"post","link":"https:\/\/blagovest.org.ru\/?p=94252","title":{"rendered":"C#, \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 System.Management"},"content":{"rendered":"<p>using System;<br \/>using System.Collections.Generic;<br \/>using System.ComponentModel;<br \/>using System.Data;<br \/>using System.Drawing;<br \/>using System.Linq;<br \/>using System.Text;<br \/>using System.Windows.Forms;<\/p>\n<p>namespace avastInstalled<br \/>{<br \/> &nbsp; &nbsp;public partial class Form1 : Form<br \/> &nbsp; &nbsp;{<br \/> &nbsp; &nbsp; &nbsp; &nbsp;public Form1()<br \/> &nbsp; &nbsp; &nbsp; &nbsp;{<br \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;InitializeComponent();<br \/> &nbsp; &nbsp; &nbsp; &nbsp;}<\/p>\n<p> &nbsp; &nbsp; &nbsp; &nbsp;private void Form1_Load(object sender,EventArgs e)<br \/> &nbsp; &nbsp; &nbsp; &nbsp;{<br \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;string path=string.Format(@&quot;\\{0}rootSecurityCenter2&quot;,Environment.MachineName);<br \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var searcher=new System.Management.ManagementObjectSearcher(path,&quot;SELECT * FROM AntivirusProduct&quot;);<br \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;System.Management.ManagementObjectCollection managementObjectCollection=searcher.Get();<br \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;foreach(var managementObject in managementObjectCollection)<br \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if(managementObject[&quot;displayName&quot;]==&quot;avast! Antivirus&quot;)<br \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\/\/\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f<br \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br \/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br \/> &nbsp; &nbsp; &nbsp; &nbsp;}<br \/> &nbsp; &nbsp;}<br \/>}<\/p>\n<p>\u043f\u0440\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0432\u044b\u0434\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<br \/>E:UsersSanyaDocumentsVisual Studio 2010ProjectsavastInstalledavastInstalledForm1.cs(22,48): \u043e\u0448\u0438\u0431\u043a\u0430 CS0234: \u0418\u043c\u044f \u0442\u0438\u043f\u0430 \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0438\u043c\u0435\u043d &quot;ManagementObjectSearcher&quot; \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0438\u043c\u0435\u043d &quot;System.Management&quot; (\u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u0430 \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0441\u0431\u043e\u0440\u043a\u0443?)<br \/>E:UsersSanyaDocumentsVisual Studio 2010ProjectsavastInstalledavastInstalledForm1.cs(23,31): \u043e\u0448\u0438\u0431\u043a\u0430 CS0234: \u0418\u043c\u044f \u0442\u0438\u043f\u0430 \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0438\u043c\u0435\u043d &quot;ManagementObjectCollection&quot; \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0438\u043c\u0435\u043d &quot;System.Management&quot; (\u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u0430 \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0441\u0431\u043e\u0440\u043a\u0443?)<\/p>\n<p>\u043f\u043e\u0447\u0435\u043c\u0443??<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043e&#8230;.<br \/>\n\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u043f\u0438\u0441\u0430\u0442\u044c \u0438 using System.Management;<br \/>\u043f\u0438\u0448\u0435\u0442 \u0442\u043e\u0436\u0435 \u0441\u0430\u043c\u043e\u0435.<br \/>\n<br \/>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043e&#8230;.<br \/>\n\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 Visual Studio 2010<\/p>\n","protected":false},"excerpt":{"rendered":"<p>using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms; namespace avastInstalled{ &nbsp; &nbsp;public partial class Form1 : Form &nbsp; &nbsp;{ &nbsp; &nbsp; &nbsp; &nbsp;public Form1() &nbsp; &nbsp; &nbsp; &nbsp;{ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;InitializeComponent(); &nbsp; &nbsp; &nbsp; &nbsp;} &nbsp; &nbsp; &nbsp; &nbsp;private void Form1_Load(object sender,EventArgs e) &nbsp; &nbsp; &nbsp; &nbsp;{ &nbsp; &nbsp; &nbsp; &nbsp; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1435],"tags":[779,1580,1460],"class_list":["post-94252","post","type-post","status-publish","format-standard","hentry","category-windows","tag-c-2","tag-namespace-2","tag-programmirovanie"],"_links":{"self":[{"href":"https:\/\/blagovest.org.ru\/index.php?rest_route=\/wp\/v2\/posts\/94252","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blagovest.org.ru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blagovest.org.ru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blagovest.org.ru\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blagovest.org.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=94252"}],"version-history":[{"count":0,"href":"https:\/\/blagovest.org.ru\/index.php?rest_route=\/wp\/v2\/posts\/94252\/revisions"}],"wp:attachment":[{"href":"https:\/\/blagovest.org.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=94252"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blagovest.org.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=94252"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blagovest.org.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=94252"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}