hexsha stringlengths 40 40 | size int64 5 1.05M | ext stringclasses 588
values | lang stringclasses 305
values | max_stars_repo_path stringlengths 3 363 | max_stars_repo_name stringlengths 5 118 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count float64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringdate 2015-01-01 00:00:35 2022-03-31 23:43:49 ⌀ | max_stars_repo_stars_event_max_datetime stringdate 2015-01-01 12:37:38 2022-03-31 23:59:52 ⌀ | max_issues_repo_path stringlengths 3 363 | max_issues_repo_name stringlengths 5 118 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count float64 1 134k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 3 363 | max_forks_repo_name stringlengths 5 135 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count float64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringdate 2015-01-01 00:01:02 2022-03-31 23:27:27 ⌀ | max_forks_repo_forks_event_max_datetime stringdate 2015-01-03 08:55:07 2022-03-31 23:59:24 ⌀ | content stringlengths 5 1.05M | avg_line_length float64 1.13 1.04M | max_line_length int64 1 1.05M | alphanum_fraction float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f34811e9f021929f5f33c78a9e5bf6f9b9c33e7e | 262 | cs | C# | Mindstorms.Core/Music/438/E2.cs | Mortens4444/LegoMindstromsEV3 | d50bf6b1b2572c62ff00625f5c431bcf83f20c7c | [
"MIT"
] | null | null | null | Mindstorms.Core/Music/438/E2.cs | Mortens4444/LegoMindstromsEV3 | d50bf6b1b2572c62ff00625f5c431bcf83f20c7c | [
"MIT"
] | null | null | null | Mindstorms.Core/Music/438/E2.cs | Mortens4444/LegoMindstromsEV3 | d50bf6b1b2572c62ff00625f5c431bcf83f20c7c | [
"MIT"
] | null | null | null | namespace Mindstorms.Core.Music._438
{
public class E2 : Note
{
public E2(NoteType noteType = NoteType.Quarter) : base(noteType)
{
Name = "E2";
Frequency = 82.03;
WaveLength = 420.57;
}
}
}
| 20.153846 | 72 | 0.51145 |
f384de021465481d7e4f6566fa87e7fe29c89eb2 | 184 | cs | C# | Parser/Src/Parser.Auth.Remote/Factories/IRemoteUserFactory.cs | shakuu/parser | 1cc7f0c8405db24deff5269fa1f237a32169f1f4 | [
"MIT"
] | null | null | null | Parser/Src/Parser.Auth.Remote/Factories/IRemoteUserFactory.cs | shakuu/parser | 1cc7f0c8405db24deff5269fa1f237a32169f1f4 | [
"MIT"
] | null | null | null | Parser/Src/Parser.Auth.Remote/Factories/IRemoteUserFactory.cs | shakuu/parser | 1cc7f0c8405db24deff5269fa1f237a32169f1f4 | [
"MIT"
] | null | null | null | using Parser.Auth.Remote.Models;
namespace Parser.Auth.Remote.Factories
{
public interface IRemoteUserFactory
{
RemoteUser CreateRemoteUser(string username);
}
}
| 18.4 | 53 | 0.728261 |
ee6f948b6f567675362b3948184912f878cbff52 | 453 | cs | C# | Compiler/Saltarelle.Compiler/Compiler/VariableData.cs | AstrorEnales/SaltarelleCompiler | 96f5e862e8e94ad1eb5bfdaa90e2ec72e409f6e8 | [
"Apache-2.0"
] | 86 | 2015-07-06T17:37:24.000Z | 2021-12-01T02:30:49.000Z | Compiler/Saltarelle.Compiler/Compiler/VariableData.cs | AstrorEnales/SaltarelleCompiler | 96f5e862e8e94ad1eb5bfdaa90e2ec72e409f6e8 | [
"Apache-2.0"
] | 58 | 2015-01-06T11:43:56.000Z | 2015-06-23T15:28:24.000Z | Compiler/Saltarelle.Compiler/Compiler/VariableData.cs | AstrorEnales/SaltarelleCompiler | 96f5e862e8e94ad1eb5bfdaa90e2ec72e409f6e8 | [
"Apache-2.0"
] | 33 | 2015-08-19T18:51:18.000Z | 2022-02-11T08:29:07.000Z | using ICSharpCode.NRefactory.CSharp;
namespace Saltarelle.Compiler.Compiler {
public class VariableData {
public string Name { get; private set; }
public AstNode DeclaringMethod { get; private set; }
public bool UseByRefSemantics { get; private set; }
public VariableData(string name, AstNode declaringMethod, bool useByRefSemantics) {
Name = name;
DeclaringMethod = declaringMethod;
UseByRefSemantics = useByRefSemantics;
}
}
}
| 28.3125 | 85 | 0.757174 |
eec180da930ff0b81727946f0f0635c64058d5e0 | 11,809 | cs | C# | GitlabCleaner/MainForm.cs | Programistyk/GitLabPipelinesCleaner | e2ec78c5674792f5d8780289c6fd4f02c6fb5325 | [
"MIT"
] | null | null | null | GitlabCleaner/MainForm.cs | Programistyk/GitLabPipelinesCleaner | e2ec78c5674792f5d8780289c6fd4f02c6fb5325 | [
"MIT"
] | null | null | null | GitlabCleaner/MainForm.cs | Programistyk/GitLabPipelinesCleaner | e2ec78c5674792f5d8780289c6fd4f02c6fb5325 | [
"MIT"
] | null | null | null | using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Windows.Forms;
using GitLabApiClient;
using GitLabApiClient.Models.Pipelines;
namespace GitlabCleaner
{
public partial class MainForm : Form
{
private GitLabClient client;
private readonly ListViewItemComparer lviComparer;
private PictureBox userAvatar;
public MainForm()
{
InitializeComponent();
lviComparer = new ListViewItemComparer();
listView1.ListViewItemSorter = lviComparer;
}
private void settingsButton_Click(object sender, EventArgs e)
{
SettingsForm form = new SettingsForm();
form.ShowDialog();
form.Dispose();
}
private async void connectButton_Click(object sender, EventArgs e)
{
if (Properties.Settings.Default.apikey.Length == 0 || Properties.Settings.Default.url.Length == 0)
{
return;
}
try
{
listView1.UseWaitCursor = true;
if (client == null)
{
client = new GitLabClient(Properties.Settings.Default.url, Properties.Settings.Default.apikey);
}
listView1.Items.Clear();
toolStripStatusLabel1.Text = Properties.Resources.Connecting;
toolStripProgressBar1.Style = ProgressBarStyle.Marquee;
GitLabApiClient.Models.Users.Responses.Session session = await client.Users.GetCurrentSessionAsync().ConfigureAwait(true);
toolStripStatusLabel1.Text = Properties.Resources.DownloadingAvatar;
toolStripLabel1.Text = session.Name;
userAvatar = new PictureBox
{
ImageLocation = session.AvatarUrl
};
userAvatar.LoadAsync();
userAvatar.LoadCompleted += delegate { toolStripLabel1.Image = userAvatar.Image; };
userAvatar.Dispose();
toolStripStatusLabel1.Text = Properties.Resources.DownloadingProjects;
IList<GitLabApiClient.Models.Projects.Responses.Project> projects = await client.Projects.GetAsync().ConfigureAwait(true);
toolStripStatusLabel1.Text = Properties.Resources.DownloadingPipelines;
toolStripProgressBar1.Value = 0;
toolStripProgressBar1.Maximum = projects.Count;
toolStripProgressBar1.Style = ProgressBarStyle.Continuous;
listView1.Items.Clear();
foreach (GitLabApiClient.Models.Projects.Responses.Project project in projects)
{
toolStripProgressBar1.PerformStep();
toolStripStatusLabel1.Text = String.Format(CultureInfo.CurrentCulture, Properties.Resources.DownloadingPipelineProgress, toolStripProgressBar1.Value, toolStripProgressBar1.Maximum, Math.Ceiling(toolStripProgressBar1.Value / toolStripProgressBar1.Maximum * 100.0));
ListViewGroup group = new ListViewGroup(project.NameWithNamespace);
group.Tag = project;
listView1.Groups.Add(group);
IList<GitLabApiClient.Models.Pipelines.Responses.Pipeline> pipelines = await client.Pipelines.GetAsync(project.Id).ConfigureAwait(true);
listView1.BeginUpdate();
foreach (GitLabApiClient.Models.Pipelines.Responses.Pipeline pipeline in pipelines)
{
ListViewItem item = new ListViewItem(String.Format(CultureInfo.InvariantCulture, "{0}", pipeline.Id), group);
item.Tag = pipeline;
item.SubItems.Add(new ListViewItem.ListViewSubItem(item, Properties.Resources.ResourceManager.GetString(String.Format(CultureInfo.InvariantCulture, "status.{0}", pipeline.Status), CultureInfo.CurrentCulture)));
item.SubItems.Add(new ListViewItem.ListViewSubItem(item, pipeline.UpdatedAt.ToString()));
listView1.Items.Add(item);
}
listView1.EndUpdate();
}
selectDropdownButton.Enabled = true;
connectButton.Enabled = false;
}
catch (Exception ex)
{
selectDropdownButton.Enabled = false;
MessageBox.Show(ex.Message, Properties.Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
finally
{
toolStripStatusLabel1.Text = Properties.Resources.Ready;
toolStripProgressBar1.Value = 0;
listView1.UseWaitCursor = false;
}
}
private void listView1_ColumnClick(object sender, ColumnClickEventArgs e)
{
lviComparer.toggleSortOnColumn(e.Column);
listView1.Sort();
}
private void listView1_ItemChecked(object sender, ItemCheckedEventArgs e)
{
removeSelectionButton.Enabled = listView1.CheckedItems.Count > 0;
toolStripStatusLabel1.Text = String.Format(CultureInfo.InvariantCulture, Properties.Resources.SelectedProgress, listView1.CheckedItems.Count, listView1.Items.Count);
}
private async void removeSelectionButton_Click(object sender, EventArgs e)
{
toolStripStatusLabel1.Text = Properties.Resources.RemovingPipelines;
toolStripProgressBar1.Style = ProgressBarStyle.Continuous;
toolStripProgressBar1.Value = 0;
toolStripProgressBar1.Maximum = listView1.CheckedItems.Count;
listView1.Enabled = false;
listView1.UseWaitCursor = true;
listView1.BeginUpdate();
foreach (ListViewItem item in listView1.CheckedItems)
{
toolStripProgressBar1.PerformStep();
toolStripStatusLabel1.Text = String.Format(CultureInfo.CurrentCulture, Properties.Resources.RemovingPipelinesProgress, toolStripProgressBar1.Value, toolStripProgressBar1.Maximum, Math.Ceiling(toolStripProgressBar1.Value / toolStripProgressBar1.Maximum * 100.0));
await client.Pipelines.DeleteAsync(((GitLabApiClient.Models.Projects.Responses.Project)item.Group.Tag).Id, ((GitLabApiClient.Models.Pipelines.Responses.Pipeline)item.Tag).Id).ConfigureAwait(true);
listView1.Items.Remove(item);
}
listView1.EndUpdate();
toolStripStatusLabel1.Text = Properties.Resources.RemovingFinished;
toolStripProgressBar1.Value = 0;
listView1.Enabled = true;
listView1.UseWaitCursor = false;
}
private static bool statusComparator(ListViewItem item, PipelineStatus status)
{
return ((GitLabApiClient.Models.Pipelines.Responses.Pipeline)item.Tag).Status == status;
}
private static bool dateComparator(ListViewItem item, int months_old)
{
DateTime? pipeline_date = ((GitLabApiClient.Models.Pipelines.Responses.Pipeline)item.Tag).CreatedAt;
if (pipeline_date != null)
{
DateTime limit = DateTime.Now.AddMonths(-1 * months_old);
return pipeline_date <= limit;
}
return false;
}
private void selectAllMenuItem_Click(object sender, EventArgs e)
{
listView1.BeginUpdate();
foreach (ListViewItem item in listView1.Items)
{
item.Checked = true;
}
listView1.EndUpdate();
}
private void selectNoneMenuItem_Click(object sender, EventArgs e)
{
listView1.BeginUpdate();
foreach (ListViewItem item in listView1.Items)
{
item.Checked = false;
}
listView1.EndUpdate();
}
private void selectInvertMenuItem_Click(object sender, EventArgs e)
{
listView1.BeginUpdate();
foreach (ListViewItem item in listView1.Items)
{
item.Checked = !item.Checked;
}
listView1.EndUpdate();
}
private void selectSuccessMenuItem_Click(object sender, EventArgs e)
{
listView1.BeginUpdate();
foreach (ListViewItem item in listView1.Items)
{
item.Checked = statusComparator(item, PipelineStatus.Success);
}
listView1.EndUpdate();
}
private void selectFailureMenuItem_Click(object sender, EventArgs e)
{
listView1.BeginUpdate();
foreach (ListViewItem item in listView1.Items)
{
item.Checked = statusComparator(item, PipelineStatus.Failed);
}
listView1.EndUpdate();
}
private void selectManualMenuItem_Click(object sender, EventArgs e)
{
listView1.BeginUpdate();
foreach (ListViewItem item in listView1.Items)
{
item.Checked = statusComparator(item, PipelineStatus.Manual);
}
listView1.EndUpdate();
}
private void selectCanceledMenuitem_Click(object sender, EventArgs e)
{
listView1.BeginUpdate();
foreach (ListViewItem item in listView1.Items)
{
item.Checked = statusComparator(item, PipelineStatus.Canceled);
}
listView1.EndUpdate();
}
private void selectOlder1mMenuItem_Click(object sender, EventArgs e)
{
listView1.BeginUpdate();
foreach (ListViewItem item in listView1.Items)
{
item.Checked = dateComparator(item, 1);
}
listView1.EndUpdate();
}
private void selectOlder3mMenuItem_Click(object sender, EventArgs e)
{
listView1.BeginUpdate();
foreach (ListViewItem item in listView1.Items)
{
item.Checked = dateComparator(item, 3);
}
listView1.EndUpdate();
}
private void selectOlder6mMenuItem_Click(object sender, EventArgs e)
{
listView1.BeginUpdate();
foreach (ListViewItem item in listView1.Items)
{
item.Checked = dateComparator(item, 6);
}
listView1.EndUpdate();
}
private void selectOlder12mMenuItem_Click(object sender, EventArgs e)
{
listView1.BeginUpdate();
foreach (ListViewItem item in listView1.Items)
{
item.Checked = dateComparator(item, 12);
}
listView1.EndUpdate();
}
}
class ListViewItemComparer : IComparer
{
private int col;
private int last_column;
private bool revert;
public ListViewItemComparer()
{
col = 0;
last_column = 0;
revert = false;
}
public void toggleSortOnColumn(int column)
{
if (column == last_column)
{
revert = !revert;
} else
{
revert = false;
col = column;
last_column = col;
}
}
public int Compare(object x, object y)
{
return (revert ? -1 : 1) * String.Compare(((ListViewItem)x).SubItems[col].Text, ((ListViewItem)y).SubItems[col].Text, StringComparison.OrdinalIgnoreCase);
}
}
}
| 38.845395 | 284 | 0.589381 |
a063b2cd21f7c7189ad27545a1017cce84fe706b | 854 | cs | C# | DomainFramework.Tests/EmployeeWithSpouse/EmployeeBoundedContext/InputDataTransferObjects/PhoneNumberInputDto.cs | jgonte/DomainFramework | f6ed40f395cdafb9ae5ef3fecdbb4edc1879029e | [
"MIT"
] | null | null | null | DomainFramework.Tests/EmployeeWithSpouse/EmployeeBoundedContext/InputDataTransferObjects/PhoneNumberInputDto.cs | jgonte/DomainFramework | f6ed40f395cdafb9ae5ef3fecdbb4edc1879029e | [
"MIT"
] | null | null | null | DomainFramework.Tests/EmployeeWithSpouse/EmployeeBoundedContext/InputDataTransferObjects/PhoneNumberInputDto.cs | jgonte/DomainFramework | f6ed40f395cdafb9ae5ef3fecdbb4edc1879029e | [
"MIT"
] | null | null | null | using DomainFramework.Core;
using System;
using System.Collections.Generic;
using Utilities.Validation;
namespace EmployeeWithSpouse.EmployeeBoundedContext
{
public class PhoneNumberInputDto : IInputDataTransferObject
{
public string AreaCode { get; set; }
public string Exchange { get; set; }
public string Number { get; set; }
public virtual void Validate(ValidationResult result)
{
AreaCode.ValidateRequired(result, nameof(AreaCode));
AreaCode.ValidateMaxLength(result, nameof(AreaCode), 3);
Exchange.ValidateRequired(result, nameof(Exchange));
Exchange.ValidateMaxLength(result, nameof(Exchange), 3);
Number.ValidateRequired(result, nameof(Number));
Number.ValidateMaxLength(result, nameof(Number), 4);
}
}
} | 26.6875 | 68 | 0.674473 |
edb675ed33abfa84b9245bd454f78b4673aa4116 | 782 | cs | C# | src/Builder/ESRI.ArcGIS.Mapping.Builder.Server/SaveConfigurationStoreXmlHandlerBase.cs | Esri/arcgis-viewer-silverlight | db982ddd671d9261d374867ac450c7389334ba59 | [
"MS-PL"
] | 7 | 2015-01-28T03:54:02.000Z | 2021-02-22T06:49:49.000Z | src/Builder/ESRI.ArcGIS.Mapping.Builder.Server/SaveConfigurationStoreXmlHandlerBase.cs | Esri/arcgis-viewer-silverlight | db982ddd671d9261d374867ac450c7389334ba59 | [
"MS-PL"
] | 4 | 2015-01-05T15:44:36.000Z | 2018-01-17T14:58:14.000Z | src/Builder/ESRI.ArcGIS.Mapping.Builder.Server/SaveConfigurationStoreXmlHandlerBase.cs | Esri/arcgis-viewer-silverlight | db982ddd671d9261d374867ac450c7389334ba59 | [
"MS-PL"
] | 8 | 2015-02-10T10:31:12.000Z | 2017-11-24T13:53:17.000Z | /*
(c) Copyright ESRI.
This source is subject to the Microsoft Public License (Ms-PL).
Please see https://opensource.org/licenses/ms-pl for details.
All other rights reserved.
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace ESRI.ArcGIS.Mapping.Builder.Server
{
public abstract class SaveConfigurationStoreXmlHandlerBase : ServiceRequestHandlerBase
{
protected override void HandleRequest()
{
string xml = null;
using (StreamReader reader = new StreamReader(Request.InputStream))
{
xml = reader.ReadToEnd();
}
SaveConfigurationStoreXml(xml);
}
protected abstract void SaveConfigurationStoreXml(string xml);
}
}
| 26.066667 | 90 | 0.672634 |
edc4f6312f41f1ab46d4d06c691c6d17eeb9ae49 | 359 | cs | C# | SimpleIdentityServer/src/Apis/Common/SimpleIdServer.Storage/StorageOptionsBuilder.cs | appkins/SimpleIdentityServer | 5712aefff2ada84e08d0a38c42b1de5e820a0d24 | [
"Apache-2.0"
] | 71 | 2015-10-22T14:14:36.000Z | 2022-01-05T00:28:28.000Z | SimpleIdentityServer/src/Apis/Common/SimpleIdServer.Storage/StorageOptionsBuilder.cs | appkins/SimpleIdentityServer | 5712aefff2ada84e08d0a38c42b1de5e820a0d24 | [
"Apache-2.0"
] | 269 | 2015-10-26T17:41:59.000Z | 2019-12-01T02:39:31.000Z | SimpleIdentityServer/src/Apis/Common/SimpleIdServer.Storage/StorageOptionsBuilder.cs | appkins/SimpleIdentityServer | 5712aefff2ada84e08d0a38c42b1de5e820a0d24 | [
"Apache-2.0"
] | 23 | 2015-12-11T17:51:12.000Z | 2020-12-24T13:27:18.000Z | using Microsoft.Extensions.DependencyInjection;
namespace SimpleIdServer.Storage
{
public class StorageOptionsBuilder
{
public StorageOptionsBuilder(IServiceCollection serviceCollection)
{
ServiceCollection = serviceCollection;
}
public IServiceCollection ServiceCollection { get; private set; }
}
}
| 23.933333 | 74 | 0.710306 |
edfb172680c8a610313ece1d71c78478653e6712 | 551 | cs | C# | Assets/Scripts/Mainmenu/Menudisable.cs | V1v1d-Dreams/20C | e035d7f97ab9f8da06742e5165a09e7441737e01 | [
"MIT"
] | null | null | null | Assets/Scripts/Mainmenu/Menudisable.cs | V1v1d-Dreams/20C | e035d7f97ab9f8da06742e5165a09e7441737e01 | [
"MIT"
] | null | null | null | Assets/Scripts/Mainmenu/Menudisable.cs | V1v1d-Dreams/20C | e035d7f97ab9f8da06742e5165a09e7441737e01 | [
"MIT"
] | null | null | null | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class Menudisable : MonoBehaviour
{
[SerializeField] GameObject canvas;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if(SceneManager.GetActiveScene().buildIndex == 0)
{
canvas.SetActive(false);
}
else
{
canvas.SetActive(true);
}
}
}
| 19 | 57 | 0.595281 |
d97b07b6a8a1d04a359f43d7b11e078862739158 | 1,827 | cs | C# | src/DataCore.Adapter/AdapterOptions.cs | intelligentplant/AppStoreConnect.Adapters | 50c113602615437fc9a456ed83021385594670f4 | [
"Apache-2.0",
"MIT"
] | null | null | null | src/DataCore.Adapter/AdapterOptions.cs | intelligentplant/AppStoreConnect.Adapters | 50c113602615437fc9a456ed83021385594670f4 | [
"Apache-2.0",
"MIT"
] | 10 | 2020-09-18T08:32:31.000Z | 2022-02-14T08:15:08.000Z | src/DataCore.Adapter/AdapterOptions.cs | intelligentplant/AppStoreConnect.Adapters | 50c113602615437fc9a456ed83021385594670f4 | [
"Apache-2.0",
"MIT"
] | null | null | null | using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace DataCore.Adapter {
/// <summary>
/// Base class for runtime options for adapters deriving from <see cref="AdapterBase{TAdapterOptions}"/>.
/// </summary>
public class AdapterOptions {
/// <summary>
/// The adapter name. If <see langword="null"/> or white space, the adapter ID will be
/// used as the name.
/// </summary>
[MaxLength(AdapterConstants.MaxNameLength)]
[Display(
ResourceType = typeof(AdapterOptionsResources),
Name = nameof(AdapterOptionsResources.AdapterOptions_Name_DisplayName),
Description = nameof(AdapterOptionsResources.AdapterOptions_Name_Description),
Order = 0
)]
public string? Name { get; set; }
/// <summary>
/// The adapter description.
/// </summary>
[MaxLength(AdapterConstants.MaxDescriptionLength)]
[Display(
ResourceType = typeof(AdapterOptionsResources),
Name = nameof(AdapterOptionsResources.AdapterOptions_Description_DisplayName),
Description = nameof(AdapterOptionsResources.AdapterOptions_Description_Description),
Order = 1
)]
public string? Description { get; set; }
/// <summary>
/// A flag indicating if the adapter is enabled or not.
/// </summary>
[Display(
ResourceType = typeof(AdapterOptionsResources),
Name = nameof(AdapterOptionsResources.AdapterOptions_IsEnabled_DisplayName),
Description = nameof(AdapterOptionsResources.AdapterOptions_IsEnabled_Description),
Order = 2
)]
[DefaultValue(true)]
public bool IsEnabled { get; set; } = true;
}
}
| 36.54 | 109 | 0.633826 |
f2dfd438407a036f83a512c8bb448f646cff5639 | 6,298 | cs | C# | GenerateDatabaseFile/MainWindow.xaml.cs | tstavrianos/FolderCompare | 06b32512add516342092566ba4d83dac83de4cb6 | [
"MIT"
] | 1 | 2019-09-25T12:31:44.000Z | 2019-09-25T12:31:44.000Z | GenerateDatabaseFile/MainWindow.xaml.cs | tstavrianos/FolderCompare | 06b32512add516342092566ba4d83dac83de4cb6 | [
"MIT"
] | 99 | 2019-10-21T07:16:38.000Z | 2022-03-22T07:14:53.000Z | GenerateDatabaseFile/MainWindow.xaml.cs | tstavrianos/FolderCompare | 06b32512add516342092566ba4d83dac83de4cb6 | [
"MIT"
] | null | null | null | using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using System.Threading.Tasks.Dataflow;
using System.Windows;
using Newtonsoft.Json;
using Standart.Hash.xxHash;
// ReSharper disable UnusedAutoPropertyAccessor.Local
// ReSharper disable AccessToDisposedClosure
namespace GenerateDatabaseFile
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public sealed partial class MainWindow : INotifyPropertyChanged
{
public string SelectedDirectory { get; set; }
public string SelectedFile { get; set; }
private readonly ConcurrentDictionary<string, DbEntry> _database = new ConcurrentDictionary<string, DbEntry>();
private sealed class DbEntry
{
public DateTime LastWrite { get; }
public ulong Hash { get; }
public long Size { get; }
public DbEntry(DateTime lastWrite, ulong hash, long size)
{
this.LastWrite = lastWrite;
this.Hash = hash;
this.Size = size;
}
}
private sealed class SourceFile
{
public SourceFile(string filePath, Stream data, DateTime lastWrite)
{
this.FilePath = filePath;
this.Data = data;
this.Size = data.Length;
this.LastWrite = lastWrite;
}
public string FilePath { get; }
public Stream Data { get; }
public long Size { get; }
public DateTime LastWrite { get; }
}
private sealed class TargetFile
{
public TargetFile(string filePath, ulong hash, long size, DateTime lastWrite)
{
this.FilePath = filePath;
this.Hash = hash;
this.Size = size;
this.LastWrite = lastWrite;
}
public string FilePath { get; }
public ulong Hash { get; }
public long Size { get; }
public DateTime LastWrite { get; }
}
private int _filesFound;
public int FilesFound
{
get => this._filesFound;
set => this._UpdateField(ref this._filesFound, value);
}
private bool _controlsEnabled = true;
public bool ControlsEnabled
{
get => this._controlsEnabled;
set => this._UpdateField(ref this._controlsEnabled, value);
}
private bool? _hashFiles = false;
public bool? HashFiles
{
get => this._hashFiles;
set => this._UpdateField(ref this._hashFiles, value);
}
public MainWindow()
{
this.InitializeComponent();
}
private async Task Generate()
{
if (string.IsNullOrEmpty(this.SelectedFile) || string.IsNullOrEmpty(this.SelectedDirectory) ||
!Directory.Exists(this.SelectedDirectory)) return;
this.FilesFound = 0;
this.ControlsEnabled = false;
var getFilesBlock = new TransformBlock<FileInfo, SourceFile>(file =>
new SourceFile(file.FullName.Remove(0, this.SelectedDirectory.Length),
file.OpenRead(), file.LastWriteTimeUtc)); //Only lets one thread do this at a time.
var hashFilesBlock = new TransformBlock<SourceFile, TargetFile>(this.HashFile,
new ExecutionDataflowBlockOptions
{
MaxDegreeOfParallelism = Environment.ProcessorCount, //We can multi-thread this part.
BoundedCapacity = Environment.ProcessorCount
}); //Only allow 50 byte[]'s to be waiting in the queue. It will unblock getFilesBlock once there is room.
var writeHashedFiles = new ActionBlock<TargetFile>(this.WriteHashedFile,
new ExecutionDataflowBlockOptions
{
BoundedCapacity = Environment.ProcessorCount
}); //MaxDegreeOfParallelism defaults to 1 so we don't need to specifiy it.
getFilesBlock.LinkTo(hashFilesBlock, new DataflowLinkOptions { PropagateCompletion = true });
hashFilesBlock.LinkTo(writeHashedFiles, new DataflowLinkOptions { PropagateCompletion = true });
var di = new DirectoryInfo(this.SelectedDirectory);
foreach (var filePath in di.EnumerateFiles("*", SearchOption.AllDirectories))
{
await getFilesBlock.SendAsync(filePath).ConfigureAwait(false);
}
getFilesBlock.Complete();
await writeHashedFiles.Completion.ConfigureAwait(false);
var output = JsonConvert.SerializeObject(this._database, Formatting.Indented);
File.WriteAllText(this.SelectedFile, output);
this.ControlsEnabled = true;
}
private void _UpdateField<T>(ref T field, T newValue, [CallerMemberName] string propertyName = null)
{
if (EqualityComparer<T>.Default.Equals(field, newValue)) return;
field = newValue;
this._OnPropertyChanged(propertyName);
}
private void _OnPropertyChanged(string propertyName)
{
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public event PropertyChangedEventHandler PropertyChanged;
private TargetFile HashFile(SourceFile dto)
{
ulong hash = 0;
if (this.HashFiles == true)
hash = xxHash64.ComputeHash(dto.Data);
dto.Data.Dispose();
var path = dto.FilePath[0] == '\\' ? dto.FilePath.Substring(1) : dto.FilePath;
return new TargetFile(path, hash, dto.Size, dto.LastWrite);
}
private void WriteHashedFile(TargetFile arg)
{
this.FilesFound++;
this._database.TryAdd(arg.FilePath, new DbEntry(arg.LastWrite, arg.Hash, arg.Size));
}
private async void GenerateCommand(object sender, RoutedEventArgs e)
{
await this.Generate();
}
}
} | 35.784091 | 122 | 0.598444 |
9375f76365783988f479a3b22fad4febe07f3e2e | 637 | cs | C# | src/reactive.pipes.scheduled/IScheduleStore.cs | JTOne123/reactive-pipes | 753ae17fc961c214ade26b420fc4f7118581de2c | [
"Apache-2.0"
] | 13 | 2016-05-31T22:34:24.000Z | 2020-01-04T19:01:52.000Z | src/reactive.pipes.scheduled/IScheduleStore.cs | JTOne123/reactive-pipes | 753ae17fc961c214ade26b420fc4f7118581de2c | [
"Apache-2.0"
] | 4 | 2017-11-14T05:25:44.000Z | 2018-06-22T17:45:44.000Z | src/reactive.pipes.scheduled/IScheduleStore.cs | JTOne123/reactive-pipes | 753ae17fc961c214ade26b420fc4f7118581de2c | [
"Apache-2.0"
] | 2 | 2017-11-14T04:57:36.000Z | 2020-06-25T11:09:00.000Z | // Copyright (c) Daniel Crenna. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
namespace reactive.pipes.scheduled
{
public interface IScheduleStore
{
IList<ScheduledTask> GetAll();
IList<ScheduledTask> GetByAllTags(params string[] tags);
IList<ScheduledTask> GetByAnyTags(params string[] tags);
ScheduledTask GetById(int id);
IList<ScheduledTask> GetHangingTasks();
void Save(ScheduledTask task);
void Delete(ScheduledTask task);
IList<ScheduledTask> GetAndLockNextAvailable(int readAhead);
}
} | 30.333333 | 111 | 0.77708 |
d66bfb2eeaabe6e99a8e517305150a915e8a5157 | 1,334 | cs | C# | src/CompletedPoint.cs | fbredy/ristretto-dotnet | c5a139cffefe0d02ed9062f48475e389170ec2b8 | [
"Apache-2.0"
] | 2 | 2021-05-17T14:12:04.000Z | 2022-03-11T10:34:34.000Z | src/CompletedPoint.cs | fbredy/ristretto-dotnet | c5a139cffefe0d02ed9062f48475e389170ec2b8 | [
"Apache-2.0"
] | null | null | null | src/CompletedPoint.cs | fbredy/ristretto-dotnet | c5a139cffefe0d02ed9062f48475e389170ec2b8 | [
"Apache-2.0"
] | null | null | null | namespace Ristretto
{
/// <summary>
/// A point ((X:Z), (Y:T)) on the P^1 \times P^1 model of the curve.
/// </summary>
public class CompletedPoint
{
readonly FieldElement X;
readonly FieldElement Y;
readonly FieldElement Z;
readonly FieldElement T;
public CompletedPoint(FieldElement X, FieldElement Y, FieldElement Z, FieldElement T)
{
this.X = X;
this.Y = Y;
this.Z = Z;
this.T = T;
}
/// <summary>
/// Convert this point from the P^1 \times P^1 model to the P^2 model.
/// </summary>
/// <returns>This costs 3 M.</returns>
public ProjectivePoint ToProjective()
{
return new ProjectivePoint(this.X.Multiply(this.T), Y.Multiply(this.Z), this.Z.Multiply(this.T));
}
/// <summary>
/// Convert this point from the P^1 * P^1 model to the P^3 model.
/// This costs 4 M.
/// </summary>
/// <returns></returns>
public EdwardsPoint ToExtended()
{
return new EdwardsPoint(
this.X.Multiply(this.T),
Y.Multiply(this.Z),
this.Z.Multiply(this.T),
this.X.Multiply(this.Y));
}
}
}
| 29 | 109 | 0.502999 |
591a9b4c68574bbe071c20d166e3620703971475 | 4,439 | cs | C# | BaiduVoiceDAL/VoiceConverter.cs | AlairEileen/RedPackets | 4637583ed622bac162bf453cd0910aba80e852d0 | [
"Apache-2.0"
] | 1 | 2019-05-10T05:06:43.000Z | 2019-05-10T05:06:43.000Z | BaiduVoiceDAL/VoiceConverter.cs | AlairEileen/RedPackets | 4637583ed622bac162bf453cd0910aba80e852d0 | [
"Apache-2.0"
] | null | null | null | BaiduVoiceDAL/VoiceConverter.cs | AlairEileen/RedPackets | 4637583ed622bac162bf453cd0910aba80e852d0 | [
"Apache-2.0"
] | 1 | 2019-07-18T03:04:20.000Z | 2019-07-18T03:04:20.000Z | using Baidu.Aip.Speech;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace BaiduVoiceDAL
{
public class VoiceConverter
{
private string serverURL = "http://vop.baidu.com/server_api";
private static string token = "";
private static string testFileName = "test.pcm";
//put your own params here
private static string apiKey = "s8M5pRA7yL9w586RmeoRxo53";
private static string secretKey = "2ab7cd180d1377cbb8bf3bd4a7e62e7f";
private static string cuid = "666";
private readonly Asr _asrClient;
private readonly Tts _ttsClient;
public VoiceConverter()
{
_asrClient = new Asr(apiKey, secretKey);
_ttsClient = new Tts(apiKey, secretKey);
}
// 识别本地文件
public async Task<string> AsrData(string fileUrl)
{
return
await Task.Run(() =>
{
var data = File.ReadAllBytes(fileUrl);
var result = _asrClient.Recognize(data, "pcm", 8000);
return JsonConvert.DeserializeObject<string[]>(result["result"].ToString())[0];
});
}
public async Task<string> GetToken()
{
return await Task.Run(() =>
{
string accessToken = "";
String getTokenURL = "https://openapi.baidu.com/oauth/2.0/token?grant_type=client_credentials" +
"&client_id=" + apiKey + "&client_secret=" + secretKey;
WebClient wc = new WebClient();
string responseString = wc.DownloadString(getTokenURL);
var jObj = (JObject)JsonConvert.DeserializeObject(responseString);
accessToken = jObj.GetValue("access_token").ToString();
return accessToken;
});
}
public async Task<string> Post(string audioFilePath)
{
string token = await GetToken();
serverURL += "?lan=zh&cuid=kwwwvagaa&token=" + token;
byte[] voice = File.ReadAllBytes(audioFilePath);
HttpWebRequest request = null;
Uri uri = new Uri(serverURL);
request = (HttpWebRequest)WebRequest.Create(uri);
request.Timeout = 10000;
request.Method = "POST";
request.ContentType = "audio/pcm; rate=8000";
request.ContentLength = voice.Length;
try
{
using (Stream writeStream = request.GetRequestStream())
{
writeStream.Write(voice, 0, voice.Length);
writeStream.Close();
writeStream.Dispose();
}
}
catch
{
return null;
}
string result = string.Empty;
string result_final = string.Empty;
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
using (Stream responseStream = response.GetResponseStream())
{
using (StreamReader readStream = new StreamReader(responseStream, Encoding.UTF8))
{
string line = string.Empty;
StringBuilder sb = new StringBuilder();
while (!readStream.EndOfStream)
{
line = readStream.ReadLine();
sb.Append(line);
sb.Append("\r");
}
readStream.Close();
readStream.Dispose();
result = sb.ToString();
string[] indexs = result.Split(',');
foreach (string index in indexs)
{
string[] _indexs = index.Split('"');
if (_indexs[2] == ":[")
result_final = _indexs[3];
}
}
responseStream.Close();
responseStream.Dispose();
}
response.Close();
}
return result_final;
}
}
}
| 35.512 | 112 | 0.497635 |
dcad22f9a2354acdaaf316d18fe57d6a20d1f627 | 765 | cs | C# | Xamarin.PropertyEditing.Windows/HasItemsToVisibilityConverter.cs | netonjm/Xamarin.PropertyEditing | b0db811113957cc9dc70f883190ad3bd98918671 | [
"MIT"
] | null | null | null | Xamarin.PropertyEditing.Windows/HasItemsToVisibilityConverter.cs | netonjm/Xamarin.PropertyEditing | b0db811113957cc9dc70f883190ad3bd98918671 | [
"MIT"
] | null | null | null | Xamarin.PropertyEditing.Windows/HasItemsToVisibilityConverter.cs | netonjm/Xamarin.PropertyEditing | b0db811113957cc9dc70f883190ad3bd98918671 | [
"MIT"
] | null | null | null | using System;
using System.Collections;
using System.Globalization;
using System.Linq;
using System.Windows;
using System.Windows.Data;
using System.Windows.Markup;
namespace Xamarin.PropertyEditing.Windows
{
internal class HasItemsToVisibilityConverter : MarkupExtension, IValueConverter
{
public object Convert (object value, Type targetType, object parameter, CultureInfo culture) =>
(value is ICollection enumerable)
? (enumerable.Count > 0 ? Visibility.Visible : Visibility.Collapsed)
: Visibility.Visible;
public object ConvertBack (object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException ();
}
public override object ProvideValue (IServiceProvider serviceProvider) => this;
}
}
| 29.423077 | 98 | 0.783007 |
2ddc598072f50d79a9a1a3fbd3668dccc6a00a8b | 1,766 | cs | C# | Engine/Saving/JsonSaver/JsonValue.cs | AnomalousMedical/Engine | a19e21f597bd277e4ca17e0e5f3f89577f2307bb | [
"MIT"
] | null | null | null | Engine/Saving/JsonSaver/JsonValue.cs | AnomalousMedical/Engine | a19e21f597bd277e4ca17e0e5f3f89577f2307bb | [
"MIT"
] | null | null | null | Engine/Saving/JsonSaver/JsonValue.cs | AnomalousMedical/Engine | a19e21f597bd277e4ca17e0e5f3f89577f2307bb | [
"MIT"
] | null | null | null | using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
namespace Engine.Saving.Json
{
abstract class JsonValue<T> : ValueWriterEntry, JsonValueReader
{
protected const String NAME_ENTRY = "name";
protected String elementName;
protected JsonSaver xmlSaver;
public JsonValue(JsonSaver xmlSaver, String elementName)
{
this.xmlSaver = xmlSaver;
this.elementName = elementName;
}
public virtual void writeValue(SaveEntry entry)
{
var writer = xmlSaver.Writer;
writer.WritePropertyName(entry.Name);
var format = writer.Formatting;
writer.Formatting = Newtonsoft.Json.Formatting.None;
writer.WriteStartObject();
writer.WritePropertyName(elementName);
if (entry.Value != null)
{
writeValue((T)entry.Value, writer);
}
else
{
writer.WriteNull();
}
writer.WriteEndObject();
writer.Formatting = format;
}
public abstract void writeValue(T value, JsonWriter writer);
public virtual void readValue(LoadControl loadControl, String name, JsonReader xmlReader)
{
loadControl.addValue(name, xmlReader.Value != null ? parseValue(xmlReader) : default(T), typeof(T));
}
public abstract T parseValue(JsonReader xmlReader);
public String ElementName
{
get
{
return elementName;
}
}
public Type getWriteType()
{
return typeof(T);
}
}
}
| 26.757576 | 112 | 0.573046 |
1160050bea3d87556c580529cda659ca33324d62 | 375 | cs | C# | ProgrammingLanguageNr1/src/3. Add external functions to tree/VariableDefinition.cs | bloomingbridges/hxSprak | 045c6df28fb4fdd6dda46af24423b71eaf63a84b | [
"Zlib"
] | 50 | 2015-03-19T13:31:53.000Z | 2021-12-28T22:30:04.000Z | ProgrammingLanguageNr1/src/3. Add external functions to tree/VariableDefinition.cs | bloomingbridges/hxSprak | 045c6df28fb4fdd6dda46af24423b71eaf63a84b | [
"Zlib"
] | 3 | 2016-08-06T06:06:49.000Z | 2020-11-01T11:08:08.000Z | ProgrammingLanguageNr1/src/3. Add external functions to tree/VariableDefinition.cs | bloomingbridges/hxSprak | 045c6df28fb4fdd6dda46af24423b71eaf63a84b | [
"Zlib"
] | 18 | 2015-09-26T15:34:00.000Z | 2021-12-28T10:51:19.000Z | using System;
namespace ProgrammingLanguageNr1
{
[Serializable]
public class VariableDefinition
{
public VariableDefinition() { }
public VariableDefinition (string pVariableName, object pInitValue)
{
variableName = pVariableName;
initValue = pInitValue;
}
public string variableName;
public object initValue;
}
}
| 18.75 | 69 | 0.68 |
f7c605b0e738308022a7b2dd6b68d62023c1834b | 212 | cs | C# | AdventureBot/Item/IAdventureItem.cs | BobIllumine/AdventureBot | 46afc1036ba1996d974f544f78e55a5ec2fc88cb | [
"MIT"
] | 5 | 2018-07-28T22:02:43.000Z | 2020-03-16T21:45:15.000Z | AdventureBot/Item/IAdventureItem.cs | BobIllumine/AdventureBot | 46afc1036ba1996d974f544f78e55a5ec2fc88cb | [
"MIT"
] | 65 | 2018-07-27T17:45:06.000Z | 2020-09-01T08:49:56.000Z | AdventureBot/Item/IAdventureItem.cs | BobIllumine/AdventureBot | 46afc1036ba1996d974f544f78e55a5ec2fc88cb | [
"MIT"
] | 2 | 2018-08-09T12:03:02.000Z | 2018-08-18T18:28:16.000Z | namespace AdventureBot.Item
{
public interface IAdventureItem : IItem
{
void OnAdventureEnter(User.User user, ItemInfo info);
void OnAdventureLeave(User.User user, ItemInfo info);
}
} | 26.5 | 61 | 0.693396 |
4086195aaa7d1783ff3cb5653bdbd444750c8df6 | 2,292 | cshtml | C# | Formall.Web.Mvc.ExtJs/App_Code/RotateElement.cshtml | InnPad/Formall.NET | d0e929ffc5cd53adc6e6e14a19a9d3c5d060b9a4 | [
"Apache-2.0"
] | 1 | 2021-08-17T05:19:01.000Z | 2021-08-17T05:19:01.000Z | Formall.Web.Mvc.ExtJs/App_Code/RotateElement.cshtml | InnPad/Formall.NET | d0e929ffc5cd53adc6e6e14a19a9d3c5d060b9a4 | [
"Apache-2.0"
] | null | null | null | Formall.Web.Mvc.ExtJs/App_Code/RotateElement.cshtml | InnPad/Formall.NET | d0e929ffc5cd53adc6e6e14a19a9d3c5d060b9a4 | [
"Apache-2.0"
] | null | null | null | @* Rotates an element vertically using a css3 transform
* <param name="angle">angle of rotation (90, 180, or 270)</param>
* <param name="includeIE"></param>
* <param name="backgroundColor">bg color to use for ms chroma filter</param>
*@
@helper RotateElement(int angle, bool includeIE, string backgroundColor = null)
{
string prefix = Model.Prefix;
string rotationOrigin = null;
var rotation = Rotate("#" + angle + "deg");
int? ieRotation = null;
if (angle == 90)
{
ieRotation = 1;
rotationOrigin = "0 0";
}
else if (angle == 180)
{
ieRotation = 2;
rotationOrigin = "50% 50%";
}
else if (angle == 270)
{
ieRotation = 3;
rotationOrigin = "100% 0";
}
@:-webkit-transform: @rotation;
@:-webkit-transform-origin: @rotationOrigin;
@:-moz-transform: @rotation;
@:-moz-transform-origin: @rotationOrigin;
@:-o-transform: @rotation;
@:-o-transform-origin: @rotationOrigin;
@:transform: $rotation;
@:transform-origin: @rotationOrigin;
if (includeIE)
{
// In IE9 and below we have to use a BasicImage filter to achieve 90 or 270 degree
// rotation of the text container. Text rotated using this methodology does
// not display using ClearType font unless the element has a background. To
// work around this, we apply a background color to the text container element
// and then use a Chroma filter to display all pixels of that color as transparent.
@:.#@(prefix)ie9m & {
if (Model.BackgroundColor != null)
{
@:background-color: @backgroundColor;
@:filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=#@ieRotation),
@:progid:DXImageTransform.Microsoft.Chroma(color=#@backgroundColor);
}
else
{
@:filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=#@ieRotation);
}
@:}
}
}
@helper UnrotateElement(bool includeIE)
{
@:-webkit-transform: none;
@:-moz-transform: none;
@:-o-transform: none;
@:transform: none;
if (includeIE)
{
@:background-color: transparent;
@:filter: none;
}
}
| 30.972973 | 92 | 0.598604 |
0b6651950245a2b687ed515ce35371f2ea646727 | 437 | cs | C# | Source/GraduatedCylinder.Geo/Devices/Serial/ISerialPort.cs | EddieGarmon/GraduatedCylinder | 1384a69f6bb6509aa2caa1183beae6160e9e902a | [
"MIT"
] | 7 | 2016-07-07T17:35:20.000Z | 2022-03-21T17:21:48.000Z | Source/GraduatedCylinder.Geo/Devices/Serial/ISerialPort.cs | EddieGarmon/GraduatedCylinder | 1384a69f6bb6509aa2caa1183beae6160e9e902a | [
"MIT"
] | 3 | 2016-07-18T18:57:58.000Z | 2016-09-16T19:19:04.000Z | Source/GraduatedCylinder.Geo/Devices/Serial/ISerialPort.cs | EddieGarmon/GraduatedCylinder | 1384a69f6bb6509aa2caa1183beae6160e9e902a | [
"MIT"
] | 1 | 2016-07-18T18:50:15.000Z | 2016-07-18T18:50:15.000Z | using System.IO.Ports;
namespace GraduatedCylinder.Devices.Serial
{
public interface ISerialPort
{
int BytesToRead { get; }
bool IsOpen { get; }
event SerialDataReceivedEventHandler DataReceived;
event SerialErrorReceivedEventHandler ErrorReceived;
void Close();
void Open();
int Read(byte[] buffer, int offset, int count);
void Write(string text);
}
} | 19 | 60 | 0.638444 |
cf826501c0991b445adc9a636b594c46d58a4e02 | 372 | cs | C# | modules/ProjectService/src/ProjectService.Domain/Settings/ProjectServiceSettingDefinitionProvider.cs | antosubash/AbpModuleToMicroservice | 7b9242d725b5607ea56fa521b8317a0aea23b1d5 | [
"MIT"
] | 16 | 2021-11-19T08:00:29.000Z | 2022-03-12T12:11:25.000Z | modules/ProjectService/src/ProjectService.Domain/Settings/ProjectServiceSettingDefinitionProvider.cs | antosubash/AbpModuleToMicroservice | 7b9242d725b5607ea56fa521b8317a0aea23b1d5 | [
"MIT"
] | null | null | null | modules/ProjectService/src/ProjectService.Domain/Settings/ProjectServiceSettingDefinitionProvider.cs | antosubash/AbpModuleToMicroservice | 7b9242d725b5607ea56fa521b8317a0aea23b1d5 | [
"MIT"
] | 1 | 2022-02-26T13:30:36.000Z | 2022-02-26T13:30:36.000Z | using Volo.Abp.Settings;
namespace ProjectService.Settings
{
public class ProjectServiceSettingDefinitionProvider : SettingDefinitionProvider
{
public override void Define(ISettingDefinitionContext context)
{
/* Define module settings here.
* Use names from ProjectServiceSettings class.
*/
}
}
} | 26.571429 | 84 | 0.658602 |
59beeda6c920df42436c6eb6c60d950447d5199e | 1,323 | cs | C# | flexsys.TinyCLR.Networking.FTP.Server/src/Server/Configuration.cs | AndreMarschalek/TinyCLR-Libraries | da7e13c23a77fd4ed04c0137f6f09296fd7d14db | [
"MIT"
] | 1 | 2021-03-21T10:18:02.000Z | 2021-03-21T10:18:02.000Z | flexsys.TinyCLR.Networking.FTP.Server/src/Server/Configuration.cs | AndreMarschalek/TinyCLR-Libraries | da7e13c23a77fd4ed04c0137f6f09296fd7d14db | [
"MIT"
] | null | null | null | flexsys.TinyCLR.Networking.FTP.Server/src/Server/Configuration.cs | AndreMarschalek/TinyCLR-Libraries | da7e13c23a77fd4ed04c0137f6f09296fd7d14db | [
"MIT"
] | null | null | null | using System;
using System.Collections;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading;
namespace flexsys.TinyCLR.Networking.FTP.Server
{
public class Configuration
{
private const string IDENTIFIER = "TinyCLR OS Cloud Services/1.0";
public Configuration()
{
}
public Method Method { get; set; }
public bool AnonymousAuthentication { get; set; }
public AuthCallback AuthMethod { get; set; }
public X509Certificate Certificate { get; set; }
public string WelcomeMessage { get; set; } = IDENTIFIER;
/// <summary>
/// The Directory out of which you will serve your items.
/// </summary>
public string DocumentRoot { get; set; }
public int ServerPort { get; set; }
/// <summary>
/// Socket Listen
/// </summary>
public int Backlog { get; set; } = 10;
/// <summary>
/// minutes
/// </summary>
public int SessionTimeout { get; set; } = 10;
/// <summary>
/// minutes
/// </summary>
public int IpsBlockTime { get; set; } = 3;
public int MaxConnectionsPerMinute { get; set; } = 3;
public int MaxWrongPasswords { get; set; } = 3;
}
}
| 24.5 | 74 | 0.577475 |
94529ee6406efa12b0adec16f7d503ca953b1d95 | 1,348 | cs | C# | tdb.framework.webapi/Cors/CorsExtensions.cs | dabintang/tdb.framework | ccf27514a58ec2be329efe32c22ff1c2a3cef233 | [
"MIT"
] | 1 | 2021-05-29T04:26:21.000Z | 2021-05-29T04:26:21.000Z | tdb.framework.webapi/Cors/CorsExtensions.cs | dabintang/tdb.framework | ccf27514a58ec2be329efe32c22ff1c2a3cef233 | [
"MIT"
] | null | null | null | tdb.framework.webapi/Cors/CorsExtensions.cs | dabintang/tdb.framework | ccf27514a58ec2be329efe32c22ff1c2a3cef233 | [
"MIT"
] | null | null | null | using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace tdb.framework.webapi.Cors
{
/// <summary>
/// 跨域设置
/// </summary>
public static class CorsExtensions
{
/// <summary>
/// 允许所有来源跨域
/// </summary>
/// <param name="services"></param>
/// <returns></returns>
public static IServiceCollection AddTdbAllAllowCors(this IServiceCollection services)
{
services.AddCors(options => options.AddPolicy("AllAllowCorsPolicy", builder =>
{
builder.WithOrigins("urls")
.AllowAnyMethod()
.AllowAnyHeader()
.SetIsOriginAllowed(_ => true) // =AllowAnyOrigin()
.AllowCredentials();
})
);
return services;
}
/// <summary>
/// 允许所有来源跨域
/// </summary>
/// <param name="app"></param>
/// <returns></returns>
public static IApplicationBuilder UseTdbAllAllowCors(this IApplicationBuilder app)
{
// 跨域设置
return app.UseCors("AllAllowCorsPolicy");
}
}
}
| 28.083333 | 93 | 0.542285 |
eb0ed140e8b83490188d05eb990af6e24787d727 | 5,180 | cs | C# | Project-Obsidian-UWP/Core/Loader.cs | idexdavis/Project-Obsidian-UWP | 71cb0dfdbe125ab7f218107d1c0948f9ca2e749e | [
"MIT"
] | 1 | 2019-09-14T14:56:01.000Z | 2019-09-14T14:56:01.000Z | Project-Obsidian-UWP/Core/Loader.cs | idexdavis/Project-Obsidian-UWP | 71cb0dfdbe125ab7f218107d1c0948f9ca2e749e | [
"MIT"
] | null | null | null | Project-Obsidian-UWP/Core/Loader.cs | idexdavis/Project-Obsidian-UWP | 71cb0dfdbe125ab7f218107d1c0948f9ca2e749e | [
"MIT"
] | null | null | null | using Project_Obsidian_UWP.Models;
using Project_Obsidian_UWP.Utilities;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Windows.Storage;
using YamlDotNet.RepresentationModel;
namespace Project_Obsidian_UWP.Core
{
public class Loader
{
public async static Task ReadAllCategories(StorageFolder rootFolder)
{
StorageFolder cateFolder = await rootFolder.GetFolderAsync(Constants.categoriesPath);
if (cateFolder != null)
{
IReadOnlyList<StorageFile> storageFiles = await cateFolder.GetFilesAsync();
if (storageFiles == null) return;
foreach (StorageFile file in storageFiles)
{
var splitedContent = await Utility.SplitYamlFrontMatter(file);
IDictionary<YamlNode, YamlNode> children = Parser.ParseYamlFront(splitedContent.Item1).Children;
isLayoutValid(file, children);
Category category = new Category(file.DisplayName, file.FileType,
(string)children[new YamlScalarNode(Constants.titleKeyword)],
(string)children[new YamlScalarNode(Constants.slugKeyword)],
(string)children[new YamlScalarNode(Constants.descriptionKeyword)],
file.Path, content: splitedContent.Item2);
Core.categoryManager.AddCategoryCollection(category);
}
}
}
public async static Task ReadAllPosts(StorageFolder rootFolder)
{
StorageFolder postsFolder = await rootFolder.GetFolderAsync(Constants.postsPath);
foreach (Category category in Core.categoryManager.GetCategoriesCollection())
{
try
{
StorageFolder singlePostsFolder = await postsFolder.GetFolderAsync($"{ category.slug }\\{ Constants.subpostPath }");
IReadOnlyList<StorageFile> postFiles = await singlePostsFolder.GetFilesAsync();
foreach (StorageFile postFile in postFiles)
{
var splitedContent = await Utility.SplitYamlFrontMatter(postFile);
IDictionary<YamlNode, YamlNode> children = Parser.ParseYamlFront(splitedContent.Item1).Children;
string title = (string)children[new YamlScalarNode(Constants.titleKeyword)];
string description = (string)children[new YamlScalarNode(Constants.descriptionKeyword)];
Post post = new Post(postFile.DisplayName,
postFile.FileType,
title, description,
postFile.Path ,
category,
splitedContent.Item2);
category.posts.AddPost(post);
}
}
catch (Exception ex)
{
Console.WriteLine($"Category doesn't match up posts or cannot locate _posts folder. Detail: { ex.Message }");
}
}
}
public async static Task ReadAllPages(StorageFolder rootFolder)
{
StorageFolder pagesFolder = await rootFolder.GetFolderAsync(Constants.pagesPath);
foreach (StorageFile pageFile in await pagesFolder.GetFilesAsync())
{
var splitedContent = await Utility.SplitYamlFrontMatter(pageFile);
IDictionary<YamlNode, YamlNode> children = Parser.ParseYamlFront(splitedContent.Item1).Children;
string title = (string)children[new YamlScalarNode(Constants.titleKeyword)];
string description = (string)children[new YamlScalarNode(Constants.descriptionKeyword)];
string layout = (string)children[new YamlScalarNode(Constants.layoutKeyword)];
string permalink = (string)children[new YamlScalarNode(Constants.permalinkKeyword)];
Page page = new Page(layout,
permalink,
pageFile.DisplayName,
pageFile.FileType,
title,
description,
splitedContent.Item2);
Core.pageManager.AddPageCollection(page);
}
}
private static bool isLayoutValid(StorageFile file, IDictionary<YamlNode, YamlNode> children)
{
if ((string)children[new YamlScalarNode(Constants.layoutKeyword)] !=
Enumerations.CategoryLayout.List.ToString().ToLower())
{
Console.WriteLine($"Category { file.Name } layout is incorrect!");
return false;
}
return true;
}
}
}
| 45.840708 | 136 | 0.549807 |
bf18bac5b857582309badcd1596c47f4830a202c | 2,453 | cs | C# | AnnoDesigner/Undo/UndoManager.cs | FroggieFrog/anno-designer | c7e055741e21f6a4faaf9d5b7298b7a1315aab76 | [
"MIT"
] | 80 | 2020-05-14T09:24:34.000Z | 2022-03-04T17:59:25.000Z | AnnoDesigner/Undo/UndoManager.cs | hwc12310/anno-designer | b187b11cb320695dd4374d7e7c7fd1d743aba921 | [
"MIT"
] | 156 | 2020-05-11T15:38:42.000Z | 2022-01-22T22:04:06.000Z | AnnoDesigner/Undo/UndoManager.cs | StingMcRay/anno-designer | 92a40a8ef20f21c6912bc55ebdafe36267bab392 | [
"MIT"
] | 16 | 2020-05-11T19:20:53.000Z | 2022-03-13T15:48:00.000Z | using System;
using System.Collections.Generic;
using AnnoDesigner.Undo.Operations;
namespace AnnoDesigner.Undo
{
public class UndoManager : IUndoManager
{
internal Stack<IOperation> UndoStack { get; set; } = new Stack<IOperation>();
internal Stack<IOperation> RedoStack { get; set; } = new Stack<IOperation>();
internal CompositeOperation CurrentCompositeOperation { get; set; }
private IOperation lastUndoableOperation;
public bool IsDirty
{
get { return lastUndoableOperation != (UndoStack.Count > 0 ? UndoStack.Peek() : null); }
set
{
if (value)
{
throw new ArgumentException("You can only set IsDirty to false");
}
lastUndoableOperation = UndoStack.Count > 0 ? UndoStack.Peek() : null;
}
}
public void Undo()
{
if (UndoStack.Count > 0)
{
var operation = UndoStack.Pop();
operation.Undo();
RedoStack.Push(operation);
}
}
public void Redo()
{
if (RedoStack.Count > 0)
{
var operation = RedoStack.Pop();
operation.Redo();
UndoStack.Push(operation);
}
}
public void Clear()
{
UndoStack.Clear();
RedoStack.Clear();
IsDirty = false;
}
public void RegisterOperation(IOperation operation)
{
if (CurrentCompositeOperation != null)
{
CurrentCompositeOperation.Operations.Add(operation);
}
else
{
UndoStack.Push(operation);
RedoStack.Clear();
}
}
public void AsSingleUndoableOperation(Action action)
{
CurrentCompositeOperation = new CompositeOperation();
CompositeOperation operation = null;
try
{
action();
operation = CurrentCompositeOperation;
}
finally
{
CurrentCompositeOperation = null;
if (operation != null && operation.Operations.Count > 0)
{
RegisterOperation(operation);
}
}
}
}
}
| 27.561798 | 100 | 0.488789 |
47206d019eff148f1cd432f6a2bb780feb7014b6 | 3,870 | cs | C# | VIM2VHD/CREATE_VIRTUAL_DISK_FLAG.cs | smourier/VIM2VHD | bb7fc04ef5db4f709668fc64c0607fa324a6a7d1 | [
"MIT"
] | 11 | 2019-01-07T10:58:23.000Z | 2021-10-21T09:48:46.000Z | VIM2VHD/CREATE_VIRTUAL_DISK_FLAG.cs | smourier/VIM2VHD | bb7fc04ef5db4f709668fc64c0607fa324a6a7d1 | [
"MIT"
] | null | null | null | VIM2VHD/CREATE_VIRTUAL_DISK_FLAG.cs | smourier/VIM2VHD | bb7fc04ef5db4f709668fc64c0607fa324a6a7d1 | [
"MIT"
] | null | null | null | using System;
namespace VIM2VHD
{
/// <summary>
/// Contains virtual hard disk (VHD) creation flags.
/// </summary>
[Flags]
public enum CREATE_VIRTUAL_DISK_FLAG
{
/// <summary>
/// No flags. Use system defaults.
/// </summary>
CREATE_VIRTUAL_DISK_FLAG_NONE = 0x0,
/// <summary>
/// Pre-allocate all physical space necessary for the virtual size of the disk (e.g. a fixed VHD).
/// </summary>
CREATE_VIRTUAL_DISK_FLAG_FULL_PHYSICAL_ALLOCATION = 0x1,
/// <summary>
/// Take ownership of the source disk during create from source disk, to
/// insure the source disk does not change during the create operation. The
/// source disk must also already be offline or read-only (or both).
/// Ownership is released when create is done. This also has a side-effect
/// of disallowing concurrent create from same source disk. Create will fail
/// if ownership cannot be obtained or if the source disk is not already
/// offline or read-only. This flag is optional, but highly recommended for
/// creates from source disk. No effect for other types of create (no effect
/// for create from source VHD; no effect for create without SourcePath).
/// </summary>
CREATE_VIRTUAL_DISK_FLAG_PREVENT_WRITES_TO_SOURCE_DISK = 0x2,
/// <summary>
/// Do not copy initial virtual disk metadata or block states from the
/// parent VHD; this is useful if the parent VHD is a stand-in file and the
/// real parent will be explicitly set later.
/// </summary>
CREATE_VIRTUAL_DISK_FLAG_DO_NOT_COPY_METADATA_FROM_PARENT = 0x4,
/// <summary>
/// Create the backing storage disk.
/// </summary>
CREATE_VIRTUAL_DISK_FLAG_CREATE_BACKING_STORAGE = 0x8,
/// <summary>
/// If set, the SourceLimitPath is an change tracking ID, and all data that has changed
/// since that change tracking ID will be copied from the source. If clear, the
/// SourceLimitPath is a VHD file path in the source VHD's chain, and
/// all data that is present in the children of that VHD in the chain
/// will be copied from the source.
/// </summary>
CREATE_VIRTUAL_DISK_FLAG_USE_CHANGE_TRACKING_SOURCE_LIMIT = 0x10,
/// <summary>
/// If set and the parent VHD has change tracking enabled, the child will
/// have change tracking enabled and will recognize all change tracking
/// IDs that currently exist in the parent. If clear or if the parent VHD
/// does not have change tracking available, then change tracking will
/// not be enabled in the new VHD.
/// </summary>
CREATE_VIRTUAL_DISK_FLAG_PRESERVE_PARENT_CHANGE_TRACKING_STATE = 0x20,
/// <summary>
/// When creating a VHD Set from source, don't copy the data in the original
/// backing store, but intsead use the file as is. If this flag is not specified
/// and a source file is passed to CreateVirtualDisk for a VHDSet file, the data
/// in the source file is copied. If this flag is set the data is moved. The
/// name of the file may change.
/// </summary>
CREATE_VIRTUAL_DISK_FLAG_VHD_SET_USE_ORIGINAL_BACKING_STORAGE = 0x40,
/// <summary>
/// When creating a fixed virtual disk, take advantage of an underlying sparse file.
/// Only supported on file systems that support sparse VDLs.
/// </summary>
CREATE_VIRTUAL_DISK_FLAG_SPARSE_FILE = 0x80,
/// <summary>
/// Creates a VHD suitable as the backing store for a virtual persistent memory device.
/// </summary>
CREATE_VIRTUAL_DISK_FLAG_PMEM_COMPATIBLE = 0x100,
}
}
| 45.529412 | 106 | 0.648062 |
f85e6f27b9944a26d2280d58aecd955a6c9ffb90 | 1,141 | cs | C# | PlutoModUnity/Assets/Scripts/assembly_steamworks/Steamworks/AccountID_t.cs | DrewKestell/JotunnModStub | df32798345ad843328c89dc5922ab829786ecdd6 | [
"WTFPL"
] | 1 | 2021-12-09T16:08:20.000Z | 2021-12-09T16:08:20.000Z | PlutoModUnity/Assets/Scripts/assembly_steamworks/Steamworks/AccountID_t.cs | DrewKestell/JotunnModStub | df32798345ad843328c89dc5922ab829786ecdd6 | [
"WTFPL"
] | null | null | null | PlutoModUnity/Assets/Scripts/assembly_steamworks/Steamworks/AccountID_t.cs | DrewKestell/JotunnModStub | df32798345ad843328c89dc5922ab829786ecdd6 | [
"WTFPL"
] | 2 | 2021-11-06T08:29:34.000Z | 2021-11-06T08:37:24.000Z | using System;
namespace Steamworks
{
[Serializable]
public struct AccountID_t : IEquatable<AccountID_t>, IComparable<AccountID_t>
{
public uint m_AccountID;
public AccountID_t(uint value)
{
m_AccountID = value;
}
public override string ToString()
{
return m_AccountID.ToString();
}
public override bool Equals(object other)
{
if (other is AccountID_t)
{
return this == (AccountID_t)other;
}
return false;
}
public override int GetHashCode()
{
return m_AccountID.GetHashCode();
}
public static bool operator ==(AccountID_t x, AccountID_t y)
{
return x.m_AccountID == y.m_AccountID;
}
public static bool operator !=(AccountID_t x, AccountID_t y)
{
return !(x == y);
}
public static explicit operator AccountID_t(uint value)
{
return new AccountID_t(value);
}
public static explicit operator uint(AccountID_t that)
{
return that.m_AccountID;
}
public bool Equals(AccountID_t other)
{
return m_AccountID == other.m_AccountID;
}
public int CompareTo(AccountID_t other)
{
return m_AccountID.CompareTo(other.m_AccountID);
}
}
}
| 17.553846 | 78 | 0.690622 |
9f912d86cd87fb415428c88e47d2fabcd9d88c55 | 3,544 | cs | C# | src/Extensions.Grasshopper/Toolpaths/ExtrusionToolpathCustom.cs | visose/Extensions | 6c42190dfa17c02ffc282aa7c59928cfcff64373 | [
"MIT"
] | 4 | 2020-03-21T00:38:19.000Z | 2022-01-05T17:12:05.000Z | src/Extensions.Grasshopper/Toolpaths/ExtrusionToolpathCustom.cs | visose/Extensions | 6c42190dfa17c02ffc282aa7c59928cfcff64373 | [
"MIT"
] | null | null | null | src/Extensions.Grasshopper/Toolpaths/ExtrusionToolpathCustom.cs | visose/Extensions | 6c42190dfa17c02ffc282aa7c59928cfcff64373 | [
"MIT"
] | 4 | 2020-04-03T13:38:31.000Z | 2021-12-06T12:07:12.000Z | using Grasshopper.Kernel;
using Robots.Grasshopper;
using Extensions.Toolpaths.Extrusion;
using Grasshopper.Kernel.Data;
using Grasshopper.Kernel.Types;
namespace Extensions.Grasshopper;
public class CreateExternalExtrusionToolpathCustom : GH_Component
{
public CreateExternalExtrusionToolpathCustom() : base("Extrusion Toolpath Ex Custom", "ExtPathCustom", "Extrusion toolpath with external axis with custom plane and external value.", "Extensions", "Toolpaths") { }
public override GH_Exposure Exposure => ExtensionsInfo.IsRobotsInstalled ? GH_Exposure.primary : GH_Exposure.hidden;
protected override System.Drawing.Bitmap Icon => Util.GetIcon("LayersAdd");
public override Guid ComponentGuid => new Guid("{5219D611-92BF-42AA-95E5-AEA4115D360A}");
protected override void RegisterInputParams(GH_InputParamManager pManager)
{
if (ExtensionsInfo.IsRobotsInstalled)
Inputs(pManager);
}
protected override void RegisterOutputParams(GH_OutputParamManager pManager)
{
if (ExtensionsInfo.IsRobotsInstalled)
Outputs(pManager);
}
void Inputs(GH_InputParamManager pManager)
{
pManager.AddPlaneParameter("Planes", "P", "Lists of target locations as planes.", GH_ParamAccess.tree);
pManager.AddNumberParameter("Lengths", "L", "Raw values for external axis (extrusion amount per target)", GH_ParamAccess.tree);
pManager.AddParameter(new ExtrusionAttributesParameter(), "Extrusion attributes", "A", "Extrusion attributes.", GH_ParamAccess.item);
pManager.AddNumberParameter("Extrusion Factor", "F", "Extrusion factor.", GH_ParamAccess.item, 0.21);
pManager.AddNumberParameter("Suck Back", "Sb", "Distance to extrude in reverse immediately after stopping the extrusion. To avoid dripping material.", GH_ParamAccess.item, 0);
pManager.AddNumberParameter("Start Distance", "Sd", "Distance to extrude before the robot starts moving. To compensate for material not flowing immediately after starting the extrusion.", GH_ParamAccess.item, 0);
pManager.AddNumberParameter("Test Loop", "L", "Distance for test loop.", GH_ParamAccess.item, 200);
}
void Outputs(GH_OutputParamManager pManager)
{
pManager.AddParameter(new ToolpathParameter(), "Toolpath", "T", "Extrusion toolpath.", GH_ParamAccess.item);
pManager.AddIntegerParameter("Layer indices", "L", "Layer indices.", GH_ParamAccess.list);
}
protected override void SolveInstance(IGH_DataAccess DA)
{
var locationsGH = new GH_Structure<GH_Plane>();
var lengthsGH = new GH_Structure<GH_Number>();
GH_ExtrusionAttributes attributes = null;
double factor = 0, suckBack = 0, loop = 0, startDistance = 0;
if (!DA.GetDataTree(0, out locationsGH)) return;
if (!DA.GetDataTree(1, out lengthsGH)) return;
if (!DA.GetData(2, ref attributes)) return;
if (!DA.GetData(3, ref factor)) return;
if (!DA.GetData(4, ref suckBack)) return;
if (!DA.GetData(5, ref startDistance)) return;
if (!DA.GetData(6, ref loop)) return;
var locations = locationsGH.Branches.Select(b => b.Select(p => p.Value).ToList()).ToList();
var lengths = lengthsGH.Branches.Select(b => b.Select(p => p.Value).ToList()).ToList();
var toolpath = new ExternalExtrusionToolpath(locations, lengths, attributes.Value, factor, suckBack, startDistance, loop);
DA.SetData(0, toolpath);
DA.SetDataList(1, toolpath.SubPrograms);
}
}
| 50.628571 | 220 | 0.713036 |
9fc665994534b070faaa327e058e68dacdf3c149 | 2,548 | cs | C# | src/MasterData/MasterData.Controllers.Integration.Tests/SourceFormat/Update_SourceFormat_NameDescIsActive_Should.cs | SayusiAndo/DigitalLibrary | 4c2eed304fea9098ff43e0bb96eed4ac6443dab3 | [
"MIT"
] | 1 | 2020-12-30T12:24:48.000Z | 2020-12-30T12:24:48.000Z | src/MasterData/MasterData.Controllers.Integration.Tests/SourceFormat/Update_SourceFormat_NameDescIsActive_Should.cs | SayusiAndo/DigitalLibrary | 4c2eed304fea9098ff43e0bb96eed4ac6443dab3 | [
"MIT"
] | 74 | 2020-01-06T17:01:55.000Z | 2021-01-14T09:25:04.000Z | src/MasterData/MasterData.Controllers.Integration.Tests/SourceFormat/Update_SourceFormat_NameDescIsActive_Should.cs | SayusiAndo/DigitalLibrary | 4c2eed304fea9098ff43e0bb96eed4ac6443dab3 | [
"MIT"
] | null | null | null | // // <copyright file="Update_SourceFormat_NameDescIsActive_Should.cs" company="Andras Csanyi">
// // Copyright (c) Andras Csanyi. All rights reserved.
// // Licensed under MIT.
// // </copyright>
//
// namespace DigitalLibrary.MasterData.Controllers.Integration.Tests.SourceFormat
// {
// using System.Diagnostics.CodeAnalysis;
// using System.Threading.Tasks;
//
// using DigitalLibrary.MasterData.DomainModel;
// using DigitalLibrary.Utils.IntegrationTestFactories.Factories;
//
// using FluentAssertions;
//
// using WebApp;
//
// using Xunit;
// using Xunit.Abstractions;
//
// [SuppressMessage("ReSharper", "InconsistentNaming", Justification = "Reviewed.")]
// [ExcludeFromCodeCoverage]
// [SuppressMessage("ReSharper", "CA1707", Justification = "Reviewed.")]
// [SuppressMessage("ReSharper", "SA1600", Justification = "Reviewed.")]
// [Collection("DigitalLibrary.IaC.MasterData.Controllers.Integration.Tests")]
// public class Update_SourceFormat_NameDescIsActive_Should : TestBase<SourceFormat>
// {
// public Update_SourceFormat_NameDescIsActive_Should(
// DiLibMasterDataWebApplicationFactory<Startup, SourceFormat> host,
// ITestOutputHelper testOutputHelper)
// : base(host, testOutputHelper)
// {
// }
//
// [Fact(Skip = "Needs refactor")]
// public async Task Update_NameDescIsActive()
// {
// // Arrange
// string name = "name";
// string desc = "desc";
// int isActive = 0;
//
// SourceFormat orig = new SourceFormat
// {
// Name = "orig",
// Desc = "orig",
// IsActive = 1,
// };
// SourceFormat origResult = await _masterDataHttpClient
// .AddSourceFormatAsync(orig)
// .ConfigureAwait(false);
//
// origResult.Name = name;
// origResult.Desc = desc;
// origResult.IsActive = isActive;
//
// // Act
// SourceFormat result = await _masterDataHttpClient
// .UpdateSourceFormatAsync(origResult)
// .ConfigureAwait(false);
//
// // Assert
// result.Should().NotBeNull();
// result.Id.Should().Be(origResult.Id);
// result.Name.Should().Be(name);
// result.Desc.Should().Be(desc);
// result.IsActive.Should().Be(isActive);
// }
// }
// }
| 34.432432 | 95 | 0.575746 |
de3b6a7fab814de9bea8d2c20c2d8814a9f867b7 | 328 | cs | C# | 03-Source/YH.ICMS.Common/Enumeration/CameraPostion.cs | chenghui0715/TDRS_master | f2711ad5fb3d1b3c4a5c3e2a36fd4ae18a08f1d9 | [
"MIT"
] | 1 | 2020-12-12T02:42:25.000Z | 2020-12-12T02:42:25.000Z | 03-Source/YH.ICMS.Common/Enumeration/CameraPostion.cs | chenghui0715/TDRS_master | f2711ad5fb3d1b3c4a5c3e2a36fd4ae18a08f1d9 | [
"MIT"
] | null | null | null | 03-Source/YH.ICMS.Common/Enumeration/CameraPostion.cs | chenghui0715/TDRS_master | f2711ad5fb3d1b3c4a5c3e2a36fd4ae18a08f1d9 | [
"MIT"
] | null | null | null | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace YH.ICMS.Common.Enumeration
{
public enum CameraPostion
{
BottomLeft,
BottomMiddle,
BottomRight,
LeftSide,
RightSide,
LeftSideBackup,
RightSideBackup
}
}
| 16.4 | 36 | 0.621951 |
deb4defd8911d0492dd3420504d5931bb0035f3e | 9,369 | cs | C# | AuthoringTools/EmotionalAppraisalWF/MainForm.cs | raisthewolf/FAtiMA-Toolkit-OCEAN-Personality | 1004eba49a294504cb0d1af73e363f3af411eafa | [
"Apache-2.0"
] | null | null | null | AuthoringTools/EmotionalAppraisalWF/MainForm.cs | raisthewolf/FAtiMA-Toolkit-OCEAN-Personality | 1004eba49a294504cb0d1af73e363f3af411eafa | [
"Apache-2.0"
] | null | null | null | AuthoringTools/EmotionalAppraisalWF/MainForm.cs | raisthewolf/FAtiMA-Toolkit-OCEAN-Personality | 1004eba49a294504cb0d1af73e363f3af411eafa | [
"Apache-2.0"
] | null | null | null | using EmotionalAppraisal;
using EmotionalAppraisal.DTOs;
using EmotionalAppraisalWF.ViewModels;
using Equin.ApplicationFramework;
using GAIPS.AssetEditorTools;
using GAIPS.Rage;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace EmotionalAppraisalWF
{
public partial class MainForm : BaseEAForm
{
private AppraisalRulesVM _appraisalRulesVM;
private EmotionDispositionsVM _emotionDispositionsVM;
public MainForm()
{
InitializeComponent();
}
protected override void OnAssetDataLoaded(EmotionalAppraisalAsset asset)
{
//Emotion Dispositions
_emotionDispositionsVM = new EmotionDispositionsVM(this);
comboBoxDefaultDecay.SelectedIndex = comboBoxDefaultDecay.FindString(_emotionDispositionsVM.DefaultDecay.ToString());
comboBoxDefaultThreshold.SelectedIndex = comboBoxDefaultThreshold.FindString(_emotionDispositionsVM.DefaultThreshold.ToString());
dataGridViewEmotionDispositions.DataSource = _emotionDispositionsVM.EmotionDispositions;
//Personality Factors
double[] factors = _emotionDispositionsVM.getFactors();
oEntry.Value = (float)factors[0];
cEntry.Value = (float)factors[1];
eEntry.Value = (float)factors[2];
aEntry.Value = (float)factors[3];
nEntry.Value = (float)factors[4];
//Appraisal Rule
_appraisalRulesVM = new AppraisalRulesVM(this);
dataGridViewAppraisalRules.DataSource = _appraisalRulesVM.AppraisalRules;
EditorTools.HideColumns(dataGridViewAppraisalRules, new[] {
PropertyUtil.GetPropertyName<AppraisalRuleDTO>(dto => dto.Id),
PropertyUtil.GetPropertyName<AppraisalRuleDTO>(dto => dto.Conditions)});
conditionSetEditor.View = _appraisalRulesVM.CurrentRuleConditions;
dataGridViewGoals.DataSource = new BindingListView<GoalDTO>(LoadedAsset.GetAllGoals().ToList());
_wasModified = false;
}
private void buttonAddGoal_Click(object sender, EventArgs e)
{
new AddOrEditGoalForm(LoadedAsset, null).ShowDialog(this);
dataGridViewGoals.DataSource = new BindingListView<GoalDTO>(LoadedAsset.GetAllGoals().ToList());
}
private void buttonAddAppraisalRule_Click(object sender, EventArgs e)
{
new AddOrEditAppraisalRuleForm(_appraisalRulesVM).ShowDialog();
}
private void buttonAddEmotionDisposition_Click(object sender, EventArgs e)
{
new AddOrEditEmotionDispositionForm(_emotionDispositionsVM).ShowDialog();
}
private void buttonAppVariables_Click(object sender, EventArgs e)
{
new AddOrEditAppraisalVariablesForm(_appraisalRulesVM).ShowDialog(this);
}
private void buttonDuplicateAppraisalRule_Click(object sender, EventArgs e)
{
var selectedAppraisalRule = EditorTools.GetSelectedDtoFromTable<AppraisalRuleDTO>(dataGridViewAppraisalRules);
if (selectedAppraisalRule != null)
{
var duplicateRule = CloneHelper.Clone(selectedAppraisalRule);
duplicateRule.Id = Guid.Empty;
_appraisalRulesVM.AddOrUpdateAppraisalRule(duplicateRule);
}
}
private void buttonEditAppraisalRule_Click(object sender, EventArgs e)
{
var selectedAppraisalRule = EditorTools.GetSelectedDtoFromTable<AppraisalRuleDTO>(dataGridViewAppraisalRules);
if (selectedAppraisalRule != null)
new AddOrEditAppraisalRuleForm(_appraisalRulesVM, selectedAppraisalRule).ShowDialog();
}
private void buttonEditEmotionDisposition_Click(object sender, EventArgs e)
{
if (dataGridViewEmotionDispositions.SelectedRows.Count == 1)
{
var selectedEmotionDisposition = ((ObjectView<EmotionDispositionDTO>)dataGridViewEmotionDispositions.
SelectedRows[0].DataBoundItem).Object;
new AddOrEditEmotionDispositionForm(_emotionDispositionsVM, selectedEmotionDisposition).ShowDialog();
}
}
private void buttonRemoveAppraisalRule_Click(object sender, EventArgs e)
{
IList<AppraisalRuleDTO> rulesToRemove = new List<AppraisalRuleDTO>();
for (int i = 0; i < dataGridViewAppraisalRules.SelectedRows.Count; i++)
{
var rule = ((ObjectView<AppraisalRuleDTO>)dataGridViewAppraisalRules.SelectedRows[i].DataBoundItem).Object;
rulesToRemove.Add(rule);
}
_appraisalRulesVM.RemoveAppraisalRules(rulesToRemove);
}
private void buttonRemoveEmotionDisposition_Click(object sender, EventArgs e)
{
IList<EmotionDispositionDTO> dispositionsToRemove = new List<EmotionDispositionDTO>();
for (int i = 0; i < dataGridViewEmotionDispositions.SelectedRows.Count; i++)
{
var disposition = ((ObjectView<EmotionDispositionDTO>)dataGridViewEmotionDispositions.SelectedRows[i].DataBoundItem).Object;
dispositionsToRemove.Add(disposition);
}
_emotionDispositionsVM.RemoveDispositions(dispositionsToRemove);
}
private void comboBoxDefaultDecay_SelectedIndexChanged(object sender, EventArgs e)
{
if (IsLoading)
return;
_emotionDispositionsVM.DefaultDecay = int.Parse(comboBoxDefaultDecay.Text);
}
private void comboBoxDefaultThreshold_SelectedIndexChanged(object sender, EventArgs e)
{
if (IsLoading)
return;
_emotionDispositionsVM.DefaultThreshold = int.Parse(comboBoxDefaultThreshold.Text);
}
private void conditionSetEditor_Load(object sender, EventArgs e)
{
}
private void dataGridViewAppraisalRules_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void dataGridViewAppraisalRules_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
{
if (e.RowIndex != -1) //exclude header cells
{
this.buttonEditAppraisalRule_Click(sender, e);
}
}
private void dataGridViewAppraisalRules_KeyDown(object sender, KeyEventArgs e)
{
switch (e.KeyCode)
{
case Keys.Enter:
this.buttonEditAppraisalRule_Click(sender, e);
e.Handled = true;
break;
case Keys.D:
if (e.Control) this.buttonDuplicateAppraisalRule_Click(sender, e);
break;
case Keys.Delete:
this.buttonRemoveAppraisalRule_Click(sender, e);
break;
}
}
private void dataGridViewAppraisalRules_RowEnter(object sender, DataGridViewCellEventArgs e)
{
var rule = ((ObjectView<AppraisalRuleDTO>)dataGridViewAppraisalRules.Rows[e.RowIndex].DataBoundItem).Object;
_appraisalRulesVM.ChangeCurrentRule(rule);
}
private void dataGridViewBeliefs_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
{
}
private void dataGridViewEmotionDispositions_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
{
if (e.RowIndex != -1) //exclude header cells
{
this.buttonEditEmotionDisposition_Click(sender, e);
}
}
private void groupBox1_Enter(object sender, EventArgs e)
{
}
private void buttonEditGoal_Click(object sender, EventArgs e)
{
var selectedGoal = EditorTools.GetSelectedDtoFromTable<GoalDTO>(dataGridViewGoals);
if (selectedGoal != null)
{
new AddOrEditGoalForm(LoadedAsset, selectedGoal).ShowDialog();
dataGridViewGoals.DataSource = new BindingListView<GoalDTO>(LoadedAsset.GetAllGoals().ToList());
}
}
private void buttonRemove_Click(object sender, EventArgs e)
{
IList<GoalDTO> goalsToRemove = new List<GoalDTO>();
for (int i = 0; i < dataGridViewGoals.SelectedRows.Count; i++)
{
var goal = ((ObjectView<GoalDTO>)dataGridViewGoals.SelectedRows[i].DataBoundItem).Object;
goalsToRemove.Add(goal);
}
LoadedAsset.RemoveGoals(goalsToRemove);
dataGridViewGoals.DataSource = new BindingListView<GoalDTO>(LoadedAsset.GetAllGoals().ToList());
}
private void button1_Click(object sender, EventArgs e) {
_emotionDispositionsVM.SavePersonalityFactors(oEntry.Value, cEntry.Value, eEntry.Value, aEntry.Value, nEntry.Value);
}
private void button3_Click(object sender, EventArgs e) {
_emotionDispositionsVM.resetDispositionOnPersonality();
}
}
} | 41.64 | 142 | 0.642651 |
26587c77ae5617eb62ce17dbc2e7a1218577b47f | 5,656 | cs | C# | Assets/Scripts/PlayerSlot.cs | tac4ttack/In-the-Shadows | 5f47a85fc3d5b2f64a7b0553f354b39100d87478 | [
"Unlicense"
] | 2 | 2020-08-31T13:44:06.000Z | 2020-10-07T09:12:15.000Z | Assets/Scripts/PlayerSlot.cs | tac4ttack/In-the-Shadows | 5f47a85fc3d5b2f64a7b0553f354b39100d87478 | [
"Unlicense"
] | 16 | 2019-10-23T10:59:49.000Z | 2020-03-10T14:03:21.000Z | Assets/Scripts/PlayerSlot.cs | tac4ttack/In-the-Shadows | 5f47a85fc3d5b2f64a7b0553f354b39100d87478 | [
"Unlicense"
] | 1 | 2020-02-28T06:55:01.000Z | 2020-02-28T06:55:01.000Z | using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Assertions;
using TMPro;
using ITS.GameManagement;
using ITS.MainMenuUI;
using ITS.SavingSystem;
namespace ITS.PlayerSlotUI
{
public class PlayerSlot : MonoBehaviour
{
private GameObject _CurrentSlot;
private MainMenu _MainMenuScript;
public int SlotID = -1;
public TextMeshProUGUI PlayerName_TXT;
public Image CompletionRadial_IMG;
public TextMeshProUGUI CompletionPercentage_TXT;
public TextMeshProUGUI LastPlayed_TXT;
public Button ClearSlot_BTN;
public GameObject EmptyText_GO;
public GameObject PlayerSlotInfo_GO;
[HideInInspector] public bool Empty;
void Awake()
{
// DEBUG
#if UNITY_EDITOR || DEVELOPMENT_BUILD
Debug.Log($"PLAYER SLOT - {this.name} - Awake()");
#endif
_CurrentSlot = this.gameObject;
Assert.IsNotNull(_CurrentSlot, "Slot GameObject not found!");
if (_MainMenuScript == null)
_MainMenuScript = GameObject.FindGameObjectWithTag("Main Menu/UI").GetComponent<MainMenu>();
Assert.IsNotNull(_MainMenuScript, "Main Menu script not found in scene!");
if (SlotID < 0 || SlotID > 3)
{
// DEBUG
#if UNITY_EDITOR || DEVELOPMENT_BUILD
Debug.LogError("Invalid SlotID for \"" + _CurrentSlot.name + "\" player slot GameObject.\nDesactivating player slot Gameobject.");
#endif
_CurrentSlot.SetActive(false);
}
if (EmptyText_GO == null)
EmptyText_GO = _CurrentSlot.transform.Find("Empty_Text").gameObject;
Assert.IsNotNull(EmptyText_GO, "Empty placeholder text not found in slot \"" + _CurrentSlot.name + "\"");
if (PlayerSlotInfo_GO == null)
PlayerSlotInfo_GO = _CurrentSlot.transform.Find("PlayerSlotInfo").gameObject;
if (PlayerName_TXT == null)
PlayerName_TXT = PlayerSlotInfo_GO.transform.Find("PlayerName_Text").GetComponent<TextMeshProUGUI>();
Assert.IsNotNull(PlayerName_TXT, "Player name text not found in slot \"" + _CurrentSlot.name + "\"");
if (CompletionRadial_IMG == null)
CompletionRadial_IMG = PlayerSlotInfo_GO.transform.Find("Progression_Radial_Back").Find("Progression_Radial").GetComponent<Image>();
Assert.IsNotNull(CompletionRadial_IMG, "Completion radial sprite not found in slot \"" + _CurrentSlot.name + "\"");
if (CompletionPercentage_TXT == null)
CompletionPercentage_TXT = CompletionRadial_IMG.transform.Find("Progression_Value").GetComponent<TextMeshProUGUI>();
Assert.IsNotNull(CompletionPercentage_TXT, "Completion percentage text not found in slot \"" + _CurrentSlot.name + "\"");
if (LastPlayed_TXT == null)
LastPlayed_TXT = PlayerSlotInfo_GO.transform.Find("Bottom").Find("Bottom_left").Find("LastPlayed_Text").GetComponent<TextMeshProUGUI>();
Assert.IsNotNull(LastPlayed_TXT, "Last played text not found in slot \"" + _CurrentSlot.name + "\"");
if (ClearSlot_BTN == null)
ClearSlot_BTN = PlayerSlotInfo_GO.transform.Find("Bottom").Find("Bottom_right").Find("ClearSlot_Button").GetComponent<Button>();
Assert.IsNotNull(ClearSlot_BTN, "Clear slot button not found in slot \"" + _CurrentSlot.name + "\"");
}
void Start()
{
// DEBUG
#if UNITY_EDITOR || DEVELOPMENT_BUILD
Debug.Log($"PLAYER SLOT - {this.name} - Start()");
#endif
Empty = GameManager.GM.Players.IsEmpty[SlotID];
FetchSlotInfo();
}
void Update()
{
Empty = GameManager.GM.Players.IsEmpty[SlotID];
FetchSlotInfo();
}
private void FetchSlotInfo()
{
if (Empty)
{
EmptyText_GO.SetActive(true);
PlayerSlotInfo_GO.SetActive(false);
}
else
{
EmptyText_GO.SetActive(false);
PlayerSlotInfo_GO.SetActive(true);
PlayerName_TXT.text = GameManager.GM.Players.PlayersName[SlotID];
CompletionRadial_IMG.fillAmount = GameManager.GM.Players.ProgressionPercentage[SlotID] / 100f;
CompletionPercentage_TXT.text = Mathf.RoundToInt(GameManager.GM.Players.ProgressionPercentage[SlotID]) + "%";
LastPlayed_TXT.text = "Last played: <i><size=75%>" + GameManager.GM.Players.LastPlayed[SlotID] + "</size></i>";
}
}
public void ClearSlot_BTNPress()
{
GameManager.GM.SM.SfxSrc.PlayOneShot(GameManager.GM.SM.Sfx[1]);
GameManager.GM.Players.ResetTargetPlayer(SlotID);
SaveSystem.SavePlayer(GameManager.GM.Players);
}
public void SlotPress()
{
GameManager.GM.SM.SfxSrc.PlayOneShot(GameManager.GM.SM.Sfx[1]);
if (Empty)
{
_MainMenuScript.MainMenuStateMachine.ChangeState(new NewPlayerPrompt_MainMenuState(_MainMenuScript, SlotID));
}
else
{
GameManager.GM.CurrentPlayerSlot = SlotID;
GameManager.GM.GameStateMachine.ChangeState(new LevelSelection_GameState());
}
}
}
} | 41.588235 | 153 | 0.596535 |
267d3bda4bcb31a0e1c7b8825e7649960edc7b6d | 301 | cs | C# | Assets/Scripts/Scriptables/Scales.cs | FabriceChiron/Galaxy-Map-VR | 0fe280abb868a8e3e14d2d67869c712ed888e99f | [
"MIT"
] | null | null | null | Assets/Scripts/Scriptables/Scales.cs | FabriceChiron/Galaxy-Map-VR | 0fe280abb868a8e3e14d2d67869c712ed888e99f | [
"MIT"
] | null | null | null | Assets/Scripts/Scriptables/Scales.cs | FabriceChiron/Galaxy-Map-VR | 0fe280abb868a8e3e14d2d67869c712ed888e99f | [
"MIT"
] | 1 | 2021-12-23T02:58:24.000Z | 2021-12-23T02:58:24.000Z | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu]
public class Scales : ScriptableObject
{
public float Orbit = 10f;
public float Planet = 1f;
public float Year = 30f;
public float Day = 10f;
public bool RationalizeValues = true;
}
| 20.066667 | 41 | 0.727575 |
3fdc8001649a61a7fc38926b6147eded5724c8c0 | 630 | cs | C# | Calculator/Prompter.cs | elodea/SupaDupaCalculator | 470a2a5e8051e9056391f29aadb0fd0b1198a5d5 | [
"MIT"
] | 1 | 2020-08-31T06:48:53.000Z | 2020-08-31T06:48:53.000Z | Calculator/Prompter.cs | elodea/SupaDupaCalculator | 470a2a5e8051e9056391f29aadb0fd0b1198a5d5 | [
"MIT"
] | null | null | null | Calculator/Prompter.cs | elodea/SupaDupaCalculator | 470a2a5e8051e9056391f29aadb0fd0b1198a5d5 | [
"MIT"
] | 1 | 2020-08-31T06:48:57.000Z | 2020-08-31T06:48:57.000Z | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Calculator
{
public class Prompter
{
public List<char> Prompt(string prompt) {
Console.WriteLine(prompt);
Console.Write("> ");
bool isReading = true;
List<char> result = new List<char>();
while (isReading) {
var key = Console.ReadKey().KeyChar;
if (key == '\r')
isReading = false;
if (key == '\b') {
if (result.Count > 0)
result.RemoveAt(result.Count - 1);
}
else result.Add(key);
}
Console.WriteLine();
return result;
}
}
}
| 17.5 | 43 | 0.622222 |
a2413ab2e271483f46b28adc9a3b9b7fb22be04a | 298 | cs | C# | src/SolutionInfo.cs | rikrak/fluentassertions.mvc | d9e67a2495e2fa59871c835ee3954372360337ee | [
"MS-PL"
] | 19 | 2017-10-13T04:02:29.000Z | 2021-11-08T12:14:08.000Z | src/SolutionInfo.cs | rikrak/fluentassertions.mvc | d9e67a2495e2fa59871c835ee3954372360337ee | [
"MS-PL"
] | 11 | 2017-10-24T10:02:34.000Z | 2021-11-27T14:25:57.000Z | src/SolutionInfo.cs | rikrak/fluentassertions.mvc | d9e67a2495e2fa59871c835ee3954372360337ee | [
"MS-PL"
] | 5 | 2017-10-10T05:55:17.000Z | 2021-11-02T15:04:05.000Z | using System.Reflection;
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FluentAssertions.Mvc")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("0.9.0")]
[assembly: AssemblyInformationalVersion("0.9.0")]
| 27.090909 | 51 | 0.751678 |
39229e45521352c825c1ef625b1271583c023b94 | 1,051 | cs | C# | Common/Helpers/ZLib.cs | drolean/Servidor-WOW | f77520bc8ad5d123139e34d3d0c8f40d161ad352 | [
"Unlicense"
] | 7 | 2017-04-03T16:24:29.000Z | 2021-10-19T05:58:14.000Z | Common/Helpers/ZLib.cs | drolean/Servidor-WOW | f77520bc8ad5d123139e34d3d0c8f40d161ad352 | [
"Unlicense"
] | null | null | null | Common/Helpers/ZLib.cs | drolean/Servidor-WOW | f77520bc8ad5d123139e34d3d0c8f40d161ad352 | [
"Unlicense"
] | 5 | 2018-10-03T06:56:55.000Z | 2022-03-13T21:59:16.000Z | using System.IO;
using System.IO.Compression;
namespace Common.Helpers
{
public class ZLib
{
public static byte[] Compress(byte[] data)
{
using (var compressedStream = new MemoryStream())
using (var zipStream = new DeflateStream(compressedStream, CompressionMode.Compress))
{
zipStream.Write(data, 0, data.Length);
zipStream.Close();
return compressedStream.ToArray();
}
}
public static byte[] Decompress(byte[] data)
{
using (var compressedStream = new MemoryStream(data))
{
compressedStream.Position = 2; //skip RFC1950 flags
using (var zipStream = new DeflateStream(compressedStream, CompressionMode.Decompress))
using (var resultStream = new MemoryStream())
{
zipStream.CopyTo(resultStream);
return resultStream.ToArray();
}
}
}
}
} | 31.848485 | 103 | 0.540438 |
205bbfd9a6909a341ade1f8fe59b6099542c2981 | 1,073 | cs | C# | Poco.Evolved.Core/IDataMigration.cs | spiegelp/Poco.Evolved | c135d328021139745c655cd65f45de33e0d0a950 | [
"MIT"
] | 8 | 2017-11-28T09:42:57.000Z | 2020-10-22T05:37:50.000Z | Poco.Evolved.Core/IDataMigration.cs | spiegelp/Poco.Evolved | c135d328021139745c655cd65f45de33e0d0a950 | [
"MIT"
] | null | null | null | Poco.Evolved.Core/IDataMigration.cs | spiegelp/Poco.Evolved | c135d328021139745c655cd65f45de33e0d0a950 | [
"MIT"
] | 3 | 2020-04-19T06:04:46.000Z | 2021-08-17T06:19:42.000Z | using System;
using System.Collections.Generic;
using System.Text;
using Poco.Evolved.Core.Transactions;
namespace Poco.Evolved.Core
{
/// <summary>
/// Interface which all class based data migrations must implement.
/// </summary>
/// <typeparam name="T">The type of the specific <see cref="IUnitOfWork"/></typeparam>
public interface IDataMigration<T> where T : class, IUnitOfWork
{
/// <summary>
/// The version number of the data migration.
/// </summary>
long VersionNumber { get; }
/// <summary>
/// An optional description for the data migration.
/// </summary>
string Description { get; }
/// <summary>
/// An optional checksum of the data migration.
/// </summary>
string Checksum { get; }
/// <summary>
/// The unit of work to work with.
/// </summary>
T UnitOfWork { get; set; }
/// <summary>
/// Applies the data migration.
/// </summary>
void ApplyMigration();
}
}
| 26.170732 | 90 | 0.5685 |
99402393821abdc6a6763c93c32a17183f52627e | 553 | cs | C# | MappingSPO/Entities/WinbooksCompanyTableEntity.cs | hmohcine/MappingSPO | 8c553ba99cad125e991aa3da5c23803b5ba8fbc0 | [
"MIT"
] | null | null | null | MappingSPO/Entities/WinbooksCompanyTableEntity.cs | hmohcine/MappingSPO | 8c553ba99cad125e991aa3da5c23803b5ba8fbc0 | [
"MIT"
] | null | null | null | MappingSPO/Entities/WinbooksCompanyTableEntity.cs | hmohcine/MappingSPO | 8c553ba99cad125e991aa3da5c23803b5ba8fbc0 | [
"MIT"
] | null | null | null |
namespace MappingSPO.Entities
{
public partial class WinbooksCompanyTableEntity
{
public WinbooksCompanyTableEntity()
{
InitializePartial();
}
public long Wbid { get; set; }
public long CompanyId { get; set; }
public long TableId { get; set; }
public string CompanyKey { get; set; }
public string SourceFileName { get; set; }
public string Memo { get; set; }
public string TargetTable { get; set; }
partial void InitializePartial();
}
}
| 25.136364 | 51 | 0.59132 |
885971a035d3879bc6ce9769fe3bf825d1c440e8 | 3,139 | cs | C# | packages/GeoAPI.Core.1.7.5/src/Geometries/ICoordinateSequenceFilter.cs | JeyssonXD/Sistema-Alerta-OT | 5dac04bc2fab5a9500e50b8e7aeddf9ae8893fde | [
"MIT"
] | 150 | 2015-01-24T20:14:57.000Z | 2022-03-31T03:41:23.000Z | packages/GeoAPI.Core.1.7.5/src/Geometries/ICoordinateSequenceFilter.cs | JeyssonXD/Sistema-Alerta-OT | 5dac04bc2fab5a9500e50b8e7aeddf9ae8893fde | [
"MIT"
] | 62 | 2015-01-27T13:19:15.000Z | 2022-02-26T19:37:01.000Z | TCCC/SetupApplication/packages/GeoAPI.Core.1.7.5/src/Geometries/ICoordinateSequenceFilter.cs | andreitudorica/Licence-Thesis-UTCN | 7402553b50a3d666c6d6b0bf2051a3be460932f8 | [
"BSD-4-Clause-UC"
] | 75 | 2015-02-16T14:25:16.000Z | 2021-11-18T00:53:21.000Z | using System;
namespace GeoAPI.Geometries
{
///<summary>
/// An interface for classes which process the coordinates in a <see cref="ICoordinateSequence"/>.
/// A filter can either record information about each coordinate,
/// or change the value of the coordinate.
/// Filters can be
/// used to implement operations such as coordinate transformations, centroid and
/// envelope computation, and many other functions.
/// <see cref="IGeometry"/> classes support the concept of applying a
/// <c>CoordinateSequenceFilter</c> to each
/// <see cref="ICoordinateSequence"/>s they contain.
/// <para/>
/// For maximum efficiency, the execution of filters can be short-circuited by using the <see cref="ICoordinateSequenceFilter.Done"/> property.
///</summary>
///<see cref="IGeometry.Apply(ICoordinateSequenceFilter)"/>
///<remarks>
/// <c>CoordinateSequenceFilter</c> is an example of the Gang-of-Four Visitor pattern.
/// <para><b>Note</b>: In general, it is preferable to treat Geometrys as immutable.
/// Mutation should be performed by creating a new Geometry object (see <see cref="T:NetTopologySuite.Geometries.Utilities.GeometryEditor"/>
/// and <see cref="T:NetTopologySuite.Geometries.Utilities.GeometryTransformer"/> for convenient ways to do this).
/// An exception to this rule is when a new Geometry has been created via <see cref="ICoordinateSequence.Copy"/>.
/// In this case mutating the Geometry will not cause aliasing issues,
/// and a filter is a convenient way to implement coordinate transformation.
/// </para>
///</remarks>
/// <author>Martin Davis</author>
/// <seealso cref="IGeometry.Apply(ICoordinateFilter)"/>
/// <seealso cref="T:NetTopologySuite.Geometries.Utilities.GeometryTransformer"/>
/// <see cref="T:NetTopologySuite.Geometries.Utilities.GeometryEditor"/>
public interface ICoordinateSequenceFilter
{
///<summary>
/// Performs an operation on a coordinate in a <see cref="ICoordinateSequence"/>.
///</summary>
/// <param name="seq">the <c>CoordinateSequence</c> to which the filter is applied</param>
/// <param name="i">i the index of the coordinate to apply the filter to</param>
void Filter(ICoordinateSequence seq, int i);
///<summary>
/// Reports whether the application of this filter can be terminated.
///</summary>
///<remarks>
/// Once this method returns <c>false</c>, it should
/// continue to return <c>false</c> on every subsequent call.
///</remarks>
Boolean Done { get; }
///<summary>
/// Reports whether the execution of this filter has modified the coordinates of the geometry.
/// If so, <see cref="IGeometry.GeometryChanged()"/> will be executed
/// after this filter has finished being executed.
/// </summary>
/// <remarks>Most filters can simply return a constant value reflecting whether they are able to change the coordinates.</remarks>
Boolean GeometryChanged { get; }
}
} | 52.316667 | 147 | 0.671233 |
8487c5a32d12266596c9ed20a646292a654a3404 | 5,633 | cs | C# | framework/test/Sprite.Data.Tests/Uow/Uow_Tx_Propagation_Tests.cs | beango-project/beango-framework | cd35572950f138f9581b32888bb54843cdaba11a | [
"Apache-2.0"
] | null | null | null | framework/test/Sprite.Data.Tests/Uow/Uow_Tx_Propagation_Tests.cs | beango-project/beango-framework | cd35572950f138f9581b32888bb54843cdaba11a | [
"Apache-2.0"
] | null | null | null | framework/test/Sprite.Data.Tests/Uow/Uow_Tx_Propagation_Tests.cs | beango-project/beango-framework | cd35572950f138f9581b32888bb54843cdaba11a | [
"Apache-2.0"
] | null | null | null | using System.Collections.Generic;
using System.Data.Common;
using System.Data.SqlClient;
using Microsoft.Data.Sqlite;
using Microsoft.Extensions.DependencyInjection;
using Shouldly;
using Sprite.Data.Persistence;
using Sprite.Data.Tests.Persistence;
using Sprite.Data.Transaction;
using Sprite.Data.Uow;
using Sprite.Tests;
using Xunit;
namespace Sprite.Data.Tests.Uow
{
public class Uow_Tx_Propagation_Tests : SpriteIntegratedTest<DataTestModule>
{
private readonly IUnitOfWorkManager _unitOfWorkManager;
public Uow_Tx_Propagation_Tests()
{
_unitOfWorkManager = ServiceProvider.GetRequiredService<IUnitOfWorkManager>();
}
[Fact]
public void Should_Create_Nested_Uow()
{
using (var uow = _unitOfWorkManager.Begin())
{
_unitOfWorkManager.CurrentUow.ShouldNotBeNull();
_unitOfWorkManager.CurrentUow.ShouldBe(uow);
using (var nestedUow = _unitOfWorkManager.Begin())
{
_unitOfWorkManager.CurrentUow.ShouldNotBeNull();
_unitOfWorkManager.CurrentUow.ShouldBe(nestedUow);
_unitOfWorkManager.CurrentUow.ShouldBeOfType<VirtualUnitOfWork>();
_unitOfWorkManager.CurrentUow.Outer.ShouldBeNull();
((VirtualUnitOfWork)nestedUow).BaseUow.ShouldBe(uow);
}
}
using (var uow = _unitOfWorkManager.Begin())
{
}
_unitOfWorkManager.CurrentUow.ShouldBeNull();
}
[Fact]
public void Should_Create_Virtual_Uow_With_Tx_Propagation_Request_Of_Non_Tx()
{
using (var uow = _unitOfWorkManager.Begin())
{
_unitOfWorkManager.CurrentUow.ShouldNotBeNull();
_unitOfWorkManager.CurrentUow.ShouldBe(uow);
using (var nestedUow = _unitOfWorkManager.Begin())
{
_unitOfWorkManager.CurrentUow.ShouldNotBeNull();
_unitOfWorkManager.CurrentUow.ShouldBe(nestedUow);
_unitOfWorkManager.CurrentUow.ShouldBeOfType<VirtualUnitOfWork>();
_unitOfWorkManager.CurrentUow.Outer.ShouldBeNull();
((VirtualUnitOfWork)nestedUow).BaseUow.ShouldBe(uow);
}
}
_unitOfWorkManager.CurrentUow.ShouldBeNull();
}
[Fact]
public void Should_Create_Virtual_Uow_With_Tx_Propagation_RequestNew_Of_Non_Tx()
// public void Should_Create_New_Uow_With_Tx_Propagation_RequestNew()
{
var txOpts = new TransactionOptions()
{
Propagation = Propagation.RequiresNew
};
using (var uow = _unitOfWorkManager.Begin())
{
_unitOfWorkManager.CurrentUow.ShouldNotBeNull();
_unitOfWorkManager.CurrentUow.ShouldBe(uow);
using (var newUow = _unitOfWorkManager.Begin(txOpts))
{
_unitOfWorkManager.CurrentUow.ShouldNotBeNull();
_unitOfWorkManager.CurrentUow.ShouldBe(newUow);
_unitOfWorkManager.CurrentUow.ShouldBeOfType<UnitOfWork>();
_unitOfWorkManager.CurrentUow.Outer.ShouldBe(uow);
using (var newUow2 = _unitOfWorkManager.Begin(txOpts))
{
_unitOfWorkManager.CurrentUow.ShouldNotBeNull();
_unitOfWorkManager.CurrentUow.ShouldBe(newUow2);
_unitOfWorkManager.CurrentUow.ShouldBeOfType<UnitOfWork>();
_unitOfWorkManager.CurrentUow.Outer.ShouldBe(newUow);
}
_unitOfWorkManager.CurrentUow.ShouldBe(newUow);
}
}
_unitOfWorkManager.CurrentUow.ShouldBeNull();
}
[Fact]
public void Should_Create_New_Uow_With_Tx_Propagation_Supports()
{
var txOpts = new TransactionOptions()
{
Propagation = Propagation.Supports
};
var vendor = ServiceProvider.GetRequiredService<AdoSqlite>();
// var vendor2 = ServiceProvider.GetRequiredService<AdoSqlite>();
var str = $"{vendor.DbConnection}";
List<SqlConnection> dbConnections = new List<SqlConnection>();
var sqlConnection = new SqlConnection();
var sqlConnection2 = new SqlConnection();
Assert.Equal(sqlConnection,sqlConnection);
// var tx1 = sqlConnection.BeginTransaction();
// transactions.Add(tx1);
// var tx2 = sqlConnection2.BeginTransaction();
using (var uow = _unitOfWorkManager.Begin())
{
_unitOfWorkManager.CurrentUow.ShouldNotBeNull();
_unitOfWorkManager.CurrentUow.ShouldBe(uow);
uow.HasTransaction.ShouldBeFalse();
AddVendorInUow(_unitOfWorkManager.CurrentUow, "Ado_SQLite", vendor);
vendor.CurrentTransaction.ShouldBeNull();
var dbTx = vendor.BeginTransaction();
vendor.CurrentTransaction.ShouldBe(dbTx);
uow.HasTransaction.ShouldBeTrue();
}
_unitOfWorkManager.CurrentUow.ShouldBeNull();
}
private void AddVendorInUow(IUnitOfWork unitOfWork, string key, IVendor vendor)
{
unitOfWork.GetOrAddVendor(key, vendor);
}
}
} | 37.059211 | 90 | 0.597018 |
21ebddc905ad382392386ea66bb9abb78aef882e | 622 | cs | C# | LibraryManagementSystem/Users.cs | NafisaMaliyat-iut/SWE-4202-Summer-2021 | 8a857bdf92b7019adf3c3f46ee8220e2b58d2d50 | [
"MIT"
] | null | null | null | LibraryManagementSystem/Users.cs | NafisaMaliyat-iut/SWE-4202-Summer-2021 | 8a857bdf92b7019adf3c3f46ee8220e2b58d2d50 | [
"MIT"
] | null | null | null | LibraryManagementSystem/Users.cs | NafisaMaliyat-iut/SWE-4202-Summer-2021 | 8a857bdf92b7019adf3c3f46ee8220e2b58d2d50 | [
"MIT"
] | null | null | null | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LibraryManagementSystem
{
internal class Users
{
public int userID = 0;
public string userName = "";
public string userAddress = "";
public List<int> bookIDBorrrowedList = new List<int>();
public void BorrowBook(int userIDBorrowed, int bookIDBorrowed)
{
}
public string GetUserInfo()
{
return Convert.ToString(userID) + "\t" + userName + "\t" + userAddress;
}
}
}
| 20.733333 | 83 | 0.596463 |
812d96692fd2024a87fc13eb13c5cd47b0597733 | 1,395 | cs | C# | bbs.D3S.Domain.SeedWork/Abstracts/Entity.cs | RSadocchi/bbs.D3S.Domain.SeedWork | 98e785bd0bb047e9a14392ed211ea2b38360181b | [
"MIT"
] | null | null | null | bbs.D3S.Domain.SeedWork/Abstracts/Entity.cs | RSadocchi/bbs.D3S.Domain.SeedWork | 98e785bd0bb047e9a14392ed211ea2b38360181b | [
"MIT"
] | null | null | null | bbs.D3S.Domain.SeedWork/Abstracts/Entity.cs | RSadocchi/bbs.D3S.Domain.SeedWork | 98e785bd0bb047e9a14392ed211ea2b38360181b | [
"MIT"
] | null | null | null | using System;
using System.Collections.Generic;
using System.Text;
namespace bbs.D3S.Domain.SeedWork
{
public abstract class Entity
{
//int? _requestedHashCode;
//private List<INotification> _domainEvents;
//public List<INotification> DomainEvents => _domainEvents;
//public void AddDomainEvent(INotification eventItem)
//{
// _domainEvents = _domainEvents ?? new List<INotification>();
// _domainEvents.Add(eventItem);
//}
//public void RemoveDomainEvent(INotification eventItem)
//{
// if (_domainEvents is null) return;
// _domainEvents.Remove(eventItem);
//}
public override bool Equals(object obj)
{
if (obj == null || !(obj is Entity)) return false;
if (Object.ReferenceEquals(this, obj)) return true;
if (GetType() != obj.GetType()) return false;
return false;
}
public override int GetHashCode() => base.GetHashCode();
public static bool operator ==(Entity left, Entity right)
{
if (Object.Equals(left, null)) return (Object.Equals(right, null)) ? true : false;
else return left.Equals(right);
}
public static bool operator !=(Entity left, Entity right)
{
return !(left == right);
}
}
}
| 29.680851 | 94 | 0.582079 |
53e73bb16088fac1ac1f3430c12fc02992956b78 | 7,058 | cs | C# | Rebus.AwsSnsAndSqsPerformanceTest/Program.cs | ThomasEg/Rebus.AwsSnsAndSqs | 4914ca9cd99c9c449c8e36ef177bf813f80b8930 | [
"MIT"
] | 6 | 2019-10-02T13:58:18.000Z | 2021-10-05T00:42:14.000Z | Rebus.AwsSnsAndSqsPerformanceTest/Program.cs | ThomasEg/Rebus.AwsSnsAndSqs | 4914ca9cd99c9c449c8e36ef177bf813f80b8930 | [
"MIT"
] | 2 | 2021-03-09T11:51:37.000Z | 2022-01-24T09:09:07.000Z | Rebus.AwsSnsAndSqsPerformanceTest/Program.cs | ThomasEg/Rebus.AwsSnsAndSqs | 4914ca9cd99c9c449c8e36ef177bf813f80b8930 | [
"MIT"
] | 4 | 2019-05-03T17:30:37.000Z | 2021-03-09T12:07:55.000Z | using System;
using System.Collections.Generic;
using System.IO;
using Rebus.AwsSnsAndSqsPerformanceTest.Markdown;
using Rebus.Config;
using Serilog;
using Logger = Serilog.Log;
namespace Rebus.AwsSnsAndSqsPerformanceTest
{
using System.Threading.Tasks;
using Amazon.Runtime.Internal;
using AwsSnsAndSqs;
public class Program
{
static void Main(string[] args)
{
try
{
Logger.Logger = new LoggerConfiguration()
.Enrich.WithRebusCorrelationId("Test-Run")
.WriteTo.RollingFile("logs-{date}.txt")
.CreateLogger();
var markDownPage = new MarkDownPage();
markDownPage.AddMarkDown(new Header
{
HeaderLevel = HeaderLevel.One,
Text = "Load test data"
});
markDownPage.AddTextNewLine("Aws rebus sns and sqs load test results.");
markDownPage.AddTextNewLine("Test were run without compression or encryption.");
markDownPage.AddTextNewLine("Added different message sizes to show performance difference.");
markDownPage.AddTextNewLine("As always with tcp you want to keep your packet size below 64k.");
markDownPage.AddTextNewLine("Keeping your messages below 32k will keep headers, etc from bumping your message over 64k.");
markDownPage.AddTextNewLine("It will also help you keep your aws costs down as going over 64k will double your cost per message");
markDownPage.AddMarkDown(TextControl.Newline);
var tableControl = new TableControl();
markDownPage.AddMarkDown(tableControl);
tableControl.AddColumn("Test");
tableControl.AddColumn("max # concurrent publishes");
tableControl.AddColumn("Publish per second");
tableControl.AddColumn("Receive # of workers");
tableControl.AddColumn("Receive max parallelism");
tableControl.AddColumn("# msgs Receive per second");
#if DEBUG
AsyncHelpers.RunSync(() => RunTest(
new SendOptions()
{
MessageSizeKilobytes = 4,
MaxDegreeOfParallelism = 200,
MaxMessagesPerTask = 1,
},
new ReceiveOptions()
{
RebusMaxParallelism = 200,
RebusNumberOfWorkers = Environment.ProcessorCount
}, tableControl));
#else
AsyncHelpers.RunSync(() => RunTest(
new SendOptions()
{
MessageSizeKilobytes = 4,
MaxDegreeOfParallelism = 200,
MaxMessagesPerTask = 1
},
new ReceiveOptions()
{
RebusMaxParallelism = 200,
RebusNumberOfWorkers = Environment.ProcessorCount
}, tableControl));
AsyncHelpers.RunSync(() => RunTest(
new SendOptions()
{
MessageSizeKilobytes = 16,
MaxDegreeOfParallelism = 200,
MaxMessagesPerTask = 1
},
new ReceiveOptions()
{
RebusMaxParallelism = 200,
RebusNumberOfWorkers = Environment.ProcessorCount
}, tableControl));
AsyncHelpers.RunSync(() => RunTest(
new SendOptions()
{
MessageSizeKilobytes = 32,
MaxDegreeOfParallelism = 200,
MaxMessagesPerTask = 1
},
new ReceiveOptions()
{
RebusMaxParallelism = 200,
RebusNumberOfWorkers = Environment.ProcessorCount
}, tableControl));
AsyncHelpers.RunSync(() => RunTest(
new SendOptions()
{
MessageSizeKilobytes = 64,
MaxDegreeOfParallelism = 200,
MaxMessagesPerTask = 1
},
new ReceiveOptions()
{
RebusMaxParallelism = 200,
RebusNumberOfWorkers = Environment.ProcessorCount
}, tableControl));
AsyncHelpers.RunSync(() => RunTest(
new SendOptions()
{
MessageSizeKilobytes = 128,
MaxDegreeOfParallelism = 200,
MaxMessagesPerTask = 1
},
new ReceiveOptions()
{
RebusMaxParallelism = 200,
RebusNumberOfWorkers = Environment.ProcessorCount
}, tableControl));
#endif
Console.WriteLine("Creating load test result markdown");
var file = "..\\..\\..\\LoadResults.md";
using (FileStream fs = new FileStream(file, FileMode.Create))
{
markDownPage.Write(fs);
}
}
finally
{
Console.WriteLine("Complete. Press enter to close.");
Console.ReadLine();
}
}
private static async Task RunTest(SendOptions sendOptions, ReceiveOptions receiveOptions, TableControl tableControl)
{
var result = await PerformanceTest.RunTest(sendOptions, receiveOptions);
var text = $"send msgs at {sendOptions.MessageSizeKilobytes} kilobytes in size";
if (result == null)
{
Console.WriteLine($"Test failed: {text}");
}
var messagesSentPerSecond = result.MessageSentTimes.MessagesSentCounter.Value / result.MessageSentTimes.MessageSentTimePerTimePeriod.TotalSeconds;
var messagesReceivedPerSecond = result.MessageReceivedTimes.MessagesReceivedCounter.Value / result.MessageReceivedTimes.MessageRecievedTimePerTimePeriod.Elapsed.TotalSeconds;
tableControl.AddRow(new List<TableCellControl>()
{
new TableCellControl(text),
new TableCellControl($"{sendOptions.MaxDegreeOfParallelism}"),
new TableCellControl($"{messagesSentPerSecond}"),
new TableCellControl($"{receiveOptions.RebusNumberOfWorkers}"),
new TableCellControl($"{receiveOptions.RebusMaxParallelism}"),
new TableCellControl($"{messagesReceivedPerSecond}"),
});
}
}
}
| 41.034884 | 186 | 0.51261 |
4da3a529e273af42c0ee45b5b7e59311d32dfa51 | 605 | cs | C# | SRC/Private/Abstractions/Interfaces/Reflection/IEventInfo.cs | Sholtee/proxygen | dde6a1f49df3ce11207913213768e6e1c3f447ba | [
"MIT"
] | 2 | 2020-11-25T11:18:08.000Z | 2021-03-18T02:38:26.000Z | SRC/Private/Abstractions/Interfaces/Reflection/IEventInfo.cs | Sholtee/proxygen | dde6a1f49df3ce11207913213768e6e1c3f447ba | [
"MIT"
] | null | null | null | SRC/Private/Abstractions/Interfaces/Reflection/IEventInfo.cs | Sholtee/proxygen | dde6a1f49df3ce11207913213768e6e1c3f447ba | [
"MIT"
] | 1 | 2021-04-05T11:32:01.000Z | 2021-04-05T11:32:01.000Z | /********************************************************************************
* IEventInfo.cs *
* *
* Author: Denes Solti *
********************************************************************************/
namespace Solti.Utils.Proxy.Internals
{
internal interface IEventInfo: IMemberInfo, IHasType
{
IMethodInfo? AddMethod { get; }
IMethodInfo? RemoveMethod { get; }
}
}
| 43.214286 | 82 | 0.257851 |
4dc811610a2bfdd61b70f25518d202420686a523 | 1,811 | cs | C# | src/Microsoft.DotNet.ImageBuilder/src/Commands/CopyImagesOptions.cs | QaColony/dotnet-tools_DI | df01b956b9df83710c2de325b4a682b35f88b2ce | [
"MIT"
] | 73 | 2017-05-16T21:38:28.000Z | 2022-03-09T02:21:28.000Z | src/Microsoft.DotNet.ImageBuilder/src/Commands/CopyImagesOptions.cs | QaColony/dotnet-tools_DI | df01b956b9df83710c2de325b4a682b35f88b2ce | [
"MIT"
] | 561 | 2017-05-03T20:44:15.000Z | 2022-03-30T17:17:12.000Z | src/Microsoft.DotNet.ImageBuilder/src/Commands/CopyImagesOptions.cs | QaColony/dotnet-tools_DI | df01b956b9df83710c2de325b4a682b35f88b2ce | [
"MIT"
] | 28 | 2017-05-01T20:19:00.000Z | 2022-03-25T23:49:18.000Z | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using System.CommandLine;
using System.Linq;
#nullable enable
namespace Microsoft.DotNet.ImageBuilder.Commands
{
public class CopyImagesOptions : ManifestOptions, IFilterableOptions
{
public ManifestFilterOptions FilterOptions { get; set; } = new ManifestFilterOptions();
public string ResourceGroup { get; set; } = string.Empty;
public string Subscription { get; set; } = string.Empty;
public ServicePrincipalOptions ServicePrincipal { get; set; } = new ServicePrincipalOptions();
}
public class CopyImagesOptionsBuilder : ManifestOptionsBuilder
{
private readonly ManifestFilterOptionsBuilder _manifestFilterOptionsBuilder =
new ManifestFilterOptionsBuilder();
public override IEnumerable<Option> GetCliOptions() =>
base.GetCliOptions().Concat(_manifestFilterOptionsBuilder.GetCliOptions());
public override IEnumerable<Argument> GetCliArguments() =>
base.GetCliArguments()
.Concat(_manifestFilterOptionsBuilder.GetCliArguments())
.Concat(ServicePrincipalOptions.GetCliArguments())
.Concat(
new Argument[]
{
new Argument<string>(nameof(CopyImagesOptions.Subscription),
"Azure subscription to operate on"),
new Argument<string>(nameof(CopyImagesOptions.ResourceGroup),
"Azure resource group to operate on"),
});
}
}
#nullable disable
| 40.244444 | 102 | 0.659856 |
dfe4bcaf9a314e26fcc64e973a5ceb788479116f | 102 | cs | C# | Enemies/Enemy.cs | POBIX/willy-on-a-wheel | 90e66c937a7bf1c588b4050e5899614daa623a23 | [
"MIT"
] | 2 | 2021-10-05T17:04:36.000Z | 2021-12-18T13:41:49.000Z | Enemies/Enemy.cs | POBIX/willy-on-a-wheel | 90e66c937a7bf1c588b4050e5899614daa623a23 | [
"MIT"
] | null | null | null | Enemies/Enemy.cs | POBIX/willy-on-a-wheel | 90e66c937a7bf1c588b4050e5899614daa623a23 | [
"MIT"
] | null | null | null | using Godot;
public class Enemy : KinematicBody2D
{
public virtual void Die() => QueueFree();
}
| 14.571429 | 45 | 0.686275 |
66e99daeb0267b7b6419173b46492065b292db36 | 695 | cs | C# | c_sharp/Unity_ARPG_SFS_MMO_2/EnemyHealthManager.cs | vesche/snippets | 7a9d598df99c26c4e0c63669f9f95a94eeed0d08 | [
"Unlicense"
] | 7 | 2016-01-03T19:42:07.000Z | 2018-10-23T14:03:12.000Z | c_sharp/Unity_ARPG_SFS_MMO_2/EnemyHealthManager.cs | vesche/snippets | 7a9d598df99c26c4e0c63669f9f95a94eeed0d08 | [
"Unlicense"
] | null | null | null | c_sharp/Unity_ARPG_SFS_MMO_2/EnemyHealthManager.cs | vesche/snippets | 7a9d598df99c26c4e0c63669f9f95a94eeed0d08 | [
"Unlicense"
] | 1 | 2018-03-09T08:52:01.000Z | 2018-03-09T08:52:01.000Z | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnemyHealthManager : MonoBehaviour {
public int MaxHealth;
public int CurrentHealth;
private PlayerStats thePlayerStats;
public int expToGive;
// Use this for initialization
void Start () {
CurrentHealth = MaxHealth;
thePlayerStats = FindObjectOfType<PlayerStats> ();
}
// Update is called once per frame
void Update () {
if (CurrentHealth <= 0)
{
Destroy (gameObject);
thePlayerStats.AddExperience (expToGive);
}
}
public void HurtEnemy (int damageToGive)
{
CurrentHealth -= damageToGive;
}
public void SetMaxHealth()
{
CurrentHealth = MaxHealth;
}
}
| 16.162791 | 52 | 0.723741 |
c62eeadf42dffd2f5486820c86cef19129f36cf7 | 642 | cs | C# | src/Solid.Core/IdAttribute.cs | godrose/Solid | fea4144c227591ed907eae559c4e45a76528f6f9 | [
"Apache-2.0"
] | 16 | 2015-07-25T10:48:24.000Z | 2021-05-10T03:14:50.000Z | src/Solid.Core/IdAttribute.cs | godrose/Solid | fea4144c227591ed907eae559c4e45a76528f6f9 | [
"Apache-2.0"
] | 54 | 2016-03-06T09:25:19.000Z | 2021-11-24T16:34:15.000Z | src/Solid.Core/IdAttribute.cs | godrose/Solid | fea4144c227591ed907eae559c4e45a76528f6f9 | [
"Apache-2.0"
] | 5 | 2016-02-15T12:38:18.000Z | 2019-02-18T09:51:04.000Z | using System;
namespace Solid.Core
{
/// <summary>
/// The identity attribute. Use it to assign a unique identifiable value to the type.
/// </summary>
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
public sealed class IdAttribute : Attribute
{
/// <summary>
/// Creates an instance of <see cref="IdAttribute"/>
/// </summary>
/// <param name="id"></param>
public IdAttribute(string id)
{
Id = id;
}
/// <summary>
/// The id.
/// </summary>
public string Id { get; }
}
}
| 24.692308 | 90 | 0.537383 |
dff48ff844044ee960c1283ae3c06e9e577eac95 | 1,437 | cs | C# | src/api/Vote.API/Member/LoginController.cs | MichealFex/vote | e0d107366f8595e68b41603ec787091394187093 | [
"Apache-2.0"
] | 1 | 2019-10-10T02:32:33.000Z | 2019-10-10T02:32:33.000Z | src/api/Vote.API/Member/LoginController.cs | MichealFex/vote | e0d107366f8595e68b41603ec787091394187093 | [
"Apache-2.0"
] | null | null | null | src/api/Vote.API/Member/LoginController.cs | MichealFex/vote | e0d107366f8595e68b41603ec787091394187093 | [
"Apache-2.0"
] | null | null | null | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Vote.Model;
using Vote.Model.DTO;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace Vote.API.Member
{
/// <summary>
/// 用户登陆相关API接口
/// </summary>
[Route("[controller]")]
public class LoginController : Controller
{
/// <summary>
/// 用户登陆
/// </summary>
/// <param name="input">登陆参数</param>
/// <returns></returns>
[HttpPost("/login")]
public Result Login([FromBody]LoginInput input)
{
return new Result();
}
// GET api/<controller>/5
/// <summary>
///
/// </summary>
/// <param name="id">Id参数</param>
/// <returns></returns>
[HttpGet("{id}")]
public string Get(int id)
{
return "value";
}
// POST api/<controller>
[HttpGet("/")]
[HttpPost("/")]
public dynamic Post()
{
return new Result();
}
// PUT api/<controller>/5
[HttpPut("{id}")]
public void Put(int id, [FromBody]string value)
{
}
// DELETE api/<controller>/5
[HttpDelete("{id}")]
public void Delete(int id)
{
}
}
}
| 22.809524 | 116 | 0.512178 |
5f29e26c2869af18cace0cb5b45b69fb22e9f596 | 2,904 | cs | C# | OneCodeTeam/How to Import vCard Files in Office 365 Exchange Online/[VB]-How to Import vCard Files in Office 365 Exchange Online/C#/CSO365ImportVCardFiles/SetContactDetails.cs | zzgchina888/msdn-code-gallery-microsoft | 21cb9b6bc0da3b234c5854ecac449cb3bd261f29 | [
"MIT"
] | 2 | 2022-01-21T01:40:58.000Z | 2022-01-21T01:41:10.000Z | OneCodeTeam/How to Import vCard Files in Office 365 Exchange Online/[VB]-How to Import vCard Files in Office 365 Exchange Online/C#/CSO365ImportVCardFiles/SetContactDetails.cs | zzgchina888/msdn-code-gallery-microsoft | 21cb9b6bc0da3b234c5854ecac449cb3bd261f29 | [
"MIT"
] | 1 | 2022-03-15T04:21:41.000Z | 2022-03-15T04:21:41.000Z | OneCodeTeam/How to Import vCard Files in Office 365 Exchange Online/[VB]-How to Import vCard Files in Office 365 Exchange Online/C#/CSO365ImportVCardFiles/SetContactDetails.cs | zzgchina888/msdn-code-gallery-microsoft | 21cb9b6bc0da3b234c5854ecac449cb3bd261f29 | [
"MIT"
] | null | null | null | /****************************** Module Header ******************************\
Module Name: SetContactDetails.cs
Project: CSO365ImportVCardFiles
Copyright (c) Microsoft Corporation.
The vCard file format is supported by many email clients and email services.
Now Outlook Web App supports to import the single .CSV file only. In this
application, we will demonstrate how to import multiple vCard files in
Office 365 Exchange Online.
The class includes the methods that are invoked in set contact properties.
This source is subject to the Microsoft Public License.
See http://www.microsoft.com/en-us/openness/licenses.aspx#MPL.
All other rights reserved.
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
\***************************************************************************/
using System;
using System.Collections.Generic;
using Microsoft.Exchange.WebServices.Data;
namespace CSO365ImportVCardFiles
{
public static class SetContactDetails
{
/// <summary>
/// Set the address entry.
/// </summary>
public static void SetAddress(ContactSchemaProperties key, String keyValue,
PhysicalAddressEntry addressEntry)
{
switch (key)
{
case ContactSchemaProperties.BusinessAddressStreet:
case ContactSchemaProperties.HomeAddressStreet:
case ContactSchemaProperties.OtherAddressStreet:
addressEntry.Street = keyValue;
break;
case ContactSchemaProperties.BusinessAddressCity:
case ContactSchemaProperties.HomeAddressCity:
case ContactSchemaProperties.OtherAddressCity:
addressEntry.City = keyValue;
break;
case ContactSchemaProperties.BusinessAddressState:
case ContactSchemaProperties.HomeAddressState:
case ContactSchemaProperties.OtherAddressState:
addressEntry.State = keyValue;
break;
case ContactSchemaProperties.BusinessAddressPostalCode:
case ContactSchemaProperties.HomeAddressPostalCode:
case ContactSchemaProperties.OtherAddressPostalCode:
addressEntry.PostalCode = keyValue;
break;
case ContactSchemaProperties.BusinessAddressCountryOrRegion:
case ContactSchemaProperties.HomeAddressCountryOrRegion:
case ContactSchemaProperties.OtherAddressCountryOrRegion:
addressEntry.CountryOrRegion = keyValue;
break;
default:
break;
}
}
}
}
| 42.086957 | 84 | 0.631198 |
6fc36ac19d73fa82f17c5c26b8824bfff795f040 | 951 | cs | C# | ClubPenguin.Interactables.Domain/InteractablesEvents.cs | smdx24/CPI-Source-Code | 7602749d447dc73f24ecd9e08c50d2031721abf4 | [
"MIT"
] | 8 | 2019-06-04T19:49:27.000Z | 2022-03-19T13:39:41.000Z | ClubPenguin.Interactables.Domain/InteractablesEvents.cs | smdx24/CPI-Source-Code | 7602749d447dc73f24ecd9e08c50d2031721abf4 | [
"MIT"
] | null | null | null | ClubPenguin.Interactables.Domain/InteractablesEvents.cs | smdx24/CPI-Source-Code | 7602749d447dc73f24ecd9e08c50d2031721abf4 | [
"MIT"
] | 5 | 2020-05-05T04:06:29.000Z | 2022-02-09T21:12:34.000Z | // InteractablesEvents
using ClubPenguin.Interactables.Domain;
using UnityEngine;
public static class InteractablesEvents
{
public enum Actions
{
DoneInteracting = -1,
Action1,
Action2,
Action3
}
public struct ActionEvent
{
public readonly GameObject InteractableTarget;
public readonly Actions Action;
public ActionEvent(GameObject _interactableTarget, Actions _action)
{
InteractableTarget = _interactableTarget;
Action = _action;
}
}
public struct InvitationalItemUsed
{
public readonly GameObject Item;
public readonly int QuantityLeft;
public InvitationalItemUsed(GameObject _item, int _quantityLeft)
{
Item = _item;
QuantityLeft = _quantityLeft;
}
}
public struct InWorldItemCollected
{
public readonly string PickupTag;
public readonly int CoinCount;
public InWorldItemCollected(string pickupTag, int coinCount)
{
PickupTag = pickupTag;
CoinCount = coinCount;
}
}
}
| 17.611111 | 69 | 0.754995 |
6ff04fe1684821c0b1e8d17afbce1e334f61f3b4 | 2,254 | cs | C# | Runtime/Grid2D/Common/RoomTemplates/RoomTemplateSettingsGrid2D.cs | OndrejNepozitek/ProceduralLevelGenerator-Unity | fa4d7f2ebb30b067388ce566a9d175015709ea73 | [
"MIT"
] | 123 | 2019-02-26T22:38:57.000Z | 2020-06-13T11:21:28.000Z | Runtime/Grid2D/Common/RoomTemplates/RoomTemplateSettingsGrid2D.cs | OndrejNepozitek/ProceduralLevelGenerator-Unity | fa4d7f2ebb30b067388ce566a9d175015709ea73 | [
"MIT"
] | 48 | 2019-02-27T19:55:33.000Z | 2020-06-01T20:42:14.000Z | Runtime/Grid2D/Common/RoomTemplates/RoomTemplateSettingsGrid2D.cs | OndrejNepozitek/ProceduralLevelGenerator-Unity | fa4d7f2ebb30b067388ce566a9d175015709ea73 | [
"MIT"
] | 24 | 2019-03-07T19:47:31.000Z | 2020-06-03T09:13:30.000Z | using System;
using Edgar.Geometry;
using Edgar.GraphBasedGenerator.Common;
using UnityEngine;
using UnityEngine.Tilemaps;
namespace Edgar.Unity
{
/// <summary>
/// Component that is attached to each room template game objects and contains basic settings.
/// </summary>
[AddComponentMenu("Edgar/Grid2D/Room Template Settings (Grid2D)")]
public class RoomTemplateSettingsGrid2D : MonoBehaviour
{
public RoomTemplateRepeatMode RepeatMode = RoomTemplateRepeatMode.AllowRepeat;
public PolygonGrid2D GetOutline()
{
try
{
var polygon = RoomTemplateLoaderGrid2D.GetPolygonFromRoomTemplate(gameObject);
return polygon;
}
catch (InvalidOutlineException)
{
return null;
}
}
public void AddOutlineOverride()
{
if (HasOutlineOverride())
{
return;
}
var tilemapsRoot = RoomTemplateUtilsGrid2D.GetTilemapsRoot(gameObject);
var outlineOverride = new GameObject(GeneratorConstantsGrid2D.OutlineOverrideLayerName);
outlineOverride.transform.parent = tilemapsRoot.transform;
outlineOverride.AddComponent<Tilemap>();
outlineOverride.AddComponent<TilemapRenderer>();
outlineOverride.AddComponent<OutlineOverrideGrid2D>();
outlineOverride.GetComponent<TilemapRenderer>().sortingOrder = 1000;
}
public void RemoveOutlineOverride()
{
if (!HasOutlineOverride())
{
return;
}
var tilemapsRoot = RoomTemplateUtilsGrid2D.GetTilemapsRoot(gameObject);
var outlineOverride = tilemapsRoot.transform.Find(GeneratorConstantsGrid2D.OutlineOverrideLayerName).gameObject;
PostProcessUtilsGrid2D.Destroy(outlineOverride);
}
public bool HasOutlineOverride()
{
var tilemapsRoot = RoomTemplateUtilsGrid2D.GetTilemapsRoot(gameObject);
var outlineOverride = tilemapsRoot.transform.Find(GeneratorConstantsGrid2D.OutlineOverrideLayerName);
return outlineOverride != null;
}
}
} | 33.641791 | 124 | 0.639308 |
c14bf4c140bf8af490975d0151d8b2249ca23390 | 5,830 | cs | C# | experimental/SvgXml.Test/Program.cs | benjaminZale/Svg.Skia | 0d310631003d72e7e0008a51380b36660322d88f | [
"MIT"
] | null | null | null | experimental/SvgXml.Test/Program.cs | benjaminZale/Svg.Skia | 0d310631003d72e7e0008a51380b36660322d88f | [
"MIT"
] | null | null | null | experimental/SvgXml.Test/Program.cs | benjaminZale/Svg.Skia | 0d310631003d72e7e0008a51380b36660322d88f | [
"MIT"
] | null | null | null | using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Linq;
using SvgXml.Svg;
using SvgXml.Xml;
using SvgXml.Xml.Attributes;
namespace SvgXml.Test
{
internal class Program
{
internal class ElementInfo
{
public string? Name { get; set; }
public Type? Type { get; set; }
public (PropertyInfo Property, AttributeAttribute? Attribute)[]? Attributes { get; set; }
}
private static PropertyInfo[] GetPublicProperties(Type type)
{
var propertyInfos = new List<PropertyInfo>();
var considered = new List<Type>();
var queue = new Queue<Type>();
considered.Add(type);
queue.Enqueue(type);
while (queue.Count > 0)
{
var subType = queue.Dequeue();
foreach (var subInterface in subType.GetInterfaces())
{
if (considered.Contains(subInterface))
{
continue;
}
considered.Add(subInterface);
queue.Enqueue(subInterface);
}
var typeProperties = subType.GetProperties(BindingFlags.FlattenHierarchy | BindingFlags.Public | BindingFlags.Instance);
var newPropertyInfos = typeProperties.Where(x => !propertyInfos.Contains(x));
propertyInfos.InsertRange(0, newPropertyInfos);
}
return propertyInfos.ToArray();
}
private static void PrintAttributeUsage(Action<string> write)
{
var elements = typeof(SvgDocument).Assembly
.GetExportedTypes()
.Where(x => x.GetCustomAttributes(typeof(ElementAttribute), true).Length > 0 && x.IsSubclassOf(typeof(Element)))
.Select(x => new ElementInfo
{
Name = ((ElementAttribute)x.GetCustomAttributes(typeof(ElementAttribute), true)[0]).Name,
Type = x,
Attributes = GetPublicProperties(x).Select(x => (x, (AttributeAttribute?)x.GetCustomAttributes(typeof(AttributeAttribute), true).FirstOrDefault())).ToArray()
})
.OrderBy(x => x.Name);
#if true
foreach (var element in elements)
{
write($"{element.Name} [{element.Type?.Name}]");
if (element.Attributes != null)
{
foreach (var attribute in element.Attributes)
{
if (attribute.Attribute != null)
{
write($" {attribute.Attribute.Name} [{attribute.Property.Name}]");
}
}
}
}
#else
foreach (var element in elements)
{
write($"public interface I{element.Type?.Name}");
write($"{{");
if (element.Attributes != null)
{
foreach (var attribute in element.Attributes)
{
if (attribute.Attribute != null)
{
write($" {attribute.Property.Name} {{ get; set; }}");
}
}
}
write($"}}");
}
#endif
}
private static void Main(string[] args)
{
Action<string> write = Console.WriteLine;
if (args.Length == 0)
{
PrintAttributeUsage(write);
return;
}
if (args.Length != 1)
{
write($"Usage: {nameof(SvgXml.Test)} <directory>");
return;
}
var directory = new DirectoryInfo(args[0]);
var paths = new List<FileInfo>();
var files = Directory.EnumerateFiles(directory.FullName, "*.svg");
if (files != null)
{
foreach (var path in files)
{
paths.Add(new FileInfo(path));
}
}
paths.Sort((f1, f2) => f1.Name.CompareTo(f2.Name));
var sw = Stopwatch.StartNew();
var results = new List<(FileInfo path, SvgDocument document)>();
var elementFactory = new SvgElementFactory();
var errors = new List<(FileInfo path, Exception ex)>();
foreach (var path in paths)
{
try
{
var svgDocument = SvgDocument.Open(path.FullName);
if (svgDocument != null)
{
svgDocument.LoadIds();
svgDocument.LoadStyles();
svgDocument.FlushStyles(true);
results.Add((path, svgDocument));
}
}
catch (Exception ex)
{
errors.Add((path, ex));
}
}
sw.Stop();
write($"# {sw.Elapsed.TotalMilliseconds}ms [{sw.Elapsed}], {paths.Count} files");
foreach (var (path, ex) in errors)
{
write($"{path.FullName}");
Print(ex);
}
void Print(Exception ex)
{
write(ex.Message);
if (ex.StackTrace != null)
{
write(ex.StackTrace);
}
if (ex.InnerException != null)
{
Print(ex.InnerException);
}
}
}
}
}
| 33.895349 | 177 | 0.45506 |
0c0c09a29b52f2321c25ce3a6b369906fb7c0882 | 7,736 | cs | C# | Jx3Full/Source/Source/Tools/GameDesignerEditor/ThirdParty/TextEditor/Project/Src/Document/TextBufferStrategy/PieceTableTextBufferStrategy.cs | RivenZoo/FullSource | cfd7fd7ad422fd2dae5d657a18839c91ff9521fd | [
"MIT"
] | 2 | 2021-07-31T15:35:01.000Z | 2022-02-28T05:54:54.000Z | Jx3Full/Source/Source/Tools/GameDesignerEditor/ThirdParty/TextEditor/Project/Src/Document/TextBufferStrategy/PieceTableTextBufferStrategy.cs | RivenZoo/FullSource | cfd7fd7ad422fd2dae5d657a18839c91ff9521fd | [
"MIT"
] | null | null | null | Jx3Full/Source/Source/Tools/GameDesignerEditor/ThirdParty/TextEditor/Project/Src/Document/TextBufferStrategy/PieceTableTextBufferStrategy.cs | RivenZoo/FullSource | cfd7fd7ad422fd2dae5d657a18839c91ff9521fd | [
"MIT"
] | 5 | 2021-02-03T10:25:39.000Z | 2022-02-23T07:08:37.000Z | // <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="David McCloskey" email="dave_a_mccloskey@hotmail.com"/>
// <version>$Revision: 1.1 $</version>
// </file>
using System;
using System.Collections;
namespace ICSharpCode.TextEditor.Document
{
// Currently not in use and doesn't compile because SetContent is not implemented.
// If anyone wants to use this, it should be easy to fix it.
/*
public class PieceTableTextBufferStrategy : ITextBufferStrategy
{
protected struct PieceTableDescriptor
{
public bool Buffer; // False for original, True for modified
public int Offset;
public int Length;
}
protected string OriginalBuffer = "";
protected string ModifiedBuffer = ""; // Use StringBuilder
// Use List<PieceTableDescriptor>
protected ArrayList Descriptors = new ArrayList();
public int Length
{
get
{
int length = 0;
for(int i = 0; i < Descriptors.Count; i++)
{
length += ((PieceTableDescriptor)Descriptors[i]).Length;
}
return length;
}
}
public void Insert(int offset, string text)
{
int Len = 0;
int CurrentDesc = 0;
while(true)
{
PieceTableDescriptor desc = (PieceTableDescriptor)Descriptors[CurrentDesc];
// Is the offset in this descriptor
if((Len + desc.Length) >= offset)
{
int gap = offset - Len;
int newoffset = ModifiedBuffer.Length;
// Add the text to the end of the buffer
ModifiedBuffer += text;
// Set up descriptor for the new text
PieceTableDescriptor newtext = new PieceTableDescriptor();
newtext.Offset = newoffset;
newtext.Length = text.Length;
newtext.Buffer = true;
// Is the offset in the middle of the descriptor
if(gap != 0 && gap != desc.Length)
{
int end = desc.Offset + desc.Length;
desc.Length = gap;
// Set up descriptor for the end of the current descriptor
PieceTableDescriptor newdesc = new PieceTableDescriptor();
newdesc.Offset = desc.Offset + desc.Length;
newdesc.Length = end - newdesc.Offset;
Descriptors[CurrentDesc] = desc;
Descriptors.Insert(CurrentDesc + 1, newtext);
Descriptors.Insert(CurrentDesc + 2, newdesc);
}
else if(gap == desc.Length) // Is it at the end
{
Descriptors.Insert(CurrentDesc + 1, newtext);
}
else // Is it at the beginning
{
Descriptors.Insert(CurrentDesc, newtext);
}
break;
}
else
{
CurrentDesc++;
Len += desc.Length;
if(CurrentDesc == Descriptors.Count)
break;
}
}
}
public void Remove(int offset, int length)
{
int Len = 0;
int CurrentDesc = 0;
while(true)
{
// Does the descriptor contain the offset
if((Len + ((PieceTableDescriptor)Descriptors[CurrentDesc]).Length) >= offset)
{
// Remove the text from the descriptor
RemoveInternal(CurrentDesc, Len, offset, length);
break;
}
else
{
CurrentDesc++;
Len += ((PieceTableDescriptor)Descriptors[CurrentDesc]).Length;
if(CurrentDesc == Descriptors.Count)
break;
}
}
}
protected void RemoveInternal(int descriptor, int lentodesc, int offset, int length)
{
PieceTableDescriptor desc = (PieceTableDescriptor)Descriptors[descriptor];
int gap = offset - lentodesc;
// Is all the text we want to remove span over multiple descriptors
if((offset + length) > (lentodesc + desc.Length))
{
lentodesc += desc.Length;
length -= lentodesc - offset;
offset = lentodesc;
desc.Length = gap;
// Does the text we want to remove encompass all of this descriptor
if(gap != 0)
{
Descriptors[descriptor] = desc;
RemoveInternal(descriptor + 1, lentodesc, offset, length);
}
else // It does encompass all of this descriptor so remove it
{
Descriptors.RemoveAt(descriptor);
RemoveInternal(descriptor, lentodesc, offset, length);
}
}
else
{
// Set up new descriptor to reflect removed text
PieceTableDescriptor newdesc = new PieceTableDescriptor();
newdesc.Buffer = desc.Buffer;
newdesc.Offset = desc.Offset + gap + length;
newdesc.Length = (desc.Offset + desc.Length) - newdesc.Offset;
desc.Length = gap;
// Does the text we want to remove encompass all of this descriptor
if(gap != 0)
{
Descriptors.Insert(descriptor + 1, newdesc);
Descriptors[descriptor] = desc;
}
else
{
// Instead of removing the old and inserting the new, just set the old to the new inside the array
Descriptors[descriptor] = newdesc;
}
}
}
public void Replace(int offset, int length, string text)
{
Remove(offset, length);
Insert(offset, text);
}
public void SetText(string text)
{
Descriptors.Clear();
ModifiedBuffer = "";
OriginalBuffer = text;
PieceTableDescriptor desc = new PieceTableDescriptor();
desc.Buffer = false;
desc.Offset = 0;
desc.Length = text.Length;
Descriptors.Add(desc);
}
public char GetCharAt(int offset)
{
int off = 0;
int currdesc = 0;
while(true)
{
PieceTableDescriptor desc = (PieceTableDescriptor)Descriptors[currdesc];
// Is the offset in the current descriptor
if((off + desc.Length) > offset)
{
// Find the difference between the beginning of the descriptor and the offset
int gap = offset - off;
if(desc.Buffer == false) // Original Buffer
{
return OriginalBuffer[desc.Offset + gap];
}
else // Modified Buffer
{
return ModifiedBuffer[desc.Offset + gap];
}
}
else
{
off += desc.Length;
}
currdesc++;
if(currdesc == Descriptors.Count) return '\0';
}
}
public string GetText(int offset, int length)
{
string text = "";
int off = 0;
int currdesc = 0;
while(true)
{
// Does the descriptor contain the offset
if((off + ((PieceTableDescriptor)Descriptors[currdesc]).Length) > offset)
{
// Get the text
text += GetTextInternal(currdesc, off, offset, length);
break;
}
else
{
currdesc++;
off += ((PieceTableDescriptor)Descriptors[currdesc]).Length;
if(currdesc == Descriptors.Count)
break;
}
}
return text;
}
protected string GetTextInternal(int descriptor, int lentodesc, int offset, int length)
{
PieceTableDescriptor desc = (PieceTableDescriptor)Descriptors[descriptor];
int gap = offset - lentodesc;
string text = "";
// Is the text we want greater than this descriptor
if((offset + length) > (lentodesc + desc.Length))
{
if(desc.Buffer)
{
text += ModifiedBuffer.Substring(desc.Offset + gap, desc.Length);
}
else
{
text += OriginalBuffer.Substring(desc.Offset + gap, desc.Length);
}
lentodesc += desc.Length;
length -= lentodesc - offset;
offset = lentodesc;
// Get the text from the next descriptor
text += GetTextInternal(descriptor + 1, lentodesc, offset, length);
}
else
{
// The text we want is in this descriptor so get it
if(desc.Buffer)
{
text += ModifiedBuffer.Substring(desc.Offset + gap, length);
}
else
{
text += OriginalBuffer.Substring(desc.Offset + gap, length);
}
}
return text;
}
}
*/
}
| 24.024845 | 104 | 0.606644 |
2312883ea87a3678792e81e76b9718506b623419 | 541 | cs | C# | XCode/Service/DbServer.cs | windNight/X | af16b83cdf0e08a724a04f8a58f1b0cf4132183d | [
"MIT"
] | 1,580 | 2016-06-22T14:27:38.000Z | 2022-03-29T10:43:15.000Z | XCode/Service/DbServer.cs | windNight/X | af16b83cdf0e08a724a04f8a58f1b0cf4132183d | [
"MIT"
] | 70 | 2016-09-29T06:30:08.000Z | 2022-03-12T13:45:01.000Z | XCode/Service/DbServer.cs | windNight/X | af16b83cdf0e08a724a04f8a58f1b0cf4132183d | [
"MIT"
] | 489 | 2016-06-22T14:50:40.000Z | 2022-03-31T06:30:29.000Z | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NewLife.Log;
using NewLife.Remoting;
namespace XCode.Service
{
/// <summary>数据服务器</summary>
public class DbServer : ApiServer
{
/// <summary>实例化数据服务</summary>
public DbServer()
{
Port = 3305;
Register(new DbController(), null);
#if DEBUG
Log = XTrace.Log;
EncoderLog = XTrace.Log;
#endif
}
}
} | 20.037037 | 48 | 0.574861 |
2350c68d91f3793eb0025368f193d3aa2450c865 | 18,142 | cs | C# | Recherche/DC.designer.cs | zeroualihajar/Moteur-de-Recherche | 557983789bd34552118c5e5f41ab57a190556591 | [
"MIT"
] | null | null | null | Recherche/DC.designer.cs | zeroualihajar/Moteur-de-Recherche | 557983789bd34552118c5e5f41ab57a190556591 | [
"MIT"
] | null | null | null | Recherche/DC.designer.cs | zeroualihajar/Moteur-de-Recherche | 557983789bd34552118c5e5f41ab57a190556591 | [
"MIT"
] | null | null | null | #pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// Ce code a été généré par un outil.
// Version du runtime :4.0.30319.42000
//
// Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
// le code est régénéré.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Recherche
{
using System.Data.Linq;
using System.Data.Linq.Mapping;
using System.Data;
using System.Collections.Generic;
using System.Reflection;
using System.Linq;
using System.Linq.Expressions;
using System.ComponentModel;
using System;
[global::System.Data.Linq.Mapping.DatabaseAttribute(Name="BD")]
public partial class DCDataContext : System.Data.Linq.DataContext
{
private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource();
#region Définitions de méthodes d'extensibilité
partial void OnCreated();
partial void InsertHistorique(Historique instance);
partial void UpdateHistorique(Historique instance);
partial void DeleteHistorique(Historique instance);
partial void InsertLien(Lien instance);
partial void UpdateLien(Lien instance);
partial void DeleteLien(Lien instance);
partial void InsertMot(Mot instance);
partial void UpdateMot(Mot instance);
partial void DeleteMot(Mot instance);
partial void InsertSearch(Search instance);
partial void UpdateSearch(Search instance);
partial void DeleteSearch(Search instance);
#endregion
public DCDataContext() :
base(global::System.Configuration.ConfigurationManager.ConnectionStrings["BDConnectionString"].ConnectionString, mappingSource)
{
OnCreated();
}
public DCDataContext(string connection) :
base(connection, mappingSource)
{
OnCreated();
}
public DCDataContext(System.Data.IDbConnection connection) :
base(connection, mappingSource)
{
OnCreated();
}
public DCDataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
base(connection, mappingSource)
{
OnCreated();
}
public DCDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
base(connection, mappingSource)
{
OnCreated();
}
public System.Data.Linq.Table<Historique> Historique
{
get
{
return this.GetTable<Historique>();
}
}
public System.Data.Linq.Table<Lien> Lien
{
get
{
return this.GetTable<Lien>();
}
}
public System.Data.Linq.Table<Mot> Mot
{
get
{
return this.GetTable<Mot>();
}
}
public System.Data.Linq.Table<Search> Search
{
get
{
return this.GetTable<Search>();
}
}
}
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Historique")]
public partial class Historique : INotifyPropertyChanging, INotifyPropertyChanged
{
private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
private int _IdHistorique;
private System.Nullable<int> _IdSearch;
private System.Nullable<System.DateTime> _Date;
private EntityRef<Search> _Search;
#region Définitions de méthodes d'extensibilité
partial void OnLoaded();
partial void OnValidate(System.Data.Linq.ChangeAction action);
partial void OnCreated();
partial void OnIdHistoriqueChanging(int value);
partial void OnIdHistoriqueChanged();
partial void OnIdSearchChanging(System.Nullable<int> value);
partial void OnIdSearchChanged();
partial void OnDateChanging(System.Nullable<System.DateTime> value);
partial void OnDateChanged();
#endregion
public Historique()
{
this._Search = default(EntityRef<Search>);
OnCreated();
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IdHistorique", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
public int IdHistorique
{
get
{
return this._IdHistorique;
}
set
{
if ((this._IdHistorique != value))
{
this.OnIdHistoriqueChanging(value);
this.SendPropertyChanging();
this._IdHistorique = value;
this.SendPropertyChanged("IdHistorique");
this.OnIdHistoriqueChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IdSearch", DbType="Int")]
public System.Nullable<int> IdSearch
{
get
{
return this._IdSearch;
}
set
{
if ((this._IdSearch != value))
{
if (this._Search.HasLoadedOrAssignedValue)
{
throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
}
this.OnIdSearchChanging(value);
this.SendPropertyChanging();
this._IdSearch = value;
this.SendPropertyChanged("IdSearch");
this.OnIdSearchChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Date", DbType="Date")]
public System.Nullable<System.DateTime> Date
{
get
{
return this._Date;
}
set
{
if ((this._Date != value))
{
this.OnDateChanging(value);
this.SendPropertyChanging();
this._Date = value;
this.SendPropertyChanged("Date");
this.OnDateChanged();
}
}
}
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Search_Historique", Storage="_Search", ThisKey="IdSearch", OtherKey="IdSearch", IsForeignKey=true)]
public Search Search
{
get
{
return this._Search.Entity;
}
set
{
Search previousValue = this._Search.Entity;
if (((previousValue != value)
|| (this._Search.HasLoadedOrAssignedValue == false)))
{
this.SendPropertyChanging();
if ((previousValue != null))
{
this._Search.Entity = null;
previousValue.Historique.Remove(this);
}
this._Search.Entity = value;
if ((value != null))
{
value.Historique.Add(this);
this._IdSearch = value.IdSearch;
}
else
{
this._IdSearch = default(Nullable<int>);
}
this.SendPropertyChanged("Search");
}
}
}
public event PropertyChangingEventHandler PropertyChanging;
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void SendPropertyChanging()
{
if ((this.PropertyChanging != null))
{
this.PropertyChanging(this, emptyChangingEventArgs);
}
}
protected virtual void SendPropertyChanged(String propertyName)
{
if ((this.PropertyChanged != null))
{
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Lien")]
public partial class Lien : INotifyPropertyChanging, INotifyPropertyChanged
{
private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
private int _IdLien;
private string _Url;
private string _title;
private EntitySet<Search> _Search;
#region Définitions de méthodes d'extensibilité
partial void OnLoaded();
partial void OnValidate(System.Data.Linq.ChangeAction action);
partial void OnCreated();
partial void OnIdLienChanging(int value);
partial void OnIdLienChanged();
partial void OnUrlChanging(string value);
partial void OnUrlChanged();
partial void OntitleChanging(string value);
partial void OntitleChanged();
#endregion
public Lien()
{
this._Search = new EntitySet<Search>(new Action<Search>(this.attach_Search), new Action<Search>(this.detach_Search));
OnCreated();
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IdLien", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
public int IdLien
{
get
{
return this._IdLien;
}
set
{
if ((this._IdLien != value))
{
this.OnIdLienChanging(value);
this.SendPropertyChanging();
this._IdLien = value;
this.SendPropertyChanged("IdLien");
this.OnIdLienChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Url", DbType="Text", UpdateCheck=UpdateCheck.Never)]
public string Url
{
get
{
return this._Url;
}
set
{
if ((this._Url != value))
{
this.OnUrlChanging(value);
this.SendPropertyChanging();
this._Url = value;
this.SendPropertyChanged("Url");
this.OnUrlChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_title", DbType="NVarChar(100)")]
public string title
{
get
{
return this._title;
}
set
{
if ((this._title != value))
{
this.OntitleChanging(value);
this.SendPropertyChanging();
this._title = value;
this.SendPropertyChanged("title");
this.OntitleChanged();
}
}
}
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Lien_Search", Storage="_Search", ThisKey="IdLien", OtherKey="IdLien")]
public EntitySet<Search> Search
{
get
{
return this._Search;
}
set
{
this._Search.Assign(value);
}
}
public event PropertyChangingEventHandler PropertyChanging;
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void SendPropertyChanging()
{
if ((this.PropertyChanging != null))
{
this.PropertyChanging(this, emptyChangingEventArgs);
}
}
protected virtual void SendPropertyChanged(String propertyName)
{
if ((this.PropertyChanged != null))
{
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
private void attach_Search(Search entity)
{
this.SendPropertyChanging();
entity.Lien = this;
}
private void detach_Search(Search entity)
{
this.SendPropertyChanging();
entity.Lien = null;
}
}
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Mot")]
public partial class Mot : INotifyPropertyChanging, INotifyPropertyChanged
{
private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
private int _IdMot;
private string _Text;
private EntitySet<Search> _Search;
#region Définitions de méthodes d'extensibilité
partial void OnLoaded();
partial void OnValidate(System.Data.Linq.ChangeAction action);
partial void OnCreated();
partial void OnIdMotChanging(int value);
partial void OnIdMotChanged();
partial void OnTextChanging(string value);
partial void OnTextChanged();
#endregion
public Mot()
{
this._Search = new EntitySet<Search>(new Action<Search>(this.attach_Search), new Action<Search>(this.detach_Search));
OnCreated();
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IdMot", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
public int IdMot
{
get
{
return this._IdMot;
}
set
{
if ((this._IdMot != value))
{
this.OnIdMotChanging(value);
this.SendPropertyChanging();
this._IdMot = value;
this.SendPropertyChanged("IdMot");
this.OnIdMotChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Text", DbType="Text", UpdateCheck=UpdateCheck.Never)]
public string Text
{
get
{
return this._Text;
}
set
{
if ((this._Text != value))
{
this.OnTextChanging(value);
this.SendPropertyChanging();
this._Text = value;
this.SendPropertyChanged("Text");
this.OnTextChanged();
}
}
}
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Mot_Search", Storage="_Search", ThisKey="IdMot", OtherKey="IdMot")]
public EntitySet<Search> Search
{
get
{
return this._Search;
}
set
{
this._Search.Assign(value);
}
}
public event PropertyChangingEventHandler PropertyChanging;
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void SendPropertyChanging()
{
if ((this.PropertyChanging != null))
{
this.PropertyChanging(this, emptyChangingEventArgs);
}
}
protected virtual void SendPropertyChanged(String propertyName)
{
if ((this.PropertyChanged != null))
{
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
private void attach_Search(Search entity)
{
this.SendPropertyChanging();
entity.Mot = this;
}
private void detach_Search(Search entity)
{
this.SendPropertyChanging();
entity.Mot = null;
}
}
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Search")]
public partial class Search : INotifyPropertyChanging, INotifyPropertyChanged
{
private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
private int _IdSearch;
private System.Nullable<int> _IdMot;
private System.Nullable<int> _IdLien;
private EntitySet<Historique> _Historique;
private EntityRef<Lien> _Lien;
private EntityRef<Mot> _Mot;
#region Définitions de méthodes d'extensibilité
partial void OnLoaded();
partial void OnValidate(System.Data.Linq.ChangeAction action);
partial void OnCreated();
partial void OnIdSearchChanging(int value);
partial void OnIdSearchChanged();
partial void OnIdMotChanging(System.Nullable<int> value);
partial void OnIdMotChanged();
partial void OnIdLienChanging(System.Nullable<int> value);
partial void OnIdLienChanged();
#endregion
public Search()
{
this._Historique = new EntitySet<Historique>(new Action<Historique>(this.attach_Historique), new Action<Historique>(this.detach_Historique));
this._Lien = default(EntityRef<Lien>);
this._Mot = default(EntityRef<Mot>);
OnCreated();
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IdSearch", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
public int IdSearch
{
get
{
return this._IdSearch;
}
set
{
if ((this._IdSearch != value))
{
this.OnIdSearchChanging(value);
this.SendPropertyChanging();
this._IdSearch = value;
this.SendPropertyChanged("IdSearch");
this.OnIdSearchChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IdMot", DbType="Int")]
public System.Nullable<int> IdMot
{
get
{
return this._IdMot;
}
set
{
if ((this._IdMot != value))
{
if (this._Mot.HasLoadedOrAssignedValue)
{
throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
}
this.OnIdMotChanging(value);
this.SendPropertyChanging();
this._IdMot = value;
this.SendPropertyChanged("IdMot");
this.OnIdMotChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IdLien", DbType="Int")]
public System.Nullable<int> IdLien
{
get
{
return this._IdLien;
}
set
{
if ((this._IdLien != value))
{
if (this._Lien.HasLoadedOrAssignedValue)
{
throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
}
this.OnIdLienChanging(value);
this.SendPropertyChanging();
this._IdLien = value;
this.SendPropertyChanged("IdLien");
this.OnIdLienChanged();
}
}
}
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Search_Historique", Storage="_Historique", ThisKey="IdSearch", OtherKey="IdSearch")]
public EntitySet<Historique> Historique
{
get
{
return this._Historique;
}
set
{
this._Historique.Assign(value);
}
}
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Lien_Search", Storage="_Lien", ThisKey="IdLien", OtherKey="IdLien", IsForeignKey=true)]
public Lien Lien
{
get
{
return this._Lien.Entity;
}
set
{
Lien previousValue = this._Lien.Entity;
if (((previousValue != value)
|| (this._Lien.HasLoadedOrAssignedValue == false)))
{
this.SendPropertyChanging();
if ((previousValue != null))
{
this._Lien.Entity = null;
previousValue.Search.Remove(this);
}
this._Lien.Entity = value;
if ((value != null))
{
value.Search.Add(this);
this._IdLien = value.IdLien;
}
else
{
this._IdLien = default(Nullable<int>);
}
this.SendPropertyChanged("Lien");
}
}
}
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Mot_Search", Storage="_Mot", ThisKey="IdMot", OtherKey="IdMot", IsForeignKey=true)]
public Mot Mot
{
get
{
return this._Mot.Entity;
}
set
{
Mot previousValue = this._Mot.Entity;
if (((previousValue != value)
|| (this._Mot.HasLoadedOrAssignedValue == false)))
{
this.SendPropertyChanging();
if ((previousValue != null))
{
this._Mot.Entity = null;
previousValue.Search.Remove(this);
}
this._Mot.Entity = value;
if ((value != null))
{
value.Search.Add(this);
this._IdMot = value.IdMot;
}
else
{
this._IdMot = default(Nullable<int>);
}
this.SendPropertyChanged("Mot");
}
}
}
public event PropertyChangingEventHandler PropertyChanging;
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void SendPropertyChanging()
{
if ((this.PropertyChanging != null))
{
this.PropertyChanging(this, emptyChangingEventArgs);
}
}
protected virtual void SendPropertyChanged(String propertyName)
{
if ((this.PropertyChanged != null))
{
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
private void attach_Historique(Historique entity)
{
this.SendPropertyChanging();
entity.Search = this;
}
private void detach_Historique(Historique entity)
{
this.SendPropertyChanging();
entity.Search = null;
}
}
}
#pragma warning restore 1591
| 24.716621 | 176 | 0.676276 |
9b8849b93839782ded16df8c11c768d56e3b7fe7 | 3,063 | cs | C# | DBUtil/Database.cs | mcabezas/DBUtil | 5408d16a489afded7c9c1f330541495bc8a4b516 | [
"Apache-2.0"
] | null | null | null | DBUtil/Database.cs | mcabezas/DBUtil | 5408d16a489afded7c9c1f330541495bc8a4b516 | [
"Apache-2.0"
] | null | null | null | DBUtil/Database.cs | mcabezas/DBUtil | 5408d16a489afded7c9c1f330541495bc8a4b516 | [
"Apache-2.0"
] | null | null | null | using System.Data;
using System.Data.SqlClient;
using System.Runtime.CompilerServices;
namespace DBUtil
{
public class Database : IDatabase
{
private readonly SqlConnection _sqlConnection;
private const string LocalDatabase = @"Server=.\SQLUAI;Database=master;Integrated Security = SSPI;";
private Database(string connectionString)
{
_sqlConnection = new SqlConnection(connectionString);
}
private static Database _instance;
[MethodImpl(MethodImplOptions.Synchronized)]
public static Database Instance()
{
if (_instance != null)
{
return _instance;
}
_instance = new Database(LocalDatabase);
return _instance;
}
public SqlTransaction BeginTransaction()
{
ConnectionMustBeOpen();
return _sqlConnection.BeginTransaction();
}
public object ExecuteScalar(string sqlStatement, SqlParameter[] parameters)
{
ConnectionMustBeOpen();
var sqlTransaction = _sqlConnection.BeginTransaction();
var result = ExecuteScalar(sqlStatement, parameters, sqlTransaction);
sqlTransaction.Commit();
return result;
}
public object ExecuteScalar(string sqlStatement, SqlParameter[] parameters, SqlTransaction transaction)
{
ConnectionMustBeOpen();
var command = new SqlCommand(sqlStatement, _sqlConnection, transaction);
command.Parameters.AddRange(parameters);
return command.ExecuteScalar();
}
public void ExecuteNonQuery(string sqlStatement, SqlParameter[] parameters)
{
ConnectionMustBeOpen();
var sqlTransaction = _sqlConnection.BeginTransaction();
ExecuteNonQuery(sqlStatement, parameters, sqlTransaction);
sqlTransaction.Commit();
}
public void ExecuteNonQuery(string sqlStatement, SqlParameter[] parameters, SqlTransaction transaction)
{
ConnectionMustBeOpen();
var command = new SqlCommand(sqlStatement, _sqlConnection, transaction);
command.Parameters.AddRange(parameters);
command.ExecuteNonQuery();
}
public DataTable ExecuteQuery(string sqlStatement, SqlParameter[] parameters)
{
ConnectionMustBeOpen();
var command = new SqlCommand(sqlStatement, _sqlConnection);
command.Parameters.AddRange(parameters);
var dataAdapter = new SqlDataAdapter();
var dataTable = new DataTable();
dataAdapter.SelectCommand = command;
dataAdapter.Fill(dataTable);
return dataTable;
}
private void ConnectionMustBeOpen()
{
if (_sqlConnection.State == ConnectionState.Closed)
{
_sqlConnection.Open();
}
}
}
} | 32.585106 | 111 | 0.606268 |
be03c9da0b00e99d6c927b2ebe7a7bcef90eabf5 | 1,141 | cs | C# | AzureWebsite.Function/MainMenu.cs | Riniga/Azure-Website | 760143f9e6dc5d8e3d4a0782499a67322d8bba1b | [
"MIT"
] | null | null | null | AzureWebsite.Function/MainMenu.cs | Riniga/Azure-Website | 760143f9e6dc5d8e3d4a0782499a67322d8bba1b | [
"MIT"
] | null | null | null | AzureWebsite.Function/MainMenu.cs | Riniga/Azure-Website | 760143f9e6dc5d8e3d4a0782499a67322d8bba1b | [
"MIT"
] | null | null | null | using System.Threading.Tasks;
using AzureWebsite.Library;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
namespace AzureWebApp.Function
{
public static class MainMenu
{
[FunctionName("GetCosmosDbMenu")]
public static async Task<IActionResult> GetCosmosDbMenu([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req, ILogger log)
{
log.LogInformation("Return a menu tree");
Menu root = await CosmosHelper.GetMenuFromCosmosDb();
return new OkObjectResult(root);
}
[FunctionName("CreateCosmosDbMenu")]
public static async Task<IActionResult> CreateCosmosDbMenu([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req, ILogger log)
{
log.LogInformation("Create a new menu to Cosmos DB ");
await CosmosHelper.CreateMenuInCosmosDb();
return new OkObjectResult("{\"Result\":\"Meu Created\"}");
}
}
}
| 35.65625 | 168 | 0.688869 |
1e2cab69f96f67f100bc03bb97f313de8d40c284 | 13,491 | cs | C# | Assets/Editor/VirtualFolder/VirtualFolderWindow.cs | akof1314/UnityVirtualFolder | eacd76d79c71f144d5f3087d0e868e2ae375b3e9 | [
"MIT"
] | 10 | 2018-01-04T03:37:57.000Z | 2021-04-26T04:34:46.000Z | Assets/Editor/VirtualFolder/VirtualFolderWindow.cs | akof1314/UnityVirtualFolder | eacd76d79c71f144d5f3087d0e868e2ae375b3e9 | [
"MIT"
] | null | null | null | Assets/Editor/VirtualFolder/VirtualFolderWindow.cs | akof1314/UnityVirtualFolder | eacd76d79c71f144d5f3087d0e868e2ae375b3e9 | [
"MIT"
] | 1 | 2019-08-15T01:59:12.000Z | 2019-08-15T01:59:12.000Z | using System;
using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEditor.IMGUI.Controls;
using UnityEngine;
namespace VirtualFolder
{
public class VirtualFolderWindow : EditorWindow
{
[MenuItem("Window/Virtual Folder")]
private static void InitShow()
{
GetWindow<VirtualFolderWindow>();
}
public delegate void WindowItemCallback(VirtualFolderInfo info, Rect selectionRect, TreeView treeView);
public static WindowItemCallback windowItemOnGUI;
public delegate void ViewChangedCallback(VirtualFolderInfo info, VirtualFolderTreeView treeView);
public static ViewChangedCallback viewChanged;
public static string configPath = "Assets/Editor/VirtualFolder/VirtualFolderConfig.json";
private static Styles s_Styles;
[SerializeField]
private TreeViewState m_TreeViewState;
[SerializeField]
private int m_CurrentListIndex;
private bool m_CreateVirtualFolder;
private string m_CreateName;
private SearchField m_SearchField;
private VirtualFolderTreeView m_TreeView;
private VirtualFolderList m_VirtualFolderList;
void Awake()
{
titleContent = EditorGUIUtility.IconContent("Project");
titleContent.text = "Virtual Folder";
}
void OnEnable()
{
}
void OnDisable()
{
}
void OnGUI()
{
if (s_Styles == null)
s_Styles = new Styles();
if (!Initialized())
{
Init();
}
DrawToolBar();
DrawCreate();
DoTreeView();
ExecuteCommands();
HandleKeys();
}
private void DrawToolBar()
{
EditorGUI.BeginDisabledGroup(m_CreateVirtualFolder);
EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);
Rect rect = GUILayoutUtility.GetRect(s_Styles.fileDropdownContent, EditorStyles.toolbarDropDown);
if (EditorGUI.DropdownButton(rect, s_Styles.fileDropdownContent, FocusType.Passive, EditorStyles.toolbarDropDown))
{
GUIUtility.hotControl = 0;
var createMenu = new GenericMenu();
createMenu.AddItem(s_Styles.newFolderContent, false, CreateFolder);
createMenu.AddItem(s_Styles.newFolderChildContent, false, CreateFolderChild);
createMenu.AddSeparator(String.Empty);
createMenu.AddItem(s_Styles.newVirtualFolderContent, false, CreateVirtualFolder);
createMenu.AddSeparator(String.Empty);
createMenu.AddItem(s_Styles.saveDropdownContent, false, SaveData);
createMenu.AddItem(s_Styles.reloadDropdownContent, false, () => { CreateData(); SetTreeViewModelIndex(m_CurrentListIndex); });
createMenu.DropDown(new Rect(rect.x, 17f, 0, 0));
}
rect = GUILayoutUtility.GetRect(s_Styles.viewDropdownContent, EditorStyles.toolbarDropDown);
if (EditorGUI.DropdownButton(rect, s_Styles.viewDropdownContent, FocusType.Passive, EditorStyles.toolbarDropDown))
{
GUIUtility.hotControl = 0;
var createMenu = new GenericMenu();
var list = m_VirtualFolderList.rootList;
for (int i = 0; list != null && i < list.Count; i++)
{
createMenu.AddItem(new GUIContent(list[i].name), i == m_CurrentListIndex, ViewVirtualFolder, i);
}
createMenu.DropDown(new Rect(rect.x, 17f, 0, 0));
}
GUILayout.FlexibleSpace();
m_TreeView.searchString = m_SearchField.OnToolbarGUI(m_TreeView.searchString);
EditorGUILayout.EndHorizontal();
EditorGUI.EndDisabledGroup();
}
private void DrawCreate()
{
if (!m_CreateVirtualFolder)
{
return;
}
EditorGUILayout.BeginHorizontal();
if (GUILayout.Button("OK", GUILayout.Width(60)))
{
m_CreateVirtualFolder = !CreateVirtualFolderDo();
}
if (GUILayout.Button("Cancel", GUILayout.Width(60)))
{
m_CreateVirtualFolder = false;
}
m_CreateName = EditorGUILayout.TextField(m_CreateName);
EditorGUILayout.EndHorizontal();
}
void DoTreeView()
{
if (m_CreateVirtualFolder)
{
return;
}
if (m_VirtualFolderList.rootList != null && m_VirtualFolderList.rootList.Count > 0)
{
Rect rect = GUILayoutUtility.GetRect(0, 100000, 0, 100000);
m_TreeView.OnGUI(rect);
}
}
private void SearchFieldOnDownOrUpArrowKeyPressed()
{
m_TreeView.SetFocus();
}
public bool Initialized()
{
return m_TreeView != null;
}
private void Init()
{
if (Initialized())
{
return;
}
CreateData();
m_SearchField = new SearchField();
m_SearchField.downOrUpArrowKeyPressed += SearchFieldOnDownOrUpArrowKeyPressed;
if (m_TreeViewState == null)
{
m_TreeViewState = new TreeViewState();
}
m_TreeView = new VirtualFolderTreeView(m_TreeViewState);
m_TreeView.onGUIRowCallback += OnGUIItemCallback;
SetTreeViewModelIndex(m_CurrentListIndex);
}
private void OnGUIItemCallback(VirtualFolderInfo info, Rect rect, TreeView treeView)
{
if (windowItemOnGUI == null)
{
return;
}
windowItemOnGUI(info, rect, treeView);
}
private void OnLostFocus()
{
if (m_TreeView != null)
{
m_TreeView.EndRename();
}
}
private void ExecuteCommands()
{
Event current = Event.current;
if (current.type != EventType.ExecuteCommand && current.type != EventType.ValidateCommand)
{
return;
}
bool flag = current.type == EventType.ExecuteCommand;
if (current.commandName == "Delete" || current.commandName == "SoftDelete")
{
if (flag)
{
DeleteFolder();
}
current.Use();
GUIUtility.ExitGUI();
}
else if (current.commandName == "Duplicate")
{
if (flag)
{
DuplicateFolder();
}
current.Use();
GUIUtility.ExitGUI();
}
else if (current.commandName == "FrameSelected")
{
if (current.type == EventType.ExecuteCommand)
{
FrameFolder();
}
current.Use();
GUIUtility.ExitGUI();
}
}
private void HandleKeys()
{
Event current = Event.current;
if (current.type != EventType.KeyDown || m_TreeView == null)
{
return;
}
if (m_TreeView.treeViewControlID != GUIUtility.keyboardControl)
{
return;
}
if (current.keyCode == KeyCode.D)
{
if (EditorGUI.actionKey && current.shift)
{
CreateFolder();
current.Use();
}
else if (current.alt && current.shift)
{
CreateFolderChild();
current.Use();
}
}
}
private void CreateData()
{
if (!File.Exists(configPath))
{
m_VirtualFolderList = new VirtualFolderList();
return;
}
string json = File.ReadAllText(configPath);
m_VirtualFolderList = VirtualFolderList.CreateFromString(json);
}
private void SaveData()
{
if (m_VirtualFolderList != null)
{
File.WriteAllText(configPath, m_VirtualFolderList.SaveToString());
AssetDatabase.ImportAsset(configPath, ImportAssetOptions.Default);
}
}
private void SetTreeViewModelIndex(int index)
{
if (m_VirtualFolderList.rootList == null)
{
return;
}
m_CurrentListIndex = -1;
if (index >= 0 && index < m_VirtualFolderList.rootList.Count)
{
m_CurrentListIndex = index;
m_TreeView.SetModel(m_VirtualFolderList.rootList[index]);
if (viewChanged != null)
{
viewChanged(m_VirtualFolderList.rootList[index], m_TreeView);
}
}
}
private void CreateVirtualFolder()
{
m_CreateVirtualFolder = true;
}
private bool CreateVirtualFolderDo()
{
if (string.IsNullOrEmpty(m_CreateName))
{
return false;
}
m_TreeView.searchString = String.Empty;
if (!m_VirtualFolderList.ContainsRoot(m_CreateName))
{
m_VirtualFolderList.AddRoot(m_CreateName);
}
SetTreeViewModelIndex(m_VirtualFolderList.rootCount - 1);
m_CreateName = String.Empty;
return true;
}
private void CreateFolder()
{
var selection = m_TreeViewState.selectedIDs;
if (selection.Count == 0 || m_TreeView.hasSearch || m_TreeView.disableEdit)
{
return;
}
VirtualFolderInfo info = m_VirtualFolderList.rootList[m_CurrentListIndex].Find(selection[0]);
if (info != null)
{
if (info.parent != null)
{
info = info.parent;
}
VirtualFolderInfo childInfo = info.AddChild();
m_TreeView.Reload();
m_TreeView.SetExpanded(info.id, true);
m_TreeView.SetSelection(new List<int>() { childInfo.id }, TreeViewSelectionOptions.RevealAndFrame);
m_TreeView.BeginRename(m_TreeView.GetItemById(childInfo.id));
}
}
private void CreateFolderChild()
{
var selection = m_TreeViewState.selectedIDs;
if (selection.Count == 0 || m_TreeView.hasSearch || m_TreeView.disableEdit)
{
return;
}
VirtualFolderInfo info = m_VirtualFolderList.rootList[m_CurrentListIndex].Find(selection[0]);
if (info != null)
{
VirtualFolderInfo childInfo = info.AddChild();
m_TreeView.Reload();
m_TreeView.SetExpanded(info.id, true);
m_TreeView.SetSelection(new List<int>() { childInfo.id }, TreeViewSelectionOptions.RevealAndFrame);
m_TreeView.BeginRename(m_TreeView.GetItemById(childInfo.id));
}
}
private void DeleteFolder()
{
var selection = m_TreeViewState.selectedIDs;
if (selection.Count == 0 || m_TreeView.hasSearch || m_TreeView.disableEdit)
{
return;
}
VirtualFolderInfo info = m_VirtualFolderList.rootList[m_CurrentListIndex].Find(selection[0]);
if (info != null)
{
if (info.parent != null)
{
info.parent.RemoveChild(info);
m_TreeView.Reload();
}
}
}
private void DuplicateFolder()
{
CreateFolder();
}
private void FrameFolder()
{
var selection = m_TreeViewState.selectedIDs;
if (selection.Count == 0)
{
return;
}
m_TreeView.FrameItemById(selection[0], true);
}
private void ViewVirtualFolder(object obj)
{
SetTreeViewModelIndex((int)obj);
}
private class Styles
{
public readonly GUIContent fileDropdownContent = new GUIContent("File");
public readonly GUIContent viewDropdownContent = new GUIContent("View");
public readonly GUIContent newFolderContent = new GUIContent("New Folder %#d");
public readonly GUIContent newFolderChildContent = new GUIContent("New Folder Child &#d");
public readonly GUIContent newVirtualFolderContent = new GUIContent("New Virtual Folder");
public readonly GUIContent saveDropdownContent = new GUIContent("Save Config");
public readonly GUIContent reloadDropdownContent = new GUIContent("Reload Config");
private static GUIStyle GetStyle(string styleName)
{
return (GUIStyle)styleName;
}
}
}
} | 33.14742 | 142 | 0.533541 |
1e805730f47922a81a5bcdea8bbd156d05f2ec50 | 1,109 | cs | C# | Assets/Plugins/UniOSC/Scripts/Example.Components/Editor/UniOSCChangeColorEditor.cs | MichaelProkofyev/HI-Hat_LaserInstallation | e57e508706f09c59e505e5f73aa6ea5f15d68804 | [
"MIT"
] | null | null | null | Assets/Plugins/UniOSC/Scripts/Example.Components/Editor/UniOSCChangeColorEditor.cs | MichaelProkofyev/HI-Hat_LaserInstallation | e57e508706f09c59e505e5f73aa6ea5f15d68804 | [
"MIT"
] | null | null | null | Assets/Plugins/UniOSC/Scripts/Example.Components/Editor/UniOSCChangeColorEditor.cs | MichaelProkofyev/HI-Hat_LaserInstallation | e57e508706f09c59e505e5f73aa6ea5f15d68804 | [
"MIT"
] | null | null | null | /*
* UniOSC
* Copyright © 2014-2015 Stefan Schlupek
* All rights reserved
* info@monoflow.org
*/
using UnityEngine;
using UnityEditor;
using System.Collections;
namespace UniOSC{
[CustomEditor(typeof(UniOSCChangeColor))]
[CanEditMultipleObjects]
public class UniOSCChangeColorEditor : UniOSCEventTargetEditor {
override public void OnInspectorGUI(){
GUILayout.Space(5);
if(_tex_logo != null){
UniOSCUtils.DrawClickableTextureHorizontal(_tex_logo,()=>{EditorApplication.ExecuteMenuItem(UniOSCUtils.MENUITEM_EDITOR);});
}
//EditorGUIUtility.LookLikeControls(150f,100f);
EditorGUIUtility.labelWidth = 150f;
EditorGUIUtility.fieldWidth = 100f;
EditorGUI.BeginChangeCheck();
DrawDefaultInspector ();
GUILayout.Space(5f);
serializedObject.Update();
DrawConnectionSetup();
//DrawPort();
DrawConnectionInfo();
serializedObject.ApplyModifiedProperties();
if(EditorGUI.EndChangeCheck()){
_target.enabled = !_target.enabled;
_target.enabled = !_target.enabled;
}
}
}
}
| 22.632653 | 129 | 0.694319 |
3d35af39e3388e40c140f4829989bae8367750b1 | 687 | cs | C# | Osp/Backend/Ianitor.Osp.Backend.DistributedCache/CacheCommon.cs | ianitor/ObjectServicePlatform | 5012d32c6287fc7fe0c50bfe10c6edc95e8aa57b | [
"MIT"
] | null | null | null | Osp/Backend/Ianitor.Osp.Backend.DistributedCache/CacheCommon.cs | ianitor/ObjectServicePlatform | 5012d32c6287fc7fe0c50bfe10c6edc95e8aa57b | [
"MIT"
] | null | null | null | Osp/Backend/Ianitor.Osp.Backend.DistributedCache/CacheCommon.cs | ianitor/ObjectServicePlatform | 5012d32c6287fc7fe0c50bfe10c6edc95e8aa57b | [
"MIT"
] | null | null | null | namespace Ianitor.Osp.Backend.DistributedCache
{
/// <summary>
/// Common definitions of cache
/// </summary>
public static class CacheCommon
{
/// <summary>
/// Channel of identity provider updates
/// </summary>
public const string KeyIdentityProviderUpdate = "IdentityProviderUpdate";
/// <summary>
/// Key where the cors policy definitions are stored
/// </summary>
public const string KeyCorsClients = "CorsPolicyProvider_CorsClients";
/// <summary>
/// Channel of tenant updates
/// </summary>
public const string KeyTenantUpdate = "TenantUpdate";
}
} | 29.869565 | 81 | 0.60262 |
3dc396ba3706719b0d50882f00f1d35c3760e242 | 6,133 | cs | C# | sdk/dotnet/Config/Config.cs | fmarmol/pulumi-kubernetes | fdd470e62a8b15570f946cb6e4185dfd8a43ce7d | [
"Apache-2.0"
] | 277 | 2018-06-18T14:57:09.000Z | 2022-03-29T04:05:06.000Z | sdk/dotnet/Config/Config.cs | fmarmol/pulumi-kubernetes | fdd470e62a8b15570f946cb6e4185dfd8a43ce7d | [
"Apache-2.0"
] | 1,447 | 2018-06-20T00:58:34.000Z | 2022-03-31T21:28:43.000Z | sdk/dotnet/Config/Config.cs | fmarmol/pulumi-kubernetes | fdd470e62a8b15570f946cb6e4185dfd8a43ce7d | [
"Apache-2.0"
] | 95 | 2018-06-30T03:30:05.000Z | 2022-03-29T04:05:09.000Z | // *** WARNING: this file was generated by pulumigen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
using System;
using System.Collections.Immutable;
namespace Pulumi.Kubernetes
{
public static class Config
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "IDE1006", Justification =
"Double underscore prefix used to avoid conflicts with variable names.")]
private sealed class __Value<T>
{
private readonly Func<T> _getter;
private T _value = default!;
private bool _set;
public __Value(Func<T> getter)
{
_getter = getter;
}
public T Get() => _set ? _value : _getter();
public void Set(T value)
{
_value = value;
_set = true;
}
}
private static readonly Pulumi.Config __config = new Pulumi.Config("kubernetes");
private static readonly __Value<string?> _cluster = new __Value<string?>(() => __config.Get("cluster"));
/// <summary>
/// If present, the name of the kubeconfig cluster to use.
/// </summary>
public static string? Cluster
{
get => _cluster.Get();
set => _cluster.Set(value);
}
private static readonly __Value<string?> _context = new __Value<string?>(() => __config.Get("context"));
/// <summary>
/// If present, the name of the kubeconfig context to use.
/// </summary>
public static string? Context
{
get => _context.Get();
set => _context.Set(value);
}
private static readonly __Value<bool?> _enableDryRun = new __Value<bool?>(() => __config.GetBoolean("enableDryRun"));
/// <summary>
/// BETA FEATURE - If present and set to true, enable server-side diff calculations.
/// This feature is in developer preview, and is disabled by default.
///
/// This config can be specified in the following ways, using this precedence:
/// 1. This `enableDryRun` parameter.
/// 2. The `PULUMI_K8S_ENABLE_DRY_RUN` environment variable.
/// </summary>
public static bool? EnableDryRun
{
get => _enableDryRun.Get();
set => _enableDryRun.Set(value);
}
private static readonly __Value<string?> _kubeconfig = new __Value<string?>(() => __config.Get("kubeconfig"));
/// <summary>
/// The contents of a kubeconfig file or the path to a kubeconfig file. If this is set, this config will be used instead of $KUBECONFIG.
/// </summary>
public static string? KubeConfig
{
get => _kubeconfig.Get();
set => _kubeconfig.Set(value);
}
private static readonly __Value<string?> _namespace = new __Value<string?>(() => __config.Get("namespace"));
/// <summary>
/// If present, the default namespace to use. This flag is ignored for cluster-scoped resources.
///
/// A namespace can be specified in multiple places, and the precedence is as follows:
/// 1. `.metadata.namespace` set on the resource.
/// 2. This `namespace` parameter.
/// 3. `namespace` set for the active context in the kubeconfig.
/// </summary>
public static string? Namespace
{
get => _namespace.Get();
set => _namespace.Set(value);
}
private static readonly __Value<string?> _renderYamlToDirectory = new __Value<string?>(() => __config.Get("renderYamlToDirectory"));
/// <summary>
/// BETA FEATURE - If present, render resource manifests to this directory. In this mode, resources will not
/// be created on a Kubernetes cluster, but the rendered manifests will be kept in sync with changes
/// to the Pulumi program. This feature is in developer preview, and is disabled by default.
///
/// Note that some computed Outputs such as status fields will not be populated
/// since the resources are not created on a Kubernetes cluster. These Output values will remain undefined,
/// and may result in an error if they are referenced by other resources. Also note that any secret values
/// used in these resources will be rendered in plaintext to the resulting YAML.
/// </summary>
public static string? RenderYamlToDirectory
{
get => _renderYamlToDirectory.Get();
set => _renderYamlToDirectory.Set(value);
}
private static readonly __Value<bool?> _suppressDeprecationWarnings = new __Value<bool?>(() => __config.GetBoolean("suppressDeprecationWarnings"));
/// <summary>
/// If present and set to true, suppress apiVersion deprecation warnings from the CLI.
///
/// This config can be specified in the following ways, using this precedence:
/// 1. This `suppressDeprecationWarnings` parameter.
/// 2. The `PULUMI_K8S_SUPPRESS_DEPRECATION_WARNINGS` environment variable.
/// </summary>
public static bool? SuppressDeprecationWarnings
{
get => _suppressDeprecationWarnings.Get();
set => _suppressDeprecationWarnings.Set(value);
}
private static readonly __Value<bool?> _suppressHelmHookWarnings = new __Value<bool?>(() => __config.GetBoolean("suppressHelmHookWarnings"));
/// <summary>
/// If present and set to true, suppress unsupported Helm hook warnings from the CLI.
///
/// This config can be specified in the following ways, using this precedence:
/// 1. This `suppressHelmHookWarnings` parameter.
/// 2. The `PULUMI_K8S_SUPPRESS_HELM_HOOK_WARNINGS` environment variable.
/// </summary>
public static bool? SuppressHelmHookWarnings
{
get => _suppressHelmHookWarnings.Get();
set => _suppressHelmHookWarnings.Set(value);
}
}
}
| 43.190141 | 155 | 0.610794 |
4fc42ebd72ae23824a23d6c26b807658f76e4dd0 | 3,945 | cs | C# | aspnet-core/src/Tiger.Application.Contracts/Permissions/StockPermissions.cs | AllenHongjun/tiger_admin | e4b8787c0be80656876e89f9a898e11fcb5d781f | [
"Apache-2.0"
] | 1 | 2021-06-17T16:02:38.000Z | 2021-06-17T16:02:38.000Z | aspnet-core/src/Tiger.Application.Contracts/Permissions/StockPermissions.cs | AllenHongjun/tiger_admin | e4b8787c0be80656876e89f9a898e11fcb5d781f | [
"Apache-2.0"
] | 1 | 2021-08-10T13:26:05.000Z | 2021-08-10T13:26:05.000Z | aspnet-core/src/Tiger.Application.Contracts/Permissions/StockPermissions.cs | AllenHongjun/tiger_admin | e4b8787c0be80656876e89f9a898e11fcb5d781f | [
"Apache-2.0"
] | null | null | null | using System;
using System.Collections.Generic;
using System.Text;
using Volo.Abp.Reflection;
namespace Tiger.Permissions
{
public static class StockPermissions
{
public const string GroupName = "Stock";
public class Inventory
{
public const string Default = GroupName + ".Inventory";
public const string Update = Default + ".Update";
public const string Create = Default + ".Create";
public const string Delete = Default + ".Delete";
}
public class InventoryHistory
{
public const string Default = GroupName + ".InventoryHistory";
public const string Update = Default + ".Update";
public const string Create = Default + ".Create";
public const string Delete = Default + ".Delete";
}
public class CheckHeader
{
public const string Default = GroupName + ".CheckHeader";
public const string Update = Default + ".Update";
public const string Create = Default + ".Create";
public const string Delete = Default + ".Delete";
}
public class CheckDetail
{
public const string Default = GroupName + ".CheckDetail";
public const string Update = Default + ".Update";
public const string Create = Default + ".Create";
public const string Delete = Default + ".Delete";
}
public class ReceiptHeader
{
public const string Default = GroupName + ".ReceiptHeader";
public const string Update = Default + ".Update";
public const string Create = Default + ".Create";
public const string Delete = Default + ".Delete";
}
public class ReverseDetail
{
public const string Default = GroupName + ".ReverseDetail";
public const string Update = Default + ".Update";
public const string Create = Default + ".Create";
public const string Delete = Default + ".Delete";
}
public class ShipmentHeader
{
public const string Default = GroupName + ".ShipmentHeader";
public const string Update = Default + ".Update";
public const string Create = Default + ".Create";
public const string Delete = Default + ".Delete";
}
public class ShipmentDetail
{
public const string Default = GroupName + ".ShipmentDetail";
public const string Update = Default + ".Update";
public const string Create = Default + ".Create";
public const string Delete = Default + ".Delete";
}
public class TransferHeader
{
public const string Default = GroupName + ".TransferHeader";
public const string Update = Default + ".Update";
public const string Create = Default + ".Create";
public const string Delete = Default + ".Delete";
}
public class TransferDetail
{
public const string Default = GroupName + ".TransferDetail";
public const string Update = Default + ".Update";
public const string Create = Default + ".Create";
public const string Delete = Default + ".Delete";
}
public class ReverseHeader
{
public const string Default = GroupName + ".ReverseHeader";
public const string Update = Default + ".Update";
public const string Create = Default + ".Create";
public const string Delete = Default + ".Delete";
}
public static string[] GetAll()
{
return ReflectionHelper.GetPublicConstantsRecursively(typeof(StockPermissions));
}
}
}
| 36.527778 | 93 | 0.562484 |
8b51a4557db49e02f7d9acb0b161361e2b4e0152 | 24,195 | cs | C# | sdk/eventhub/Azure.Messaging.EventHubs/tests/Compatibility/TrackOneEventHubClientTests.cs | nithinpnp/azure-sdk-for-net | 44da82373a5bc3b31355baa1eb8fe128cd002b9d | [
"MIT"
] | null | null | null | sdk/eventhub/Azure.Messaging.EventHubs/tests/Compatibility/TrackOneEventHubClientTests.cs | nithinpnp/azure-sdk-for-net | 44da82373a5bc3b31355baa1eb8fe128cd002b9d | [
"MIT"
] | null | null | null | sdk/eventhub/Azure.Messaging.EventHubs/tests/Compatibility/TrackOneEventHubClientTests.cs | nithinpnp/azure-sdk-for-net | 44da82373a5bc3b31355baa1eb8fe128cd002b9d | [
"MIT"
] | null | null | null | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Messaging.EventHubs.Authorization;
using Azure.Messaging.EventHubs.Compatibility;
using Azure.Messaging.EventHubs.Core;
using Moq;
using NUnit.Framework;
using TrackOne;
using TrackOne.Amqp;
namespace Azure.Messaging.EventHubs.Tests
{
/// <summary>
/// The suite of tests for the <see cref="TrackOneEventHubClient" />
/// class.
/// </summary>
///
[TestFixture]
[Parallelizable(ParallelScope.Children)]
public class TrackOneEventHubClientTests
{
/// <summary>
/// Verifies functionality of the constructor.
/// </summary>
///
[Test]
[TestCase(null)]
[TestCase("")]
public void ConstructorRequiresTheHost(string host)
{
Assert.That(() => new TrackOneEventHubClient(host, "test-path", Mock.Of<TokenCredential>(), new EventHubClientOptions()), Throws.InstanceOf<ArgumentException>());
}
/// <summary>
/// Verifies functionality of the constructor.
/// </summary>
///
[Test]
[TestCase(null)]
[TestCase("")]
public void ConstructorRequiresTheEventHubPath(string path)
{
Assert.That(() => new TrackOneEventHubClient("my.eventhub.com", path, Mock.Of<TokenCredential>(), new EventHubClientOptions()), Throws.InstanceOf<ArgumentException>());
}
/// <summary>
/// Verifies functionality of the constructor.
/// </summary>
///
[Test]
public void ConstructorRequiresTheCredential()
{
Assert.That(() => new TrackOneEventHubClient("my.eventhub.com", "somePath", null, new EventHubClientOptions()), Throws.InstanceOf<ArgumentException>());
}
/// <summary>
/// Verifies functionality of the constructor.
/// </summary>
///
[Test]
public void ConstructorRequiresTheOption()
{
Assert.That(() => new TrackOneEventHubClient("my.eventhub.com", "somePath", Mock.Of<TokenCredential>(), null), Throws.InstanceOf<ArgumentException>());
}
/// <summary>
/// Verifies functionality of the <see cref="TrackOneEventHubClient.CreateClient" />
/// method.
/// </summary>
///
[Test]
public void CreateFailsOnUnknownConnectionType()
{
var options = new EventHubClientOptions
{
TransportType = (TransportType)Int32.MinValue
};
var host = "my.eventhub.com";
var eventHubPath = "some-path";
var resource = $"amqps://{ host }/{ eventHubPath }";
var signature = new SharedAccessSignature(resource, "keyName", "KEY", TimeSpan.FromHours(1));
var credential = new SharedAccessSignatureCredential(signature);
Assert.That(() => TrackOneEventHubClient.CreateClient(host, eventHubPath, credential, options), Throws.InstanceOf<ArgumentException>());
}
/// <summary>
/// Verifies functionality of the <see cref="TrackOneEventHubClient.CreateClient" />
/// method.
/// </summary>
///
[Test]
public void CreateFailsForUnknownCredentialType()
{
var options = new EventHubClientOptions();
var host = "my.eventhub.com";
var eventHubPath = "some-path";
var credential = Mock.Of<TokenCredential>();
Assert.That(() => TrackOneEventHubClient.CreateClient(host, eventHubPath, credential, options), Throws.InstanceOf<ArgumentException>());
}
/// <summary>
/// Verifies functionality of the <see cref="TrackOneEventHubClient.CreateClient" />
/// method.
/// </summary>
///
[Test]
public async Task CreateClientCreatesTheProperClientType()
{
var options = new EventHubClientOptions();
var host = "my.eventhub.com";
var eventHubPath = "some-path";
var resource = $"amqps://{ host }/{ eventHubPath }";
var signature = new SharedAccessSignature(resource, "keyName", "KEY", TimeSpan.FromHours(1));
var credential = new SharedAccessSignatureCredential(signature);
var client = TrackOneEventHubClient.CreateClient(host, eventHubPath, credential, options);
try
{
Assert.That(client, Is.Not.Null, "The client should have been returned.");
Assert.That(client, Is.InstanceOf<AmqpEventHubClient>(), "The client should be specific to the AMQP protocol.");
}
finally
{
await client?.CloseAsync();
}
}
/// <summary>
/// Verifies functionality of the <see cref="TrackOneEventHubClient.CreateClient" />
/// method.
/// </summary>
///
[Test]
[TestCase(TransportType.AmqpTcp)]
[TestCase(TransportType.AmqpWebSockets)]
public async Task CreateClientTranslatesTheTransportType(TransportType connectionType)
{
var options = new EventHubClientOptions
{
TransportType = connectionType
};
var host = "my.eventhub.com";
var eventHubPath = "some-path";
var resource = $"amqps://{ host }/{ eventHubPath }";
var signature = new SharedAccessSignature(resource, "keyName", "KEY", TimeSpan.FromHours(1));
var credential = new SharedAccessSignatureCredential(signature);
var client = (AmqpEventHubClient)TrackOneEventHubClient.CreateClient(host, eventHubPath, credential, options);
try
{
if (connectionType.ToString().ToLower().Contains("websockets"))
{
Assert.That(client.ConnectionStringBuilder.TransportType.ToString().ToLower(), Contains.Substring("websockets"), "The transport type should be based on WebSockets.");
}
else
{
Assert.That(client.ConnectionStringBuilder.TransportType.ToString().ToLower(), Does.Not.Contain("websockets"), "The transport type should be based on TCP.");
}
}
finally
{
await client?.CloseAsync();
}
}
/// <summary>
/// Verifies functionality of the <see cref="TrackOneEventHubClient.CreateClient" />
/// method.
/// </summary>
///
[Test]
public async Task CreateClientTranslatesTheSharedKeyCredential()
{
var options = new EventHubClientOptions();
var host = "my.eventhub.com";
var eventHubPath = "some-path";
var resource = $"amqps://{ host }/{ eventHubPath }";
var signature = new SharedAccessSignature(resource, "keyName", "KEY", TimeSpan.FromHours(1));
var credential = new SharedAccessSignatureCredential(signature);
var client = (AmqpEventHubClient)TrackOneEventHubClient.CreateClient(host, eventHubPath, credential, options);
try
{
Assert.That(client.InternalTokenProvider, Is.InstanceOf<TrackOneSharedAccessTokenProvider>(), "The token provider should be the track one SAS adapter.");
Assert.That(((TrackOneSharedAccessTokenProvider)client.InternalTokenProvider).SharedAccessSignature.Value, Is.EqualTo(signature.Value), "The SAS should match.");
}
finally
{
await client?.CloseAsync();
}
}
/// <summary>
/// Verifies functionality of the <see cref="TrackOneEventHubClient.CreateClient" />
/// method.
/// </summary>
///
[Test]
public async Task CreateClientTranslatesTheEventHubCredential()
{
var options = new EventHubClientOptions();
var host = "my.eventhub.com";
var eventHubPath = "some-path";
var resource = $"amqps://{ host }/{ eventHubPath }";
var signature = new SharedAccessSignature(resource, "keyName", "KEY", TimeSpan.FromHours(1));
var credential = new EventHubTokenCredential(Mock.Of<TokenCredential>(), resource);
var client = (AmqpEventHubClient)TrackOneEventHubClient.CreateClient(host, eventHubPath, credential, options);
try
{
Assert.That(client.InternalTokenProvider, Is.InstanceOf<TrackOneGenericTokenProvider>(), "The token provider should be the track one generic adapter.");
Assert.That(((TrackOneGenericTokenProvider)client.InternalTokenProvider).Credential, Is.EqualTo(credential), "The source credential should match.");
}
finally
{
await client?.CloseAsync();
}
}
/// <summary>
/// Verifies functionality of the <see cref="TrackOneEventHubClient.CreateClient" />
/// method.
/// </summary>
///
[Test]
public async Task CreateClientFormsTheCorrectEndpoint()
{
var options = new EventHubClientOptions();
var host = "my.eventhub.com";
var eventHubPath = "some-path";
var resource = $"amqps://{ host }/{ eventHubPath }";
var signature = new SharedAccessSignature(resource, "keyName", "KEY", TimeSpan.FromHours(1));
var credential = new SharedAccessSignatureCredential(signature);
var client = (AmqpEventHubClient)TrackOneEventHubClient.CreateClient(host, eventHubPath, credential, options);
try
{
var endpoint = client.ConnectionStringBuilder.Endpoint;
Assert.That(endpoint.Scheme.ToLowerInvariant(), Contains.Substring(options.TransportType.GetUriScheme().ToLowerInvariant()), "The scheme should be part of the endpoint.");
Assert.That(endpoint.Host.ToLowerInvariant(), Contains.Substring(host.ToLowerInvariant()), "The host should be part of the endpoint.");
Assert.That(endpoint.AbsolutePath.ToLowerInvariant(), Contains.Substring(eventHubPath.ToLowerInvariant()), "The host should be part of the endpoint.");
}
finally
{
await client?.CloseAsync();
}
}
/// <summary>
/// Verifies functionality of the <see cref="TrackOneEventHubClient.CreateClient" />
/// method.
/// </summary>
///
[Test]
public async Task CreateClientPopulatesTheEventHubPath()
{
var options = new EventHubClientOptions();
var host = "my.eventhub.com";
var eventHubPath = "some-path";
var resource = $"amqps://{ host }/{ eventHubPath }";
var signature = new SharedAccessSignature(resource, "keyName", "KEY", TimeSpan.FromHours(1));
var credential = new SharedAccessSignatureCredential(signature);
var client = (AmqpEventHubClient)TrackOneEventHubClient.CreateClient(host, eventHubPath, credential, options);
try
{
Assert.That(client.EventHubName, Is.EqualTo(eventHubPath), "The client should recognize the Event Hub path.");
}
finally
{
await client?.CloseAsync();
}
}
/// <summary>
/// Verifies functionality of the <see cref="TrackOneEventHubClient.CreateClient" />
/// method.
/// </summary>
///
[Test]
public async Task CreateClientPopulatesTheProxy()
{
var options = new EventHubClientOptions
{
TransportType = TransportType.AmqpWebSockets,
Proxy = Mock.Of<IWebProxy>()
};
var host = "my.eventhub.com";
var eventHubPath = "some-path";
var resource = $"amqps://{ host }/{ eventHubPath }";
var signature = new SharedAccessSignature(resource, "keyName", "KEY", TimeSpan.FromHours(1));
var credential = new SharedAccessSignatureCredential(signature);
var client = (AmqpEventHubClient)TrackOneEventHubClient.CreateClient(host, eventHubPath, credential, options);
try
{
Assert.That(client.WebProxy, Is.SameAs(options.Proxy), "The client should honor the proxy.");
}
finally
{
await client?.CloseAsync();
}
}
/// <summary>
/// Verifies functionality of the <see cref="TrackOneEventHubClient.CloseAsync" />
/// method.
/// </summary>
///
[Test]
public async Task CloseAsyncDoesNotDelegateIfTheClientWasNotCreated()
{
var options = new EventHubClientOptions();
var host = "http://my.eventhub.com";
var eventHubPath = "some-path";
var resource = $"amqps://{ host }/{ eventHubPath }";
var signature = new SharedAccessSignature(resource, "keyName", "KEY", TimeSpan.FromHours(1));
var credential = new SharedAccessSignatureCredential(signature);
var mock = new ObservableClientMock(host, eventHubPath, credential, options);
var client = new TrackOneEventHubClient(host, eventHubPath, credential, options, (host, path, credential, options) => mock);
await client.CloseAsync(default);
Assert.That(mock.WasCloseAsyncInvoked, Is.False);
}
/// <summary>
/// Verifies functionality of the <see cref="TrackOneEventHubClient.CloseAsync" />
/// method.
/// </summary>
///
[Test]
public async Task CloseAsyncDelegatesToTheClient()
{
var options = new EventHubClientOptions();
var host = "http://my.eventhub.com";
var eventHubPath = "some-path";
var resource = $"amqps://{ host }/{ eventHubPath }";
var signature = new SharedAccessSignature(resource, "keyName", "KEY", TimeSpan.FromHours(1));
var credential = new SharedAccessSignatureCredential(signature);
var mock = new ObservableClientMock(host, eventHubPath, credential, options);
var client = new TrackOneEventHubClient(host, eventHubPath, credential, options, (host, path, credential, options) => mock);
// Invoke an operation to force the client to be lazily instantiated. Otherwise,
// Close does not delegate the call.
await client.GetPropertiesAsync(default);
await client.CloseAsync(default);
Assert.That(mock.WasCloseAsyncInvoked, Is.True);
}
/// <summary>
/// Verifies functionality of the <see cref="TrackOneEventHubClient.GetPropertiesAsync" />
/// method.
/// </summary>
///
[Test]
public async Task GetPropertiesAsyncDelegatesToTheClient()
{
var options = new EventHubClientOptions();
var host = "http://my.eventhub.com";
var eventHubPath = "some-path";
var resource = $"amqps://{ host }/{ eventHubPath }";
var signature = new SharedAccessSignature(resource, "keyName", "KEY", TimeSpan.FromHours(1));
var credential = new SharedAccessSignatureCredential(signature);
var mock = new ObservableClientMock(host, eventHubPath, credential, options);
var client = new TrackOneEventHubClient(host, eventHubPath, credential, options, (host, path, credential, options) => mock);
try
{
await client.GetPropertiesAsync(default);
Assert.That(mock.WasGetRuntimeInvoked, Is.True);
}
finally
{
await client?.CloseAsync(default);
}
}
/// <summary>
/// Verifies functionality of the <see cref="TrackOneEventHubClient.GetPartitionPropertiesAsync" />
/// method.
/// </summary>
///
[Test]
public async Task GetPartitionPropertiesAsyncDelegatesToTheClient()
{
var options = new EventHubClientOptions();
var host = "http://my.eventhub.com";
var eventHubPath = "some-path";
var resource = $"amqps://{ host }/{ eventHubPath }";
var signature = new SharedAccessSignature(resource, "keyName", "KEY", TimeSpan.FromHours(1));
var credential = new SharedAccessSignatureCredential(signature);
var mock = new ObservableClientMock(host, eventHubPath, credential, options);
var client = new TrackOneEventHubClient(host, eventHubPath, credential, options, (host, path, credential, options) => mock);
try
{
var partitionId = "0123";
await client.GetPartitionPropertiesAsync(partitionId, CancellationToken.None);
Assert.That(mock.GetPartitionRuntimePartitionInvokedWith, Is.EqualTo(partitionId));
}
finally
{
await client?.CloseAsync(default);
}
}
/// <summary>
/// Verifies functionality of the <see cref="TrackOneEventHubClient.CreateProducer" />
/// method.
/// </summary>
///
[Test]
public async Task CreateProducerDelegatesToTheClient()
{
var options = new EventHubClientOptions();
var host = "http://my.eventhub.com";
var eventHubPath = "some-path";
var resource = $"amqps://{ host }/{ eventHubPath }";
var signature = new SharedAccessSignature(resource, "keyName", "KEY", TimeSpan.FromHours(1));
var credential = new SharedAccessSignatureCredential(signature);
var mock = new ObservableClientMock(host, eventHubPath, credential, options);
var client = new TrackOneEventHubClient(host, eventHubPath, credential, options, (host, path, credential, options) => mock);
try
{
var producerOptions = new EventHubProducerOptions { PartitionId = "45345" };
// Because the producer is lazily instantiated, an operation needs to be requested to force creation. Because we are returning a null
// producer from within the mock client, that operation will fail with a null reference exception.
Assert.That(async () => await client.CreateProducer(producerOptions)?.SendAsync(new[] { new EventData(new byte[] { 0x12 }) }), Throws.InstanceOf<NullReferenceException>(), "because the EventDataSender was not populated.");
Assert.That(mock.CreateProducerInvokedWith, Is.EqualTo(producerOptions.PartitionId));
}
finally
{
await client?.CloseAsync(default);
}
}
/// <summary>
/// Verifies functionality of the <see cref="TrackOneEventHubClient.CreateConsumer" />
/// method.
/// </summary>
///
[Test]
public async Task CreateConsumerDelegatesToTheClient()
{
var options = new EventHubClientOptions();
var host = "http://my.eventhub.com";
var eventHubPath = "some-path";
var resource = $"amqps://{ host }/{ eventHubPath }";
var signature = new SharedAccessSignature(resource, "keyName", "KEY", TimeSpan.FromHours(1));
var credential = new SharedAccessSignatureCredential(signature);
var mock = new ObservableClientMock(host, eventHubPath, credential, options);
var client = new TrackOneEventHubClient(host, eventHubPath, credential, options, (host, path, credential, options) => mock);
try
{
var partitionId = "32234";
var eventPosition = EventPosition.FromOffset(34);
var consumerOptions = new EventHubConsumerOptions { ConsumerGroup = "Test" };
// Because the consumer is lazily instantiated, an operation needs to be requested to force creation. Because we are returning a null
// consumer from within the mock client, that operation will fail with a null reference exception.
Assert.That(async () => await client.CreateConsumer(partitionId, eventPosition, consumerOptions).ReceiveAsync(10), Throws.InstanceOf<NullReferenceException>(), "because the PartitionReceiver was not populated.");
(var calledConsumerGroup, var calledPartition, var calledPosition, var calledPriority, var calledOptions) = mock.CreateReiverInvokedWith;
Assert.That(calledConsumerGroup, Is.EqualTo(consumerOptions.ConsumerGroup), "The consumer group should match.");
Assert.That(calledPartition, Is.EqualTo(partitionId), "The partition should match.");
Assert.That(calledPosition.Offset, Is.EqualTo(eventPosition.Offset), "The event position offset should match.");
Assert.That(calledOptions.Identifier, Is.EqualTo(consumerOptions.Identifier), "The options should match.");
}
finally
{
await client?.CloseAsync(default);
}
}
/// <summary>
/// Allows for observation of operations performed by the client for testing purposes.
/// </summary>
///
private class ObservableClientMock : TrackOne.EventHubClient
{
public bool WasCloseAsyncInvoked;
public bool WasGetRuntimeInvoked;
public string GetPartitionRuntimePartitionInvokedWith;
public string CreateProducerInvokedWith;
public (string ConsumerGroup, string Partition, TrackOne.EventPosition startingPosition, long? priority, TrackOne.ReceiverOptions Options) CreateReiverInvokedWith;
public ObservableClientMock(string host,
string path,
TokenCredential credential,
EventHubClientOptions options) : base(new TrackOne.EventHubsConnectionStringBuilder(new Uri(host), path, "keyName", "KEY!"))
{
}
protected override Task OnCloseAsync()
{
WasCloseAsyncInvoked = true;
return Task.CompletedTask;
}
protected override PartitionReceiver OnCreateReceiver(string consumerGroupName, string partitionId, TrackOne.EventPosition eventPosition, long? epoch, TrackOne.ReceiverOptions consumerOptions)
{
CreateReiverInvokedWith =
(
consumerGroupName,
partitionId,
eventPosition,
epoch,
consumerOptions
);
return default(PartitionReceiver);
}
protected override Task<EventHubPartitionRuntimeInformation> OnGetPartitionRuntimeInformationAsync(string partitionId)
{
GetPartitionRuntimePartitionInvokedWith = partitionId;
return Task.FromResult(new EventHubPartitionRuntimeInformation());
}
protected override Task<EventHubRuntimeInformation> OnGetRuntimeInformationAsync()
{
WasGetRuntimeInvoked = true;
return Task.FromResult(new EventHubRuntimeInformation());
}
internal override EventDataSender OnCreateEventSender(string partitionId)
{
CreateProducerInvokedWith = partitionId;
return default(EventDataSender);
}
}
}
}
| 43.438061 | 238 | 0.595495 |
41185a94b59829e86e381cf702a72b81dced40ea | 2,542 | cs | C# | src/Sigil/Emit.CopyBlock.cs | moljac/Sigil | 186afec7168271a9a58f02143e21a6038944bc1b | [
"MS-PL"
] | 810 | 2015-01-02T16:16:11.000Z | 2022-03-25T07:54:11.000Z | src/Sigil/Emit.CopyBlock.cs | moljac/Sigil | 186afec7168271a9a58f02143e21a6038944bc1b | [
"MS-PL"
] | 26 | 2015-02-15T22:45:42.000Z | 2019-11-24T13:49:48.000Z | src/Sigil/Emit.CopyBlock.cs | moljac/Sigil | 186afec7168271a9a58f02143e21a6038944bc1b | [
"MS-PL"
] | 85 | 2015-01-09T21:21:46.000Z | 2021-08-16T07:59:24.000Z | using Sigil.Impl;
using System;
using System.Reflection.Emit;
namespace Sigil
{
public partial class Emit<DelegateType>
{
/// <summary>
/// <para>Expects a destination pointer, a source pointer, and a length on the stack. Pops all three values.</para>
/// <para>Copies length bytes from destination to the source.</para>
/// </summary>
public Emit<DelegateType> CopyBlock(bool isVolatile = false, int? unaligned = null)
{
if (unaligned.HasValue && (unaligned != 1 && unaligned != 2 && unaligned != 4))
{
throw new ArgumentException("unaligned must be null, 1, 2, or 4", "unaligned");
}
if (!AllowsUnverifiableCIL)
{
FailUnverifiable("CopyBlock");
}
if (isVolatile)
{
UpdateState(OpCodes.Volatile, Wrap(StackTransition.None(),"CopyBlock"));
}
if (unaligned.HasValue)
{
UpdateState(OpCodes.Unaligned, (byte)unaligned.Value, Wrap(StackTransition.None(), "CopyBlock"));
}
var transition =
new[]
{
new StackTransition(new[] { typeof(int), typeof(NativeIntType), typeof(NativeIntType) }, TypeHelpers.EmptyTypes),
new StackTransition(new[] { typeof(int), typeof(byte*), typeof(NativeIntType) }, TypeHelpers.EmptyTypes),
new StackTransition(new[] { typeof(int), typeof(byte).MakeByRefType(), typeof(NativeIntType) }, TypeHelpers.EmptyTypes),
new StackTransition(new[] { typeof(int), typeof(NativeIntType), typeof(byte*) }, TypeHelpers.EmptyTypes),
new StackTransition(new[] { typeof(int), typeof(byte*), typeof(byte*) }, TypeHelpers.EmptyTypes),
new StackTransition(new[] { typeof(int), typeof(byte).MakeByRefType(), typeof(byte*) }, TypeHelpers.EmptyTypes),
new StackTransition(new[] { typeof(int), typeof(NativeIntType), typeof(byte).MakeByRefType() }, TypeHelpers.EmptyTypes),
new StackTransition(new[] { typeof(int), typeof(byte*), typeof(byte).MakeByRefType() }, TypeHelpers.EmptyTypes),
new StackTransition(new[] { typeof(int), typeof(byte).MakeByRefType(), typeof(byte).MakeByRefType() }, TypeHelpers.EmptyTypes)
};
UpdateState(OpCodes.Cpblk, Wrap(transition, "CopyBlock"));
return this;
}
}
}
| 46.218182 | 146 | 0.581825 |
fcbffd313fe74b5dbb1941558303713baf1066bc | 828 | cs | C# | CirnoLib/Properties/AssemblyInfo.cs | BlacklightsC/CirnoLib | 49179840cc9639375f9127d654748e91b86885e8 | [
"MIT"
] | 1 | 2020-08-17T05:44:05.000Z | 2020-08-17T05:44:05.000Z | CirnoLib/Properties/AssemblyInfo.cs | BlacklightsC/CirnoLib | 49179840cc9639375f9127d654748e91b86885e8 | [
"MIT"
] | 1 | 2022-02-24T12:59:21.000Z | 2022-02-24T12:59:21.000Z | CirnoLib/Properties/AssemblyInfo.cs | BlacklightsC/CirnoLib | 49179840cc9639375f9127d654748e91b86885e8 | [
"MIT"
] | 2 | 2020-08-17T05:44:08.000Z | 2022-03-17T05:28:02.000Z | using System.Reflection;
using System.Runtime.InteropServices;
// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해
// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면
// 이러한 특성 값을 변경하세요.
[assembly: AssemblyTitle("CirnoLib - 범용 라이브러리 모듈")]
[assembly: AssemblyProduct("Cirno 라이브러리 모듈")]
[assembly: AssemblyCopyright("Copyright © 2018 - 2020 BlacklightsC")]
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요.
[assembly: ComVisible(false)]
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
[assembly: Guid("ec749998-e306-4db9-a6cb-9692dc918b6b")]
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
//
// 주 버전
// 부 버전
// 빌드 번호
// 수정 버전
//
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를
// 기본값으로 할 수 있습니다.
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.*")] | 28.551724 | 69 | 0.681159 |
48c04216e300b9c8e32f790bbc087e21532727ea | 1,537 | cs | C# | Modules/Devon4Net.Infrastructure.AnsibleTower/Dto/Organizations/OrganizationsResponseDto.cs | dario-rodriguez/devon4net-1 | 536a6a29fe2819d983f438d5d5ba389316ffbacd | [
"Apache-2.0"
] | null | null | null | Modules/Devon4Net.Infrastructure.AnsibleTower/Dto/Organizations/OrganizationsResponseDto.cs | dario-rodriguez/devon4net-1 | 536a6a29fe2819d983f438d5d5ba389316ffbacd | [
"Apache-2.0"
] | null | null | null | Modules/Devon4Net.Infrastructure.AnsibleTower/Dto/Organizations/OrganizationsResponseDto.cs | dario-rodriguez/devon4net-1 | 536a6a29fe2819d983f438d5d5ba389316ffbacd | [
"Apache-2.0"
] | null | null | null | using System;
using System.Collections.Generic;
using Devon4Net.Infrastructure.AnsibleTower.Dto.Common;
namespace Devon4Net.Infrastructure.AnsibleTower.Dto.Organizations
{
public class ResultOrganizationDto
{
public string description { get; set; }
public int max_hosts { get; set; }
public string url { get; set; }
public OrganizationSummaryFields summary_fields { get; set; }
public DateTime created { get; set; }
public DateTime modified { get; set; }
public Dictionary<string,string> related { get; set; }
public object custom_virtualenv { get; set; }
public string type { get; set; }
public int id { get; set; }
public string name { get; set; }
}
public class OrganizationSummaryFields
{
public User_Capabilities user_capabilities { get; set; }
public Related_Field_Counts related_field_counts { get; set; }
public Dictionary<string, ObjectRole> object_roles { get; set; }
}
public class Related_Field_Counts
{
public int job_templates { get; set; }
public int users { get; set; }
public int teams { get; set; }
public int admins { get; set; }
public int inventories { get; set; }
public int projects { get; set; }
}
public class ObjectRole
{
public bool? user_only { get; set; }
public string description { get; set; }
public string name { get; set; }
public int id { get; set; }
}
}
| 31.367347 | 72 | 0.627846 |
ae604ec5e43779481d2b613876c0727018286a26 | 464 | cs | C# | SDC_Web/Models/CodeCategory.cs | jjang3530/SDC | 91dfd77991108b7a23c2534191b20a1cacc1796c | [
"MIT"
] | null | null | null | SDC_Web/Models/CodeCategory.cs | jjang3530/SDC | 91dfd77991108b7a23c2534191b20a1cacc1796c | [
"MIT"
] | null | null | null | SDC_Web/Models/CodeCategory.cs | jjang3530/SDC | 91dfd77991108b7a23c2534191b20a1cacc1796c | [
"MIT"
] | null | null | null | using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace SDC_Web.Models
{
public partial class CodeCategory
{
public CodeCategory()
{
CodeList = new HashSet<CodeList>();
}
[Required]
public int CategoryId { get; set; }
[Required]
public string CategoryName { get; set; }
public ICollection<CodeList> CodeList { get; set; }
}
}
| 22.095238 | 59 | 0.616379 |
d5ea46b273b9699856c4fe18c8ede0ea3b962bce | 1,583 | cs | C# | Drums/VDrumExplorer.Data/SchemaRegistry.cs | fredatgithub/DemoCode | d8ae3b071d99a08bc4f23e9098fdb008e3df0d0b | [
"Apache-2.0"
] | null | null | null | Drums/VDrumExplorer.Data/SchemaRegistry.cs | fredatgithub/DemoCode | d8ae3b071d99a08bc4f23e9098fdb008e3df0d0b | [
"Apache-2.0"
] | 1 | 2021-04-21T19:56:58.000Z | 2021-04-21T19:56:58.000Z | Drums/VDrumExplorer.Data/SchemaRegistry.cs | fredatgithub/DemoCode | d8ae3b071d99a08bc4f23e9098fdb008e3df0d0b | [
"Apache-2.0"
] | null | null | null | // Copyright 2019 Jon Skeet. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.
using System;
using System.Collections.Generic;
using System.IO;
using ModuleIdentifier = VDrumExplorer.Midi.ModuleIdentifier;
using VDrumExplorer.Data.Proto;
namespace VDrumExplorer.Data
{
// TODO: Not really sure what to do with this, static/instance methods, non-public etc.
public static class SchemaRegistry
{
public static IReadOnlyDictionary<ModuleIdentifier, Lazy<ModuleSchema>> KnownSchemas { get; }
= new Dictionary<ModuleIdentifier, Lazy<ModuleSchema>>
{
{ ModuleIdentifier.TD17, CreateLazySchema("VDrumExplorer.Data.TD17", "TD17.json") },
{ ModuleIdentifier.TD27, CreateLazySchema("VDrumExplorer.Data.TD27", "TD27.json") },
{ ModuleIdentifier.TD50, CreateLazySchema("VDrumExplorer.Data.TD50", "TD50.json") }
}.AsReadOnly();
private static Lazy<ModuleSchema> CreateLazySchema(string resourceBase, string resourceName) =>
new Lazy<ModuleSchema>(() => ModuleSchema.FromAssemblyResources(typeof(SchemaRegistry).Assembly, resourceBase, resourceName));
// It's unpleasant having this here, but I'm not sure of the alternative...
/// <summary>
/// Reads the given stream as drum data, returning a Kit or a Module depending
/// on the data within the stream.
/// </summary>
public static object ReadStream(Stream stream) => ProtoIo.ReadStream(stream);
}
}
| 43.972222 | 138 | 0.694251 |
a42ee946b27ad4b32f162c03510168fdaf5b9ef9 | 314 | cs | C# | src/EChartsBlazor/Configuration/Event/IEvent.cs | draculakkk/EChartsBlazor | f886c878a6b1a1d4b47d54d8e86001c7ef2a072e | [
"Apache-2.0"
] | 4 | 2021-07-16T09:34:03.000Z | 2022-01-18T15:48:32.000Z | src/EChartsBlazor/Configuration/Event/IEvent.cs | draculakkk/EChartsBlazor | f886c878a6b1a1d4b47d54d8e86001c7ef2a072e | [
"Apache-2.0"
] | null | null | null | src/EChartsBlazor/Configuration/Event/IEvent.cs | draculakkk/EChartsBlazor | f886c878a6b1a1d4b47d54d8e86001c7ef2a072e | [
"Apache-2.0"
] | 1 | 2021-08-17T03:10:13.000Z | 2021-08-17T03:10:13.000Z | using TagEChartsBlazor.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TagEChartsBlazor.Configuration.Event
{
public interface IEvent
{
string EventName { get; }
object? Query { get; set; }
}
}
| 19.625 | 46 | 0.716561 |
334afbed1e2da33b00f070ac0c66bc233e37175d | 3,144 | cs | C# | src/Uno.UWP/Generated/3.0.0.0/Windows.Storage/SystemMusicProperties.cs | nv-ksavaria/Uno | b8f1855d0c6495e86cc9660c783bac9efa96e8de | [
"Apache-2.0"
] | null | null | null | src/Uno.UWP/Generated/3.0.0.0/Windows.Storage/SystemMusicProperties.cs | nv-ksavaria/Uno | b8f1855d0c6495e86cc9660c783bac9efa96e8de | [
"Apache-2.0"
] | null | null | null | src/Uno.UWP/Generated/3.0.0.0/Windows.Storage/SystemMusicProperties.cs | nv-ksavaria/Uno | b8f1855d0c6495e86cc9660c783bac9efa96e8de | [
"Apache-2.0"
] | null | null | null | #pragma warning disable 108 // new keyword hiding
#pragma warning disable 114 // new keyword hiding
namespace Windows.Storage
{
#if __ANDROID__ || __IOS__ || NET46 || __WASM__
[global::Uno.NotImplemented]
#endif
public partial class SystemMusicProperties
{
#if __ANDROID__ || __IOS__ || NET46 || __WASM__
[global::Uno.NotImplemented]
public string AlbumArtist
{
get
{
throw new global::System.NotImplementedException("The member string SystemMusicProperties.AlbumArtist is not implemented in Uno.");
}
}
#endif
#if __ANDROID__ || __IOS__ || NET46 || __WASM__
[global::Uno.NotImplemented]
public string AlbumTitle
{
get
{
throw new global::System.NotImplementedException("The member string SystemMusicProperties.AlbumTitle is not implemented in Uno.");
}
}
#endif
#if __ANDROID__ || __IOS__ || NET46 || __WASM__
[global::Uno.NotImplemented]
public string Artist
{
get
{
throw new global::System.NotImplementedException("The member string SystemMusicProperties.Artist is not implemented in Uno.");
}
}
#endif
#if __ANDROID__ || __IOS__ || NET46 || __WASM__
[global::Uno.NotImplemented]
public string Composer
{
get
{
throw new global::System.NotImplementedException("The member string SystemMusicProperties.Composer is not implemented in Uno.");
}
}
#endif
#if __ANDROID__ || __IOS__ || NET46 || __WASM__
[global::Uno.NotImplemented]
public string Conductor
{
get
{
throw new global::System.NotImplementedException("The member string SystemMusicProperties.Conductor is not implemented in Uno.");
}
}
#endif
#if __ANDROID__ || __IOS__ || NET46 || __WASM__
[global::Uno.NotImplemented]
public string DisplayArtist
{
get
{
throw new global::System.NotImplementedException("The member string SystemMusicProperties.DisplayArtist is not implemented in Uno.");
}
}
#endif
#if __ANDROID__ || __IOS__ || NET46 || __WASM__
[global::Uno.NotImplemented]
public string Genre
{
get
{
throw new global::System.NotImplementedException("The member string SystemMusicProperties.Genre is not implemented in Uno.");
}
}
#endif
#if __ANDROID__ || __IOS__ || NET46 || __WASM__
[global::Uno.NotImplemented]
public string TrackNumber
{
get
{
throw new global::System.NotImplementedException("The member string SystemMusicProperties.TrackNumber is not implemented in Uno.");
}
}
#endif
// Forced skipping of method Windows.Storage.SystemMusicProperties.AlbumArtist.get
// Forced skipping of method Windows.Storage.SystemMusicProperties.AlbumTitle.get
// Forced skipping of method Windows.Storage.SystemMusicProperties.Artist.get
// Forced skipping of method Windows.Storage.SystemMusicProperties.Composer.get
// Forced skipping of method Windows.Storage.SystemMusicProperties.Conductor.get
// Forced skipping of method Windows.Storage.SystemMusicProperties.DisplayArtist.get
// Forced skipping of method Windows.Storage.SystemMusicProperties.Genre.get
// Forced skipping of method Windows.Storage.SystemMusicProperties.TrackNumber.get
}
}
| 31.44 | 137 | 0.734097 |
e8fb8e987a87f2ec34d4b437d52193880a750848 | 1,670 | cs | C# | src/Microsoft.Health.Dicom.Core/Features/Workitem/WorkitemService.Query.cs | daemel/dicom-server | 9b16efba259b1061d766fc3497d9d3c2d12d0da6 | [
"MIT"
] | null | null | null | src/Microsoft.Health.Dicom.Core/Features/Workitem/WorkitemService.Query.cs | daemel/dicom-server | 9b16efba259b1061d766fc3497d9d3c2d12d0da6 | [
"MIT"
] | null | null | null | src/Microsoft.Health.Dicom.Core/Features/Workitem/WorkitemService.Query.cs | daemel/dicom-server | 9b16efba259b1061d766fc3497d9d3c2d12d0da6 | [
"MIT"
] | null | null | null | // -------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
// -------------------------------------------------------------------------------------------------
using System;
using System.Threading;
using System.Threading.Tasks;
using EnsureThat;
using Microsoft.Extensions.Logging;
using Microsoft.Health.Dicom.Core.Features.Query;
using Microsoft.Health.Dicom.Core.Features.Store;
using Microsoft.Health.Dicom.Core.Features.Store.Entries;
using Microsoft.Health.Dicom.Core.Messages.Workitem;
namespace Microsoft.Health.Dicom.Core.Features.Workitem;
/// <summary>
/// Provides functionality to process the list of <see cref="IDicomInstanceEntry"/>.
/// </summary>
public partial class WorkitemService
{
public async Task<QueryWorkitemResourceResponse> ProcessQueryAsync(BaseQueryParameters parameters, CancellationToken cancellationToken)
{
EnsureArg.IsNotNull(parameters, nameof(parameters));
try
{
var result = await _workitemOrchestrator.QueryAsync(parameters, cancellationToken).ConfigureAwait(false);
_logger.LogInformation("Successfully queried the DICOM instance work-item entry.");
return result;
}
catch (Exception ex)
{
ushort failureCode = FailureReasonCodes.ProcessingFailure;
_logger.LogWarning(ex, "Failed to query the DICOM instance work-item entry. Failure code: {FailureCode}.", failureCode);
throw;
}
}
}
| 37.111111 | 139 | 0.641317 |
330212a4fca60c34426335302630639ed0226321 | 5,025 | cs | C# | objectModel/CSharp/Microsoft.CommonDataModel.ObjectModel/Persistence/ModelJson/DataPartitionPersistence.cs | lukas-gust/CDM | 9c7391f5af65669a7119587833238b562f73c3e3 | [
"CC-BY-4.0",
"MIT"
] | 1 | 2021-03-05T03:35:58.000Z | 2021-03-05T03:35:58.000Z | objectModel/CSharp/Microsoft.CommonDataModel.ObjectModel/Persistence/ModelJson/DataPartitionPersistence.cs | spbast/CDM | bf97a3720c97ee4c9df3625084cf8b3bc65ff9c7 | [
"CC-BY-4.0",
"MIT"
] | null | null | null | objectModel/CSharp/Microsoft.CommonDataModel.ObjectModel/Persistence/ModelJson/DataPartitionPersistence.cs | spbast/CDM | bf97a3720c97ee4c9df3625084cf8b3bc65ff9c7 | [
"CC-BY-4.0",
"MIT"
] | null | null | null | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
namespace Microsoft.CommonDataModel.ObjectModel.Persistence.ModelJson
{
using Microsoft.CommonDataModel.ObjectModel.Cdm;
using Microsoft.CommonDataModel.ObjectModel.Enums;
using Microsoft.CommonDataModel.ObjectModel.Persistence.ModelJson.types;
using Microsoft.CommonDataModel.ObjectModel.Utilities;
using Microsoft.CommonDataModel.ObjectModel.Utilities.Logging;
using System.Collections.Generic;
using System.Threading.Tasks;
/// <summary>
/// The data partition persistence.
/// </summary>
class DataPartitionPersistence
{
public static async Task<CdmDataPartitionDefinition> FromData(CdmCorpusContext ctx, Partition obj, List<CdmTraitDefinition> extensionTraitDefList, List<CdmTraitDefinition> localExtensionTraitDefList, CdmFolderDefinition documentFolder)
{
var partition = ctx.Corpus.MakeObject<CdmDataPartitionDefinition>(CdmObjectType.DataPartitionDef, obj.Name);
if (!string.IsNullOrWhiteSpace(obj.Description))
partition.Description = obj.Description;
partition.Location = ctx.Corpus.Storage.CreateRelativeCorpusPath(
ctx.Corpus.Storage.AdapterPathToCorpusPath(obj.Location),
documentFolder);
partition.RefreshTime = obj.RefreshTime;
partition.LastFileModifiedTime = obj.LastFileModifiedTime;
partition.LastFileStatusCheckTime = obj.LastFileStatusCheckTime;
if (string.IsNullOrEmpty(partition.Location))
{
Logger.Warning(nameof(DataPartitionPersistence), ctx as ResolveContext, $"Couldn't find data partition's location for partition {partition.Name}.", nameof(FromData));
}
if (obj.IsHidden == true)
{
var isHiddenTrait = ctx.Corpus.MakeRef<CdmTraitReference>(CdmObjectType.TraitRef, "is.hidden", true);
partition.ExhibitsTraits.Add(isHiddenTrait);
}
await Utils.ProcessAnnotationsFromData(ctx, obj, partition.ExhibitsTraits);
if (obj.FileFormatSettings != null)
{
var csvFormatTrait = Utils.CreateCsvTrait(obj.FileFormatSettings, ctx);
if (csvFormatTrait == null) {
Logger.Error(nameof(DataPartitionPersistence), ctx as ResolveContext, "There was a problem while processing csv format settings inside data partition.");
return null;
}
partition.ExhibitsTraits.Add(csvFormatTrait);
}
ExtensionHelper.ProcessExtensionFromJson(ctx, obj, partition.ExhibitsTraits, extensionTraitDefList, localExtensionTraitDefList);
return partition;
}
public static async Task<Partition> ToData(CdmDataPartitionDefinition instance, ResolveOptions resOpt, CopyOptions options)
{
var result = new Partition
{
Name = instance.Name,
Description = instance.Description,
Location = instance.Ctx.Corpus.Storage.CorpusPathToAdapterPath(
instance.Ctx.Corpus.Storage.CreateAbsoluteCorpusPath(
instance.Location, instance.InDocument)),
RefreshTime = instance.RefreshTime,
FileFormatSettings = null,
LastFileModifiedTime = instance.LastFileModifiedTime,
LastFileStatusCheckTime = instance.LastFileStatusCheckTime
};
if (string.IsNullOrEmpty(result.Location))
{
Logger.Warning(nameof(DataPartitionPersistence), instance.Ctx, $"Couldn't find data partition's location for partition {result.Name}.", nameof(ToData));
}
Utils.ProcessTraitsAndAnnotationsToData(instance.Ctx, result, instance.ExhibitsTraits);
var t2pm = new TraitToPropertyMap(instance);
var isHiddenTrait = t2pm.FetchTraitReference("is.hidden");
if (isHiddenTrait != null)
{
result.IsHidden = true;
}
var csvTrait = t2pm.FetchTraitReference("is.partition.format.CSV");
if (csvTrait != null)
{
var csvFormatSettings = Utils.CreateCsvFormatSettings(csvTrait);
if (csvFormatSettings != null)
{
result.FileFormatSettings = csvFormatSettings;
result.FileFormatSettings.Type = "CsvFormatSettings";
}
else
{
Logger.Error(nameof(DataPartitionPersistence), instance.Ctx,
"There was a problem while processing csv format trait inside data partition.");
return null;
}
}
return result;
}
}
}
| 43.318966 | 243 | 0.635622 |
bdfac19fca2653ef540e03ff8b618e0f0a7ea249 | 567 | cs | C# | Assets/Scripts/ChangeDayOfNight.cs | AntiecoSoftware/Popit-Junior | d34c2eb16c985785ae4e4349b52ac3b7376a1bcf | [
"Apache-2.0"
] | null | null | null | Assets/Scripts/ChangeDayOfNight.cs | AntiecoSoftware/Popit-Junior | d34c2eb16c985785ae4e4349b52ac3b7376a1bcf | [
"Apache-2.0"
] | null | null | null | Assets/Scripts/ChangeDayOfNight.cs | AntiecoSoftware/Popit-Junior | d34c2eb16c985785ae4e4349b52ac3b7376a1bcf | [
"Apache-2.0"
] | null | null | null | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ChangeDayOfNight : MonoBehaviour
{
/*
public Material material1;
public Material material2;
float duration = 2.0f;
Renderer rend;
void Start()
{
}
void Update()
{
// ping-pong between the materials over the duration
float lerp = Mathf.PingPong(Time.time, duration) / duration;
RenderSettings.skybox.Lerp (material1, material2, lerp);
}
public void ChangeTimesOfDay()
{
}
*/
}
| 17.181818 | 68 | 0.634921 |
c547a9854065db3c6eb18f5fb2eaac66c5f24145 | 1,807 | cs | C# | tests/OpenPDF.Tests/Content/Handling/DictionaryPdfContentFactoryTests.cs | svishnevsky/OpenPDF | a9b0d919bcf401de1e93e40b18864316729376f7 | [
"MIT"
] | 3 | 2019-01-02T05:44:25.000Z | 2021-06-23T09:56:41.000Z | tests/OpenPDF.Tests/Content/Handling/DictionaryPdfContentFactoryTests.cs | svishnevsky/OpenPDF | a9b0d919bcf401de1e93e40b18864316729376f7 | [
"MIT"
] | null | null | null | tests/OpenPDF.Tests/Content/Handling/DictionaryPdfContentFactoryTests.cs | svishnevsky/OpenPDF | a9b0d919bcf401de1e93e40b18864316729376f7 | [
"MIT"
] | 1 | 2020-08-20T04:47:43.000Z | 2020-08-20T04:47:43.000Z | using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenPDF.Content;
using OpenPDF.Content.Handling;
namespace OpenPDF.Tests.Content.Handling
{
[TestClass]
public class DictionaryPdfContentFactoryTests
{
[TestMethod]
public void CreateDefaultDictionary()
{
var props = new Dictionary<string, PdfObjectContent>
{
{ "Some Prop", new NullPdfObjectContent() }
};
var expected = new DictionaryPdfObjectContent(props);
var sut = new DictionaryPdfContentFactory();
DictionaryPdfObjectContent result = sut.Create(props);
Assert.AreEqual(expected, result);
}
[TestMethod]
public void CreateUnlnownTypeDictionary()
{
var props = new Dictionary<string, PdfObjectContent>
{
{ "Type", new StringPdfObjectContent("someunknowntype") }
};
var expected = new DictionaryPdfObjectContent(props);
var sut = new DictionaryPdfContentFactory();
DictionaryPdfObjectContent result = sut.Create(props);
Assert.AreEqual(expected, result);
}
[TestMethod]
public void CreateCatalogDictionary()
{
var props = new Dictionary<string, PdfObjectContent>
{
{ "Type", new StringPdfObjectContent("Catalog") }
};
var expected = new CatalogPdfObjectContent(props);
var sut = new DictionaryPdfContentFactory();
DictionaryPdfObjectContent result = sut.Create(props);
Assert.IsInstanceOfType(result, typeof(CatalogPdfObjectContent));
Assert.AreEqual(expected, result);
}
}
}
| 31.155172 | 77 | 0.609297 |
34b95d85840e87d2981cad985707f4c4467734c1 | 265 | csx | C# | SkyEditor.RomEditor.Rtdx.ConsoleApp/Scripts/Queries/Rtdx/PrintStatuses.csx | theCapypara/SkyEditor.RomEditor.Rtdx | 60a3ebf347bc554d19772ef224344013a2ee64e6 | [
"MIT"
] | 6 | 2021-10-13T13:23:52.000Z | 2022-03-05T02:55:13.000Z | SkyEditor.RomEditor.Rtdx.ConsoleApp/Scripts/Queries/Rtdx/PrintStatuses.csx | theCapypara/SkyEditor.RomEditor.Rtdx | 60a3ebf347bc554d19772ef224344013a2ee64e6 | [
"MIT"
] | 46 | 2021-10-13T08:50:01.000Z | 2022-03-28T19:31:36.000Z | SkyEditor.RomEditor.Rtdx.ConsoleApp/Scripts/Queries/Rtdx/PrintStatuses.csx | theCapypara/SkyEditor.RomEditor.Rtdx | 60a3ebf347bc554d19772ef224344013a2ee64e6 | [
"MIT"
] | 3 | 2021-10-09T02:47:15.000Z | 2021-10-11T21:38:20.000Z | #load "../../../Stubs/Rtdx.csx"
using System;
using SkyEditor.RomEditor.Domain.Rtdx.Structures;
var statuses = Rom.GetCommonStrings().Statuses;
foreach (var status in statuses)
{
Console.WriteLine($"{(int)status.Key,3}: {status.Key,-15} {status.Value}");
}
| 24.090909 | 80 | 0.698113 |
8909ee39e451920e83278ddf1912f9c60c0bd8d9 | 3,117 | cs | C# | AssetTracking/AssetTracking/Startup.cs | microsoftgraph/aspnet-bookloan-sample | 0e769898e374aafd913aa87db08fa556229ed425 | [
"MIT"
] | 3 | 2020-01-28T15:46:04.000Z | 2020-12-11T16:06:59.000Z | AssetTracking/AssetTracking/Startup.cs | microsoftgraph/aspnet-bookloan-sample | 0e769898e374aafd913aa87db08fa556229ed425 | [
"MIT"
] | 15 | 2019-07-04T07:55:13.000Z | 2019-09-05T08:02:06.000Z | AssetTracking/AssetTracking/Startup.cs | microsoftgraph/aspnet-bookloan-sample | 0e769898e374aafd913aa87db08fa556229ed425 | [
"MIT"
] | 6 | 2019-07-02T07:50:24.000Z | 2022-02-22T10:05:43.000Z | using AssetTracking.Extensions;
using AssetTracking.Helpers;
using AssetTracking.Interfaces;
using AssetTracking.Repositories;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System;
namespace AssetTracking
{
public partial class Startup
{
public Startup(IConfiguration config)
{
Configuration = config;
}
public IConfiguration Configuration { get; }
public const string ObjectIdentifierType = "http://schemas.microsoft.com/identity/claims/objectidentifier";
public const string TenantIdType = "http://schemas.microsoft.com/identity/claims/tenantid";
public void ConfigureServices(IServiceCollection services)
{
services.Configure<CookiePolicyOptions>(options =>
{
options.CheckConsentNeeded = context => true;
options.MinimumSameSitePolicy = SameSiteMode.None;
});
services.AddAuthentication(sharedOptions =>
{
sharedOptions.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme;
sharedOptions.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
sharedOptions.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
})
.AddAzureAd(options => Configuration.Bind("AzureAd", options))
.AddCookie();
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
services.AddSession();
services.AddSingleton<IGraphAuthProvider, GraphAuthProvider>();
services.AddTransient<IGraphSdkHelper, GraphSdkHelper>();
services.AddScoped<IOfficeBookRepository, OfficeBookRepository>();
services.AddScoped<IOfficeItemRepository, OfficeItemRepository>();
services.Configure<HstsOptions>(options =>
{
options.IncludeSubDomains = true;
options.MaxAge = TimeSpan.FromDays(365);
});
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseCookiePolicy();
app.UseSession();
app.UseAuthentication();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Admin}/{action=Index}/{id?}");
});
}
}
} | 36.244186 | 115 | 0.634264 |
89e284a07715e998fa36026cfe19d71163f39994 | 488 | cs | C# | src/Plugins/Plugin.StatusTracking/LastSessionInfo.cs | guanwu/notify | b67765859a9292dbed8361e9c1e4451a4dc9eb24 | [
"MIT"
] | null | null | null | src/Plugins/Plugin.StatusTracking/LastSessionInfo.cs | guanwu/notify | b67765859a9292dbed8361e9c1e4451a4dc9eb24 | [
"MIT"
] | null | null | null | src/Plugins/Plugin.StatusTracking/LastSessionInfo.cs | guanwu/notify | b67765859a9292dbed8361e9c1e4451a4dc9eb24 | [
"MIT"
] | null | null | null | namespace Guanwu.Notify.Plugin.StatusTracking
{
internal class LastSession
{
public string id { get; set; }
public string sn { get; set; }
public LastTaskState[] ls { get; set; }
public class LastTaskState
{
public string n { get; set; }
public string s { get; set; }
}
}
internal class StateProfile
{
public string[] All { get; set; }
public string State { get; set; }
}
}
| 23.238095 | 47 | 0.538934 |
d3f582c35a20fa8fedcd05839ad3932c5641a0a3 | 191 | cs | C# | Models/GetUploadUrlRequest.cs | Eagles-Jungscharen/media-library-backend | 1fc5598d1e6592f042297e048e3a356fa378f46c | [
"Apache-2.0"
] | null | null | null | Models/GetUploadUrlRequest.cs | Eagles-Jungscharen/media-library-backend | 1fc5598d1e6592f042297e048e3a356fa378f46c | [
"Apache-2.0"
] | null | null | null | Models/GetUploadUrlRequest.cs | Eagles-Jungscharen/media-library-backend | 1fc5598d1e6592f042297e048e3a356fa378f46c | [
"Apache-2.0"
] | null | null | null | namespace EaglesJungscharen.MediaLibrary.Models
{
public class GetUploadUrlRequest {
public string TargetMediaItemId {get;set;}
public string MediaName {get;set;}
}
} | 27.285714 | 50 | 0.712042 |
cbae5d77ee23268bcb4a77f4c91e56357390abd7 | 562 | cs | C# | managed/Interop/Drawing/NativeMetrics.cs | GrognardsFromHell/OpenTemple.Native | d8c479d6d218a65db077c4c095c34adecae8301f | [
"MIT"
] | null | null | null | managed/Interop/Drawing/NativeMetrics.cs | GrognardsFromHell/OpenTemple.Native | d8c479d6d218a65db077c4c095c34adecae8301f | [
"MIT"
] | 3 | 2019-12-24T20:41:11.000Z | 2019-12-24T20:42:08.000Z | managed/Interop/Drawing/NativeMetrics.cs | GrognardsFromHell/OpenTemple.Native | d8c479d6d218a65db077c4c095c34adecae8301f | [
"MIT"
] | 1 | 2021-09-07T02:19:57.000Z | 2021-09-07T02:19:57.000Z | using System.Runtime.InteropServices;
namespace OpenTemple.Interop.Drawing
{
[StructLayout(LayoutKind.Sequential)]
public readonly struct NativeMetrics
{
public readonly float Left;
public readonly float Top;
public readonly float Width;
public readonly float WidthIncludingTrailingWhitespace;
public readonly float Height;
public readonly float LayoutWidth;
public readonly float LayoutHeight;
public readonly int MaxBidiReorderingDepth;
public readonly int LineCount;
}
} | 31.222222 | 63 | 0.715302 |
a37b0d7c4235e0198195e98664056050dd7a6cf0 | 3,103 | cs | C# | Assets/PowerUI/Source/JavaScript/Web APIs/NPAPI Plugins/Navigator-Plugins.cs | charliedavenport/Athens-Parking-Meters | 5e27916292238abf936086f720ac96f139388c90 | [
"MIT"
] | null | null | null | Assets/PowerUI/Source/JavaScript/Web APIs/NPAPI Plugins/Navigator-Plugins.cs | charliedavenport/Athens-Parking-Meters | 5e27916292238abf936086f720ac96f139388c90 | [
"MIT"
] | null | null | null | Assets/PowerUI/Source/JavaScript/Web APIs/NPAPI Plugins/Navigator-Plugins.cs | charliedavenport/Athens-Parking-Meters | 5e27916292238abf936086f720ac96f139388c90 | [
"MIT"
] | null | null | null | //--------------------------------------
// PowerUI
//
// For documentation or
// if you have any issues, visit
// powerUI.kulestar.com
//
// Copyright © 2013 Kulestar Ltd
// www.kulestar.com
//--------------------------------------
using System;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.IO;
#if UNITY_STANDALONE_WIN
using Microsoft.Win32;
#endif
namespace PowerUI{
/// <summary>
/// Used by window.navigator.
/// </summary>
public partial class Navigator{
internal static Dictionary<string,Plugin> PluginMap;
internal static PluginArray LoadedPlugins;
/// <summary>Is java enabled?</summary>
public bool javaEnabled{
get{
return false;
}
}
/// <summary>Installed plugins.</summary>
public PluginArray plugins{
get{
if(LoadedPlugins==null){
LoadPluginList();
}
return LoadedPlugins;
}
}
#if UNITY_STANDALONE_WIN
private void CollectPluginsRegistry(PluginArray arr,RegistryKey key){
foreach (string v in key.GetSubKeyNames()){
// Open it up:
RegistryKey pluginData = key.OpenSubKey(v);
Plugin p=new Plugin();
// General meta:
p.dllPath=pluginData.GetValue("Path","") as string;
p.description=pluginData.GetValue("Description","") as string;
p.name=pluginData.GetValue("ProductName","") as string;
p.vendor=pluginData.GetValue("Vendor","") as string;
p.version=pluginData.GetValue("Version","") as string;
// May have an optional 'MimeTypes' folder:
RegistryKey mimeTypes = pluginData.OpenSubKey("MimeTypes");
List<PluginMimeType> types=new List<PluginMimeType>();
if(mimeTypes!=null){
foreach (string mT in mimeTypes.GetSubKeyNames()){
// Open it up:
RegistryKey mtData = mimeTypes.OpenSubKey(mT);
// Add:
types.Add(new PluginMimeType(mT,mtData.GetValue("Description","") as string));
// Map:
PluginMap[mT]=p;
}
}
p.mimeTypes=types.ToArray();
}
}
// private void CollectPluginsDir(PluginArray arr,string dir){}
#endif
/// <summary>Loads the Gecko plugin list.</summary>
private void LoadPluginList(){
PluginArray arr=new PluginArray();
PluginMap=new Dictionary<string,Plugin>();
LoadedPlugins=arr;
#if UNITY_STANDALONE_WIN
/*
// Get moz path:
string mozPath=System.Environment.GetEnvironmentVariable("MOZ_PLUGIN_PATH");
if(mozPath!=null){
CollectPluginsDir(arr,mozPath);
}
if(Directory.Exists("%APPDATA%\\Mozilla\\plugins")){
CollectPluginsDir(arr,"%APPDATA%\\Mozilla\\plugins");
}
*/
// From the registry:
try{
CollectPluginsRegistry(arr,Registry.CurrentUser.OpenSubKey("Software\\MozillaPlugins"));
}catch{
// Privs
}
try{
CollectPluginsRegistry(arr,Registry.LocalMachine.OpenSubKey("Software\\MozillaPlugins"));
}catch{
// Privs
}
#endif
}
}
} | 20.825503 | 93 | 0.614567 |
58f09f335797c4a13f0e0278e1dbc3555f1e833d | 1,935 | cs | C# | src/Style.cs | Bia10/Crow | f3344a78e511213d235e4c91bf507264fd41ac0d | [
"MIT"
] | 1 | 2021-04-30T05:18:05.000Z | 2021-04-30T05:18:05.000Z | src/Style.cs | Bia10/Crow | f3344a78e511213d235e4c91bf507264fd41ac0d | [
"MIT"
] | null | null | null | src/Style.cs | Bia10/Crow | f3344a78e511213d235e4c91bf507264fd41ac0d | [
"MIT"
] | null | null | null | //
// Style.cs
//
// Author:
// Jean-Philippe Bruyère <jp.bruyere@hotmail.com>
//
// Copyright (c) 2013-2017 Jean-Philippe Bruyère
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.Collections.Generic;
namespace Crow
{
public struct FileLocation {
public string FilePath;
public int Line;
public int Column;
public FileLocation(string filePath, int line, int column){
FilePath = filePath;
Line = line;
Column = column;
}
public override string ToString ()
{
return string.Format ("{0} ({1},{2})", FilePath, Line, Column);
}
}
public class Style : Dictionary<string, object>
{
#if DESIGN_MODE
public Dictionary<string, FileLocation> Locations = new Dictionary<string, FileLocation>();
#endif
//public Dictionary<string, Style> SubStyles;//TODO:implement substyles for all tags inside a style
public Style () : base()
{
}
}
}
| 32.25 | 101 | 0.731266 |
456e8cffbcdaff7aded6c2d81efe5c306c6787a7 | 1,039 | cs | C# | src/System.Collections.NonGeneric/tests/SortedList/PropertyCapacityTests.cs | n8ohu/corefx | 3e62bc488d409633549dea48110ce25c872c3e55 | [
"MIT"
] | 1 | 2020-10-12T15:22:24.000Z | 2020-10-12T15:22:24.000Z | src/System.Collections.NonGeneric/tests/SortedList/PropertyCapacityTests.cs | n8ohu/corefx | 3e62bc488d409633549dea48110ce25c872c3e55 | [
"MIT"
] | 1 | 2021-06-25T15:38:54.000Z | 2021-06-25T15:38:54.000Z | src/System.Collections.NonGeneric/tests/SortedList/PropertyCapacityTests.cs | n8ohu/corefx | 3e62bc488d409633549dea48110ce25c872c3e55 | [
"MIT"
] | null | null | null | // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections;
using System.Globalization;
using System.Text;
using Xunit;
namespace System.Collections.SortedListTests
{
public class CapacityTests
{
[Fact]
public void TestGetCapacityBasic()
{
String strValue = String.Empty;
SortedList list;
Int32 iCurrentDefaultCapacity;
Int32 capacity;
iCurrentDefaultCapacity = 0;
list = new SortedList();
Assert.Equal(list.Capacity, iCurrentDefaultCapacity);
list.Capacity = 3;
Assert.Equal(3, list.Capacity);
capacity = 0;
list = new SortedList(capacity);
Assert.Equal(list.Capacity, capacity);
capacity = 5000;
list = new SortedList(capacity);
Assert.Equal(list.Capacity, capacity);
}
}
}
| 25.341463 | 101 | 0.611165 |
5c965810b5b1923ca070f3720d484c71affc2d80 | 4,538 | cs | C# | ShiftOS/ShiftOS/Programs/Clock.Designer.cs | Alee14/shiftos-challenge | a227f0e3dfc632cf1e6931b831db7d75fe0d40b3 | [
"MIT"
] | null | null | null | ShiftOS/ShiftOS/Programs/Clock.Designer.cs | Alee14/shiftos-challenge | a227f0e3dfc632cf1e6931b831db7d75fe0d40b3 | [
"MIT"
] | null | null | null | ShiftOS/ShiftOS/Programs/Clock.Designer.cs | Alee14/shiftos-challenge | a227f0e3dfc632cf1e6931b831db7d75fe0d40b3 | [
"MIT"
] | null | null | null | namespace ShiftOS.Programs
{
partial class Clock
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.bottomtext = new System.Windows.Forms.Label();
this.pgcontents = new System.Windows.Forms.Panel();
this.toptext = new System.Windows.Forms.Label();
this.lbmaintime = new System.Windows.Forms.Label();
this.pgcontents.SuspendLayout();
this.SuspendLayout();
//
// bottomtext
//
this.bottomtext.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.bottomtext.Location = new System.Drawing.Point(10, 88);
this.bottomtext.Name = "bottomtext";
this.bottomtext.Size = new System.Drawing.Size(342, 23);
this.bottomtext.TabIndex = 2;
this.bottomtext.Text = "Seconds have passed";
this.bottomtext.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// pgcontents
//
this.pgcontents.BackColor = System.Drawing.Color.White;
this.pgcontents.Controls.Add(this.bottomtext);
this.pgcontents.Controls.Add(this.toptext);
this.pgcontents.Controls.Add(this.lbmaintime);
this.pgcontents.Dock = System.Windows.Forms.DockStyle.Fill;
this.pgcontents.Location = new System.Drawing.Point(2, 30);
this.pgcontents.Name = "pgcontents";
this.pgcontents.Size = new System.Drawing.Size(362, 135);
this.pgcontents.TabIndex = 25;
//
// toptext
//
this.toptext.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.toptext.Location = new System.Drawing.Point(10, 22);
this.toptext.Name = "toptext";
this.toptext.Size = new System.Drawing.Size(342, 23);
this.toptext.TabIndex = 1;
this.toptext.Text = "The Time is";
this.toptext.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// lbmaintime
//
this.lbmaintime.Font = new System.Drawing.Font("Microsoft Sans Serif", 36F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbmaintime.Location = new System.Drawing.Point(6, 38);
this.lbmaintime.Name = "lbmaintime";
this.lbmaintime.Size = new System.Drawing.Size(350, 52);
this.lbmaintime.TabIndex = 0;
this.lbmaintime.Text = "00000000";
this.lbmaintime.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// Clock
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(366, 167);
this.Controls.Add(this.pgcontents);
this.Name = "Clock";
this.Text = "Clock";
this.WindowIcon = global::ShiftOS.Properties.Resources.iconClock;
this.WindowTitle = "Clock";
this.Controls.SetChildIndex(this.pgcontents, 0);
this.pgcontents.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
internal System.Windows.Forms.Label bottomtext;
internal System.Windows.Forms.Panel pgcontents;
internal System.Windows.Forms.Label toptext;
internal System.Windows.Forms.Label lbmaintime;
}
} | 44.490196 | 170 | 0.592552 |
ceea347e9307359d36e0928882ba4e6613cad96b | 201 | cs | C# | src/CooKit.Mobile/CooKit.Mobile/Services/Feature/IFeatureService.cs | AppsLab2019/CooKit | 9d66d23e5bb2604730d4e8c31c5353fc1dc1736a | [
"MIT"
] | 2 | 2020-03-19T01:05:17.000Z | 2020-06-02T13:51:13.000Z | src/CooKit.Mobile/CooKit.Mobile/Services/Feature/IFeatureService.cs | AppsLab2019/CooKit | 9d66d23e5bb2604730d4e8c31c5353fc1dc1736a | [
"MIT"
] | null | null | null | src/CooKit.Mobile/CooKit.Mobile/Services/Feature/IFeatureService.cs | AppsLab2019/CooKit | 9d66d23e5bb2604730d4e8c31c5353fc1dc1736a | [
"MIT"
] | 2 | 2020-01-13T07:43:47.000Z | 2020-04-02T11:21:39.000Z | using System.Threading.Tasks;
using CooKit.Mobile.Models;
namespace CooKit.Mobile.Services.Feature
{
public interface IFeatureService
{
Task<Recipe> GetFeaturedRecipeAsync();
}
}
| 18.272727 | 46 | 0.726368 |
3007b1fd70d08d00039df77a07e296b98c62fa31 | 2,508 | cs | C# | ProtoProjects/Csharp_Unity/Assets/Gen/test/TestNullable.cs | LiuOcean/luban_examples | 75d5fd7c1b15d79efc0ebbac21a74bf050aed1fb | [
"MIT"
] | 1 | 2022-03-25T02:40:12.000Z | 2022-03-25T02:40:12.000Z | ProtoProjects/Csharp_Unity/Assets/Gen/test/TestNullable.cs | HFX-93/luban_examples | 5b90e392d404950d12ff803a186b26bdea5e0292 | [
"MIT"
] | null | null | null | ProtoProjects/Csharp_Unity/Assets/Gen/test/TestNullable.cs | HFX-93/luban_examples | 5b90e392d404950d12ff803a186b26bdea5e0292 | [
"MIT"
] | null | null | null | //------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Bright.Serialization;
namespace proto.test
{
public sealed class TestNullable : Bright.Serialization.BeanBase
{
public TestNullable()
{
}
public TestNullable(Bright.Common.NotNullInitialization _)
{
F2 = "";
F3 = new test.Simple();
}
public static void SerializeTestNullable(ByteBuf _buf, TestNullable x)
{
x.Serialize(_buf);
}
public static TestNullable DeserializeTestNullable(ByteBuf _buf)
{
var x = new test.TestNullable();
x.Deserialize(_buf);
return x;
}
public int? F1;
public string F2;
public test.Simple F3;
public test.Dyn F4;
public const int __ID__ = 0;
public override int GetTypeId() => __ID__;
public override void Serialize(ByteBuf _buf)
{
{ if(F1 is int __value__){ _buf.WriteBool(true); _buf.WriteInt(__value__); } else { _buf.WriteBool(false); } }
{ if(F2 is string __value__){ _buf.WriteBool(true); _buf.WriteString(__value__); } else { _buf.WriteBool(false); } }
{ if(F3 is test.Simple __value__){ _buf.WriteBool(true); test.Simple.SerializeSimple(_buf, __value__); } else { _buf.WriteBool(false); } }
{ if(F4 is test.Dyn __value__){ _buf.WriteBool(true); test.Dyn.SerializeDyn(_buf, __value__); } else { _buf.WriteBool(false); } }
}
public override void Deserialize(ByteBuf _buf)
{
if(_buf.ReadBool()){ F1 = _buf.ReadInt(); } else { F1 = null; }
if(_buf.ReadBool()){ F2 = _buf.ReadString(); } else { F2 = null; }
if(_buf.ReadBool()){ F3 = test.Simple.DeserializeSimple(_buf); } else { F3 = null; }
if(_buf.ReadBool()){ F4 = test.Dyn.DeserializeDyn(_buf); } else { F4 = null; }
}
public override string ToString()
{
return "test.TestNullable{ "
+ "F1:" + F1 + ","
+ "F2:" + F2 + ","
+ "F3:" + F3 + ","
+ "F4:" + F4 + ","
+ "}";
}
}
}
| 32.153846 | 150 | 0.514753 |
bbd09dd5d6570fd862dfeaefefa158cdf64277db | 282 | cs | C# | server/src/server/Cafe.Domain/Repositories/IManagerRepository.cs | dnikolovv/cafe | 807b396e19e8e093b2a223bb8e1ae37cf36698a1 | [
"MIT"
] | 55 | 2019-03-28T06:30:33.000Z | 2021-12-05T08:49:20.000Z | server/src/server/Cafe.Domain/Repositories/IManagerRepository.cs | nstankov23/cafe | 807b396e19e8e093b2a223bb8e1ae37cf36698a1 | [
"MIT"
] | 22 | 2019-03-19T11:41:18.000Z | 2019-07-28T19:05:46.000Z | server/src/server/Cafe.Domain/Repositories/IManagerRepository.cs | nstankov23/cafe | 807b396e19e8e093b2a223bb8e1ae37cf36698a1 | [
"MIT"
] | 16 | 2019-04-18T14:03:42.000Z | 2022-02-14T21:27:26.000Z | using Cafe.Domain.Entities;
using MediatR;
using Optional;
using System;
using System.Threading.Tasks;
namespace Cafe.Domain.Repositories
{
public interface IManagerRepository
{
Task<Option<Manager>> Get(Guid id);
Task<Unit> Add(Manager manager);
}
}
| 17.625 | 43 | 0.705674 |
012bda98bcf9790176553d4dd17187fd54134a82 | 264 | cs | C# | Src/Modules/Users/Divstack.Company.Estimation.Tool.Users.Api/Controllers/Common/DTO/Authentication/ConfirmAccountRequest.cs | kamilbaczek/estimation-tool | d4a2c2b112c2b830ba067dc69776deaccf752435 | [
"MIT"
] | 1 | 2021-06-24T15:13:21.000Z | 2021-06-24T15:13:21.000Z | Src/Modules/Users/Divstack.Company.Estimation.Tool.Users.Api/Controllers/Common/DTO/Authentication/ConfirmAccountRequest.cs | kamilbaczek/estimations-tool | d4a2c2b112c2b830ba067dc69776deaccf752435 | [
"MIT"
] | null | null | null | Src/Modules/Users/Divstack.Company.Estimation.Tool.Users.Api/Controllers/Common/DTO/Authentication/ConfirmAccountRequest.cs | kamilbaczek/estimations-tool | d4a2c2b112c2b830ba067dc69776deaccf752435 | [
"MIT"
] | null | null | null | namespace Divstack.Company.Estimation.Tool.Users.Api.Controllers.Common.DTO.Authentication;
using System;
public class ConfirmAccountRequest
{
public Guid UserId { get; set; }
public string Password { get; set; }
public string Token { get; set; }
}
| 24 | 92 | 0.734848 |
e30869c904efafbc950c53705609a5da8538a1d5 | 2,935 | cs | C# | Downloader/Objects/ShortcutHelper.cs | Paklausk/Kvantiliai | eefe8e9d291414988eaa801d2941b9a2925ccb34 | [
"MIT"
] | null | null | null | Downloader/Objects/ShortcutHelper.cs | Paklausk/Kvantiliai | eefe8e9d291414988eaa801d2941b9a2925ccb34 | [
"MIT"
] | null | null | null | Downloader/Objects/ShortcutHelper.cs | Paklausk/Kvantiliai | eefe8e9d291414988eaa801d2941b9a2925ccb34 | [
"MIT"
] | null | null | null | using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace Downloader.Objects
{
public static class ShortcutHelper
{
private static Type m_type = Type.GetTypeFromProgID("WScript.Shell");
private static object m_shell = Activator.CreateInstance(m_type);
[ComImport, TypeLibType((short)0x1040), Guid("F935DC23-1CF0-11D0-ADB9-00C04FD58A0B")]
private interface IWshShortcut
{
[DispId(0)]
string FullName { [return: MarshalAs(UnmanagedType.BStr)] [DispId(0)] get; }
[DispId(0x3e8)]
string Arguments { [return: MarshalAs(UnmanagedType.BStr)] [DispId(0x3e8)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [DispId(0x3e8)] set; }
[DispId(0x3e9)]
string Description { [return: MarshalAs(UnmanagedType.BStr)] [DispId(0x3e9)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [DispId(0x3e9)] set; }
[DispId(0x3ea)]
string Hotkey { [return: MarshalAs(UnmanagedType.BStr)] [DispId(0x3ea)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [DispId(0x3ea)] set; }
[DispId(0x3eb)]
string IconLocation { [return: MarshalAs(UnmanagedType.BStr)] [DispId(0x3eb)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [DispId(0x3eb)] set; }
[DispId(0x3ec)]
string RelativePath { [param: In, MarshalAs(UnmanagedType.BStr)] [DispId(0x3ec)] set; }
[DispId(0x3ed)]
string TargetPath { [return: MarshalAs(UnmanagedType.BStr)] [DispId(0x3ed)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [DispId(0x3ed)] set; }
[DispId(0x3ee)]
int WindowStyle { [DispId(0x3ee)] get; [param: In] [DispId(0x3ee)] set; }
[DispId(0x3ef)]
string WorkingDirectory { [return: MarshalAs(UnmanagedType.BStr)] [DispId(0x3ef)] get; [param: In, MarshalAs(UnmanagedType.BStr)] [DispId(0x3ef)] set; }
[TypeLibFunc((short)0x40), DispId(0x7d0)]
void Load([In, MarshalAs(UnmanagedType.BStr)] string PathLink);
[DispId(0x7d1)]
void Save();
}
public static void Create(string fileName, string targetPath, string arguments, string workingDirectory, string description, string hotkey, string iconPath)
{
IWshShortcut shortcut = (IWshShortcut)m_type.InvokeMember("CreateShortcut", System.Reflection.BindingFlags.InvokeMethod, null, m_shell, new object[] { fileName });
shortcut.Description = description;
shortcut.Hotkey = hotkey;
shortcut.TargetPath = targetPath;
shortcut.WorkingDirectory = workingDirectory;
shortcut.Arguments = arguments;
if (!string.IsNullOrEmpty(iconPath))
shortcut.IconLocation = iconPath;
shortcut.Save();
}
}
}
| 51.491228 | 175 | 0.644293 |
8db4072d197834d85a4f9ed3b59d794a05503bcc | 241 | cs | C# | src/Domain.Core/Interfaces/Events/IEntityDeletedDomainEvent.cs | otaviojulianons/DynamicRestApi | f0d8b7183524c4cc3ab7da8d7608a65b59e98bf0 | [
"MIT"
] | 1 | 2019-06-26T14:58:22.000Z | 2019-06-26T14:58:22.000Z | src/Domain.Core/Interfaces/Events/IEntityDeletedDomainEvent.cs | otaviojulianons/DynamicRestApi | f0d8b7183524c4cc3ab7da8d7608a65b59e98bf0 | [
"MIT"
] | 1 | 2021-11-19T21:53:33.000Z | 2021-11-19T21:53:33.000Z | src/Domain.Core/Interfaces/Events/IEntityDeletedDomainEvent.cs | otaviojulianons/DynamicRestApi | f0d8b7183524c4cc3ab7da8d7608a65b59e98bf0 | [
"MIT"
] | null | null | null | using Domain.Core.Interfaces.Structure;
using MediatR;
namespace Domain.Core.Interfaces.Events
{
public interface IEntityDeletedDomainEvent<TEntity> : INotification where TEntity : IEntity
{
TEntity Entity { get; }
}
}
| 21.909091 | 95 | 0.73029 |
82b7dc30f4feb5fda877a3a5fcc7744c7f2d8b60 | 382 | cs | C# | backend/Modules/Users/HitMeApp.Users/UserModuleCompositionRoot.cs | Somsiady-Inc/HitMeApp | 142742a20c25a52e7e46aea12767b6319aa9c26e | [
"MIT"
] | null | null | null | backend/Modules/Users/HitMeApp.Users/UserModuleCompositionRoot.cs | Somsiady-Inc/HitMeApp | 142742a20c25a52e7e46aea12767b6319aa9c26e | [
"MIT"
] | 5 | 2021-01-03T19:25:24.000Z | 2021-01-07T21:17:58.000Z | backend/Modules/Users/HitMeApp.Users/UserModuleCompositionRoot.cs | Somsiady-Inc/HitMeApp | 142742a20c25a52e7e46aea12767b6319aa9c26e | [
"MIT"
] | null | null | null | using Autofac;
namespace HitMeApp.Users
{
internal static class UserModuleCompositionRoot
{
private static IContainer _container;
public static void SetContainer(IContainer container)
{
_container = container;
}
public static ILifetimeScope BeginLifetimeScope()
=> _container.BeginLifetimeScope();
}
}
| 21.222222 | 61 | 0.651832 |
f63a0f2da758489d63d68033338a975338025c6a | 665 | cs | C# | src/Fabricdot.Core/DependencyInjection/DependencyRegistrarExtensions.cs | Winches/Fabricdot.Core | 002f29623feb203d6ee8355223c6b2f24bd20487 | [
"MIT"
] | 8 | 2021-07-15T09:24:48.000Z | 2022-01-19T07:06:52.000Z | src/Fabricdot.Core/DependencyInjection/DependencyRegistrarExtensions.cs | Winches/Fabricdot.Core | 002f29623feb203d6ee8355223c6b2f24bd20487 | [
"MIT"
] | null | null | null | src/Fabricdot.Core/DependencyInjection/DependencyRegistrarExtensions.cs | Winches/Fabricdot.Core | 002f29623feb203d6ee8355223c6b2f24bd20487 | [
"MIT"
] | 3 | 2021-11-11T14:25:00.000Z | 2022-02-07T09:30:27.000Z | using System;
namespace Fabricdot.Core.DependencyInjection
{
public static class DependencyRegistrarExtensions
{
public static DependencyLifeTime GetDependencyLifeTime(this IDependencyRegistrar registrar, Type type)
{
if (type.IsAssignableTo(typeof(ITransientDependency)))
return DependencyLifeTime.Transient;
if (type.IsAssignableTo(typeof(ISingletonDependency)))
return DependencyLifeTime.Singleton;
if (type.IsAssignableTo(typeof(IScopedDependency)))
return DependencyLifeTime.Scoped;
return DependencyLifeTime.Transient;
}
}
} | 35 | 110 | 0.682707 |
b3dc1d3dd9f1c98442e336866b087e42a11eb38b | 2,035 | cs | C# | Test3D/Assets/Scripts/LoadAssetBundles.cs | bachsoda326/TestUnity3D | f2b71f18ba985aea53370df052a754e90de31d64 | [
"Apache-2.0"
] | null | null | null | Test3D/Assets/Scripts/LoadAssetBundles.cs | bachsoda326/TestUnity3D | f2b71f18ba985aea53370df052a754e90de31d64 | [
"Apache-2.0"
] | null | null | null | Test3D/Assets/Scripts/LoadAssetBundles.cs | bachsoda326/TestUnity3D | f2b71f18ba985aea53370df052a754e90de31d64 | [
"Apache-2.0"
] | null | null | null | using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;
public class LoadAssetBundles : MonoBehaviour
{
public string url = "";
public string objName = "";
void Start()
{
StartCoroutine(DownloadObject());
}
IEnumerator DownloadObject()
{
WWW www = new WWW(url);
yield return www;
if (www.error != null)
{
Debug.Log(www.error);
}
AssetBundle bundle = www.assetBundle;
//var obj = bundle.mainAsset;
var obj = bundle.LoadAsset(objName);
Instantiate(obj);
}
}
//-------------------------------------------------------------------------------------------------
//public string url = "ahttp://visual.ariadne-infrastructure.eu/3d/monbracelet";
//void Start()
//{
// StartCoroutine(LoadModel());
//}
//IEnumerator LoadModel()
//{
// WWW www = new WWW(url);
// yield return www;
// AssetBundle bundle = www.assetBundle;
// if (www.error == null)
// {
// //var obj = bundle.LoadAsset<GameObject>("Funnel");
// //Instantiate(obj);
// GameObject obj = Instantiate(bundle.LoadAsset("monbracelet")) as GameObject;
// }
// else
// {
// Debug.Log(www.error);
// }
//}
//-------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------
//IEnumerator Start()
//{
// while (!Caching.ready)
// yield return null;
// using (var www = WWW.LoadFromCacheOrDownload("Ahttps://drive.google.com/open?id=154xObSvwHaqpXOgRNzR9w7rU9OmQk6nm", 5))
// {
// yield return www;
// if (!string.IsNullOrEmpty(www.error))
// {
// Debug.Log(www.error);
// yield return null;
// }
// var myLoadedAssetBundle = www.assetBundle;
// var asset = myLoadedAssetBundle.mainAsset;
// }
//} | 23.941176 | 125 | 0.510565 |
b6a2bcb30b3cf87823069a29a534ab8ecd82e4da | 5,250 | cs | C# | Rawr.Mage/XMath.cs | satelliteprogrammer/rawr | add4c167a77b4987ece7c36839249b35de5b5c40 | [
"Apache-2.0"
] | null | null | null | Rawr.Mage/XMath.cs | satelliteprogrammer/rawr | add4c167a77b4987ece7c36839249b35de5b5c40 | [
"Apache-2.0"
] | null | null | null | Rawr.Mage/XMath.cs | satelliteprogrammer/rawr | add4c167a77b4987ece7c36839249b35de5b5c40 | [
"Apache-2.0"
] | 1 | 2021-05-18T05:25:57.000Z | 2021-05-18T05:25:57.000Z | // adopted from http://www.codeproject.com/KB/cs/SpecialFunction.aspx
using System;
namespace Rawr.Mage
{
public class XMath
{
private const double MAXLOG = 7.09782712893383996732E2;
/// <summary>
/// Returns the complementary error function of the specified number.
/// </summary>
/// <param name="a"></param>
/// <returns></returns>
public static double Erfc(double a)
{
double x, y, z, p, q;
double[] P = {
2.46196981473530512524E-10,
5.64189564831068821977E-1,
7.46321056442269912687E0,
4.86371970985681366614E1,
1.96520832956077098242E2,
5.26445194995477358631E2,
9.34528527171957607540E2,
1.02755188689515710272E3,
5.57535335369399327526E2
};
double[] Q = {
//1.0
1.32281951154744992508E1,
8.67072140885989742329E1,
3.54937778887819891062E2,
9.75708501743205489753E2,
1.82390916687909736289E3,
2.24633760818710981792E3,
1.65666309194161350182E3,
5.57535340817727675546E2
};
double[] R = {
5.64189583547755073984E-1,
1.27536670759978104416E0,
5.01905042251180477414E0,
6.16021097993053585195E0,
7.40974269950448939160E0,
2.97886665372100240670E0
};
double[] S = {
//1.00000000000000000000E0,
2.26052863220117276590E0,
9.39603524938001434673E0,
1.20489539808096656605E1,
1.70814450747565897222E1,
9.60896809063285878198E0,
3.36907645100081516050E0
};
if (a < 0.0) x = -a;
else x = a;
if (x < 1.0) return 1.0 - Erf(a);
z = -a * a;
if (z < -MAXLOG)
{
if (a < 0) return (2.0);
else return (0.0);
}
z = Math.Exp(z);
if (x < 8.0)
{
p = polevl(x, P, 8);
q = p1evl(x, Q, 8);
}
else
{
p = polevl(x, R, 5);
q = p1evl(x, S, 6);
}
y = (z * p) / q;
if (a < 0) y = 2.0 - y;
if (y == 0.0)
{
if (a < 0) return 2.0;
else return (0.0);
}
return y;
}
/// <summary>
/// Returns the error function of the specified number.
/// </summary>
/// <param name="x"></param>
/// <returns></returns>
public static double Erf(double x)
{
double y, z;
double[] T = {
9.60497373987051638749E0,
9.00260197203842689217E1,
2.23200534594684319226E3,
7.00332514112805075473E3,
5.55923013010394962768E4
};
double[] U = {
//1.00000000000000000000E0,
3.35617141647503099647E1,
5.21357949780152679795E2,
4.59432382970980127987E3,
2.26290000613890934246E4,
4.92673942608635921086E4
};
if (Math.Abs(x) > 1.0) return (1.0 - Erfc(x));
z = x * x;
y = x * polevl(z, T, 4) / p1evl(z, U, 5);
return y;
}
/// <summary>
/// Evaluates polynomial of degree N
/// </summary>
/// <param name="x"></param>
/// <param name="coef"></param>
/// <param name="N"></param>
/// <returns></returns>
private static double polevl(double x, double[] coef, int N)
{
double ans;
ans = coef[0];
for (int i = 1; i <= N; i++)
{
ans = ans * x + coef[i];
}
return ans;
}
/// <summary>
/// Evaluates polynomial of degree N with assumtion that coef[N] = 1.0
/// </summary>
/// <param name="x"></param>
/// <param name="coef"></param>
/// <param name="N"></param>
/// <returns></returns>
private static double p1evl(double x, double[] coef, int N)
{
double ans;
ans = x + coef[0];
for (int i = 1; i < N; i++)
{
ans = ans * x + coef[i];
}
return ans;
}
}
}
| 30.172414 | 79 | 0.388762 |
8cef5f9bdc6ecd91ea00ea2a9134eec60a82c255 | 7,500 | cs | C# | LogAnalyticsExporter.cs | rbickel/AzureFunction.LogAnalytics.Exporter | 4d43245796a1a4ddc24f2325473bd99ec295b2b2 | [
"MIT"
] | null | null | null | LogAnalyticsExporter.cs | rbickel/AzureFunction.LogAnalytics.Exporter | 4d43245796a1a4ddc24f2325473bd99ec295b2b2 | [
"MIT"
] | null | null | null | LogAnalyticsExporter.cs | rbickel/AzureFunction.LogAnalytics.Exporter | 4d43245796a1a4ddc24f2325473bd99ec295b2b2 | [
"MIT"
] | null | null | null | using System;
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using System.Threading.Tasks;
using System.Collections.Generic;
using Newtonsoft.Json.Linq;
using System.Linq;
using System.Diagnostics;
using Microsoft.Azure.Cosmos.Table;
namespace Rbkl.io
{
public static class LogAnalyticsExporter
{
public static string workspaceId = Environment.GetEnvironmentVariable("workspaceId");
public static string tenantId = Environment.GetEnvironmentVariable("tenantId");
public static bool _local = string.Equals(Environment.GetEnvironmentVariable("isLocal"), "true");
private static string _clientId = Environment.GetEnvironmentVariable("clientId");
private static string _clientSecret = Environment.GetEnvironmentVariable("clientSecret");
private const string _QUEUENAME = "batchcursors-queue";
private const string _INDEXERTABLENAME = "BatchIndexTable";
//Event Hub Name. Will be overriden at runtime if specified in the connection string
//https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-event-hubs-output?tabs=csharp#configuration
private const string _EVENTHUBEPATH = "allevents";
private static string _CURSORFORMAT = "yyyy-MM-dd HH:mm:ss.fffffff";
private const string _CURSORCOLUMNNAME = "cursor";
private const int _TAKE = 1000;
private const string _SAFETYLAG = "ago(5m)";
[FunctionName(nameof(DatabaseCursorSlicer))]
public static async Task DatabaseCursorSlicer(
[TimerTrigger("0 * * * * *")] TimerInfo myTimer,
[Queue(_QUEUENAME)] IAsyncCollector<Summary> queuesCollector,
[Table(_INDEXERTABLENAME)] IAsyncCollector<Summary> summaryCollector,
[Table(_INDEXERTABLENAME)] CloudTable summaryTable,
ILogger logger
)
{
var run = DateTime.Now;
logger.LogInformation($"C# Timer trigger function executed at: {run}");
//Need to retrieve the latest cursor value
var initialCursor = DateTime.Now.AddMinutes(-31).ToUniversalTime().ToString(_CURSORFORMAT);
Summary summary = null;
var lastSummaryQuery = new TableQuery<Summary>().Take(1);
try
{
summary = (await summaryTable.ExecuteQuerySegmentedAsync(lastSummaryQuery, null)).FirstOrDefault();
}
catch (Exception e)
{
logger.LogError(e, "Impossible to find the latest cursor from the Table");
}
var previousCursor = summary?.NextCursor ?? initialCursor;
//Get the log analytic instance
var analytics = LogAnalyticQuery.GetInstance(logger);
//Authenticate to thje log analytic REST API
if (_local)
{
await analytics.AuthenticateWithClient(tenantId, _clientId, _clientSecret);
}
else
{
await analytics.AuthenticateWithMSI();
}
bool exit = true;
do
{
exit = true;
var timer = Stopwatch.StartNew();
//get next cursor ranges within the safety boundaries
var ranges = analytics.GetCursorRanges($"{previousCursor}", _SAFETYLAG, _TAKE);
await foreach (var r in ranges)
{
logger.LogDebug($"Summary: {JsonConvert.SerializeObject(r)}");
await queuesCollector.AddAsync(r);
await summaryCollector.AddAsync(r);
//continue the loop if some items were found
exit = false;
previousCursor = r.LastCursor;
}
await queuesCollector.FlushAsync();
await summaryCollector.FlushAsync();
} while (exit);
logger.LogInformation("Complete");
}
[FunctionName(nameof(BatchProcessor))]
public static async Task BatchProcessor(
[QueueTrigger(_QUEUENAME)] string message,
[Table(_INDEXERTABLENAME)] CloudTable summaryTable,
[EventHub(_EVENTHUBEPATH, Connection = "EventHubConnection")] IAsyncCollector<string> eventHub,
ILogger logger)
{
var run = DateTime.Now;
logger.LogInformation($"Processing batch {run}");
var analytics = LogAnalyticQuery.GetInstance(logger);
if (_local)
{
await analytics.AuthenticateWithClient(tenantId, _clientId, _clientSecret);
}
else
{
await analytics.AuthenticateWithMSI();
}
var timer = Stopwatch.StartNew();
var summary = JsonConvert.DeserializeObject<Summary>(message);
var events = await analytics.FetchEvents($"datetime({summary.LastCursor})", $"datetime({summary.NextCursor})");
await eventHub.SendEvents(events, logger);
summary = new Summary(summary.LastCursor, summary.NextCursor, events.Count, "OK", timer.ElapsedMilliseconds, run);
summary.ETag = "*"; //Etag required for replace
await summaryTable.ExecuteAsync(TableOperation.Replace(summary));
}
private static async Task SendEvents(this IAsyncCollector<string> outputEvents, IEnumerable<object> events, ILogger logger)
{
foreach (var e in events)
{
await outputEvents.AddAsync(JsonConvert.SerializeObject(e));
}
await outputEvents.FlushAsync();
logger.LogInformation($"{events.Count()} Events sent successfully");
}
public static async Task<IList<Dictionary<string, object>>> FetchEvents(this LogAnalyticQuery query, string after, string to)
{
var q = $@"union withsource=SourceTable *
| extend ItemId = _ItemId
| extend _ingestionTime = ingestion_time()
| extend cursor = format_datetime(_ingestionTime,'yyyy-MM-dd HH:mm:ss.fffffff')
| where _ingestionTime > {after}
| where _ingestionTime <= {to}
| order by _ingestionTime asc";
return await query.ExecuteQuery(workspaceId, q);
}
public static async IAsyncEnumerable<Summary> GetCursorRanges(this LogAnalyticQuery query, string lastCursor, string safetyLag, int limit)
{
//Making 1 second grouped ranges for better performances
var q = $@"union withsource=SourceTable *
| extend ItemId = _ItemId
| extend _ingestionTime = ingestion_time()
| extend cursor = format_datetime(_ingestionTime,'yyyy-MM-dd HH:mm:ss.fffffff')
| where _ingestionTime > datetime({lastCursor})
| where _ingestionTime <= {safetyLag}
| order by _ingestionTime asc
| limit 10000
| summarize max(cursor), count() by bin(_ingestionTime, 1s)";
var cursors = await query.GetNextCursors(workspaceId, q, limit);
foreach (var c in cursors)
{
yield return new Summary(lastCursor, c.Item1) { EventsCount = c.Item2 };
lastCursor = c.Item1;
}
}
}
}
| 42.857143 | 146 | 0.603867 |
ead7407e6065a6e6a637937fdda4ba349bac8525 | 6,542 | cs | C# | obj/Debug/netcoreapp2.2/ubuntu.18.04-x64/Razor/Views/User/Library.g.cshtml.cs | SeniorOverflow/Diplom_SoftSpace | 958635258caaa09c08b3cec99435e73eeda4230e | [
"MIT"
] | 3 | 2021-04-03T12:26:25.000Z | 2022-03-06T04:27:52.000Z | obj/Release/netcoreapp2.2/Razor/Views/User/Library.g.cshtml.cs | SeniorOverflow/Diplom_SoftSpace | 958635258caaa09c08b3cec99435e73eeda4230e | [
"MIT"
] | null | null | null | obj/Release/netcoreapp2.2/Razor/Views/User/Library.g.cshtml.cs | SeniorOverflow/Diplom_SoftSpace | 958635258caaa09c08b3cec99435e73eeda4230e | [
"MIT"
] | null | null | null | #pragma checksum "E:\diploma_project_here\SoftSpace_web\Views\User\Library.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "a0e3a15752279720104072cc052ef3ac6cccb4e1"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.Views_User_Library), @"mvc.1.0.view", @"/Views/User/Library.cshtml")]
[assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/Views/User/Library.cshtml", typeof(AspNetCore.Views_User_Library))]
namespace AspNetCore
{
#line hidden
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
#line 1 "E:\diploma_project_here\SoftSpace_web\Views\_ViewImports.cshtml"
using SoftSpace_web;
#line default
#line hidden
#line 2 "E:\diploma_project_here\SoftSpace_web\Views\_ViewImports.cshtml"
using SoftSpace_web.Models;
#line default
#line hidden
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"a0e3a15752279720104072cc052ef3ac6cccb4e1", @"/Views/User/Library.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"4d30cee2550be9db46aaba39048f361d201242e2", @"/Views/_ViewImports.cshtml")]
public class Views_User_Library : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage<dynamic>
{
#pragma warning disable 1998
public async override global::System.Threading.Tasks.Task ExecuteAsync()
{
BeginContext(1, 44, false);
#line 1 "E:\diploma_project_here\SoftSpace_web\Views\User\Library.cshtml"
Write(await Component.InvokeAsync("Menu" , new {}));
#line default
#line hidden
EndContext();
BeginContext(45, 6, true);
WriteLiteral("\r\n<h1>");
EndContext();
BeginContext(52, 27, false);
#line 2 "E:\diploma_project_here\SoftSpace_web\Views\User\Library.cshtml"
Write(ViewBag.Translate_words[58]);
#line default
#line hidden
EndContext();
BeginContext(79, 109, true);
WriteLiteral("</h1>\r\n\r\n\r\n\r\n\r\n<table class=\"table\">\r\n <thead class=\"thead-light\">\r\n <tr>\r\n \r\n <th scope=\"col\">");
EndContext();
BeginContext(189, 27, false);
#line 11 "E:\diploma_project_here\SoftSpace_web\Views\User\Library.cshtml"
Write(ViewBag.Translate_words[22]);
#line default
#line hidden
EndContext();
BeginContext(216, 29, true);
WriteLiteral("</th>\r\n <th scope=\"col\">");
EndContext();
BeginContext(246, 27, false);
#line 12 "E:\diploma_project_here\SoftSpace_web\Views\User\Library.cshtml"
Write(ViewBag.Translate_words[23]);
#line default
#line hidden
EndContext();
BeginContext(273, 29, true);
WriteLiteral("</th>\r\n <th scope=\"col\">");
EndContext();
BeginContext(303, 27, false);
#line 13 "E:\diploma_project_here\SoftSpace_web\Views\User\Library.cshtml"
Write(ViewBag.Translate_words[65]);
#line default
#line hidden
EndContext();
BeginContext(330, 29, true);
WriteLiteral("</th>\r\n <th scope=\"col\">");
EndContext();
BeginContext(360, 27, false);
#line 14 "E:\diploma_project_here\SoftSpace_web\Views\User\Library.cshtml"
Write(ViewBag.Translate_words[66]);
#line default
#line hidden
EndContext();
BeginContext(387, 41, true);
WriteLiteral("</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n");
EndContext();
#line 18 "E:\diploma_project_here\SoftSpace_web\Views\User\Library.cshtml"
foreach( var a in @ViewBag.Lib)
{
#line default
#line hidden
BeginContext(466, 32, true);
WriteLiteral(" <tr>\r\n <th scope=\"row\">");
EndContext();
BeginContext(499, 4, false);
#line 21 "E:\diploma_project_here\SoftSpace_web\Views\User\Library.cshtml"
Write(a[1]);
#line default
#line hidden
EndContext();
BeginContext(503, 17, true);
WriteLiteral("</th>\r\n <td>");
EndContext();
BeginContext(521, 4, false);
#line 22 "E:\diploma_project_here\SoftSpace_web\Views\User\Library.cshtml"
Write(a[2]);
#line default
#line hidden
EndContext();
BeginContext(525, 17, true);
WriteLiteral("</td>\r\n <td>");
EndContext();
BeginContext(543, 4, false);
#line 23 "E:\diploma_project_here\SoftSpace_web\Views\User\Library.cshtml"
Write(a[3]);
#line default
#line hidden
EndContext();
BeginContext(547, 17, true);
WriteLiteral("</td>\r\n <td>");
EndContext();
BeginContext(565, 4, false);
#line 24 "E:\diploma_project_here\SoftSpace_web\Views\User\Library.cshtml"
Write(a[4]);
#line default
#line hidden
EndContext();
BeginContext(569, 18, true);
WriteLiteral("</td>\r\n </tr>\r\n");
EndContext();
#line 26 "E:\diploma_project_here\SoftSpace_web\Views\User\Library.cshtml"
}
#line default
#line hidden
BeginContext(595, 10, true);
WriteLiteral("\r\n</table>");
EndContext();
}
#pragma warning restore 1998
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<dynamic> Html { get; private set; }
}
}
#pragma warning restore 1591
| 39.409639 | 168 | 0.652094 |
3ab249f3977cf1d1e8eb63b404b2531e3566abe1 | 325 | cs | C# | services/catalog/src/EShopOnAbp.CatalogService.Domain.Shared/Products/ProductEto.cs | hpstory/eShopOnAbp | 99ab301aba266d5542d21ee06622a62d0a000f81 | [
"MIT"
] | 242 | 2021-07-06T07:26:14.000Z | 2022-03-27T01:50:36.000Z | services/catalog/src/EShopOnAbp.CatalogService.Domain.Shared/Products/ProductEto.cs | hpstory/eShopOnAbp | 99ab301aba266d5542d21ee06622a62d0a000f81 | [
"MIT"
] | 17 | 2021-07-28T07:56:38.000Z | 2022-03-24T09:45:42.000Z | services/catalog/src/EShopOnAbp.CatalogService.Domain.Shared/Products/ProductEto.cs | hpstory/eShopOnAbp | 99ab301aba266d5542d21ee06622a62d0a000f81 | [
"MIT"
] | 73 | 2021-07-06T07:26:36.000Z | 2022-03-26T01:45:23.000Z | using System;
namespace EShopOnAbp.CatalogService.Products;
public class ProductEto
{
public Guid Id { get; set; }
public string Code { get; set; }
public string Name { get; set; }
public float Price { get; set; }
public int StockCount { get; set; }
public string ImageName { get; set; }
} | 18.055556 | 45 | 0.643077 |
29f19f9b8f252f0ea1f59001a3cc36479d83994d | 903 | cs | C# | src/MonitoringFunctions/DataService/Providers/DummyDataService.cs | amos402/install-scripts | ca03088d777fb308610b1c69999b9ecb9697d53a | [
"MIT"
] | null | null | null | src/MonitoringFunctions/DataService/Providers/DummyDataService.cs | amos402/install-scripts | ca03088d777fb308610b1c69999b9ecb9697d53a | [
"MIT"
] | null | null | null | src/MonitoringFunctions/DataService/Providers/DummyDataService.cs | amos402/install-scripts | ca03088d777fb308610b1c69999b9ecb9697d53a | [
"MIT"
] | null | null | null | // Copyright (c) Microsoft. All rights reserved.
using System;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
namespace MonitoringFunctions.Providers
{
internal sealed class DummyDataService : IDataService
{
public async Task ReportUrlAccessAsync(string monitorName, HttpResponseMessage httpResponse, CancellationToken cancellationToken = default)
{
await Task.Delay(new Random().Next(200, 4000), cancellationToken).ConfigureAwait(false);
}
public async Task ReportScriptExecutionAsync(string monitorName, string scriptName, string commandLineArgs, string error, CancellationToken cancellationToken = default)
{
await Task.Delay(new Random().Next(200, 4000), cancellationToken).ConfigureAwait(false);
}
public void Dispose()
{
// Do nothing
}
}
}
| 31.137931 | 176 | 0.698782 |
082ce6050d89b3a6ec62c3acf61a5be513110dc4 | 5,521 | cs | C# | System/Xml/Linq/XContentHandler.cs | Dot42Xna/master | 41920ff1e3c5e92944db0345de940660a7006652 | [
"Apache-2.0"
] | 1 | 2018-10-24T06:19:31.000Z | 2018-10-24T06:19:31.000Z | System/Xml/Linq/XContentHandler.cs | Dot42Xna/master | 41920ff1e3c5e92944db0345de940660a7006652 | [
"Apache-2.0"
] | null | null | null | System/Xml/Linq/XContentHandler.cs | Dot42Xna/master | 41920ff1e3c5e92944db0345de940660a7006652 | [
"Apache-2.0"
] | null | null | null | // Copyright (C) 2014 dot42
//
// Original filename: XContentHandler.cs
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System.Text;
using Java.Util;
using Org.Xml.Sax;
namespace System.Xml.Linq
{
internal class XContentHandler : IContentHandler, IErrorHandler
{
private readonly LoadOptions options;
private XDocument document;
private readonly Stack<XElement> elementStack = new Stack<XElement>();
/// <summary>
/// Default ctor
/// </summary>
internal XContentHandler(LoadOptions options)
{
this.options = options;
}
/// <summary>
/// Gets the generated document.
/// </summary>
internal XDocument Document
{
get { return document; }
}
public void SetDocumentLocator(ILocator locator)
{
}
public void StartDocument()
{
document = new XDocument();
}
public void EndDocument()
{
}
public void StartPrefixMapping(string prefix, string uri)
{
}
public void EndPrefixMapping(string prefix)
{
}
/// <summary>
/// <para>Receive notification of the beginning of an element.</para><para>The Parser will invoke this method at the beginning of every element in the XML document; there will be a corresponding endElement event for every startElement event (even when the element is empty). All of the element's content will be reported, in order, before the corresponding endElement event.</para><para>This event allows up to three name components for each element:</para><para><ol><li><para>the Namespace URI; </para></li><li><para>the local name; and </para></li><li><para>the qualified (prefixed) name. </para></li></ol></para><para>Any or all of these may be provided, depending on the values of the <b></b> and the <b></b> properties:</para><para><ul><li><para>the Namespace URI and local name are required when the namespaces property is <b>true</b> (the default), and are optional when the namespaces property is <b>false</b> (if one is specified, both must be); </para></li><li><para>the qualified name is required when the namespace-prefixes property is <b>true</b>, and is optional when the namespace-prefixes property is <b>false</b> (the default). </para></li></ul></para><para>Note that the attribute list provided will contain only attributes with explicit values (specified or defaulted): #IMPLIED attributes will be omitted. The attribute list will contain attributes used for Namespace declarations (xmlns* attributes) only if the <code></code> property is true (it is false by default, and support for a true value is optional).</para><para>Like characters(), attribute values may have characters that need more than one <code>char</code> value. </para><para><para>endElement </para><simplesectsep></simplesectsep><para>org.xml.sax.Attributes </para><simplesectsep></simplesectsep><para>org.xml.sax.helpers.AttributesImpl </para></para>
/// </summary>
public void StartElement(string uri, string localName, string qName, IAttributes atts)
{
var element = new XElement(XName.Get(localName, uri));
var parent = elementStack.Empty() ? null : elementStack.Peek();
if (parent == null)
{
document.Add(element);
}
else
{
parent.Add(element);
}
var attrCount = atts.GetLength();
for (var i = 0; i < attrCount; i++)
{
var name = XName.Get(atts.GetLocalName(i), atts.GetURI(i));
var attr = new XAttribute(name, atts.GetValue(i));
element.Add(attr);
}
elementStack.Push(element);
}
public void EndElement(string uri, string localName, string qName)
{
elementStack.Pop();
}
public void Characters(char[] ch, int start, int length)
{
var element = elementStack.Peek();
if (element == null) return;
var lastTextNode = element.LastNode as XText;
if (lastTextNode != null)
{
//append text
var builder = new StringBuilder(lastTextNode.Value);
builder.Append(ch, start, length);
lastTextNode.Value = builder.ToString();
}
else
{
//add text
var builder = new StringBuilder();
builder.Append(ch, start, length);
element.Add(new XText(builder.ToString()));
}
}
public void IgnorableWhitespace(char[] ch, int start, int length)
{
}
public void ProcessingInstruction(string target, string data)
{
}
public void SkippedEntity(string name)
{
}
public void Warning(SAXParseException exception)
{
}
public void Error(SAXParseException exception)
{
}
public void FatalError(SAXParseException exception)
{
}
}
}
| 38.608392 | 1,852 | 0.638834 |
bc29d115749105225fc76277a22601a5b3447891 | 4,100 | cs | C# | Relativision2/Assets/Scripts/UIManager.cs | khorotyan/relativision_2 | 270ae76fcad8809040876b4c90119a34f203f63f | [
"MIT"
] | null | null | null | Relativision2/Assets/Scripts/UIManager.cs | khorotyan/relativision_2 | 270ae76fcad8809040876b4c90119a34f203f63f | [
"MIT"
] | null | null | null | Relativision2/Assets/Scripts/UIManager.cs | khorotyan/relativision_2 | 270ae76fcad8809040876b4c90119a34f203f63f | [
"MIT"
] | null | null | null | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class UIManager : MonoBehaviour {
public bool isSpaceScene = true;
public ViewerSpace viewerSpace;
public Viewer viewer;
[Space(10)]
public Button restartB;
public Text lightSpeedT;
public Slider lightSpeedS;
public Text accelerationT;
public Slider accelerationS;
public Text inBetDistT;
public Slider inBetDistS;
public Button nextSceneB;
public InputField velocityIn;
public Toggle accelerationToggle;
public Button twinSceneB;
public Toggle pauseToggle;
private void Awake()
{
restartB.onClick.AddListener(delegate { SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); ResetTimeScale(); });
if (isSpaceScene == true)
viewerSpace.vel = lightSpeedS.value * viewerSpace.velPercentage;
else
viewer.vel = lightSpeedS.value * viewer.velPercentage;
lightSpeedS.onValueChanged.AddListener(delegate
{
if (isSpaceScene == true)
viewerSpace.vel = lightSpeedS.value * viewerSpace.velPercentage;
else
viewer.vel = lightSpeedS.value * viewer.velPercentage;
Formulas.lightSpeed = lightSpeedS.value;
lightSpeedT.text = "Light Speed: " + lightSpeedS.value;
accelerationS.minValue = lightSpeedS.value * 0.002f;
accelerationS.maxValue = lightSpeedS.value * 0.20f;
});
accelerationS.onValueChanged.AddListener(delegate
{
if (isSpaceScene == true)
viewerSpace.acceleration = accelerationS.value;
else
viewer.acceleration = accelerationS.value;
accelerationT.text = "Acceleration: " + accelerationS.value.ToString("F2");
});
inBetDistS.onValueChanged.AddListener(delegate
{
if (isSpaceScene == true)
viewerSpace.inObjDist = inBetDistS.value;
else
viewer.inObjDist = inBetDistS.value;
inBetDistT.text = "In Object Distance: " + inBetDistS.value;
});
velocityIn.onEndEdit.AddListener(delegate
{
string input = velocityIn.text;
if (input[velocityIn.text.Length - 1] == '%')
input = input.Remove(input.Length - 1);
float vel = float.MaxValue;
try
{
vel = float.Parse(input);
}
catch (System.Exception)
{
velocityIn.text = "Input is invalid";
}
if (vel != float.MaxValue)
{
if (isSpaceScene == true)
viewerSpace.vel = vel * Formulas.lightSpeed / 100;
else
viewer.vel = vel * Formulas.lightSpeed / 100;
}
if (vel > 98) vel = 98;
else if (vel < -98) vel = -98;
velocityIn.text = "Velocity: " + vel + "%";
});
accelerationToggle.onValueChanged.AddListener(delegate
{
if (isSpaceScene == true)
viewerSpace.alwaysAccelerate = accelerationToggle.isOn;
else
viewer.alwaysAccelerate = accelerationToggle.isOn;
});
twinSceneB.onClick.AddListener(delegate { SceneManager.LoadScene(2); ResetTimeScale(); });
if (isSpaceScene == true)
nextSceneB.onClick.AddListener(delegate { SceneManager.LoadScene(1); ResetTimeScale(); });
else
nextSceneB.onClick.AddListener(delegate { SceneManager.LoadScene(0); ResetTimeScale(); });
pauseToggle.onValueChanged.AddListener(delegate
{
if (pauseToggle.isOn)
Time.timeScale = 0;
else
Time.timeScale = 1;
});
}
private void ResetTimeScale()
{
if (Time.timeScale != 1)
Time.timeScale = 1;
}
}
| 31.29771 | 135 | 0.578049 |
3bbabf82a534e09a13b5b26acb40327341356a1b | 4,062 | cs | C# | src/Evolve.Cli/Options.cs | iainnicol/Evolve | ad62de1132b1c8d78677a007d9cbfe2d83b1dbd4 | [
"MIT"
] | null | null | null | src/Evolve.Cli/Options.cs | iainnicol/Evolve | ad62de1132b1c8d78677a007d9cbfe2d83b1dbd4 | [
"MIT"
] | null | null | null | src/Evolve.Cli/Options.cs | iainnicol/Evolve | ad62de1132b1c8d78677a007d9cbfe2d83b1dbd4 | [
"MIT"
] | null | null | null | using System.Collections.Generic;
using CommandLine;
namespace Evolve.Cli
{
internal abstract class Options
{
public abstract string Driver { get; }
[Value(0, MetaName = "command", Required = true, HelpText = "migrate | erase | repair")]
public Command Command { get; set; }
[Option('c', "connection-string", Required = true, HelpText = "The connection string to the target database engine. Must have the necessary privileges to execute ddl.")]
public string ConnectionString { get; set; }
[Option('p', "driver-assembly-path", Required = true, HelpText = "Path to the application folder to migrate or to any folder that contains database driver assemblies.")]
public string DriverAssemblyPath { get; set; }
[Option('l', "locations", Default = new[] { "Sql_Scripts" }, HelpText = "Paths to scan recursively for migration scripts.")]
public IEnumerable<string> Locations { get; set; }
[Option('t', "metadata-table", Default = "changelog", HelpText = "The name of the metadata table.")]
public string MetadataTableName { get; set; }
[Option('v', "target-version", Required = false, HelpText = "Target version to reach. If empty it evolves all the way up.")]
public string TargetVersion { get; set; }
[Option("start-version", Default = "0", HelpText = "Version used as starting point for already existing databases.")]
public string StartVersion { get; set; }
[Option("out-of-order", Default = false, HelpText = "Allows migration scripts to be run “out of order”. If you already have versions 1 and 3 applied, and now a version 2 is found, it will be applied too instead of being ignored.")]
public bool OutOfOrder { get; set; }
[Option("erase-disabled", Default = false, HelpText = "When set, ensures that Evolve will never erase schemas. Highly recommended in production.")]
public bool EraseDisabled { get; set; }
[Option("erase-on-validation-error", Default = false, HelpText = "When set, if validation phase fails, Evolve will erase the database schemas and will re-execute migration scripts from scratch. Intended to be used in development only.")]
public bool EraseOnValidationError { get; set; }
[Option("command-timeout", Default = 30, HelpText = "The wait time in seconds before terminating the attempt to execute a migration and generating an error.")]
public int CommandTimeout { get; set; }
[Option("encoding", Default = "UTF-8", HelpText = "The encoding of migration scripts.")]
public string Encoding { get; set; }
[Option("scripts-prefix", Default = "V", HelpText = "Migration scripts file names prefix")]
public string MigrationScriptsPrefix { get; set; }
[Option("scripts-separator", Default = "__", HelpText = "Migration scripts file names separator")]
public string MigrationScriptsSeparator { get; set; }
[Option("scripts-suffix", Default = ".sql", HelpText = "Migration scripts files extension.")]
public string ScriptsSuffix { get; set; }
[Option("placeholder-prefix", Default = "${", HelpText = "The prefix of the placeholders.")]
public string PlaceholderPrefix { get; set; }
[Option("placeholder-suffix", Default = "}", HelpText = "The suffix of the placeholders.")]
public string PlaceholderSuffix { get; set; }
[Option("placeholders", Required = false, HelpText = "Placeholders are strings to replace in migration scripts. Format for commandline is \"key:value\".")]
public IEnumerable<string> Placeholders { get; set; }
[Option("disable-cluster-mode", Default = false, HelpText = "By default, Evolve will use a session level lock to coordinate the migration on multiple nodes. This prevents two distinct Evolve executions from executing an Evolve command on the same database at the same time. If this flag is set, it will not be the case.")]
public bool DisableClusterMode { get; set; }
}
}
| 59.735294 | 330 | 0.680453 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.