public void ProcessRequest(HttpContext context)
 {
     try
     {
         string filePath = context.Request.QueryString["file_path"];
         context.Session["current_path"] = filePath;
         if (DriveInfo.GetDrives().ToList().Find((DriveInfo driveInfo) => driveInfo.Name == filePath) != null)
         {
             context.Session["parent_path"] = "";
         }
         else if (Directory.Exists(filePath))
         {
             context.Session["parent_path"] = new DirectoryInfo(filePath).Parent.FullName;
         }
         else if (File.Exists(filePath))
         {
             context.Session["parent_path"] = new FileInfo(filePath).FullName;
         }
         context.Response.Redirect("Main.aspx");
     }
     catch (Exception e)
     {
         MyExceptionHandler.SaveException(e);
     }
 }
 public void ProcessRequest(HttpContext context)
 {
     try
     {
         string parentFilePath = context.Session["parent_path"].ToString();
         string ancestorFilePath;
         if (parentFilePath == "")
         {
             ancestorFilePath = "";
         }
         else if (DriveInfo.GetDrives().ToList().Find((DriveInfo driveInfo) => driveInfo.Name == parentFilePath) != null)
         {
             ancestorFilePath = "";
         }
         else
         {
             ancestorFilePath = new DirectoryInfo(parentFilePath).Parent.FullName;
         }
         context.Session["current_path"] = parentFilePath;
         context.Session["parent_path"]  = ancestorFilePath;
         context.Response.Redirect("Main.aspx");
     }
     catch (Exception e)
     {
         MyExceptionHandler.SaveException(e);
     }
 }
 public void ProcessRequest(HttpContext context)
 {
     try
     {
         string filePath = context.Request.QueryString["file_path"];
         string fileType = context.Request.QueryString["file_type"];
         context.Session["current_path"] = filePath;
         if (fileType == "directory")
         {
             context.Session["parent_path"] = new DirectoryInfo(filePath).Parent.FullName;
         }
         else if (fileType == "file")
         {
             context.Session["parent_path"] = new FileInfo(filePath).Directory.FullName;
         }
         else if (fileType == "drive")
         {
             context.Session["parent_path"] = "";
         }
         context.Response.Redirect("Main.aspx");
     }
     catch (Exception e)
     {
         MyExceptionHandler.SaveException(e);
     }
 }
 public void ProcessRequest(HttpContext context)
 {
     try
     {
         string copyFilePath    = context.Session["copy_file_path"].ToString();
         string copyFileType    = context.Session["copy_file_type"].ToString();
         string currentFilePath = context.Session["current_path"].ToString();
         if (copyFileType == "file")
         {
             FileInfo fileInfo = new FileInfo(copyFilePath);
             string   a        = $"{currentFilePath}\\{fileInfo.Name}";
             fileInfo.MoveTo($"{currentFilePath}\\{fileInfo.Name}");
         }
         else if (copyFileType == "directory")
         {
             DirectoryInfo directoryInfo = new DirectoryInfo(copyFilePath);
             directoryInfo.MoveTo(currentFilePath);
         }
         context.Response.Redirect("Main.aspx");
     }
     catch (Exception e)
     {
         MyExceptionHandler.SaveException(e);
     }
 }
Exemple #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         InitialPath();
         ShowFile();
         ShowPasteFile();
         ShowCurrentFile();
     }
     catch (Exception exception)
     {
         MyExceptionHandler.SaveException(exception);
     }
 }
Exemple #6
0
 public void ProcessRequest(HttpContext context)
 {
     try
     {
         context.Session["copy_file_type"] = context.Request.QueryString["copy_file_type"].ToString();
         context.Session["copy_file_path"] = context.Request.QueryString["copy_file_path"].ToString();
         context.Session["copy_file_name"] = context.Request.QueryString["copy_file_name"].ToString();
         context.Response.Redirect("Main.aspx");
     }
     catch (Exception e)
     {
         MyExceptionHandler.SaveException(e);
     }
 }
 //刘庆科修改1
 public void ProcessRequest(HttpContext context)
 {
     try
     {
         string       fileContent  = context.Request.QueryString["file_content"];
         string       filePath     = context.Session["current_path"].ToString();
         FileInfo     fileInfo     = new FileInfo(filePath);
         StreamWriter streamWriter = fileInfo.CreateText();
         streamWriter.Write(fileContent);
         streamWriter.Dispose();
         context.Response.Redirect("Main.aspx");
     }
     catch (Exception e)
     {
         MyExceptionHandler.SaveException(e);
     }
 }
Exemple #8
0
 public void ProcessRequest(HttpContext context)
 {
     try
     {
         string fileType = context.Request.QueryString["file_type"].ToString();
         string filePath = context.Request.QueryString["file_path"].ToString();
         if (fileType == "file")
         {
             File.Create(filePath).Close();
         }
         else if (fileType == "directory")
         {
             Directory.CreateDirectory(filePath);
         }
         context.Response.Redirect("Main.aspx");
     }
     catch (Exception e)
     {
         MyExceptionHandler.SaveException(e);
     }
 }