Example #1
0
        protected override void FileAction(string fileName, string rawLocation)
        {
            string location = rawLocation + "\\" + fileName;

            try
            {
                File.SetCreationTime(@location, newTime.ToTime());
                RuntimeVariables.GetInstance().Success();
                Logger.GetInstance().LogCommand("Modification of " + fileName + " is now " + newTime.ToString());
            }
            catch (Exception ex)
            {
                RuntimeVariables.GetInstance().Failure();

                if (ex is IOException || ex is UnauthorizedAccessException)
                {
                    throw new CommandException("Action ignored! Access denied during changing creation time of " + fileName + ".");
                }
                else
                {
                    throw new CommandException("Action ignored! Something went wrong during changing creation time of " + fileName + ".");
                }
            }
        }