Esempio n. 1
0
        public Stream GetData(Uri url)
        //public string GetData(Uri url)
        {
            try
            {
                // TEST: DELETE LATER
                try {
                    LogDepartment.Log("Request Got for: " + url.ToString());
                }
                catch
                {
                }

                internetContact = new InternetContactDepartment();
                internetContact.SendReceiveRequest(url);
                sizeOriginal = internetContact.NewReceivedByteArray.Length.ToString();

                DAMFD = new DataAnalyzeModifyFilterDepartment();
                DAMFD.RemoveScriptsStyleComment(internetContact.NewReceivedByteArray);

                DAMFD.RemoveHrefs(internetContact.NewReceivedByteArray);

                comDep = new CompressorDepartment();
                //comDep.CompressBytes(internetContact.NewReceivedByteArray);
                comDep.CompressBytes(DAMFD.ModifiedByte);

                sizeResult = comDep.CompressedStream.Length.ToString();

                //return comDep.CompressedStream.Length.ToString();
                return(comDep.CompressedStream);
            }
            catch (Exception e)
            {
                string test      = "Error: " + e.ToString();
                byte[] byteArray = Encoding.ASCII.GetBytes(test);

                comDep = new CompressorDepartment();
                comDep.CompressBytes(byteArray);

                return(comDep.CompressedStream);
            }
        }
        public Stream GetData(Uri url)
        //public string GetData(Uri url)
        {
            try
            {
                // TEST: DELETE LATER
                try {
                    LogDepartment.Log("Request Got for: " + url.ToString());
                }
                catch
                {
                }
                
                internetContact = new InternetContactDepartment();
                internetContact.SendReceiveRequest(url);
                sizeOriginal = internetContact.NewReceivedByteArray.Length.ToString();

                DAMFD =new DataAnalyzeModifyFilterDepartment();
                DAMFD.RemoveScriptsStyleComment(internetContact.NewReceivedByteArray);

                DAMFD.RemoveHrefs(internetContact.NewReceivedByteArray);

                comDep = new CompressorDepartment();
                //comDep.CompressBytes(internetContact.NewReceivedByteArray);
                comDep.CompressBytes(DAMFD.ModifiedByte);

                sizeResult = comDep.CompressedStream.Length.ToString();

                //return comDep.CompressedStream.Length.ToString();
                return comDep.CompressedStream;
            }
            catch (Exception e)
            {
                string test = "Error: "+e.ToString();
                byte[] byteArray = Encoding.ASCII.GetBytes(test);

                comDep = new CompressorDepartment();
                comDep.CompressBytes(byteArray);

                return comDep.CompressedStream;
            }
        }