Beispiel #1
0
 public void Open(ClientPipelineArgs args)
 {
     Assert.ArgumentNotNull((object)args, "args");
     if (args.IsPostBack)
     {
         if (args.Result.Length <= 0 || !(args.Result != "undefined"))
         {
             return;
         }
         string file = UserLogForm.GetFile(args.Result);
         if (string.IsNullOrEmpty(file))
         {
             SheerResponse.Alert("You can only open log files.");
         }
         else
         {
             this.SetFile(file);
         }
     }
     else
     {
         SheerResponse.Alert("File location: " + Settings.LogFolder);
         Files.ListFiles("Open Log File", " ", "Software/32x32/text_code_colored.png", "Open", Settings.LogFolder, "*log*.txt", false);
         args.WaitForPostBack();
     }
 }
Beispiel #2
0
        public void Zip(Message message)
        {
            Assert.ArgumentNotNull((object)message, "message");
            string file1 = Context.ClientPage.ServerProperties["File"] as string;

            if (file1 == null)
            {
                Context.ClientPage.ClientResponse.Alert("You must open a log file first.");
            }
            else
            {
                if (string.IsNullOrEmpty(file1))
                {
                    return;
                }
                string file2 = UserLogForm.GetFile(file1);
                if (string.IsNullOrEmpty(file2))
                {
                    return;
                }
                Files.Zip(string.Empty, new string[1]
                {
                    file2
                });
                Context.ClientPage.ClientResponse.Alert("The log file has been zipped.");
            }
        }
Beispiel #3
0
        public void Delete(ClientPipelineArgs args)
        {
            Assert.ArgumentNotNull((object)args, "args");
            string @string = StringUtil.GetString(Context.ClientPage.ServerProperties["File"]);

            if (args.IsPostBack)
            {
                if (!(args.Result == "yes"))
                {
                    return;
                }
                string path = FileUtil.MapPath(UserLogForm.GetFile(@string));
                if (string.IsNullOrEmpty(path))
                {
                    return;
                }
                try
                {
                    File.Delete(path);
                    Log.Audit((object)this, "Delete log file {0}", new string[1]
                    {
                        path
                    });
                    this.SetFile(string.Empty);
                }
                catch (Exception ex)
                {
                    SheerResponse.Alert("The file could not be deleted.\n\nError message:\n" + ex.Message);
                }
            }
            else if (Context.ClientPage.ServerProperties["File"] == null)
            {
                Context.ClientPage.ClientResponse.Alert("You must open a log file first.");
            }
            else
            {
                SheerResponse.Confirm(Translate.Text("Are you sure you want to delete \"{0}\"?", (object)@string));
                args.WaitForPostBack();
            }
        }
Beispiel #4
0
        public void Download(Message message)
        {
            Assert.ArgumentNotNull((object)message, "message");
            string file1 = Context.ClientPage.ServerProperties["File"] as string;

            if (file1 == null)
            {
                Context.ClientPage.ClientResponse.Alert("You must open a log file first.");
            }
            else
            {
                if (string.IsNullOrEmpty(file1))
                {
                    return;
                }
                string file2 = UserLogForm.GetFile(file1);
                if (string.IsNullOrEmpty(file2))
                {
                    return;
                }
                Files.Download(TempFolder.CreateTempFile(file2));
            }
        }