예제 #1
0
        public JettisonFile AddFileToJettison(Jettison jettison, string file)
        {
            JettisonFile newFile = new JettisonFile();

            newFile.FullPath = file;
            newFile.DropTime = DateTime.Now;
            jettison.JettisonFiles.Add(newFile);
            SaveDataFile();
            JFLog.Log(LogOperationType.Info, file + " was added");
            return(newFile);
        }
예제 #2
0
        private static void DisposeFile(Jettison j, string file, bool delete)
        {
            LogOperationType opType;

            if (delete)
            {
                try
                {
                    File.Delete(file);
                    opType = LogOperationType.Delete;
                }
                catch (Exception)
                {
                    opType = LogOperationType.DeleteFail;
                }
            }
            else
            {
                try {
                    FileOperationAPIWrapper.MoveToRecycleBin(file);
                    opType = LogOperationType.MoveToRecycleBin;
                }
                catch (Exception)
                {
                    opType = LogOperationType.MoveToRecycleBinFail;
                }
            }
            dh.RemoveFileFromJettison(j, file);

            if (settings["LogHistory"] == true)
            {
                JFLog.Log(opType, file);
            }

            if (settings["DisplayAlerts"] == true)
            {
                trayIcon.BalloonTipIcon  = System.Windows.Forms.ToolTipIcon.Info;
                trayIcon.BalloonTipTitle = "Jettison";
                trayIcon.BalloonTipText  = file + " was deleted";
                trayIcon.ShowBalloonTip(2000);
            }
        }