コード例 #1
0
ファイル: UserAgentFeature.cs プロジェクト: thpy/temp
        private void RunW3cext(string id, List <string> header, string[] item)
        {
            //int val = 0;

            int index  = header.IndexOf("date");
            int index2 = header.IndexOf("cs(User-Agent)");

            if (index == -1 || index2 == -1)
            {
                return;
            }

            string key  = item[index];
            string data = item[index2];

            string path = String.Format("{0}\\Temp\\{1}\\", Environment.CurrentDirectory, id);

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            if (!string.IsNullOrEmpty(data) && data != "-")
            {
                string browser = CheckBrowser(data);

                FeatureLogFile logFile = new FeatureLogFile();

                string generalFile = String.Format("{0}{1}-General.tmp", path, _featureName.ToString());
                logFile.LogFile = generalFile;
                logFile.UpdateCount(string.Format("{0}-{1}", key, browser), 1);
            }
        }
コード例 #2
0
        private void RunW3cext(string id, List <string> header, string[] item)
        {
            int index  = header.IndexOf("date");
            int index2 = header.IndexOf("s-ip");

            if (index == -1 || index2 == -1)
            {
                return;
            }

            string key  = item[index];
            string key2 = item[index2];

            try
            {
                string path = String.Format("{0}\\Temp\\{1}\\", Environment.CurrentDirectory, id);
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }

                if (!string.IsNullOrEmpty(key) && key != "-")
                {
                    FeatureLogFile logFile = new FeatureLogFile();

                    string generalFile = String.Format("{0}{1}-General.tmp", path, _featureName.ToString());
                    logFile.LogFile = generalFile;
                    logFile.InsertUniqueData(key);


                    string totalFile = String.Format("{0}{1}-TotalData.tmp", path, _featureName.ToString());
                    logFile.LogFile = totalFile;
                    logFile.UpdateCount("total", 1);
                }
                if (!string.IsNullOrEmpty(key2) && key2 != "-")
                {
                    FeatureLogFile logFile    = new FeatureLogFile();
                    string         serverFile = String.Format("{0}{1}-IPServer.tmp", path, _featureName.ToString());

                    logFile.LogFile = serverFile;
                    logFile.InsertUniqueData(key2);
                }
            }
            catch (Exception err)
            {
                System.Diagnostics.Debug.WriteLine(String.Format("GeneralFeature Error: {0}", err.Message));
            }
        }
コード例 #3
0
ファイル: RequestFeature.cs プロジェクト: xargon180/Indihiang
        private void RunW3cext(string id, List <string> header, string[] item)
        {
            int index1 = header.IndexOf("cs-uri-stem");
            int index2 = header.IndexOf("time-taken");

            if (index1 == -1 || index2 == -1)
            {
                return;
            }

            string data1;

            if (index1 > 0)
            {
                data1 = item[index1];
            }
            else
            {
                data1 = string.Empty;
            }
            string data2;

            if (index2 > 0)
            {
                data2 = item[index2];
            }
            else
            {
                data2 = string.Empty;
            }

            string path = String.Format("{0}\\Temp\\{1}\\", Environment.CurrentDirectory, id);

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            if (!string.IsNullOrEmpty(data1) && data1 != "-" && !string.IsNullOrEmpty(data2) && data2 != "-")
            {
                FeatureLogFile logFile       = new FeatureLogFile();
                string         timeTakenFile = String.Format("{0}{1}-TimeTaken.tmp", path, _featureName.ToString());
                logFile.LogFile = timeTakenFile;
                logFile.InsertData(data1, data2);
            }
        }
コード例 #4
0
        private void RunW3cext(string id, List <string> header, string[] item)
        {
            if (header == null || item == null)
            {
                return;
            }

            if (header.Count <= 0 || item.Length <= 0)
            {
                return;
            }

            int index  = header.IndexOf("date");
            int index2 = header.IndexOf("sc-status");

            if (index == -1 || index2 == -1)
            {
                return;
            }
            if (index2 > item.Length)
            {
                return;
            }

            string key     = item[index];
            string dataKey = item[index2];

            string path = String.Format("{0}\\Temp\\{1}\\", Environment.CurrentDirectory, id);

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            if (!string.IsNullOrEmpty(dataKey) && dataKey != "-")
            {
                FeatureLogFile logFile = new FeatureLogFile();

                string generalFile = String.Format("{0}{1}-General.tmp", path, _featureName.ToString());
                logFile.LogFile = generalFile;
                logFile.UpdateCount(string.Format("{0}-{1}", key, dataKey), 1);
            }
        }
コード例 #5
0
ファイル: HitsFeature.cs プロジェクト: thpy/temp
        private void RunW3cext(string id, List <string> header, string[] item)
        {
            int index = header.IndexOf("date");

            if (index == -1)
            {
                return;
            }

            string key = item[index];

            string path = String.Format("{0}\\Temp\\{1}\\", Environment.CurrentDirectory, id);

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            FeatureLogFile logFile     = new FeatureLogFile();
            string         generalFile = String.Format("{0}{1}-General.tmp", path, _featureName.ToString());

            logFile.LogFile = generalFile;
            logFile.UpdateCount(key, 1);
        }
