Exemplo n.º 1
0
        private static void HandleUpdate(ClipboardData data)
        {
            if (data.IsEmpty)
            {
                return;
            }

            if (SameAsLast(data))
            {
                return;
            }

            if (IsEnabled)
            {
                if (Time.Now <= lastUpdate + updateTimeout)
                {
                    History[0] = data;
                }
                else
                {
                    History.Push(data);
                    GuiTool.Tooltip("saved", 500);
                }

                lastUpdate = Time.Now;
            }
        }
Exemplo n.º 2
0
 public static bool SameAsLast(ClipboardData data)
 {
     if (History.Count == 0)
     {
         return(false);
     }
     if (data.HasText && History[0].HasText && data.GetText() == History[0].GetText())
     {
         return(true);
     }
     if (data.HasImage && SameAsLast(data.GetImage()))
     {
         return(true);
     }
     return(false);
 }