Beispiel #1
0
        //public Stream GetData(Uri url)
        public string GetDataTest(string uri)
        {
            try
            {
                Uri url = new Uri(uri);
                // TEST: DELETE LATER
                try
                {
                    LogDepartment.Log("Request Got for: " + url.ToString());
                }
                catch
                {
                }

                internetContact = new InternetContactDepartment();
                internetContact.SendReceiveRequest(url);

                comDep = new CompressorDepartment();
                comDep.CompressBytes(internetContact.NewReceivedByteArray);

                //return comDep.CompressedStream.Length.ToString();
                return(comDep.CompressedStream.ToString());
            }
            catch (Exception e)
            {
                return(e.ToString() + "Error in execution of the server codes.");
            }
        }
Beispiel #2
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;
            }
        }
        //public Stream GetData(Uri url)
        public string GetDataTest(string uri)
        {
            try
            {
                Uri url = new Uri(uri);
                // TEST: DELETE LATER
                try
                {
                    LogDepartment.Log("Request Got for: " + url.ToString());
                }
                catch
                {
                }

                internetContact = new InternetContactDepartment();
                internetContact.SendReceiveRequest(url);

                comDep = new CompressorDepartment();
                comDep.CompressBytes(internetContact.NewReceivedByteArray);

                //return comDep.CompressedStream.Length.ToString();
                return comDep.CompressedStream.ToString();
            }
            catch(Exception e)
            {
                return e.ToString()+"Error in execution of the server codes.";
            }
            
        }