using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
namespace OPS.Component
{
/**//// <summary>
/// IISWebServerCollection
/// </summary>
public class IISWebServerCollection : CollectionBase
{
/**//// <summary>
///
/// </summary>
public IISWebServer this[int Index]
{
get
{
return (IISWebServer)this.List[Index];
}
}
/**//**/
/**//// <summary>
///
/// </summary>
public IISWebServer this[string ServerComment]
{
get
{
ServerComment = ServerComment.ToLower().Trim();
IISWebServer list;
for (int i = 0; i < this.List.Count; i++)
{
list = (IISWebServer)this.List[i];
if (list.ServerComment.ToLower().Trim() == ServerComment)
return list;
}
return null;
}
}
internal void Add_(IISWebServer WebServer)
{
this.List.Add(WebServer);
}
/**//**/
/**//// <summary>
///
/// </summary>
/// <param name="WebServer"></param>
public void Add(IISWebServer WebServer)
{
try
{
this.List.Add(WebServer);
IISManagement.CreateIISWebServer(WebServer);
}
catch
{
throw (new Exception("發生意外錯誤,可能是某節點將該節點的上級節點作為它自己的子級插入"));
}
}
/**//**/
/**//// <summary>
/// 是否包含指定的網站
/// </summary>
/// <param name="ServerComment"></param>
/// <returns></returns>
public bool Contains(string ServerComment)
{
ServerComment = ServerComment.ToLower().Trim();
for (int i = 0; i < this.List.Count; i++)
{
IISWebServer server = this[i];
if (server.ServerComment.ToLower().Trim() == ServerComment)
return true;
}
return false;
}
/**//**/
/**//// <summary>
/// 是否包含指定的網站
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
public bool Contains(int index)
{
for (int i = 0; i < this.List.Count; i++)
{
IISWebServer server = this[i];
if (server.index == index)
return true;
}
return false;
}
/**//**/
/**//// <summary>
///
/// </summary>
/// <param name="WebServers"></param>
public void AddRange(IISWebServer[] WebServers)
{
for (int i = 0; i <= WebServers.GetUpperBound(0); i++)
{
Add(WebServers[i]);
}
}
/**//**/
/**//// <summary>
///
/// </summary>
/// <param name="WebServer"></param>
public void Remove(IISWebServer WebServer)
{
for (int i = 0; i < this.List.Count; i++)
{
if ((IISWebServer)this.List[i] == WebServer)
{
this.List.RemoveAt(i);
return;
}
}
IISManagement.RemoveIISWebServer(WebServer.index);
}
}
}
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
namespace OPS.Component
{
/**//// <summary>
/// IISWebVirtualDirCollection
/// </summary>
public class IISWebVirtualDirCollection : CollectionBase
{
/**//**/
/**//// <summary>
///
/// </summary>
public IISWebServer Parent = null;
/**//**/
/**//// <summary>
///
/// </summary>
public IISWebVirtualDir this[int Index]
{
get
{
return (IISWebVirtualDir)this.List[Index];
}
}
/**//**/
/**//// <summary>
///
/// </summary>
public IISWebVirtualDir this[string Name]
{
get
{
Name = Name.ToLower();
IISWebVirtualDir list;
for (int i = 0; i < this.List.Count; i++)
{
list = (IISWebVirtualDir)this.List[i];
if (list.Name.ToLower() == Name)
return list;
}
return null;
}
}
internal void Add_(IISWebVirtualDir WebVirtualDir)
{
try
{
this.List.Add(WebVirtualDir);
}
catch
{
throw (new Exception("發生意外錯誤,可能是某節點將該節點的上級節點作為它自己的子級插入"));
}
}
/**//**/
/**//// <summary>
///
/// </summary>
/// <param name="WebVirtualDir"></param>
public void Add(IISWebVirtualDir WebVirtualDir)
{
WebVirtualDir.Parent = this.Parent;
try
{
this.List.Add(WebVirtualDir);
}
catch
{
throw (new Exception("發生意外錯誤,可能是某節點將該節點的上級節點作為它自己的子級插入"));
}
IISManagement.CreateIISWebVirtualDir(WebVirtualDir, true);
}
/**//**/
/**//// <summary>
///
/// </summary>
/// <param name="WebVirtualDirs"></param>
public void AddRange(IISWebVirtualDir[] WebVirtualDirs)
{
for (int i = 0; i <= WebVirtualDirs.GetUpperBound(0); i++)
{
Add(WebVirtualDirs[i]);
}
}
/**//**/
/**//// <summary>
///
/// </summary>
/// <param name="WebVirtualDir"></param>
public void Remove(IISWebVirtualDir WebVirtualDir)
{
for (int i = 0; i < this.List.Count; i++)
{
if ((IISWebVirtualDir)this.List[i] == WebVirtualDir)
{
this.List.RemoveAt(i);
IISManagement.RemoveIISWebVirtualDir(WebVirtualDir);
return;
}
}
}
/**//**/
/**//// <summary>
///
/// </summary>
/// <param name="Parent"></param>
public IISWebVirtualDirCollection(IISWebServer Parent)
{
this.Parent = Parent;
}
}
}