mirror of
https://github.com/achiez/NebulaAuth-Steam-Desktop-Authenticator-by-Achies.git
synced 2026-07-25 06:14:31 +00:00
60 lines
1.3 KiB
C#
60 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Specialized;
|
|
using System.Windows;
|
|
using NebulaAuth.Core;
|
|
using NebulaAuth.Model;
|
|
|
|
namespace NebulaAuth.Utility;
|
|
|
|
public class ClipboardHelper
|
|
{
|
|
public static bool Set(string text)
|
|
{
|
|
var i = 0;
|
|
while (i < 20)
|
|
{
|
|
try
|
|
{
|
|
Clipboard.SetText(text);
|
|
return true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
if (i == 19)
|
|
{
|
|
Shell.Logger.Error(ex);
|
|
SnackbarController.SendSnackbar(LocManager.GetCommonOrDefault("Error", "Error"));
|
|
}
|
|
}
|
|
|
|
i++;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
public static bool SetFiles(StringCollection files)
|
|
{
|
|
var i = 0;
|
|
while (i < 20)
|
|
{
|
|
try
|
|
{
|
|
Clipboard.SetFileDropList(files);
|
|
return true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
if (i == 19)
|
|
{
|
|
Shell.Logger.Error(ex);
|
|
SnackbarController.SendSnackbar(LocManager.GetCommonOrDefault("Error", "Error"));
|
|
}
|
|
}
|
|
|
|
i++;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
} |