Иконка ресурса

FREE Copylog : 1.0.2 1.0.2

Нет прав для скачивания
C#:
using System;
using System.IO;
using Newtonsoft.Json;

namespace Oxide.Plugins
{
    [Info("Copylog", "Soller", "1.0.2")]
    [Description("Copy console log file")]
    public class Copylog : RustPlugin
    {
        private void CopyLogFile()
        {
            string logFilePath = @"console.log";
            string currentTime = DateTime.Now.ToString("dd.MM.yyyy - HH'h 'mm'm 'ss's'");
            string destinationDirectory = Path.Combine("oxide", "logs", "Console_log");
            string destinationPath = Path.Combine(destinationDirectory, $"console_{currentTime}.log");

            try
            {
                if (!Directory.Exists(destinationDirectory))
                {
                    Directory.CreateDirectory(destinationDirectory);
                }

                File.Copy(logFilePath, destinationPath, true);
                PrintWarning($"File {logFilePath} copied successfully to {destinationPath}");
            }
            catch (Exception ex)
            {
                PrintError($"An error occurred while copying the file: {ex.Message}");
            }
        }

        [ConsoleCommand("copylog")]
        private void CopyFileCommand(ConsoleSystem.Arg arg)
        {
            if (arg.Connection != null && arg.Connection.authLevel < 2)
            {
                arg.ReplyWith("You need to be an admin to use this command.");
                return;
            }

            CopyLogFile();
        }
    }
}

Автор
15FPS
Скачиваний
0
Просмотры
1
Первый выпуск
Обновление
Оценка
0.00 звёзд 0 оценок
Сверху