repo_name
stringlengths
2
55
dataset
stringclasses
1 value
owner
stringlengths
3
31
lang
stringclasses
10 values
func_name
stringlengths
1
104
code
stringlengths
20
96.7k
docstring
stringlengths
1
4.92k
url
stringlengths
94
241
sha
stringlengths
40
40
Polyfill
github_2023
SimonCropp
csharp
Polyfill.SaveAsync
public static Task SaveAsync( this XDocument target, XmlWriter writer, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); target.Save(writer); return Task.CompletedTask; }
/// <summary>
https://github.com/SimonCropp/Polyfill/blob/b3fc2b19ec553e6971f8bb688d0116c8b61f6788/src/Polyfill/Polyfill_XDocument.cs#L26-L34
b3fc2b19ec553e6971f8bb688d0116c8b61f6788
Polyfill
github_2023
SimonCropp
csharp
OperatingSystemPolyfill.IsOSPlatform
public static bool IsOSPlatform(string platform) => #if NET5_0_OR_GREATER OperatingSystem.IsOSPlatform(platform); #else RuntimeInformation.IsOSPlatform(OSPlatform.Create(platform)); #endif /// <summary> /// Checks if the operating system version is greater than or equal to the specified platfor...
/// <summary>
https://github.com/SimonCropp/Polyfill/blob/b3fc2b19ec553e6971f8bb688d0116c8b61f6788/src/Polyfill/OperatingSystemPolyfill.cs#L52-L68
b3fc2b19ec553e6971f8bb688d0116c8b61f6788
Polyfill
github_2023
SimonCropp
csharp
UIntPolyfill.TryParse
public static bool TryParse(string? target, IFormatProvider? provider, out uint result) => #if NET7_0_OR_GREATER uint.TryParse(target, provider, out result); #else uint.TryParse(target, NumberStyles.Integer, provider, out result); #endif
/// <summary>
https://github.com/SimonCropp/Polyfill/blob/b3fc2b19ec553e6971f8bb688d0116c8b61f6788/src/Polyfill/Numbers/UIntPolyfill.cs#L23-L28
b3fc2b19ec553e6971f8bb688d0116c8b61f6788
grzyClothTool
github_2023
grzybeek
csharp
CutFloatValueEventArgs.ReadXml
public override void ReadXml(XmlNode node) { base.ReadXml(node); fValue = Xml.GetChildFloatAttribute(node, "fValue", "value"); }
// PsoDataType.Float, 32, 0, 0)
https://github.com/grzybeek/grzyClothTool/blob/4f0ddcfffadcf3fbf8a4529b084c90bf464a81b5/CodeWalker/CodeWalker.Core/GameFiles/FileTypes/CutFile.cs#L984-L988
4f0ddcfffadcf3fbf8a4529b084c90bf464a81b5
grzyClothTool
github_2023
grzybeek
csharp
CutVehicleExtraEventArgs.ReadXml
public override void ReadXml(XmlNode node) { base.ReadXml(node); pExtraBoneIds = Xml.GetChildRawIntArray(node, "pExtraBoneIds"); }
// PsoDataType.Array, 40, 0, (MetaName)3)//ARRAYINFO, PsoDataType.SInt, 0, 0, 0),
https://github.com/grzybeek/grzyClothTool/blob/4f0ddcfffadcf3fbf8a4529b084c90bf464a81b5/CodeWalker/CodeWalker.Core/GameFiles/FileTypes/CutFile.cs#L1181-L1185
4f0ddcfffadcf3fbf8a4529b084c90bf464a81b5
grzyClothTool
github_2023
grzybeek
csharp
AnimSequence.EvaluateQuaternionType7
public Quaternion EvaluateQuaternionType7(int frame) { if (!IsType7Quat) { return new Quaternion( Channels[0].EvaluateFloat(frame), Channels[1].EvaluateFloat(frame), Channels[2].EvaluateFloat(frame), ...
//for convenience
https://github.com/grzybeek/grzyClothTool/blob/4f0ddcfffadcf3fbf8a4529b084c90bf464a81b5/CodeWalker/CodeWalker.Core/GameFiles/Resources/Clip.cs#L2171-L2204
4f0ddcfffadcf3fbf8a4529b084c90bf464a81b5
grzyClothTool
github_2023
grzybeek
csharp
FbxIO.Read
public static FbxDocument Read(byte[] data) { using (var stream = new MemoryStream(data)) { var isbinary = FbxBinary.IsBinary(stream); if (isbinary) { var reader = new FbxBinaryReader(stream); return ...
/// <summary>
https://github.com/grzybeek/grzyClothTool/blob/4f0ddcfffadcf3fbf8a4529b084c90bf464a81b5/CodeWalker/CodeWalker.Core/Utils/Fbx.cs#L35-L51
4f0ddcfffadcf3fbf8a4529b084c90bf464a81b5
grzyClothTool
github_2023
grzybeek
csharp
Program.Main
[STAThread] static void Main(string[] args) { //Application.SetHighDpiMode(HighDpiMode.SystemAware); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // Always check the GTA folder first thing if (!GTAFol...
/// <summary>
https://github.com/grzybeek/grzyClothTool/blob/4f0ddcfffadcf3fbf8a4529b084c90bf464a81b5/CodeWalker/CodeWalker/Program.cs#L18-L43
4f0ddcfffadcf3fbf8a4529b084c90bf464a81b5
DatasetHelpers
github_2023
Particle1904
csharp
PromptGeneratorService.GeneratePromptFromDataset
public string GeneratePromptFromDataset(string[] tags, string prependTags, string appendTags, int amountOfTags) { _stringBuilder.Clear(); if (!string.IsNullOrEmpty(prependTags)) { _stringBuilder.Append(prependTags); _stringBuilder.Append(", ")...
/// <summary>
https://github.com/Particle1904/DatasetHelpers/blob/f55d0567c227a6eec658f597384439056e47762f/SmartData.Lib/Services/PromptGeneratorService.cs#L39-L67
f55d0567c227a6eec658f597384439056e47762f
DatasetHelpers
github_2023
Particle1904
csharp
TagProcessorService.ProcessAllTagFiles
public async Task ProcessAllTagFiles(string inputFolderPath, string tagsToAdd, string tagsToEmphasize, string tagsToRemove) { string[] files = Utilities.GetFilesByMultipleExtensions(inputFolderPath, _txtSearchPattern); CancellationToken cancellationToken = _cancellationTokenSource.Token;...
/// <summary>
https://github.com/Particle1904/DatasetHelpers/blob/f55d0567c227a6eec658f597384439056e47762f/SmartData.Lib/Services/TagProcessorService.cs#L152-L168
f55d0567c227a6eec658f597384439056e47762f
aibpm.plus
github_2023
leooneone
csharp
StartActivityService.Submit
public override async Task<ActivityOutput> Submit(InstanceDataInput input) { InstanceEntity instance = null; WorkflowTemplateEntity tpl = null; ActivityModel currentActivity = null; var workItemId = 0l; var workItem = default(WorkItemEntity); ...
/// <summary>
https://github.com/leooneone/aibpm.plus/blob/00b7e0f9274fbdeefd1686d65bd9ac414a1ebaf5/Modules/AI/AI.BPM/Services/BPM/Activity/Activities/StartActivityService.cs#L40-L145
00b7e0f9274fbdeefd1686d65bd9ac414a1ebaf5
aibpm.plus
github_2023
leooneone
csharp
RoleRepository.GetChildIdListAsync
public async Task<List<long>> GetChildIdListAsync(long id) { return await Select .Where(a => a.Id == id) .AsTreeCte() .ToListAsync(a => a.Id); }
/// <summary>
https://github.com/leooneone/aibpm.plus/blob/00b7e0f9274fbdeefd1686d65bd9ac414a1ebaf5/src/platform/ZhonTai.Admin/Repositories/Role/RoleRepository.cs#L20-L26
00b7e0f9274fbdeefd1686d65bd9ac414a1ebaf5
aibpm.plus
github_2023
leooneone
csharp
UserOrgRepository.HasUser
public async Task<bool> HasUser(long id) { return await Select.Where(a => a.OrgId == id).AnyAsync(); }
/// <summary>
https://github.com/leooneone/aibpm.plus/blob/00b7e0f9274fbdeefd1686d65bd9ac414a1ebaf5/src/platform/ZhonTai.Admin/Repositories/UserOrg/UserOrgRepository.cs#L20-L23
00b7e0f9274fbdeefd1686d65bd9ac414a1ebaf5
aibpm.plus
github_2023
leooneone
csharp
CacheService.GetList
public List<dynamic> GetList() { var list = new List<dynamic>(); var appConfig = LazyGetRequiredService<AppConfig>(); Assembly[] assemblies = AssemblyHelper.GetAssemblyList(appConfig.AssemblyNames); foreach (Assembly assembly in assemblies) { var types = assembl...
/// <summary>
https://github.com/leooneone/aibpm.plus/blob/00b7e0f9274fbdeefd1686d65bd9ac414a1ebaf5/src/platform/ZhonTai.Admin/Services/Cache/CacheService.cs#L32-L60
00b7e0f9274fbdeefd1686d65bd9ac414a1ebaf5
aibpm.plus
github_2023
leooneone
csharp
ConfigHelper.Load
public static IConfiguration Load(string fileName, string environmentName = "", bool optional = true, bool reloadOnChange = false) { var filePath = Path.Combine(AppContext.BaseDirectory, "Configs"); if (!Directory.Exists(filePath)) return null; var builder = new ConfigurationBui...
/* 使用热更新 var uploadConfig = new ConfigHelper().Load("uploadconfig", _env.EnvironmentName, true); services.Configure<UploadConfig>(uploadConfig); private readonly UploadConfig _uploadConfig; public ImgController(IOptionsMonitor<UploadConfig> uploadConfig) { _uploadConfig = uploadConfig.Curre...
https://github.com/leooneone/aibpm.plus/blob/00b7e0f9274fbdeefd1686d65bd9ac414a1ebaf5/src/platform/ZhonTai.Common/Helpers/ConfigHelper.cs#L31-L47
00b7e0f9274fbdeefd1686d65bd9ac414a1ebaf5
aibpm.plus
github_2023
leooneone
csharp
PasswordHelper.Verify
public static bool Verify(string input) { if (input.IsNull()) { return false; } return RegexPassword().IsMatch(input); }
/// <summary>
https://github.com/leooneone/aibpm.plus/blob/00b7e0f9274fbdeefd1686d65bd9ac414a1ebaf5/src/platform/ZhonTai.Common/Helpers/PasswordHelper.cs#L19-L27
00b7e0f9274fbdeefd1686d65bd9ac414a1ebaf5
RazorSlices
github_2023
DamianEdwards
csharp
RazorSlice.Write
protected void Write(char? value) { if (value.HasValue) { WriteUtf8SpanFormattable(value.Value); } }
/// <summary>
https://github.com/DamianEdwards/RazorSlices/blob/cf2e413551e49c3a3b40623ce020d678697f123a/src/RazorSlices/RazorSlice.Formattables.cs#L28-L34
cf2e413551e49c3a3b40623ce020d678697f123a
p4vfs
github_2023
microsoft
csharp
ServiceInfo.IsServiceRunning
public static bool IsServiceRunning(string serviceName) { return IsServiceRunning(Environment.MachineName, serviceName); }
/// <summary>
https://github.com/microsoft/p4vfs/blob/10d93293a4846b4fee3267f9a6da38f8fd5c5a66/source/P4VFS.Extensions/Source/Utilities/ServiceInfo.cs#L58-L61
10d93293a4846b4fee3267f9a6da38f8fd5c5a66
VisualChatGPTStudio
github_2023
jeffdapaz
csharp
DiffView.ShowDiffViewAsync
public static async System.Threading.Tasks.Task ShowDiffViewAsync(string filePath, string originalCode, string optimizedCode) { string extension = System.IO.Path.GetExtension(filePath).TrimStart('.'); string tempFolder = System.IO.Path.GetTempPath(); string tempFilePath1 = S...
/// <summary>
https://github.com/jeffdapaz/VisualChatGPTStudio/blob/b393c71d8c8ddeb12d13c5a77e63caf39cd734ab/VisualChatGPTStudioShared/Utils/DiffView.cs#L17-L33
b393c71d8c8ddeb12d13c5a77e63caf39cd734ab
FramePFX
github_2023
AngryCarrot789
csharp
ResourceObjectUtils.AddItemAndRet
public static T AddItemAndRet<T>(this ResourceFolder folder, T item) where T : BaseResource { folder.AddItem(item); return item; }
/// <summary>
https://github.com/AngryCarrot789/FramePFX/blob/73f9ddb9ddfa9a50755f78bbfcbc19ef45ce61b8/FramePFX/Editing/ResourceManaging/ResourceObjectUtils.cs#L29-L32
73f9ddb9ddfa9a50755f78bbfcbc19ef45ce61b8
FramePFX
github_2023
AngryCarrot789
csharp
ActivityTask.GetAwaiter
public new TaskAwaiter<T> GetAwaiter() => this.Task.GetAwaiter();
/// <inheritdoc cref="ActivityTask.GetAwaiter"/>
https://github.com/AngryCarrot789/FramePFX/blob/73f9ddb9ddfa9a50755f78bbfcbc19ef45ce61b8/FramePFX/Tasks/ActivityTask.cs#L168-L168
73f9ddb9ddfa9a50755f78bbfcbc19ef45ce61b8
FramePFX
github_2023
AngryCarrot789
csharp
ArrayUtils.Hash
public static int Hash<T>(T[] array) { if (array == null) return 0; IEqualityComparer<T> comparer = EqualityComparer<T>.Default; int result = 1; foreach (T t in array) { result = 31 * result + comparer.GetHashCode(t); } return result; }
// Using IEqualityComparer + generic functions is easier than having
https://github.com/AngryCarrot789/FramePFX/blob/73f9ddb9ddfa9a50755f78bbfcbc19ef45ce61b8/FramePFX/Utils/ArrayUtils.cs#L29-L40
73f9ddb9ddfa9a50755f78bbfcbc19ef45ce61b8
FramePFX
github_2023
AngryCarrot789
csharp
TypeUtils.instanceof
public static bool instanceof(this Type left, Type right) { return right.IsAssignableFrom(left); }
/// <summary>
https://github.com/AngryCarrot789/FramePFX/blob/73f9ddb9ddfa9a50755f78bbfcbc19ef45ce61b8/FramePFX/Utils/TypeUtils.cs#L33-L35
73f9ddb9ddfa9a50755f78bbfcbc19ef45ce61b8
FramePFX
github_2023
AngryCarrot789
csharp
InheritanceDictionary.GetEffectiveValue
public T? GetEffectiveValue(Type key) { return this.GetOrCreateEntryInternal(key).inheritedItem; }
/// <summary>
https://github.com/AngryCarrot789/FramePFX/blob/73f9ddb9ddfa9a50755f78bbfcbc19ef45ce61b8/FramePFX/Utils/Collections/InheritanceDictionary.cs#L96-L98
73f9ddb9ddfa9a50755f78bbfcbc19ef45ce61b8
FramePFX
github_2023
AngryCarrot789
csharp
ObservableItemProcessor.MakeSimple
public static ObservableItemProcessorSimple<T> MakeSimple<T>(IObservableList<T> list, Action<T>? onItemAdded, Action<T>? onItemRemoved) { return new ObservableItemProcessorSimple<T>(list, onItemAdded, onItemRemoved); }
/// <summary>
https://github.com/AngryCarrot789/FramePFX/blob/73f9ddb9ddfa9a50755f78bbfcbc19ef45ce61b8/FramePFX/Utils/Collections/Observable/ObservableItemProcessor.cs#L40-L42
73f9ddb9ddfa9a50755f78bbfcbc19ef45ce61b8
FramePFX
github_2023
AngryCarrot789
csharp
RateLimitedDispatchAction.InvokeAsync
public void InvokeAsync(T param) { _ = Interlocked.Exchange(ref this.currentValue, new ObjectWrapper(param)); base.InvokeAsyncCore(); }
// An object wrapper is required in order to permit InvokeAsync being called with a null value.
https://github.com/AngryCarrot789/FramePFX/blob/73f9ddb9ddfa9a50755f78bbfcbc19ef45ce61b8/FramePFX/Utils/RDA/RateLimitedDispatchAction.cs#L321-L324
73f9ddb9ddfa9a50755f78bbfcbc19ef45ce61b8
ThingsGateway
github_2023
ThingsGateway
csharp
ImportExportService.ExportAsync
public async Task<FileStreamResult> ExportAsync<T>(object input, string fileName, bool isDynamicExcelColumn = true) where T : class { var path = ImportExportUtil.GetFileDir(ref fileName); fileName = CommonUtils.GetSingleId() + fileName; var filePath = Path.Combine(path, fileName); ...
/// <summary>
https://github.com/ThingsGateway/ThingsGateway/blob/c355968addb85577c008fc6ea9ba5b58e08ce784/src/Admin/ThingsGateway.Admin.Application/Services/ImportExport/ImportExportService.cs#L38-L51
c355968addb85577c008fc6ea9ba5b58e08ce784
ThingsGateway
github_2023
ThingsGateway
csharp
SessionService.PageAsync
public async Task<QueryData<SessionOutput>> PageAsync(QueryPageOptions option) { var ret = new QueryData<SessionOutput>() { IsSorted = option.SortOrder != SortOrder.Unset, IsFiltered = option.Filters.Count > 0, IsAdvanceSearch = option.AdvanceSearches.Count > 0 ||...
/// <summary>
https://github.com/ThingsGateway/ThingsGateway/blob/c355968addb85577c008fc6ea9ba5b58e08ce784/src/Admin/ThingsGateway.Admin.Application/Services/Session/SessionService.cs#L47-L141
c355968addb85577c008fc6ea9ba5b58e08ce784
ThingsGateway
github_2023
ThingsGateway
csharp
ConfigurableOptionsServiceCollectionExtensions.AddConfigurableOptions
public static IServiceCollection AddConfigurableOptions<TOptions>(this IServiceCollection services) where TOptions : class, IConfigurableOptions { var optionsType = typeof(TOptions); // 获取选项配置 var (optionsSettings, path) = Penetrates.GetOptionsConfiguration(optionsType); //...
/// <summary>
https://github.com/ThingsGateway/ThingsGateway/blob/c355968addb85577c008fc6ea9ba5b58e08ce784/src/Admin/ThingsGateway.Furion/ConfigurableOptions/Extensions/ConfigurableOptionsServiceCollectionExtensions.cs#L37-L114
c355968addb85577c008fc6ea9ba5b58e08ce784
ThingsGateway
github_2023
ThingsGateway
csharp
MD5Encryption.Compare
public static bool Compare(string text, string hash, bool uppercase = false, bool is16 = false) { return Compare(Encoding.UTF8.GetBytes(text), hash, uppercase, is16); }
/// <summary>
https://github.com/ThingsGateway/ThingsGateway/blob/c355968addb85577c008fc6ea9ba5b58e08ce784/src/Admin/ThingsGateway.Furion/DataEncryption/Encryptions/MD5Encryption.cs#L31-L34
c355968addb85577c008fc6ea9ba5b58e08ce784
ThingsGateway
github_2023
ThingsGateway
csharp
Scoped.Create
public static void Create(Action<IServiceScopeFactory, IServiceScope> handler, IServiceScopeFactory scopeFactory = default) { CreateAsync(async (fac, scope) => { handler(fac, scope); await Task.CompletedTask.ConfigureAwait(false); }, scopeFactory).GetAwaiter().GetResu...
/// <summary>
https://github.com/ThingsGateway/ThingsGateway/blob/c355968addb85577c008fc6ea9ba5b58e08ce784/src/Admin/ThingsGateway.Furion/DependencyInjection/Scoped.cs#L27-L34
c355968addb85577c008fc6ea9ba5b58e08ce784
ThingsGateway
github_2023
ThingsGateway
csharp
NewtonsoftJsonExtensions.AddDateTimeTypeConverters
public static IList<JsonConverter> AddDateTimeTypeConverters(this IList<JsonConverter> converters, string outputFormat = "yyyy-MM-dd HH:mm:ss", bool localized = false) { converters.Add(new NewtonsoftJsonDateTimeJsonConverter(outputFormat, localized)); converters.Add(new NewtonsoftNullableJsonDateTim...
/// <summary>
https://github.com/ThingsGateway/ThingsGateway/blob/c355968addb85577c008fc6ea9ba5b58e08ce784/src/Admin/ThingsGateway.Furion/JsonSerialization/Extensions/NewtonsoftJsonExtensions.cs#L29-L38
c355968addb85577c008fc6ea9ba5b58e08ce784
ThingsGateway
github_2023
ThingsGateway
csharp
SpecificationDocumentServiceCollectionExtensions.AddSpecificationDocuments
public static IMvcBuilder AddSpecificationDocuments(this IMvcBuilder mvcBuilder, Action<SwaggerGenOptions> configure = default) { mvcBuilder.Services.AddSpecificationDocuments(configure); return mvcBuilder; }
/// <summary>
https://github.com/ThingsGateway/ThingsGateway/blob/c355968addb85577c008fc6ea9ba5b58e08ce784/src/Admin/ThingsGateway.Furion/SpecificationDocument/Extensions/SpecificationDocumentServiceCollectionExtensions.cs#L33-L38
c355968addb85577c008fc6ea9ba5b58e08ce784
ThingsGateway
github_2023
ThingsGateway
csharp
UnifyResultServiceCollectionExtensions.AddUnifyResult
public static IMvcBuilder AddUnifyResult(this IMvcBuilder mvcBuilder) { mvcBuilder.Services.AddUnifyResult<RESTfulResultProvider>(); return mvcBuilder; }
/// <summary>
https://github.com/ThingsGateway/ThingsGateway/blob/c355968addb85577c008fc6ea9ba5b58e08ce784/src/Admin/ThingsGateway.Furion/UnifyResult/Extensions/UnifyResultServiceCollectionExtensions.cs#L32-L37
c355968addb85577c008fc6ea9ba5b58e08ce784
ThingsGateway
github_2023
ThingsGateway
csharp
NewObjectExtensions.GetAssembly
internal static Assembly? GetAssembly(this object? obj) => obj?.GetType().Assembly;
/// <summary>
https://github.com/ThingsGateway/ThingsGateway/blob/c355968addb85577c008fc6ea9ba5b58e08ce784/src/Admin/ThingsGateway.Furion/V5_Experience/Core/Extensions/ObjectExtensions.cs#L35-L35
c355968addb85577c008fc6ea9ba5b58e08ce784
ThingsGateway
github_2023
ThingsGateway
csharp
HttpMultipartFormDataBuilderDeclarativeExtractor.Extract
public void Extract(HttpRequestBuilder httpRequestBuilder, HttpDeclarativeExtractorContext context) { // 尝试解析单个 Action<HttpMultipartFormDataBuilder> 类型参数 if (context.Args.SingleOrDefault(u => u is Action<HttpMultipartFormDataBuilder>) is not Action<HttpMultipartFormDataBuilder> multipart...
/// <inheritdoc />
https://github.com/ThingsGateway/ThingsGateway/blob/c355968addb85577c008fc6ea9ba5b58e08ce784/src/Admin/ThingsGateway.Furion/V5_Experience/HttpRemote/Declarative/Extractors/HttpMultipartFormDataBuilderDeclarativeExtractor.cs#L20-L39
c355968addb85577c008fc6ea9ba5b58e08ce784
ThingsGateway
github_2023
ThingsGateway
csharp
FileUtil.ReadFile
public static string ReadFile(string Path, Encoding? encoding = default) { encoding ??= Encoding.UTF8; if (!File.Exists(Path)) { return null; } StreamReader streamReader = new StreamReader(Path, encoding); string result = streamReader.ReadToEnd(); ...
/// <summary>
https://github.com/ThingsGateway/ThingsGateway/blob/c355968addb85577c008fc6ea9ba5b58e08ce784/src/Admin/ThingsGateway.NewLife.X/Common/FileUtil.cs#L23-L36
c355968addb85577c008fc6ea9ba5b58e08ce784
ThingsGateway
github_2023
ThingsGateway
csharp
InIConfigProvider.Init
public override void Init(String value) { // 加上默认后缀 if (!value.IsNullOrEmpty() && Path.GetExtension(value).IsNullOrEmpty()) value += ".ini"; base.Init(value); }
/// <summary>初始化</summary>
https://github.com/ThingsGateway/ThingsGateway/blob/c355968addb85577c008fc6ea9ba5b58e08ce784/src/Admin/ThingsGateway.NewLife.X/Configuration/IniConfigProvider.cs#L13-L19
c355968addb85577c008fc6ea9ba5b58e08ce784
ThingsGateway
github_2023
ThingsGateway
csharp
MD5PasswordProvider.Hash
public String Hash(String password) => password.MD5();
/// <summary>对密码进行散列处理,此处可以加盐,结果保存在数据库</summary>
https://github.com/ThingsGateway/ThingsGateway/blob/c355968addb85577c008fc6ea9ba5b58e08ce784/src/Admin/ThingsGateway.NewLife.X/Security/IPasswordProvider.cs#L41-L41
c355968addb85577c008fc6ea9ba5b58e08ce784
ThingsGateway
github_2023
ThingsGateway
csharp
VariableObjectSourceGenerator.Initialize
public void Initialize(GeneratorInitializationContext context) { //Debugger.Launch(); context.RegisterForPostInitialization(a => { a.AddSource(nameof(m_generatorVariableAttribute), m_generatorVariableAttribute); }); context.RegisterForSyntaxNotifications(() => new...
/// <inheritdoc/>
https://github.com/ThingsGateway/ThingsGateway/blob/c355968addb85577c008fc6ea9ba5b58e08ce784/src/Foundation/ThingsGateway.Foundation.SourceGenerator/SourceGenerator/VariableObjectSourceGenerator.cs#L53-L61
c355968addb85577c008fc6ea9ba5b58e08ce784
ThingsGateway
github_2023
ThingsGateway
csharp
RuntimeInfoController.GetChannelListAsync
[HttpGet("channelList")] [DisplayName("获取通道信息")] public async Task<SqlSugarPagedList<ChannelRuntime>> GetChannelListAsync(ChannelPageInput input) { var channelRuntimes = await GlobalData.GetCurrentUserChannels().ConfigureAwait(false); var data = channelRuntimes .Select(a => a.Valu...
/// <summary>
https://github.com/ThingsGateway/ThingsGateway/blob/c355968addb85577c008fc6ea9ba5b58e08ce784/src/Gateway/ThingsGateway.Gateway.Application/Controller/RuntimeInfoController.cs#L37-L51
c355968addb85577c008fc6ea9ba5b58e08ce784
ThingsGateway
github_2023
ThingsGateway
csharp
UpdateZipFileInfo.OnInitialized
protected override void OnInitialized() { base.OnInitialized(); HeaderText = ManagementLocalizer[nameof(HeaderText)]; }
/// <inheritdoc/>
https://github.com/ThingsGateway/ThingsGateway/blob/c355968addb85577c008fc6ea9ba5b58e08ce784/src/Gateway/ThingsGateway.Management/Update/Update/UpdateZipFileInfo.razor.cs#L42-L46
c355968addb85577c008fc6ea9ba5b58e08ce784
ExifGlass
github_2023
d2phap
csharp
UpdateModel.Deserialize
public static UpdateModel Deserialize(string json) { var obj = JsonSerializer.Deserialize(json, UpdateModelJsonContext.Default.UpdateModel); return obj; }
/// <summary>
https://github.com/d2phap/ExifGlass/blob/ca73fd2105de29b7f6bec9f82f715b51cdbebc82/Source/ExifGlass.Core/Settings/UpdateModel.cs#L48-L53
ca73fd2105de29b7f6bec9f82f715b51cdbebc82
BONELAB-Fusion
github_2023
Lakatrazz
csharp
SteamServerStats.RequestUserStatsAsync
public static async Task<Result> RequestUserStatsAsync(SteamId steamid) { var r = await Internal.RequestUserStats(steamid); if (!r.HasValue) return Result.Fail; return r.Value.Result; }
/// <summary>
https://github.com/Lakatrazz/BONELAB-Fusion/blob/8889d7008e90c36cdcb8ba6bdf15a499d8f17ebb/LabFusion/dependencies/Facepunch.Steamworks/SteamServerStats.cs#L18-L23
8889d7008e90c36cdcb8ba6bdf15a499d8f17ebb
Unity-ImageLoader
github_2023
IvanMurzak
csharp
ImageLoader.DiskCacheContains
public static bool DiskCacheContains(string url) => File.Exists(DiskCachePath(url));
/// <summary>
https://github.com/IvanMurzak/Unity-ImageLoader/blob/8f9ebd0e03a8d465adfc659b9124a504fba3c177/Assets/_PackageRoot/Runtime/ImageLoader.DiskCache.cs#L52-L52
8f9ebd0e03a8d465adfc659b9124a504fba3c177
XCSkillEditor_Unity
github_2023
smartgrass
csharp
ServerClientAttributeProcessor.InjectGuardParameters
static void InjectGuardParameters(MethodDefinition md, ILProcessor worker, Instruction top) { int offset = md.Resolve().IsStatic ? 0 : 1; for (int index = 0; index < md.Parameters.Count; index++) { ParameterDefinition param = md.Parameters[index]; ...
// this is required to early-out from a function with "ref" or "out" parameters
https://github.com/smartgrass/XCSkillEditor_Unity/blob/a1ea899b4504eff4ab64de33abf98681f4409f82/Assets/Mirror/Editor/Weaver/Processors/ServerClientAttributeProcessor.cs#L117-L137
a1ea899b4504eff4ab64de33abf98681f4409f82
XCSkillEditor_Unity
github_2023
smartgrass
csharp
NetworkRoomManagerExt.OnRoomServerSceneChanged
public override void OnRoomServerSceneChanged(string sceneName) { // spawn the initial batch of Rewards if (sceneName == GameplayScene) { Spawner.InitialSpawn(); } }
/// <summary>
https://github.com/smartgrass/XCSkillEditor_Unity/blob/a1ea899b4504eff4ab64de33abf98681f4409f82/Assets/Mirror/Examples/Room/Scripts/NetworkRoomManagerExt.cs#L16-L23
a1ea899b4504eff4ab64de33abf98681f4409f82
Blazor.WebAudio
github_2023
KristofferStrube
csharp
BiquadFilterNode.CreateAsync
public static new async Task<BiquadFilterNode> CreateAsync(IJSRuntime jSRuntime, IJSObjectReference jSReference) { return await CreateAsync(jSRuntime, jSReference, new()); }
/// <inheritdoc/>
https://github.com/KristofferStrube/Blazor.WebAudio/blob/ea1acdd530ee4dc07e3efda4bc0712447b0af18a/src/KristofferStrube.Blazor.WebAudio/AudioNodes/BiquadFilterNode.cs#L21-L24
ea1acdd530ee4dc07e3efda4bc0712447b0af18a
Blazor.WebAudio
github_2023
KristofferStrube
csharp
ChannelSplitterNode.CreateAsync
public static new async Task<ChannelSplitterNode> CreateAsync(IJSRuntime jSRuntime, IJSObjectReference jSReference) { return await CreateAsync(jSRuntime, jSReference, new()); }
/// <inheritdoc/>
https://github.com/KristofferStrube/Blazor.WebAudio/blob/ea1acdd530ee4dc07e3efda4bc0712447b0af18a/src/KristofferStrube.Blazor.WebAudio/AudioNodes/ChannelSplitterNode.cs#L22-L25
ea1acdd530ee4dc07e3efda4bc0712447b0af18a
Blazor.WebAudio
github_2023
KristofferStrube
csharp
AudioParamMap.CreateAsync
public static async Task<AudioParamMap> CreateAsync(IJSRuntime jSRuntime, IJSObjectReference jSReference) { return await CreateAsync(jSRuntime, jSReference, new()); }
/// <inheritdoc/>
https://github.com/KristofferStrube/Blazor.WebAudio/blob/ea1acdd530ee4dc07e3efda4bc0712447b0af18a/src/KristofferStrube.Blazor.WebAudio/AudioWorklet/AudioParamMap.cs#L14-L17
ea1acdd530ee4dc07e3efda4bc0712447b0af18a
nArchitecture.Core
github_2023
kodlamaio-projects
csharp
HashingHelper.CreatePasswordHash
public static void CreatePasswordHash(string password, out byte[] passwordHash, out byte[] passwordSalt) { using HMACSHA512 hmac = new(); passwordSalt = hmac.Key; passwordHash = hmac.ComputeHash(Encoding.UTF8.GetBytes(password)); }
/// <summary>
https://github.com/kodlamaio-projects/nArchitecture.Core/blob/9561d89f545169c3c2078c229c3a62dddf2886ad/src/Core.Security/Hashing/HashingHelper.cs#L11-L17
9561d89f545169c3c2078c229c3a62dddf2886ad
Dumpify
github_2023
MoaidHathot
csharp
TestExplicit.GetEnumerator
public IEnumerator GetEnumerator() => new TestEnumerator(_list);
//IEnumerator<KeyValuePair<string, string>> IEnumerable<KeyValuePair<string, string>>.GetEnumerator()
https://github.com/MoaidHathot/Dumpify/blob/78ef11df642fac68e6676c08c322a79ce30e25f9/src/Dumpify.Playground/Program.cs#L717-L717
78ef11df642fac68e6676c08c322a79ce30e25f9
ShaderLibrary
github_2023
falseeeeeeeeee
csharp
WorldNormalInputsNode.DrawProperties
public override void DrawProperties() { base.DrawProperties(); m_perPixel = EditorGUILayoutToggleLeft( PerPixelLabelStr, m_perPixel ); }
//public override void Destroy()
https://github.com/falseeeeeeeeee/ShaderLibrary/blob/5d3931c2fd7c8478c984bb2f0be2d0875d6352d2/ShaderLib_2021/Assets/Plugins/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalInputsNode.cs#L45-L49
5d3931c2fd7c8478c984bb2f0be2d0875d6352d2
ShaderLibrary
github_2023
falseeeeeeeeee
csharp
CreateCustomShader.CreateShaderTemplate
private static void CreateShaderTemplate(string templatePath, string defaultFileName) { ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, ScriptableObject.CreateInstance<ShaderAsset>(), GetSelectedPathOrFallback() + "/" + defaultFileName, null, templa...
// 通用方法,用于从给定的模板路径创建Shader
https://github.com/falseeeeeeeeee/ShaderLibrary/blob/5d3931c2fd7c8478c984bb2f0be2d0875d6352d2/ShaderLib_2022/Assets/Plugins/CreateCustomShader/Editor/CreateCustomShader.cs#L11-L18
5d3931c2fd7c8478c984bb2f0be2d0875d6352d2
ShaderLibrary
github_2023
falseeeeeeeeee
csharp
MainDrawer.GetPropertyHeight
public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor) { return _height; }
// Call in custom shader gui
https://github.com/falseeeeeeeeee/ShaderLibrary/blob/5d3931c2fd7c8478c984bb2f0be2d0875d6352d2/ShaderLib_2022/Assets/Plugins/LightWeightShaderGUI/Editor/ShaderDrawer.cs#L91-L94
5d3931c2fd7c8478c984bb2f0be2d0875d6352d2
GDC23_PracticalMobileRendering
github_2023
WeakKnight
csharp
FBO.Create
public static FBO Create() { FBO fbo = new FBO(); fbo.m_width = 0; fbo.m_height = 0; return fbo; }
// Create a dummy FBO
https://github.com/WeakKnight/GDC23_PracticalMobileRendering/blob/cb8f6f4e6933abe6a3d1b72c821864f239b14338/PracticalMobileRendering/Assets/Scripts/RenderPipeline/Runtime/LowLevelGraphicsAPI/FBO.cs#L149-L155
cb8f6f4e6933abe6a3d1b72c821864f239b14338
GenshinGamePlay
github_2023
526077247
csharp
AIDecisionTree.Think
public static void Think(AIKnowledge knowledge, AIDecision decision) { var conf = ConfigAIDecisionTreeCategory.Instance.Get(knowledge.DecisionArchetype); if (conf != null) { if (knowledge.CombatComponent != null && knowledge.CombatComponent.IsInCombat) { if (conf.CombatNode != null) Handle...
/// <summary>
https://github.com/526077247/GenshinGamePlay/blob/5b1e4e62ebdc0b189e158ec55b3d3b4b5e3857d7/Assets/Scripts/Code/Game/Component/AI/Decision/AIDecisionTree.cs#L13-L29
5b1e4e62ebdc0b189e158ec55b3d3b4b5e3857d7
GenshinGamePlay
github_2023
526077247
csharp
ResourcesManager.IsProcessRunning
public bool IsProcessRunning() { return this.loadingOp.Count > 0; }
/// <summary>
https://github.com/526077247/GenshinGamePlay/blob/5b1e4e62ebdc0b189e158ec55b3d3b4b5e3857d7/Assets/Scripts/Code/Module/Resource/ResourcesManager.cs#L53-L56
5b1e4e62ebdc0b189e158ec55b3d3b4b5e3857d7
GenshinGamePlay
github_2023
526077247
csharp
Writer.WriteCommonVal
[MethodImpl(MethodImplOptions.AggressiveInlining)] public void WriteCommonVal<T>(T val) => Serializer.Serialize(typeof(T), val, this, option, false);
/// <summary>
https://github.com/526077247/GenshinGamePlay/blob/5b1e4e62ebdc0b189e158ec55b3d3b4b5e3857d7/Assets/Scripts/ThirdParty/Nino/Serialization/Writer.Generic.cs#L16-L18
5b1e4e62ebdc0b189e158ec55b3d3b4b5e3857d7
GenshinGamePlay
github_2023
526077247
csharp
StringMgr.Split
public static unsafe string[] Split(this ReadOnlySpan<char> str, char separator) { if (str.IsEmpty) { return Array.Empty<string>(); } var indexes = ObjectPool<ExtensibleBuffer<int>>.Request(); var index = 0; int i = 0; ...
/// <summary>
https://github.com/526077247/GenshinGamePlay/blob/5b1e4e62ebdc0b189e158ec55b3d3b4b5e3857d7/Assets/Scripts/ThirdParty/Nino/Shared/Mgr/StringMgr.cs#L15-L70
5b1e4e62ebdc0b189e158ec55b3d3b4b5e3857d7
GenshinGamePlay
github_2023
526077247
csharp
TaskCopyBuildinFiles.CopyBuildinFilesToStreaming
private void CopyBuildinFilesToStreaming(BuildParametersContext buildParametersContext, ManifestContext manifestContext) { ECopyBuildinFileOption option = buildParametersContext.Parameters.CopyBuildinFileOption; string packageOutputDirectory = buildParametersContext.GetPackageOutputDirectory(); string stream...
/// <summary>
https://github.com/526077247/GenshinGamePlay/blob/5b1e4e62ebdc0b189e158ec55b3d3b4b5e3857d7/Modules/com.tuyoogame.yooasset/Editor/AssetBundleBuilder/BuildTasks/TaskCopyBuildinFiles.cs#L29-L104
5b1e4e62ebdc0b189e158ec55b3d3b4b5e3857d7
GenshinGamePlay
github_2023
526077247
csharp
RawBundleWebLoader.Update
public override void Update() { if (_steps == ESteps.Done) return; if (_steps == ESteps.None) { if (MainBundleInfo.LoadMode == BundleInfo.ELoadMode.LoadFromRemote) { _steps = ESteps.Download; FileLoadPath = MainBundleInfo.Bundle.CachedDataFilePath; } else if (MainBundleInfo.Loa...
/// <summary>
https://github.com/526077247/GenshinGamePlay/blob/5b1e4e62ebdc0b189e158ec55b3d3b4b5e3857d7/Modules/com.tuyoogame.yooasset/Runtime/AssetSystem/Loader/RawBundleWebLoader.cs#L33-L133
5b1e4e62ebdc0b189e158ec55b3d3b4b5e3857d7
GenshinGamePlay
github_2023
526077247
csharp
GameManager.OnHandleEventMessage
private void OnHandleEventMessage(IEventMessage message) { if(message is SceneEventDefine.ChangeToHomeScene) { _machine.ChangeState<FsmSceneHome>(); } else if(message is SceneEventDefine.ChangeToBattleScene) { _machine.ChangeState<FsmSceneBattle>(); } }
/// <summary>
https://github.com/526077247/GenshinGamePlay/blob/5b1e4e62ebdc0b189e158ec55b3d3b4b5e3857d7/Modules/com.tuyoogame.yooasset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/GameManager.cs#L53-L63
5b1e4e62ebdc0b189e158ec55b3d3b4b5e3857d7
GenshinGamePlay
github_2023
526077247
csharp
StreamingAssetsHelper.Init
public static void Init() { if (_isInit == false) { _isInit = true; var manifest = Resources.Load<BuildinFileManifest>("BuildinFileManifest"); if (manifest != null) { foreach (string fileName in manifest.BuildinFiles) { _cacheData.Add(fileName); } } } }
/// <summary>
https://github.com/526077247/GenshinGamePlay/blob/5b1e4e62ebdc0b189e158ec55b3d3b4b5e3857d7/Modules/com.tuyoogame.yooasset/Samples~/Space Shooter/ThirdParty/StreamingAssetsHelper/StreamingAssetsHelper.cs#L43-L57
5b1e4e62ebdc0b189e158ec55b3d3b4b5e3857d7
GenshinGamePlay
github_2023
526077247
csharp
Double3Drawer.PopulateGenericMenu
public void PopulateGenericMenu(InspectorProperty property, GenericMenu genericMenu) { double3 value = (double3)property.ValueEntry.WeakSmartValue; var vec = new Vector3((float)value.x, (float)value.y, (float)value.z); if (genericMenu.GetItemCount() > 0) { ...
/// <summary>
https://github.com/526077247/GenshinGamePlay/blob/5b1e4e62ebdc0b189e158ec55b3d3b4b5e3857d7/Packages/com.thridparty.odin/Sirenix/Odin Inspector/Modules/Unity.Mathematics/MathematicsDrawers.cs#L598-L617
5b1e4e62ebdc0b189e158ec55b3d3b4b5e3857d7
GenshinGamePlay
github_2023
526077247
csharp
TMP_SpriteAssetEditor.DisplayPageNavigation
void DisplayPageNavigation(ref int currentPage, int arraySize, int itemsPerPage) { Rect pagePos = EditorGUILayout.GetControlRect(false, 20); pagePos.width /= 3; int shiftMultiplier = Event.current.shift ? 10 : 1; // Page + Shift goes 10 page forward // Previous ...
/// <summary>
https://github.com/526077247/GenshinGamePlay/blob/5b1e4e62ebdc0b189e158ec55b3d3b4b5e3857d7/Packages/com.unity.textmeshpro/Scripts/Editor/TMP_SpriteAssetEditor.cs#L672-L708
5b1e4e62ebdc0b189e158ec55b3d3b4b5e3857d7
GenshinGamePlay
github_2023
526077247
csharp
TMP_MaterialManager.GetStencilMaterial
public static Material GetStencilMaterial(Material baseMaterial, int stencilID) { // Check if Material supports masking if (!baseMaterial.HasProperty(ShaderUtilities.ID_StencilID)) { Debug.LogWarning("Selected Shader does not support Stencil Masking. Please se...
/// <summary>
https://github.com/526077247/GenshinGamePlay/blob/5b1e4e62ebdc0b189e158ec55b3d3b4b5e3857d7/Packages/com.unity.textmeshpro/Scripts/Runtime/TMP_MaterialManager.cs#L43-L104
5b1e4e62ebdc0b189e158ec55b3d3b4b5e3857d7
GenshinGamePlay
github_2023
526077247
csharp
TimelineAction.Execute
public abstract bool Execute(ActionContext context);
/// <summary>
https://github.com/526077247/GenshinGamePlay/blob/5b1e4e62ebdc0b189e158ec55b3d3b4b5e3857d7/Packages/com.unity.timeline/Editor/Actions/TimelineAction.cs#L25-L25
5b1e4e62ebdc0b189e158ec55b3d3b4b5e3857d7
GenshinGamePlay
github_2023
526077247
csharp
TrackAction.Execute
public abstract bool Execute(IEnumerable<TrackAsset> tracks);
/// <summary>
https://github.com/526077247/GenshinGamePlay/blob/5b1e4e62ebdc0b189e158ec55b3d3b4b5e3857d7/Packages/com.unity.timeline/Editor/Actions/TrackAction.cs#L27-L27
5b1e4e62ebdc0b189e158ec55b3d3b4b5e3857d7
GenshinGamePlay
github_2023
526077247
csharp
AnimationPlayableAssetEditor.GetClipOptions
public override ClipDrawOptions GetClipOptions(TimelineClip clip) { var clipOptions = base.GetClipOptions(clip); var asset = clip.asset as AnimationPlayableAsset; if (asset != null) clipOptions.errorText = GetErrorText(asset, clip.GetParentTrack() as Animatio...
/// <inheritdoc/>
https://github.com/526077247/GenshinGamePlay/blob/5b1e4e62ebdc0b189e158ec55b3d3b4b5e3857d7/Packages/com.unity.timeline/Editor/Animation/AnimationPlayableAssetEditor.cs#L17-L29
5b1e4e62ebdc0b189e158ec55b3d3b4b5e3857d7
GenshinGamePlay
github_2023
526077247
csharp
TrackAsset.OnBeforeTrackSerialize
protected virtual void OnBeforeTrackSerialize() { }
/// <summary>
https://github.com/526077247/GenshinGamePlay/blob/5b1e4e62ebdc0b189e158ec55b3d3b4b5e3857d7/Packages/com.unity.timeline/Runtime/AssetUpgrade/TrackUpgrade.cs#L27-L27
5b1e4e62ebdc0b189e158ec55b3d3b4b5e3857d7
StructuredConcurrency
github_2023
StephenCleary
csharp
DisposeUtility.Wrap
public static IAsyncDisposable Wrap(object? resource) => TryWrap(resource) ?? NoopDisposable.Instance;
/// <summary>
https://github.com/StephenCleary/StructuredConcurrency/blob/309813256331af44f15ba8add05350428f60c846/src/Nito.StructuredConcurrency/Internals/DisposeUtility.cs#L15-L15
309813256331af44f15ba8add05350428f60c846
StructuredConcurrency
github_2023
StephenCleary
csharp
InterlockedEx.Apply
public static T Apply<T>(ref T value, Func<T, T> transformation) where T : class { _ = transformation ?? throw new ArgumentNullException(nameof(transformation)); while (true) { var localValue = Interlocked.CompareExchange(ref value, null!, null!); var modifie...
/// <summary>
https://github.com/StephenCleary/StructuredConcurrency/blob/309813256331af44f15ba8add05350428f60c846/src/Nito.StructuredConcurrency/Internals/InterlockedEx.cs#L17-L29
309813256331af44f15ba8add05350428f60c846
GameFramework-Next
github_2023
Alex-Rachel
csharp
LogRedirection.GetStackTrace
private static string GetStackTrace() { // 通过反射获取ConsoleWindow类 var consoleWindowType = typeof(EditorWindow).Assembly.GetType("UnityEditor.ConsoleWindow"); // 获取窗口实例 var fieldInfo = consoleWindowType.GetField("ms_ConsoleWindow", BindingFlags.Static...
/// <summary>
https://github.com/Alex-Rachel/GameFramework-Next/blob/4f2fbfa6fc0eb0bfa55c92fd51df295eae3de4b3/UnityProject/Assets/GameScripts/Editor/Extension/Utility/LogRedirection.cs#L95-L123
4f2fbfa6fc0eb0bfa55c92fd51df295eae3de4b3
GameFramework-Next
github_2023
Alex-Rachel
csharp
ReleaseTools.CreateEncryptionInstance
private static IEncryptionServices CreateEncryptionInstance(string packageName, EBuildPipeline buildPipeline) { var encryptionClassName = AssetBundleBuilderSetting.GetPackageEncyptionClassName(packageName, buildPipeline); var encryptionClassTypes = EditorTools.GetAssignableTypes(typeof(I...
/// <summary>
https://github.com/Alex-Rachel/GameFramework-Next/blob/4f2fbfa6fc0eb0bfa55c92fd51df295eae3de4b3/UnityProject/Assets/GameScripts/Editor/ReleaseTools/ReleaseTools.cs#L165-L179
4f2fbfa6fc0eb0bfa55c92fd51df295eae3de4b3
GameFramework-Next
github_2023
Alex-Rachel
csharp
GameApp.Entrance
public static void Entrance(object[] objects) { s_HotfixAssembly = (List<Assembly>)objects[0]; Log.Warning("======= 看到此条日志代表你成功运行了热更新代码 ======="); Log.Warning("======= Entrance GameApp ======="); Instance.InitSystem(); Instance.Start(); Utility.Unity.AddUpdateListener...
/// <summary>
https://github.com/Alex-Rachel/GameFramework-Next/blob/4f2fbfa6fc0eb0bfa55c92fd51df295eae3de4b3/UnityProject/Assets/GameScripts/HotFix/GameLogic/GameApp.cs#L15-L29
4f2fbfa6fc0eb0bfa55c92fd51df295eae3de4b3
vertical-slice-api-template
github_2023
mehdihadeli
csharp
AggregateIdValueConverter.Create
private static TAggregateId Create(TId id) => ( Activator.CreateInstance( typeof(TAggregateId), BindingFlags.Instance | BindingFlags.NonPublic, null, new object?[] { id }, null, null ) as TAgg...
// instantiate AggregateId and pass id to its protected or private constructor
https://github.com/mehdihadeli/vertical-slice-api-template/blob/3837aefd7d6ed6bf8e32faca932a145f25f0dfb4/src/Shared/EF/Converters/AggregateIdValueConverter.cs#L15-L25
3837aefd7d6ed6bf8e32faca932a145f25f0dfb4
AcrylicView.MAUI
github_2023
sswi
csharp
CornerFrameLayout.SetRadius
public void SetRadius(float topLeft, float topRight, float bottomRight, float bottomLeft) { mRadii[0] = topLeft; mRadii[1] = topLeft; mRadii[2] = topRight; mRadii[3] = topRight; mRadii[4] = bottomRight; mRadii[5] = bottomRight; ...
/// <summary>
https://github.com/sswi/AcrylicView.MAUI/blob/a70ec049b39ba9f5300f27c16d4bf1539e00c373/AcrylicView/Platforms/Android/Drawable/CornerFrameLayout.cs#L47-L61
a70ec049b39ba9f5300f27c16d4bf1539e00c373
Template
github_2023
CSharpRedotTools
csharp
StateMachineComponent.SwitchState
private void SwitchState(State newState, bool callExit = true) { if (callExit) { _curState.Exit(); } _curState = newState; _curState.Enter(); }
/// <summary>
https://github.com/CSharpRedotTools/Template/blob/d1b39583643c63beeda68c629ecc6c76cf98df4c/Genres/2D Top Down/Scripts/Components/StateMachineComponent.cs#L39-L48
d1b39583643c63beeda68c629ecc6c76cf98df4c
PotatoVN
github_2023
GoldenPotato137
csharp
GalStatusSyncResultHelper.ToInfoBarSeverity
public static InfoBarSeverity ToInfoBarSeverity(this GalStatusSyncResult result) { switch (result) { case GalStatusSyncResult.Ok: return InfoBarSeverity.Success; case GalStatusSyncResult.UnAuthorized: case GalStatusSyncResult.NoId: case...
/// <summary>
https://github.com/GoldenPotato137/PotatoVN/blob/e8db00158d27c07f868cae89d9aaa5a5bd9c3349/GalgameManager/Enums/GalStatusSyncResult.cs#L24-L39
e8db00158d27c07f868cae89d9aaa5a5bd9c3349
PotatoVN
github_2023
GoldenPotato137
csharp
NavigationHelper.NavigateToHomePage
public static void NavigateToHomePage(INavigationService navigationService, IFilterService? filterService = null, IEnumerable<FilterBase>? filters = null) { Debug.Assert(!(filterService is null ^ filters is null)); // 同时为null或同时不为null if (filterService is not null && filters is not null) ...
/// <summary>
https://github.com/GoldenPotato137/PotatoVN/blob/e8db00158d27c07f868cae89d9aaa5a5bd9c3349/GalgameManager/Helpers/NavigationHelper.cs#L34-L52
e8db00158d27c07f868cae89d9aaa5a5bd9c3349
PotatoVN
github_2023
GoldenPotato137
csharp
TimeToDisplayTimeConverter.Convert
public static string Convert(int value) { var timeAsHour = App.GetService<ILocalSettingsService>().ReadSettingAsync<bool>(KeyValues.TimeAsHour).Result; if (timeAsHour) return value > 60 ? $"{value / 60}h{value % 60}m" : $"{value}m"; return $"{value} {"Minute".GetLocalized()}"; ...
//不需要
https://github.com/GoldenPotato137/PotatoVN/blob/e8db00158d27c07f868cae89d9aaa5a5bd9c3349/GalgameManager/Helpers/Converter/TimeToDisplayTimeConverter.cs#L24-L30
e8db00158d27c07f868cae89d9aaa5a5bd9c3349
PotatoVN
github_2023
GoldenPotato137
csharp
ObservableCollectionExtensions.SyncCollection
public static void SyncCollection<T>(this ObservableCollection<T> collection, IList<T> other, bool sort = false) where T : notnull { // var delta = other.Count - collection.Count; // for (var i = 0; i < delta; i++) // collection.Add(other[0]); //内容不总要,只是要填充到对应的总数 // for (...
/// <summary>
https://github.com/GoldenPotato137/PotatoVN/blob/e8db00158d27c07f868cae89d9aaa5a5bd9c3349/GalgameManager/Helpers/Extensions/ObservableCollectionExtensions.cs#L14-L38
e8db00158d27c07f868cae89d9aaa5a5bd9c3349
PotatoVN
github_2023
GoldenPotato137
csharp
GalgameUid.Similarity
public int Similarity(GalgameUid? rhs) { if (rhs is null) return 0; var result = 0; result += !PvnId.IsNullOrEmpty() && PvnId == rhs.PvnId ? 1 : 0; result += !BangumiId.IsNullOrEmpty() && BangumiId == rhs.BangumiId ? 1 : 0; result += !VndbId.IsNullOrEmpty() && VndbId == rhs.V...
/// <summary>
https://github.com/GoldenPotato137/PotatoVN/blob/e8db00158d27c07f868cae89d9aaa5a5bd9c3349/GalgameManager/Models/GalgameUid.cs#L24-L34
e8db00158d27c07f868cae89d9aaa5a5bd9c3349
BarcodeScanning.Native.Maui
github_2023
afriscic
csharp
Program.Main
static void Main(string[] args) { // if you want to use a different Application Delegate class from "AppDelegate" // you can specify it here. UIApplication.Main(args, null, typeof(AppDelegate)); }
// This is the main entry point of the application.
https://github.com/afriscic/BarcodeScanning.Native.Maui/blob/dd51248cb791fe8b7099b5d06b6f71c9d766ea81/BarcodeScanning.Test/Platforms/iOS/Program.cs#L9-L14
dd51248cb791fe8b7099b5d06b6f71c9d766ea81
AIShell
github_2023
PowerShell
csharp
PSConsoleReadLine.ViReplaceLine
public static void ViReplaceLine(ConsoleKeyInfo? key = null, object arg = null) { _singleton._groupUndoHelper.StartGroup(ViReplaceLine, arg); DeleteLine(key, arg); ViInsertMode(key, arg); }
/// <summary>
https://github.com/PowerShell/AIShell/blob/8fc4c0dc16cdcf5aaefefec24e3b10ecc85c3ad0/shell/ReadLine/Replace.vi.cs#L138-L143
8fc4c0dc16cdcf5aaefefec24e3b10ecc85c3ad0
AIShell
github_2023
PowerShell
csharp
ReplaceCommand.RegenerateAsync
private async Task<string> RegenerateAsync() { ArgumentPlaceholder ap = _agent.ArgPlaceholder; // We are doing the replacement locally, but want to fake the regeneration. await Task.Delay(2000, Shell.CancellationToken); ResponseData data = ap.ResponseData; _agent.ReplaceKno...
/// <summary>
https://github.com/PowerShell/AIShell/blob/8fc4c0dc16cdcf5aaefefec24e3b10ecc85c3ad0/shell/agents/Microsoft.Azure.Agent/Command.cs#L260-L276
8fc4c0dc16cdcf5aaefefec24e3b10ecc85c3ad0
elsa-studio
github_2023
elsa-workflows
csharp
RenderTreeBuilderExtensions.CreateComponent
public static void CreateComponent<T>(this RenderTreeBuilder builder) where T : IComponent { var sequence = 0; CreateComponent<T>(builder, ref sequence); }
/// <summary>
https://github.com/elsa-workflows/elsa-studio/blob/95c37625ffcdfde09f1a3244a386b0ab005cdd82/src/framework/Elsa.Studio.Core/Extensions/RenderTreeBuilderExtensions.cs#L14-L18
95c37625ffcdfde09f1a3244a386b0ab005cdd82
elsa-studio
github_2023
elsa-workflows
csharp
ServiceCollectionExtensions.AddLoginModuleCore
public static IServiceCollection AddLoginModuleCore(this IServiceCollection services) { return services .AddScoped<IFeature, Feature>() .AddOptions() .AddAuthorizationCore() .AddScoped<AuthenticatingApiHttpMessageHandler>() .Add...
/// <summary>
https://github.com/elsa-workflows/elsa-studio/blob/95c37625ffcdfde09f1a3244a386b0ab005cdd82/src/modules/Elsa.Studio.Login/Extensions/ServiceCollectionExtensions.cs#L20-L31
95c37625ffcdfde09f1a3244a386b0ab005cdd82
elsa-studio
github_2023
elsa-workflows
csharp
InputDescriptorCheckListExtensions.GetCheckList
public static CheckList GetCheckList(this InputDescriptor descriptor) { var specifications = descriptor.UISpecifications; var props = specifications != null ? specifications.TryGetValue("checklist", out var propsValue) ? propsValue is JsonElement value ? value : default : default : default; ...
/// <summary>
https://github.com/elsa-workflows/elsa-studio/blob/95c37625ffcdfde09f1a3244a386b0ab005cdd82/src/modules/Elsa.Studio.UIHints/Extensions/InputDescriptorCheckListExtensions.cs#L15-L30
95c37625ffcdfde09f1a3244a386b0ab005cdd82
elsa-studio
github_2023
elsa-workflows
csharp
RemoteLogPersistenceStrategyService.GetLogPersistenceStrategiesAsync
public async Task<IEnumerable<LogPersistenceStrategyDescriptor>> GetLogPersistenceStrategiesAsync(CancellationToken cancellationToken = default) { if (_descriptors == null) { var api = await backendApiClientProvider.GetApiAsync<ILogPersistenceStrategiesApi>(cancellationToken); ...
/// <inheritdoc />
https://github.com/elsa-workflows/elsa-studio/blob/95c37625ffcdfde09f1a3244a386b0ab005cdd82/src/modules/Elsa.Studio.Workflows.Core/Domain/Services/RemoteLogPersistenceStrategyService.cs#L13-L23
95c37625ffcdfde09f1a3244a386b0ab005cdd82
elsa-studio
github_2023
elsa-workflows
csharp
RemoteWorkflowDefinitionService.ListAsync
public async Task<PagedListResponse<WorkflowDefinitionSummary>> ListAsync(ListWorkflowDefinitionsRequest request, VersionOptions? versionOptions = null, CancellationToken cancellationToken = default) { var api = await GetApiAsync(cancellationToken); return await api.ListAsync(request, versionOptions...
/// <inheritdoc />
https://github.com/elsa-workflows/elsa-studio/blob/95c37625ffcdfde09f1a3244a386b0ab005cdd82/src/modules/Elsa.Studio.Workflows.Core/Domain/Services/WorkflowDefinitionService.cs#L25-L29
95c37625ffcdfde09f1a3244a386b0ab005cdd82
AspNetStatic
github_2023
ZarehD
csharp
HttpContextExtensions.IsAspNetStaticRequest
public static bool IsAspNetStaticRequest(this HttpRequest request) => (request is not null) && request.Headers.TryGetValue(HeaderNames.UserAgent, out var ua) && ua.Contains(Consts.AspNetStatic);
/// <summary>
https://github.com/ZarehD/AspNetStatic/blob/25aced55cddc84eaf910363ec377ffef99853e7b/src/AspNetStatic/HttpContextExtensions.cs#L33-L36
25aced55cddc84eaf910363ec377ffef99853e7b
AspNetStatic
github_2023
ZarehD
csharp
StaticGeneratorHostExtension.GenerateStaticContent
public static void GenerateStaticContent( this IHost host, string destinationRoot, bool exitWhenDone = default, bool alwaysDefaultFile = default, bool dontUpdateLinks = default, bool dontOptimizeContent = default, TimeSpan? regenerationInterval = default, ulong httpTimeoutSeconds = c_DefaultHttp...
/// <summary>
https://github.com/ZarehD/AspNetStatic/blob/25aced55cddc84eaf910363ec377ffef99853e7b/src/AspNetStatic/StaticGeneratorHostExtension.cs#L86-L215
25aced55cddc84eaf910363ec377ffef99853e7b
azure-search-openai-demo-csharp
github_2023
Azure-Samples
csharp
StringExtensions.ToCitationUrl
internal static string ToCitationUrl(this string fileName, string baseUrl) { var builder = new UriBuilder(baseUrl); builder.Path += $"/{fileName}"; builder.Fragment = "view-fitV"; return builder.Uri.AbsoluteUri; }
/// <summary>
https://github.com/Azure-Samples/azure-search-openai-demo-csharp/blob/fd451e3cef53fe0c65ae8c283d95a389e4f203bd/app/frontend/Extensions/StringExtensions.cs#L11-L18
fd451e3cef53fe0c65ae8c283d95a389e4f203bd
devhomegithubextension
github_2023
microsoft
csharp
DeveloperIdTests.LoginUI_ControllerPATLoginTest_Success
[TestMethod] [TestCategory("LiveData")] public async Task LoginUI_ControllerPATLoginTest_Success() { // Create DataRows during Runtime since these need Env vars RuntimeDataRow[] dataRows = { new() ...
/* This test requires the following environment variables to be set: * DEV_HOME_TEST_GITHUB_ENTERPRISE_SERVER : The host address of the GitHub Enterprise Server to test against * DEV_HOME_TEST_GITHUB_COM_PAT : A valid Personal Access Token for GitHub.com (with at least repo_public permissions) * DEV_HOME...
https://github.com/microsoft/devhomegithubextension/blob/054645220c7e9e71dd7c75a9781d36964af346c0/test/GitHubExtension/DeveloperId/LoginUITests.cs#L149-L205
054645220c7e9e71dd7c75a9781d36964af346c0
S7CommPlusDriver
github_2023
thomas-v2
csharp
POffsetInfoType_FbArray.IsMDim
public override bool IsMDim() { return false; }
//!!! TODO
https://github.com/thomas-v2/S7CommPlusDriver/blob/76ca5e78cba06628146591277adf3dfafd62ca63/src/S7CommPlusDriver/Core/POffsetInfoType.cs#L120-L120
76ca5e78cba06628146591277adf3dfafd62ca63
JitHubV2
github_2023
JitHubApp
csharp
WebView2Ex.RegisterDragDropEvents
void RegisterDragDropEvents() { var manager = CoreDragDropManager.GetForCurrentView(); manager.TargetRequested += TargetRequested; }
//LinkedListNode<ICoreDropOperationTarget>? thisNode;
https://github.com/JitHubApp/JitHubV2/blob/01d7d884407b4b92a51cf0a95c08e95ed2acde5d/JitHub.WebView/UI/WebView2Ex.DragDrop.cs#L26-L30
01d7d884407b4b92a51cf0a95c08e95ed2acde5d
FSR3Unity
github_2023
ndepoel
csharp
IntParameter.Interp
public override void Interp(int from, int to, float t) { // Int snapping interpolation. Don't use this for enums as they don't necessarily have // contiguous values. Use the default interpolator instead (same as bool). value = (int)(from + (to - from) * t); }
/// <summary>
https://github.com/ndepoel/FSR3Unity/blob/71879e71aa72465a79bdf009d7d71f9f7ab83066/Packages/com.unity.postprocessing/PostProcessing/Runtime/ParameterOverride.cs#L233-L238
71879e71aa72465a79bdf009d7d71f9f7ab83066
SqlParser-cs
github_2023
TylerBrinks
csharp
ParserTestBase.ParseSqlStatements
public Sequence<Statement?> ParseSqlStatements(string sql, IEnumerable<Dialect> dialects, bool unescape = false, ParserOptions? options = null) { options ??= new ParserOptions { Unescape = unescape }; return OneOfIdenticalResults(dialect => { options.TrailingCommas |= dialect.Sup...
// Ensures that `sql` parses as a single statement and returns it.
https://github.com/TylerBrinks/SqlParser-cs/blob/66aea72a1cb0ed72e3f50cc4bf83326de41b93c2/src/SqlParser.Tests/ParserTestBase.cs#L172-L180
66aea72a1cb0ed72e3f50cc4bf83326de41b93c2