예제 #1
0
        public string GetData(int value)
        {
            // TEST: DELETE LATER
            LogDepartment.Log("Done creation process");

            return(string.Format("You entered: {0}", value));
        }
예제 #2
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.");
            }
        }
예제 #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);
            }
        }
예제 #4
0
        //public string SaveDataToCloud(Object data)
        public string SaveDataToCloud(string filename = "Log")
        {
            try
            {
                userData = new UserDataStoreDepartment();
                userData.SaveInfo("username", "password", filename);

                try
                {
                    LogDepartment.Log("Save data cloud to success: " + filename);
                }
                catch
                {
                }

                return("Success");
            }
            catch (Exception e)
            {
                return(e.ToString() + " Unsucess");
            }
        }
예제 #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());
        }