using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Windows.Forms.Design; using System.DirectoryServices; using System.Reflection; using System.Text.RegularExpressions; int TotalServerCount=0; DirectoryEntry rootfolder = new DirectoryEntry("IIS://localhost/W3SVC"); //TotalServerCount=rootfolder.Children.SchemaFilter.Count; foreach (DirectoryEntry child in rootfolder.Children) { if (child.SchemaClassName == "IIsWebServer") { TotalServerCount+=1; } } //循环获取所有站点详细属性写入数组中 string [] arrayServerID = new string[TotalServerCount];//站点标识符 string [] arrayServerIP = new string[TotalServerCount];//站点主机头 string [] arrayServerPort = new string[TotalServerCount];//站点主机头 string [] arrayServerHeader = new string[TotalServerCount];//站点主机头 string [] arrayServerPath = new string[TotalServerCount];//站点主机头 string [] arrayServerComment = new string[TotalServerCount];//站点主机头 string [] arrayServerBinds = new string[TotalServerCount];//站点主机头 string currentServerBindings;//绑定主机头IP端口字符串 char[] a=":".ToCharArray(); string […]
View Detailsprivate void comboBox1_SelectedIndexChanged(object sender, System.EventArgs e) { string currentServerComment=comboBox1.SelectedItem.ToString(); string currentSiteNum = GetWebSiteNum(currentServerComment); string rootPath = "IIS://localhost/w3svc"; string currentSitePath =rootPath+"/"+currentSiteNum; DirectoryEntry siteEntry = new DirectoryEntry(currentSitePath); string currentServerBindings=siteEntry.Properties["ServerBindings"].Value.ToString(); char[] a=":".ToCharArray(); string [] currentBingdings = null; currentBingdings=currentServerBindings.Split(a); string currentServerIP=currentBingdings[0]; string currentServerPort=currentBingdings[1]; string currentServerHeader=currentBingdings[2]; string currentServerHost=""; string currentServerPath=""; foreach (DirectoryEntry child in siteEntry.Children) { if((child.SchemaClassName == "IIsWebVirtualDir")&&(child.Name=="root")) { currentServerPath = child.Properties["Path"].Value.ToString(); } } textBox2.Text=currentServerIP; textBox3.Text=currentServerPort; textBox4.Text=currentServerPath; textBox5.Text=currentServerHeader; textBox6.Text=currentServerHost; } /// <summary> /// 根据站点名称获取站点标识符 /// </summary> public string GetWebSiteNum(string siteName) { Regex […]
View Details(木野狐 2006-10-29) 由于之前一阵公司一个项目提出的需求,自己也想进行这方面的尝试,我对如何使用 Flash 来做 WinForm 程序的界面产生了兴趣,于是学习了一些资料,摘要于此。 要在 WinForm 中使用 Flash,通常需要用到 Shockwave Flash Object 这个 COM 组件。 (http://www.codeproject.com/csharp/fscommand.asp) (http://www.codeproject.com/useritems/FlashDBInteract.asp) 具体步骤如下: 首先添加对 COM 组件 Shockwave Flash Object 的引用,将该组件拖到窗体上之后,可以设置如下关键属性: Movie: Flash 的存放地址 EmbedMovie: 是否嵌入到程序的资源中。 接下来你可以设置其他一些属性,使得 Flash 的窗口最大化,隐藏掉其宿主程序的 C# WinForm 窗体。 在 Flash 的 ActionScript 中,可以通过 FSCommand 函数与 hosting app 通信,该函数有两个参数,分别是: command: 命令名称 parameters: 参数 例子: on(press){ fscommand("Circule", "Green"); } 在 C# 中,处理 Flash 对象的 FSCommand 事件即可。 如果该事件处理函数的 EventArgs 为 e, 则有如下对应关系: […]
View Details