repo
stringclasses
183 values
ref
stringlengths
40
40
path
stringlengths
8
198
prompt
stringlengths
0
24.6k
suffix
stringlengths
0
24.5k
canonical_solution
stringlengths
30
18.1k
lang
stringclasses
12 values
timestamp
timestamp[s]date
2019-12-19 23:00:04
2025-03-02 18:12:33
2dust/v2rayN
79a0538ca0ea952ff7b14b368e9bbabf7928019c
v2rayN/ServiceLib/Global.cs
namespace ServiceLib { public class Global { #region const public const string AppName = "v2rayN"; public const string GithubUrl = "https://github.com"; public const string GithubApiUrl = "https://api.github.com/repos"; public const string GeoUrl = "https://github.com/Lo...
#endregion const } }
public static readonly Dictionary<ECoreType, string> CoreUrls = new() { { ECoreType.v2fly, "v2fly/v2ray-core" }, { ECoreType.v2fly_v5, "v2fly/v2ray-core" }, { ECoreType.Xray, "XTLS/Xray-core" }, { ECoreType.sing_box, "SagerNet/sing-box" }, { ECoreType....
csharp
2025-02-03T12:19:20
2dust/v2rayN
e6b27d17e40ad392d33bfda4ff5cd926bbea54a5
v2rayN/ServiceLib/Global.cs
namespace ServiceLib { public class Global { #region const public const string AppName = "v2rayN"; public const string GithubUrl = "https://github.com"; public const string GithubApiUrl = "https://api.github.com/repos"; public const string V2flyCoreUrl = "https://github....
public const string SingboxRulesetUrl = @"https://raw.githubusercontent.com/2dust/sing-box-rules/rule-set-{0}/{1}.srs"; public const string IPAPIUrl = "https://api.ip.sb/geoip"; public const string PromotionUrl = @"aHR0cHM6Ly85LjIzNDQ1Ni54eXovYWJjLmh0bWw="; public const string ConfigFi...
public const string OvertlsCoreUrl = "https://github.com/ShadowsocksR-Live/overtls/releases";
csharp
2025-02-03T07:43:26
2dust/v2rayN
e6b27d17e40ad392d33bfda4ff5cd926bbea54a5
v2rayN/ServiceLib/Handler/CoreInfoHandler.cs
namespace ServiceLib.Handler { public sealed class CoreInfoHandler { private static readonly Lazy<CoreInfoHandler> _instance = new(() => new()); private List<CoreInfo>? _coreInfo; public static CoreInfoHandler Instance => _instance.Value; public CoreInfoHandler() { ...
} ]; } private string PortableMode() { return $" -d {Utils.GetBinPath("").AppendQuotes()}"; } } }
}, new CoreInfo { CoreType = ECoreType.overtls, CoreExes = [ "overtls-bin", "overtls"], Arguments = "-r client -c {0}", Url = Global.OvertlsCoreUrl, AbsolutePath = false,
csharp
2025-02-03T07:43:26
2dust/v2rayN
2a0012824abb0dc5f2cb893ad510a01b9cd9d703
v2rayN/ServiceLib/Global.cs
namespace ServiceLib { public class Global { #region const public const string AppName = "v2rayN"; public const string GithubUrl = "https://github.com"; public const string GithubApiUrl = "https://api.github.com/repos"; public const string V2flyCoreUrl = "https://github....
public const string SingboxRulesetUrl = @"https://raw.githubusercontent.com/2dust/sing-box-rules/rule-set-{0}/{1}.srs"; public const string IPAPIUrl = "https://api.ip.sb/geoip"; public const string PromotionUrl = @"aHR0cHM6Ly85LjIzNDQ1Ni54eXovYWJjLmh0bWw="; public const string ConfigFi...
public const string BrookCoreUrl = "https://github.com/txthinking/brook/releases";
csharp
2025-02-03T07:06:21
2dust/v2rayN
b2feaf3ba986863ce337b1de8f0731a7ca27c791
v2rayN/ServiceLib/Handler/AutoStartupHandler.cs
using System.Diagnostics; using System.Security.Principal; using System.Text.RegularExpressions; namespace ServiceLib.Handler { public static class AutoStartupHandler { private static readonly string _tag = "AutoStartupHandler"; public static async Task<bool> UpdateTask(Config config) ...
} }
#region macOS private static async Task ClearTaskOSX() { try { var launchAgentPath = GetLaunchAgentPathMacOS(); if (File.Exists(launchAgentPath)) { var args = new[] { "-c", $"launchctl unload -w \"{launchAgentPath}\"" }; await Utils....
csharp
2025-01-30T05:24:01
2dust/v2rayN
c0f8b6b84ca3920992b0f310d4f51538f52a83c0
v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs
using Avalonia; using Avalonia.Controls; using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Controls.Notifications; using Avalonia.Input; using Avalonia.Interactivity; using Avalonia.ReactiveUI; using Avalonia.Threading; using DialogHostAvalonia; using MsBox.Avalonia.Enums; using ReactiveUI; using Splat; usi...
this.Hide(); } else { this.WindowState = WindowState.Minimized; } } _config.UiItem.ShowInTaskbar = bl; } private void RestoreUI() { if (_config.UiItem.MainWidth > 0 && _config.UiItem.MainHeight > 0)...
foreach (var ownedWindow in this.OwnedWindows) { ownedWindow.Close(); }
csharp
2025-01-30T02:12:59
2dust/v2rayN
54fe669d89fc4c347cbc52fea95bb3a9114a3451
v2rayN/ServiceLib/Handler/CoreHandler.cs
using System.Diagnostics; using System.Text; namespace ServiceLib.Handler { /// <summary> /// Core process processing class /// </summary> public class CoreHandler { private static readonly Lazy<CoreHandler> _instance = new(() => new()); public static CoreHandler Instance => _insta...
if (Utils.IsNonWindows()) { var coreInfo = CoreInfoHandler.Instance.GetCoreInfo(); foreach (var it in coreInfo) { if (it.CoreType == ECoreType.v2rayN) { if (Utils.UpgradeAppExists(ou...
//Copy the bin folder to the storage location (for init) if (Environment.GetEnvironmentVariable(Global.LocalAppData) == "1") { var fromPath = Utils.GetBaseDirectory("bin"); var toPath = Utils.GetBinPath(""); if (fromPath != toPath) ...
csharp
2025-01-18T08:58:44
2dust/v2rayN
cf1a8599eb08efb32b3d984a5c33378853e04fd4
v2rayN/AmazTool/UpgradeApp.cs
using System.Diagnostics; using System.IO.Compression; using System.Text; namespace AmazTool { internal class UpgradeApp { public static void Upgrade(string fileName) { Console.WriteLine($"{Resx.Resource.StartUnzipping}\n{fileName}"); Utils.Waiting(5); if ...
entry.ExtractToFile(entryOutputPath, true); Console.WriteLine(entryOutputPath); } catch (Exception ex) { sb.Append(ex.StackTrace); } } } ...
//In the bin folder, if the file already exists, it will be skipped if (fullName.StartsWith("bin") && File.Exists(entryOutputPath)) { continue; }
csharp
2025-01-17T02:27:29
2dust/v2rayN
cf1a8599eb08efb32b3d984a5c33378853e04fd4
v2rayN/AmazTool/Utils.cs
using System.Diagnostics; namespace AmazTool { internal class Utils { public static string GetExePath() { return Environment.ProcessPath ?? Process.GetCurrentProcess().MainModule?.FileName ?? string.Empty; } public static string StartupPath() { ...
} }
public static void Waiting(int second) { for (var i = second; i > 0; i--) { Console.WriteLine(i); Thread.Sleep(1000); } }
csharp
2025-01-17T02:27:29
2dust/v2rayN
de1132c2df5422a16d454be0e49007be8a9c2894
v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml.cs
using Avalonia.Controls; using Avalonia.ReactiveUI; using ReactiveUI; using System.Reactive.Disposables; namespace v2rayN.Desktop.Views { public partial class OptionSettingWindow : ReactiveWindow<OptionSettingViewModel> { private static Config _config; public OptionSettingWindow() { ...
this.Bind(ViewModel, vm => vm.KeepOlderDedupl, v => v.togKeepOlderDedupl.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.EnableAutoAdjustMainLvColWidth, v => v.togEnableAutoAdjustMainLvColWidth.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, ...
this.Bind(ViewModel, vm => vm.DisplayRealTimeSpeed, v => v.togDisplayRealTimeSpeed.IsChecked).DisposeWith(disposables);
csharp
2025-01-15T11:45:53
2dust/v2rayN
de1132c2df5422a16d454be0e49007be8a9c2894
v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs
using ReactiveUI; using System.Globalization; using System.IO; using System.Reactive.Disposables; using System.Windows; using System.Windows.Media; namespace v2rayN.Views { public partial class OptionSettingWindow { private static Config _config; public OptionSettingWindow() { ...
this.Bind(ViewModel, vm => vm.KeepOlderDedupl, v => v.togKeepOlderDedupl.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.EnableAutoAdjustMainLvColWidth, v => v.togEnableAutoAdjustMainLvColWidth.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, ...
this.Bind(ViewModel, vm => vm.DisplayRealTimeSpeed, v => v.togDisplayRealTimeSpeed.IsChecked).DisposeWith(disposables);
csharp
2025-01-15T11:45:53
2dust/v2rayN
4ad4e27dc102088c42b613e484b10ad745b6fdd5
v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs
using ReactiveUI; using ReactiveUI.Fody.Helpers; using Splat; using System.Reactive; namespace ServiceLib.ViewModels { public class MainWindowViewModel : MyReactiveObject { #region Menu //servers public ReactiveCommand<Unit, Unit> AddVmessServerCmd { get; } public ReactiveComm...
} public void ReloadResult() { // BlReloadEnabled = true; //Locator.Current.GetService<StatusBarViewModel>()?.ChangeSystemProxyAsync(_config.systemProxyItem.sysProxyType, false); ShowClashUI = _config.IsRunningCore(ECoreType.sing_box); if (ShowCl...
BlReloadEnabled = true; if (_hasNextReloadJob) { _hasNextReloadJob = false; await Reload(); }
csharp
2025-01-14T09:05:13
2dust/v2rayN
73706849859bb13f2680355065b488a886565bb8
v2rayN/ServiceLib/Common/FileManager.cs
using System.Formats.Tar; using System.IO.Compression; using System.Text; namespace ServiceLib.Common { public static class FileManager { private static readonly string _tag = "FileManager"; public static bool ByteArrayToFile(string fileName, byte[] content) { try ...
} }
public static void DeleteExpiredFiles(string sourceDir, DateTime dtLine) { try { var files = Directory.GetFiles(sourceDir, "*.*"); foreach (var filePath in files) { var file = new FileInfo(filePath); ...
csharp
2025-01-14T09:04:43
2dust/v2rayN
5ae58e6a980f0d21ca8f11dad2492840262bcaab
v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs
using ReactiveUI; using ReactiveUI.Fody.Helpers; using Splat; using System.Reactive; namespace ServiceLib.ViewModels { public class MainWindowViewModel : MyReactiveObject { #region Menu //servers public ReactiveCommand<Unit, Unit> AddVmessServerCmd { get; } public ReactiveComm...
BlReloadEnabled = false; await LoadCore(); Locator.Current.GetService<StatusBarViewModel>()?.TestServerAvailability(); await SysProxyHandler.UpdateSysProxy(_config, false); _updateView?.Invoke(EViewAction.DispatcherReload, null); } public ...
//If there are unfinished reload job, wait a few seconds and exec again. if (!BlReloadEnabled) { await Task.Delay(3000); if (times > 3) return; await Reload(++times); return; }
csharp
2025-01-14T06:49:17
2dust/v2rayN
780ccb193256cce45b6be7fe28d1bd727f3eb63d
v2rayN/ServiceLib/Handler/AppHandler.cs
namespace ServiceLib.Handler { public sealed class AppHandler { #region Property private static readonly Lazy<AppHandler> _instance = new(() => new()); private Config _config; private int? _statePort; private int? _statePort2; private Job? _processJob; p...
} #endregion Init #region Config public int GetLocalPort(EInboundProtocol protocol) { var localPort = _config.Inbound.FirstOrDefault(t => t.Protocol == nameof(EInboundProtocol.socks))?.LocalPort ?? 10808; return localPort + (int)protocol; } ...
} private void ClearTemps() { Task.Run(() => { try { var now = DateTime.Now.AddMonths(-1); var dir = Utils.GetTempPath(); var files = Directory.GetFiles(dir, "*.*"); f...
csharp
2025-01-14T03:48:02
2dust/v2rayN
7a8680711e38b9b1b947c401b9063c2a8abd560e
v2rayN/ServiceLib/Global.cs
namespace ServiceLib { public class Global { #region const public const string AppName = "v2rayN"; public const string GithubUrl = "https://github.com"; public const string GithubApiUrl = "https://api.github.com/repos"; public const string V2flyCoreUrl = "https://github...
public const string UserEMail = "t@t.tt"; public const string AutoRunRegPath = @"Software\Microsoft\Windows\CurrentVersion\Run"; public const string AutoRunName = "v2rayNAutoRun"; public const string CustomIconName = "v2rayN.ico"; public const string SystemProxyExceptionsWindow...
public const string Socks5Protocol = "socks5://";
csharp
2025-01-12T06:30:49
2dust/v2rayN
649e89e7af497a52b91b1daed731136f66767726
v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs
using DynamicData.Binding; using ReactiveUI; using ReactiveUI.Fody.Helpers; using Splat; using System.Reactive; using System.Text; namespace ServiceLib.ViewModels { public class StatusBarViewModel : MyReactiveObject { #region ObservableCollection private IObservableCollection<RoutingItem> _ro...
} private async Task AddServerViaClipboard() { var service = Locator.Current.GetService<MainWindowViewModel>(); if (service != null) await service.AddServerViaClipboardAsync(null); } private async Task AddServerViaScan() { var servic...
} private async Task CopyProxyCmdToClipboard() { var cmd = Utils.IsWindows() ? "set" : "export"; var address = $"{Global.Loopback}:{AppHandler.Instance.GetLocalPort(EInboundProtocol.socks)}"; var sb = new StringBuilder(); sb.AppendLine($"{cmd} http_proxy...
csharp
2025-01-12T03:07:34
2dust/v2rayN
649e89e7af497a52b91b1daed731136f66767726
v2rayN/v2rayN.Desktop/Views/StatusBarView.axaml.cs
using Avalonia; using Avalonia.Controls; using Avalonia.Controls.ApplicationLifetimes; using Avalonia.ReactiveUI; using Avalonia.Threading; using ReactiveUI; using Splat; using System.Reactive.Disposables; using v2rayN.Desktop.Common; namespace v2rayN.Desktop.Views { public partial class StatusBarView : ReactiveUs...
} return await Task.FromResult(true); } private void RefreshIcon() { if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) { desktop.MainWindow.Icon = AvaUtils.GetAppIcon(_config.SystemPr...
case EViewAction.SetClipboardData: if (obj is null) return false; await AvaUtils.SetClipboardData(this, (string)obj); break;
csharp
2025-01-12T03:07:34
2dust/v2rayN
649e89e7af497a52b91b1daed731136f66767726
v2rayN/v2rayN/Views/StatusBarView.xaml.cs
using ReactiveUI; using Splat; using System.Reactive.Disposables; using System.Windows; using System.Windows.Input; using System.Windows.Threading; using v2rayN.Handler; namespace v2rayN.Views { public partial class StatusBarView { private static Config _config; public StatusBarView() ...
break; } return await Task.FromResult(true); } private async void menuExit_Click(object sender, RoutedEventArgs e) { tbNotify.Dispose(); var service = Locator.Current.GetService<MainWindowViewModel>(); if (service ...
break; case EViewAction.SetClipboardData: if (obj is null) return false; WindowsUtils.SetClipboardData((string)obj);
csharp
2025-01-12T03:07:34
2dust/v2rayN
364a24c5802ae40167e5a91a7405939bc2eb9854
v2rayN/ServiceLib/Handler/StatisticsHandler.cs
namespace ServiceLib.Handler { public class StatisticsHandler { private static readonly Lazy<StatisticsHandler> instance = new(() => new()); public static StatisticsHandler Instance => instance.Value; private Config _config; private ServerStatItem? _serverStatItem; priv...
var stat = _lstServerStat.FirstOrDefault(t => t.IndexId == indexId); if (stat == null) { return; } var toStat = JsonUtils.DeepCopy(stat); toStat.IndexId = toIndexId; await SQLiteHelper.Instance.ReplaceAsync(toStat); ...
if(indexId == toIndexId) { return; }
csharp
2025-01-11T06:44:09
2dust/v2rayN
40915b5f989b6f95a8d9b0d1e0e8387fa6d2a6a0
v2rayN/v2rayN/Views/ThemeSettingView.xaml.cs
using ReactiveUI; using System.Reactive.Disposables; using v2rayN.ViewModels; namespace v2rayN.Views { /// <summary> /// ThemeSettingView.xaml /// </summary> public partial class ThemeSettingView { public ThemeSettingView() { InitializeComponent(); ViewModel...
for (int i = Global.MinFontSize; i <= Global.MinFontSize + 10; i++) { cmbCurrentFontSize.Items.Add(i.ToString()); } Global.Languages.ForEach(it => { cmbCurrentLanguage.Items.Add(it); }); this.WhenActi...
foreach (ETheme it in Enum.GetValues(typeof(ETheme))) { if ((int)it > 2) continue; cmbCurrentTheme.Items.Add(it.ToString()); }
csharp
2025-01-11T03:23:40
2dust/v2rayN
a176613119e579fb726088d1f22073dc8e9558ba
v2rayN/ServiceLib/Common/ProcUtils.cs
using System.Diagnostics; namespace ServiceLib.Common; public static class ProcUtils { private static readonly string _tag = "ProcUtils"; public static void ProcessStart(string? fileName, string arguments = "") { ProcessStart(fileName, arguments, null); } public static int? ProcessStart(...
if (review && procId != null && fileName != null) { try { var lstProc = Process.GetProcessesByName(processName); foreach (var proc2 in lstProc) { if (proc2.Id == procId) { ...
await ProcessKillByKeyInfo(review, procId, fileName, processName); } private static void GetProcessKeyInfo(Process? proc, bool review, out int? procId, out string? fileName, out string? processName) { procId = null; fileName = null; processName = null; if (!review) return; ...
csharp
2025-01-11T02:44:34
2dust/v2rayN
a176613119e579fb726088d1f22073dc8e9558ba
v2rayN/ServiceLib/Handler/CoreHandler.cs
using System.Diagnostics; using System.Text; namespace ServiceLib.Handler { /// <summary> /// Core process processing class /// </summary> public class CoreHandler { private static readonly Lazy<CoreHandler> _instance = new(() => new()); public static CoreHandler Instance => _insta...
if (proc.WaitForExit(1000)) { proc.CancelErrorRead(); throw new Exception(displayLog ? startUpErrorMessage.ToString() : "启动进程失败并退出 (Failed to start the process and exited)"); } else { ...
AppHandler.Instance.AddProcess(proc.Handle);
csharp
2025-01-11T02:44:34
2dust/v2rayN
edbd168dcf3f6b78235a40e41026bd0b4054b8f9
v2rayN/ServiceLib/Models/ConfigItems.cs
namespace ServiceLib.Models { [Serializable] public class CoreBasicItem { public bool LogEnabled { get; set; } public string Loglevel { get; set; } public bool MuxEnabled { get; set; } public bool DefAllowInsecure { get; set; } public string DefFingerprint { get;...
public string CurrentLanguage { get; set; } public string CurrentFontFamily { get; set; } public int CurrentFontSize { get; set; } public bool EnableDragDropSort { get; set; } public bool DoubleClick2Activate { get; set; } public bool AutoHideStartup { get; set; } ...
public string? CurrentTheme { get; set; }
csharp
2025-01-10T07:53:06
2dust/v2rayN
edbd168dcf3f6b78235a40e41026bd0b4054b8f9
v2rayN/v2rayN.Desktop/Views/ThemeSettingView.axaml.cs
using Avalonia; using Avalonia.ReactiveUI; using ReactiveUI; using System.Reactive.Disposables; using v2rayN.Desktop.ViewModels; namespace v2rayN.Desktop.Views { /// <summary> /// ThemeSettingView.xaml /// </summary> public partial class ThemeSettingView : ReactiveUserControl<ThemeSettingViewModel> ...
for (int i = Global.MinFontSize; i <= Global.MinFontSize + 10; i++) { cmbCurrentFontSize.Items.Add(i); } Global.Languages.ForEach(it => { cmbCurrentLanguage.Items.Add(it); }); this.WhenActivated(dispo...
foreach (ETheme it in Enum.GetValues(typeof(ETheme))) { cmbCurrentTheme.Items.Add(it.ToString()); }
csharp
2025-01-10T07:53:06
2dust/v2rayN
127858d5822ef8eabad9f8e4432b719f5756ebf1
v2rayN/v2rayN.Desktop/Views/QrcodeView.axaml.cs
using Avalonia.Controls; using Avalonia.Media.Imaging; namespace v2rayN.Desktop.Views { public partial class QrcodeView : UserControl {
public QrcodeView(string? url) { InitializeComponent(); txtContent.Text = url; imgQrcode.Source = GetQRCode(url); // btnCancel.Click += (s, e) => this.Close(); } private Bitmap? GetQRCode(string? url) { var bytes =...
public QrcodeView() { InitializeComponent(); }
csharp
2025-01-10T06:23:03
2dust/v2rayN
e0ae101ff4ca160c5b88ac2c642816f17ca4ce07
v2rayN/v2rayN.Desktop/Common/UI.cs
using Avalonia.Controls; using Avalonia.Platform.Storage; using MsBox.Avalonia; using MsBox.Avalonia.Enums; namespace v2rayN.Desktop.Common { internal class UI { private static readonly string caption = Global.AppName; public static async Task<ButtonResult> ShowYesNo(Window owner, string msg)...
} } }
} private static IStorageProvider? GetStorageProvider(Window owner) { var topLevel = TopLevel.GetTopLevel(owner); return topLevel?.StorageProvider;
csharp
2025-01-09T07:14:03
2dust/v2rayN
db934e70cb1576f05c989585c42e7d879ca1b030
v2rayN/v2rayN.Desktop/Common/AvaUtils.cs
using Avalonia; using Avalonia.Controls; using Avalonia.Input; using Avalonia.Media.Imaging; using Avalonia.Platform; namespace v2rayN.Desktop.Common { internal class AvaUtils { public static async Task<string?> GetClipboardData(Window owner) { try { var...
var uri = new Uri(Path.Combine(Global.AvaAssets, $"NotifyIcon{index}.ico")); using var bitmap = new Bitmap(AssetLoader.Open(uri)); return new(bitmap); } } }
var fileName = Utils.GetPath($"NotifyIcon{index}.ico"); if (File.Exists(fileName)) { return new(fileName); }
csharp
2025-01-08T12:35:33
2dust/v2rayN
b770048f050b8d5501c158c5808f3c3f9695a234
v2rayN/ServiceLib/Common/JsonUtils.cs
using System.Text.Json; using System.Text.Json.Nodes; using System.Text.Json.Serialization; namespace ServiceLib.Common { public class JsonUtils { private static readonly string _tag = "JsonUtils"; /// <summary> /// DeepCopy /// </summary> /// <typeparam name="T"></typ...
/// SerializeToNode /// </summary> /// <param name="obj"></param> /// <returns></returns> public static JsonNode? SerializeToNode(object? obj) => JsonSerializer.SerializeToNode(obj); } }
/// Serialize Object to Json string /// </summary> /// <param name="obj"></param> /// <param name="options"></param> /// <returns></returns> public static string Serialize(object? obj, JsonSerializerOptions options) { var result = string.Empty; try...
csharp
2025-01-08T09:57:23
2dust/v2rayN
d93c12b354cdf8a4cb310269eb7fb3b989e22feb
v2rayN/ServiceLib/Models/Config.cs
namespace ServiceLib.Models { /// <summary> /// 本软件配置文件实体类 /// </summary> [Serializable] public class Config { #region property public string IndexId { get; set; } public string SubIndexId { get; set; } public ECoreType RunningCoreType { get; set; } pu...
public List<InItem> Inbound { get; set; } public List<KeyEventItem> GlobalHotkeys { get; set; } public List<CoreTypeItem> CoreTypeItem { get; set; } #endregion other entities } }
public Fragment4RayItem? Fragment4RayItem { get; set; }
csharp
2025-01-08T05:52:21
2dust/v2rayN
e63042af848c93140d2fe6f2ef3cbf0cf7bb2be2
v2rayN/v2rayN.Desktop/ViewModels/ThemeSettingViewModel.cs
using Avalonia; using Avalonia.Controls; using Avalonia.Controls.Notifications; using Avalonia.Controls.Primitives; using Avalonia.Media; using Avalonia.Styling; using ReactiveUI; using ReactiveUI.Fody.Helpers; using System.Reactive.Linq; namespace v2rayN.Desktop.ViewModels { public class ThemeSettingViewModel : M...
Style style = new(x => Selectors.Or( x.OfType<Button>(), x.OfType<TextBox>(), x.OfType<TextBlock>(), x.OfType<Menu>(), x.OfType<ContextMenu>(), x.OfType<DataGridRow>(), x.OfType<ListBoxItem>(), ...
if (size < Global.MinFontSize) return;
csharp
2025-01-05T11:10:12
2dust/v2rayN
4a7bafd01121698886319f5fa89d2b40f6c12930
v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs
using Avalonia; using Avalonia.Controls; using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Controls.Notifications; using Avalonia.Input; using Avalonia.Interactivity; using Avalonia.ReactiveUI; using Avalonia.Threading; using DialogHostAvalonia; using MsBox.Avalonia.Enums; using ReactiveUI; using Splat; usi...
StorageUI(); if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) { desktop.Shutdown(); } break; case EViewAction.ScanScreenTask: ...
if (obj != null && _blCloseByUser == false) { _blCloseByUser = (bool)obj; }
csharp
2025-01-05T02:22:18
2dust/v2rayN
bc2adbfa771abeb49bce59adb741f3b0f485ce45
v2rayN/ServiceLib/ViewModels/BackupAndRestoreViewModel.cs
using ReactiveUI; using ReactiveUI.Fody.Helpers; using Splat; using System.Reactive; namespace ServiceLib.ViewModels { public class BackupAndRestoreViewModel : MyReactiveObject { private readonly string _guiConfigs = "guiConfigs"; private static string BackupFileName => $"backup_{DateTime.Now:...
service?.Shutdown(); } else { DisplayOperationMsg(WebDavHandler.Instance.GetLastError()); } } private async Task<bool> CreateZipFileFromDirectory(string fileName) { if (Utils.IsNullOrEmpty(fileName)) ...
else { if (Utils.UpgradeAppExists(out var upgradeFileName)) { ProcUtils.ProcessStart(upgradeFileName, Global.RebootAs, Utils.StartupPath()); } }
csharp
2025-01-04T09:03:12
2dust/v2rayN
5732b84a7b9457169625da48fc17608569eb6482
v2rayN/ServiceLib/Common/ProcUtils.cs
using System.Diagnostics; namespace ServiceLib.Common; public static class ProcUtils { private static readonly string _tag = "ProcUtils"; public static void ProcessStart(string? fileName, string arguments = "") { ProcessStart(fileName, arguments, null); } public static int? ProcessStart(...
}
public static async Task ProcessKill(int pid) { try { await ProcessKill(Process.GetProcessById(pid), false); } catch (Exception ex) { Logging.SaveLog(_tag, ex); } } public static async Task ProcessKill(Process? proc, bool review) {...
csharp
2025-01-04T07:06:30
2dust/v2rayN
5732b84a7b9457169625da48fc17608569eb6482
v2rayN/ServiceLib/Handler/CoreInfoHandler.cs
namespace ServiceLib.Handler { public sealed class CoreInfoHandler { private static readonly Lazy<CoreInfoHandler> _instance = new(() => new()); private List<CoreInfo>? _coreInfo; public static CoreInfoHandler Instance => _instance.Value; public CoreInfoHandler() { ...
private void InitCoreInfo() { _coreInfo = []; _coreInfo.Add(new CoreInfo { CoreType = ECoreType.v2rayN, Url = Global.NUrl, ReleaseApiUrl = Global.NUrl.Replace(Global.GithubUrl, Global.GithubApiUrl), Do...
public string GetCoreExecFile(CoreInfo? coreInfo, out string msg) { var fileName = string.Empty; msg = string.Empty; foreach (var name in coreInfo?.CoreExes) { var vName = Utils.GetBinPath(Utils.GetExeName(name), coreInfo.CoreType.ToString()); ...
csharp
2025-01-04T07:06:30
2dust/v2rayN
3db1dd7bbbd9ee61c85321c131c740c3576fad77
v2rayN/ServiceLib/Common/FileManager.cs
using System.Formats.Tar; using System.IO.Compression; using System.Text; namespace ServiceLib.Common { public static class FileManager {
public static bool ByteArrayToFile(string fileName, byte[] content) { try { File.WriteAllBytes(fileName, content); return true; } catch (Exception ex) { Logging.SaveLog(_tag, ex); } ...
private static readonly string _tag = "FileManager";
csharp
2025-01-03T07:02:31
2dust/v2rayN
3db1dd7bbbd9ee61c85321c131c740c3576fad77
v2rayN/ServiceLib/Common/JsonUtils.cs
using System.Text.Json; using System.Text.Json.Nodes; using System.Text.Json.Serialization; namespace ServiceLib.Common { public class JsonUtils {
/// <summary> /// DeepCopy /// </summary> /// <typeparam name="T"></typeparam> /// <param name="obj"></param> /// <returns></returns> public static T DeepCopy<T>(T obj) { return Deserialize<T>(Serialize(obj, false))!; } /// <...
private static readonly string _tag = "JsonUtils";
csharp
2025-01-03T07:02:31
2dust/v2rayN
3db1dd7bbbd9ee61c85321c131c740c3576fad77
v2rayN/ServiceLib/Common/WindowsUtils.cs
using Microsoft.Win32; namespace ServiceLib.Common { internal static class WindowsUtils {
public static string? RegReadValue(string path, string name, string def) { RegistryKey? regKey = null; try { regKey = Registry.CurrentUser.OpenSubKey(path, false); var value = regKey?.GetValue(name) as string; return Ut...
private static readonly string _tag = "WindowsUtils";
csharp
2025-01-03T07:02:31
2dust/v2rayN
3db1dd7bbbd9ee61c85321c131c740c3576fad77
v2rayN/ServiceLib/Common/YamlUtils.cs
using YamlDotNet.Core; using YamlDotNet.Serialization; using YamlDotNet.Serialization.NamingConventions; namespace ServiceLib.Common { public class YamlUtils {
#region YAML /// <summary> /// 反序列化成对象 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="str"></param> /// <returns></returns> public static T FromYaml<T>(string str) { var deserializer = new DeserializerBuilder() ...
private static readonly string _tag = "YamlUtils";
csharp
2025-01-03T07:02:31
2dust/v2rayN
3db1dd7bbbd9ee61c85321c131c740c3576fad77
v2rayN/ServiceLib/Handler/AutoStartupHandler.cs
using System.Security.Principal; using System.Text.RegularExpressions; namespace ServiceLib.Handler { public static class AutoStartupHandler {
public static async Task<bool> UpdateTask(Config config) { if (Utils.IsWindows()) { await ClearTaskWindows(); if (config.GuiItem.AutoRun) { await SetTaskWindows(); } } e...
private static readonly string _tag = "AutoStartupHandler";
csharp
2025-01-03T07:02:31
2dust/v2rayN
3db1dd7bbbd9ee61c85321c131c740c3576fad77
v2rayN/ServiceLib/Handler/ClashApiHandler.cs
using static ServiceLib.Models.ClashProxies; namespace ServiceLib.Handler { public sealed class ClashApiHandler { private static readonly Lazy<ClashApiHandler> instance = new(() => new()); public static ClashApiHandler Instance => instance.Value; private Dictionary<string, ProxiesItem...
public async Task<Tuple<ClashProxies, ClashProviders>?> GetClashProxiesAsync(Config config) { for (var i = 0; i < 5; i++) { var url = $"{GetApiUrl()}/proxies"; var result = await HttpClientHelper.Instance.TryGetAsync(url); var cla...
private static readonly string _tag = "ClashApiHandler";
csharp
2025-01-03T07:02:31
2dust/v2rayN
3db1dd7bbbd9ee61c85321c131c740c3576fad77
v2rayN/ServiceLib/Handler/CoreConfigHandler.cs
using YamlDotNet.Core.Tokens; namespace ServiceLib.Handler { /// <summary> /// Core configuration file processing class /// </summary> public class CoreConfigHandler {
public static async Task<RetResult> GenerateClientConfig(ProfileItem node, string? fileName) { var config = AppHandler.Instance.Config; var result = new RetResult(); if (node.ConfigType == EConfigType.Custom) { result = node.CoreType swi...
private static readonly string _tag = "CoreConfigHandler";
csharp
2025-01-03T07:02:31
2dust/v2rayN
3db1dd7bbbd9ee61c85321c131c740c3576fad77
v2rayN/ServiceLib/Handler/SysProxy/SysProxyHandler.cs
namespace ServiceLib.Handler.SysProxy { public static class SysProxyHandler {
public static async Task<bool> UpdateSysProxy(Config config, bool forceDisable) { var type = config.SystemProxyItem.SysProxyType; if (forceDisable && type != ESysProxyType.Unchanged) { type = ESysProxyType.ForcedClear; } try ...
private static readonly string _tag = "SysProxyHandler";
csharp
2025-01-03T07:02:31
2dust/v2rayN
3db1dd7bbbd9ee61c85321c131c740c3576fad77
v2rayN/ServiceLib/Services/CoreConfig/CoreConfigClashService.cs
namespace ServiceLib.Services.CoreConfig { /// <summary> /// Core configuration file processing class /// </summary> public class CoreConfigClashService { private Config _config;
public CoreConfigClashService(Config config) { _config = config; } /// <summary> /// 生成配置文件 /// </summary> /// <param name="node"></param> /// <param name="fileName"></param> /// <param name="msg"></param> /// <returns></retu...
private static readonly string _tag = "CoreConfigClashService";
csharp
2025-01-03T07:02:31
2dust/v2rayN
3db1dd7bbbd9ee61c85321c131c740c3576fad77
v2rayN/ServiceLib/Services/DownloadService.cs
using System.Diagnostics; using System.Net; using System.Net.Http.Headers; using System.Net.Sockets; namespace ServiceLib.Services { /// <summary> ///Download /// </summary> public class DownloadService { public event EventHandler<RetResult>? UpdateCompleted; public event ErrorEve...
public async Task<int> DownloadDataAsync(string url, WebProxy webProxy, int downloadTimeout, Action<bool, string> updateFunc) { try { SetSecurityProtocol(AppHandler.Instance.Config.GuiItem.EnableSecurityProtocolTls13); var progress = new Progres...
private static readonly string _tag = "DownloadService";
csharp
2025-01-03T07:02:31
2dust/v2rayN
3db1dd7bbbd9ee61c85321c131c740c3576fad77
v2rayN/ServiceLib/Services/SpeedtestService.cs
using ReactiveUI; using System.Diagnostics; using System.Net; using System.Net.Sockets; namespace ServiceLib.Services { public class SpeedtestService { private Config? _config; private Action<SpeedTestResult>? _updateFunc; private bool _exitLoop = false;
public SpeedtestService(Config config, List<ProfileItem> selecteds, ESpeedActionType actionType, Action<SpeedTestResult> updateFunc) { _config = config; _updateFunc = updateFunc; var lstSelected = new List<ServerTestItem>(); foreach (var it in selecteds...
private static readonly string _tag = "SpeedtestService";
csharp
2025-01-03T07:02:31
2dust/v2rayN
3db1dd7bbbd9ee61c85321c131c740c3576fad77
v2rayN/ServiceLib/Services/Statistics/StatisticsSingboxService.cs
using System.Net.WebSockets; using System.Text; namespace ServiceLib.Services.Statistics { public class StatisticsSingboxService { private Config _config; private bool _exitFlag; private ClientWebSocket? webSocket; private Action<ServerSpeedItem>? _updateFunc; private s...
public StatisticsSingboxService(Config config, Action<ServerSpeedItem> updateFunc) { _config = config; _updateFunc = updateFunc; _exitFlag = false; Task.Run(Run); } private async void Init() { await Task.Delay(5000);...
private static readonly string _tag = "StatisticsSingboxService";
csharp
2025-01-03T07:02:31
2dust/v2rayN
3db1dd7bbbd9ee61c85321c131c740c3576fad77
v2rayN/ServiceLib/Services/UpdateService.cs
using System.Runtime.InteropServices; using System.Text.RegularExpressions; namespace ServiceLib.Services { public class UpdateService { private Action<bool, string>? _updateFunc; private int _timeout = 30;
public async Task CheckUpdateGuiN(Config config, Action<bool, string> updateFunc, bool preRelease) { _updateFunc = updateFunc; var url = string.Empty; var fileName = string.Empty; DownloadService downloadHandle = new(); downloadHandle.Update...
private static readonly string _tag = "UpdateService";
csharp
2025-01-03T07:02:31
2dust/v2rayN
3db1dd7bbbd9ee61c85321c131c740c3576fad77
v2rayN/v2rayN/Common/WindowsUtils.cs
using Microsoft.Win32; using System.Diagnostics; using System.Drawing; using System.Runtime.InteropServices; using System.Security.Cryptography; using System.Text; using System.Windows; using System.Windows.Interop; using System.Windows.Media; using System.Windows.Media.Imaging; namespace v2rayN { internal static...
/// <summary> /// 获取剪贴板数 /// </summary> /// <returns></returns> public static string? GetClipboardData() { string? strData = string.Empty; try { IDataObject data = Clipboard.GetDataObject(); if (data.Get...
private static readonly string _tag = "WindowsUtils";
csharp
2025-01-03T07:02:31
2dust/v2rayN
3db1dd7bbbd9ee61c85321c131c740c3576fad77
v2rayN/v2rayN/Handler/WindowsHandler.cs
using System.Drawing; using System.IO; using System.Windows.Media.Imaging; namespace v2rayN.Handler { public sealed class WindowsHandler { private static readonly Lazy<WindowsHandler> instance = new(() => new()); public static WindowsHandler Instance => instance.Value;
public async Task<Icon> GetNotifyIcon(Config config) { try { var index = (int)config.SystemProxyItem.SysProxyType; //Load from routing setting var createdIcon = await GetNotifyIcon4Routing(config); if (createdIcon...
private static readonly string _tag = "WindowsHandler";
csharp
2025-01-03T07:02:31
2dust/v2rayN
7884853098a0c5642433672f5b368affd18072ee
v2rayN/ServiceLib/Common/SqliteHelper.cs
using SQLite; using System.Collections; namespace ServiceLib.Common { public sealed class SQLiteHelper { private static readonly Lazy<SQLiteHelper> _instance = new(() => new()); public static SQLiteHelper Instance => _instance.Value; private string _connstr; private SQLiteConne...
} }
public async Task DisposeDbConnectionAsync() { await Task.Factory.StartNew(() => { _db?.Close(); _db?.Dispose(); _db = null; _dbAsync?.GetConnection()?.Close(); _dbAsync?.GetConnection()?.Dispose(); ...
csharp
2025-01-02T05:36:26
2dust/v2rayN
7884853098a0c5642433672f5b368affd18072ee
v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs
using ReactiveUI; using ReactiveUI.Fody.Helpers; using Splat; using System.Diagnostics; using System.Reactive; using System.Reactive.Linq; namespace ServiceLib.ViewModels { public class MainWindowViewModel : MyReactiveObject { #region Menu //servers public ReactiveCommand<Unit, Unit> A...
#endregion Actions #region Servers && Groups private void RefreshServers() { MessageBus.Current.SendMessage("", EMsgCommand.RefreshProfiles.ToString()); } private void RefreshSubscriptions() { Locator.Current.GetService<ProfilesViewMod...
public void Shutdown() { _updateView?.Invoke(EViewAction.Shutdown, null); }
csharp
2025-01-02T05:36:26
2dust/v2rayNG
e55e069fe3c4502ce1a93755c4a2cd3ff9f21ed2
V2rayNG/app/src/main/java/com/v2ray/ang/dto/ProfileItem.kt
package com.v2ray.ang.dto import com.v2ray.ang.AppConfig.LOOPBACK import com.v2ray.ang.AppConfig.PORT_SOCKS import com.v2ray.ang.AppConfig.TAG_BLOCKED import com.v2ray.ang.AppConfig.TAG_DIRECT import com.v2ray.ang.AppConfig.TAG_PROXY import com.v2ray.ang.util.Utils data class ProfileItem( val configVersion: Int =...
) { companion object { fun create(configType: EConfigType): ProfileItem { return ProfileItem(configType = configType) } } fun getAllOutboundTags(): MutableList<String> { return mutableListOf(TAG_PROXY, TAG_DIRECT, TAG_BLOCKED) } fun getServerAddressAndPort...
var bandwidthDown: String? = null, var bandwidthUp: String? = null,
kotlin
2025-01-16T06:44:19
2dust/v2rayNG
e55e069fe3c4502ce1a93755c4a2cd3ff9f21ed2
V2rayNG/app/src/main/java/com/v2ray/ang/fmt/Hysteria2Fmt.kt
package com.v2ray.ang.fmt import com.v2ray.ang.AppConfig import com.v2ray.ang.AppConfig.LOOPBACK import com.v2ray.ang.dto.EConfigType import com.v2ray.ang.dto.Hysteria2Bean import com.v2ray.ang.dto.ProfileItem import com.v2ray.ang.dto.V2rayConfig.OutboundBean import com.v2ray.ang.extension.idnHost import com.v2ray.ang...
val server = if (config.portHopping.isNullOrEmpty()) config.getServerAddressAndPort() else Utils.getIpv6Address(config.server) + ":" + config.portHopping val bean = Hysteria2Bean( server = server, auth = config.password, ...
val bandwidth = if (config.bandwidthDown.isNullOrEmpty() || config.bandwidthUp.isNullOrEmpty()) null else Hysteria2Bean.BandwidthBean( down = config.bandwidthDown, up = config.bandwidthUp, )
kotlin
2025-01-16T06:44:19
2dust/v2rayNG
efd07167074f639aec7ca2c7d0478cf6f2d75c67
V2rayNG/app/src/main/java/com/v2ray/ang/dto/ProfileItem.kt
package com.v2ray.ang.dto import com.v2ray.ang.AppConfig.LOOPBACK import com.v2ray.ang.AppConfig.PORT_SOCKS import com.v2ray.ang.AppConfig.TAG_BLOCKED import com.v2ray.ang.AppConfig.TAG_DIRECT import com.v2ray.ang.AppConfig.TAG_PROXY import com.v2ray.ang.util.Utils data class ProfileItem( val configVersion: Int =...
return Utils.getIpv6Address(server) + ":" + serverPort } override fun equals(other: Any?): Boolean { if (other == null) return false val obj = other as ProfileItem return (this.server == obj.server && this.serverPort == obj.serverPort && this.pa...
if (server.isNullOrEmpty() && configType == EConfigType.CUSTOM) { return "$LOOPBACK:$PORT_SOCKS" }
kotlin
2025-01-07T09:14:23
2dust/v2rayNG
833a1e06f04417f1a1040b784ac699d9c3586494
V2rayNG/app/src/main/java/com/v2ray/ang/AppConfig.kt
package com.v2ray.ang object AppConfig { /** The application's package name. */ const val ANG_PACKAGE = BuildConfig.APPLICATION_ID /** Directory names used in the app's file system. */ const val DIR_ASSETS = "assets" const val DIR_BACKUPS = "backups" /** Legacy configuration keys. */ co...
const val PREF_ROUTING_DOMAIN_STRATEGY = "pref_routing_domain_strategy" const val PREF_ROUTING_RULESET = "pref_routing_ruleset" const val PREF_MUX_ENABLED = "pref_mux_enabled" const val PREF_MUX_CONCURRENCY = "pref_mux_concurrency" const val PREF_MUX_XUDP_CONCURRENCY = "pref_mux_xudp_concurrency" ...
const val PREF_VPN_BYPASS_LAN = "pref_vpn_bypass_lan"
kotlin
2025-01-01T08:43:48
2dust/v2rayNG
833a1e06f04417f1a1040b784ac699d9c3586494
V2rayNG/app/src/main/java/com/v2ray/ang/handler/SettingsManager.kt
package com.v2ray.ang.handler import android.content.Context import android.content.res.AssetManager import android.text.TextUtils import android.util.Log import com.v2ray.ang.AppConfig import com.v2ray.ang.AppConfig.ANG_PACKAGE import com.v2ray.ang.AppConfig.GEOIP_PRIVATE import com.v2ray.ang.AppConfig.GEOSITE_PRIVAT...
val guid = MmkvManager.getSelectServer() ?: return false val config = MmkvManager.decodeServerConfig(guid) ?: return false if (config.configType == EConfigType.CUSTOM) { val raw = MmkvManager.decodeServerRaw(guid) ?: return false val v2rayConfig = JsonUtil.fromJson(raw, ...
val vpnBypassLan = MmkvManager.decodeSettingsString(AppConfig.PREF_VPN_BYPASS_LAN) ?: "0" if (vpnBypassLan == "1") { return true } else if (vpnBypassLan == "2") { return false } //Follow config
kotlin
2025-01-01T08:43:48
2dust/v2rayNG
833a1e06f04417f1a1040b784ac699d9c3586494
V2rayNG/app/src/main/java/com/v2ray/ang/ui/SettingsActivity.kt
package com.v2ray.ang.ui import android.content.Intent import android.os.Bundle import android.text.TextUtils import android.view.View import androidx.activity.viewModels import androidx.preference.CheckBoxPreference import androidx.preference.EditTextPreference import androidx.preference.ListPreference import android...
private val mux by lazy { findPreference<CheckBoxPreference>(AppConfig.PREF_MUX_ENABLED) } private val muxConcurrency by lazy { findPreference<EditTextPreference>(AppConfig.PREF_MUX_CONCURRENCY) } private val muxXudpConcurrency by lazy { findPreference<EditTextPreference>(AppConfig.PREF_MUX_XU...
private val vpnBypassLan by lazy { findPreference<ListPreference>(AppConfig.PREF_VPN_BYPASS_LAN) }
kotlin
2025-01-01T08:43:48
2dust/v2rayNG
833a1e06f04417f1a1040b784ac699d9c3586494
V2rayNG/app/src/main/java/com/v2ray/ang/viewmodel/SettingsViewModel.kt
package com.v2ray.ang.viewmodel import android.app.Application import android.content.SharedPreferences import android.util.Log import androidx.lifecycle.AndroidViewModel import androidx.preference.PreferenceManager import com.v2ray.ang.AppConfig import com.v2ray.ang.handler.MmkvManager import com.v2ray.ang.util.Utils...
AppConfig.PREF_REMOTE_DNS, AppConfig.PREF_DOMESTIC_DNS, AppConfig.PREF_DNS_HOSTS, AppConfig.PREF_DELAY_TEST_URL, AppConfig.PREF_LOCAL_DNS_PORT, AppConfig.PREF_SOCKS_PORT, AppConfig.PREF_LOGLEVEL, AppConfig.PREF_LANGUAGE, ...
AppConfig.PREF_VPN_BYPASS_LAN,
kotlin
2025-01-01T08:43:48
Delgan/loguru
b64e1d537ffb367e419eaab784920f7d1a809409
loguru/_file_sink.py
import datetime import decimal import glob import numbers import os import shutil import string from functools import partial from stat import ST_DEV, ST_INO from . import _string_parsers as string_parsers from ._ctime_functions import get_ctime, set_ctime from ._datetime import aware_now def generate_rename_path(ro...
if isinstance(rotation, str): size = string_parsers.parse_size(rotation) if size is not None: return FileSink._make_rotation_function(size) interval = string_parsers.parse_duration(rotation) if interval is not None: return FileSink...
if isinstance(rotation, (list, tuple, set)): if len(rotation) == 0: raise ValueError("Must provide at least one rotation condition") return Rotation.RotationGroup( [FileSink._make_rotation_function(rot) for rot in rotation] )
python
2025-01-17T17:06:04
Delgan/loguru
7455a070e5570c2a2af7bfba037913a6b9df45ca
tests/conftest.py
import asyncio import builtins import contextlib import datetime import io import logging import os import pathlib import sys import threading import time import traceback import warnings from typing import NamedTuple import freezegun import pytest import loguru if sys.version_info < (3, 5, 3): def run(coro): ...
logging_logger = logging.getLogger(name) logging_logger.setLevel(level) formatter = logging.Formatter(fmt) handler.setLevel(level) handler.setFormatter(formatter) logging_logger.addHandler(handler) try: yield logging_logger finally: logging_logger.setLevel(original_log...
original_logging_level = logging.getLogger().getEffectiveLevel()
python
2025-01-15T16:19:33
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/messenger/BirthdayController.java
package org.telegram.messenger; import android.content.SharedPreferences; import org.telegram.tgnet.AbstractSerializedData; import org.telegram.tgnet.ConnectionsManager;
import org.telegram.tgnet.SerializedData; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; import org.telegram.tgnet.tl.TL_account; import java.util.ArrayList; import java.util.Calendar; import java.util.HashSet; import java.util.Set; public class BirthdayController { private static volatile...
import org.telegram.tgnet.InputSerializedData; import org.telegram.tgnet.OutputSerializedData;
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/messenger/CacheByChatsController.java
package org.telegram.messenger; import android.text.TextUtils; import android.util.LongSparseArray; import org.telegram.tgnet.TLRPC; import java.io.File; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.HashSet; public class CacheByChatsController { public static int KEEP_MEDIA_DELETE =...
keepMediaByTypes[type] = keepMedia; SharedConfig.getPreferences().edit().putInt("keep_media_type_" + type, keepMedia).apply(); } public void lookupFiles(ArrayList<? extends KeepMediaFile> keepMediaFiles) { LongSparseArray<ArrayList<KeepMediaFile>> filesByDialogId = FileLoader.getInstan...
if (!gotKeepMediaByTypes) { gotKeepMediaByTypes = true; for (int i = 0; i < 4; i++) { keepMediaByTypes[i] = SharedConfig.getPreferences().getInt("keep_media_type_" + i, getDefault(i)); } }
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/messenger/DialogObject.java
/* * This is the source code of Telegram for Android v. 5.x.x. * It is licensed under GNU GPL v. 2 or later. * You should have received a copy of the license in this archive (see LICENSE). * * Copyright Nikolai Kudashov, 2013-2018. */ package org.telegram.messenger; import android.text.TextUtils; import androi...
public static long getEmojiStatusDocumentId(TLRPC.EmojiStatus emojiStatus) { if (MessagesController.getInstance(UserConfig.selectedAccount).premiumFeaturesBlocked()) { return 0; } if (emojiStatus instanceof TLRPC.TL_emojiStatus) { final TLRPC.TL_emojiStatus status =...
public static boolean isEmojiStatusCollectible(long dialogId) { if (dialogId >= 0) { final TLRPC.User user = MessagesController.getInstance(UserConfig.selectedAccount).getUser(dialogId); if (user == null) return false; return isEmojiStatusCollectible(user.emoji_status); ...
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/messenger/DispatchQueuePool.java
package org.telegram.messenger; import android.os.Build; import android.os.Looper; import android.os.SystemClock; import android.util.SparseIntArray; import androidx.annotation.UiThread; import org.telegram.ui.Components.Reactions.HwEmojis; import java.util.LinkedList; public class DispatchQueuePool { private...
DispatchQueue queue; if (!busyQueues.isEmpty() && (totalTasksCount / 2 <= busyQueues.size() || queues.isEmpty() && createdCount >= maxCount)) { queue = busyQueues.remove(0); } else if (queues.isEmpty()) { queue = new DispatchQueue("DispatchQueuePool" + guid + "_" + Utili...
if (Looper.myLooper() != Looper.getMainLooper()) { AndroidUtilities.runOnUIThread(() -> execute(runnable)); return; }
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/messenger/FileStreamLoadOperation.java
/* * This is the source code of Telegram for Android v. 5.x.x. * It is licensed under GNU GPL v. 2 or later. * You should have received a copy of the license in this archive (see LICENSE). * * Copyright Nikolai Kudashov, 2013-2018. */ package org.telegram.messenger; import android.net.Uri; import androidx.anno...
} catch (Exception e) { throw new IOException(e); } return bytesRead; } } @Override public Uri getUri() { return uri; } @Override public void close() { FileLog.e("FileStreamLoadOperation " + document.id + " close me="...
} catch (InterruptedException e) { FileLog.e(e); return C.RESULT_NOTHING_READ;
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/messenger/UserNameResolver.java
package org.telegram.messenger; import android.text.TextUtils; import android.util.LruCache; import com.google.android.exoplayer2.util.Consumer; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.BaseFragment; import org...
}; public void update(TLRPC.User oldUser, TLRPC.User user) { if (oldUser == null || user == null || oldUser.username == null || TextUtils.equals(oldUser.username, user.username)) { return; } resolvedCache.remove(oldUser.username); if (user.username != null) { ...
return () -> { resolvingConsumers.remove(username); ConnectionsManager.getInstance(currentAccount).cancelRequest(reqId, true); };
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/messenger/UserObject.java
/* * This is the source code of Telegram for Android v. 5.x.x. * It is licensed under GNU GPL v. 2 or later. * You should have received a copy of the license in this archive (see LICENSE). * * Copyright Nikolai Kudashov, 2013-2018. */ package org.telegram.messenger; import android.text.TextUtils; import androi...
} return null; } public static boolean isService(long user_id) { return user_id == 333000 || user_id == 777000 || user_id == 42777; } public static MessagesController.PeerColor getPeerColorForAvatar(int currentAccount, TLRPC.User user) { // if (user != null && user.prof...
return status.document_id; } if (emojiStatus instanceof TLRPC.TL_emojiStatusCollectible) { final TLRPC.TL_emojiStatusCollectible status = (TLRPC.TL_emojiStatusCollectible) emojiStatus; if ((status.flags & 1) != 0 && status.until <= (int) (System.currentTimeMillis() / 1000)) { ...
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/messenger/utils/BillingUtilities.java
package org.telegram.messenger.utils; import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; import android.util.Base64; import androidx.core.util.Pair; import com.android.billingclient.api.AccountIdentifiers; import com.android.billingclient.api.Purchase; import com.g...
import org.telegram.tgnet.SerializedData; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; import java.io.InputStream; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; public class BillingUtilities { private static final String CURRENCY_FILE ...
import org.telegram.tgnet.InputSerializedData; import org.telegram.tgnet.OutputSerializedData;
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/tgnet/tl/TL_fragment.java
package org.telegram.tgnet.tl; import org.telegram.tgnet.AbstractSerializedData;
import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; public class TL_fragment { public static class InputCollectible extends TLObject { public static InputCollectible TLdeserialize(InputSerializedData stream, int constructor, boolean exception) { InputCollectible result = null...
import org.telegram.tgnet.InputSerializedData; import org.telegram.tgnet.OutputSerializedData;
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarMenuSubItem.java
package org.telegram.ui.ActionBar; import static org.telegram.messenger.AndroidUtilities.dp; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.content.Context; import android.graphics.PorterDuff; import android.graphics.PorterDu...
} @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, View.MeasureSpec.makeMeasureSpec(dp(itemHeight), View.MeasureSpec.EXACTLY)); if (expandIfMultiline && textView.getLayout().getLineCount() > 1) { super.onMeasure...
} public void setEmojiCacheType(int cacheType) { textView.setCacheType(cacheType);
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/ui/ActionBar/MenuDrawable.java
/* * This is the source code of Telegram for Android v. 5.x.x. * It is licensed under GNU GPL v. 2 or later. * You should have received a copy of the license in this archive (see LICENSE). * * Copyright Nikolai Kudashov, 2013-2018. */ package org.telegram.ui.ActionBar;
import android.graphics.Canvas; import android.graphics.ColorFilter; import android.graphics.Paint; import android.graphics.PixelFormat; import android.graphics.RectF; import android.graphics.drawable.Drawable; import android.os.SystemClock; import android.view.animation.DecelerateInterpolator; import org.telegram.m...
import static org.telegram.messenger.AndroidUtilities.dp; import static org.telegram.messenger.AndroidUtilities.dpf2;
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/ui/AvatarSpan.java
package org.telegram.ui; import static org.telegram.messenger.AndroidUtilities.dp; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.drawable.Drawable; import android.text.Spannable; import android.text.style.ReplacementSpan; import android.util.Log; import android.view.View; im...
} public void setName(String name) { avatarDrawable.setInfo(0, name, null, null, null, null); imageReceiver.setForUserOrChat(null, avatarDrawable); } public void setImageDrawable(Drawable drawable) { imageReceiver.setImageBitmap(drawable); } @Override public int g...
} public void setObject(TLObject obj) { avatarDrawable.setInfo(currentAccount, obj); imageReceiver.setForUserOrChat(obj, avatarDrawable);
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogsHintCell.java
package org.telegram.ui.Cells; import static org.telegram.messenger.AndroidUtilities.dp; import android.content.Context; import android.graphics.Canvas; import android.graphics.PorterDuff; import android.text.TextUtils; import android.util.TypedValue; import android.view.Gravity; import android.view.MotionEvent; impo...
} public void setText(CharSequence title, CharSequence subtitle) { titleView.setText(title); titleView.setCompoundDrawables(null, null, null, null); messageView.setText(subtitle); chevronView.setVisibility(VISIBLE); closeView.setVisibility(GONE); } public void ...
} public void clear() { setCompact(false); setAvatars(UserConfig.selectedAccount, null); imageView.setVisibility(View.GONE); imageView.clearImage(); } public void showImage() { imageView.setVisibility(View.VISIBLE);
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/ui/Cells/DrawerUserCell.java
/* * This is the source code of Telegram for Android v. 5.x.x. * It is licensed under GNU GPL v. 2 or later. * You should have received a copy of the license in this archive (see LICENSE). * * Copyright Nikolai Kudashov, 2013-2018. */ package org.telegram.ui.Cells; import static org.telegram.messenger.AndroidUt...
status.setColor(Theme.getColor(Theme.key_chats_verifiedBackground)); imageView.getImageReceiver().setCurrentAccount(account); imageView.setForUserOrChat(user, avatarDrawable); checkBox.setVisibility(account == UserConfig.selectedAccount ? VISIBLE : INVISIBLE); } public int getA...
final long botVerificationId = DialogObject.getBotVerificationIcon(user); if (botVerificationId == 0 || ConnectionsManager.getInstance(account).isTestBackend() != ConnectionsManager.getInstance(UserConfig.selectedAccount).isTestBackend()) { botVerification.set((Drawable) null, false); te...
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/ui/Cells/EditEmojiTextCell.java
package org.telegram.ui.Cells; import static org.telegram.messenger.AndroidUtilities.dp; import static org.telegram.messenger.LocaleController.getString; import static org.telegram.ui.Components.EditTextEmoji.STYLE_GIFT; import android.content.Context; import android.graphics.Canvas; import android.graphics.drawable....
public EditEmojiTextCell( Context context, SizeNotifierFrameLayout parent, String hint, boolean multiline, int maxLength, int style, Theme.ResourcesProvider resourceProvider ) { super(context); this.maxLength = maxLength; editTex...
public int emojiCacheType() { return AnimatedEmojiDrawable.getCacheTypeForEnterView(); } public void setEmojiViewCacheType(int cacheType) { editTextEmoji.setEmojiViewCacheType(cacheType); } public EditEmojiTextCell setAllowEntities(boolean allow) { allowEntities = allow; ...
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/ui/Cells/GraySectionCell.java
/* * This is the source code of Telegram for Android v. 5.x.x. * It is licensed under GNU GPL v. 2 or later. * You should have received a copy of the license in this archive (see LICENSE). * * Copyright Nikolai Kudashov, 2013-2018. */ package org.telegram.ui.Cells; import static org.telegram.messenger.AndroidUt...
} public void setRightText(CharSequence right, boolean moveDown) { rightTextView.setText(right, true, moveDown); rightTextView.setVisibility(VISIBLE); } public void setRightText(CharSequence right, OnClickListener onClickListener) { rightTextView.setText(right, false); ...
} public void setRightTextMargin(int marginDp) { rightTextViewLayoutParams.leftMargin = dp(marginDp); rightTextViewLayoutParams.rightMargin = dp(marginDp); rightTextView.setLayoutParams(rightTextViewLayoutParams);
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/ui/Cells/TextInfoPrivacyCell.java
/* * This is the source code of Telegram for Android v. 5.x.x. * It is licensed under GNU GPL v. 2 or later. * You should have received a copy of the license in this archive (see LICENSE). * * Copyright Nikolai Kudashov, 2013-2018. */ package org.telegram.ui.Cells; import android.animation.Animator; import andr...
}; textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); textView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); textView.setPadding(0, AndroidUtilities.dp(10), 0, AndroidUtilities.dp(17)); textView.setMovementMethod(LinkMovementMethod.getInstance()); ...
@Override public int overrideColor() { if (linkTextRippleColor != null) { return linkTextRippleColor; } return super.overrideColor(); }
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/ui/Components/AnimatedFloat.java
package org.telegram.ui.Components; import android.animation.TimeInterpolator; import android.os.SystemClock; import android.view.View; import androidx.core.math.MathUtils; import org.telegram.messenger.AndroidUtilities; public class AnimatedFloat { private View parent; private Runnable invalidate; pr...
public float set(boolean mustBe, boolean force) { return this.set(mustBe ? 1 : 0, force); } public float set(float mustBe, boolean force) { if (force || transitionDuration <= 0 || firstSet) { value = targetValue = mustBe; transition = false; firstSet = ...
public void force(float value) { this.set(value, true); } public void force(boolean value) { this.set(value ? 1 : 0, true); }
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/ui/Components/BackupImageView.java
/* * This is the source code of Telegram for Android v. 5.x.x. * It is licensed under GNU GPL v. 2 or later. * You should have received a copy of the license in this archive (see LICENSE). * * Copyright Nikolai Kudashov, 2013-2018. */ package org.telegram.ui.Components; import static org.telegram.messenger.Andr...
if (width != -1 && height != -1) { if (drawFromStart) { imageReceiver.setImageCoords(0, 0, width, height); if (blurAllowed) { blurImageReceiver.setImageCoords(0, 0, width, height); } } else { imageReceiv...
if (animatedEmojiDrawable != null && animatedEmojiDrawableColorFilter != null) { animatedEmojiDrawable.setColorFilter(animatedEmojiDrawableColorFilter); }
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/ui/Components/ButtonSpan.java
package org.telegram.ui.Components; import static org.telegram.messenger.AndroidUtilities.dp; import static org.telegram.messenger.AndroidUtilities.dpf2; import static org.telegram.messenger.LocaleController.formatPluralString; import android.content.Context; import android.graphics.Canvas; import android.graphics.Pa...
} } }
} @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(chan...
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/ui/Components/CheckBoxBase.java
package org.telegram.ui.Components; import static org.telegram.messenger.AndroidUtilities.dp; import static org.telegram.messenger.AndroidUtilities.lerp; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ObjectAnimator; import android.graphics.Canvas; import...
public void setBackgroundColor(int backgroundColor) { this.backgroundColor = backgroundColor; invalidate(); } public void setBackgroundDrawable(Theme.MessageDrawable drawable) { messageDrawable = drawable; } public void setUseDefaultCheck(boolean value) { useDefau...
public void setStrokeBackgroundColor(int key) { strokeBackgroundKey = key; invalidate(); } public void setStrokeBackgroundWidth(int width) { strokeBackgroundWidth = width; invalidate(); }
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/ui/Components/CircularProgressDrawable.java
package org.telegram.ui.Components; import android.graphics.Canvas; import android.graphics.ColorFilter; import android.graphics.Paint; import android.graphics.PixelFormat; import android.graphics.RectF; import android.graphics.drawable.Drawable; import android.os.SystemClock; import androidx.annotation.NonNull; impo...
}
@Override public int getIntrinsicWidth() { return (int) (size + thickness); } @Override public int getIntrinsicHeight() { return (int) (size + thickness); }
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/ui/Components/EditTextEffects.java
package org.telegram.ui.Components; import android.content.Context; import android.graphics.Canvas; import android.graphics.ColorFilter; import android.graphics.Path; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; import android.graphics.Rect; import android.graphics.Region; import ...
@Override public void setTextColor(int color) { lastTextColor = color; super.setTextColor(color); animatedEmojiColorFilter = new PorterDuffColorFilter(emojiColor == null ? color : emojiColor, PorterDuff.Mode.SRC_IN); } @Override protected void onLayout(boolean changed, int...
private int lastTextColor; private Integer emojiColor; public void setEmojiColor(Integer emojiColor) { this.emojiColor = emojiColor; animatedEmojiColorFilter = new PorterDuffColorFilter(emojiColor == null ? lastTextColor : emojiColor, PorterDuff.Mode.SRC_IN); invalidate(); }
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/Views/LinkPreview.java
package org.telegram.ui.Components.Paint.Views; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Path; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; import android.graphics.RectF; i...
import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.Cells.ChatMessageCell; import org.telegram.ui.Components.AnimatedFloat; import org.telegram.ui.Components.CubicBezierInterpolator; import org.telegram.ui.Components.Text; import org.teleg...
import org.telegram.tgnet.InputSerializedData; import org.telegram.tgnet.OutputSerializedData;
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/ui/Components/Paint/Views/PaintTypefaceListView.java
package org.telegram.ui.Components.Paint.Views; import android.content.Context; import android.graphics.Canvas; import android.graphics.Path; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.core.util.Consumer; import android...
} }
} @Override public boolean dispatchTouchEvent(MotionEvent ev) { return super.dispatchTouchEvent(ev); } @Override public boolean onTouchEvent(MotionEvent e) { return super.onTouchEvent(e);
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/PremiumLockIconView.java
package org.telegram.ui.Components.Premium; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.LinearGradient; import android.graphics.Paint; import android.graphics.Path; import android.graphics.Shader; import android....
} public boolean done() { return colorRetrieved; } public void play(int delay) { isEnter = true; if (cellFlickerDrawable != null) { cellFlickerDrawable.progress = 0; cellFlickerDrawable.repeatEnabled = false; } invalidate(); anim...
} private Integer blendColor; public void setBlendWithColor(Integer color) { blendColor = color;
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/adapters/SelectorAdapter.java
package org.telegram.ui.Components.Premium.boosts.adapters; import android.annotation.SuppressLint; import android.content.Context; import android.graphics.Paint; import android.graphics.drawable.Drawable; import android.text.TextUtils; import android.view.View; import android.view.ViewGroup; import android.widget.Fra...
return item; } public static Item asUser(TLRPC.User user, boolean checked) { Item item = new Item(VIEW_TYPE_USER, true); item.user = user; item.peer = null; item.chat = null; item.checked = checked; return item; ...
return item; } public static Item asCustomUser(int id, Drawable icon, CharSequence title, CharSequence subtitle) { Item item = new Item(VIEW_TYPE_USER, true); item.id = id; item.icon = icon; item.text = title; item.subtext = subtitle;
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/ui/Components/Premium/boosts/cells/selector/SelectorUserCell.java
package org.telegram.ui.Components.Premium.boosts.cells.selector; import static org.telegram.messenger.AndroidUtilities.dp; import android.annotation.SuppressLint; import android.content.Context; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; import android.graphics.drawable.Drawab...
} public void setChat(TLRPC.Chat chat, int participants_count) { optionsView.setVisibility(View.GONE); this.chat = chat; this.user = null; avatarDrawable.setInfo(chat); imageView.setRoundRadius(dp(ChatObject.isForum(chat) ? 12 : 20)); imageView.setForUserOrChat...
} public void setCustomUser(Drawable icon, CharSequence title, CharSequence subtitle) { optionsView.setVisibility(View.GONE); this.user = null; this.chat = null; imageView.setRoundRadius(dp(20)); imageView.setImageDrawable(icon); titleTextView.setText(title); ...
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/ui/Components/Text.java
package org.telegram.ui.Components; import static org.telegram.messenger.AndroidUtilities.dp; import android.graphics.Canvas; import android.graphics.ColorFilter; import android.graphics.LinearGradient; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.PorterDuff; import android.g...
public void setText(CharSequence text) { layout = new StaticLayout(AndroidUtilities.replaceNewLines(text), paint, (int) Math.max(maxWidth, 1), Layout.Alignment.ALIGN_NORMAL, 1f, 0f, false); width = 0; left = layout.getWidth(); for (int i = 0; i < layout.getLineCount(); ++i) { ...
private boolean drawAnimatedEmojis; private View parentView; private AnimatedEmojiSpan.EmojiGroupedSpans animatedEmojis; private int animatedEmojisCacheType = AnimatedEmojiDrawable.CACHE_TYPE_MESSAGES; private ColorFilter animatedEmojisColorFilter; private int animatedEmojisColorFilterColor; pub...
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/ui/Components/UItem.java
package org.telegram.ui.Components; import android.content.Context; import android.graphics.drawable.Drawable; import android.text.TextUtils; import android.util.LongSparseArray; import android.util.SparseIntArray; import android.util.SparseLongArray; import android.view.View; import android.widget.FrameLayout; impo...
public static UItem asSearchMessage(MessageObject messageObject) { UItem item = new UItem(UniversalAdapter.VIEW_TYPE_SEARCH_MESSAGE, false); item.object = messageObject; return item; } public static UItem asSearchMessage(int id, MessageObject messageObject) { UItem item = ...
public UItem withOpenButton(Utilities.Callback<TLRPC.User> onOpenButton) { this.checked = true; this.object2 = onOpenButton; return this; }
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/ui/Components/VideoSeekPreviewImage.java
package org.telegram.ui.Components; import static org.telegram.messenger.AndroidUtilities.dp; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapShader; import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.Pat...
public void open(Uri uri) { if (uri == null || uri.equals(videoUri)) { return; } if (open) { close(); } isQualities = false; videoUri = uri; Utilities.globalQueue.postRunnable(loadRunnable = () -> { String scheme = uri.get...
public void open(VideoPlayer videoPlayer) { if (videoPlayer == null) return; if (videoPlayer.getQualitiesCount() > 0) { VideoPlayer.VideoUri suitableUri = null; for (int i = 0; i < videoPlayer.getQualitiesCount(); ++i) { final VideoPlayer.Quality q = videoPlayer.g...
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/ui/Components/spoilers/SpoilersTextView.java
package org.telegram.ui.Components.spoilers; import android.content.Context; import android.graphics.Canvas; import android.graphics.ColorFilter; import android.graphics.Paint; import android.graphics.Path; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; import android.graphics.Porte...
if (allowClickSpoilers && clickDetector.onTouchEvent(event)) return true; return super.dispatchTouchEvent(event); } @Override public void setText(CharSequence text, BufferType type) { isSpoilersRevealed = false; super.setText(text, type); } public void ...
if (links != null) { Layout textLayout = getLayout(); ClickableSpan span; if ((span = hit((int) event.getX(), (int) event.getY())) != null) { if (event.getAction() == MotionEvent.ACTION_DOWN) { final LinkSpanDrawable link = new LinkSpanDrawable<Cli...
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/ui/Stories/DarkThemeResourceProvider.java
package org.telegram.ui.Stories; import android.graphics.Color; import android.graphics.ColorFilter; import android.graphics.Paint; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; import android.graphics.drawable.Drawable; import android.util.SparseIntArray; import androidx.core.gra...
appendColors(); dividerPaint.setColor(getColor(Theme.key_divider)); } public void appendColors() { } @Override public int getColor(int key) { int index = sparseIntArray.indexOfKey(key); if (index >= 0) { return sparseIntArray.valueAt(index); }...
sparseIntArray.put(Theme.key_radioBackgroundChecked, -10177041); sparseIntArray.put(Theme.key_checkboxDisabled, -12237499); sparseIntArray.put(Theme.key_checkboxCheck, 0xFFFFFFFF); sparseIntArray.put(Theme.key_avatar_backgroundSaved, 0xFF5CADF6); sparseIntArray.put(Theme.key_avatar_back...
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/ui/Stories/MessageMediaStoryFull.java
package org.telegram.ui.Stories; import org.telegram.messenger.MessagesController; import org.telegram.messenger.UserConfig; import org.telegram.tgnet.AbstractSerializedData;
import org.telegram.tgnet.TLRPC; import org.telegram.tgnet.tl.TL_stories; public class MessageMediaStoryFull extends TLRPC.TL_messageMediaStory { public static int constructor = 0xc79aee1d; public void readParams(InputSerializedData stream, boolean exception) { user_id = stream.readInt64(exception);...
import org.telegram.tgnet.InputSerializedData; import org.telegram.tgnet.OutputSerializedData;
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/ui/Stories/MessageMediaStoryFull_old.java
package org.telegram.ui.Stories; import org.telegram.tgnet.AbstractSerializedData;
import org.telegram.tgnet.TLRPC; import org.telegram.tgnet.tl.TL_stories; public class MessageMediaStoryFull_old extends TLRPC.TL_messageMediaStory { public MessageMediaStoryFull_old() { } public static int constructor = 0xc79aee1f; public void readParams(InputSerializedData stream, boolean except...
import org.telegram.tgnet.InputSerializedData; import org.telegram.tgnet.OutputSerializedData;
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/ButtonWithCounterView.java
package org.telegram.ui.Stories.recorder; import static org.telegram.messenger.AndroidUtilities.dp; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color...
public void updateColors() { text.setTextColor(Theme.getColor(filled ? Theme.key_featuredStickers_buttonText : Theme.key_featuredStickers_addButton, resourcesProvider)); if (filled) { rippleView.setBackground(Theme.createRadSelectorDrawable(Theme.getColor(Theme.key_listSelector, resour...
public void updateColors(Theme.ResourcesProvider resourcesProvider) { this.resourcesProvider = resourcesProvider; updateColors(); }
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/ui/Stories/recorder/CollageLayout.java
package org.telegram.ui.Stories.recorder; import android.graphics.RectF; import android.text.TextUtils; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import org.telegram.messenger.BuildVars; import java.util.ArrayList; public class CollageLayout { private static ArrayList<CollageLay...
private final String src; public final int w, h; public final int[] columns; public final ArrayList<Part> parts = new ArrayList<>(); public CollageLayout(@Nullable String schema) { if (schema == null) schema = "."; src = schema; final String[] rows = src.split("/"); ...
public static CollageLayout of(int count) { for (CollageLayout layout : getLayouts()) { if (layout.parts.size() >= count) return layout; } return null; } public static int getMaxCount() { int max = 0; for (CollageLayout layout : getLayouts()) ...
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/ui/web/BrowserHistory.java
package org.telegram.ui.web; import android.util.LongSparseArray; import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.FileLoader; import org.telegram.messenger.FileLog; import org.telegram.messenger.Utilities; import org.telegram.tgnet.AbstractSerializedData;
import org.telegram.tgnet.SerializedData; import org.telegram.tgnet.TLObject; import java.io.File; import java.io.FileOutputStream; import java.util.ArrayList; public class BrowserHistory { public static class Entry extends TLObject { public long id; public long time; public String url; ...
import org.telegram.tgnet.InputSerializedData; import org.telegram.tgnet.OutputSerializedData;
java
2025-01-26T15:30:37
DrKLO/Telegram
eee720ef5e48e1c434f4c5a83698dc4ada34aaa9
TMessagesProj/src/main/java/org/telegram/ui/web/WebMetadataCache.java
package org.telegram.ui.web; import static org.telegram.messenger.AndroidUtilities.dp; import android.app.Activity; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.os.Build; import android.text.TextUtils; import andr...
import org.telegram.tgnet.SerializedData; import org.telegram.tgnet.TLObject; import org.telegram.tgnet.TLRPC; import org.telegram.ui.Components.LayoutHelper; import org.telegram.ui.LaunchActivity; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileOutpu...
import org.telegram.tgnet.InputSerializedData; import org.telegram.tgnet.OutputSerializedData;
java
2025-01-26T15:30:37