Example #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.");
            }
        }
        //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.";
            }
            
        }
Example #3
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;
            }
        }
Example #5
0
        public string DownloadAFile(string url)
        {
            try
            {
                LogDepartment.Log("Request For Download: " + url.ToString());
            }
            catch
            {
            }

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

            string filePath = System.Web.Hosting.HostingEnvironment.MapPath("~/Related_Files/newFile.txt");

            if (filePath != null)
            {
                File.WriteAllBytes(filePath, internetContact.NewReceivedByteArray);
            }

            SaveDataToCloud("newFile");
            return("completed download of: " + url.ToString());
        }
        public string DownloadAFile(string url)
        {
            try
            {
                LogDepartment.Log("Request For Download: " + url.ToString());
            }
            catch
            {
            }

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

            string filePath = System.Web.Hosting.HostingEnvironment.MapPath("~/Related_Files/newFile.txt");

            if (filePath != null)
            {
                File.WriteAllBytes(filePath, internetContact.NewReceivedByteArray);
            }

            SaveDataToCloud("newFile");
            return "completed download of: " + url.ToString();
        }