Esempio n. 1
0
 // add new request
 public static RequestDto AddNewRequest(RequestDto requestDto)
 {
     try
     {
         // converts the URL to a recording format
         requestDto.content          = "VERSION BUILD = 1005 RECORDER = CR\nURL GOTO =  " + requestDto.content + " \nSAVEAS TYPE = HTML FOLDER =D:\\Files FILE =newHtml";
         requestDto.recording_stream = Encoding.ASCII.GetBytes(requestDto.content);
         Status status = Run(requestDto.content, "");
         // Robotic surfing for keeping the initial state of the page
         if (status == Status.sOk)
         {
             // Read the page content
             string newPlay = File.ReadAllText("D:\\Files\\newHtml.htm");
             // fill in the data
             requestDto.file_stream = Encoding.ASCII.GetBytes(newPlay);
             requestDto.file_id     = RequestDAL.AttachedFile(requestDto.file_stream, ".html");
             // add to database
             RequestDto requestsDto = RequestDAL.AddNewRequest(requestDto);
             return(requestsDto);
         }
     }
     catch (Exception)
     {
         return(null);
     }
     return(null);
 }