ScreenToGif/Util/ClipBoard.cs

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.IO;
using ScreenToGif.FileWriters;
using ScreenToGif.Util.Model;

namespace ScreenToGif.Util
{
    public static class Clipboard
    {
        #region Properties

        private static string Folder { get; set; }

        private static string CurrentFolder { get; set; }

        public static List<List<FrameInfo>> Items { get; private set; } = new List<List<FrameInfo>>();

        #endregion

        #region Public Methods

        /// <summary>
        /// Copies the selected frames to a Clipboard folder.
        /// </summary>
        /// <param name="target">The selected frames.</param>
        /// <returns>The selected copied frames.</returns>
        public static bool Copy(List<FrameInfo> target)
        {
            try
            {
                PrepareCurrent(target[0].Path);

                var newList = new List<FrameInfo>();

                foreach (var frameInfo in target)
                {
                    //Changes the path of the image.
                    var filename = Path.Combine(CurrentFolder, Path.GetFileName(frameInfo.Path));

                    //Copy the image to the folder.
                    File.Copy(frameInfo.Path, filename, true);

                    //Create the new object and add to the list.
                    newList.Add(new FrameInfo(filename, frameInfo.Delay));
                }

                //Adds the current copied list to the clipboard.
                Items.Add(newList);
                return true;
            }
            catch (Exception ex)
            {
                LogWriter.Log(ex, "Copy to Clipboard");
                return false;
            }
        }

        /// <summary>
        /// Cuts the selected frames to a Clipboard folder.
后面还有 100 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。