コード例 #1
0
ファイル: Gene6FTP.cs プロジェクト: appliedi/websitepanel-1
        public override ServiceProviderItemBandwidth[] GetServiceItemsBandwidth(ServiceProviderItem[] items, DateTime since)
        {
            ServiceProviderItemBandwidth[] itemsBandwidth = new ServiceProviderItemBandwidth[items.Length];

            // create parser object
            // and update statistics
            LogParser parser = new LogParser("Gene6Ftp", SiteId, GetLogsPath(), "cs-username");

            parser.ParseLogs();

            // update items with diskspace
            for (int i = 0; i < items.Length; i++)
            {
                ServiceProviderItem item = items[i];

                // create new bandwidth object
                itemsBandwidth[i]        = new ServiceProviderItemBandwidth();
                itemsBandwidth[i].ItemId = item.Id;
                itemsBandwidth[i].Days   = new DailyStatistics[0];

                if (item is FtpAccount)
                {
                    try
                    {
                        // get daily statistics
                        itemsBandwidth[i].Days = parser.GetDailyStatistics(since, new string[] { item.Name });
                    }
                    catch (Exception ex)
                    {
                        Log.WriteError(ex);
                    }
                }
            }
            return(itemsBandwidth);
        }
コード例 #2
0
ファイル: MsFTP.cs プロジェクト: appliedi/websitepanel-1
        public override ServiceProviderItemBandwidth[] GetServiceItemsBandwidth(ServiceProviderItem[] items, DateTime since)
        {
            ServiceProviderItemBandwidth[] itemsBandwidth = new ServiceProviderItemBandwidth[items.Length];

            // calculate bandwidth for Default FTP Site
            FtpSite ftpSite  = GetSite(SiteId);
            string  siteId   = String.Concat("FTPSVC", ftpSite[FtpSite.MSFTP7_SITE_ID]);
            string  logsPath = Path.Combine(ftpSite.LogFileDirectory, siteId);

            // create parser object
            // and update statistics
            LogParser parser = new LogParser("Ftp", siteId, logsPath, "s-sitename", "cs-username");

            // Subscribe to the events because FTP 7.0 has several differences that should be taken into account
            // and processed in a specific way
            parser.ProcessKeyFields        += new ProcessKeyFieldsEventHandler(LogParser_ProcessKeyFields);
            parser.CalculateStatisticsLine += new CalculateStatsLineEventHandler(LogParser_CalculateStatisticsLine);
            //
            parser.ParseLogs();

            // update items with diskspace
            for (int i = 0; i < items.Length; i++)
            {
                ServiceProviderItem item = items[i];

                // create new bandwidth object
                itemsBandwidth[i]        = new ServiceProviderItemBandwidth();
                itemsBandwidth[i].ItemId = item.Id;
                itemsBandwidth[i].Days   = new DailyStatistics[0];

                if (item is FtpAccount)
                {
                    try
                    {
                        // get daily statistics
                        itemsBandwidth[i].Days = parser.GetDailyStatistics(since, new string[] { siteId, item.Name });
                    }
                    catch (Exception ex)
                    {
                        Log.WriteError(ex);
                    }
                }
            }
            return(itemsBandwidth);
        }
コード例 #3
0
        public override ServiceProviderItemBandwidth[] GetServiceItemsBandwidth(ServiceProviderItem[] items, DateTime since)
        {
            ServiceProviderItemBandwidth[] itemsBandwidth = new ServiceProviderItemBandwidth[items.Length];

            // calculate bandwidth for Default FTP Site
            FtpSite fptSite  = GetSite(SiteId);
            string  siteId   = SiteId.Replace("/", "");
            string  logsPath = Path.Combine(fptSite.LogFileDirectory, siteId);

            // create parser object
            // and update statistics
            LogParser parser = new LogParser("Ftp", siteId, logsPath, "s-sitename", "cs-username");

            parser.ParseLogs();

            // update items with diskspace
            for (int i = 0; i < items.Length; i++)
            {
                ServiceProviderItem item = items[i];

                // create new bandwidth object
                itemsBandwidth[i]        = new ServiceProviderItemBandwidth();
                itemsBandwidth[i].ItemId = item.Id;
                itemsBandwidth[i].Days   = new DailyStatistics[0];

                if (item is FtpAccount)
                {
                    try
                    {
                        // get daily statistics
                        itemsBandwidth[i].Days = parser.GetDailyStatistics(since, new string[] { siteId, item.Name });
                    }
                    catch (Exception ex)
                    {
                        Log.WriteError(ex);
                    }
                }
            }
            return(itemsBandwidth);
        }
コード例 #4
0
ファイル: IIs70.cs プロジェクト: jordan49/websitepanel
		public override ServiceProviderItemBandwidth[] GetServiceItemsBandwidth(ServiceProviderItem[] items, DateTime since)
		{
			ServiceProviderItemBandwidth[] itemsBandwidth = new ServiceProviderItemBandwidth[items.Length];

			// update items with diskspace
			for (int i = 0; i < items.Length; i++)
			{
				ServiceProviderItem item = items[i];

				// create new bandwidth object
				itemsBandwidth[i] = new ServiceProviderItemBandwidth();
				itemsBandwidth[i].ItemId = item.Id;
				itemsBandwidth[i].Days = new DailyStatistics[0];

				if (item is WebSite)
				{
					try
					{
						WebSite site = GetSite(item.Name);
						string siteId = site[WebSite.IIS7_SITE_ID];
						string logsPath = Path.Combine(site.LogsPath, siteId);

						if (!Directory.Exists(logsPath))
							continue;

						// create parser object
						// and update statistics
						LogParser parser = new LogParser("Web", siteId, logsPath, "s-sitename");
						parser.ParseLogs();

						// get daily statistics
						itemsBandwidth[i].Days = parser.GetDailyStatistics(since, new string[] { siteId });
					}
					catch (Exception ex)
					{
						Log.WriteError(ex);
					}
				}
			}
			return itemsBandwidth;
		}
