当前位置: 首页>>代码示例>>C#>>正文


C# ServiceProviderItem类代码示例

本文整理汇总了C#中ServiceProviderItem的典型用法代码示例。如果您正苦于以下问题:C# ServiceProviderItem类的具体用法?C# ServiceProviderItem怎么用?C# ServiceProviderItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ServiceProviderItem类属于命名空间,在下文中一共展示了ServiceProviderItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的ServiceProviderItem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。