コード例 #6
0
ファイル: IPAddressFeature.cs プロジェクト: thpy/temp
        private void RunW3cext(string id, List <string> header, string[] item)
        {
            if (header == null)
            {
                return;
            }
            if (header.Count <= 0)
            {
                return;
            }

            int    index = header.IndexOf("date");
            string key;

            if (index != -1)
            {
                key = item[index];
            }
            else
            {
                key = null;
            }
            int    index2 = header.IndexOf("c-ip");
            string key2;

            if (index2 != -1)
            {
                key2 = item[index2];
            }
            else
            {
                key2 = null;
            }
            int    index3 = header.IndexOf("cs-uri-stem");
            string key3;

            if (index3 != -1)
            {
                key3 = item[index3];
            }
            else
            {
                key3 = null;
            }


            string path = String.Format("{0}\\Temp\\{1}\\", Environment.CurrentDirectory, id);

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            if (!string.IsNullOrEmpty(key) && key != "-")
            {
                if (!string.IsNullOrEmpty(key2) && key2 != "-")
                {
                    FeatureLogFile logFile     = new FeatureLogFile();
                    string         generalFile = String.Format("{0}{1}-General.tmp", path, _featureName.ToString());
                    logFile.LogFile = generalFile;
                    logFile.UpdateCount("total", 1);

                    if (!string.IsNullOrEmpty(key3))
                    {
                        string ipPageFile = String.Format("{0}{1}-IPPage.tmp", path, _featureName.ToString());
                        logFile.LogFile = ipPageFile;
                        logFile.UpdateCount(string.Format("{0}-{1}", key2, key3), 1);
                    }
                }
            }
        }
コード例 #7
0
        private void RunW3cext(string id, List <string> header, string[] item)
        {
            if (header == null)
            {
                return;
            }

            long val    = 0;
            int  index  = header.IndexOf("date");
            int  index2 = header.IndexOf("cs-uri-stem");
            int  index3 = header.IndexOf("sc-bytes");
            int  index4 = header.IndexOf("cs-bytes");
            int  index5 = header.IndexOf("c-ip");

            if (index == -1)
            {
                return;
            }

            string key = item[index];

            string data1;

            if (index2 > 0 && index2 <= item.Length)
            {
                data1 = item[index2];
            }
            else
            {
                data1 = string.Empty;
            }
            string data2;

            if (index3 > 0 && index3 <= item.Length)
            {
                data2 = item[index3];
            }
            else
            {
                data2 = string.Empty;
            }
            string data3;

            if (index4 > 0 && index4 <= item.Length)
            {
                data3 = item[index4];
            }
            else
            {
                data3 = string.Empty;
            }

            string data4;

            if (index5 > 0 && index5 <= item.Length)
            {
                data4 = item[index5];
            }
            else
            {
                data4 = string.Empty;
            }


            string path = String.Format("{0}\\Temp\\{1}\\", Environment.CurrentDirectory, id);

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }


            #region BytesSent
            if (!string.IsNullOrEmpty(data1) && data1 != "-")
            {
                FeatureLogFile logFile       = new FeatureLogFile();
                string         bytesSentFile = String.Format("{0}{1}-BytesSent.tmp", path, _featureName.ToString());
                logFile.LogFile = bytesSentFile;

                if (!string.IsNullOrEmpty(data2) && data2 != "-")
                {
                    val = Convert.ToInt64(data2);
                    logFile.UpdateCount(string.Format("{0}-{1}", key, data1), val);
                }
            }
            #endregion

            #region ByteReceived
            if (!string.IsNullOrEmpty(data1) && data1 != "-")
            {
                FeatureLogFile logFile      = new FeatureLogFile();
                string         byteReceived = String.Format("{0}{1}-ByteReceived.tmp", path, _featureName.ToString());
                logFile.LogFile = byteReceived;

                if (!string.IsNullOrEmpty(data3) && data3 != "-")
                {
                    val = Convert.ToInt64(data3);
                    logFile.UpdateCount(string.Format("{0}-{1}", key, data1), val);
                }
            }
            #endregion

            #region ByteIPClient
            if (!string.IsNullOrEmpty(data4) && data4 != "-")
            {
                FeatureLogFile logFile      = new FeatureLogFile();
                string         byteIPClient = String.Format("{0}{1}-ByteIPClient.tmp", path, _featureName.ToString());
                logFile.LogFile = byteIPClient;

                if (!string.IsNullOrEmpty(data2) && data2 != "-")
                {
                    val = Convert.ToInt64(data2);
                    logFile.UpdateCount(string.Format("{0}-{1}-Sent", key, data4), val);
                }
                if (!string.IsNullOrEmpty(data3) && data3 != "-")
                {
                    val = Convert.ToInt64(data3);
                    logFile.UpdateCount(string.Format("{0}-{1}-Received", key, data4), val);
                }
            }
            #endregion
        }