コード例 #5
0
ファイル: Gene6FTP.cs プロジェクト: lwhitelock/Websitepanel
        public override ServiceProviderItemBandwidth[] GetServiceItemsBandwidth(ServiceProviderItem[] items, DateTime since)
        {
            ServiceProviderItemBandwidth[] itemsBandwidth = new ServiceProviderItemBandwidth[items.Length];

            // create parser object
            // and update statistics
            LogParser parser = new LogParser("Gene6Ftp", SiteId, GetLogsPath(), "cs-username");
            parser.ParseLogs();

            // update items with diskspace
            for (int i = 0; i < items.Length; i++)
            {
                ServiceProviderItem item = items[i];

                // create new bandwidth object
                itemsBandwidth[i] = new ServiceProviderItemBandwidth();
                itemsBandwidth[i].ItemId = item.Id;
                itemsBandwidth[i].Days = new DailyStatistics[0];

                if (item is FtpAccount)
                {
                    try
                    {
                        // get daily statistics
                        itemsBandwidth[i].Days = parser.GetDailyStatistics(since, new string[] { item.Name });
                    }
                    catch (Exception ex)
                    {
                        Log.WriteError(ex);
                    }
                }
            }
            return itemsBandwidth;
        }
コード例 #6
0
ファイル: MsFTP.cs プロジェクト: jordan49/websitepanel
        public override ServiceProviderItemBandwidth[] GetServiceItemsBandwidth(ServiceProviderItem[] items, DateTime since)
        {
            ServiceProviderItemBandwidth[] itemsBandwidth = new ServiceProviderItemBandwidth[items.Length];

            // calculate bandwidth for Default FTP Site
            FtpSite ftpSite = GetSite(SiteId);
			string siteId = String.Concat("FTPSVC", ftpSite[FtpSite.MSFTP7_SITE_ID]);
			string logsPath = Path.Combine(ftpSite.LogFileDirectory, siteId);

            // create parser object
            // and update statistics
            LogParser parser = new LogParser("Ftp", siteId, logsPath, "s-sitename", "cs-username");
			// Subscribe to the events because FTP 7.0 has several differences that should be taken into account
			// and processed in a specific way
			parser.ProcessKeyFields += new ProcessKeyFieldsEventHandler(LogParser_ProcessKeyFields);
			parser.CalculateStatisticsLine += new CalculateStatsLineEventHandler(LogParser_CalculateStatisticsLine);
			// 
            parser.ParseLogs();

            // update items with diskspace
            for (int i = 0; i < items.Length; i++)
            {
                ServiceProviderItem item = items[i];

                // create new bandwidth object
                itemsBandwidth[i] = new ServiceProviderItemBandwidth();
                itemsBandwidth[i].ItemId = item.Id;
                itemsBandwidth[i].Days = new DailyStatistics[0];

                if (item is FtpAccount)
                {
                    try
                    {
                        // get daily statistics
                        itemsBandwidth[i].Days = parser.GetDailyStatistics(since, new string[] { siteId, item.Name });
                    }
                    catch (Exception ex)
                    {
                        Log.WriteError(ex);
                    }
                }
            }
            return itemsBandwidth;
        }
コード例 #7
0
ファイル: MsFTP.cs プロジェクト: jordan49/websitepanel
        public override ServiceProviderItemBandwidth[] GetServiceItemsBandwidth(ServiceProviderItem[] items, DateTime since)
	    {
		    ServiceProviderItemBandwidth[] itemsBandwidth = new ServiceProviderItemBandwidth[items.Length];

		    // calculate bandwidth for Default FTP Site
		    FtpSite fptSite = GetSite(SiteId);
		    string siteId = SiteId.Replace("/", "");
            string logsPath = Path.Combine(fptSite.LogFileDirectory, siteId);

		    // create parser object
		    // and update statistics
		    LogParser parser = new LogParser("Ftp", siteId, logsPath, "s-sitename", "cs-username");
		    parser.ParseLogs();

		    // update items with diskspace
		    for (int i = 0; i < items.Length; i++)
		    {
                ServiceProviderItem item = items[i];

			    // create new bandwidth object
			    itemsBandwidth[i] = new ServiceProviderItemBandwidth();
			    itemsBandwidth[i].ItemId = item.Id;
			    itemsBandwidth[i].Days = new DailyStatistics[0];

			    if (item is FtpAccount)
			    {
				    try
				    {
					    // get daily statistics
					    itemsBandwidth[i].Days = parser.GetDailyStatistics(since, new string[] { siteId, item.Name });
				    }
				    catch (Exception ex)
				    {
					    Log.WriteError(ex);
				    }
			    }
		    }
		    return itemsBandwidth;
	    }