本文整理汇总了C#中ServiceProviderItem类的典型用法代码示例。如果您正苦于以下问题:C# ServiceProviderItem类的具体用法?C# ServiceProviderItem怎么用?C# ServiceProviderItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServiceProviderItem类属于命名空间,在下文中一共展示了ServiceProviderItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ConvertItemToMailAccount
private static MailAccount ConvertItemToMailAccount(ServiceProviderItem item)
{
MailAccount account = (MailAccount)item;
account.Password = CryptoUtils.Decrypt(account.Password);
return account;
}
开发者ID:jordan49,项目名称:websitepanel,代码行数:7,代码来源:MailServerController.cs
示例2: Wrap
// static methods
public static SoapServiceProviderItem Wrap(ServiceProviderItem item)
{
if (item == null)
return null;
// wrap only "persistent" properties
SoapServiceProviderItem sobj = new SoapServiceProviderItem();
sobj.TypeName = item.GetType().AssemblyQualifiedName;
// add common properties
Hashtable props = GetObjectProperties(item, true);
props.Add("Id", item.Id.ToString());
props.Add("Name", item.Name);
props.Add("ServiceId", item.ServiceId.ToString());
props.Add("PackageId", item.PackageId.ToString());
List<string> wrProps = new List<string>();
foreach (string key in props.Keys)
{
wrProps.Add(key + "=" + props[key].ToString());
}
sobj.Properties = wrProps.ToArray();
return sobj;
}
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:26,代码来源:SoapServiceProviderItem.cs
示例3: ConvertItemToFtpAccount
private static FtpAccount ConvertItemToFtpAccount(ServiceProviderItem item)
{
FtpAccount account = (FtpAccount)item;
string homeFolder = FilesController.GetHomeFolder(account.PackageId);
if(!String.IsNullOrEmpty(account.Folder) && account.Folder.IndexOf(":") != -1)
account.Folder = account.Folder.Substring(homeFolder.Length);
account.Folder = (account.Folder == "") ? "\\" : account.Folder;
// decode password
account.Password = CryptoUtils.Decrypt(account.Password);
return account;
}
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:14,代码来源:FtpServerController.cs
示例4: DeleteServiceItems
public override void DeleteServiceItems(ServiceProviderItem[] items)
{
foreach (ServiceProviderItem item in items)
{
try
{
if (item is HomeFolder)
// delete home folder
FileUtils.DeleteFile(item.Name);
}
catch (Exception ex)
{
Log.WriteError(String.Format("Error deleting '{0}' {1}", item.Name, item.GetType().Name), ex);
}
}
}
开发者ID:JohnyBuchar,项目名称:Websitepanel,代码行数:16,代码来源:Windows2012.cs
示例5: GetServiceItemsBandwidth
public virtual ServiceProviderItemBandwidth[] GetServiceItemsBandwidth(ServiceProviderItem[] items, DateTime since)
{
// don't calculate bandwidth
return null;
}
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:5,代码来源:HostingServiceProviderBase.cs
示例6: GetServiceItemsDiskSpace
public virtual ServiceProviderItemDiskSpace[] GetServiceItemsDiskSpace(ServiceProviderItem[] items)
{
// don't calculate disk space
return null;
}
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:5,代码来源:HostingServiceProviderBase.cs
示例7: BackupItem
public int BackupItem(string tempFolder, System.Xml.XmlWriter writer, ServiceProviderItem item, ResourceGroupInfo group)
{
if (item is HomeFolder)
{
// backup home folder files
string backupName = String.Format("SpaceFiles_{0}_{1}.zip",
item.Id, DateTime.Now.Ticks);
// get the list of remote files
List<SystemFile> files = FilesController.GetFiles(item.PackageId, "\\", true);
string[] zipFiles = new string[files.Count];
for(int i = 0; i < zipFiles.Length; i++)
zipFiles[i] = files[i].Name;
// zip remote files
FilesController.ZipFiles(item.PackageId, zipFiles, backupName);
// download zipped file
string localBackupPath = Path.Combine(tempFolder, backupName);
byte[] buffer = null;
FileStream stream = new FileStream(localBackupPath, FileMode.Create, FileAccess.Write);
int offset = 0;
long length = 0;
do
{
// read remote content
buffer = FilesController.GetFileBinaryChunk(item.PackageId, backupName, offset, FILE_BUFFER_LENGTH);
// write remote content
stream.Write(buffer, 0, buffer.Length);
length += buffer.Length;
offset += FILE_BUFFER_LENGTH;
}
while (buffer.Length == FILE_BUFFER_LENGTH);
stream.Close();
// delete zipped file
if (FilesController.FileExists(item.PackageId, backupName))
FilesController.DeleteFiles(item.PackageId, new string[] { backupName });
// add file pointer
BackupController.WriteFileElement(writer, "SpaceFiles", backupName, length);
// store meta item
XmlSerializer serializer = new XmlSerializer(typeof(HomeFolder));
serializer.Serialize(writer, item);
}
else if (item is SystemDSN)
{
// backup ODBC DSN
OS.OperatingSystem os = GetOS(item.ServiceId);
// read DSN info
SystemDSN itemDsn = item as SystemDSN;
SystemDSN dsn = os.GetDSN(item.Name);
dsn.DatabasePassword = itemDsn.DatabasePassword;
XmlSerializer serializer = new XmlSerializer(typeof(SystemDSN));
serializer.Serialize(writer, dsn);
}
return 0;
}
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:67,代码来源:OperatingSystemController.cs
示例8: BackupItem
public int BackupItem(string tempFolder, XmlWriter writer, ServiceProviderItem item, ResourceGroupInfo group)
{
if (!(item is DnsZone))
return 0;
// DNS provider
DNSServer dns = GetDNSServer(item.ServiceId);
// zone records serialized
XmlSerializer serializer = new XmlSerializer(typeof(DnsRecord));
try
{
// get zone records
DnsRecord[] records = dns.GetZoneRecords(item.Name);
// serialize zone records
foreach (DnsRecord record in records)
serializer.Serialize(writer, record);
}
catch (Exception ex)
{
TaskManager.WriteError(ex, "Could not read zone records");
}
return 0;
}
开发者ID:jonwbstr,项目名称:Websitepanel,代码行数:27,代码来源:DnsServerController.cs
示例9: ChangeServiceItemsState
public override void ChangeServiceItemsState(ServiceProviderItem[] items, bool enabled)
{
foreach (ServiceProviderItem item in items)
{
try
{
if (item is Organization)
{
Organization org = item as Organization;
ChangeOrganizationState(org, enabled);
}
}
catch (Exception ex)
{
HostedSolutionLog.LogError(
String.Format("Error deleting '{0}' {1}", item.Name, item.GetType().Name), ex);
}
}
}
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:20,代码来源:OrganizationProvider.cs
示例10: DeleteServiceItems
public override void DeleteServiceItems(ServiceProviderItem[] items)
{
foreach (ServiceProviderItem item in items)
{
if (item is StatsSite)
{
try
{
DeleteSite(((StatsSite)item).SiteId);
}
catch (Exception ex)
{
Log.WriteError(String.Format("Error deleting '{0}' {1}", item.Name, item.GetType().Name), ex);
}
}
}
}
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:17,代码来源:SmarterStats.cs
示例11: ConvertItemToWebSite
private static WebSite ConvertItemToWebSite(ServiceProviderItem item)
{
return (WebSite)item;
}
开发者ID:jordan49,项目名称:websitepanel,代码行数:4,代码来源:WebServerController.cs
示例12: DeleteServiceItems
public override void DeleteServiceItems(ServiceProviderItem[] items)
{
foreach (ServiceProviderItem item in items)
{
if (item is VirtualMachine)
{
// delete virtual machine
VirtualMachine vm = item as VirtualMachine;
DeleteVirtualMachineServiceItem(vm);
}
else if (item is VirtualSwitch)
{
// delete switch
VirtualSwitch vs = item as VirtualSwitch;
DeleteVirtualSwitchServiceItem(vs);
}
}
}
开发者ID:berkut1,项目名称:Websitepanel,代码行数:18,代码来源:HyperV2012R2.cs
示例13: DeleteServiceItems
public override void DeleteServiceItems(ServiceProviderItem[] items)
{
foreach (ServiceProviderItem item in items)
{
if (item is DnsZone)
{
try
{
// delete DNS zone
DeleteZone(item.Name);
}
catch (Exception ex)
{
Log.WriteError(String.Format("Error deleting '{0}' Power DNS zone", item.Name), ex);
}
}
}
}
开发者ID:lwhitelock,项目名称:Websitepanel,代码行数:18,代码来源:PowerDNS.cs
示例14: ChangeServiceItemsState
public override void ChangeServiceItemsState(ServiceProviderItem[] items, bool enabled)
{
foreach (ServiceProviderItem item in items)
{
if (item is VirtualMachine)
{
// start/stop virtual machine
VirtualMachine vm = item as VirtualMachine;
ChangeVirtualMachineServiceItemState(vm, enabled);
}
}
}
开发者ID:berkut1,项目名称:Websitepanel,代码行数:12,代码来源:HyperV2012R2.cs
示例15: DeleteServiceItems
public override void DeleteServiceItems(ServiceProviderItem[] items)
{
foreach (ServiceProviderItem item in items)
{
if (item is FtpAccount)
{
try
{
// delete FTP account
DeleteAccount(item.Name);
}
catch (Exception ex)
{
Log.WriteError(String.Format("Error deleting '{0}' {1}", item.Name, item.GetType().Name), ex);
}
}
}
}
开发者ID:jordan49,项目名称:websitepanel,代码行数:18,代码来源:FileZilla.cs
示例16: ChangeServiceItemsState
public override void ChangeServiceItemsState(ServiceProviderItem[] items, bool enabled)
{
foreach (ServiceProviderItem item in items)
{
if (item is FtpAccount)
{
try
{
// change FTP account state
FtpAccount account = GetAccount(item.Name);
account.Enabled = enabled;
UpdateAccount(account);
}
catch (Exception ex)
{
Log.WriteError(String.Format("Error switching '{0}' {1}", item.Name, item.GetType().Name), ex);
}
}
}
}
开发者ID:jordan49,项目名称:websitepanel,代码行数:20,代码来源:FileZilla.cs
示例17: ConvertItemToSharedSSLFolder
private static SharedSSLFolder ConvertItemToSharedSSLFolder(ServiceProviderItem item)
{
return (SharedSSLFolder)item;
}
开发者ID:jordan49,项目名称:websitepanel,代码行数:4,代码来源:WebServerController.cs
示例18: ChangeServiceItemsState
public override void ChangeServiceItemsState(ServiceProviderItem[] items, bool enabled)
{
foreach (ServiceProviderItem item in items)
{
if (item is MailDomain)
{
try
{
// enable/disable mail domain
if (DomainExists(item.Name))
{
MailDomain mailDomain = GetDomain(item.Name);
mailDomain.Enabled = enabled;
UpdateDomain(mailDomain);
}
}
catch (Exception ex)
{
Log.WriteError(String.Format("Error switching '{0}' SmarterMail domain", item.Name), ex);
}
}
}
}
开发者ID:jordan49,项目名称:websitepanel,代码行数:23,代码来源:SmarterMail7.cs
示例19: BackupItem
public int BackupItem(string tempFolder, System.Xml.XmlWriter writer, ServiceProviderItem item, ResourceGroupInfo group)
{
if (item is WebSite)
{
WebServer web = GetWebServer(item.ServiceId);
// read web site
WebSite itemSite = item as WebSite;
string siteId = itemSite.SiteId;
WebSite site = web.GetSite(siteId);
site.SiteId = itemSite.SiteId;
site.SiteIPAddressId = itemSite.SiteIPAddressId;
site.DataPath = itemSite.DataPath;
site.FrontPageAccount = itemSite.FrontPageAccount;
site.FrontPagePassword = itemSite.FrontPagePassword;
// serialize web site
XmlSerializer serializer = new XmlSerializer(typeof(WebSite));
serializer.Serialize(writer, site);
// process virtual directories
WebVirtualDirectory[] vdirs = web.GetVirtualDirectories(siteId);
foreach (WebVirtualDirectory vdirShort in vdirs)
{
WebVirtualDirectory vdir = web.GetVirtualDirectory(siteId, vdirShort.Name);
// serialize vdir
serializer = new XmlSerializer(typeof(WebVirtualDirectory));
serializer.Serialize(writer, vdir);
}
}
else if (item is SharedSSLFolder)
{
SharedSSLFolder sslFolder = GetSharedSSLFolder(item.Id);
// convert content path to physical
sslFolder.ContentPath = FilesController.GetFullPackagePath(item.PackageId, sslFolder.ContentPath);
XmlSerializer serializer = new XmlSerializer(typeof(SharedSSLFolder));
serializer.Serialize(writer, sslFolder);
}
return 0;
}
开发者ID:jordan49,项目名称:websitepanel,代码行数:44,代码来源:WebServerController.cs
示例20: GetServiceItemsDiskSpace
public override ServiceProviderItemDiskSpace[] GetServiceItemsDiskSpace(ServiceProviderItem[] items)
{
List<ServiceProviderItemDiskSpace> itemsDiskspace = new List<ServiceProviderItemDiskSpace>();
// update items with diskspace
foreach (ServiceProviderItem item in items)
{
if (item is MailAccount)
{
try
{
// get mailbox size
string name = item.Name;
// try to get SmarterMail postoffices path
string poPath = DomainsPath;
if (poPath == null)
continue;
string mailboxName = name.Substring(0, name.IndexOf("@"));
string domainName = name.Substring(name.IndexOf("@") + 1);
string mailboxPath = Path.Combine(DomainsPath, String.Format("{0}\\Users\\{1}", domainName, mailboxName));
Log.WriteStart(String.Format("Calculating '{0}' folder size", mailboxPath));
// calculate disk space
ServiceProviderItemDiskSpace diskspace = new ServiceProviderItemDiskSpace();
diskspace.ItemId = item.Id;
//diskspace.DiskSpace = 0;
diskspace.DiskSpace = FileUtils.CalculateFolderSize(mailboxPath);
itemsDiskspace.Add(diskspace);
Log.WriteEnd(String.Format("Calculating '{0}' folder size", mailboxPath));
}
catch (Exception ex)
{
Log.WriteError(ex);
}
}
}
return itemsDiskspace.ToArray();
}
开发者ID:jordan49,项目名称:websitepanel,代码行数:43,代码来源:SmarterMail7.cs
注:本文中的ServiceProviderItem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论