source
stringclasses 1
value | id
stringlengths 40
40
| language
stringclasses 2
values | date
stringclasses 1
value | author
stringclasses 1
value | url
stringclasses 1
value | title
stringclasses 1
value | extra
stringlengths 528
1.53k
| quality_signals
stringlengths 139
178
| text
stringlengths 6
1.05M
|
---|---|---|---|---|---|---|---|---|---|
TheStack | e8b37c0ed2c125c6d8dd589201fd5f1c10ea51bd | C#code:C# | {"size": 7577, "ext": "cs", "max_stars_repo_path": "InternalLibraries/ZionWeb.UnitTests/DAL/DatasetTableDetailsDataAccessTests.cs", "max_stars_repo_name": "gagandeepgarg/Centralized-Data-Ingestion-Outgestion", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "InternalLibraries/ZionWeb.UnitTests/DAL/DatasetTableDetailsDataAccessTests.cs", "max_issues_repo_name": "gagandeepgarg/Centralized-Data-Ingestion-Outgestion", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "InternalLibraries/ZionWeb.UnitTests/DAL/DatasetTableDetailsDataAccessTests.cs", "max_forks_repo_name": "gagandeepgarg/Centralized-Data-Ingestion-Outgestion", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 39.8789473684, "max_line_length": 191, "alphanum_fraction": 0.6818001848} | using Moq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xunit;
using ZionWeb.DAL;
using ZionWeb.DAL.Entities;
using ZionWeb.UnitTests.Utility;
namespace ZionWeb.UnitTests.DAL.DatasetTableDetailsDataAccessTests
{
public class DatasetTableDetailsDataAccessTests
{
public Mock<ZionContext> _dbContext = null;
public DatasetTableDetailsDataAccess _dataAccess = null;
public DatasetTableDetailsDataAccessTests()
{
_dbContext = new Mock<ZionContext>("");
_dataAccess = new DatasetTableDetailsDataAccess("", _dbContext.Object);
}
}
public class GetAllDatasetTableDetails: DatasetTableDetailsDataAccessTests
{
[Theory]
[InlineData(1000, 1001)]
public void given_dataset_table_details_when_retrieved_verify_dataset_table_details(int input1, int input2)
{
var data = new FakeDbSet<DatasetTableDetails>() { Parameters<DatasetTableDetails>.GetSingle(input1), Parameters<DatasetTableDetails>.GetSingle(input2) };
_dbContext.Setup(d => d.DatasetTableDetails).Returns(data);
var result = _dataAccess.GetAllDatasetTableDetails();
Assert.NotNull(result);
Assert.True(result.Count() > 0);
Assert.IsType<List<DatasetTableDetails>>(result);
}
[Fact]
public void given_dataset_table_details_with_null_context_when_retrived_throws_exception()
{
Exception ex = Assert.Throws<ArgumentNullException>(() => _dataAccess.GetAllDatasetTableDetails());
Assert.Contains("Value cannot be null.", ex.Message);
}
}
public class AddDatasetTableDetails: DatasetTableDetailsDataAccessTests
{
[Theory]
[InlineData(1000, 1001)]
public void given_dataset_table_details_when_added_then_dataset_table_details_gets_created(int input1, int input2)
{
var data = new FakeDbSet<DatasetTableDetails>() { Parameters<DatasetTableDetails>.GetSingle(input1), Parameters<DatasetTableDetails>.GetSingle(input2) };
var input = Parameters<DatasetTableDetails>.GetSingle(input2);
_dbContext.Setup(db => db.DatasetTableDetails.Add(input)).Returns(() => _dbContext.Object.Entry(input)).Callback(() => _dbContext.Setup(d => d.DatasetTableDetails).Returns(data));
var result = _dataAccess.AddDatasetTableDetails(input);
_dbContext.Verify(x => x.SaveChanges(), Times.Once());
Assert.Equal(input2, result);
}
[Fact]
public void given_scheduling_details_with_null_context_when_added_throws_exception()
{
Exception ex = Assert.Throws<NullReferenceException>(() => _dataAccess.AddDatasetTableDetails(It.IsAny<DatasetTableDetails>()));
Assert.Contains("Object reference not set", ex.Message);
}
}
public class UpdateDatasetTableDetails: DatasetTableDetailsDataAccessTests
{
[Theory(Skip = "Update issue with context.entry")]
[InlineData(1000)]
public void given_dataset_table_details_when_edited_then_updates_dataset_table_details(int input1)
{
var input = Parameters<DatasetTableDetails>.GetSingle(input1);
var expected = new FakeDbSet<DatasetTableDetails>() { Parameters<DatasetTableDetails>.GetSingle(input1) };
_dbContext.Setup(db => db.DatasetTableDetails).Returns(expected);
//_dbContext.Setup(x => x.Entry(input)).Returns(() => _dbContext.Object.Entry(input)).Callback(() => _dbContext.Setup(db => db.DatasetFileDetails).Returns(expected));
_dataAccess.UpdateDatasetTableDetails(input);
}
}
public class GetDatasetTableDetailsData: DatasetTableDetailsDataAccessTests
{
[Theory]
[InlineData(1000)]
public void given_dataset_detail_id_when_retrieved_verify_dataset_details(int input1)
{
var data = Parameters<DatasetTableDetails>.GetSingle(input1);
_dbContext.Setup(db => db.DatasetTableDetails.Find(input1)).Returns(data);
var result = _dataAccess.GetDatasetTableDetailsData(input1);
Assert.NotNull(result);
Assert.IsType(data.GetType(), result);
Assert.Equal(input1, result.DatasetDetailId);
}
[Fact]
public void given_dataset_id_with_null_context_when_retrived_throws_exception()
{
Exception ex = Assert.Throws<NullReferenceException>(() => _dataAccess.GetDatasetTableDetailsData(It.IsAny<int>()));
Assert.Contains("Object reference not set", ex.Message);
}
}
public class GetDetailsByDataSetId: DatasetTableDetailsDataAccessTests
{
[Theory]
[InlineData(1000, 1001)]
public void given_dataset_id_when_retrieved_then_verify_dataset(int input1, int input2)
{
//var data = Parameters<DatasetTableDetails>.GetSingle(datasetId);
var data = new FakeDbSet<DatasetTableDetails>() { Parameters<DatasetTableDetails>.GetSingle(input1), Parameters<DatasetTableDetails>.GetSingle(input2) };
_dbContext.Setup(d => d.DatasetTableDetails).Returns(data);
var result = _dataAccess.GetDetailsByDataSetId(input2);
Assert.NotNull(result);
Assert.Equal(input2, result.DatasetId);
}
[Fact]
public void given_dataset_id_with_null_context_when_retrieved_throws_exception()
{
Exception ex = Assert.Throws<ArgumentNullException>(() => _dataAccess.GetDetailsByDataSetId(It.IsAny<int>()));
Assert.Contains("Value cannot be null.", ex.Message);
}
}
public class UpdateDataSetDBDetailsByDataSetID: DatasetTableDetailsDataAccessTests
{
[Theory(Skip = "Update issue with context.entry")]
[InlineData(1000)]
public void given_dataset_table_details_when_edited_then_updates_dataset_table_details(int input1)
{
var input = Parameters<DatasetTableDetails>.GetSingle(input1);
var expected = new FakeDbSet<DatasetTableDetails>() { Parameters<DatasetTableDetails>.GetSingle(input1) };
_dbContext.Setup(db => db.DatasetTableDetails).Returns(expected);
//_dbContext.Setup(x => x.Entry(input)).Returns(() => _dbContext.Object.Entry(input)).Callback(() => _dbContext.Setup(db => db.DatasetFileDetails).Returns(expected));
_dataAccess.UpdateDatasetTableDetails(input);
}
}
public class DeleteDatasetTableDetails: DatasetTableDetailsDataAccessTests
{
[Theory]
[InlineData(1000)]
public void given_dataset_detail_id_when_deleted_verify_dataset_table_detail_is_deleted(int input1)
{
var data = Parameters<DatasetTableDetails>.GetSingle(input1);
_dbContext.Setup(db => db.DatasetTableDetails.Find(input1)).Returns(data);
_dbContext.Setup(db => db.DatasetTableDetails.Remove(data));
var result = _dataAccess.DeleteDatasetTableDetails(input1);
Assert.Equal(1, result);
_dbContext.Verify(x => x.SaveChanges(), Times.Once());
}
[Fact]
public void given_dataset_file_id_with_null_context_when_deleted_throws_exception()
{
Exception ex = Assert.Throws<NullReferenceException>(() => _dataAccess.DeleteDatasetTableDetails(It.IsAny<int>()));
Assert.Contains("Object reference not set", ex.Message);
}
}
}
|
||||
TheStack | e8b57a818c8c932d303d1e8e1fb60888c6bd6085 | C#code:C# | {"size": 1220, "ext": "cs", "max_stars_repo_path": "NewsCollector.Services/NewsKeywordService.cs", "max_stars_repo_name": "svbnbyrk/news-collector", "max_stars_repo_stars_event_min_datetime": "2021-05-29T11:04:23.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-01T13:55:21.000Z", "max_issues_repo_path": "NewsCollector.Services/NewsKeywordService.cs", "max_issues_repo_name": "svbnbyrk/news-collector", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "NewsCollector.Services/NewsKeywordService.cs", "max_forks_repo_name": "svbnbyrk/news-collector", "max_forks_repo_forks_event_min_datetime": "2021-05-29T11:04:27.000Z", "max_forks_repo_forks_event_max_datetime": "2021-07-28T11:45:41.000Z"} | {"max_stars_count": 4.0, "max_issues_count": null, "max_forks_count": 2.0, "avg_line_length": 29.0476190476, "max_line_length": 81, "alphanum_fraction": 0.6672131148} | using NewsCollector.Core;
using NewsCollector.Core.Models;
using NewsCollector.Core.Services;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace NewsCollector.Services
{
public class NewsKeywordService : INewsKeywordService
{
private readonly IUnitOfWork _unitOfWork;
public NewsKeywordService(IUnitOfWork unitOfWork)
{
_unitOfWork = unitOfWork;
}
public async Task<NewsKeyword> CreateNewsKeyword(NewsKeyword newsKeyword)
{
await _unitOfWork.NewsKeywords.AddAsync(newsKeyword);
await _unitOfWork.CommitAsync();
return (newsKeyword);
}
public async Task DeleteNewsKeyword(NewsKeyword newsKeyword)
{
_unitOfWork.NewsKeywords.Remove(newsKeyword);
await _unitOfWork.CommitAsync();
}
public async Task<IEnumerable<NewsKeyword>> GetAllNewsKeyword()
{
return await _unitOfWork.NewsKeywords.GetAllAsync();
}
public async Task<NewsKeyword> GetNewsKeywordById(int id)
{
return await _unitOfWork.NewsKeywords.GetByIdAsync(id);
}
}
}
|
||||
TheStack | e8b93d407c2f2aa9032ea0122fb0d81ab31f3df4 | C#code:C# | {"size": 2683, "ext": "cs", "max_stars_repo_path": "HashCompareLib/Hash.cs", "max_stars_repo_name": "JannoTjarks/HashCompare", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "HashCompareLib/Hash.cs", "max_issues_repo_name": "JannoTjarks/HashCompare", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "HashCompareLib/Hash.cs", "max_forks_repo_name": "JannoTjarks/HashCompare", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 30.8390804598, "max_line_length": 96, "alphanum_fraction": 0.5080134178} | using System;
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;
namespace HashCompareLib
{
/// <summary>
/// This class performs all tasks concerning the hashing.
/// </summary>
public static class Hash
{
private static List<String> hashMethods = new List<String>()
{
"MD5",
"SHA-1",
"SHA-256",
"SHA-384",
"SHA-512"
};
public static List<String> HashMethods { get => hashMethods; }
// Hash the stream with the chosen hash-method with the given method
public static HashAlgorithm GetHashAlgorithm(String hashMethod)
{
HashAlgorithm hashAlgorithm = null;
switch (hashMethod)
{
case "MD5":
hashAlgorithm = MD5.Create();
break;
case "SHA-1":
hashAlgorithm = SHA1.Create();
break;
case "SHA-256":
hashAlgorithm = SHA256.Create();
break;
case "SHA-384":
hashAlgorithm = SHA384.Create();
break;
case "SHA-512":
hashAlgorithm = SHA512.Create();
break;
default:
break;
}
return hashAlgorithm;
}
public static string GetHashAsString(HashAlgorithm hashAlgorithm, FileStream fileStream)
{
var hash = hashAlgorithm.ComputeHash(fileStream);
fileStream.Dispose();
return ConvertByteArrayToString(hash);
}
// Hash the string with the chosen hash-method with the given method
public static string GetHashAsString(HashAlgorithm hashMethod, String hashString)
{
var hashStringAsArray = new byte[hashString.Length];
for (int i = 0; i < hashString.Length; i++) {
hashStringAsArray[i] = Convert.ToByte(hashString[i]);
}
var hash = hashMethod.ComputeHash(hashStringAsArray);
return ConvertByteArrayToString(hash);
}
// Converts the hash byte-array to a string with lowercase and return that
private static string ConvertByteArrayToString(byte[] array)
{
var hash = String.Empty;
for (int i = 0; i < array.Length; i++)
{
hash += (String.Format("{0:X2}", array[i]));
}
return hash.ToLower(); ;
}
}
} |
||||
TheStack | e8ba00824e625f91d9ae877738563f625b97430f | C#code:C# | {"size": 2833, "ext": "cs", "max_stars_repo_path": "SharedLibrary/Models/ApplicationModel.cs", "max_stars_repo_name": "sapoi/MetaRMS", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "SharedLibrary/Models/ApplicationModel.cs", "max_issues_repo_name": "sapoi/MetaRMS", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "SharedLibrary/Models/ApplicationModel.cs", "max_forks_repo_name": "sapoi/MetaRMS", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 36.7922077922, "max_line_length": 119, "alphanum_fraction": 0.6152488528} | using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using Newtonsoft.Json;
using SharedLibrary.Descriptors;
namespace SharedLibrary.Models
{
/// <summary>
/// ApplicationModel is a model of one application from database "applications" table.
/// </summary>
[Table("applications")]
public class ApplicationModel : IBaseModel
{
/// <summary>
/// Id property.
/// </summary>
/// <value>Id is a unique identificator of application in database.</value>
[Key]
[Column("id")]
public long Id { get; set; }
/// <summary>
/// LoginApplicationName property.
/// </summary>
/// <value>LoginApplicationName is a unique string representation of a application used for user login.</value>
[Required]
[Column("login_application_name")]
public string LoginApplicationName { get; set; }
/// <summary>
/// ApplicationDescriptorJSON property.
/// </summary>
/// <value>ApplicationDescriptorJSON contains application descriptor in JSON format.</value>
[Required]
[Column("descriptor")]
public string ApplicationDescriptorJSON { get; set; }
/// <summary>
/// Users property.
/// </summary>
/// <value>Users property contains all UserModels associated with the application.</value>
[InverseProperty("Application")]
public List<UserModel> Users { get; set; }
/// <summary>
/// Rights property.
/// </summary>
/// <value>Rights property contains all RightsModels associated with the application.</value>
[InverseProperty("Application")]
public List<RightsModel> Rights { get; set; }
/// <summary>
/// Datas property.
/// </summary>
/// <value>Datas property contains all DataModels associated with the application.</value>
[InverseProperty("Application")]
public List<DataModel> Datas { get; set; }
/// <summary>
/// ApplicationDescriptor property.
/// </summary>
/// <value>Deserializer ApplicationDescriptorJSON value.</value>
[JsonIgnore]
public ApplicationDescriptor ApplicationDescriptor
{
get
{
return JsonConvert.DeserializeObject<ApplicationDescriptor>(ApplicationDescriptorJSON);
}
}
/// <summary>
/// GetUsernameAttribute method.
/// </summary>
/// <returns>AttributeDescriptor describing username.</returns>
public AttributeDescriptor GetUsernameAttribute()
{
return this.ApplicationDescriptor.GetUsernameAttribute();
}
}
} |
||||
TheStack | e8bb12c19d1662ce72fc120419aeb0c216bf5d4e | C#code:C# | {"size": 4446, "ext": "cs", "max_stars_repo_path": "GIP/Controls/Ctrl_UniformVariableInfoView.cs", "max_stars_repo_name": "RT-EGG/GIP", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "GIP/Controls/Ctrl_UniformVariableInfoView.cs", "max_issues_repo_name": "RT-EGG/GIP", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "GIP/Controls/Ctrl_UniformVariableInfoView.cs", "max_forks_repo_name": "RT-EGG/GIP", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 31.7571428571, "max_line_length": 160, "alphanum_fraction": 0.4930274404} | using System;
using System.Data;
using System.Linq;
using System.Windows.Forms;
using GIP.Common;
using GIP.Core.Uniforms;
using GIP.Core.Variables;
using GIP.Controls.UniformVariableValues;
namespace GIP.Controls
{
public partial class Ctrl_UniformVariableInfoView : UserControl
{
public Ctrl_UniformVariableInfoView()
{
InitializeComponent();
ComboType.Items.Clear();
ComboType.Items.AddRange(con_SupportVariables);
ComboType.SelectedIndex = -1;
return;
}
public VariableList Variables
{
get => m_Variables;
set {
if (m_Variables == value) {
return;
}
m_Variables = value;
if (m_ValueView != null) {
m_ValueView.Variables = m_Variables;
}
return;
}
}
public UniformVariable Data
{
get => m_Data;
set {
if (m_Data == value) {
return;
}
m_Data = value;
if (m_Data == null) {
SetEnableAll(false);
} else {
SetEnableAll(true);
m_IsDataSetting = true;
try {
TextBoxName.Text = m_Data.UniformName.Value;
var preType = ComboType.SelectedItem;
ComboType.Select((object inItem) => {
return ((inItem as VariableType).Type == m_Data.Variable.Value.GetType());
});
if (ComboType.SelectedItem == preType) {
// invoke on selected to adapt value updating
ComboType_SelectedValueChanged(ComboType, null);
}
} finally {
m_IsDataSetting = false;
}
}
return;
}
}
private void SetEnableAll(bool inEnable)
{
TextBoxName.Enabled = inEnable;
ComboType.Enabled = inEnable;
if (m_ValueView != null) {
m_ValueView.SetEnabled(inEnable);
}
return;
}
private void TextBoxName_TextChanged(object sender, EventArgs e)
{
if ((!m_IsDataSetting) && (m_Data != null)) {
m_Data.UniformName.Value = TextBoxName.Text;
}
return;
}
private void ComboType_SelectedValueChanged(object sender, EventArgs e)
{
if ((!m_IsDataSetting) && (m_Data != null)) {
if ((ComboType.SelectedItem as VariableType).Type != m_Data.Variable.Value.GetType()) {
m_Data.Variable.Value = (ComboType.SelectedItem as VariableType).GenerateFunc();
}
}
if (m_ValueView != null) {
m_ValueView.Parent = null;
m_ValueView = null;
}
if ((m_Data != null) && (m_Data.Variable.Value != null)) {
m_ValueView = m_Data.Variable.Value.CreateView();
if (m_ValueView != null) {
PanelVariableValueArea.Controls.Add(m_ValueView);
m_ValueView.Dock = DockStyle.Top;
m_ValueView.AutoSize = true;
m_ValueView.Variables = m_Variables;
m_ValueView.Data = m_Data.Variable.Value;
}
}
return;
}
private VariableList m_Variables = null;
private UniformVariable m_Data = null;
private bool m_IsDataSetting = false;
private Ctrl_UniformVariableValueView m_ValueView = null;
private class VariableType
{
public string Name = "";
public Type Type = default;
public Func<UniformVariableValue> GenerateFunc = null;
public override string ToString()
{
return Name;
}
}
private readonly VariableType[] con_SupportVariables = {
new VariableType{ Name = "Texture", Type = typeof(UniformVariableTextureValue), GenerateFunc = () => { return new UniformVariableTextureValue(); } }
};
}
}
|
||||
TheStack | e8bc9e5be640efb0b446caef25eaa83b40c2cee8 | C#code:C# | {"size": 1060, "ext": "cs", "max_stars_repo_path": "Edit Distance/EditDistance.cs", "max_stars_repo_name": "GydroCasper/Leetcode", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Edit Distance/EditDistance.cs", "max_issues_repo_name": "GydroCasper/Leetcode", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Edit Distance/EditDistance.cs", "max_forks_repo_name": "GydroCasper/Leetcode", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 16.5625, "max_line_length": 85, "alphanum_fraction": 0.5386792453} | using System;
namespace Leetcode.Edit_Distance
{
public static class EditDistance
{
public static void Go()
{
var first = "biting";
var second = "sitting";
Console.WriteLine(FindEditDistance(first, second));
}
private static int FindEditDistance(string first, string second)
{
if (first is null) throw new ArgumentException("String is null", nameof(first));
if (second is null) throw new ArgumentException("String is null", nameof(second));
var i = 0;
var j = 0;
var distance = 0;
while (i < first.Length || j < second.Length)
{
if (i >= first.Length)
{
distance++;
j++;
continue;
}
if (j >= second.Length)
{
distance++;
i++;
continue;
}
if (first[i] != second[j])
{
distance++;
if (i < first.Length - 1 && first[i + 1] == second[j])
{
i++;
continue;
}
if (j < second.Length - 1 && first[i] == second[j + 1])
{
j++;
continue;
}
}
i++;
j++;
}
return distance;
}
}
}
|
||||
TheStack | e8bcde7f8f65e5f9e75cdce3359b66db0095644e | C#code:C# | {"size": 669, "ext": "cs", "max_stars_repo_path": "Assets/Scripts/Switch.cs", "max_stars_repo_name": "igaryhe/maze", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Assets/Scripts/Switch.cs", "max_issues_repo_name": "igaryhe/maze", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Assets/Scripts/Switch.cs", "max_forks_repo_name": "igaryhe/maze", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 20.90625, "max_line_length": 72, "alphanum_fraction": 0.5889387145} | using System;
using UnityEngine;
public class Switch : MonoBehaviour
{
public GameObject spotlight;
public int noiseCount;
private void Start()
{
AudioManager.Instance.Play(noiseCount);
}
private void OnTriggerEnter(Collider other)
{
if (other.CompareTag("Player"))
{
// spotlight.SetActive(true);
spotlight.GetComponent<Animator>().SetBool("lightOn", true);
AudioManager.Instance.Stop(noiseCount);
}
}
private void OnTriggerExit(Collider other)
{
if (other.CompareTag("Player"))
{
// light.SetActive(false);
}
}
}
|
||||
TheStack | e8be82db112e41c63e8e4a1b79a94e7247b2020a | C#code:C# | {"size": 1709, "ext": "cs", "max_stars_repo_path": "Source/DotSpatial.Data/ICancelProgressHandler.cs", "max_stars_repo_name": "sdrmaps/dotspatial", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Source/DotSpatial.Data/ICancelProgressHandler.cs", "max_issues_repo_name": "sdrmaps/dotspatial", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Source/DotSpatial.Data/ICancelProgressHandler.cs", "max_forks_repo_name": "sdrmaps/dotspatial", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 46.1891891892, "max_line_length": 130, "alphanum_fraction": 0.5658279696} | // ********************************************************************************************************
// Product Name: DotSpatial.Tools.ICancelProgressHandler
// Description: Interface for tools for the DotSpatial toolbox
//
// ********************************************************************************************************
// The contents of this file are subject to the MIT License (MIT)
// you may not use this file except in compliance with the License. You may obtain a copy of the License at
// http://dotspatial.codeplex.com/license
//
// Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
// ANY KIND, either expressed or implied. See the License for the specific language governing rights and
// limitations under the License.
//
// The Original Code is Toolbox.dll for the DotSpatial 4.6/6 ToolManager project
//
// The Initial Developer of this Original Code is Brian Marchionni. Created in Oct, 2008.
//
// Contributor(s): (Open source contributors should list themselves and their modifications here).
//
// ********************************************************************************************************
namespace DotSpatial.Data
{
/// <summary>
/// a IProgressHandler that carries a boolean property allowing the process using the handler to know if you should cancelled
/// </summary>
public interface ICancelProgressHandler : IProgressHandler
{
/// <summary>
/// Returns true if the progress handler has been notified that the running process should be cancelled
/// </summary>
bool Cancel
{
get;
}
}
} |
||||
TheStack | e8bfac04d40cbf95b969fe71813d74e46d4037d8 | C#code:C# | {"size": 1396, "ext": "cs", "max_stars_repo_path": "ASP.NET_CORE_MongoDB/Modules/ApiModule.cs", "max_stars_repo_name": "dougglas1/ASP.NET_CORE_MongoDB", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "ASP.NET_CORE_MongoDB/Modules/ApiModule.cs", "max_issues_repo_name": "dougglas1/ASP.NET_CORE_MongoDB", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "ASP.NET_CORE_MongoDB/Modules/ApiModule.cs", "max_forks_repo_name": "dougglas1/ASP.NET_CORE_MongoDB", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 41.0588235294, "max_line_length": 116, "alphanum_fraction": 0.7392550143} | using ASP.NET_CORE_MongoDB.Builders;
using ASP.NET_CORE_MongoDB.Handlers;
using ASP.NET_CORE_MongoDB.Mappers;
using ASP.NET_CORE_MongoDB.Repositories;
using ASP.NET_CORE_MongoDB.Services;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using MongoDB.Driver;
namespace ASP.NET_CORE_MongoDB.Modules
{
public static class ApiModule
{
public static void AddDependencyInjection(IServiceCollection services, IConfiguration configuration)
{
services.AddSingleton<IMongoClient>(x => new MongoClient(configuration.GetConnectionString("MongoDB")));
services.AddScoped(x => x.GetService<IMongoClient>().StartSession());
services.AddScoped<IPeopleCreateCommandHandler, PeopleCreateCommandHandler>();
services.AddScoped<IPeopleUpdateCommandHandler, PeopleUpdateCommandHandler>();
services.AddScoped<IPeopleRemoveCommandHandler, PeopleRemoveCommandHandler>();
services.AddScoped<IPeopleRemoveLogicCommandHandler, PeopleRemoveLogicCommandHandler>();
services.AddScoped<IPeopleService, PeopleService>();
services.AddScoped<IPeopleMapper, PeopleMapper>();
services.AddScoped<IBuildPeopleFilter, PeopleFilterBuilder>();
services.AddScoped<IPeopleRepository, PeopleRepository>();
}
}
}
|
||||
TheStack | e8c1ff7337001354a350c0322aa9d262cacfe7f6 | C#code:C# | {"size": 1769, "ext": "cs", "max_stars_repo_path": "src/Platformus.Forms.Backend/Areas/Backend/Controllers/FormsController.cs", "max_stars_repo_name": "uQr/Platformus", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Platformus.Forms.Backend/Areas/Backend/Controllers/FormsController.cs", "max_issues_repo_name": "uQr/Platformus", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Platformus.Forms.Backend/Areas/Backend/Controllers/FormsController.cs", "max_forks_repo_name": "uQr/Platformus", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 28.5322580645, "max_line_length": 111, "alphanum_fraction": 0.706048615} | // Copyright © 2015 Dmitry Sikorsky. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using ExtCore.Data.Abstractions;
using Microsoft.AspNetCore.Mvc;
using Platformus.Forms.Backend.ViewModels.Forms;
using Platformus.Forms.Data.Abstractions;
using Platformus.Forms.Data.Models;
namespace Platformus.Forms.Backend.Controllers
{
[Area("Backend")]
public class FormsController : Platformus.Globalization.Backend.Controllers.ControllerBase
{
public FormsController(IStorage storage)
: base(storage)
{
}
public IActionResult Index()
{
return this.View(new IndexViewModelFactory(this).Create());
}
[HttpGet]
[ImportModelStateFromTempData]
public IActionResult CreateOrEdit(int? id)
{
return this.View(new CreateOrEditViewModelFactory(this).Create(id));
}
[HttpPost]
[ExportModelStateToTempData]
public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit)
{
if (this.ModelState.IsValid)
{
Form form = new CreateOrEditViewModelMapper(this).Map(createOrEdit);
this.CreateOrEditEntityLocalizations(form);
if (createOrEdit.Id == null)
this.Storage.GetRepository<IFormRepository>().Create(form);
else this.Storage.GetRepository<IFormRepository>().Edit(form);
this.Storage.Save();
new CacheManager(this).CacheForm(form);
return this.RedirectToAction("Index");
}
return this.CreateRedirectToSelfResult();
}
public ActionResult Delete(int id)
{
this.Storage.GetRepository<IFormRepository>().Delete(id);
this.Storage.Save();
return this.RedirectToAction("Index");
}
}
} |
||||
TheStack | e8c2c11d5fd84d970f85c4f409a26ac8a561d5f5 | C#code:C# | {"size": 1549, "ext": "cs", "max_stars_repo_path": "asn1sharp.Test/Asn1ParserTest.cs", "max_stars_repo_name": "dropoutdude/asn1sharp", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "asn1sharp.Test/Asn1ParserTest.cs", "max_issues_repo_name": "dropoutdude/asn1sharp", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "asn1sharp.Test/Asn1ParserTest.cs", "max_forks_repo_name": "dropoutdude/asn1sharp", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.8166666667, "max_line_length": 89, "alphanum_fraction": 0.5306649451} | using System;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Xunit;
namespace asn1sharp.Test
{
public class Asn1ParserTest
{
[Fact]
public async Task ParsePemRsaKeyPair_ExpectSpecificStructure()
{
using (var file = File.OpenRead(Path.Combine("TestData", "rsakey1.pem")))
{
var node = await file.ParsePem();
AssertNode(node);
}
}
[Fact]
public async Task ParseBinaryRsaKeyPair_ExpectSpecificStructure()
{
using (var file = File.OpenRead(Path.Combine("TestData", "rsakey1.pem")))
{
var bytes = Convert.FromBase64String(PemReader.ReadPem(file));
var node = await bytes.ParseBinary();
AssertNode(node);
}
}
private void AssertNode(Node node)
{
var children = node.Children;
var grandChildren = children.SelectMany(c => c.Children);
var key = grandChildren.Last();
Assert.Equal(3, children.Count());
Assert.Equal(3, grandChildren.Count());
Assert.Equal(9, key.Children.Count());
}
[Fact]
public async Task ParseEccKeyPair_ExpectSpecificStructure()
{
using (var file = File.OpenRead(Path.Combine("TestData", "bp384-key1.pem")))
{
var node = await file.ParsePem();
}
}
}
}
|
||||
TheStack | e8c2cb4e31592a835d16295e54380c671535b591 | C#code:C# | {"size": 2805, "ext": "cs", "max_stars_repo_path": "src/ArangoDB.VelocyPack/Enumerators/ObjectEnumerator.cs", "max_stars_repo_name": "ra0o0f/velocypack", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/ArangoDB.VelocyPack/Enumerators/ObjectEnumerator.cs", "max_issues_repo_name": "ra0o0f/velocypack", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/ArangoDB.VelocyPack/Enumerators/ObjectEnumerator.cs", "max_forks_repo_name": "ra0o0f/velocypack", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.2702702703, "max_line_length": 116, "alphanum_fraction": 0.4752228164} | using ArangoDB.VelocyPack.Exceptions;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ArangoDB.VelocyPack.Enumerators
{
public class ObjectEnumerator : IEnumerator<KeyValuePair<string, VPackSlice>>
{
VPackSlice slice;
KeyValuePair<string, VPackSlice> _current;
long size;
long position;
long current_position;
public ObjectEnumerator(VPackSlice slice)
{
this.slice = slice;
size = slice.Length;
position = 0;
if (!slice.IsType(SliceType.Object))
{
throw new VPackValueTypeException(SliceType.Object);
}
if (size > 0)
{
byte head = slice.TypeCode;
if (head == 0x14)
{
current_position = slice.KeyAt(0).Start;
}
else
{
current_position = slice.Start + slice.FindDataOffset();
}
}
}
public KeyValuePair<string, VPackSlice> Current
{
get
{
return _current;
}
}
object IEnumerator.Current
{
get
{
return _current;
}
}
VPackSlice GetCurrent()
{
return new VPackSlice(slice.Buffer, (int)current_position);
}
public bool MoveNext()
{
if (position++ > 0)
{
if (position <= size && current_position != 0)
{
// skip over key
current_position += GetCurrent().GetByteSize();
// skip over value
current_position += GetCurrent().GetByteSize();
}
else
{
return false;
}
}
VPackSlice currentField = GetCurrent();
string key;
try
{
key = currentField.MakeKey().ToStringUnchecked();
}
catch (VPackKeyTypeException) {
return false;
} catch (VPackNeedAttributeTranslatorException) {
return false;
}
VPackSlice value = new VPackSlice(currentField.Buffer, currentField.Start + currentField.GetByteSize());
_current = new KeyValuePair<string, VPackSlice>(key, value);
return true;
}
public void Reset()
{
throw new NotImplementedException();
}
public void Dispose()
{
}
}
}
|
||||
TheStack | e8c441000fd83f7419a0c6fce4d05a69412c9204 | C#code:C# | {"size": 7962, "ext": "cs", "max_stars_repo_path": "src/dotnet/AdventOfCode2021/AdventOfCode2021.Solutions/Day2Input.cs", "max_stars_repo_name": "alex-renyov/advent-of-code-2021", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/dotnet/AdventOfCode2021/AdventOfCode2021.Solutions/Day2Input.cs", "max_issues_repo_name": "alex-renyov/advent-of-code-2021", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/dotnet/AdventOfCode2021/AdventOfCode2021.Solutions/Day2Input.cs", "max_forks_repo_name": "alex-renyov/advent-of-code-2021", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 7.85982231, "max_line_length": 48, "alphanum_fraction": 0.7420246169} | namespace AdventOfCode2021.Solutions;
public partial class Day2
{
private const string TestInput = @"forward 5
down 5
forward 8
up 3
down 8
forward 2";
private const string Input = @"forward 2
down 2
forward 6
forward 8
down 8
up 2
forward 7
forward 8
down 1
down 8
forward 9
down 1
down 9
up 9
forward 8
down 4
forward 1
forward 4
up 3
down 1
up 4
up 7
down 8
forward 8
forward 9
down 7
forward 2
up 2
forward 3
forward 2
down 8
up 3
up 3
forward 6
down 5
up 6
down 3
forward 4
forward 2
down 9
down 9
down 1
down 3
forward 7
forward 4
down 1
down 3
up 3
up 9
up 2
down 6
down 7
forward 9
down 7
forward 3
forward 5
up 6
up 4
down 8
down 6
down 4
up 2
up 7
up 8
up 1
forward 7
up 9
down 6
up 7
up 3
forward 8
up 9
down 9
up 2
forward 8
forward 4
up 3
forward 4
up 2
down 3
up 7
down 7
forward 6
forward 5
forward 2
forward 3
up 2
down 3
up 6
forward 2
forward 4
up 2
down 6
up 3
down 8
forward 7
forward 8
forward 3
down 6
forward 5
forward 8
down 6
forward 4
down 3
up 2
down 6
down 5
forward 8
forward 8
up 1
down 9
down 6
forward 8
up 1
down 7
forward 7
up 4
up 6
down 3
down 1
up 9
forward 8
forward 1
forward 2
forward 2
up 9
up 4
down 8
up 9
down 8
forward 1
forward 6
up 3
down 4
forward 1
down 5
down 7
down 9
forward 1
forward 1
forward 5
up 2
up 4
down 8
forward 3
forward 1
forward 4
down 6
up 4
up 4
down 6
up 9
down 2
up 6
forward 5
forward 5
forward 1
down 2
up 1
forward 6
up 7
forward 4
up 3
forward 3
forward 8
up 5
forward 4
up 3
forward 9
down 4
down 8
down 8
forward 8
forward 4
down 5
up 8
down 4
up 9
forward 5
up 3
forward 8
forward 3
forward 7
forward 5
forward 3
down 4
down 3
forward 9
down 9
forward 3
down 7
forward 8
down 3
forward 7
forward 5
up 6
up 1
forward 3
down 3
up 3
down 1
forward 8
forward 5
forward 1
forward 6
forward 9
up 5
down 5
down 9
forward 2
down 5
down 4
up 9
forward 9
forward 7
down 8
up 3
down 7
down 1
down 2
down 4
forward 2
forward 7
forward 3
down 5
down 3
up 3
down 4
down 1
forward 9
down 1
forward 4
forward 6
forward 7
down 8
up 4
up 3
down 4
forward 5
down 9
down 1
down 9
up 9
forward 6
forward 7
down 2
up 1
forward 8
up 3
forward 9
forward 1
up 9
down 4
forward 8
forward 4
forward 3
forward 7
forward 1
forward 5
forward 5
forward 7
down 8
forward 1
up 8
forward 7
up 8
forward 2
forward 7
forward 3
down 2
forward 2
forward 6
down 7
down 1
up 2
down 7
up 3
down 8
down 4
forward 2
down 6
forward 4
down 8
down 9
forward 2
down 2
down 1
forward 7
up 2
down 2
forward 8
forward 3
down 9
down 4
down 5
forward 6
forward 2
down 7
up 7
forward 1
down 7
down 3
up 5
down 8
down 2
down 2
up 1
forward 6
up 2
down 3
up 1
down 9
forward 5
forward 5
up 5
down 1
down 7
down 2
forward 5
down 6
up 6
forward 3
down 1
up 3
forward 3
down 7
forward 5
down 8
down 5
down 7
down 7
down 2
forward 8
down 7
down 2
up 7
down 6
down 8
up 7
forward 5
up 8
down 1
forward 5
down 2
forward 3
down 9
down 7
forward 3
up 9
up 7
down 5
down 3
forward 3
down 7
forward 6
forward 2
up 9
down 6
up 4
down 3
up 3
up 6
up 1
down 1
down 7
forward 7
down 1
up 1
forward 6
down 2
up 6
forward 4
down 9
forward 1
forward 3
down 1
forward 9
forward 1
forward 5
down 1
down 8
down 7
down 7
down 3
up 1
down 6
down 2
forward 3
forward 8
down 6
down 8
down 1
down 6
forward 5
down 2
down 6
forward 7
down 6
forward 2
forward 3
down 8
forward 4
down 5
down 1
up 7
forward 3
forward 1
forward 9
forward 5
down 2
forward 6
down 1
up 3
forward 6
forward 5
down 3
down 6
forward 2
forward 3
down 9
up 4
up 9
up 1
forward 6
down 6
forward 9
forward 9
down 6
forward 4
down 6
forward 6
forward 2
forward 8
forward 2
down 2
forward 6
forward 4
forward 2
up 1
down 2
forward 7
forward 2
down 9
forward 2
forward 1
down 8
forward 4
forward 7
up 3
down 2
forward 4
up 6
down 1
forward 6
forward 3
down 3
down 3
forward 7
forward 9
forward 5
forward 9
down 3
down 3
up 7
down 2
forward 1
forward 3
up 1
forward 6
down 6
down 4
down 2
down 3
down 1
up 6
forward 5
down 6
forward 2
down 7
forward 4
down 2
down 7
down 6
forward 3
forward 1
forward 6
down 3
forward 3
up 1
forward 5
down 2
up 1
down 2
up 5
down 2
up 3
down 7
up 6
down 9
forward 1
forward 3
down 9
up 9
down 4
down 1
forward 7
forward 6
up 1
forward 5
down 4
up 4
forward 7
forward 6
down 9
up 9
up 6
up 6
forward 6
up 4
forward 7
down 4
up 1
forward 3
down 5
down 5
up 2
down 6
forward 2
up 2
forward 1
up 7
up 8
up 7
down 3
forward 5
forward 9
up 9
down 7
forward 5
up 8
down 9
forward 6
forward 1
forward 3
down 5
up 4
up 8
down 5
forward 5
up 9
down 7
up 3
forward 4
down 1
forward 1
down 4
forward 8
up 8
forward 4
forward 5
forward 6
forward 2
forward 5
forward 6
up 9
down 3
up 6
down 3
down 1
down 2
down 7
down 9
up 8
down 5
forward 4
down 9
forward 8
forward 9
down 3
forward 4
up 6
forward 4
forward 4
down 6
up 4
down 4
forward 9
down 5
down 7
forward 9
forward 4
down 7
down 2
down 5
down 4
forward 5
down 5
forward 8
forward 9
forward 2
down 8
forward 9
down 2
forward 3
up 6
up 5
down 9
down 1
up 7
forward 9
forward 9
forward 2
down 5
up 5
down 1
forward 8
forward 7
down 7
down 8
down 1
forward 5
down 3
forward 4
down 1
down 5
forward 9
up 1
down 4
down 7
forward 8
up 9
up 6
forward 4
up 1
forward 9
down 6
up 7
down 8
up 2
forward 9
up 6
down 1
up 7
down 5
down 3
forward 2
down 7
forward 5
forward 4
down 4
up 7
down 5
up 4
forward 9
forward 6
forward 4
down 8
forward 1
down 2
forward 2
down 3
up 6
forward 4
down 5
up 8
forward 6
forward 4
up 4
forward 5
forward 3
down 8
forward 9
forward 1
forward 7
down 8
up 5
forward 6
down 4
forward 3
forward 7
forward 2
down 1
up 5
up 4
down 8
forward 3
forward 8
down 8
forward 3
up 9
forward 9
forward 2
forward 7
down 9
up 5
forward 7
down 4
up 4
up 6
down 2
up 9
up 7
forward 4
down 5
up 4
forward 3
down 4
down 7
down 7
up 7
down 9
down 9
forward 7
up 2
forward 4
forward 4
forward 8
forward 2
down 1
up 8
down 9
forward 1
forward 4
down 5
down 3
forward 3
forward 1
up 4
down 6
forward 2
down 5
down 1
down 2
forward 2
down 3
forward 6
down 6
down 3
forward 9
up 6
up 9
down 9
up 5
down 1
down 1
down 6
forward 6
forward 5
forward 5
forward 6
down 8
up 4
down 3
down 8
down 9
down 4
down 7
forward 2
up 5
forward 2
forward 2
forward 4
down 4
down 3
forward 6
forward 9
down 9
forward 4
down 9
down 2
forward 1
down 2
up 3
forward 2
down 9
up 5
down 9
forward 9
forward 8
down 1
down 6
up 2
up 9
forward 7
up 1
down 1
down 3
up 5
down 2
up 5
down 7
up 7
up 8
forward 2
forward 3
down 4
forward 6
up 3
forward 7
forward 7
forward 7
forward 7
forward 8
forward 4
up 1
forward 6
forward 9
forward 2
down 3
up 8
down 9
down 3
down 8
up 9
down 6
up 6
up 9
forward 9
down 9
forward 6
forward 1
down 3
up 2
forward 1
up 2
up 1
forward 2
down 1
up 4
forward 9
down 5
up 9
down 4
forward 4
forward 1
down 8
forward 8
down 5
forward 5
forward 7
forward 6
forward 7
down 7
down 3
forward 9
forward 6
down 7
forward 3
forward 2
down 1
forward 2
forward 5
up 7
up 7
forward 2
up 1
forward 2
up 2
up 2
up 6
forward 4
down 2
up 3
down 4
down 7
down 6
forward 6
forward 5
forward 8
forward 9
up 1
down 9
up 6
down 1
up 1
down 5
forward 2
forward 9
forward 9
up 4
up 2
forward 8
up 4
down 3
down 8
forward 2
down 3
down 8
forward 2
down 6
down 8
down 1
up 4
down 1
forward 2
up 7
up 8
down 8
down 8
forward 8
down 1
down 2
down 1
forward 9
forward 5
forward 8
forward 7
down 9
down 2
down 8
forward 9
down 3
forward 4
forward 1
down 4
forward 9
up 6
forward 6
forward 7
forward 7
forward 6
forward 8
down 4
forward 7
down 8
up 1
forward 2
down 1
up 7
forward 6
up 9
down 4
up 4
forward 1
down 7
down 2
forward 4
forward 4
down 4
down 2
forward 5
forward 9
down 4
down 5
down 6
up 9
down 2
up 4
forward 7
forward 5
forward 1
forward 9
down 7
up 4
up 7
forward 5
up 8
forward 2
down 3
up 1
down 4
forward 4
forward 3
forward 9
forward 9
down 9
down 9
up 7
forward 4
forward 9
down 5
down 5
up 7
up 4
forward 9
up 5
down 2
forward 5
down 1
forward 2
down 6
down 9
forward 2
up 4
forward 6
forward 6
down 1
up 8
forward 5
forward 9
forward 6
forward 4
forward 9
forward 2
forward 5
down 6
up 4
forward 2
up 1
forward 5";
}
|
||||
TheStack | e8c4d8bb769f7140874125a9b5bb0c1a04de7f2c | C#code:C# | {"size": 1157, "ext": "cs", "max_stars_repo_path": "NDP/fx/src/DataWeb/Server/System/Data/Services/IRequestHandler.cs", "max_stars_repo_name": "mahasak/dotnet452", "max_stars_repo_stars_event_min_datetime": "2019-09-23T12:20:20.000Z", "max_stars_repo_stars_event_max_datetime": "2019-11-26T21:36:51.000Z", "max_issues_repo_path": "NDP/fx/src/DataWeb/Server/System/Data/Services/IRequestHandler.cs", "max_issues_repo_name": "mahasak/dotnet452", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "NDP/fx/src/DataWeb/Server/System/Data/Services/IRequestHandler.cs", "max_forks_repo_name": "mahasak/dotnet452", "max_forks_repo_forks_event_min_datetime": "2019-09-29T10:11:34.000Z", "max_forks_repo_forks_event_max_datetime": "2019-09-29T10:11:34.000Z"} | {"max_stars_count": 3.0, "max_issues_count": null, "max_forks_count": 1.0, "avg_line_length": 33.0571428571, "max_line_length": 84, "alphanum_fraction": 0.5652549697} | //---------------------------------------------------------------------
// <copyright file="IRequestHandler.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// <summary>
// Provides the interface with the service contract for
// DataWeb services.
// </summary>
//
// @owner [....]
//---------------------------------------------------------------------
namespace System.Data.Services
{
using System.IO;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Web;
/// <summary>
/// This interface declares the service contract for a DataWeb
/// service.
/// </summary>
[ServiceContract]
public interface IRequestHandler
{
/// <summary>Provides an entry point for all requests.</summary>
/// <param name='messageBody'>Incoming message body.</param>
/// <returns>The resulting <see cref="Message"/> for this request.</returns>
[OperationContract]
[WebInvoke(UriTemplate = "*", Method = "*")]
Message ProcessRequestForMessage(Stream messageBody);
}
}
|
||||
TheStack | e8c854fe26cb600d4d3fcd575b4258966ebd5940 | C#code:C# | {"size": 892, "ext": "cs", "max_stars_repo_path": "ShaderExtensions/Installers/ShaderExtensionsCoreInstaller.cs", "max_stars_repo_name": "AuriRex/ShaderExtensions", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "ShaderExtensions/Installers/ShaderExtensionsCoreInstaller.cs", "max_issues_repo_name": "AuriRex/ShaderExtensions", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "ShaderExtensions/Installers/ShaderExtensionsCoreInstaller.cs", "max_forks_repo_name": "AuriRex/ShaderExtensions", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 34.3076923077, "max_line_length": 108, "alphanum_fraction": 0.7107623318} | using ShaderExtensions.Managers;
using ShaderExtensions.Util;
using Zenject;
namespace ShaderExtensions.Installers
{
internal class ShaderExtensionsCoreInstaller : Installer<PluginConfig, ShaderExtensionsCoreInstaller>
{
private readonly PluginConfig _pluginConfig;
public ShaderExtensionsCoreInstaller(PluginConfig pluginConfig)
{
_pluginConfig = pluginConfig;
}
public override void InstallBindings()
{
Container.BindInstance(_pluginConfig).AsSingle();
Container.BindInterfacesAndSelfTo<ShaderAssetLoader>().AsSingle();
Container.BindInterfacesAndSelfTo<ShaderManager>().AsSingle();
Container.BindInterfacesAndSelfTo<ShaderCore>().AsSingle();
Container.BindInterfacesAndSelfTo<CameraManager>().AsSingle().WhenInjectedInto<ShaderManager>();
}
}
}
|
||||
TheStack | e8c97f803000d3a5895691ee2df2d4c17174f403 | C#code:C# | {"size": 5865, "ext": "cs", "max_stars_repo_path": "src/Atata.Tests/FileScreenshotConsumerTests.cs", "max_stars_repo_name": "ysamus/atata", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Atata.Tests/FileScreenshotConsumerTests.cs", "max_issues_repo_name": "ysamus/atata", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Atata.Tests/FileScreenshotConsumerTests.cs", "max_forks_repo_name": "ysamus/atata", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 34.5, "max_line_length": 170, "alphanum_fraction": 0.6095481671} | using System;
using System.Collections.Generic;
using System.IO;
using NUnit.Framework;
namespace Atata.Tests
{
[TestFixture]
public class FileScreenshotConsumerTests : UITestFixtureBase
{
private AtataContextBuilder<FileScreenshotConsumer> consumerBuilder;
private List<string> foldersToDelete;
[SetUp]
public void SetUp()
{
consumerBuilder = ConfigureBaseAtataContext().
AddScreenshotFileSaving();
foldersToDelete = new List<string>();
}
[Test]
public void FileScreenshotConsumer_FolderPath_Relative()
{
consumerBuilder.
WithFolderPath(@"TestLogs\{build-start}\{test-name-sanitized}").
Build();
Go.To<BasicControlsPage>();
AtataContext.Current.Log.Screenshot();
string folderPath = Path.Combine(
AppDomain.CurrentDomain.BaseDirectory,
"TestLogs",
AtataContext.BuildStart.Value.ToString(FileScreenshotConsumer.DefaultDateTimeFormat),
nameof(FileScreenshotConsumer_FolderPath_Relative));
foldersToDelete.Add(folderPath);
FileAssert.Exists(Path.Combine(folderPath, "01 - Basic Controls page.png"));
}
[Test]
public void FileScreenshotConsumer_FolderPath_Absolute()
{
consumerBuilder.
WithFolderPath(@"C:\TestLogs\{build-start}\{test-name-sanitized}").
Build();
Go.To<BasicControlsPage>();
AtataContext.Current.Log.Screenshot();
string folderPath = Path.Combine(
@"C:\TestLogs",
AtataContext.BuildStart.Value.ToString(FileScreenshotConsumer.DefaultDateTimeFormat),
nameof(FileScreenshotConsumer_FolderPath_Absolute));
foldersToDelete.Add(folderPath);
FileAssert.Exists(Path.Combine(folderPath, "01 - Basic Controls page.png"));
}
[Test]
public void FileScreenshotConsumer_FolderPathBuilder()
{
consumerBuilder.
WithFolderPath(() => $@"TestLogs\{AtataContext.BuildStart.Value.ToString(FileScreenshotConsumer.DefaultDateTimeFormat)}\{AtataContext.Current.TestName}").
Build();
Go.To<BasicControlsPage>();
AtataContext.Current.Log.Screenshot();
string folderPath = Path.Combine(
AppDomain.CurrentDomain.BaseDirectory,
"TestLogs",
AtataContext.BuildStart.Value.ToString(FileScreenshotConsumer.DefaultDateTimeFormat),
nameof(FileScreenshotConsumer_FolderPathBuilder));
foldersToDelete.Add(folderPath);
FileAssert.Exists(Path.Combine(folderPath, "01 - Basic Controls page.png"));
}
[Test]
public void FileScreenshotConsumer_FileName()
{
consumerBuilder.
WithFileName(@"{screenshot-number:d3} {screenshot-title:* - }{screenshot-pageobjectname}").
Build();
Go.To<BasicControlsPage>();
AtataContext.Current.Log.Screenshot();
AtataContext.Current.Log.Screenshot("Some title");
string folderPath = Path.Combine(
AppDomain.CurrentDomain.BaseDirectory,
"Logs",
AtataContext.BuildStart.Value.ToString(FileScreenshotConsumer.DefaultDateTimeFormat),
nameof(FileScreenshotConsumer_FileName));
foldersToDelete.Add(folderPath);
FileAssert.Exists(Path.Combine(folderPath, "001 Basic Controls.png"));
FileAssert.Exists(Path.Combine(folderPath, "002 Some title - Basic Controls.png"));
}
[Test]
public void FileScreenshotConsumer_FileName_Sanitizing()
{
consumerBuilder.
UseTestName("FileScreenshotConsumer_File\"Name\\_/Sanitizing").
Build();
Go.To<BasicControlsPage>();
AtataContext.Current.Log.Screenshot();
AtataContext.Current.Log.Screenshot("Some\\ /:title");
string folderPath = Path.Combine(
AppDomain.CurrentDomain.BaseDirectory,
"Logs",
AtataContext.BuildStart.Value.ToString(FileScreenshotConsumer.DefaultDateTimeFormat),
nameof(FileScreenshotConsumer_FileName_Sanitizing));
foldersToDelete.Add(folderPath);
FileAssert.Exists(Path.Combine(folderPath, "01 - Basic Controls page.png"));
FileAssert.Exists(Path.Combine(folderPath, "02 - Basic Controls page - Some title.png"));
}
[Test]
public void FileScreenshotConsumer_FilePath()
{
consumerBuilder.
WithFilePath(@"TestLogs\{build-start}\Test {test-name-sanitized}\{screenshot-number:d2}{screenshot-title: - *}").
Build();
Go.To<BasicControlsPage>();
AtataContext.Current.Log.Screenshot();
AtataContext.Current.Log.Screenshot("Some title");
string folderPath = Path.Combine(
AppDomain.CurrentDomain.BaseDirectory,
"TestLogs",
AtataContext.BuildStart.Value.ToString(FileScreenshotConsumer.DefaultDateTimeFormat),
$"Test {nameof(FileScreenshotConsumer_FilePath)}");
foldersToDelete.Add(folderPath);
FileAssert.Exists(Path.Combine(folderPath, "01.png"));
FileAssert.Exists(Path.Combine(folderPath, "02 - Some title.png"));
}
public override void TearDown()
{
base.TearDown();
foreach (string folderPath in foldersToDelete)
Directory.Delete(folderPath, true);
}
}
}
|
||||
TheStack | e8cb92d01284a57ff5ae396a2e9811020e5b2159 | C#code:C# | {"size": 1232, "ext": "cs", "max_stars_repo_path": "GarbageCan.Application/Roles/LevelRoles/Commands/AddLevelRole/AddLevelRoleCommand.cs", "max_stars_repo_name": "SorenNeedsCoffee/Garbage-Can", "max_stars_repo_stars_event_min_datetime": "2021-02-17T00:33:55.000Z", "max_stars_repo_stars_event_max_datetime": "2021-02-17T00:33:55.000Z", "max_issues_repo_path": "GarbageCan.Application/Roles/LevelRoles/Commands/AddLevelRole/AddLevelRoleCommand.cs", "max_issues_repo_name": "SorenNeedsCoffee/Garbage-Can", "max_issues_repo_issues_event_min_datetime": "2021-08-05T18:46:45.000Z", "max_issues_repo_issues_event_max_datetime": "2021-08-15T17:31:11.000Z", "max_forks_repo_path": "GarbageCan.Application/Roles/LevelRoles/Commands/AddLevelRole/AddLevelRoleCommand.cs", "max_forks_repo_name": "SorenNeedsCoffee/Garbage-Can", "max_forks_repo_forks_event_min_datetime": "2021-04-11T22:22:02.000Z", "max_forks_repo_forks_event_max_datetime": "2021-04-11T22:22:02.000Z"} | {"max_stars_count": 1.0, "max_issues_count": 1.0, "max_forks_count": 1.0, "avg_line_length": 30.0487804878, "max_line_length": 104, "alphanum_fraction": 0.6452922078} | using System.Threading;
using System.Threading.Tasks;
using GarbageCan.Application.Common.Interfaces;
using GarbageCan.Domain.Entities.Roles;
using MediatR;
namespace GarbageCan.Application.Roles.LevelRoles.Commands.AddLevelRole
{
public class AddLevelRoleCommand : IRequest
{
public int Level { get; set; }
public bool Remain { get; set; }
public ulong RoleId { get; set; }
public ulong GuildId { get; set; }
}
public class AddLevelRoleCommandHandler : IRequestHandler<AddLevelRoleCommand>
{
private readonly IApplicationDbContext _context;
public AddLevelRoleCommandHandler(IApplicationDbContext context)
{
_context = context;
}
public async Task<Unit> Handle(AddLevelRoleCommand request, CancellationToken cancellationToken)
{
await _context.LevelRoles.AddAsync(new LevelRole
{
GuildId = request.GuildId,
RoleId = request.RoleId,
Lvl = request.Level,
Remain = request.Remain
}, cancellationToken);
await _context.SaveChangesAsync(cancellationToken);
return Unit.Value;
}
}
}
|
||||
TheStack | e8cd9e1be94a2bb8c69e95cdc6a6b38b30202df5 | C#code:C# | {"size": 929, "ext": "cs", "max_stars_repo_path": "tvz2api-cqrs/Infrastructure/Messaging/EventBus.cs", "max_stars_repo_name": "MatijaNovosel/tvz2", "max_stars_repo_stars_event_min_datetime": "2020-01-28T13:14:44.000Z", "max_stars_repo_stars_event_max_datetime": "2020-07-21T00:12:25.000Z", "max_issues_repo_path": "tvz2api-cqrs/Infrastructure/Messaging/EventBus.cs", "max_issues_repo_name": "MatijaNovosel/tvz2", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "tvz2api-cqrs/Infrastructure/Messaging/EventBus.cs", "max_forks_repo_name": "MatijaNovosel/tvz2", "max_forks_repo_forks_event_min_datetime": "2021-04-28T11:15:09.000Z", "max_forks_repo_forks_event_max_datetime": "2021-04-28T11:15:09.000Z"} | {"max_stars_count": 2.0, "max_issues_count": null, "max_forks_count": 1.0, "avg_line_length": 23.8205128205, "max_line_length": 75, "alphanum_fraction": 0.7007534984} | using tvz2api_cqrs.Infrastructure.Events;
using tvz2api_cqrs.Infrastructure.EventHandlers;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using System;
namespace tvz2api_cqrs.Infrastructure.Messaging
{
public class EventBus : IEventBus
{
IServiceProvider _serviceProvider;
public EventBus(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
}
public void Publish<T>(T @event) where T : IEvent
{
var handlers = _serviceProvider.GetServices<IEventHandler<T>>();
foreach (var eventHandler in handlers)
{
eventHandler.Handle(@event);
}
}
public async Task PublishAsync<T>(T @event) where T : IEvent
{
var handlers = _serviceProvider.GetServices<IEventHandlerAsync<T>>();
foreach (var eventHandler in handlers)
{
await eventHandler.HandleAsync(@event);
}
}
}
}
|
||||
TheStack | e8ce39df0a5f66ed9dfb7878804eded2283fe347 | C#code:C# | {"size": 3342, "ext": "cs", "max_stars_repo_path": "Client/NC.Client/ViewModels/WaitViewModel.cs", "max_stars_repo_name": "devowl-net/networkchess", "max_stars_repo_stars_event_min_datetime": "2020-10-26T15:39:01.000Z", "max_stars_repo_stars_event_max_datetime": "2021-04-23T12:00:12.000Z", "max_issues_repo_path": "Client/NC.Client/ViewModels/WaitViewModel.cs", "max_issues_repo_name": "devowl-net/networkchess", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Client/NC.Client/ViewModels/WaitViewModel.cs", "max_forks_repo_name": "devowl-net/networkchess", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": 2.0, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 27.1707317073, "max_line_length": 107, "alphanum_fraction": 0.4910233393} | using System;
using System.Threading.Tasks;
using NC.ChessControls.Prism;
using NC.Client.Shell;
namespace NC.Client.ViewModels
{
/// <summary>
/// Wait view model.
/// </summary>
public class WaitViewModel : NotificationObject
{
private readonly string _cancelText;
private readonly bool _canCancel;
private readonly Action _cancelCallback;
private string _actionText;
private bool _waiting;
private bool _isPressed;
private string _defaultText;
/// <summary>
/// Constructor for <see cref="WaitViewModel"/>.
/// </summary>
public WaitViewModel(string defaultText, string cancelText, bool canCancel, Action cancelCallback)
{
ActionText = defaultText;
_defaultText = defaultText;
_cancelText = cancelText;
_canCancel = canCancel;
_cancelCallback = cancelCallback;
CancelCommand = new DelegateCommand(CancelPressed, CanExecute);
}
/// <summary>
/// <see cref="WaitViewModel"/> factory.
/// </summary>
/// <param name="defaultText">Default text.</param>
/// <param name="cancelText">Cancel text.</param>
/// <param name="canCancel">Can press cancel.</param>
/// <param name="cancelCallback">Cancel button press callback.</param>
/// <returns></returns>
public delegate WaitViewModel Factory(
string defaultText,
string cancelText = null,
bool canCancel = false,
Action cancelCallback = null);
/// <summary>
/// Waiting some operation.
/// </summary>
public bool Waiting
{
get
{
return _waiting;
}
set
{
_waiting = value;
RaisePropertyChanged(() => Waiting);
}
}
/// <summary>
/// Cancel button.
/// </summary>
public DelegateCommand CancelCommand { get; }
/// <summary>
/// Action text.
/// </summary>
public string ActionText
{
get
{
return _actionText;
}
set
{
_actionText = value;
RaisePropertyChanged(() => ActionText);
}
}
/// <summary>
/// Create wait operation.
/// </summary>
/// <returns>New wait operation.</returns>
public WaitOperation Operation()
{
_isPressed = false;
ActionText = _defaultText;
return new WaitOperation(this);
}
private async void CancelPressed(object obj)
{
await Task.Factory.StartNew(
() =>
{
_isPressed = true;
CancelCommand.RaiseCanExecuteChanged();
ActionText = _cancelText;
_cancelCallback?.Invoke();
});
}
private bool CanExecute(object obj)
{
return !_isPressed && _canCancel;
}
}
} |
||||
TheStack | e8cea81e96f4413e0d6cdb222a36c5f6e7c7b34f | C#code:C# | {"size": 989, "ext": "cs", "max_stars_repo_path": "OpenERP_RV_Server/Backend/ExtentionMethods.cs", "max_stars_repo_name": "My-Proffesional-Portfolio/OpenERP_RV_Server", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "OpenERP_RV_Server/Backend/ExtentionMethods.cs", "max_issues_repo_name": "My-Proffesional-Portfolio/OpenERP_RV_Server", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "OpenERP_RV_Server/Backend/ExtentionMethods.cs", "max_forks_repo_name": "My-Proffesional-Portfolio/OpenERP_RV_Server", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 39.56, "max_line_length": 146, "alphanum_fraction": 0.6663296259} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace OpenERP_RV_Server.Backend
{
public static class ExtentionMethods
{
/// <summary>
/// Extention Method for IOrderedQueryable<T> where T is the Entity Database Model (DbSet)
/// </summary>
/// <typeparam name="T">T is the Entity Database Model (DbSet)</typeparam>
/// <param name="IQueryableEntity">Raw query data from table or DbSet </param>
/// <param name="currentPage">current page request</param>
/// <param name="itemsPerPage">items per page in request</param>
/// <returns></returns>
public static IQueryable<T> GetPagedData<T>(this IOrderedQueryable<T> IQueryableEntity, int currentPage, int itemsPerPage) where T : class
{
var pagedItems = IQueryableEntity.Skip(currentPage * itemsPerPage).Take(itemsPerPage).AsQueryable();
return pagedItems;
}
}
}
|
||||
TheStack | e8d01ee0ad431f8d2f43b5cea863c12f3d8ac29c | C#code:C# | {"size": 7871, "ext": "cs", "max_stars_repo_path": "fanyi/MStran.cs", "max_stars_repo_name": "fat32jin/fanyi", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "fanyi/MStran.cs", "max_issues_repo_name": "fat32jin/fanyi", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "fanyi/MStran.cs", "max_forks_repo_name": "fat32jin/fanyi", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 40.7823834197, "max_line_length": 217, "alphanum_fraction": 0.5757845255} | using System;
using System.Text;
using System.Net;
using System.IO;
using System.Runtime.Serialization.Json;
using System.Runtime.Serialization;
using System.Web;
using System.Media;
//using System.Timers;
using System.Threading;
namespace fanyi
{
class MStran
{
public static string Tran(string text,string from,string to)
{
string clientId = " 082b38ab-7b5f-41ce-bc8e-0d7751581e27";
string secret = "/eZZ6uF7fRAwHYQEYocQv4A4pdJ5amEkcoevJyY6UhY";
AdmAccessToken admToken;
string headerValue;
//Get Client Id and Client Secret from https://datamarket.azure.com/developer/applications/
//Refer obtaining AccessToken (http://msdn.microsoft.com/en-us/library/hh454950.aspx)
AdmAuthentication admAuth = new AdmAuthentication(clientId, secret);
string re = "";
try
{
admToken = admAuth.GetAccessToken();
// Create a header with the access_token property of the returned token
headerValue = "Bearer " + admToken.access_token;
re = TranslateMethod(headerValue,text,from,to);
}
catch (Exception ex)
{
re = ex.Message;
//ProcessWebException(e);
// Console.WriteLine("Press any key to continue...");
// Console.ReadKey(true);
}
return re;
}
public static string TranslateMethod(string authToken,string text , string from ,string to)
{
//string text = "Use pixels to express measurements for padding and margins.";
// string from = "en";
//string to = "de";
string uri = "http://api.microsofttranslator.com/v2/Http.svc/Translate?text=" + System.Web.HttpUtility.UrlEncode(text) + "&from=" + from + "&to=" + to;
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(uri);
httpWebRequest.Headers.Add("Authorization", authToken);
WebResponse response = null;
string translation = "";
try
{
response = httpWebRequest.GetResponse();
using (Stream stream = response.GetResponseStream())
{
System.Runtime.Serialization.DataContractSerializer dcs = new System.Runtime.Serialization.DataContractSerializer(Type.GetType("System.String"));
translation = (string)dcs.ReadObject(stream);
//Console.WriteLine("Translation for source text '{0}' from {1} to {2} is", text, "en", "de");
//Console.WriteLine(translation);
}
// Console.WriteLine("Press any key to continue...");
// Console.ReadKey(true);
}
catch(Exception ex)
{
translation = ex.Message;
}
finally
{
if (response != null)
{
response.Close();
response = null;
}
}
return translation;
}
private static void ProcessWebException(WebException e)
{
Console.WriteLine("{0}", e.ToString());
// Obtain detailed error information
string strResponse = string.Empty;
using (HttpWebResponse response = (HttpWebResponse)e.Response)
{
using (Stream responseStream = response.GetResponseStream())
{
using (StreamReader sr = new StreamReader(responseStream, System.Text.Encoding.ASCII))
{
strResponse = sr.ReadToEnd();
}
}
}
Console.WriteLine("Http status code={0}, error message={1}", e.Status, strResponse);
}
}
[DataContract]
public class AdmAccessToken
{
[DataMember]
public string access_token { get; set; }
[DataMember]
public string token_type { get; set; }
[DataMember]
public string expires_in { get; set; }
[DataMember]
public string scope { get; set; }
}
public class AdmAuthentication
{
public static readonly string DatamarketAccessUri = "https://datamarket.accesscontrol.windows.net/v2/OAuth2-13";
private string clientId;
private string clientSecret;
private string request;
private AdmAccessToken token;
private Timer accessTokenRenewer;
//Access token expires every 10 minutes. Renew it every 9 minutes only.
private const int RefreshTokenDuration = 9;
public AdmAuthentication(string clientId, string clientSecret)
{
this.clientId = clientId;
this.clientSecret = clientSecret;
//If clientid or client secret has special characters, encode before sending request
this.request = string.Format("grant_type=client_credentials&client_id={0}&client_secret={1}&scope=http://api.microsofttranslator.com", HttpUtility.UrlEncode(clientId), HttpUtility.UrlEncode(clientSecret));
this.token = HttpPost(DatamarketAccessUri, this.request);
//renew the token every specified minutes
accessTokenRenewer = new Timer(new TimerCallback(OnTokenExpiredCallback), this, TimeSpan.FromMinutes(RefreshTokenDuration), TimeSpan.FromMilliseconds(-1));
}
public AdmAccessToken GetAccessToken()
{
return this.token;
}
private void RenewAccessToken()
{
AdmAccessToken newAccessToken = HttpPost(DatamarketAccessUri, this.request);
//swap the new token with old one
//Note: the swap is thread unsafe
this.token = newAccessToken;
Console.WriteLine(string.Format("Renewed token for user: {0} is: {1}", this.clientId, this.token.access_token));
}
private void OnTokenExpiredCallback(object stateInfo)
{
try
{
RenewAccessToken();
}
catch (Exception ex)
{
Console.WriteLine(string.Format("Failed renewing access token. Details: {0}", ex.Message));
}
finally
{
try
{
accessTokenRenewer.Change(TimeSpan.FromMinutes(RefreshTokenDuration), TimeSpan.FromMilliseconds(-1));
}
catch (Exception ex)
{
Console.WriteLine(string.Format("Failed to reschedule the timer to renew access token. Details: {0}", ex.Message));
}
}
}
private AdmAccessToken HttpPost(string DatamarketAccessUri, string requestDetails)
{
//Prepare OAuth request
WebRequest webRequest = WebRequest.Create(DatamarketAccessUri);
webRequest.ContentType = "application/x-www-form-urlencoded";
webRequest.Method = "POST";
byte[] bytes = Encoding.ASCII.GetBytes(requestDetails);
webRequest.ContentLength = bytes.Length;
using (Stream outputStream = webRequest.GetRequestStream())
{
outputStream.Write(bytes, 0, bytes.Length);
}
using (WebResponse webResponse = webRequest.GetResponse())
{
DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(AdmAccessToken));
//Get deserialized object from JSON stream
AdmAccessToken token = (AdmAccessToken)serializer.ReadObject(webResponse.GetResponseStream());
return token;
}
}
}
}
|
||||
TheStack | e8d0595b80704f1f231072e9d7fa9af4f741dd3c | C#code:C# | {"size": 2358, "ext": "cs", "max_stars_repo_path": "Skylight/Converters/ConverterBase.cs", "max_stars_repo_name": "karno/Skylight", "max_stars_repo_stars_event_min_datetime": "2015-02-03T09:27:40.000Z", "max_stars_repo_stars_event_max_datetime": "2015-02-03T09:27:40.000Z", "max_issues_repo_path": "Skylight/Converters/ConverterBase.cs", "max_issues_repo_name": "karno/Skylight", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Skylight/Converters/ConverterBase.cs", "max_forks_repo_name": "karno/Skylight", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": 1.0, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 31.8648648649, "max_line_length": 161, "alphanum_fraction": 0.5882103478} | using System;
using Windows.ApplicationModel;
using Windows.UI.Xaml.Data;
namespace Skylight.Converters
{
// Converter templates
public abstract class TwoWayConverter<TSource, TTarget> : ConvertBase, IValueConverter
{
protected abstract TTarget ToTarget(TSource input, object parameter, string language);
protected abstract TSource ToSource(TTarget input, object parameter, string language);
public object Convert(object value, Type targetType, object parameter, string language)
{
return ConvertSink<TSource, TTarget>(value, parameter, language, ToTarget);
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
return ConvertSink<TTarget, TSource>(value, parameter, language, ToSource);
}
}
public abstract class OneWayConverter<TSource, TTarget> : ConvertBase, IValueConverter
{
protected abstract TTarget ToTarget(TSource input, object parameter, string language);
public object Convert(object value, Type targetType, object parameter, string language)
{
return ConvertSink<TSource, TTarget>(value, parameter, language, ToTarget);
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
throw new NotSupportedException();
}
}
public abstract class ConvertBase
{
protected static TTarget ConvertSink<TSource, TTarget>(object value, object parameter, string language, Func<TSource, object, string, TTarget> converter)
{
if (IsInDesignTime)
{
try
{
return converter((TSource)value, parameter, language);
}
catch
{
return converter(default(TSource), parameter, language);
}
}
return converter((TSource)value, parameter, language);
}
protected static bool IsInDesignTime
{
get
{
try
{
return DesignMode.DesignModeEnabled;
}
catch
{
return false;
}
}
}
}
}
|
||||
TheStack | e8d09759f6a8f913e745830933b1b8cb231c52bb | C#code:C# | {"size": 1495, "ext": "cs", "max_stars_repo_path": "Chapter05/ObjectCompositionWithAggregation.cs", "max_stars_repo_name": "cashwu/Dependency-Injection-in-.NET-Core-2.0", "max_stars_repo_stars_event_min_datetime": "2017-11-24T08:04:50.000Z", "max_stars_repo_stars_event_max_datetime": "2021-10-02T03:20:03.000Z", "max_issues_repo_path": "Chapter05/ObjectCompositionWithAggregation.cs", "max_issues_repo_name": "cashwu/Dependency-Injection-in-.NET-Core-2.0", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Chapter05/ObjectCompositionWithAggregation.cs", "max_forks_repo_name": "cashwu/Dependency-Injection-in-.NET-Core-2.0", "max_forks_repo_forks_event_min_datetime": "2018-11-12T05:19:18.000Z", "max_forks_repo_forks_event_max_datetime": "2021-09-07T08:11:44.000Z"} | {"max_stars_count": 15.0, "max_issues_count": null, "max_forks_count": 7.0, "avg_line_length": 25.3389830508, "max_line_length": 98, "alphanum_fraction": 0.5170568562} | using System;
using System.Collections.Generic;
namespace DependencyExamples
{
class Program
{
static void Main(string[] args)
{
Address add = new Address("Nayagarh");
Student rinu = new Student(1, "Jayashree Satapathy", new DateTime(1995, 11, 14), add);
Student gudy = new Student(2, "Lipsa Rath", new DateTime(1995, 4, 23), add);
rinu.PrintStudent();
gudy.PrintStudent();
Console.ReadKey();
}
}
public class Student
{
private int Id { get; set; }
private string Name { get; set; }
private DateTime Dob { get; set; }
private Address Address { get; set; }
private ICollection<Book> Books { get; set; }
public Student(int id, string name, DateTime dob, Address address)
{
Id = id;
Name = name;
Dob = dob;
Address = address;
}
public void PrintStudent()
{
Console.WriteLine("Student: " + Name);
Console.WriteLine("City: " + Address.City + "");
Console.WriteLine("-----------------------");
}
}
public class Address
{
public int AddressId { get; set; }
public string City { get; set; }
public string State { get; set; }
public string Country { get; set; }
public Address(string city)
{
City = city;
}
}
public class Book { }
} |
||||
TheStack | e8d26b25c36a754a1be007bdc528982b0d4bed6a | C#code:C# | {"size": 4995, "ext": "cs", "max_stars_repo_path": "SocketShot/StreamManager.cs", "max_stars_repo_name": "VincentPestana/SocketShot", "max_stars_repo_stars_event_min_datetime": "2019-09-15T15:06:16.000Z", "max_stars_repo_stars_event_max_datetime": "2019-09-15T15:06:16.000Z", "max_issues_repo_path": "SocketShot/StreamManager.cs", "max_issues_repo_name": "VincentPestana/SocketShot", "max_issues_repo_issues_event_min_datetime": "2019-09-14T08:16:24.000Z", "max_issues_repo_issues_event_max_datetime": "2020-05-06T18:37:23.000Z", "max_forks_repo_path": "SocketShot/StreamManager.cs", "max_forks_repo_name": "VincentPestana/SocketShot", "max_forks_repo_forks_event_min_datetime": "2021-05-05T14:03:40.000Z", "max_forks_repo_forks_event_max_datetime": "2021-05-05T14:03:40.000Z"} | {"max_stars_count": 1.0, "max_issues_count": 7.0, "max_forks_count": 1.0, "avg_line_length": 27.5966850829, "max_line_length": 170, "alphanum_fraction": 0.6804804805} | using System;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using Microsoft.AspNet.SignalR.Client;
namespace SocketShot
{
internal class StreamManager
{
// Initial starting quality setting
private long _qualitySetting = 20L;
private int _desiredSizePerShotKB = 80;
// Image resize
// 1920 × 1080
// 1280 × 720
// 960 × 540
// 720 × 480
// 640 × 360
private int _streamImageWidth = 960;
private int _streamImageHeight = 540;
private IHubProxy _hubProxy;
bool _capture = true;
StreamMeta _streamDetailed;
public StreamManager(IHubProxy hubProxy)
{
_hubProxy = hubProxy;
StreamBase64();
}
public void StreamBase64()
{
Stopwatch timerOverall = new Stopwatch();
Stopwatch timerSend = new Stopwatch();
Stopwatch timerCapture = new Stopwatch();
var averageTime = 0L;
// Initialize
Bitmap bitmap;
Graphics graphics;
string b64Bitmap = "";
_streamDetailed = new StreamMeta()
{
CaptureWidth = 1920,
CaptureHeight = 1080,
BitmapEncodeQuality = _qualitySetting.ToString()
};
// Capture 1920x1080 pixels
bitmap = new Bitmap(1920, 1080, PixelFormat.Format24bppRgb);
graphics = Graphics.FromImage(bitmap as Image);
// Setup encoder
ImageCodecInfo jpgEncoder = GetEncoder(ImageFormat.Jpeg);
EncoderParameters encoderParameters = new EncoderParameters(1);
// Quality options
var qualityEncoder = Encoder.Quality;
EncoderParameter qualityEncoderParameter = new EncoderParameter(qualityEncoder, _qualitySetting);
encoderParameters.Param[0] = qualityEncoderParameter;
// Capture to infinity
while (_capture)
{
timerOverall.Restart();
timerCapture.Restart();
graphics.CopyFromScreen(0, 0, 0, 0, bitmap.Size);
// Resize image
var resizedBitmap = ResizeBitmap(bitmap, _streamImageWidth, _streamImageHeight);
using (var ms = new MemoryStream())
{
resizedBitmap.Save(ms, jpgEncoder, encoderParameters);
// Bitmap image to array
byte[] byteImage = ms.ToArray();
// Convert to Base64
b64Bitmap = Convert.ToBase64String(byteImage);
ms.Dispose();
}
timerCapture.Stop();
_streamDetailed.JsonB64Bitmap = "data:image/png;base64, " + b64Bitmap;
// Send image over SignalR
bool sendFailed;
try
{
timerSend.Restart();
//_hubProxy.Invoke("sendB64Screen", "data:image/png;base64, " + b64Bitmap).Wait();
_hubProxy.Invoke("sendScreenDetailed", _streamDetailed).Wait();
timerSend.Stop();
sendFailed = false;
}
catch (Exception e)
{
// Image could not be sent
sendFailed = true;
}
if (sendFailed)
{
// Sending failed, decrease quality all the way
_qualitySetting = 0L;
}
else
{
// Dynamic Quality adjustment
var sizeSent = b64Bitmap.Length / 1024;
if (sizeSent > (_desiredSizePerShotKB + 5))
_qualitySetting -= 2L;
else if (sizeSent < (_desiredSizePerShotKB - 5))
_qualitySetting += 2L;
}
qualityEncoderParameter = new EncoderParameter(qualityEncoder, _qualitySetting);
encoderParameters.Param[0] = qualityEncoderParameter;
timerOverall.Stop();
averageTime = (averageTime + timerOverall.ElapsedMilliseconds) / 2;
// Timers for the detailed stream
_streamDetailed.TimerSendMilliseconds = timerSend.ElapsedMilliseconds;
_streamDetailed.TimerOverallMilliseconds = timerOverall.ElapsedMilliseconds;
_streamDetailed.TimerCaptureMilliseconds = timerCapture.ElapsedMilliseconds;
// More information regarding the stream
_streamDetailed.StreamHeight = _streamImageHeight;
_streamDetailed.StreamWidth = _streamImageWidth;
_streamDetailed.StreamSizeKB = b64Bitmap.Length / 1024;
_streamDetailed.BitmapEncodeQuality = _qualitySetting.ToString();
_streamDetailed.FramesPerSecond = (int)(1000 / averageTime);
_streamDetailed.StreamDesiredSizeKB = _desiredSizePerShotKB;
_streamDetailed.PreviousFrameFailedToSend = sendFailed;
//Console.WriteLine("FPS:Qual:Size - " + (1000 / averageTime) + " : " + _qualitySetting + " : " + b64Bitmap.Length / 1024 + "Kb" + ((sendFailed) ? " - failed" : ""));
Console.WriteLine("FPS:" + (1000 / averageTime) + " Qual: " + _qualitySetting + " Size: " + b64Bitmap.Length / 1024 + "Kb" + ((sendFailed) ? " - failed" : ""));
}
}
private Bitmap ResizeBitmap(Bitmap bmp, int width, int height)
{
Bitmap result = new Bitmap(width, height);
using (Graphics g = Graphics.FromImage(result))
{
g.DrawImage(bmp, 0, 0, width, height);
}
return result;
}
private ImageCodecInfo GetEncoder(ImageFormat format)
{
ImageCodecInfo[] codecs = ImageCodecInfo.GetImageEncoders();
foreach (ImageCodecInfo codec in codecs)
{
if (codec.FormatID == format.Guid)
return codec;
}
return null;
}
}
} |
||||
TheStack | e8d28e7be139ad1d8516e49a3206dd38ee6b71a8 | C#code:C# | {"size": 2414, "ext": "cs", "max_stars_repo_path": "MonoDevelop.Database.ConnectionManager/NodeBuilders/ConstraintNodeBuilder.cs", "max_stars_repo_name": "mono/linux-packaging-monodevelop-database", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "MonoDevelop.Database.ConnectionManager/NodeBuilders/ConstraintNodeBuilder.cs", "max_issues_repo_name": "mono/linux-packaging-monodevelop-database", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "MonoDevelop.Database.ConnectionManager/NodeBuilders/ConstraintNodeBuilder.cs", "max_forks_repo_name": "mono/linux-packaging-monodevelop-database", "max_forks_repo_forks_event_min_datetime": "2022-02-16T12:10:04.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-31T22:16:53.000Z"} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": 2.0, "avg_line_length": 33.0684931507, "max_line_length": 97, "alphanum_fraction": 0.7464788732} | //
// Authors:
// Christian Hergert <[email protected]>
// Ben Motmans <[email protected]>
//
// Copyright (C) 2005 Mosaix Communications, Inc.
// Copyright (c) 2007 Ben Motmans
//
// 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 MonoDevelop.Database.Sql;
using MonoDevelop.Ide.Gui.Components;
namespace MonoDevelop.Database.ConnectionManager
{
public class ConstraintNodeBuilder : TypeNodeBuilder
{
public ConstraintNodeBuilder ()
: base ()
{
}
public override Type NodeDataType {
get { return typeof (ConstraintSchema); }
}
public override string ContextMenuAddinPath {
get { return "/MonoDevelop/Database/ContextMenu/ConnectionManagerPad/ConstraintNode"; }
}
public override string GetNodeName (ITreeNavigator thisNode, object dataObject)
{
return AddinCatalog.GetString ("Constraint");
}
public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, NodeInfo nodeInfo)
{
ConstraintSchema constraint = dataObject as ConstraintSchema;
nodeInfo.Label = constraint.Name;
nodeInfo.Icon = Context.GetIcon ("md-db-constraint");
//TODO: icon based on constraint type
}
public override void BuildChildNodes (ITreeBuilder builder, object dataObject)
{
}
public override bool HasChildNodes (ITreeBuilder builder, object dataObject)
{
return false;
}
}
} |
||||
TheStack | e8d2ec9629cbbc9c0a854094f6daf1c6148522ed | C#code:C# | {"size": 945, "ext": "cs", "max_stars_repo_path": "BusinessLayer/Services/Interfaces/IAuthService.cs", "max_stars_repo_name": "otahirs/ClubIS", "max_stars_repo_stars_event_min_datetime": "2021-08-13T09:09:06.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-07T08:25:21.000Z", "max_issues_repo_path": "BusinessLayer/Services/Interfaces/IAuthService.cs", "max_issues_repo_name": "otahirs/ClubIS", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "BusinessLayer/Services/Interfaces/IAuthService.cs", "max_forks_repo_name": "otahirs/ClubIS", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": 5.0, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 42.9545454545, "max_line_length": 91, "alphanum_fraction": 0.7523809524} | using System.Threading.Tasks;
using ClubIS.CoreLayer.DTOs;
using ClubIS.CoreLayer.Entities;
using Microsoft.AspNetCore.Identity;
namespace ClubIS.BusinessLayer.Services.Interfaces
{
public interface IAuthService
{
Task<IdentityResult> CreateIdentity(string userName, string password);
Task<UserIdentity> GetIdentity(string userName);
Task<UserIdentity> GetIdentity(int userId);
Task<UserRolesDTO> GetRoles(UserIdentity userIdentity);
Task<IdentityResult> ChangeRoles(UserRolesDTO newRoles);
Task<SignInResult> SignIn(LoginParametersDTO parameters);
Task Logout();
Task<bool> CheckPassword(UserIdentity userIdentity, string password);
Task<IdentityResult> ChangeLogin(UserIdentity userIdentity, string newUsername);
Task<IdentityResult> ChangePassword(UserIdentity userIdentity, string newPassword);
Task<UserRolesDTO> GetRoles(int userId);
}
} |
||||
TheStack | e8d30e05354b0ef04af640e087142aae6dbf6ac7 | C#code:C# | {"size": 21756, "ext": "cs", "max_stars_repo_path": "DiscordBot/Migrations/20201121190151_updateChess.Designer.cs", "max_stars_repo_name": "TheGrandCoding/discord-bo", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "DiscordBot/Migrations/20201121190151_updateChess.Designer.cs", "max_issues_repo_name": "TheGrandCoding/discord-bo", "max_issues_repo_issues_event_min_datetime": "2020-10-06T13:37:39.000Z", "max_issues_repo_issues_event_max_datetime": "2021-11-03T22:01:55.000Z", "max_forks_repo_path": "DiscordBot/Migrations/20201121190151_updateChess.Designer.cs", "max_forks_repo_name": "TheGrandCoding/discord-bo", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": 7.0, "max_forks_count": null, "avg_line_length": 33.8351477449, "max_line_length": 93, "alphanum_fraction": 0.4300422872} | #if INCLUDE_CHESS
// <auto-generated />
using System;
using DiscordBot.Classes.Chess;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace DiscordBot.Migrations
{
[DbContext(typeof(ChessDbContext))]
[Migration("20201121190151_updateChess")]
partial class updateChess
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.UseIdentityColumns()
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.0");
modelBuilder.Entity("DiscordBot.Classes.Chess.AppealsAttachment", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.UseIdentityColumn();
b.Property<string>("FileName")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("Filed")
.HasColumnType("datetime2");
b.Property<int>("FiledBy")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("AppealsAttachments");
});
modelBuilder.Entity("DiscordBot.Classes.Chess.AppealsExhibit", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.UseIdentityColumn();
b.Property<int?>("AttachmentId")
.HasColumnType("int");
b.Property<int?>("HearingId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("AttachmentId");
b.HasIndex("HearingId");
b.ToTable("AppealsExhibits");
});
modelBuilder.Entity("DiscordBot.Classes.Chess.AppealsHearing", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.UseIdentityColumn();
b.Property<int?>("AppealOf")
.HasColumnType("int");
b.Property<DateTime?>("Commenced")
.HasColumnType("datetime2");
b.Property<DateTime?>("Concluded")
.HasColumnType("datetime2");
b.Property<DateTime>("Filed")
.HasColumnType("datetime2");
b.Property<string>("Holding")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsArbiterCase")
.HasColumnType("bit");
b.Property<bool>("Sealed")
.HasColumnType("bit");
b.HasKey("Id");
b.ToTable("Appeals");
});
modelBuilder.Entity("DiscordBot.Classes.Chess.AppealsMember", b =>
{
b.Property<int>("MemberId")
.HasColumnType("int");
b.Property<int>("AppealHearingId")
.HasColumnType("int");
b.Property<int>("Relation")
.HasColumnType("int");
b.HasKey("MemberId", "AppealHearingId");
b.HasIndex("AppealHearingId");
b.ToTable("AppealsRelations");
});
modelBuilder.Entity("DiscordBot.Classes.Chess.AppealsMotion", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.UseIdentityColumn();
b.Property<DateTime>("Filed")
.HasColumnType("datetime2");
b.Property<int>("HearingId")
.HasColumnType("int");
b.Property<string>("Holding")
.HasColumnType("nvarchar(max)");
b.Property<DateTime?>("HoldingDate")
.HasColumnType("datetime2");
b.Property<string>("MotionType")
.HasColumnType("nvarchar(max)");
b.Property<int>("MovantId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("HearingId");
b.HasIndex("MovantId");
b.ToTable("AppealsMotions");
});
modelBuilder.Entity("DiscordBot.Classes.Chess.AppealsMotionFile", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.UseIdentityColumn();
b.Property<int?>("AttachmentId")
.HasColumnType("int");
b.Property<int?>("MotionId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("AttachmentId");
b.HasIndex("MotionId");
b.ToTable("AppealsMotionFiles");
});
modelBuilder.Entity("DiscordBot.Classes.Chess.AppealsRuling", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.UseIdentityColumn();
b.Property<int?>("AttachmentId")
.HasColumnType("int");
b.Property<int>("HearingId")
.HasColumnType("int");
b.Property<string>("Holding")
.HasColumnType("nvarchar(max)");
b.Property<int>("SubmitterId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("AttachmentId");
b.HasIndex("HearingId")
.IsUnique();
b.HasIndex("SubmitterId");
b.ToTable("AppealsRuling");
});
modelBuilder.Entity("DiscordBot.Classes.Chess.AppealsWitness", b =>
{
b.Property<int>("HearingId")
.HasColumnType("int");
b.Property<int>("WitnessId")
.HasColumnType("int");
b.Property<int?>("AppealsHearingId")
.HasColumnType("int");
b.Property<DateTime?>("ConcludedOn")
.HasColumnType("datetime2");
b.HasKey("HearingId", "WitnessId");
b.HasIndex("AppealsHearingId");
b.HasIndex("WitnessId");
b.ToTable("AppealsWitnesses");
});
modelBuilder.Entity("DiscordBot.Classes.Chess.ArbiterVote", b =>
{
b.Property<int>("VoterId")
.HasColumnType("int");
b.Property<int>("VoteeId")
.HasColumnType("int");
b.Property<int>("Score")
.HasColumnType("int");
b.HasKey("VoterId", "VoteeId");
b.ToTable("ArbiterVote");
});
modelBuilder.Entity("DiscordBot.Classes.Chess.ChessBan", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.UseIdentityColumn();
b.Property<DateTime>("ExpiresAt")
.HasColumnType("datetime2");
b.Property<DateTime>("GivenAt")
.HasColumnType("datetime2");
b.Property<int>("OperatorId")
.HasColumnType("int");
b.Property<string>("Reason")
.HasColumnType("nvarchar(max)");
b.Property<int>("TargetId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("TargetId");
b.ToTable("Bans");
});
modelBuilder.Entity("DiscordBot.Classes.Chess.ChessDateScore", b =>
{
b.Property<DateTime>("Date")
.HasColumnType("datetime2");
b.Property<int>("PlayerId")
.HasColumnType("int");
b.Property<int>("Score")
.HasColumnType("int");
b.HasKey("Date", "PlayerId");
b.HasIndex("PlayerId");
b.ToTable("ChessDateScore");
});
modelBuilder.Entity("DiscordBot.Classes.Chess.ChessGame", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.UseIdentityColumn();
b.Property<int>("ApprovalGiven")
.HasColumnType("int");
b.Property<int>("ApprovalNeeded")
.HasColumnType("int");
b.Property<bool>("Draw")
.HasColumnType("bit");
b.Property<int>("LoserChange")
.HasColumnType("int");
b.Property<int>("LoserId")
.HasColumnType("int");
b.Property<DateTime>("Timestamp")
.HasColumnType("datetime2");
b.Property<int>("WinnerChange")
.HasColumnType("int");
b.Property<int>("WinnerId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("LoserId");
b.HasIndex("WinnerId");
b.HasIndex("Id", "WinnerId", "LoserId");
b.ToTable("Games");
});
modelBuilder.Entity("DiscordBot.Classes.Chess.ChessInvite", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.UseIdentityColumn();
b.Property<string>("Code")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Invites");
});
modelBuilder.Entity("DiscordBot.Classes.Chess.ChessNote", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.UseIdentityColumn();
b.Property<int>("ExpiresInDays")
.HasColumnType("int");
b.Property<DateTime>("GivenAt")
.HasColumnType("datetime2");
b.Property<int>("OperatorId")
.HasColumnType("int");
b.Property<int>("TargetId")
.HasColumnType("int");
b.Property<string>("Text")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("TargetId");
b.ToTable("Notes");
});
modelBuilder.Entity("DiscordBot.Classes.Chess.ChessPlayer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.UseIdentityColumn();
b.Property<DateTime?>("DateLastPresent")
.HasColumnType("datetime2");
b.Property<long>("DiscordAccount")
.HasColumnType("bigint");
b.Property<string>("DismissalReason")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsBuiltInAccount")
.HasColumnType("bit");
b.Property<int>("Losses")
.HasColumnType("int");
b.Property<int>("Modifier")
.HasColumnType("int");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.Property<int>("Permission")
.HasColumnType("int");
b.Property<int>("Rating")
.HasColumnType("int");
b.Property<bool>("Removed")
.HasColumnType("bit");
b.Property<bool>("RequireGameApproval")
.HasColumnType("bit");
b.Property<bool>("RequireTiming")
.HasColumnType("bit");
b.Property<int>("Wins")
.HasColumnType("int");
b.Property<bool>("WithdrawnModVote")
.HasColumnType("bit");
b.HasKey("Id");
b.ToTable("Players");
});
modelBuilder.Entity("DiscordBot.Classes.Chess.AppealsExhibit", b =>
{
b.HasOne("DiscordBot.Classes.Chess.AppealsAttachment", "Attachment")
.WithMany()
.HasForeignKey("AttachmentId");
b.HasOne("DiscordBot.Classes.Chess.AppealsHearing", "Hearing")
.WithMany("Exhibits")
.HasForeignKey("HearingId");
b.Navigation("Attachment");
b.Navigation("Hearing");
});
modelBuilder.Entity("DiscordBot.Classes.Chess.AppealsMember", b =>
{
b.HasOne("DiscordBot.Classes.Chess.AppealsHearing", "AppealHearing")
.WithMany("Members")
.HasForeignKey("AppealHearingId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("DiscordBot.Classes.Chess.ChessPlayer", "Member")
.WithMany("Appeals")
.HasForeignKey("MemberId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("AppealHearing");
b.Navigation("Member");
});
modelBuilder.Entity("DiscordBot.Classes.Chess.AppealsMotion", b =>
{
b.HasOne("DiscordBot.Classes.Chess.AppealsHearing", "Hearing")
.WithMany("Motions")
.HasForeignKey("HearingId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("DiscordBot.Classes.Chess.ChessPlayer", "Movant")
.WithMany("Motions")
.HasForeignKey("MovantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Hearing");
b.Navigation("Movant");
});
modelBuilder.Entity("DiscordBot.Classes.Chess.AppealsMotionFile", b =>
{
b.HasOne("DiscordBot.Classes.Chess.AppealsAttachment", "Attachment")
.WithMany()
.HasForeignKey("AttachmentId");
b.HasOne("DiscordBot.Classes.Chess.AppealsMotion", "Motion")
.WithMany("Attachments")
.HasForeignKey("MotionId");
b.Navigation("Attachment");
b.Navigation("Motion");
});
modelBuilder.Entity("DiscordBot.Classes.Chess.AppealsRuling", b =>
{
b.HasOne("DiscordBot.Classes.Chess.AppealsAttachment", "Attachment")
.WithMany()
.HasForeignKey("AttachmentId");
b.HasOne("DiscordBot.Classes.Chess.AppealsHearing", "Hearing")
.WithOne("Ruling")
.HasForeignKey("DiscordBot.Classes.Chess.AppealsRuling", "HearingId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("DiscordBot.Classes.Chess.ChessPlayer", "Submitter")
.WithMany()
.HasForeignKey("SubmitterId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Attachment");
b.Navigation("Hearing");
b.Navigation("Submitter");
});
modelBuilder.Entity("DiscordBot.Classes.Chess.AppealsWitness", b =>
{
b.HasOne("DiscordBot.Classes.Chess.AppealsHearing", null)
.WithMany("Witnesses")
.HasForeignKey("AppealsHearingId");
b.HasOne("DiscordBot.Classes.Chess.ChessPlayer", "Witness")
.WithMany()
.HasForeignKey("WitnessId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Witness");
});
modelBuilder.Entity("DiscordBot.Classes.Chess.ArbiterVote", b =>
{
b.HasOne("DiscordBot.Classes.Chess.ChessPlayer", "Voter")
.WithMany("ArbVotes")
.HasForeignKey("VoterId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Voter");
});
modelBuilder.Entity("DiscordBot.Classes.Chess.ChessBan", b =>
{
b.HasOne("DiscordBot.Classes.Chess.ChessPlayer", "Target")
.WithMany("Bans")
.HasForeignKey("TargetId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Target");
});
modelBuilder.Entity("DiscordBot.Classes.Chess.ChessDateScore", b =>
{
b.HasOne("DiscordBot.Classes.Chess.ChessPlayer", "Player")
.WithMany("DateScores")
.HasForeignKey("PlayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Player");
});
modelBuilder.Entity("DiscordBot.Classes.Chess.ChessGame", b =>
{
b.HasOne("DiscordBot.Classes.Chess.ChessPlayer", "Loser")
.WithMany("GamesLost")
.HasForeignKey("LoserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("DiscordBot.Classes.Chess.ChessPlayer", "Winner")
.WithMany("GamesWon")
.HasForeignKey("WinnerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Loser");
b.Navigation("Winner");
});
modelBuilder.Entity("DiscordBot.Classes.Chess.ChessNote", b =>
{
b.HasOne("DiscordBot.Classes.Chess.ChessPlayer", "Target")
.WithMany("Notes")
.HasForeignKey("TargetId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Target");
});
modelBuilder.Entity("DiscordBot.Classes.Chess.AppealsHearing", b =>
{
b.Navigation("Exhibits");
b.Navigation("Members");
b.Navigation("Motions");
b.Navigation("Ruling");
b.Navigation("Witnesses");
});
modelBuilder.Entity("DiscordBot.Classes.Chess.AppealsMotion", b =>
{
b.Navigation("Attachments");
});
modelBuilder.Entity("DiscordBot.Classes.Chess.ChessPlayer", b =>
{
b.Navigation("Appeals");
b.Navigation("ArbVotes");
b.Navigation("Bans");
b.Navigation("DateScores");
b.Navigation("GamesLost");
b.Navigation("GamesWon");
b.Navigation("Motions");
b.Navigation("Notes");
});
#pragma warning restore 612, 618
}
}
}
#endif |
||||
TheStack | e8d564fe409bffabb508e36d8c00d9be1fc465a3 | C#code:C# | {"size": 1710, "ext": "cs", "max_stars_repo_path": "16. Databases Advanced - Entity Framework - Feb 2019/08. Automapper Implementation/Automapper/MyApp/Core/CommandInterpreter.cs", "max_stars_repo_name": "zrusev/SoftwareUniversity2016", "max_stars_repo_stars_event_min_datetime": "2019-11-15T18:22:47.000Z", "max_stars_repo_stars_event_max_datetime": "2019-11-15T19:02:05.000Z", "max_issues_repo_path": "16. Databases Advanced - Entity Framework - Feb 2019/08. Automapper Implementation/Automapper/MyApp/Core/CommandInterpreter.cs", "max_issues_repo_name": "zrusev/SoftUni_2016", "max_issues_repo_issues_event_min_datetime": "2019-12-27T19:53:50.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-26T12:27:02.000Z", "max_forks_repo_path": "16. Databases Advanced - Entity Framework - Feb 2019/08. Automapper Implementation/Automapper/MyApp/Core/CommandInterpreter.cs", "max_forks_repo_name": "zrusev/SoftUni_2016", "max_forks_repo_forks_event_min_datetime": "2019-09-21T15:02:11.000Z", "max_forks_repo_forks_event_max_datetime": "2019-11-15T18:22:52.000Z"} | {"max_stars_count": 2.0, "max_issues_count": 23.0, "max_forks_count": 2.0, "avg_line_length": 27.5806451613, "max_line_length": 67, "alphanum_fraction": 0.5421052632} | namespace MyApp.Core
{
using Commands.Contracts;
using Contracts;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Linq;
using System.Reflection;
public class CommandInterpreter : ICommandInterpreter
{
private const string Suffix = "Command";
private readonly IServiceProvider serviceProvider;
public CommandInterpreter(IServiceProvider serviceProvider)
{
this.serviceProvider = serviceProvider;
}
public string Read(string[] inputArgs)
{
//type
//ctor
//ctro params
//invoke
//execute
//return result
//AddEmployee + Command
string commandName = inputArgs[0] + Suffix;
string[] commandParams = inputArgs.Skip(1).ToArray();
var type = Assembly.GetCallingAssembly()
.GetTypes()
.FirstOrDefault(x => x.Name == commandName);
if (type == null)
{
throw new ArgumentException("Invalid command!");
}
var constructor = type.GetConstructors()
.FirstOrDefault();
var constructorParams = constructor
.GetParameters()
.Select(x => x.ParameterType)
.ToArray();
var services = constructorParams
.Select(this.serviceProvider.GetService)
.ToArray();
var command = (ICommand)constructor
.Invoke(services);
string result = command.Execute(commandParams);
return result;
}
}
} |
||||
TheStack | e8d63a25e970cc6d6ea2d8e47413ca01800f574d | C#code:C# | {"size": 1562, "ext": "cs", "max_stars_repo_path": "CSharpOOPExercises/Polymorphism/WildFarm/AnimalCreator.cs", "max_stars_repo_name": "ilinatsoneva3/SoftUni-Official", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "CSharpOOPExercises/Polymorphism/WildFarm/AnimalCreator.cs", "max_issues_repo_name": "ilinatsoneva3/SoftUni-Official", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "CSharpOOPExercises/Polymorphism/WildFarm/AnimalCreator.cs", "max_forks_repo_name": "ilinatsoneva3/SoftUni-Official", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 36.3255813953, "max_line_length": 90, "alphanum_fraction": 0.4929577465} | namespace WildFarm
{
using System;
using System.Collections.Generic;
using WildFarm.Animals;
public class AnimalCreator
{
public Animal CreateAnimal(IList<string> args)
{
var type = args[0];
var name = args[1];
var weight = double.Parse(args[2]);
switch (type)
{
case nameof(Cat):
var livingRegionCat = args[3];
var breedCat = args[4];
return new Cat(name, weight, livingRegionCat, breedCat);
case nameof(Dog):
var livingRegionDog = args[3];
return new Dog(name, weight, livingRegionDog);
case nameof(Tiger):
var livingRegionTiger = args[3];
var breedTiger = args[4];
return new Tiger(name, weight, livingRegionTiger, breedTiger);
case nameof(Hen):
var wingSizeHen = double.Parse(args[3]);
return new Hen(name, weight, wingSizeHen);
case nameof(Owl):
var wingSizeOwl = double.Parse(args[3]);
return new Owl(name, weight, wingSizeOwl);
case nameof(Mouse):
var livingRegionMouse = args[3];
return new Mouse(name, weight, livingRegionMouse);
default:
throw new ArgumentException($"{type} is not a valid type of animal!");
}
}
}
}
|
||||
TheStack | e8d95e3125dc51f1af4e53a12cd89368f1662a10 | C#code:C# | {"size": 2035, "ext": "cs", "max_stars_repo_path": "PCL259/IoCBattleForXamarin/IoCBattleForXamarin/Models/BenchEngine.cs", "max_stars_repo_name": "nuitsjp/IoCBattleForXamarin", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "PCL259/IoCBattleForXamarin/IoCBattleForXamarin/Models/BenchEngine.cs", "max_issues_repo_name": "nuitsjp/IoCBattleForXamarin", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "PCL259/IoCBattleForXamarin/IoCBattleForXamarin/Models/BenchEngine.cs", "max_forks_repo_name": "nuitsjp/IoCBattleForXamarin", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 27.8767123288, "max_line_length": 110, "alphanum_fraction": 0.5803439803} | using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Threading.Tasks;
using IoCBattleForXamarin.Containers;
namespace IoCBattleForXamarin.Models
{
public class BenchEngine
{
public ObservableCollection<BenchResult> BenchResults { get; } = new ObservableCollection<BenchResult>();
public BenchEngine()
{
}
public Task Start(int executeCount, IContainer[] containers)
{
return Task.Run(() =>
{
foreach (var container in containers)
{
GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);
GC.WaitForPendingFinalizers();
// Thread.Sleep(1000);
RunBenchmark(container, container.SetupForSingletonTest, "Singleton", executeCount);
GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);
GC.WaitForPendingFinalizers();
// Thread.Sleep(1000);
RunBenchmark(container, container.SetupForTransientTest, "Transient", executeCount);
}
});
}
private void RunBenchmark(IContainer container, Action setupAction, string mode, int executeCount)
{
var regTimer = new Stopwatch();
var resolveTimer = new Stopwatch();
regTimer.Start();
setupAction();
regTimer.Stop();
BenchResults.Add(new BenchResult
{
Name = container.Name,
Mode = mode,
Category = "Registartion",
Elapsed = regTimer.Elapsed
});
resolveTimer.Start();
for (int i = 0; i < executeCount; i++)
{
var instance = container.Resolve<IWebService>();
}
resolveTimer.Stop();
BenchResults.Add(new BenchResult
{
Name = container.Name,
Mode = mode,
Category = "Component",
Elapsed = resolveTimer.Elapsed
});
}
}
} |
||||
TheStack | e8daf488b3c0380d9e697e3903486728ac3e6354 | C#code:C# | {"size": 1664, "ext": "cs", "max_stars_repo_path": "SpecFlowMasterClass.SpecOverflow.Specs.Controller/Drivers/VoteAnswerDriver.cs", "max_stars_repo_name": "indcoder/SpecFlowMasterClass.SpecOverflow", "max_stars_repo_stars_event_min_datetime": "2021-06-14T14:01:50.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-31T15:18:46.000Z", "max_issues_repo_path": "SpecFlowMasterClass.SpecOverflow.Specs.Controller/Drivers/VoteAnswerDriver.cs", "max_issues_repo_name": "indcoder/SpecFlowMasterClass.SpecOverflow", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "SpecFlowMasterClass.SpecOverflow.Specs.Controller/Drivers/VoteAnswerDriver.cs", "max_forks_repo_name": "indcoder/SpecFlowMasterClass.SpecOverflow", "max_forks_repo_forks_event_min_datetime": "2021-06-14T13:57:47.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-13T21:18:46.000Z"} | {"max_stars_count": 16.0, "max_issues_count": null, "max_forks_count": 11.0, "avg_line_length": 47.5428571429, "max_line_length": 158, "alphanum_fraction": 0.7355769231} | using System;
using SpecFlowMasterClass.SpecOverflow.Specs.Controller.Support;
using SpecFlowMasterClass.SpecOverflow.Specs.Support;
using SpecFlowMasterClass.SpecOverflow.Web.Controllers;
using SpecFlowMasterClass.SpecOverflow.Web.Models;
namespace SpecFlowMasterClass.SpecOverflow.Specs.Controller.Drivers
{
public class VoteAnswerDriver : ActionAttempt<Tuple<Guid, Guid, VoteDirection>, AnswerDetailModel>
{
private readonly QuestionContext _questionContext;
public VoteAnswerDriver(QuestionContext questionContext, AuthContext authContext, QuestionDetailsPageDriver questionDetailsPageDriver) : base(input =>
{
var controller = new QuestionController();
var result = controller
.VoteAnswer(input.Item1, input.Item2, (int)input.Item3, authContext.AuthToken);
questionDetailsPageDriver.LoadPage(input.Item1);
return result;
})
{
_questionContext = questionContext;
}
public AnswerDetailModel Perform(Guid questionId, Guid answerId, VoteDirection vote, bool attemptOnly = false) =>
Perform(new Tuple<Guid, Guid, VoteDirection>(questionId, answerId, vote), attemptOnly);
public AnswerDetailModel Perform(Guid answerId, VoteDirection vote, bool attemptOnly = false) =>
Perform(_questionContext.CurrentQuestionId, answerId, vote, attemptOnly);
public AnswerDetailModel Perform(VoteDirection vote, bool attemptOnly = false) =>
_questionContext.CurrentAnswer = Perform(_questionContext.CurrentQuestionId, _questionContext.CurrentAnswerId, vote, attemptOnly);
}
}
|
||||
TheStack | e8db10f976d4eaaf911c5ad2d27d59f0475d5c85 | C#code:C# | {"size": 341, "ext": "cs", "max_stars_repo_path": "PrismSharp/Tokenizing/RxMatch.cs", "max_stars_repo_name": "tkubec/PrismSharp", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "PrismSharp/Tokenizing/RxMatch.cs", "max_issues_repo_name": "tkubec/PrismSharp", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "PrismSharp/Tokenizing/RxMatch.cs", "max_forks_repo_name": "tkubec/PrismSharp", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 26.2307692308, "max_line_length": 60, "alphanum_fraction": 0.6774193548} | // This file is a part of PrismSharp Library by Tomas Kubec
// based on PrismJS, https://prismjs.com/
// Distributed under MIT license - see license.txt
//
namespace Orionsoft.PrismSharp.Tokenizing
{
internal class RxMatch
{
public int Index { get; internal set; }
public string Match { get; internal set; }
}
} |
||||
TheStack | e8db56a78efc5b5119a9d80ac691e5437bda23a6 | C#code:C# | {"size": 18233, "ext": "cs", "max_stars_repo_path": "main/HSSF/Util/HSSFCellUtil.cs", "max_stars_repo_name": "sunshinele/npoi", "max_stars_repo_stars_event_min_datetime": "2015-03-12T13:17:30.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-22T05:49:55.000Z", "max_issues_repo_path": "main/HSSF/Util/HSSFCellUtil.cs", "max_issues_repo_name": "sunshinele/npoi", "max_issues_repo_issues_event_min_datetime": "2015-11-20T12:11:08.000Z", "max_issues_repo_issues_event_max_datetime": "2021-10-14T02:00:07.000Z", "max_forks_repo_path": "main/HSSF/Util/HSSFCellUtil.cs", "max_forks_repo_name": "sunshinele/npoi", "max_forks_repo_forks_event_min_datetime": "2015-01-13T06:14:47.000Z", "max_forks_repo_forks_event_max_datetime": "2021-04-10T09:51:01.000Z"} | {"max_stars_count": 74.0, "max_issues_count": 36.0, "max_forks_count": 65.0, "avg_line_length": 45.9269521411, "max_line_length": 144, "alphanum_fraction": 0.5849832721} | /* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
==================================================================== */
namespace NPOI.HSSF.Util
{
using System;
using System.Collections;
using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel;
/// <summary>
/// Various utility functions that make working with a cells and rows easier. The various
/// methods that deal with style's allow you to Create your HSSFCellStyles as you need them.
/// When you apply a style change to a cell, the code will attempt to see if a style already
/// exists that meets your needs. If not, then it will Create a new style. This is to prevent
/// creating too many styles. there is an upper limit in Excel on the number of styles that
/// can be supported.
/// @author Eric Pugh [email protected]
/// </summary>
public class HSSFCellUtil
{
public static String ALIGNMENT = "alignment";
public static String BORDER_BOTTOM = "borderBottom";
public static String BORDER_LEFT = "borderLeft";
public static String BORDER_RIGHT = "borderRight";
public static String BORDER_TOP = "borderTop";
public static String BOTTOM_BORDER_COLOR = "bottomBorderColor";
public static String DATA_FORMAT = "dataFormat";
public static String FILL_BACKGROUND_COLOR = "fillBackgroundColor";
public static String FILL_FOREGROUND_COLOR = "fillForegroundColor";
public static String FILL_PATTERN = "fillPattern";
public static String FONT = "font";
public static String HIDDEN = "hidden";
public static String INDENTION = "indention";
public static String LEFT_BORDER_COLOR = "leftBorderColor";
public static String LOCKED = "locked";
public static String RIGHT_BORDER_COLOR = "rightBorderColor";
public static String ROTATION = "rotation";
public static String TOP_BORDER_COLOR = "topBorderColor";
public static String VERTICAL_ALIGNMENT = "verticalAlignment";
public static String WRAP_TEXT = "wrapText";
private static UnicodeMapping[] unicodeMappings;
static HSSFCellUtil()
{
unicodeMappings = new UnicodeMapping[15];
unicodeMappings[0] = um("alpha", "\u03B1");
unicodeMappings[1] = um("beta", "\u03B2");
unicodeMappings[2] = um("gamma", "\u03B3");
unicodeMappings[3] = um("delta", "\u03B4");
unicodeMappings[4] = um("epsilon", "\u03B5");
unicodeMappings[5] = um("zeta", "\u03B6");
unicodeMappings[6] = um("eta", "\u03B7");
unicodeMappings[7] = um("theta", "\u03B8");
unicodeMappings[8] = um("iota", "\u03B9");
unicodeMappings[9] = um("kappa", "\u03BA");
unicodeMappings[10] = um("lambda", "\u03BB");
unicodeMappings[11] = um("mu", "\u03BC");
unicodeMappings[12] = um("nu", "\u03BD");
unicodeMappings[13] = um("xi", "\u03BE");
unicodeMappings[14] = um("omicron", "\u03BF");
}
private class UnicodeMapping
{
public String entityName;
public String resolvedValue;
public UnicodeMapping(String pEntityName, String pResolvedValue)
{
entityName = "&" + pEntityName + ";";
resolvedValue = pResolvedValue;
}
}
private HSSFCellUtil()
{
// no instances of this class
}
/// <summary>
/// Get a row from the spreadsheet, and Create it if it doesn't exist.
/// </summary>
/// <param name="rowCounter">The 0 based row number</param>
/// <param name="sheet">The sheet that the row is part of.</param>
/// <returns>The row indicated by the rowCounter</returns>
public static NPOI.SS.UserModel.IRow GetRow(int rowCounter, HSSFSheet sheet)
{
NPOI.SS.UserModel.IRow row = sheet.GetRow(rowCounter);
if (row == null)
{
row = sheet.CreateRow(rowCounter);
}
return row;
}
/// <summary>
/// Get a specific cell from a row. If the cell doesn't exist,
/// </summary>
/// <param name="row">The row that the cell is part of</param>
/// <param name="column">The column index that the cell is in.</param>
/// <returns>The cell indicated by the column.</returns>
public static NPOI.SS.UserModel.ICell GetCell(NPOI.SS.UserModel.IRow row, int column)
{
NPOI.SS.UserModel.ICell cell = row.GetCell(column);
if (cell == null)
{
cell = row.CreateCell(column);
}
return cell;
}
/// <summary>
/// Creates a cell, gives it a value, and applies a style if provided
/// </summary>
/// <param name="row">the row to Create the cell in</param>
/// <param name="column">the column index to Create the cell in</param>
/// <param name="value">The value of the cell</param>
/// <param name="style">If the style is not null, then Set</param>
/// <returns>A new HSSFCell</returns>
public static NPOI.SS.UserModel.ICell CreateCell(NPOI.SS.UserModel.IRow row, int column, String value, HSSFCellStyle style)
{
NPOI.SS.UserModel.ICell cell = GetCell(row, column);
cell.SetCellValue(new HSSFRichTextString(value));
if (style != null)
{
cell.CellStyle = (style);
}
return cell;
}
/// <summary>
/// Create a cell, and give it a value.
/// </summary>
/// <param name="row">the row to Create the cell in</param>
/// <param name="column">the column index to Create the cell in</param>
/// <param name="value">The value of the cell</param>
/// <returns>A new HSSFCell.</returns>
public static NPOI.SS.UserModel.ICell CreateCell(NPOI.SS.UserModel.IRow row, int column, String value)
{
return CreateCell(row, column, value, null);
}
/// <summary>
/// Take a cell, and align it.
/// </summary>
/// <param name="cell">the cell to Set the alignment for</param>
/// <param name="workbook">The workbook that is being worked with.</param>
/// <param name="align">the column alignment to use.</param>
public static void SetAlignment(ICell cell, HSSFWorkbook workbook, short align)
{
SetCellStyleProperty(cell, workbook, ALIGNMENT, align);
}
/// <summary>
/// Take a cell, and apply a font to it
/// </summary>
/// <param name="cell">the cell to Set the alignment for</param>
/// <param name="workbook">The workbook that is being worked with.</param>
/// <param name="font">The HSSFFont that you want to Set...</param>
public static void SetFont(ICell cell, HSSFWorkbook workbook, HSSFFont font)
{
SetCellStyleProperty(cell, workbook, FONT, font);
}
/**
* This method attempt to find an already existing HSSFCellStyle that matches
* what you want the style to be. If it does not find the style, then it
* Creates a new one. If it does Create a new one, then it applies the
* propertyName and propertyValue to the style. This is necessary because
* Excel has an upper limit on the number of Styles that it supports.
*
*@param workbook The workbook that is being worked with.
*@param propertyName The name of the property that is to be
* changed.
*@param propertyValue The value of the property that is to be
* changed.
*@param cell The cell that needs it's style changes
*@exception NestableException Thrown if an error happens.
*/
public static void SetCellStyleProperty(NPOI.SS.UserModel.ICell cell, HSSFWorkbook workbook, String propertyName, Object propertyValue)
{
NPOI.SS.UserModel.ICellStyle originalStyle = cell.CellStyle;
NPOI.SS.UserModel.ICellStyle newStyle = null;
Hashtable values = GetFormatProperties(originalStyle);
values[propertyName] = propertyValue;
// index seems like what index the cellstyle is in the list of styles for a workbook.
// not good to compare on!
short numberCellStyles = workbook.NumCellStyles;
for (short i = 0; i < numberCellStyles; i++)
{
NPOI.SS.UserModel.ICellStyle wbStyle = workbook.GetCellStyleAt(i);
Hashtable wbStyleMap = GetFormatProperties(wbStyle);
if (wbStyleMap.Equals(values))
{
newStyle = wbStyle;
break;
}
}
if (newStyle == null)
{
newStyle = workbook.CreateCellStyle();
SetFormatProperties(newStyle, workbook, values);
}
cell.CellStyle = (newStyle);
}
/// <summary>
/// Returns a map containing the format properties of the given cell style.
/// </summary>
/// <param name="style">cell style</param>
/// <returns>map of format properties (String -> Object)</returns>
private static Hashtable GetFormatProperties(NPOI.SS.UserModel.ICellStyle style)
{
Hashtable properties = new Hashtable();
PutShort(properties, ALIGNMENT, (short)style.Alignment);
PutShort(properties, BORDER_BOTTOM, (short)style.BorderBottom);
PutShort(properties, BORDER_LEFT, (short)style.BorderLeft);
PutShort(properties, BORDER_RIGHT, (short)style.BorderRight);
PutShort(properties, BORDER_TOP, (short)style.BorderTop);
PutShort(properties, BOTTOM_BORDER_COLOR, style.BottomBorderColor);
PutShort(properties, DATA_FORMAT, style.DataFormat);
PutShort(properties, FILL_BACKGROUND_COLOR, style.FillBackgroundColor);
PutShort(properties, FILL_FOREGROUND_COLOR, style.FillForegroundColor);
PutShort(properties, FILL_PATTERN, (short)style.FillPattern);
PutShort(properties, FONT, style.FontIndex);
PutBoolean(properties, HIDDEN, style.IsHidden);
PutShort(properties, INDENTION, style.Indention);
PutShort(properties, LEFT_BORDER_COLOR, style.LeftBorderColor);
PutBoolean(properties, LOCKED, style.IsLocked);
PutShort(properties, RIGHT_BORDER_COLOR, style.RightBorderColor);
PutShort(properties, ROTATION, style.Rotation);
PutShort(properties, TOP_BORDER_COLOR, style.TopBorderColor);
PutShort(properties, VERTICAL_ALIGNMENT, (short)style.VerticalAlignment);
PutBoolean(properties, WRAP_TEXT, style.WrapText);
return properties;
}
/// <summary>
/// Sets the format properties of the given style based on the given map.
/// </summary>
/// <param name="style">The cell style</param>
/// <param name="workbook">The parent workbook.</param>
/// <param name="properties">The map of format properties (String -> Object).</param>
private static void SetFormatProperties(
NPOI.SS.UserModel.ICellStyle style, HSSFWorkbook workbook, Hashtable properties)
{
style.Alignment = (NPOI.SS.UserModel.HorizontalAlignment)GetShort(properties, ALIGNMENT);
style.BorderBottom = (NPOI.SS.UserModel.BorderStyle)GetShort(properties, BORDER_BOTTOM);
style.BorderLeft = (NPOI.SS.UserModel.BorderStyle)GetShort(properties, BORDER_LEFT);
style.BorderRight = (NPOI.SS.UserModel.BorderStyle)GetShort(properties, BORDER_RIGHT);
style.BorderTop = (NPOI.SS.UserModel.BorderStyle)GetShort(properties, BORDER_TOP);
style.BottomBorderColor = (GetShort(properties, BOTTOM_BORDER_COLOR));
style.DataFormat = (GetShort(properties, DATA_FORMAT));
style.FillBackgroundColor = (GetShort(properties, FILL_BACKGROUND_COLOR));
style.FillForegroundColor = (GetShort(properties, FILL_FOREGROUND_COLOR));
style.FillPattern = (NPOI.SS.UserModel.FillPatternType)GetShort(properties, FILL_PATTERN);
style.SetFont(workbook.GetFontAt(GetShort(properties, FONT)));
style.IsHidden = (GetBoolean(properties, HIDDEN));
style.Indention = (GetShort(properties, INDENTION));
style.LeftBorderColor = (GetShort(properties, LEFT_BORDER_COLOR));
style.IsLocked = (GetBoolean(properties, LOCKED));
style.RightBorderColor = (GetShort(properties, RIGHT_BORDER_COLOR));
style.Rotation = (GetShort(properties, ROTATION));
style.TopBorderColor = (GetShort(properties, TOP_BORDER_COLOR));
style.VerticalAlignment = (NPOI.SS.UserModel.VerticalAlignment)GetShort(properties, VERTICAL_ALIGNMENT);
style.WrapText = (GetBoolean(properties, WRAP_TEXT));
}
/// <summary>
/// Utility method that returns the named short value form the given map.
/// Returns zero if the property does not exist, or is not a {@link Short}.
/// </summary>
/// <param name="properties">The map of named properties (String -> Object)</param>
/// <param name="name">The property name.</param>
/// <returns>property value, or zero</returns>
private static short GetShort(Hashtable properties, String name)
{
Object value = properties[name];
if (value is short)
{
return (short)value;
}
else
{
return 0;
}
}
/// <summary>
/// Utility method that returns the named boolean value form the given map.
/// Returns false if the property does not exist, or is not a {@link Boolean}.
/// </summary>
/// <param name="properties">map of properties (String -> Object)</param>
/// <param name="name">The property name.</param>
/// <returns>property value, or false</returns>
private static bool GetBoolean(Hashtable properties, String name)
{
Object value = properties[name];
if (value is Boolean)
{
return ((Boolean)value);
}
else
{
return false;
}
}
/// <summary>
/// Utility method that Puts the named short value to the given map.
/// </summary>
/// <param name="properties">The map of properties (String -> Object).</param>
/// <param name="name">The property name.</param>
/// <param name="value">The property value.</param>
private static void PutShort(Hashtable properties, String name, short value)
{
properties[name] = value;
}
/// <summary>
/// Utility method that Puts the named boolean value to the given map.
/// </summary>
/// <param name="properties">map of properties (String -> Object)</param>
/// <param name="name">property name</param>
/// <param name="value">property value</param>
private static void PutBoolean(Hashtable properties, String name, bool value)
{
properties[name] = value;
}
/// <summary>
/// Looks for text in the cell that should be unicode, like alpha; and provides the
/// unicode version of it.
/// </summary>
/// <param name="cell">The cell to check for unicode values</param>
/// <returns>transalted to unicode</returns>
public static ICell TranslateUnicodeValues(ICell cell)
{
String s = cell.RichStringCellValue.String;
bool foundUnicode = false;
String lowerCaseStr = s.ToLower();
for (int i = 0; i < unicodeMappings.Length; i++)
{
UnicodeMapping entry = unicodeMappings[i];
String key = entry.entityName;
if (lowerCaseStr.IndexOf(key, StringComparison.Ordinal) != -1)
{
s = s.Replace(key, entry.resolvedValue);
foundUnicode = true;
}
}
if (foundUnicode)
{
cell.SetCellValue(new HSSFRichTextString(s));
}
return cell;
}
private static UnicodeMapping um(String entityName, String resolvedValue)
{
return new UnicodeMapping(entityName, resolvedValue);
}
}
} |
||||
TheStack | e8dd290583dfc3af350d96a25d477bfc2dd03383 | C#code:C# | {"size": 822, "ext": "cs", "max_stars_repo_path": "Customizations/Identity/CustomClaimsPrincipalFactory.cs", "max_stars_repo_name": "AngeloDotNet/AdminArea-IdentityBase", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Customizations/Identity/CustomClaimsPrincipalFactory.cs", "max_issues_repo_name": "AngeloDotNet/AdminArea-IdentityBase", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Customizations/Identity/CustomClaimsPrincipalFactory.cs", "max_forks_repo_name": "AngeloDotNet/AdminArea-IdentityBase", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 35.7391304348, "max_line_length": 165, "alphanum_fraction": 0.7493917275} | using System.Security.Claims;
using System.Threading.Tasks;
using AdminArea_IdentityBase.Models.Entities;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Options;
namespace AdminArea_IdentityBase.Customizations.Identity
{
public class CustomClaimsPrincipalFactory : UserClaimsPrincipalFactory<ApplicationUser>
{
public CustomClaimsPrincipalFactory(UserManager<ApplicationUser> userManager, IOptions<IdentityOptions> optionsAccessor) : base(userManager, optionsAccessor)
{
}
protected override async Task<ClaimsIdentity> GenerateClaimsAsync(ApplicationUser user)
{
ClaimsIdentity identity = await base.GenerateClaimsAsync(user);
identity.AddClaim(new Claim("FullName", user.FullName));
return identity;
}
}
} |
||||
TheStack | e8de1525b032202c17510f70e8dd49dfbcaba6fc | C#code:C# | {"size": 11728, "ext": "cs", "max_stars_repo_path": "WindowsFormsApp1/WindowsFormsApp1/HiringRequest.Designer.cs", "max_stars_repo_name": "karinakozarova/MediaBazar", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "WindowsFormsApp1/WindowsFormsApp1/HiringRequest.Designer.cs", "max_issues_repo_name": "karinakozarova/MediaBazar", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "WindowsFormsApp1/WindowsFormsApp1/HiringRequest.Designer.cs", "max_forks_repo_name": "karinakozarova/MediaBazar", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 52.5919282511, "max_line_length": 175, "alphanum_fraction": 0.6048772169} | namespace MediaBazar
{
partial class HiringRequest
{
/// <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.label1 = new System.Windows.Forms.Label();
this.tbUsername = new System.Windows.Forms.TextBox();
this.tbFirstName = new System.Windows.Forms.TextBox();
this.tbLastName = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.tbPhoneNumber = new System.Windows.Forms.TextBox();
this.tbEmail = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.nHourlyWage = new System.Windows.Forms.NumericUpDown();
this.label6 = new System.Windows.Forms.Label();
this.dtbContractStartDate = new System.Windows.Forms.DateTimePicker();
this.cmbDepartment = new System.Windows.Forms.ComboBox();
((System.ComponentModel.ISupportInitialize)(this.nHourlyWage)).BeginInit();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(12, 19);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(239, 31);
this.label1.TabIndex = 1;
this.label1.Text = "Basic information";
//
// tbUsername
//
this.tbUsername.Font = new System.Drawing.Font("Montserrat", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tbUsername.Location = new System.Drawing.Point(18, 75);
this.tbUsername.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tbUsername.Name = "tbUsername";
this.tbUsername.Size = new System.Drawing.Size(283, 40);
this.tbUsername.TabIndex = 87;
this.tbUsername.Text = "Username";
//
// tbFirstName
//
this.tbFirstName.Font = new System.Drawing.Font("Montserrat", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tbFirstName.Location = new System.Drawing.Point(18, 132);
this.tbFirstName.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tbFirstName.Name = "tbFirstName";
this.tbFirstName.Size = new System.Drawing.Size(283, 40);
this.tbFirstName.TabIndex = 88;
this.tbFirstName.Text = "First name";
//
// tbLastName
//
this.tbLastName.Font = new System.Drawing.Font("Montserrat", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tbLastName.Location = new System.Drawing.Point(18, 185);
this.tbLastName.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tbLastName.Name = "tbLastName";
this.tbLastName.Size = new System.Drawing.Size(283, 40);
this.tbLastName.TabIndex = 89;
this.tbLastName.Text = "Last name";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(249, 244);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(269, 31);
this.label2.TabIndex = 90;
this.label2.Text = "Contact information";
//
// tbPhoneNumber
//
this.tbPhoneNumber.Font = new System.Drawing.Font("Montserrat", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tbPhoneNumber.Location = new System.Drawing.Point(244, 290);
this.tbPhoneNumber.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tbPhoneNumber.Name = "tbPhoneNumber";
this.tbPhoneNumber.Size = new System.Drawing.Size(283, 40);
this.tbPhoneNumber.TabIndex = 91;
this.tbPhoneNumber.Text = "Phone number";
//
// tbEmail
//
this.tbEmail.Font = new System.Drawing.Font("Montserrat", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tbEmail.Location = new System.Drawing.Point(244, 339);
this.tbEmail.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tbEmail.Name = "tbEmail";
this.tbEmail.Size = new System.Drawing.Size(283, 40);
this.tbEmail.TabIndex = 92;
this.tbEmail.Text = "Email address";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.Location = new System.Drawing.Point(386, 19);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(268, 31);
this.label3.TabIndex = 93;
this.label3.Text = "Employment details";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label5.Location = new System.Drawing.Point(387, 64);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(165, 29);
this.label5.TabIndex = 94;
this.label5.Text = "Hourly wage:";
//
// nHourlyWage
//
this.nHourlyWage.DecimalPlaces = 2;
this.nHourlyWage.Font = new System.Drawing.Font("Montserrat", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.nHourlyWage.Location = new System.Drawing.Point(558, 59);
this.nHourlyWage.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.nHourlyWage.Name = "nHourlyWage";
this.nHourlyWage.Size = new System.Drawing.Size(107, 40);
this.nHourlyWage.TabIndex = 95;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label6.Location = new System.Drawing.Point(387, 101);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(232, 29);
this.label6.TabIndex = 96;
this.label6.Text = "Contract start date:";
//
// dtbContractStartDate
//
this.dtbContractStartDate.CalendarFont = new System.Drawing.Font("Montserrat", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.dtbContractStartDate.Font = new System.Drawing.Font("Montserrat", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.dtbContractStartDate.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.dtbContractStartDate.Location = new System.Drawing.Point(392, 132);
this.dtbContractStartDate.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.dtbContractStartDate.Name = "dtbContractStartDate";
this.dtbContractStartDate.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.dtbContractStartDate.Size = new System.Drawing.Size(290, 40);
this.dtbContractStartDate.TabIndex = 97;
this.dtbContractStartDate.Value = new System.DateTime(2020, 2, 29, 0, 51, 0, 0);
//
// cmbDepartment
//
this.cmbDepartment.Font = new System.Drawing.Font("Montserrat", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cmbDepartment.FormattingEnabled = true;
this.cmbDepartment.Location = new System.Drawing.Point(392, 185);
this.cmbDepartment.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.cmbDepartment.Name = "cmbDepartment";
this.cmbDepartment.Size = new System.Drawing.Size(288, 41);
this.cmbDepartment.TabIndex = 98;
this.cmbDepartment.Text = "Department";
//
// HiringRequest
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(759, 390);
this.Controls.Add(this.cmbDepartment);
this.Controls.Add(this.dtbContractStartDate);
this.Controls.Add(this.label6);
this.Controls.Add(this.nHourlyWage);
this.Controls.Add(this.label5);
this.Controls.Add(this.label3);
this.Controls.Add(this.tbEmail);
this.Controls.Add(this.tbPhoneNumber);
this.Controls.Add(this.label2);
this.Controls.Add(this.tbLastName);
this.Controls.Add(this.tbFirstName);
this.Controls.Add(this.tbUsername);
this.Controls.Add(this.label1);
this.Name = "HiringRequest";
this.Text = "HiringRequest";
((System.ComponentModel.ISupportInitialize)(this.nHourlyWage)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox tbUsername;
private System.Windows.Forms.TextBox tbFirstName;
private System.Windows.Forms.TextBox tbLastName;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox tbPhoneNumber;
private System.Windows.Forms.TextBox tbEmail;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.NumericUpDown nHourlyWage;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.DateTimePicker dtbContractStartDate;
private System.Windows.Forms.ComboBox cmbDepartment;
}
} |
||||
TheStack | e8deebaf346344a6053ca9a0bf17a01e725a0881 | C#code:C# | {"size": 2291, "ext": "cs", "max_stars_repo_path": "src/Components/src/Microsoft.AspNetCore.Components/Services/IUriHelper.cs", "max_stars_repo_name": "natemcmaster/Home", "max_stars_repo_stars_event_min_datetime": "2019-04-08T16:46:59.000Z", "max_stars_repo_stars_event_max_datetime": "2019-09-13T16:59:47.000Z", "max_issues_repo_path": "src/Components/src/Microsoft.AspNetCore.Components/Services/IUriHelper.cs", "max_issues_repo_name": "nnvbmmm/AspNetCore", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Components/src/Microsoft.AspNetCore.Components/Services/IUriHelper.cs", "max_forks_repo_name": "nnvbmmm/AspNetCore", "max_forks_repo_forks_event_min_datetime": "2018-12-01T15:46:43.000Z", "max_forks_repo_forks_event_max_datetime": "2020-01-04T09:57:46.000Z"} | {"max_stars_count": 2.0, "max_issues_count": null, "max_forks_count": 2.0, "avg_line_length": 40.9107142857, "max_line_length": 127, "alphanum_fraction": 0.6185072021} | // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Microsoft.AspNetCore.Components.Services
{
/// <summary>
/// Helpers for working with URIs and navigation state.
/// </summary>
public interface IUriHelper
{
/// <summary>
/// Gets the current absolute URI.
/// </summary>
/// <returns>The current absolute URI.</returns>
string GetAbsoluteUri();
/// <summary>
/// An event that fires when the navigation location has changed.
/// </summary>
event EventHandler<string> OnLocationChanged;
/// <summary>
/// Converts a relative URI into an absolute one (by resolving it
/// relative to the current absolute URI).
/// </summary>
/// <param name="href">The relative URI.</param>
/// <returns>The absolute URI.</returns>
Uri ToAbsoluteUri(string href);
/// <summary>
/// Gets the base URI (with trailing slash) that can be prepended before relative URI paths to produce an absolute URI.
/// Typically this corresponds to the 'href' attribute on the document's <base> element.
/// </summary>
/// <returns>The URI prefix, which has a trailing slash.</returns>
string GetBaseUri();
/// <summary>
/// Given a base URI (e.g., one previously returned by <see cref="GetBaseUri"/>),
/// converts an absolute URI into one relative to the base URI prefix.
/// </summary>
/// <param name="baseUri">The base URI prefix (e.g., previously returned by <see cref="GetBaseUri"/>).</param>
/// <param name="locationAbsolute">An absolute URI that is within the space of the base URI.</param>
/// <returns>A relative URI path.</returns>
string ToBaseRelativePath(string baseUri, string locationAbsolute);
/// <summary>
/// Navigates to the specified URI.
/// </summary>
/// <param name="uri">The destination URI. This can be absolute, or relative to the base URI
/// (as returned by <see cref="GetBaseUri"/>).</param>
void NavigateTo(string uri);
}
}
|
||||
TheStack | e8df2500d1f2d6b6a88dd0d8e2739491dd215d64 | C#code:C# | {"size": 1061, "ext": "cs", "max_stars_repo_path": "Projetos/AppGallery/AppGallery/AppGallery/XamarinForms/Controles/CampoDeEntradaSimplesControle/CampoDeEntradaSimples.xaml.cs", "max_stars_repo_name": "Abner37/Xamarin-Forms", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Projetos/AppGallery/AppGallery/AppGallery/XamarinForms/Controles/CampoDeEntradaSimplesControle/CampoDeEntradaSimples.xaml.cs", "max_issues_repo_name": "Abner37/Xamarin-Forms", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Projetos/AppGallery/AppGallery/AppGallery/XamarinForms/Controles/CampoDeEntradaSimplesControle/CampoDeEntradaSimples.xaml.cs", "max_forks_repo_name": "Abner37/Xamarin-Forms", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 28.6756756757, "max_line_length": 80, "alphanum_fraction": 0.6531573987} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace AppGallery.XamarinForms.Controles.CampoDeEntradaSimplesControle
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class CampoDeEntradaSimples : ContentPage
{
public CampoDeEntradaSimples()
{
InitializeComponent();
}
private void Entry_Focused(object sender, FocusEventArgs e)
{
lblFocus.Text = "Campo focado";
}
private void Entry_Unfocused(object sender, FocusEventArgs e)
{
lblFocus.Text = "Campo perdeu o foco";
}
private void Entry_TextChanged(object sender, TextChangedEventArgs e)
{
lblTextchange.Text = e.NewTextValue + " - " + e.NewTextValue.Length;
}
private void Entry_Completed(object sender, EventArgs e)
{
lblComplete.Text = "Preenchimento finalizado";
}
}
} |
||||
TheStack | e8e2c90cd360d2a4dcea6e686a14c7d313de61c4 | C#code:C# | {"size": 2027, "ext": "cs", "max_stars_repo_path": "src/Spard/Transitions/TransitionContext.cs", "max_stars_repo_name": "VladimirKhil/Lingware", "max_stars_repo_stars_event_min_datetime": "2020-12-05T11:59:36.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-03T17:29:04.000Z", "max_issues_repo_path": "src/Spard/Transitions/TransitionContext.cs", "max_issues_repo_name": "VladimirKhil/Spard", "max_issues_repo_issues_event_min_datetime": "2020-05-15T05:47:47.000Z", "max_issues_repo_issues_event_max_datetime": "2021-12-27T19:47:24.000Z", "max_forks_repo_path": "src/Spard/Transitions/TransitionContext.cs", "max_forks_repo_name": "VladimirKhil/Spard", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": 3.0, "max_issues_count": 10.0, "max_forks_count": null, "avg_line_length": 34.9482758621, "max_line_length": 112, "alphanum_fraction": 0.5984213123} | using Spard.Core;
using System.Collections.Generic;
namespace Spard.Transitions
{
/// <summary>
/// Table transformer context.
/// When moving from state to state, it keeps all necessary information about previous matches.
/// This information can be used to control branching or build a result.
/// </summary>
internal sealed class TransitionContext
{
/// <summary>
/// Saved results (they are consistently accumulated during the transformation)
/// </summary>
internal List<TransitionResult> Results { get; } = new List<TransitionResult>();
/// <summary>
/// Context variables (they are appended during the transformation), the oldest values
/// </summary>
internal Dictionary<string, IList<object>> Vars { get; set; } = new Dictionary<string, IList<object>>();
/// <summary>
/// The increase of the result insertion index within recursion
/// </summary>
public int ResultIndexIncrease { get; set; }
/// <summary>
/// Get the values of variables at the specified index of the saved list of results.
/// The index is counted from the initial state
/// </summary>
/// <param name="index">0, if initial values are needed; result index otherwise</param>
/// <returns></returns>
internal Dictionary<string, IList<object>> GetVarsByIndex(int index)
{
return index == 0 ? Vars : Results[index - 1].Vars;
}
/// <summary>
/// Create a classic transformation tree context (fill in the values of variables)
/// </summary>
/// <returns></returns>
public Context CreateContext()
{
var context = new Context((IRuntimeInfo)null);
var actualVars = GetVarsByIndex(Results.Count);
foreach (var item in actualVars)
{
context.Vars[item.Key] = item.Value;
}
return context;
}
}
}
|
||||
TheStack | e8e3cc4852cfa2ffeea0a4a25e5e464e44d05337 | C#code:C# | {"size": 1698, "ext": "cs", "max_stars_repo_path": "tests/JustSaying.UnitTests/Messaging/Channels/SubscriptionGroupTests/WhenListeningWithMultipleGroups.cs", "max_stars_repo_name": "justeat/JustSaying", "max_stars_repo_stars_event_min_datetime": "2015-01-05T12:09:18.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T22:11:18.000Z", "max_issues_repo_path": "tests/JustSaying.UnitTests/Messaging/Channels/SubscriptionGroupTests/WhenListeningWithMultipleGroups.cs", "max_issues_repo_name": "justeat/JustSaying", "max_issues_repo_issues_event_min_datetime": "2015-01-02T17:56:59.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-22T02:03:51.000Z", "max_forks_repo_path": "tests/JustSaying.UnitTests/Messaging/Channels/SubscriptionGroupTests/WhenListeningWithMultipleGroups.cs", "max_forks_repo_name": "justeat/JustSaying", "max_forks_repo_forks_event_min_datetime": "2015-01-23T14:48:05.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-19T00:44:48.000Z"} | {"max_stars_count": 249.0, "max_issues_count": 728.0, "max_forks_count": 184.0, "avg_line_length": 34.6530612245, "max_line_length": 103, "alphanum_fraction": 0.6843345112} | using JustSaying.AwsTools.MessageHandling;
using JustSaying.Messaging.Channels.SubscriptionGroups;
using Newtonsoft.Json;
namespace JustSaying.UnitTests.Messaging.Channels.SubscriptionGroupTests;
public class WhenListeningWithMultipleGroups : BaseSubscriptionGroupTests
{
private readonly ISqsQueue _queueB;
private readonly ISqsQueue _queueA;
public WhenListeningWithMultipleGroups(ITestOutputHelper testOutputHelper) : base(testOutputHelper)
{
_queueA = CreateSuccessfulTestQueue("EC159934-A30E-45B0-9186-78853F7D3BED", new TestMessage());
_queueB = CreateSuccessfulTestQueue("C7506B3F-81DA-4898-82A5-C0293523592A", new TestMessage());
}
protected override Dictionary<string, SubscriptionGroupConfigBuilder> SetupBusConfig()
{
return new Dictionary<string, SubscriptionGroupConfigBuilder>
{
{
"queueA", new SubscriptionGroupConfigBuilder("queueA")
.AddQueue(_queueA)
.WithPrefetch(5)
.WithBufferSize(20)
.WithConcurrencyLimit(1)
.WithMultiplexerCapacity(30)
},
{ "queueB", new SubscriptionGroupConfigBuilder("queueB").AddQueue(_queueB) }
};
}
protected override void Given()
{
Queues.Add(_queueA);
Queues.Add(_queueB);
}
[Fact]
public void SubscriptionGroups_OverridesDefaultSettingsCorrectly()
{
var interrogationResult = SystemUnderTest.Interrogate();
var json = JsonConvert.SerializeObject(interrogationResult, Formatting.Indented);
json.ShouldMatchApproved(c => c.SubFolder("Approvals"));
}
} |
||||
TheStack | e8e3d62dafe866c0bc6f58d82120cd3c9bd1fab7 | C#code:C# | {"size": 966, "ext": "cs", "max_stars_repo_path": "Ventas/holamundo/holamundo/BL/ProductosBL.cs", "max_stars_repo_name": "ermexg7/ventas", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Ventas/holamundo/holamundo/BL/ProductosBL.cs", "max_issues_repo_name": "ermexg7/ventas", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Ventas/holamundo/holamundo/BL/ProductosBL.cs", "max_forks_repo_name": "ermexg7/ventas", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.4210526316, "max_line_length": 80, "alphanum_fraction": 0.6128364389} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Ventas.Modelos;
namespace Ventas.BL
{
public class ProductosBL
{
public List<Productos> ListadeProductos { get; set; }
public ProductosBL()
{
ListadeProductos = new List<Productos>();
CrearDatosdePrueba();
}
private void CrearDatosdePrueba()
{
var categoria1 = new Categoria(1, "Laptop");
var categoria2 = new Categoria(2, "Accesorios");
var producto1 = new Productos(1, "Laptop DELL", 15000, categoria1);
var producto2 = new Productos(2, "Laptop Axus", 20000, categoria1);
var producto3 = new Productos(3, "Mouse Logitech", 150, categoria2);
ListadeProductos.Add(producto1);
ListadeProductos.Add(producto2);
ListadeProductos.Add(producto3);
}
}
}
|
||||
TheStack | e8e4f4110f1e5afc25dfbacbffa0855c55363249 | C#code:C# | {"size": 598, "ext": "cs", "max_stars_repo_path": "src/Tests/Plugins.Caching/conditionals/if_none_match/matching.cs", "max_stars_repo_name": "openrasta/openrasta-core", "max_stars_repo_stars_event_min_datetime": "2015-01-30T01:49:15.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-11T03:47:16.000Z", "max_issues_repo_path": "src/Tests/Plugins.Caching/conditionals/if_none_match/matching.cs", "max_issues_repo_name": "openrasta/openrasta-core", "max_issues_repo_issues_event_min_datetime": "2015-01-20T11:31:49.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-11T20:33:28.000Z", "max_forks_repo_path": "src/Tests/Plugins.Caching/conditionals/if_none_match/matching.cs", "max_forks_repo_name": "openrasta/openrasta-core", "max_forks_repo_forks_event_min_datetime": "2015-01-19T15:31:08.000Z", "max_forks_repo_forks_event_max_datetime": "2020-10-05T13:59:17.000Z"} | {"max_stars_count": 40.0, "max_issues_count": 140.0, "max_forks_count": 39.0, "avg_line_length": 23.92, "max_line_length": 68, "alphanum_fraction": 0.6722408027} | using OpenRasta.Configuration;
using OpenRasta.Plugins.Caching.Pipeline;
using Shouldly;
using Tests.Plugins.Caching.contexts;
using Xunit;
namespace Tests.Plugins.Caching.conditionals.if_none_match
{
public class matching : caching
{
public matching()
{
given_resource<TestResource>(map => map.Etag(_ => "v1"));
given_request_header("if-none-match", Etag.StrongEtag("v1"));
when_executing_request("/TestResource");
}
[Fact]
public void returns_not_modified()
{
response.StatusCode.ShouldBe(expected: 304);
}
}
} |
||||
TheStack | e8e5669e5aeede2fca3891e255068a6f652973b8 | C#code:C# | {"size": 1264, "ext": "cs", "max_stars_repo_path": "src/Jasper.Http.Testing/ContentHandling/read_and_write_json_content.cs", "max_stars_repo_name": "ndcomplete/jasper", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Jasper.Http.Testing/ContentHandling/read_and_write_json_content.cs", "max_issues_repo_name": "ndcomplete/jasper", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Jasper.Http.Testing/ContentHandling/read_and_write_json_content.cs", "max_forks_repo_name": "ndcomplete/jasper", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 22.1754385965, "max_line_length": 99, "alphanum_fraction": 0.5450949367} | using System.Threading.Tasks;
using Alba;
using Shouldly;
using Xunit;
namespace Jasper.Http.Testing.ContentHandling
{
public class read_and_write_json_content : RegistryContext<HttpTestingApp>
{
public read_and_write_json_content(RegistryFixture<HttpTestingApp> fixture) : base(fixture)
{
}
[Fact]
public async Task read_and_write()
{
var numbers = new SomeNumbers
{
X = 3, Y = 5
};
var result = await scenario(_ =>
{
_.Post.Json(numbers).ToUrl("/sum");
_.StatusCodeShouldBeOk();
_.ContentTypeShouldBe("application/json");
});
var sum = result.ResponseBody.ReadAsJson<SumValue>();
sum.Sum.ShouldBe(8);
}
}
public class SomeNumbers
{
public int X { get; set; }
public int Y { get; set; }
}
public class SumValue
{
public int Sum { get; set; }
}
// SAMPLE: NumbersEndpoint
public class NumbersEndpoint
{
public static SumValue post_sum(SomeNumbers input)
{
return new SumValue {Sum = input.X + input.Y};
}
}
// ENDSAMPLE
}
|
||||
TheStack | e8e574ca0d0c079c6af9b45e7a948b746db1dd92 | C#code:C# | {"size": 296, "ext": "cs", "max_stars_repo_path": "ClassPort.Domain/Entities/Identity/ApplicationRole.cs", "max_stars_repo_name": "PhillipPhan111/ClassPort", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "ClassPort.Domain/Entities/Identity/ApplicationRole.cs", "max_issues_repo_name": "PhillipPhan111/ClassPort", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "ClassPort.Domain/Entities/Identity/ApplicationRole.cs", "max_forks_repo_name": "PhillipPhan111/ClassPort", "max_forks_repo_forks_event_min_datetime": "2022-03-30T15:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T15:04:08.000Z"} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": 1.0, "avg_line_length": 29.6, "max_line_length": 77, "alphanum_fraction": 0.7905405405} | using Microsoft.AspNetCore.Identity;
namespace ClassPort.Domain.Entities.Identity;
public class ApplicationRole : IdentityRole<string>
{
public virtual ICollection<ApplicationUserRole> UserRoles { get; set; }
public virtual ICollection<ApplicationRoleClaim> RoleClaims { get; set; }
} |
||||
TheStack | e8e66968731984400bfdd4632b27240e165553e6 | C#code:C# | {"size": 835, "ext": "cs", "max_stars_repo_path": "Assets/Scripts/Player/States/IdleState.cs", "max_stars_repo_name": "UVGDClub/CyberpunkGame", "max_stars_repo_stars_event_min_datetime": "2018-09-21T19:05:48.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-06T23:58:26.000Z", "max_issues_repo_path": "Assets/Scripts/Player/States/IdleState.cs", "max_issues_repo_name": "UVGDClub/CyberpunkGame", "max_issues_repo_issues_event_min_datetime": "2018-10-05T01:42:35.000Z", "max_issues_repo_issues_event_max_datetime": "2018-11-11T22:43:13.000Z", "max_forks_repo_path": "Assets/Scripts/Player/States/IdleState.cs", "max_forks_repo_name": "UVGDClub/CyberpunkGame", "max_forks_repo_forks_event_min_datetime": "2018-09-28T00:33:18.000Z", "max_forks_repo_forks_event_max_datetime": "2018-10-26T21:03:03.000Z"} | {"max_stars_count": 12.0, "max_issues_count": 3.0, "max_forks_count": 7.0, "avg_line_length": 27.8333333333, "max_line_length": 90, "alphanum_fraction": 0.6910179641} | using UnityEngine;
[CreateAssetMenu(menuName = "States/IdleState")]
public class IdleState : APlayerState {
public override void OnEnter(Player player)
{
player.rigidbody2d.constraints = RigidbodyConstraints2D.FreezeAll;
player.animator.SetBool("Idle", true);
}
public override void OnExit(Player player)
{
player.rigidbody2d.constraints = RigidbodyConstraints2D.FreezeRotation;
player.animator.SetBool("Idle", false);
}
public override void Execute(Player player)
{
if (player.bottomHit)
return;
player.rigidbody2d.constraints = RigidbodyConstraints2D.FreezeRotation;
}
public override bool CanTransitionInto( Player player ) {
return Mathf.Approximately(Input.GetAxisRaw("Horizontal"), 0) && player.bottomHit;
}
}
|
||||
TheStack | e8e75758d3119a949604f4ec56e83a7318ba277d | C#code:C# | {"size": 463, "ext": "cs", "max_stars_repo_path": "Exercise1/Exercise1.Data/Models/VirbelaListing/RegionListing.cs", "max_stars_repo_name": "dong82/VirbelaChallenges", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Exercise1/Exercise1.Data/Models/VirbelaListing/RegionListing.cs", "max_issues_repo_name": "dong82/VirbelaChallenges", "max_issues_repo_issues_event_min_datetime": "2021-04-04T21:11:12.000Z", "max_issues_repo_issues_event_max_datetime": "2021-04-04T21:11:12.000Z", "max_forks_repo_path": "Exercise1/Exercise1.Data/Models/VirbelaListing/RegionListing.cs", "max_forks_repo_name": "dong82/VirbelaChallenges", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": 1.0, "max_forks_count": null, "avg_line_length": 25.7222222222, "max_line_length": 49, "alphanum_fraction": 0.5982721382} | using System;
namespace Exercise1.Data.Models.VirbelaListing
{
public class Region_Listing
{
public int Id { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public decimal Price { get; set; }
public int CreatorId { get; set; }
public DateTime CreatedDate { get; set; }
public int RegionId { get; set; }
public string RegionName { get; set; }
}
}
|
||||
TheStack | e8eb2a9e032695c40424c032f5bb03d1061ff230 | C#code:C# | {"size": 197, "ext": "cs", "max_stars_repo_path": "MyWebServer/Controllers/HomeController.cs", "max_stars_repo_name": "milen92sl/CSharp-MyWebServer", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "MyWebServer/Controllers/HomeController.cs", "max_issues_repo_name": "milen92sl/CSharp-MyWebServer", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "MyWebServer/Controllers/HomeController.cs", "max_forks_repo_name": "milen92sl/CSharp-MyWebServer", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 14.0714285714, "max_line_length": 35, "alphanum_fraction": 0.5837563452} |
using MyWebServer.Server.Http;
namespace MyWebServer.Controllers
{
public class HomeController
{
public HttpResponse Index()
{
return null;
}
}
}
|
||||
TheStack | e8ebd18df4db63a94c97570cc1c78abcbe6a8acc | C#code:C# | {"size": 1584, "ext": "cs", "max_stars_repo_path": "MvvmCross-Forms/MvvmCross.Forms/Presenters/MvxFormsPageLoader.cs", "max_stars_repo_name": "Oglan/MvvmCross", "max_stars_repo_stars_event_min_datetime": "2017-06-05T12:22:40.000Z", "max_stars_repo_stars_event_max_datetime": "2017-06-05T12:22:40.000Z", "max_issues_repo_path": "MvvmCross-Forms/MvvmCross.Forms/Presenters/MvxFormsPageLoader.cs", "max_issues_repo_name": "Oglan/MvvmCross", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "MvvmCross-Forms/MvvmCross.Forms/Presenters/MvxFormsPageLoader.cs", "max_forks_repo_name": "Oglan/MvvmCross", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": 1.0, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 26.8474576271, "max_line_length": 72, "alphanum_fraction": 0.6407828283} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using MvvmCross.Core.ViewModels;
using MvvmCross.Core.Views;
using MvvmCross.Platform;
using MvvmCross.Platform.IoC;
using Xamarin.Forms;
namespace MvvmCross.Forms.Presenters
{
public class MvxFormsPageLoader : IMvxFormsPageLoader
{
private IMvxViewsContainer _viewFinder;
public Page LoadPage(MvxViewModelRequest request)
{
var pageName = GetPageName(request);
var pageType = GetPageType(request);
if (pageType == null)
{
Mvx.Trace("Page not found for {0}", pageName);
return null;
}
var page = Activator.CreateInstance(pageType) as Page;
if (page == null)
{
Mvx.Error("Failed to create ContentPage {0}", pageName);
}
return page;
}
protected virtual string GetPageName(MvxViewModelRequest request)
{
var viewModelName = request.ViewModelType.Name;
return viewModelName.Replace("ViewModel", "Page");
}
protected virtual Type GetPageType(MvxViewModelRequest request)
{
if (_viewFinder == null)
_viewFinder = Mvx.Resolve<IMvxViewsContainer> ();
try
{
return _viewFinder.GetViewType (request.ViewModelType);
}
catch(KeyNotFoundException)
{
var pageName = GetPageName(request);
return request.ViewModelType.GetTypeInfo().Assembly.CreatableTypes()
.FirstOrDefault(t => t.Name == pageName);
}
}
}
} |
||||
TheStack | e8ec05a501d9cc498d6735b78234148b25978e0d | C#code:C# | {"size": 2778, "ext": "cs", "max_stars_repo_path": "C#Development/C#Web/C#WebDevelopmentBasics/Exams/ModPanel/ModPanel.Data/Migrations/20180921073754_initial.Designer.cs", "max_stars_repo_name": "stoyanov7/SoftwareUniversity", "max_stars_repo_stars_event_min_datetime": "2017-01-05T19:21:48.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-08T03:30:56.000Z", "max_issues_repo_path": "C#Development/C#Web/C#WebDevelopmentBasics/Exams/ModPanel/ModPanel.Data/Migrations/20180921073754_initial.Designer.cs", "max_issues_repo_name": "stoyanov7/SoftwareUniversity", "max_issues_repo_issues_event_min_datetime": "2022-03-02T02:50:48.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-02T02:50:48.000Z", "max_forks_repo_path": "C#Development/C#Web/C#WebDevelopmentBasics/Exams/ModPanel/ModPanel.Data/Migrations/20180921073754_initial.Designer.cs", "max_forks_repo_name": "stoyanov7/SoftwareUniversity", "max_forks_repo_forks_event_min_datetime": "2019-02-08T11:15:28.000Z", "max_forks_repo_forks_event_max_datetime": "2019-06-21T11:47:42.000Z"} | {"max_stars_count": 9.0, "max_issues_count": 1.0, "max_forks_count": 2.0, "avg_line_length": 34.2962962963, "max_line_length": 126, "alphanum_fraction": 0.5100791937} | // <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using ModPanel.Data;
namespace ModPanel.Data.Migrations
{
[DbContext(typeof(ModPanelContext))]
[Migration("20180921073754_initial")]
partial class initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.1.3-rtm-32065")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("ModPanel.Models.Post", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Content")
.IsRequired();
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(100);
b.Property<int>("UserId");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("Posts");
});
modelBuilder.Entity("ModPanel.Models.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Email");
b.Property<bool>("IsAdmin");
b.Property<bool>("IsApproved");
b.Property<string>("PasswordHash");
b.Property<int>("Position");
b.HasKey("Id");
b.HasIndex("Email")
.IsUnique()
.HasFilter("[Email] IS NOT NULL");
b.ToTable("Users");
});
modelBuilder.Entity("ModPanel.Models.Post", b =>
{
b.HasOne("ModPanel.Models.User", "User")
.WithMany("Posts")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}
|
||||
TheStack | e8ec8fbc5b48575cd454bff9e3eb7d946bb50386 | C#code:C# | {"size": 148, "ext": "cs", "max_stars_repo_path": "Typo4/Typo4/Pages/SettingsApp.xaml.cs", "max_stars_repo_name": "gro-ove/typo4", "max_stars_repo_stars_event_min_datetime": "2020-11-10T00:38:47.000Z", "max_stars_repo_stars_event_max_datetime": "2021-02-10T16:05:27.000Z", "max_issues_repo_path": "Typo4/Typo4/Pages/SettingsApp.xaml.cs", "max_issues_repo_name": "gro-ove/typo4", "max_issues_repo_issues_event_min_datetime": "2019-03-10T07:52:33.000Z", "max_issues_repo_issues_event_max_datetime": "2020-09-05T12:06:09.000Z", "max_forks_repo_path": "Typo4/Typo4/Pages/SettingsApp.xaml.cs", "max_forks_repo_name": "gro-ove/typo4", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": 2.0, "max_issues_count": 1.0, "max_forks_count": null, "avg_line_length": 18.5, "max_line_length": 38, "alphanum_fraction": 0.5675675676} | namespace Typo4.Pages {
public partial class SettingsApp {
public SettingsApp() {
InitializeComponent();
}
}
}
|
||||
TheStack | e8ecc56cc390880efa5cbe0a3918589fdd29bc32 | C#code:C# | {"size": 669, "ext": "cs", "max_stars_repo_path": "src/backEnd/BungalowCore/Bungalow.Core/Model/Apartments.cs", "max_stars_repo_name": "vandred/Bungalow", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/backEnd/BungalowCore/Bungalow.Core/Model/Apartments.cs", "max_issues_repo_name": "vandred/Bungalow", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/backEnd/BungalowCore/Bungalow.Core/Model/Apartments.cs", "max_forks_repo_name": "vandred/Bungalow", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.7307692308, "max_line_length": 53, "alphanum_fraction": 0.5964125561} | using System;
using System.Collections.Generic;
using System.Text;
namespace Bungalow.Core.Model
{
public class Apartments
{
public int Id { get; set; }
public string Name { get; set; }
public float Price { get; set; }
}
public class BookRecords
{
public Apartments AType { get; set; }
public string ReservationNumber { get; set; }
public string FName { get; set; }
public string lName { get; set; }
public string Email { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public float TotalPrice { get; set; }
}
}
|
||||
TheStack | e8ed0d934d6c78b821ce6021a9af00ee64341854 | C#code:C# | {"size": 49978, "ext": "cs", "max_stars_repo_path": "ASRuntime/nativefuncs/ByteArray_buildin.cs", "max_stars_repo_name": "asheigithub/AS3Tool", "max_stars_repo_stars_event_min_datetime": "2018-03-27T05:48:23.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-31T15:59:21.000Z", "max_issues_repo_path": "ASRuntime/nativefuncs/ByteArray_buildin.cs", "max_issues_repo_name": "asheigithub/AS3Tool", "max_issues_repo_issues_event_min_datetime": "2019-08-20T16:15:11.000Z", "max_issues_repo_issues_event_max_datetime": "2021-08-19T08:51:14.000Z", "max_forks_repo_path": "ASRuntime/nativefuncs/ByteArray_buildin.cs", "max_forks_repo_name": "asheigithub/AS3Tool", "max_forks_repo_forks_event_min_datetime": "2018-04-04T08:44:53.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-26T20:07:17.000Z"} | {"max_stars_count": 91.0, "max_issues_count": 3.0, "max_forks_count": 22.0, "avg_line_length": 19.0755725191, "max_line_length": 166, "alphanum_fraction": 0.6493857297} | using ASBinCode;
using ASBinCode.rtData;
using System;
using System.Collections.Generic;
using System.Text;
using ASBinCode.rtti;
using ASRuntime.flash.utils;
namespace ASRuntime.nativefuncs
{
class ByteArray_constructor : NativeFunctionBase
{
private List<RunTimeDataType> _paras;
public ByteArray_constructor()
{
_paras = new List<RunTimeDataType>();
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_constructor_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.rt_void;
}
}
public override RunTimeValueBase execute(RunTimeValueBase thisObj, SLOT[] argements, object stackframe, out string errormessage, out int errorno)
{
errormessage = null;
errorno = 0;
var bytearrayclass=((StackFrame)stackframe).player.swc.getClassByRunTimeDataType(thisObj.rtType);
var rtobj = new ASBinCode.rtti.HostedObject(bytearrayclass);
rtobj.hosted_object = new ByteArray();
var newvalue = new ASBinCode.rtData.rtObject(rtobj,null);
((rtObjectBase)thisObj).value.memberData[0].directSet(newvalue);
return ASBinCode.rtData.rtUndefined.undefined;
}
}
class ByteArray_clear : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_clear():base(0)
{
_paras = new List<RunTimeDataType>();
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_clear_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.fun_void;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
ms.clear();
success = true;
returnSlot.directSet(ASBinCode.rtData.rtUndefined.undefined);
}
}
class ByteArray_bytesSetEndian : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_bytesSetEndian() : base(1)
{
_paras = new List<RunTimeDataType>();
_paras.Add(RunTimeDataType.rt_string);
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_bytesSetEndian_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.fun_void;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
string newvalue = TypeConverter.ConvertToString(argements[0],stackframe,token);
if (newvalue != "bigEndian" && newvalue != "littleEndian")
{
success = false;
stackframe.throwArgementException(token, "Parameter type must be one of the accepted values.");
}
else
{
success = true;
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
ms.isbig = (newvalue == "bigEndian");
((rtObjectBase)thisObj).value.memberData[1].directSet(ms.isbig ? Endian.bigEndian : Endian.littleEndian);
}
returnSlot.directSet(ASBinCode.rtData.rtUndefined.undefined);
}
}
class ByteArray_bytesAvailable : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_bytesAvailable() : base(0)
{
_paras = new List<RunTimeDataType>();
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_bytesAvailable_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.rt_uint;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
success = true;
returnSlot.setValue(ms.bytesAvailable);
}
}
class ByteArray_getlength : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_getlength() : base(0)
{
_paras = new List<RunTimeDataType>();
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_getlength_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.rt_uint;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
success = true;
returnSlot.setValue(ms.length);
}
}
class ByteArray_setlength : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_setlength() : base(1)
{
_paras = new List<RunTimeDataType>();
_paras.Add(RunTimeDataType.rt_uint);
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_setlength_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.fun_void;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
try
{
success = true;
ms.length = TypeConverter.ConvertToUInt(argements[0],stackframe,token);
returnSlot.setValue(rtUndefined.undefined);
}
catch (OutOfMemoryException)
{
success = false;
stackframe.throwError(token, 1000, "The system is out of memory.");
}
catch (ArgumentOutOfRangeException)
{
success = false;
stackframe.throwError(token, 1000, "The system is out of memory.");
}
}
}
class ByteArray_getposition : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_getposition() : base(0)
{
_paras = new List<RunTimeDataType>();
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_getposition_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.rt_uint;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
success = true;
returnSlot.setValue(ms.position);
}
}
class ByteArray_setposition : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_setposition() : base(1)
{
_paras = new List<RunTimeDataType>();
_paras.Add(RunTimeDataType.rt_uint);
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_setposition_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.fun_void;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
success = true;
ms.position = TypeConverter.ConvertToUInt(argements[0], stackframe, token);
returnSlot.setValue(rtUndefined.undefined);
}
}
class ByteArray_compress : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_compress() : base(1)
{
_paras = new List<RunTimeDataType>();
_paras.Add(RunTimeDataType.rt_string);
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_compress_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.fun_void;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
success = true;
ms.compress();
returnSlot.setValue(rtUndefined.undefined);
}
}
class ByteArray_uncompress : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_uncompress() : base(1)
{
_paras = new List<RunTimeDataType>();
_paras.Add(RunTimeDataType.rt_string);
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_uncompress_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.fun_void;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
success = true;
ms.uncompress();
returnSlot.setValue(rtUndefined.undefined);
}
}
class ByteArray_deflate : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_deflate() : base(0)
{
_paras = new List<RunTimeDataType>();
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_deflate_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.fun_void;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
success = true;
ms.compress();
returnSlot.setValue(rtUndefined.undefined);
}
}
class ByteArray_inflate : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_inflate() : base(0)
{
_paras = new List<RunTimeDataType>();
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_inflate_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.fun_void;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
success = true;
ms.uncompress();
returnSlot.setValue(rtUndefined.undefined);
}
}
class ByteArray_readBoolean : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_readBoolean() : base(0)
{
_paras = new List<RunTimeDataType>();
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_readBoolean_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.rt_boolean;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
try
{
success = true;
bool b = ms.readBoolean();
returnSlot.setValue(b ? rtBoolean.True : rtBoolean.False);
}
catch (EOFException)
{
success = false;
stackframe.throwEOFException(token, "End of file was encountered");
}
}
}
class ByteArray_readByte : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_readByte() : base(0)
{
_paras = new List<RunTimeDataType>();
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_readByte_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.rt_int;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
try
{
success = true;
int b = ms.readByte();
returnSlot.setValue(b);
}
catch (EOFException)
{
success = false;
stackframe.throwEOFException(token, "End of file was encountered");
}
}
}
class ByteArray_readBytes : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_readBytes() : base(3)
{
_paras = new List<RunTimeDataType>();
_paras.Add(RunTimeDataType.rt_void);
_paras.Add(RunTimeDataType.rt_uint);
_paras.Add(RunTimeDataType.rt_uint);
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_readBytes_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.fun_void;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
if (argements[0].rtType == RunTimeDataType.rt_null)
{
success = false;
stackframe.throwArgementException(token, "Parameter bytes must be non-null.");
return;
}
var target = (ByteArray)((HostedObject) (((rtObjectBase)(((rtObjectBase)argements[0]).value.memberData[0].getValue())).value)).hosted_object;
uint offset = TypeConverter.ConvertToUInt(argements[1], stackframe, token);
uint length = TypeConverter.ConvertToUInt(argements[2], stackframe, token);
try
{
success = true;
ms.readBytes(target, offset, length);
returnSlot.setValue(rtUndefined.undefined);
}
catch (EOFException)
{
success = false;
stackframe.throwEOFException(token, "End of file was encountered");
}
}
}
class ByteArray_readDouble : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_readDouble() : base(0)
{
_paras = new List<RunTimeDataType>();
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_readDouble_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.rt_number;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
try
{
success = true;
returnSlot.setValue(ms.readDouble());
}
catch (EOFException)
{
success = false;
stackframe.throwEOFException(token, "End of file was encountered");
}
}
}
class ByteArray_readFloat : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_readFloat() : base(0)
{
_paras = new List<RunTimeDataType>();
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_readFloat_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.rt_number;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
try
{
success = true;
returnSlot.setValue(ms.readFloat());
}
catch (EOFException)
{
success = false;
stackframe.throwEOFException(token, "End of file was encountered");
}
}
}
class ByteArray_readInt : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_readInt() : base(0)
{
_paras = new List<RunTimeDataType>();
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_readInt_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.rt_int;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
try
{
success = true;
returnSlot.setValue(ms.readInt());
}
catch (EOFException)
{
success = false;
stackframe.throwEOFException(token, "End of file was encountered");
}
}
}
class ByteArray_readMultiByte : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_readMultiByte() : base(2)
{
_paras = new List<RunTimeDataType>();
_paras.Add(RunTimeDataType.rt_uint);
_paras.Add(RunTimeDataType.rt_string);
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_readMultiByte_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.rt_string;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
uint length = TypeConverter.ConvertToUInt(argements[0], stackframe, token);
string charset = TypeConverter.ConvertToString(argements[1], stackframe, token);
if (charset == null)
{
success = false;
stackframe.throwArgementException(token, "Parameter "+ functionDefine.signature.parameters[1].name + " must be non-null.");
}
else
{
try
{
success = true;
returnSlot.setValue(ms.readMultiByte(length, charset));
}
catch (EOFException)
{
success = false;
stackframe.throwEOFException(token, "End of file was encountered");
}
}
}
}
class ByteArray_readShort : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_readShort() : base(0)
{
_paras = new List<RunTimeDataType>();
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_readShort_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.rt_int;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
try
{
success = true;
returnSlot.setValue(ms.readShort());
}
catch (EOFException)
{
success = false;
stackframe.throwEOFException(token, "End of file was encountered");
}
}
}
class ByteArray_readUnsignedByte : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_readUnsignedByte() : base(0)
{
_paras = new List<RunTimeDataType>();
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_readUnsignedByte_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.rt_uint;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
try
{
success = true;
returnSlot.setValue(ms.readUnsignedByte());
}
catch (EOFException)
{
success = false;
stackframe.throwEOFException(token, "End of file was encountered");
}
}
}
class ByteArray_readUnsignedInt : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_readUnsignedInt() : base(0)
{
_paras = new List<RunTimeDataType>();
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_readUnsignedInt_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.rt_uint;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
try
{
success = true;
returnSlot.setValue(ms.readUnsignedInt());
}
catch (EOFException)
{
success = false;
stackframe.throwEOFException(token, "End of file was encountered");
}
}
}
class ByteArray_readUnsignedShort : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_readUnsignedShort() : base(0)
{
_paras = new List<RunTimeDataType>();
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_readUnsignedShort_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.rt_uint;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
try
{
success = true;
returnSlot.setValue(ms.readUnsignedShort());
}
catch (EOFException)
{
success = false;
stackframe.throwEOFException(token, "End of file was encountered");
}
}
}
class ByteArray_readUTF : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_readUTF() : base(0)
{
_paras = new List<RunTimeDataType>();
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_readUTF_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.rt_string;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
try
{
success = true;
returnSlot.setValue(ms.readUTF());
}
catch (EOFException)
{
success = false;
stackframe.throwEOFException(token, "End of file was encountered");
}
}
}
class ByteArray_readUTFBytes : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_readUTFBytes() : base(1)
{
_paras = new List<RunTimeDataType>();
_paras.Add(RunTimeDataType.rt_uint);
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_readUTFBytes_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.rt_string;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
uint len = TypeConverter.ConvertToUInt(argements[0], stackframe, token);
try
{
success = true;
returnSlot.setValue(ms.readUTFBytes(len));
}
catch (EOFException)
{
success = false;
stackframe.throwEOFException(token, "End of file was encountered");
}
}
}
class ByteArray_toString : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_toString() : base(0)
{
_paras = new List<RunTimeDataType>();
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_toString_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.rt_string;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
try
{
success = true;
returnSlot.setValue(ms.ToString());
}
catch (EOFException)
{
success = false;
stackframe.throwEOFException(token, "End of file was encountered");
}
}
}
class ByteArray_writeBoolean : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_writeBoolean() : base(1)
{
_paras = new List<RunTimeDataType>();
_paras.Add(RunTimeDataType.rt_boolean);
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_writeBoolean_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.fun_void;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
bool v = TypeConverter.ConvertToBoolean(argements[0],stackframe,token).value;
ms.writeBoolean(v);
success = true;
returnSlot.setValue(rtUndefined.undefined);
}
}
class ByteArray_writeByte : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_writeByte() : base(1)
{
_paras = new List<RunTimeDataType>();
_paras.Add(RunTimeDataType.rt_int);
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_writeByte_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.fun_void;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
int v = TypeConverter.ConvertToInt(argements[0]);
ms.writeByte(v);
success = true;
returnSlot.setValue(rtUndefined.undefined);
}
}
class ByteArray_writeBytes : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_writeBytes() : base(3)
{
_paras = new List<RunTimeDataType>();
_paras.Add(RunTimeDataType.rt_void);
_paras.Add(RunTimeDataType.rt_uint);
_paras.Add(RunTimeDataType.rt_uint);
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_writeBytes_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.fun_void;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
if (argements[0].rtType == RunTimeDataType.rt_null)
{
success = false;
stackframe.throwArgementException(token, "Parameter bytes must be non-null.");
return;
}
var target = (ByteArray)((HostedObject)(((rtObjectBase)(((rtObjectBase)argements[0]).value.memberData[0].getValue())).value)).hosted_object;
uint offset = TypeConverter.ConvertToUInt(argements[1], stackframe, token);
uint length = TypeConverter.ConvertToUInt(argements[2], stackframe, token);
try
{
ms.writeBytes(target, offset, length);
success = true;
returnSlot.setValue(rtUndefined.undefined);
}
catch (ArgumentOutOfRangeException)
{
success = false;
stackframe.throwError(token, 2006, "The supplied index is out of bounds.");
}
}
}
class ByteArray_writeDouble : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_writeDouble() : base(1)
{
_paras = new List<RunTimeDataType>();
_paras.Add(RunTimeDataType.rt_number);
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_writeDouble_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.fun_void;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
double v = TypeConverter.ConvertToNumber(argements[0]);
ms.writeDouble(v);
success = true;
returnSlot.setValue(rtUndefined.undefined);
}
}
class ByteArray_writeFloat : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_writeFloat() : base(1)
{
_paras = new List<RunTimeDataType>();
_paras.Add(RunTimeDataType.rt_number);
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_writeFloat_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.fun_void;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
double v = TypeConverter.ConvertToNumber(argements[0]);
ms.writeFloat(v);
success = true;
returnSlot.setValue(rtUndefined.undefined);
}
}
class ByteArray_writeInt : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_writeInt() : base(1)
{
_paras = new List<RunTimeDataType>();
_paras.Add(RunTimeDataType.rt_int);
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_writeInt_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.fun_void;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
int v = TypeConverter.ConvertToInt(argements[0]);
ms.writeInt(v);
success = true;
returnSlot.setValue(rtUndefined.undefined);
}
}
class ByteArray_writeMultiByte : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_writeMultiByte() : base(2)
{
_paras = new List<RunTimeDataType>();
_paras.Add(RunTimeDataType.rt_string);
_paras.Add(RunTimeDataType.rt_string);
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_writeMultiByte_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.fun_void;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
string value = TypeConverter.ConvertToString(argements[0], stackframe, token);
string charset = TypeConverter.ConvertToString(argements[1], stackframe, token);
if (charset == null)
{
success = false;
stackframe.throwArgementException(token, "Parameter " + functionDefine.signature.parameters[1].name + " must be non-null.");
}
else
{
ms.writeMultiByte(value,charset);
success = true;
returnSlot.setValue(rtUndefined.undefined);
}
}
}
class ByteArray_writeShort : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_writeShort() : base(1)
{
_paras = new List<RunTimeDataType>();
_paras.Add(RunTimeDataType.rt_int);
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_writeShort_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.fun_void;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
int v = TypeConverter.ConvertToInt(argements[0]);
ms.writeShort(v);
success = true;
returnSlot.setValue(rtUndefined.undefined);
}
}
class ByteArray_writeUnsignedInt : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_writeUnsignedInt() : base(1)
{
_paras = new List<RunTimeDataType>();
_paras.Add(RunTimeDataType.rt_uint);
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_writeUnsignedInt_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.fun_void;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
uint v = TypeConverter.ConvertToUInt(argements[0], stackframe, token);
ms.writeUnsignedInt(v);
success = true;
returnSlot.setValue(rtUndefined.undefined);
}
}
class ByteArray_writeUTF : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_writeUTF() : base(1)
{
_paras = new List<RunTimeDataType>();
_paras.Add(RunTimeDataType.rt_string);
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_writeUTF_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.fun_void;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
string v = TypeConverter.ConvertToString(argements[0], stackframe, token);
if (v == null)
{
success = false;
stackframe.throwError(token, 2007, "Parameter value must be non-null.");
returnSlot.setValue(rtUndefined.undefined);
}
else
{
ms.writeUTF(v);
success = true;
returnSlot.setValue(rtUndefined.undefined);
}
}
}
class ByteArray_writeUTFBytes : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_writeUTFBytes() : base(1)
{
_paras = new List<RunTimeDataType>();
_paras.Add(RunTimeDataType.rt_string);
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_bytearray_writeUTFBytes_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.fun_void;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
string v = TypeConverter.ConvertToString(argements[0], stackframe, token);
if (v == null)
{
success = false;
stackframe.throwError(token, 2007, "Parameter value must be non-null.");
returnSlot.setValue(rtUndefined.undefined);
}
else
{
ms.writeUTFBytes(v);
success = true;
returnSlot.setValue(rtUndefined.undefined);
}
}
}
class ByteArray_getThisItem : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_getThisItem() : base(1)
{
_paras = new List<RunTimeDataType>();
_paras.Add(RunTimeDataType.rt_number);
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_flash_utils_bytearray_getThisItem_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.rt_number;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
int index = TypeConverter.ConvertToInt(argements[0]);
if (index<0)
{
success = false;
double origin = TypeConverter.ConvertToNumber(argements[0]);
if (origin < 0)
{
stackframe.throwError(token, 1069, "Property " + index + " not found on flash.utils.ByteArray and there is no default value.");
}
returnSlot.setValue(rtUndefined.undefined);
}
else
{
if (index >= ms.length)
{
success = true;
returnSlot.setValue(rtUndefined.undefined);
}
else
{
success = true;
uint pos = ms.position;
ms.position = (uint)index;
returnSlot.setValue((double)ms.readUnsignedByte());
ms.position = pos;
}
}
}
}
class ByteArray_setThisItem : NativeConstParameterFunction
{
private List<RunTimeDataType> _paras;
public ByteArray_setThisItem() : base(2)
{
_paras = new List<RunTimeDataType>();
_paras.Add(RunTimeDataType.rt_number);
_paras.Add(RunTimeDataType.rt_number);
}
public override bool isMethod
{
get
{
return true;
}
}
public override string name
{
get
{
return "_flash_utils_bytearray_setThisItem_";
}
}
public override List<RunTimeDataType> parameters
{
get
{
return _paras;
}
}
public override RunTimeDataType returnType
{
get
{
return RunTimeDataType.fun_void;
}
}
public override void execute3(RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot, SourceToken token, StackFrame stackframe, out bool success)
{
ByteArray ms =
(ByteArray)((ASBinCode.rtti.HostedObject)((rtObjectBase)(((rtObjectBase)thisObj).value.memberData[0].getValue())).value).hosted_object;
double value = TypeConverter.ConvertToNumber(argements[0]);
int index = TypeConverter.ConvertToInt(argements[1]);
if (index <0)
{
success = false;
stackframe.throwError(token, 1056, " Error #1056: Cannot create property "+index+" on flash.utils.ByteArray.");
returnSlot.setValue(rtUndefined.undefined);
}
else
{
uint oldpos = ms.position;
if (oldpos < ms.length)
{
oldpos = ms.length;
}
while (ms.length < index)
{
ms.writeByte(0);
}
ms.position = (uint)index;
ms.writeByte( (SByte)value );
ms.position = oldpos;
success = true;
returnSlot.setValue(rtUndefined.undefined);
}
}
}
}
|
||||
TheStack | e8ee216065d20d1fe11d5bf6d9e1f90663b4c8ea | C#code:C# | {"size": 836, "ext": "cs", "max_stars_repo_path": "Common/Movement/PlayerBunnyhopping.cs", "max_stars_repo_name": "JaksonD/TerrariaOverhaul", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Common/Movement/PlayerBunnyhopping.cs", "max_issues_repo_name": "JaksonD/TerrariaOverhaul", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Common/Movement/PlayerBunnyhopping.cs", "max_forks_repo_name": "JaksonD/TerrariaOverhaul", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 22.5945945946, "max_line_length": 143, "alphanum_fraction": 0.711722488} | using Terraria.ModLoader;
using TerrariaOverhaul.Core.Configuration;
using TerrariaOverhaul.Utilities;
namespace TerrariaOverhaul.Common.Movement
{
public sealed class PlayerBunnyhopping : ModPlayer
{
public static readonly ConfigEntry<bool> EnableBunnyhopping = new(ConfigSide.Both, "PlayerMovement", nameof(EnableBunnyhopping), () => true);
public static float DefaultBoost => 0.8f;
public float Boost { get; set; }
public override void ResetEffects()
{
Boost = DefaultBoost;
Player.autoJump = true;
}
public override void PostItemCheck()
{
if (!EnableBunnyhopping) {
return;
}
bool onGround = Player.OnGround();
bool wasOnGround = Player.WasOnGround();
if (!onGround && wasOnGround && Player.velocity.Y < 0f) {
Player.velocity.X += Boost * Player.KeyDirection();
}
}
}
}
|
||||
TheStack | e8f0aaf9c63831fe3436f86ab70f563b34c6a2f4 | C#code:C# | {"size": 352, "ext": "cs", "max_stars_repo_path": "vLibrary.Model/Requests/LibraryUpsertRequest.cs", "max_stars_repo_name": "arnel-k/VirtualLibrary", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "vLibrary.Model/Requests/LibraryUpsertRequest.cs", "max_issues_repo_name": "arnel-k/VirtualLibrary", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "vLibrary.Model/Requests/LibraryUpsertRequest.cs", "max_forks_repo_name": "arnel-k/VirtualLibrary", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 22.0, "max_line_length": 63, "alphanum_fraction": 0.6789772727} | using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;
namespace vLibrary.Model.Requests
{
public class LibraryUpsertRequest
{
public Guid Guid { get; set; }
[Required(ErrorMessage = "Library name is required !")]
public string Name { get; set; }
}
}
|
||||
TheStack | e8f16e459d49bd8dc4991dc4366391446b30f3e8 | C#code:C# | {"size": 442, "ext": "cs", "max_stars_repo_path": "Assets/qjs/Demos/MultiThread/MtConfigure.cs", "max_stars_repo_name": "gsioteam/unity-qjs", "max_stars_repo_stars_event_min_datetime": "2021-02-21T05:03:25.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-23T21:44:31.000Z", "max_issues_repo_path": "Assets/qjs/Demos/MultiThread/MtConfigure.cs", "max_issues_repo_name": "gsioteam/unity-qjs", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Assets/qjs/Demos/MultiThread/MtConfigure.cs", "max_forks_repo_name": "gsioteam/unity-qjs", "max_forks_repo_forks_event_min_datetime": "2021-08-28T01:40:43.000Z", "max_forks_repo_forks_event_max_datetime": "2021-08-28T01:40:43.000Z"} | {"max_stars_count": 5.0, "max_issues_count": null, "max_forks_count": 1.0, "avg_line_length": 29.4666666667, "max_line_length": 85, "alphanum_fraction": 0.7466063348} | using System;
using System.Collections.Generic;
using System.Threading;
using UnityEngine;
public class MtConfigure : qjs.Configure
{
protected override Action _typeRegister => _GenMtConfigure.Register;
public override void OnRegisterClass(Action<Type, HashSet<string>> RegisterClass)
{
RegisterClass(typeof(WaitForSeconds), null);
RegisterClass(typeof(Thread), new HashSet<string> { "CurrentContext" });
}
}
|
||||
TheStack | e8f27e7435cf93f83b29036d61f0c3528039996e | C#code:C# | {"size": 4746, "ext": "cs", "max_stars_repo_path": "PartPreviewWindow/View3D/View3DCreateSelectionData.cs", "max_stars_repo_name": "WinstonMao/MatterControl", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "PartPreviewWindow/View3D/View3DCreateSelectionData.cs", "max_issues_repo_name": "WinstonMao/MatterControl", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "PartPreviewWindow/View3D/View3DCreateSelectionData.cs", "max_forks_repo_name": "WinstonMao/MatterControl", "max_forks_repo_forks_event_min_datetime": "2019-11-21T10:34:16.000Z", "max_forks_repo_forks_event_max_datetime": "2019-11-21T10:34:16.000Z"} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": 1.0, "avg_line_length": 34.1438848921, "max_line_length": 163, "alphanum_fraction": 0.7507374631} | /*
Copyright (c) 2014, Lars Brubaker
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using MatterHackers.Agg.UI;
using MatterHackers.Localizations;
using MatterHackers.PolygonMesh;
using System.ComponentModel;
using System.Globalization;
using System.Threading;
using System.Threading.Tasks;
using System;
namespace MatterHackers.MatterControl.PartPreviewWindow
{
public partial class View3DWidget
{
private string PartsNotPrintableMessage = "Parts are not on the bed or outside the print area.\n\nWould you like to center them on the bed?".Localize();
private string PartsNotPrintableTitle = "Parts not in print area".Localize();
private void CreateSelectionData()
{
processingProgressControl.ProcessType = "Preparing Meshes".Localize() + ":";
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
PushMeshGroupDataToAsynchLists(TraceInfoOpperation.DONT_COPY);
asyncPlatingDatas.Clear();
double ratioPerMeshGroup = 1.0 / asyncMeshGroups.Count;
double currentRatioDone = 0;
for (int i = 0; i < asyncMeshGroups.Count; i++)
{
asyncPlatingDatas.Add(new PlatingMeshGroupData());
// create the selection info
PlatingHelper.CreateITraceableForMeshGroup(asyncPlatingDatas, asyncMeshGroups, i, (double progress0To1, string processingState, out bool continueProcessing) =>
{
ReportProgressChanged(progress0To1, processingState, out continueProcessing);
});
currentRatioDone += ratioPerMeshGroup;
}
bool continueProcessing2;
ReportProgressChanged(1, "Creating GL Data", out continueProcessing2);
meshViewerWidget.CreateGlDataForMeshes(asyncMeshGroups);
}
private async void EnterEditAndCreateSelectionData()
{
if (enterEditButtonsContainer.Visible == true)
{
enterEditButtonsContainer.Visible = false;
}
viewControls3D.ActiveButton = ViewControls3DButtons.PartSelect;
if (MeshGroups.Count > 0)
{
processingProgressControl.Visible = true;
LockEditControls();
viewIsInEditModePreLock = true;
await Task.Run((System.Action)CreateSelectionData);
if (HasBeenClosed)
{
return;
}
// remove the original mesh and replace it with these new meshes
PullMeshGroupDataFromAsynchLists();
SelectedMeshGroupIndex = 0;
buttonRightPanel.Visible = true;
UnlockEditControls();
viewControls3D.ActiveButton = ViewControls3DButtons.PartSelect;
Invalidate();
if (DoAddFileAfterCreatingEditData)
{
FileDialog.OpenFileDialog(
new OpenFileDialogParams(ApplicationSettings.OpenDesignFileParams, multiSelect: true),
(openParams) =>
{
LoadAndAddPartsToPlate(openParams.FileNames);
});
DoAddFileAfterCreatingEditData = false;
}
else if (pendingPartsToLoad.Count > 0)
{
LoadAndAddPartsToPlate(pendingPartsToLoad.ToArray());
pendingPartsToLoad.Clear();
}
else
{
if (!PartsAreInPrintVolume())
{
UiThread.RunOnIdle(() =>
{
StyledMessageBox.ShowMessageBox((doCentering) =>
{
if (doCentering)
{
AutoArrangePartsInBackground();
}
}, PartsNotPrintableMessage, PartsNotPrintableTitle, StyledMessageBox.MessageType.YES_NO, "Center on Bed".Localize(), "Cancel".Localize());
});
}
}
}
}
}
} |
||||
TheStack | e8f2b39aed62f099a7059ffcacf095b48939ef70 | C#code:C# | {"size": 2269, "ext": "cs", "max_stars_repo_path": "SimpleNet/Network.cs", "max_stars_repo_name": "SharpCoder/MachineLearning", "max_stars_repo_stars_event_min_datetime": "2016-04-06T09:32:12.000Z", "max_stars_repo_stars_event_max_datetime": "2016-04-06T09:32:12.000Z", "max_issues_repo_path": "SimpleNet/Network.cs", "max_issues_repo_name": "SharpCoder/MachineLearning", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "SimpleNet/Network.cs", "max_forks_repo_name": "SharpCoder/MachineLearning", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": 1.0, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 28.012345679, "max_line_length": 114, "alphanum_fraction": 0.5663287792} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SimpleNet
{
public class Network
{
int[] topology;
float[] weights;
float[] outputs;
int start = 0;
public Network(int[] network_topology)
{
if (network_topology == null || network_topology.Length == 0) return;
this.topology = network_topology;
// Calculate the number of connections.
// The input for this graph is equal to each node on the first layer
// times itself.
int connection_limit = (int)Math.Pow(topology[0], 2);
// Then we iterate over the network topology.
for (int i = 0; i < network_topology.Length; i++)
{
if (i < network_topology.Length - 1)
connection_limit += (network_topology[i] * network_topology[i + 1]);
start += network_topology[i];
}
// Initialize the connection weights.
weights = new float[connection_limit];
outputs = new float[start];
Random rand = new Random(424242);
for (int i = 0; i < weights.Length; i++)
weights[i] = (float)(rand.NextDouble() - rand.NextDouble());
}
public float getOutput(float[] input)
{
outputs = new float[start];//weights.Length + (topology[topology.Length - 2] * topology[topology.Length - 1])];
for (int i = 0; i < input.Length; i++)
outputs[i] = input[i];
int weight_stack = 0, process_stack = 0;
float output = 0f, val = 0f;
for (int y = 1; y < topology.Length; y++)
{
for (int x = 0; x < topology[y]; x++)
{
// For each node in the graph. Calculate the value coming into it.
val = 0;
for (int z = 0; z < topology[y - 1]; z++)
{
int arrIndex = process_stack + z;
val += outputs[arrIndex] * weights[weight_stack++];
}
val = sig(val);
outputs[process_stack + x + topology[y - 1]] = val;
if (y == topology.Length - 1) output += val;
}
process_stack += topology[y - 1];
}
return output;
}
private float sig(float input)
{
return (float)(1.0f / (1.0f + Math.Exp(-input)));
}
}
}
|
||||
TheStack | e8f3d7891a89ef22080b33ba6631b710080d48f9 | C#code:C# | {"size": 33723, "ext": "cs", "max_stars_repo_path": "Assets/Udon/Editor/ProgramSources/UdonGraph/UdonNodeSearchMenu.cs", "max_stars_repo_name": "jetdog8808/udon-playground", "max_stars_repo_stars_event_min_datetime": "2020-04-07T10:14:48.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-04T15:21:37.000Z", "max_issues_repo_path": "Assets/Udon/Editor/ProgramSources/UdonGraph/UdonNodeSearchMenu.cs", "max_issues_repo_name": "jetdog8808/Udon-playground", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Assets/Udon/Editor/ProgramSources/UdonGraph/UdonNodeSearchMenu.cs", "max_forks_repo_name": "jetdog8808/Udon-playground", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": 9.0, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 41.2261613692, "max_line_length": 264, "alphanum_fraction": 0.503662189} | using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading;
using UnityEditor;
using UnityEngine;
using VRC.Udon.EditorBindings;
using VRC.Udon.EditorBindings.Interfaces;
using VRC.Udon.Graph;
namespace VRC.Udon.Editor.ProgramSources
{
public class UdonNodeSearchMenu : EditorWindow
{
private static UdonNodeSearchMenu _instance;
private string _searchString = string.Empty;
private UdonGraph _graph;
private UdonGraphGUI _graphGUI;
private Styles _styles;
private Vector2 _scrollPosition = Vector2.zero;
private IEnumerable<UdonNodeDefinition> _filteredNodeDefinitions;
private IEnumerable<UdonNodeDefinition> _unfilteredNodeDefinitions;
private Dictionary<string, UdonNodeDefinition> _searchDefinitions;
private long _lastTime;
private float _animValue;
private float _animGoal = 1;
private bool _isAnimating;
private string _currentActivePath = "";
private string _currentActiveNode = "";
private int _currentActiveIndex;
private string _nextActivePath = "";
private string _nextActiveNode = "";
private int _nextActiveIndex;
private const int LIST_BUTTON_HEIGHT = 20;
private const float DROPDOWN_HEIGHT = 320f;
private float _dropDownWidth;
private Rect _dropDownRect;
private static readonly NodeMenuLayer NodeMenu = new NodeMenuLayer();
private void Awake()
{
//_unfilteredNodeDefinitions = _udonEditorInterface.GetNodeDefinitions();
Dictionary<string, UdonNodeDefinition> baseNodeDefinitions = new Dictionary<string, UdonNodeDefinition>();
foreach (UdonNodeDefinition nodeDefinition in UdonEditorManager.Instance.GetNodeDefinitions().OrderBy(s => PrettyFullName(s)))
{
string baseIdentifier = nodeDefinition.fullName;
string[] splitBaseIdentifier = baseIdentifier.Split(new[] {"__"}, StringSplitOptions.None);
if (splitBaseIdentifier.Length >= 2)
{
baseIdentifier = $"{splitBaseIdentifier[0]}__{splitBaseIdentifier[1]}";
}
if (baseNodeDefinitions.ContainsKey(baseIdentifier))
{
continue;
}
baseNodeDefinitions.Add(baseIdentifier, nodeDefinition);
}
_unfilteredNodeDefinitions = baseNodeDefinitions.Values;
_searchDefinitions = _unfilteredNodeDefinitions.ToDictionary(nodeDefinition => SanitizedSearchString(nodeDefinition.fullName));
_filteredNodeDefinitions = _unfilteredNodeDefinitions;
string SanitizedSearchString(string s)
{
s = s.FriendlyNameify()
.ToLowerInvariant()
.Replace(".__", ".");
if (s.StartsWith("variable_"))
{
s = s.Replace("variable_", "");
}
s = s.Replace("_", " ")
.ReplaceFirst("unityengine", "");
//.ReplaceFirst("system", "");
return s;
}
}
public static void DrawWindow(UdonGraph graph, UdonGraphGUI graphGUI)
{
if(_instance == null)
{
_instance = CreateInstance<UdonNodeSearchMenu>();
}
Rect rect = GUILayoutUtility.GetLastRect();
bool goodState = graphGUI.selection.Count == 0;
if(goodState)
{
goodState = GUI.GetNameOfFocusedControl() != "NodeField";
}
if(goodState && KeyUpEvent(KeyCode.Space) && !Event.current.shift)
{
GUI.UnfocusWindow();
}
if(!GUILayout.Button("Add Node", EditorStyles.toolbarButton, GUILayout.Width(120)) && !(KeyUpEvent(KeyCode.Space) && goodState))
{
return;
}
rect = RemapRectForPopup(rect);
_instance.InitWindow(graph, graphGUI, rect);
_instance.Repaint();
}
private void InitWindow(UdonGraph graph, UdonGraphGUI graphGUI, Rect rect)
{
_dropDownRect = rect;
_graph = graph;
_graphGUI = graphGUI;
_styles = new Styles();
wantsMouseMove = true;
if (NodeMenu.MenuName == null)
{
new Thread(() =>
{
Thread.CurrentThread.IsBackground = true;
NodeMenu.PopulateNodeMenu();
}).Start();
}
_dropDownWidth = rect.width;
ShowAsDropDown(rect, new Vector2(rect.width, DROPDOWN_HEIGHT));
Focus();
}
private void OnGUI()
{
GUI.Label(new Rect(0.0f, 0.0f, position.width, position.height), GUIContent.none, _styles.Background);
if(_filteredNodeDefinitions == null)
{
_filteredNodeDefinitions = _unfilteredNodeDefinitions;
}
DrawSearchBox();
if(_isAnimating && Event.current.type == EventType.Repaint)
{
long ms = DateTime.Now.Millisecond;
float maxDelta = -(ms - _lastTime) * .01f;
_lastTime = ms;
_animValue = Mathf.MoveTowards(_animValue, _animGoal, maxDelta);
Repaint();
}
if ((_animValue >= 1 || _animValue <= -1) && Event.current.type != EventType.Repaint)
{
_isAnimating = false;
_animValue = 0;
_currentActivePath = _nextActivePath;
_currentActiveNode = _nextActiveNode;
_currentActiveIndex = _nextActiveIndex;
_nextActivePath = "";
_nextActiveNode = "";
_nextActiveIndex = 0;
while (_currentActiveIndex * LIST_BUTTON_HEIGHT >=
_scrollPosition.y + DROPDOWN_HEIGHT - (LIST_BUTTON_HEIGHT * 3) - 5)
{
_scrollPosition.y += LIST_BUTTON_HEIGHT;
}
while (_currentActiveIndex * LIST_BUTTON_HEIGHT < _scrollPosition.y)
{
_scrollPosition.y -= LIST_BUTTON_HEIGHT;
}
}
DrawListGUI(false, _animValue);
if (_isAnimating)
{
//if(animGoal == 1)
DrawListGUI( true, _animValue - 1);
//else
DrawListGUI( true, _animValue + 1);
}
if(KeyUpEvent(KeyCode.Escape))
{
Close();
}
}
private void DrawSearchBox()
{
EditorGUILayout.Space();
EditorGUILayout.BeginHorizontal();
GUI.SetNextControlName("nodeSearch");
EditorGUI.BeginChangeCheck();
_searchString = EditorGUILayout.TextField(_searchString, _styles.SearchTextField);
if(EditorGUI.EndChangeCheck())
{
ApplySearchFilter();
}
EditorGUI.FocusTextInControl("nodeSearch");
GUIStyle searchButtonStyle =
_searchString == string.Empty ? _styles.SearchCancelButtonEmpty : _styles.SearchCancelButton;
if(GUILayout.Button(string.Empty, searchButtonStyle))
{
_searchString = string.Empty;
GUI.FocusControl(null);
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.Space();
}
private void ApplySearchFilter()
{
string lowerSearchString = _searchString.ToLowerInvariant();
string unSpacedSearchString = lowerSearchString.Replace(" ", string.Empty);
string[] lowerSearchStringArray = lowerSearchString.Split(' ');
if(unSpacedSearchString.Length < 3)
{
_filteredNodeDefinitions = new List<UdonNodeDefinition>();
return;
}
_filteredNodeDefinitions = _searchDefinitions
.Where(s => s.Key.Contains(lowerSearchString))
.OrderBy(s => s.Key, new SearchComparer(lowerSearchString))
.Concat(_searchDefinitions
.Where(s => s.Key.Contains(unSpacedSearchString))
.OrderBy(s => s.Key, new SearchComparer(unSpacedSearchString))
.Concat(_searchDefinitions
.Where(s => lowerSearchStringArray.All(w => s.Key.Contains(w.ToLowerInvariant())))
.OrderBy(s => s.Key, new SearchComparer(lowerSearchStringArray.First().Replace(" ", string.Empty)))
.Where(s => s.Key.IndexOf(lowerSearchStringArray.First().Replace(" ", string.Empty), StringComparison.InvariantCultureIgnoreCase) != -1)
)
)
.Select(d => d.Value).Distinct().Take(200).ToArray();
//if(_filteredNodeDefinitions.Count() > 1000)
//{
// _filteredNodeDefinitions = _filteredNodeDefinitions.Take(1000).ToArray();
//}
}
public static string PrettyFullName(UdonNodeDefinition nodeDefinition, bool keepLong = false)
{
string fullName = nodeDefinition.fullName;
string result;
if(keepLong)
{
result = fullName.Replace("UnityEngine", "UnityEngine.").Replace("System", "System.");
}
else
{
result = fullName.Replace("UnityEngine", "").Replace("System", "");
}
string[] resultSplit = result.Split(new[] {"__"}, StringSplitOptions.None);
if(resultSplit.Length >= 3)
{
string outName = "";
if (nodeDefinition.type != typeof(void))
{
if (nodeDefinition.Outputs.Count > 0)
{
outName = string.Join(", ", nodeDefinition.Outputs.Select(o => o.name));
}
}
result = nodeDefinition.Inputs.Count > 0
? $"{resultSplit[0]}{resultSplit[1]}({string.Join(", ", nodeDefinition.Inputs.Select(s => s.name))}{outName})"
: $"{resultSplit[0]}{resultSplit[1]}({resultSplit[2].Replace("_", ", ")}{outName})";
}
else if(resultSplit.Length >= 2)
{
result = $"{resultSplit[0]}{resultSplit[1]}()";
}
if(!keepLong)
{
result = result.FriendlyNameify();
result = result.Replace("op_", "");
result = result.Replace("_", " ");
}
return result;
}
//TODO: oof ouch my reflection
private static object GetInstanceField(Type type, object instance, string fieldName)
{
BindingFlags bindFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic
| BindingFlags.Static;
FieldInfo field = type.GetField(fieldName, bindFlags);
if (field != null) return field.GetValue(instance);
throw new NullReferenceException($"Failed to get private field named: {fieldName} on object: {instance} of type: {type}");
}
private Rect _headerRect;
private void DrawListGUI( bool isNext = false, float anim = 0)
{
Rect rect = position;
rect.x = +1f;
rect.x -= 230*anim;
rect.y = 30f;
rect.height -= 30f;
rect.width -= 2f;
GUILayout.BeginArea(rect);
rect = GUILayoutUtility.GetRect(10f, 25f);
if (string.IsNullOrEmpty(_currentActivePath) || _currentActivePath == "/")
GUI.Label(rect, _searchString == string.Empty ? "Nodes" : "Search", _styles.Header);
else
{
string nestedTitle = _currentActivePath.Substring(0, _currentActivePath.Length - 1);
if (GUI.Button(rect, _searchString == string.Empty ? nestedTitle : "Search", _styles.Header))
{
if (!isNext && !string.IsNullOrEmpty(_currentActivePath))
{
List<string> tmp = _currentActivePath.Split('/').ToList();
if (tmp.Count - 2 >= 0)
{
_nextActiveNode = tmp[tmp.Count - 2];
_nextActiveIndex = 0;
tmp.RemoveAt(_currentActivePath.Split('/').Length - 2);
}
_nextActivePath = string.Join("/", tmp.ToArray());
_isAnimating = true;
_animGoal = 1;
_lastTime = DateTime.Now.Millisecond;
}
}
if (string.IsNullOrEmpty(_searchString))
GUI.Label(new Rect((float)(rect.x + 6.0), rect.y + 6f, 13f, 13f), "", _styles.LeftArrow);
}
_headerRect = rect;
//TODO: don't be lazy, figure out the math for this so you don't have to loop :P
bool repaint = false;
while (_currentActiveIndex * LIST_BUTTON_HEIGHT >=
_scrollPosition.y + DROPDOWN_HEIGHT - (LIST_BUTTON_HEIGHT * 3) - 5)
{
_scrollPosition.y += LIST_BUTTON_HEIGHT;
repaint = true;
}
while (_currentActiveIndex * LIST_BUTTON_HEIGHT < _scrollPosition.y)
{
_scrollPosition.y -= LIST_BUTTON_HEIGHT;
repaint = true;
}
if (repaint)
{
Repaint();
}
float oldScrollPosition = _scrollPosition.y;
_scrollPosition = EditorGUILayout.BeginScrollView(_scrollPosition);
if (string.IsNullOrEmpty(_searchString))
{
DrawNodeEntries(NodeMenu, isNext);
}
else
{
for(int i = 0; i < (_filteredNodeDefinitions.Count() > 100 ? 100 : _filteredNodeDefinitions.Count()); i++)
{
UdonNodeDefinition udonNodeDefinition = _filteredNodeDefinitions.ElementAt(i);
string aB = _currentActiveNode;
if(_filteredNodeDefinitions.All(f => f.fullName != aB))
{
_currentActiveNode = udonNodeDefinition.fullName;
}
GUIStyle buttonStyle = _currentActiveNode == udonNodeDefinition.fullName
? _styles.ActiveComponentButton
: _styles.ComponentButton;
rect = GUILayoutUtility.GetRect(10f, LIST_BUTTON_HEIGHT);
bool pressedButton = GUI.Button(rect, NodeContentWithIcon(udonNodeDefinition, PrettyFullName(udonNodeDefinition), PrettyFullName(udonNodeDefinition, true)), buttonStyle);
if(pressedButton ||
(_currentActiveNode == udonNodeDefinition.fullName && (KeyUpEvent(KeyCode.Return) || KeyUpEvent(KeyCode.RightArrow))))
{
Rect graphExtents = (Rect)GetInstanceField(typeof(UdonGraph), _graph, "graphExtents");
graphExtents = new Rect(new Vector2(_graphGUI.scrollPosition.x + (graphExtents.x + (_graphGUI.Host.position.width / 2)) - 125, _graphGUI.scrollPosition.y + (graphExtents.y + (_graphGUI.Host.position.height / 2)) - 24), new Vector2(10, 10));
_graph.CreateNode(udonNodeDefinition, graphExtents.position);
Close();
}
if (rect.Contains(Event.current.mousePosition) &&
Event.current.mousePosition.y <= _dropDownRect.yMin + DROPDOWN_HEIGHT + _scrollPosition.y &&
Event.current.mousePosition.y > _headerRect.yMax + _scrollPosition.y - LIST_BUTTON_HEIGHT)
{
_currentActiveNode = udonNodeDefinition.fullName;
_currentActiveIndex = i;
}
if(Event.current.type != EventType.MouseMove)
{
continue;
}
if(mouseOverWindow != null)
{
mouseOverWindow.Repaint();
}
}
}
GUILayout.EndScrollView();
if ((int)_scrollPosition.y != (int)oldScrollPosition)
{
{
Repaint();
}
}
GUILayout.EndArea();
if (!string.IsNullOrEmpty(_searchString))
{
if (KeyUsedEvent(KeyCode.DownArrow))
{
OffsetActiveButton(1);
}
else if (KeyUsedEvent(KeyCode.UpArrow))
{
OffsetActiveButton(-1);
}
}
}
private string _loadingText = "Loading Nodes";
private void DrawNodeEntries(NodeMenuLayer layer, bool isNext)
{
if (NodeMenu.MenuName == null)
{
Rect buttonRect = GUILayoutUtility.GetRect(10f, LIST_BUTTON_HEIGHT, GUILayout.ExpandWidth(true));
GUI.Label(buttonRect, _loadingText, _styles.ComponentButton);
_loadingText = $"{_loadingText}.";
if (_loadingText.Contains("......"))
{
_loadingText = "Loading Nodes";
}
Repaint();
return;
}
NodeMenuLayer foundLayer = layer.FindLayer(_currentActivePath);
string aN = _currentActiveNode;
if (foundLayer.SubNodes.Count == 0)
{
return;
}
if (foundLayer.SubNodes.All(n => n.MenuName != aN))
{
if (!isNext)
{
_currentActiveNode = foundLayer.SubNodes.First().MenuName;
_currentActiveIndex = 0;
_scrollPosition.y = 0;
aN = _currentActiveNode;
}
}
if (Event.current.type == EventType.Used && Event.current.keyCode == KeyCode.DownArrow)
{
int idx = foundLayer.SubNodes.Select((value, index) => new { value, index }).Where(pair => pair.value.MenuName == aN).Select(pair => pair.index).FirstOrDefault();
if (idx + 1 < foundLayer.SubNodes.Count)
{
if (!isNext)
{
_currentActiveNode = foundLayer.SubNodes[idx + 1].MenuName;
_currentActiveIndex = idx + 1;
if (_currentActiveIndex * LIST_BUTTON_HEIGHT >=
_scrollPosition.y + DROPDOWN_HEIGHT - (LIST_BUTTON_HEIGHT * 3) - 5)
{
_scrollPosition.y += LIST_BUTTON_HEIGHT;
}
}
}
}
if (Event.current.type == EventType.Used && Event.current.keyCode == KeyCode.UpArrow)
{
int idx = foundLayer.SubNodes.Select((value, index) => new { value, index }).Where(pair => pair.value.MenuName == aN).Select(pair => pair.index).FirstOrDefault();
if (idx - 1 >= 0)
{
if (!isNext)
{
_currentActiveNode = foundLayer.SubNodes[idx - 1].MenuName;
_currentActiveIndex = idx - 1;
if (_currentActiveIndex * LIST_BUTTON_HEIGHT < _scrollPosition.y)
{
_scrollPosition.y -= LIST_BUTTON_HEIGHT;
}
}
}
}
if (Event.current.type == EventType.Used && (Event.current.keyCode == KeyCode.Return || Event.current.keyCode == KeyCode.RightArrow))
{
if (!isNext)
{
if (foundLayer.SubNodes.First(n => n.MenuName == aN).SubNodes.Count == 0)
{
Rect graphExtents = (Rect)GetInstanceField(typeof(UdonGraph), _graph, "graphExtents");
graphExtents = new Rect(new Vector2(_graphGUI.scrollPosition.x + (graphExtents.x + (_graphGUI.Host.position.width / 2)) - 125, _graphGUI.scrollPosition.y + (graphExtents.y + (_graphGUI.Host.position.height / 2)) - 24), new Vector2(10, 10));
_graph.CreateNode(foundLayer.SubNodes.First(n => n.MenuName == aN).NodeDefinition, graphExtents.position);
Close();
}
else
{
_nextActivePath = _currentActivePath + _currentActiveNode + "/";
_isAnimating = true;
_animGoal = -1;
_lastTime = DateTime.Now.Millisecond;
}
}
}
if (Event.current.type == EventType.Used && (Event.current.keyCode == KeyCode.Backspace || Event.current.keyCode == KeyCode.LeftArrow))
{
if (!isNext && !string.IsNullOrEmpty(_currentActivePath))
{
List<string> tmp = _currentActivePath.Split('/').ToList();
if (tmp.Count - 2 >= 0)
{
_nextActiveNode = tmp[tmp.Count - 2];
_nextActiveIndex = 0;
tmp.RemoveAt(_currentActivePath.Split('/').Length - 2);
}
_nextActivePath = string.Join("/", tmp.ToArray());
_isAnimating = true;
_animGoal = 1;
_lastTime = DateTime.Now.Millisecond;
}
}
int nodeIndex = 0;
foreach (NodeMenuLayer item in foundLayer.SubNodes)
{
Rect buttonRect = GUILayoutUtility.GetRect(10f, LIST_BUTTON_HEIGHT, GUILayout.ExpandWidth(true));
if (!isNext)
{
if (string.IsNullOrEmpty(_currentActiveNode))
{
_currentActiveNode = item.MenuName;
_currentActiveIndex = nodeIndex;
while (_currentActiveIndex * LIST_BUTTON_HEIGHT >=
_scrollPosition.y + DROPDOWN_HEIGHT - (LIST_BUTTON_HEIGHT * 3) - 5)
{
_scrollPosition.y += LIST_BUTTON_HEIGHT;
}
while (_currentActiveIndex * LIST_BUTTON_HEIGHT < _scrollPosition.y)
{
_scrollPosition.y -= LIST_BUTTON_HEIGHT;
}
}
}
GUIStyle buttonStyle = _styles.ComponentButton;
if (_currentActiveNode == item.MenuName)
{
buttonStyle = _styles.ActiveComponentButton;
}
if (GUI.Button(buttonRect,
NodeContentWithIcon(item.NodeDefinition, item.MenuName,
item.NodeDefinition != null ? PrettyFullName(item.NodeDefinition, true) : item.MenuName),
buttonStyle))
{
if (item.SubNodes.Count == 0)
{
Rect graphExtents = (Rect)GetInstanceField(typeof(UdonGraph), _graph, "graphExtents");
graphExtents = new Rect(new Vector2(_graphGUI.scrollPosition.x + (graphExtents.x + (_graphGUI.Host.position.width / 2)) - 125, _graphGUI.scrollPosition.y + (graphExtents.y + (_graphGUI.Host.position.height / 2)) - 24), new Vector2(10, 10));
_graph.CreateNode(foundLayer.SubNodes.First(n => n.MenuName == aN).NodeDefinition, graphExtents.position);
Close();
}
if (!isNext)
{
_nextActivePath = $"{_currentActivePath}{item.MenuName}/";
_isAnimating = true;
_animGoal = -1;
_lastTime = DateTime.Now.Millisecond;
}
}
if (buttonRect.Contains(Event.current.mousePosition) &&
Event.current.mousePosition.y <= _dropDownRect.yMin + DROPDOWN_HEIGHT + _scrollPosition.y &&
Event.current.mousePosition.y > _headerRect.yMax + _scrollPosition.y - LIST_BUTTON_HEIGHT)
{
if (!isNext)
{
_currentActiveNode = item.MenuName;
_currentActiveIndex = nodeIndex;
while (_currentActiveIndex * LIST_BUTTON_HEIGHT >=
_scrollPosition.y + DROPDOWN_HEIGHT - (LIST_BUTTON_HEIGHT * 3) - 5)
{
_scrollPosition.y += LIST_BUTTON_HEIGHT;
}
while (_currentActiveIndex * LIST_BUTTON_HEIGHT < _scrollPosition.y)
{
_scrollPosition.y -= LIST_BUTTON_HEIGHT;
}
}
}
if (buttonRect.Contains(Event.current.mousePosition))
{
if (!isNext)
{
if (Event.current.type == EventType.MouseMove)
{
if (mouseOverWindow != null)
{
mouseOverWindow.Repaint();
}
}
}
else
{
_nextActiveNode = item.MenuName;
_nextActiveIndex = nodeIndex;
}
}
if (item.SubNodes.Count > 0)
{
GUI.Label(
new Rect((float) ((double) buttonRect.x + buttonRect.width - 13.0), buttonRect.y + 4f, 13f,
13f), "", _styles.RightArrow);
}
nodeIndex++;
}
}
private void OffsetActiveButton(int offset)
{
_currentActiveIndex += offset;
_currentActiveIndex = Mathf.Clamp(_currentActiveIndex, 0, _filteredNodeDefinitions.Count() - 1);
_currentActiveNode = _filteredNodeDefinitions.ElementAt(_currentActiveIndex).fullName;
while (_currentActiveIndex * LIST_BUTTON_HEIGHT >=
_scrollPosition.y + DROPDOWN_HEIGHT - (LIST_BUTTON_HEIGHT * 3) - 5)
{
_scrollPosition.y += LIST_BUTTON_HEIGHT;
}
while (_currentActiveIndex * LIST_BUTTON_HEIGHT < _scrollPosition.y)
{
_scrollPosition.y -= LIST_BUTTON_HEIGHT;
}
}
private static Rect RemapRectForPopup(Rect rect)
{
rect.y += 26f;
rect.x += rect.width;
rect.width = 500;
rect.x -= rect.width / 2;
Vector2 v2 = GUIUtility.GUIToScreenPoint(new Vector2(rect.x, rect.y));
rect.x = v2.x;
rect.y = v2.y;
return rect;
}
private static bool KeyUpEvent(KeyCode keyCode)
{
return Event.current.type == EventType.KeyUp && Event.current.keyCode == keyCode;
}
private static bool KeyUsedEvent(KeyCode keyCode)
{
return Event.current.type == EventType.Used && Event.current.keyCode == keyCode;
}
private static Dictionary<Type, Texture2D> typeThumbCache = new Dictionary<Type, Texture2D>();
private GUIContent NodeContentWithIcon(UdonNodeDefinition nodeDefinition, string menuName, string tooltip)
{
GUIContent content;
if (nodeDefinition != null)
{
Type thumbType = nodeDefinition.type;
if (thumbType != null)
{
if (thumbType.IsArray)
{
thumbType = thumbType.GetElementType();
}
}
Texture2D thumb = GetCachedTypeThumbnail(thumbType);
//TODO: This is real gross and hacky, figure out how to just let the name clip naturally without clipping the icon in the process
int maxLength = (int)(_dropDownWidth / 7);
menuName = menuName.Substring(0, menuName.Length <= maxLength ? menuName.Length : maxLength);
while (GUI.skin.label.CalcSize(new GUIContent(menuName)).x > _dropDownWidth - 35)
{
menuName = menuName.Substring(0, menuName.Length - 1);
}
content = thumb != null
? new GUIContent($"{menuName}", thumb, tooltip)
: new GUIContent($" {menuName}", tooltip);
}
else
{
content = new GUIContent($" {menuName}", tooltip);
}
return content;
}
public static Texture2D GetCachedTypeThumbnail(Type thumbType)
{
Texture2D thumb;
if (thumbType == null)
{
thumb = null;
}
else
{
if (typeThumbCache.ContainsKey(thumbType))
{
thumb = typeThumbCache[thumbType];
}
else
{
thumb = AssetPreview.GetMiniTypeThumbnail(thumbType);
typeThumbCache.Add(thumbType, thumb);
}
}
return thumb;
}
private class Styles
{
public readonly GUIStyle ComponentButton = new GUIStyle("PR Label");
public readonly GUIStyle ActiveComponentButton;
public readonly GUIStyle Header = new GUIStyle("In BigTitle");
public readonly GUIStyle SearchTextField;
public readonly GUIStyle SearchCancelButton;
public readonly GUIStyle SearchCancelButtonEmpty;
public readonly GUIStyle Background = "grey_border";
//public readonly GUIStyle PreviewBackground = "PopupCurveSwatchBackground";
//public readonly GUIStyle PreviewHeader = new GUIStyle(EditorStyles.label);
//public readonly GUIStyle PreviewText = new GUIStyle(EditorStyles.wordWrappedLabel);
public readonly GUIStyle RightArrow = "AC RightArrow";
public readonly GUIStyle LeftArrow = "AC LeftArrow";
//public readonly GUIStyle GroupButton;
public Styles()
{
ComponentButton.active = ComponentButton.onActive;
ComponentButton.hover = ComponentButton.onHover;
ComponentButton.padding.left -= 15;
ComponentButton.fixedHeight = 20f;
//ComponentButton.stretchWidth = true;
ComponentButton.alignment = TextAnchor.MiddleLeft;//.MiddleLeft;
ActiveComponentButton = new GUIStyle(ComponentButton);
ActiveComponentButton.normal = ActiveComponentButton.onHover;
Header.font = EditorStyles.boldLabel.font;
SearchTextField = GUI.skin.FindStyle("SearchTextField");
SearchCancelButton = GUI.skin.FindStyle("SearchCancelButton");
SearchCancelButtonEmpty = GUI.skin.FindStyle("SearchCancelButtonEmpty");
Header.font = EditorStyles.boldLabel.font;
//GroupButton = new GUIStyle(ComponentButton);
//GroupButton.padding.left += 17;
//PreviewText.padding.left += 3;
//PreviewText.padding.right += 3;
//++PreviewHeader.padding.left;
//PreviewHeader.padding.right += 3;
//PreviewHeader.padding.top += 3;
//PreviewHeader.padding.bottom += 2;
}
}
public class NodeMenuLayer
{
public string MenuName;
public UdonNodeDefinition NodeDefinition;
public readonly List<NodeMenuLayer> SubNodes = new List<NodeMenuLayer>();
}
}
}
|
||||
TheStack | e8f465d301fb3d9d8b595b36dfe8eebfd161ae4d | C#code:C# | {"size": 48688, "ext": "cs", "max_stars_repo_path": "src/DataXml/Utd820/ON_NSCHFDOPPR_UserContract_820_05_01_01.cs", "max_stars_repo_name": "AsakyraZ/diadocsdk-csharp", "max_stars_repo_stars_event_min_datetime": "2016-05-23T06:53:34.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-15T08:33:47.000Z", "max_issues_repo_path": "src/DataXml/Utd820/ON_NSCHFDOPPR_UserContract_820_05_01_01.cs", "max_issues_repo_name": "AsakyraZ/diadocsdk-csharp", "max_issues_repo_issues_event_min_datetime": "2016-06-08T11:01:38.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-30T10:59:00.000Z", "max_forks_repo_path": "src/DataXml/Utd820/ON_NSCHFDOPPR_UserContract_820_05_01_01.cs", "max_forks_repo_name": "AsakyraZ/diadocsdk-csharp", "max_forks_repo_forks_event_min_datetime": "2016-06-08T10:42:39.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-01T10:21:14.000Z"} | {"max_stars_count": 36.0, "max_issues_count": 776.0, "max_forks_count": 84.0, "avg_line_length": 28.0946335834, "max_line_length": 182, "alphanum_fraction": 0.7380874137} | //------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
//
// This source code was auto-generated by xsd, Version=4.6.1055.0.
//
namespace Diadoc.Api.DataXml.Utd820
{
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = false)]
public partial class UniversalTransferDocument
{
private ExtendedOrganizationInfo[] sellersField;
private ExtendedOrganizationInfo[] buyersField;
private UniversalTransferDocumentShipper[] shippersField;
private ExtendedOrganizationInfo[] consigneesField;
private object[] signersField;
private PaymentDocumentInfo[] paymentDocumentsField;
private AdditionalInfoId additionalInfoIdField;
private InvoiceTable tableField;
private TransferInfo transferInfoField;
private ExtendedOrganizationInfo factorInfoField;
private TransferBase820 mainAssignMonetaryClaimField;
private UniversalTransferDocumentSellerInfoCircumPublicProc sellerInfoCircumPublicProcField;
private UniversalTransferDocumentDocumentShipment[] documentShipmentsField;
private UniversalTransferDocumentFunction functionField;
private string approvedStructureAdditionalInfoFieldsField;
private string documentNameField;
private string documentDateField;
private string documentNumberField;
private string currencyField;
private decimal currencyRateField;
private bool currencyRateFieldSpecified;
private string revisionDateField;
private string revisionNumberField;
private string documentCreatorField;
private string documentCreatorBaseField;
private string governmentContractInfoField;
private UniversalTransferDocumentCircumFormatInvoice circumFormatInvoiceField;
private bool circumFormatInvoiceFieldSpecified;
/// <remarks/>
[System.Xml.Serialization.XmlArrayAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlArrayItemAttribute("Seller", Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = false)]
public ExtendedOrganizationInfo[] Sellers
{
get { return this.sellersField; }
set { this.sellersField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlArrayAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlArrayItemAttribute("Buyer", Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = false)]
public ExtendedOrganizationInfo[] Buyers
{
get { return this.buyersField; }
set { this.buyersField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlArrayAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlArrayItemAttribute("Shipper", Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = false)]
public UniversalTransferDocumentShipper[] Shippers
{
get { return this.shippersField; }
set { this.shippersField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlArrayAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlArrayItemAttribute("Consignee", Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = false)]
public ExtendedOrganizationInfo[] Consignees
{
get { return this.consigneesField; }
set { this.consigneesField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlArrayAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlArrayItemAttribute("SignerDetails", typeof(ExtendedSignerDetails_SellerTitle), Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = false)]
[System.Xml.Serialization.XmlArrayItemAttribute(typeof(SignerReference), Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = false)]
public object[] Signers
{
get { return this.signersField; }
set { this.signersField = value; }
}
public UniversalTransferDocument UseSignerReferences(SignerReference[] signerReferences)
{
this.Signers = signerReferences;
return this;
}
public UniversalTransferDocument UseSignerDetails(ExtendedSignerDetails_SellerTitle[] signerDetails)
{
this.Signers = signerDetails;
return this;
}
/// <remarks/>
[System.Xml.Serialization.XmlArrayAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlArrayItemAttribute("Document", Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = false)]
public PaymentDocumentInfo[] PaymentDocuments
{
get { return this.paymentDocumentsField; }
set { this.paymentDocumentsField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public AdditionalInfoId AdditionalInfoId
{
get { return this.additionalInfoIdField; }
set { this.additionalInfoIdField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public InvoiceTable Table
{
get { return this.tableField; }
set { this.tableField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public TransferInfo TransferInfo
{
get { return this.transferInfoField; }
set { this.transferInfoField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public ExtendedOrganizationInfo FactorInfo
{
get { return this.factorInfoField; }
set { this.factorInfoField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public TransferBase820 MainAssignMonetaryClaim
{
get { return this.mainAssignMonetaryClaimField; }
set { this.mainAssignMonetaryClaimField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public UniversalTransferDocumentSellerInfoCircumPublicProc SellerInfoCircumPublicProc
{
get { return this.sellerInfoCircumPublicProcField; }
set { this.sellerInfoCircumPublicProcField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlArrayAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlArrayItemAttribute("DocumentShipment", Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = false)]
public UniversalTransferDocumentDocumentShipment[] DocumentShipments
{
get { return this.documentShipmentsField; }
set { this.documentShipmentsField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public UniversalTransferDocumentFunction Function
{
get { return this.functionField; }
set { this.functionField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string ApprovedStructureAdditionalInfoFields
{
get { return this.approvedStructureAdditionalInfoFieldsField; }
set { this.approvedStructureAdditionalInfoFieldsField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string DocumentName
{
get { return this.documentNameField; }
set { this.documentNameField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string DocumentDate
{
get { return this.documentDateField; }
set { this.documentDateField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string DocumentNumber
{
get { return this.documentNumberField; }
set { this.documentNumberField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string Currency
{
get { return this.currencyField; }
set { this.currencyField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public decimal CurrencyRate
{
get { return this.currencyRateField; }
set { this.currencyRateField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool CurrencyRateSpecified
{
get { return this.currencyRateFieldSpecified; }
set { this.currencyRateFieldSpecified = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string RevisionDate
{
get { return this.revisionDateField; }
set { this.revisionDateField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute(DataType = "integer")]
public string RevisionNumber
{
get { return this.revisionNumberField; }
set { this.revisionNumberField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string DocumentCreator
{
get { return this.documentCreatorField; }
set { this.documentCreatorField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string DocumentCreatorBase
{
get { return this.documentCreatorBaseField; }
set { this.documentCreatorBaseField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string GovernmentContractInfo
{
get { return this.governmentContractInfoField; }
set { this.governmentContractInfoField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public UniversalTransferDocumentCircumFormatInvoice CircumFormatInvoice
{
get { return this.circumFormatInvoiceField; }
set { this.circumFormatInvoiceField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool CircumFormatInvoiceSpecified
{
get { return this.circumFormatInvoiceFieldSpecified; }
set { this.circumFormatInvoiceFieldSpecified = value; }
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class ExtendedOrganizationInfo
{
private ExtendedOrganizationDetails_ManualFilling itemField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("OrganizationDetails", typeof(ExtendedOrganizationDetails), Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlElementAttribute("OrganizationReference", typeof(ExtendedOrganizationReference), Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public ExtendedOrganizationDetails_ManualFilling Item
{
get { return this.itemField; }
set { this.itemField = value; }
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class ExtendedOrganizationDetails : ExtendedOrganizationDetails_ManualFilling
{
private Address addressField;
private string orgNameField;
private string innField;
private string kppField;
private string fnsParticipantIdField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public Address Address
{
get { return this.addressField; }
set { this.addressField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string OrgName
{
get { return this.orgNameField; }
set { this.orgNameField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string Inn
{
get { return this.innField; }
set { this.innField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string Kpp
{
get { return this.kppField; }
set { this.kppField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string FnsParticipantId
{
get { return this.fnsParticipantIdField; }
set { this.fnsParticipantIdField = value; }
}
}
/// <remarks/>
[System.Xml.Serialization.XmlIncludeAttribute(typeof(TransferBase820))]
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class TransferBase
{
private string baseDocumentNameField;
private string baseDocumentNumberField;
private string baseDocumentDateField;
private string baseDocumentInfoField;
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string BaseDocumentName
{
get { return this.baseDocumentNameField; }
set { this.baseDocumentNameField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string BaseDocumentNumber
{
get { return this.baseDocumentNumberField; }
set { this.baseDocumentNumberField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string BaseDocumentDate
{
get { return this.baseDocumentDateField; }
set { this.baseDocumentDateField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string BaseDocumentInfo
{
get { return this.baseDocumentInfoField; }
set { this.baseDocumentInfoField = value; }
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class TransferBase820 : TransferBase
{
private string baseDocumentIdField;
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string BaseDocumentId
{
get { return this.baseDocumentIdField; }
set { this.baseDocumentIdField = value; }
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class TransferInfo
{
private TransferBase820[] transferBasesField;
private WaybillsWaybill[] waybillsField;
private AdditionalInfoId additionalInfoIdField;
private ExtendedOrganizationInfo carrierField;
private Employee employeeField;
private OtherIssuer otherIssuerField;
private string operationInfoField;
private string operationTypeField;
private string transferDateField;
private string transferStartDateField;
private string transferEndDateField;
private string transferTextInfoField;
private string createdThingTransferDateField;
private string createdThingInfoField;
/// <remarks/>
[System.Xml.Serialization.XmlArrayAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlArrayItemAttribute("TransferBase", Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = false)]
public TransferBase820[] TransferBases
{
get { return this.transferBasesField; }
set { this.transferBasesField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlArrayAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlArrayItemAttribute("Waybill", Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = false)]
public WaybillsWaybill[] Waybills
{
get { return this.waybillsField; }
set { this.waybillsField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public AdditionalInfoId AdditionalInfoId
{
get { return this.additionalInfoIdField; }
set { this.additionalInfoIdField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public ExtendedOrganizationInfo Carrier
{
get { return this.carrierField; }
set { this.carrierField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public Employee Employee
{
get { return this.employeeField; }
set { this.employeeField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public OtherIssuer OtherIssuer
{
get { return this.otherIssuerField; }
set { this.otherIssuerField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string OperationInfo
{
get { return this.operationInfoField; }
set { this.operationInfoField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string OperationType
{
get { return this.operationTypeField; }
set { this.operationTypeField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string TransferDate
{
get { return this.transferDateField; }
set { this.transferDateField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string TransferStartDate
{
get { return this.transferStartDateField; }
set { this.transferStartDateField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string TransferEndDate
{
get { return this.transferEndDateField; }
set { this.transferEndDateField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string TransferTextInfo
{
get { return this.transferTextInfoField; }
set { this.transferTextInfoField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string CreatedThingTransferDate
{
get { return this.createdThingTransferDateField; }
set { this.createdThingTransferDateField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string CreatedThingInfo
{
get { return this.createdThingInfoField; }
set { this.createdThingInfoField = value; }
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class WaybillsWaybill
{
private string transferDocumentNumberField;
private string transferDocumentDateField;
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string TransferDocumentNumber
{
get { return this.transferDocumentNumberField; }
set { this.transferDocumentNumberField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string TransferDocumentDate
{
get { return this.transferDocumentDateField; }
set { this.transferDocumentDateField = value; }
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class CustomsDeclaration
{
private string countryField;
private string declarationNumberField;
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string Country
{
get { return this.countryField; }
set { this.countryField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string DeclarationNumber
{
get { return this.declarationNumberField; }
set { this.declarationNumberField = value; }
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class InvoiceTable
{
private InvoiceTableItem[] itemField;
private decimal totalWithVatExcludedField;
private bool totalWithVatExcludedFieldSpecified;
private decimal vatField;
private bool vatFieldSpecified;
private InvoiceTableWithoutVat withoutVatField;
private decimal totalField;
private bool totalFieldSpecified;
private decimal totalNetField;
private bool totalNetFieldSpecified;
public InvoiceTable()
{
this.withoutVatField = InvoiceTableWithoutVat.False;
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("Item", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public InvoiceTableItem[] Item
{
get { return this.itemField; }
set { this.itemField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public decimal TotalWithVatExcluded
{
get { return this.totalWithVatExcludedField; }
set { this.totalWithVatExcludedField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool TotalWithVatExcludedSpecified
{
get { return this.totalWithVatExcludedFieldSpecified; }
set { this.totalWithVatExcludedFieldSpecified = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public decimal Vat
{
get { return this.vatField; }
set { this.vatField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool VatSpecified
{
get { return this.vatFieldSpecified; }
set { this.vatFieldSpecified = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
[System.ComponentModel.DefaultValueAttribute(InvoiceTableWithoutVat.False)]
public InvoiceTableWithoutVat WithoutVat
{
get { return this.withoutVatField; }
set { this.withoutVatField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public decimal Total
{
get { return this.totalField; }
set { this.totalField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool TotalSpecified
{
get { return this.totalFieldSpecified; }
set { this.totalFieldSpecified = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public decimal TotalNet
{
get { return this.totalNetField; }
set { this.totalNetField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool TotalNetSpecified
{
get { return this.totalNetFieldSpecified; }
set { this.totalNetFieldSpecified = value; }
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class InvoiceTableItem
{
private CustomsDeclaration[] customsDeclarationsField;
private AdditionalInfo[] additionalInfosField;
private InvoiceTableItemItemTracingInfo[] itemTracingInfosField;
private InvoiceTableItemItemIdentificationNumber[] itemIdentificationNumbersField;
private string productField;
private string unitField;
private string unitNameField;
private decimal quantityField;
private bool quantityFieldSpecified;
private decimal priceField;
private bool priceFieldSpecified;
private decimal exciseField;
private bool exciseFieldSpecified;
private TaxRateWithTwentyPercentAndTaxedByAgent taxRateField;
private decimal subtotalWithVatExcludedField;
private bool subtotalWithVatExcludedFieldSpecified;
private decimal vatField;
private bool vatFieldSpecified;
private InvoiceTableItemWithoutVat withoutVatField;
private decimal subtotalField;
private bool subtotalFieldSpecified;
private InvoiceTableItemItemMark itemMarkField;
private bool itemMarkFieldSpecified;
private string additionalPropertyField;
private string itemVendorCodeField;
private decimal itemToReleaseField;
private bool itemToReleaseFieldSpecified;
private string itemCharactField;
private string itemArticleField;
private string itemKindField;
private string catalogCodeField;
private string itemTypeCodeField;
public InvoiceTableItem()
{
this.withoutVatField = InvoiceTableItemWithoutVat.False; }
/// <remarks/>
[System.Xml.Serialization.XmlArrayAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlArrayItemAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = false)]
public CustomsDeclaration[] CustomsDeclarations
{
get { return this.customsDeclarationsField; }
set { this.customsDeclarationsField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlArrayAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlArrayItemAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = false)]
public AdditionalInfo[] AdditionalInfos
{
get { return this.additionalInfosField; }
set { this.additionalInfosField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlArrayAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlArrayItemAttribute("ItemTracingInfo", Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = false)]
public InvoiceTableItemItemTracingInfo[] ItemTracingInfos
{
get { return this.itemTracingInfosField; }
set { this.itemTracingInfosField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlArrayAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlArrayItemAttribute("ItemIdentificationNumber", Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = false)]
public InvoiceTableItemItemIdentificationNumber[] ItemIdentificationNumbers
{
get { return this.itemIdentificationNumbersField; }
set { this.itemIdentificationNumbersField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string Product
{
get { return this.productField; }
set { this.productField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string Unit
{
get { return this.unitField; }
set { this.unitField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string UnitName
{
get { return this.unitNameField; }
set { this.unitNameField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public decimal Quantity
{
get { return this.quantityField; }
set { this.quantityField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool QuantitySpecified
{
get { return this.quantityFieldSpecified; }
set { this.quantityFieldSpecified = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public decimal Price
{
get { return this.priceField; }
set { this.priceField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool PriceSpecified
{
get { return this.priceFieldSpecified; }
set { this.priceFieldSpecified = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public decimal Excise
{
get { return this.exciseField; }
set { this.exciseField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool ExciseSpecified
{
get { return this.exciseFieldSpecified; }
set { this.exciseFieldSpecified = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public TaxRateWithTwentyPercentAndTaxedByAgent TaxRate
{
get { return this.taxRateField; }
set { this.taxRateField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public decimal SubtotalWithVatExcluded
{
get { return this.subtotalWithVatExcludedField; }
set { this.subtotalWithVatExcludedField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool SubtotalWithVatExcludedSpecified
{
get { return this.subtotalWithVatExcludedFieldSpecified; }
set { this.subtotalWithVatExcludedFieldSpecified = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public decimal Vat
{
get { return this.vatField; }
set { this.vatField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool VatSpecified
{
get { return this.vatFieldSpecified; }
set { this.vatFieldSpecified = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
[System.ComponentModel.DefaultValueAttribute(InvoiceTableItemWithoutVat.False)]
public InvoiceTableItemWithoutVat WithoutVat
{
get { return this.withoutVatField; }
set { this.withoutVatField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public decimal Subtotal
{
get { return this.subtotalField; }
set { this.subtotalField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool SubtotalSpecified
{
get { return this.subtotalFieldSpecified; }
set { this.subtotalFieldSpecified = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public InvoiceTableItemItemMark ItemMark
{
get { return this.itemMarkField; }
set { this.itemMarkField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool ItemMarkSpecified
{
get { return this.itemMarkFieldSpecified; }
set { this.itemMarkFieldSpecified = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string AdditionalProperty
{
get { return this.additionalPropertyField; }
set { this.additionalPropertyField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string ItemVendorCode
{
get { return this.itemVendorCodeField; }
set { this.itemVendorCodeField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public decimal ItemToRelease
{
get { return this.itemToReleaseField; }
set { this.itemToReleaseField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool ItemToReleaseSpecified
{
get { return this.itemToReleaseFieldSpecified; }
set { this.itemToReleaseFieldSpecified = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string ItemCharact
{
get { return this.itemCharactField; }
set { this.itemCharactField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string ItemArticle
{
get { return this.itemArticleField; }
set { this.itemArticleField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string ItemKind
{
get { return this.itemKindField; }
set { this.itemKindField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string CatalogCode
{
get { return this.catalogCodeField; }
set { this.catalogCodeField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string ItemTypeCode
{
get { return this.itemTypeCodeField; }
set { this.itemTypeCodeField = value; }
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class InvoiceTableItemItemTracingInfo
{
private string regNumberUnitField;
private string unitField;
private decimal quantityField;
private string itemAddInfoField;
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string RegNumberUnit
{
get { return this.regNumberUnitField; }
set { this.regNumberUnitField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string Unit
{
get { return this.unitField; }
set { this.unitField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public decimal Quantity
{
get { return this.quantityField; }
set { this.quantityField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string ItemAddInfo
{
get { return this.itemAddInfoField; }
set { this.itemAddInfoField = value; }
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class InvoiceTableItemItemIdentificationNumber
{
private string[] unitField;
private string[] packageIdField;
private string transPackageIdField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("Unit", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string[] Unit
{
get { return this.unitField; }
set { this.unitField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("PackageId", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string[] PackageId
{
get { return this.packageIdField; }
set { this.packageIdField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string TransPackageId
{
get { return this.transPackageIdField; }
set { this.transPackageIdField = value; }
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public enum InvoiceTableItemWithoutVat
{
/// <remarks/>
[System.Xml.Serialization.XmlEnumAttribute("true")]
True,
/// <remarks/>
[System.Xml.Serialization.XmlEnumAttribute("false")]
False,
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public enum InvoiceTableItemItemMark
{
/// <remarks/>
[System.Xml.Serialization.XmlEnumAttribute("1")]
Property,
/// <remarks/>
[System.Xml.Serialization.XmlEnumAttribute("2")]
Job,
/// <remarks/>
[System.Xml.Serialization.XmlEnumAttribute("3")]
Service,
/// <remarks/>
[System.Xml.Serialization.XmlEnumAttribute("4")]
PropertyRights,
/// <remarks/>
[System.Xml.Serialization.XmlEnumAttribute("5")]
Other,
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public enum InvoiceTableWithoutVat
{
/// <remarks/>
[System.Xml.Serialization.XmlEnumAttribute("true")]
True,
/// <remarks/>
[System.Xml.Serialization.XmlEnumAttribute("false")]
False,
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class PaymentDocumentInfo
{
private string dateField;
private string numberField;
private decimal totalField;
private bool totalFieldSpecified;
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string Date
{
get { return this.dateField; }
set { this.dateField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string Number
{
get { return this.numberField; }
set { this.numberField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public decimal Total
{
get { return this.totalField; }
set { this.totalField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool TotalSpecified
{
get { return this.totalFieldSpecified; }
set { this.totalFieldSpecified = value; }
}
}
/// <remarks/>
[System.Xml.Serialization.XmlIncludeAttribute(typeof(ExtendedOrganizationReference))]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(ExtendedOrganizationDetails))]
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class ExtendedOrganizationDetails_ManualFilling
{
private OrganizationType orgTypeField;
private string okopfField;
private string okpoField;
private string okdpField;
private string phoneField;
private string emailField;
private string correspondentAccountField;
private string bankAccountNumberField;
private string bankNameField;
private string bankIdField;
private string departmentField;
private string organizationAdditionalInfoField;
private string organizationOrPersonInfoField;
private string individualEntityRegistrationCertificateField;
private string legalEntityIdField;
private string shortOrgNameField;
private string countryField;
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public OrganizationType OrgType
{
get { return this.orgTypeField; }
set { this.orgTypeField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string Okopf
{
get { return this.okopfField; }
set { this.okopfField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string Okpo
{
get { return this.okpoField; }
set { this.okpoField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string Okdp
{
get { return this.okdpField; }
set { this.okdpField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string Phone
{
get { return this.phoneField; }
set { this.phoneField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string Email
{
get { return this.emailField; }
set { this.emailField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string CorrespondentAccount
{
get { return this.correspondentAccountField; }
set { this.correspondentAccountField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string BankAccountNumber
{
get { return this.bankAccountNumberField; }
set { this.bankAccountNumberField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string BankName
{
get { return this.bankNameField; }
set { this.bankNameField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string BankId
{
get { return this.bankIdField; }
set { this.bankIdField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string Department
{
get { return this.departmentField; }
set { this.departmentField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string OrganizationAdditionalInfo
{
get { return this.organizationAdditionalInfoField; }
set { this.organizationAdditionalInfoField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string OrganizationOrPersonInfo
{
get { return this.organizationOrPersonInfoField; }
set { this.organizationOrPersonInfoField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string IndividualEntityRegistrationCertificate
{
get { return this.individualEntityRegistrationCertificateField; }
set { this.individualEntityRegistrationCertificateField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string LegalEntityId
{
get { return this.legalEntityIdField; }
set { this.legalEntityIdField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string ShortOrgName
{
get { return this.shortOrgNameField; }
set { this.shortOrgNameField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string Country
{
get { return this.countryField; }
set { this.countryField = value; }
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class ExtendedOrganizationReference : ExtendedOrganizationDetails_ManualFilling
{
private string boxIdField;
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string BoxId
{
get { return this.boxIdField; }
set { this.boxIdField = value; }
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class UniversalTransferDocumentShipper
{
private ExtendedOrganizationDetails_ManualFilling itemField;
private UniversalTransferDocumentShipperSameAsSeller sameAsSellerField;
public UniversalTransferDocumentShipper()
{
this.sameAsSellerField = UniversalTransferDocumentShipperSameAsSeller.False; }
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("OrganizationDetails", typeof(ExtendedOrganizationDetails), Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlElementAttribute("OrganizationReference", typeof(ExtendedOrganizationReference), Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public ExtendedOrganizationDetails_ManualFilling Item
{
get { return this.itemField; }
set { this.itemField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
[System.ComponentModel.DefaultValueAttribute(UniversalTransferDocumentShipperSameAsSeller.False)]
public UniversalTransferDocumentShipperSameAsSeller SameAsSeller
{
get { return this.sameAsSellerField; }
set { this.sameAsSellerField = value; }
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public enum UniversalTransferDocumentShipperSameAsSeller
{
/// <remarks/>
[System.Xml.Serialization.XmlEnumAttribute("true")]
True,
/// <remarks/>
[System.Xml.Serialization.XmlEnumAttribute("false")]
False,
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class UniversalTransferDocumentSellerInfoCircumPublicProc
{
private string dateStateContractField;
private string numberStateContractField;
private string personalAccountSellerField;
private string sellerBudjetClassCodeField;
private string sellerTargetCodeField;
private string sellerTreasuryCodeField;
private string sellerTreasuryNameField;
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string DateStateContract
{
get { return this.dateStateContractField; }
set { this.dateStateContractField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string NumberStateContract
{
get { return this.numberStateContractField; }
set { this.numberStateContractField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string PersonalAccountSeller
{
get { return this.personalAccountSellerField; }
set { this.personalAccountSellerField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string SellerBudjetClassCode
{
get { return this.sellerBudjetClassCodeField; }
set { this.sellerBudjetClassCodeField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string SellerTargetCode
{
get { return this.sellerTargetCodeField; }
set { this.sellerTargetCodeField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string SellerTreasuryCode
{
get { return this.sellerTreasuryCodeField; }
set { this.sellerTreasuryCodeField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string SellerTreasuryName
{
get { return this.sellerTreasuryNameField; }
set { this.sellerTreasuryNameField = value; }
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class UniversalTransferDocumentDocumentShipment
{
private string nameField;
private string numberField;
private string dateField;
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string Name
{
get { return this.nameField; }
set { this.nameField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string Number
{
get { return this.numberField; }
set { this.numberField = value; }
}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string Date
{
get { return this.dateField; }
set { this.dateField = value; }
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public enum UniversalTransferDocumentFunction
{
/// <remarks/>
СЧФ,
/// <remarks/>
ДОП,
/// <remarks/>
СЧФДОП,
}
/// <remarks>
/// Обстоятельства формирования счета-фактуры, применяемого при расчетах по налогу на добавленную стоимость
/// </remarks>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public enum UniversalTransferDocumentCircumFormatInvoice
{
/// <remarks>
/// Cчет-фактура, выставляемый при реализации товаров (работ, услуг), передаче имущественных прав
/// </remarks>
[System.Xml.Serialization.XmlEnumAttribute("1")]
ItemsRealization,
/// <remarks>
/// Счет-фактура, выставляемый при получении оплаты, частичной оплаты в счет предстоящих
/// поставок товаров (выполнения работ, оказания услуг), передачи имущественных прав
/// </remarks>
[System.Xml.Serialization.XmlEnumAttribute("2")]
PaymentsRecieve,
/// <remarks>
/// Счет-фактура, применяемый в случае реализации комиссионером (агентом, экспедитором, застройщиком или заказчиком, выполняющим функции застройщика)
/// двум и более покупателям (приобретения у двух и более продавцов) товаров (работ, услуг), имущественных прав от своего имени
/// </remarks>
[System.Xml.Serialization.XmlEnumAttribute("3")]
AgentSchema,
}
}
|
||||
TheStack | e8f507bbe6089cfdcb87231ffd12040e4c4c029d | C#code:C# | {"size": 658, "ext": "cs", "max_stars_repo_path": "tests/ServiceStack.WebHost.Endpoints.Tests/Support/Host/TestAppHost.cs", "max_stars_repo_name": "BruceCowan-AI/ServiceStack", "max_stars_repo_stars_event_min_datetime": "2021-05-04T14:38:01.000Z", "max_stars_repo_stars_event_max_datetime": "2021-05-04T18:57:01.000Z", "max_issues_repo_path": "tests/ServiceStack.WebHost.Endpoints.Tests/Support/Host/TestAppHost.cs", "max_issues_repo_name": "BruceCowan-AI/ServiceStack", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "tests/ServiceStack.WebHost.Endpoints.Tests/Support/Host/TestAppHost.cs", "max_forks_repo_name": "BruceCowan-AI/ServiceStack", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": 4.0, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.3076923077, "max_line_length": 121, "alphanum_fraction": 0.6671732523} | using System.Reflection;
using Funq;
using ServiceStack.WebHost.Endpoints.Tests.Support.Services;
namespace ServiceStack.WebHost.Endpoints.Tests.Support.Host
{
public interface IFoo { }
public class Foo : IFoo { }
public class TestAppHost
: AppHostBase
{
public TestAppHost(params Assembly[] assembliesWithServices)
: base("Example Service",
assembliesWithServices.Length > 0 ? assembliesWithServices : new[] { typeof(Nested).GetAssembly() })
{
Instance = null;
}
public override void Configure(Container container)
{
container.Register<IFoo>(c => new Foo());
}
}
} |
||||
TheStack | e8f6628fb6395afd6f4dfe3e0a50d7944081e93b | C#code:C# | {"size": 397, "ext": "cs", "max_stars_repo_path": "Core/JustAssembly.DiffAlgorithm/Models/DiffResult.cs", "max_stars_repo_name": "JarLob/JustAssembly", "max_stars_repo_stars_event_min_datetime": "2017-04-06T14:19:29.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-09T13:05:34.000Z", "max_issues_repo_path": "Core/JustAssembly.DiffAlgorithm/Models/DiffResult.cs", "max_issues_repo_name": "Acidburn0zzz/JustAssembly", "max_issues_repo_issues_event_min_datetime": "2017-04-07T13:18:05.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-06T13:01:28.000Z", "max_forks_repo_path": "Core/JustAssembly.DiffAlgorithm/Models/DiffResult.cs", "max_forks_repo_name": "Acidburn0zzz/JustAssembly", "max_forks_repo_forks_event_min_datetime": "2017-04-14T19:05:28.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-16T10:00:15.000Z"} | {"max_stars_count": 322.0, "max_issues_count": 43.0, "max_forks_count": 80.0, "avg_line_length": 23.3529411765, "max_line_length": 66, "alphanum_fraction": 0.5717884131} | namespace JustAssembly.DiffAlgorithm.Models
{
public class DiffResult
{
public DiffFile File { get; set; }
public DiffFile ModifiedFile { get; set; }
public DiffResult()
{
}
public DiffResult(DiffFile oldFile, DiffFile modifiedFile)
{
this.File = oldFile;
this.ModifiedFile = modifiedFile;
}
}
} |
||||
TheStack | e8f6ec49215e44fd411fe36e16aed5c2fd63f3e4 | C#code:C# | {"size": 6202, "ext": "cs", "max_stars_repo_path": "examples/AspNetCoreWeb/Actions/Home/HomeController.cs", "max_stars_repo_name": "NanoFabricFX/IdentityBase", "max_stars_repo_stars_event_min_datetime": "2017-11-14T06:26:44.000Z", "max_stars_repo_stars_event_max_datetime": "2019-12-02T18:39:56.000Z", "max_issues_repo_path": "examples/AspNetCoreWeb/Actions/Home/HomeController.cs", "max_issues_repo_name": "NanoFabricFX/IdentityBase", "max_issues_repo_issues_event_min_datetime": "2018-01-17T01:37:51.000Z", "max_issues_repo_issues_event_max_datetime": "2020-06-23T00:06:07.000Z", "max_forks_repo_path": "examples/AspNetCoreWeb/Actions/Home/HomeController.cs", "max_forks_repo_name": "NanoFabricFX/IdentityBase", "max_forks_repo_forks_event_min_datetime": "2017-11-07T08:24:27.000Z", "max_forks_repo_forks_event_max_datetime": "2020-04-19T09:34:37.000Z"} | {"max_stars_count": 115.0, "max_issues_count": 34.0, "max_forks_count": 39.0, "avg_line_length": 33.1657754011, "max_line_length": 84, "alphanum_fraction": 0.5623992261} | namespace AspNetCoreWeb.Actions.Home
{
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authorization;
using System.Net.Http;
using Newtonsoft.Json.Linq;
using IdentityModel.Client;
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
using System.Globalization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Localization;
using Microsoft.Extensions.Logging;
public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
private readonly ApplicationOptions _appOptions;
private readonly IHttpClientFactory _httpClientFactory;
private readonly IDiscoveryCache _discoveryCache;
public HomeController(
ILogger<HomeController> logger,
ApplicationOptions appOptions,
IHttpClientFactory httpClientFactory,
IDiscoveryCache discoveryCache)
{
this._logger = logger;
this._appOptions = appOptions;
this._httpClientFactory = httpClientFactory;
this._discoveryCache = discoveryCache;
}
public IActionResult Index()
{
return this.View();
}
[Authorize]
[HttpGet("/secure")]
public IActionResult Secure()
{
return View();
}
[Authorize]
[HttpGet("/callapi-user-token")]
public async Task<IActionResult> CallApiUserToken()
{
string token = await this.HttpContext.GetTokenAsync("access_token");
HttpClient client = this._httpClientFactory.CreateClient();
client.SetBearerToken(token);
string response = await client.GetStringAsync(
this._appOptions.Api1BaseAddress + "/identity");
this.ViewBag.Json = JArray.Parse(response).ToString();
return this.View("Json");
}
[Authorize]
[HttpGet("/callapi-client-credentials")]
public async Task<IActionResult> CallApiClientCredentials()
{
HttpClient tokenClienst = this._httpClientFactory.CreateClient();
TokenResponse tokenResponse = await tokenClienst
.RequestClientCredentialsTokenAsync(
new ClientCredentialsTokenRequest
{
Address = this._appOptions.Authority + "/connect/token",
ClientId = this._appOptions.ClientId,
ClientSecret = this._appOptions.ClientSecret,
Scope = "api1"
});
HttpClient client = this._httpClientFactory.CreateClient();
client.SetBearerToken(tokenResponse.AccessToken);
string content =
await client.GetStringAsync(
this._appOptions.Api1BaseAddress + "/identity");
this.ViewBag.Json = JArray.Parse(content).ToString();
return this.View("Json");
}
[Authorize]
[HttpGet("/renew-tokens")]
public async Task<IActionResult> RenewTokens()
{
DiscoveryDocumentResponse disco = await this._discoveryCache.GetAsync();
if (disco.IsError)
{
throw new Exception(disco.Error);
}
string rt = await this.HttpContext.GetTokenAsync("refresh_token");
HttpClient tokenClient = this._httpClientFactory.CreateClient();
TokenResponse tokenResult =
await tokenClient.RequestRefreshTokenAsync(
new RefreshTokenRequest
{
Address = disco.TokenEndpoint,
ClientId = this._appOptions.ClientId,
ClientSecret = this._appOptions.ClientSecret,
RefreshToken = rt,
});
if (!tokenResult.IsError)
{
string oldIdToken =
await this.HttpContext.GetTokenAsync("id_token");
string newAccessToken = tokenResult.AccessToken;
string newRefreshToken = tokenResult.RefreshToken;
DateTime expiresAt =
DateTime.UtcNow +
TimeSpan.FromSeconds(tokenResult.ExpiresIn);
AuthenticateResult info =
await HttpContext.AuthenticateAsync("Cookies");
info.Properties
.UpdateTokenValue("refresh_token", newRefreshToken);
info.Properties
.UpdateTokenValue("access_token", newAccessToken);
info.Properties.UpdateTokenValue(
"expires_at",
expiresAt.ToString("o", CultureInfo.InvariantCulture)
);
await this.HttpContext.SignInAsync(
"Cookies",
info.Principal,
info.Properties
);
return this.RedirectToAction("Secure", "Home");
}
this.ViewData["Error"] = tokenResult.Error;
return this.View("Error");
}
[HttpGet("/logout")]
public IActionResult Logout()
{
return new SignOutResult(new[] {
"Cookies",
"oidc"
});
}
[HttpGet("/set-language")]
public IActionResult SetLanguage(string culture, string returnUrl)
{
this.Response.Cookies.Append(
CookieRequestCultureProvider.DefaultCookieName,
CookieRequestCultureProvider
.MakeCookieValue(new RequestCulture(culture)),
new CookieOptions
{
Expires = DateTimeOffset.UtcNow.AddYears(1)
}
);
return LocalRedirect(returnUrl);
}
[HttpGet("/error")]
public IActionResult Error()
{
return this.View();
}
}
}
|
||||
TheStack | e8f716dd9b5e2ad87463c61d8c10fd324fd86954 | C#code:C# | {"size": 684, "ext": "cs", "max_stars_repo_path": "soap_exercice/Models/ITestService.cs", "max_stars_repo_name": "joomab/soap-netcore-with-headers", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "soap_exercice/Models/ITestService.cs", "max_issues_repo_name": "joomab/soap-netcore-with-headers", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "soap_exercice/Models/ITestService.cs", "max_forks_repo_name": "joomab/soap-netcore-with-headers", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 19.0, "max_line_length": 56, "alphanum_fraction": 0.6140350877} | using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Threading.Tasks;
namespace soap_exercice.Models
{
[MessageContract(IsWrapped = false)]
public class TestMessage
{
[MessageHeader]
public string Security;
[MessageBodyMember]
public string Body;
public TestMessage()
{
}
public TestMessage(string security, string body)
{
Security = security;
Body = body;
}
}
[ServiceContract]
public interface ITestService
{
[OperationContract]
void Operation(TestMessage message);
}
}
|
||||
TheStack | e8f71d7aa1794803871f470f1d1d7a1aa9ab4aa0 | C#code:C# | {"size": 685, "ext": "cs", "max_stars_repo_path": "orleans/GrainInterfaces/IEventGrain.cs", "max_stars_repo_name": "vijayraavi/smilr", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "orleans/GrainInterfaces/IEventGrain.cs", "max_issues_repo_name": "vijayraavi/smilr", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "orleans/GrainInterfaces/IEventGrain.cs", "max_forks_repo_name": "vijayraavi/smilr", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.4642857143, "max_line_length": 92, "alphanum_fraction": 0.6890510949} | using GrainModels;
using Orleans;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace GrainInterfaces
{
// event grain interface
public interface IEventGrain : IGrainWithStringKey
{
// initialise/update a grain with the core event info
Task Update(string title, string type, string start, string end, TopicAPI[] topics);
// return event info
Task<EventAPI> Info();
// submit event + topic feedback
Task SubmitFeedback(int topic, int rating, string comment);
// get all feedback for specific topic
Task<FeedbackAPI> GetFeedback(int topicid);
}
}
|
||||
TheStack | e8f73fa0dbac77d025d49abd2a5ec0f238c3dd2c | C#code:C# | {"size": 1551, "ext": "cs", "max_stars_repo_path": "src/ShaderTools.CodeAnalysis.ShaderLab/Syntax/SyntaxTree.cs", "max_stars_repo_name": "stef-levesque/HlslTools", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/ShaderTools.CodeAnalysis.ShaderLab/Syntax/SyntaxTree.cs", "max_issues_repo_name": "stef-levesque/HlslTools", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/ShaderTools.CodeAnalysis.ShaderLab/Syntax/SyntaxTree.cs", "max_forks_repo_name": "stef-levesque/HlslTools", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 29.8269230769, "max_line_length": 85, "alphanum_fraction": 0.6286266925} | using System;
using System.Collections.Generic;
using ShaderTools.CodeAnalysis.Diagnostics;
using ShaderTools.CodeAnalysis.Syntax;
using ShaderTools.CodeAnalysis.Text;
namespace ShaderTools.CodeAnalysis.ShaderLab.Syntax
{
public sealed class SyntaxTree : SyntaxTreeBase
{
private readonly SourceFile _sourceFile;
public override SourceText Text => _sourceFile.Text;
public override ParseOptions Options => null;
public override SyntaxNodeBase Root { get; }
internal SyntaxTree(SourceText text, Func<SyntaxTree, SyntaxNode> parseFunc)
{
_sourceFile = new SourceFile(text, null);
Root = parseFunc(this);
}
public override IEnumerable<Diagnostic> GetDiagnostics()
{
return Root.GetDiagnostics();
}
public override SourceFileSpan GetSourceFileSpan(SourceRange range)
{
return new SourceFileSpan(
_sourceFile,
new TextSpan(range.Start.Position, range.Length));
}
public int GetSourceFilePoint(SourceLocation location)
{
return location.Position;
}
public override SourceLocation MapRootFilePosition(int position)
{
return new SourceLocation(position);
}
public override SourceRange MapRootFileRange(TextSpan span)
{
return new SourceRange(new SourceLocation(span.Start), span.Length);
}
}
} |
||||
TheStack | e8f9d052024d8d06372e02a5db39c848d0602f0f | C#code:C# | {"size": 2223, "ext": "cs", "max_stars_repo_path": "src/Stormpath.SDK.Abstractions/Shared/HashCode.cs", "max_stars_repo_name": "stormpath/stormpath-sdk-dotnet", "max_stars_repo_stars_event_min_datetime": "2015-10-22T00:50:26.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-23T11:48:29.000Z", "max_issues_repo_path": "src/Stormpath.SDK.Abstractions/Shared/HashCode.cs", "max_issues_repo_name": "stormpath/stormpath-sdk-dotnet", "max_issues_repo_issues_event_min_datetime": "2015-10-12T22:35:31.000Z", "max_issues_repo_issues_event_max_datetime": "2018-07-11T22:08:11.000Z", "max_forks_repo_path": "src/Stormpath.SDK.Abstractions/Shared/HashCode.cs", "max_forks_repo_name": "stormpath/stormpath-sdk-dotnet", "max_forks_repo_forks_event_min_datetime": "2015-12-15T00:13:59.000Z", "max_forks_repo_forks_event_max_datetime": "2019-03-19T14:04:20.000Z"} | {"max_stars_count": 54.0, "max_issues_count": 165.0, "max_forks_count": 14.0, "avg_line_length": 34.734375, "max_line_length": 89, "alphanum_fraction": 0.6000899685} | // <copyright file="HashCode.cs" company="Stormpath, Inc.">
// Copyright (c) 2016 Stormpath, Inc.
//
// 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.
// </copyright>
namespace Stormpath.SDK.Shared
{
/// <summary>
/// Represents a hash code computed for an object.
/// </summary>
/// <seealso href="http://stackoverflow.com/a/18613926/3191599"/>
public struct HashCode
{
private readonly int hashCode;
private HashCode(int startingValue)
{
this.hashCode = startingValue;
}
/// <summary>
/// Creates a new instance of <see cref="HashCode"/>.
/// </summary>
public static HashCode Start => new HashCode(17);
/// <summary>
/// Converts a <see cref="HashCode"/> instance to an <c>int</c>.
/// </summary>
/// <param name="hashCode">The <see cref="HashCode"/> to convert.</param>
/// <returns>The <c>int</c> value of this <see cref="HashCode"/>.</returns>
public static implicit operator int(HashCode hashCode) => hashCode.GetHashCode();
/// <summary>
/// Fluently adds an object to the computed hash code.
/// </summary>
/// <typeparam name="T">The object type.</typeparam>
/// <param name="obj">The object to hash.</param>
/// <returns>This instance for method chaining.</returns>
public HashCode Hash<T>(T obj)
{
var h = obj != null ? obj.GetHashCode() : 0;
unchecked
{
h += this.hashCode * 31;
}
return new HashCode(h);
}
/// <inheritdoc/>
public override int GetHashCode() => this.hashCode;
}
} |
||||
TheStack | e8fb64debc2e005995e56d1536253257b3669c17 | C#code:C# | {"size": 10020, "ext": "cs", "max_stars_repo_path": "JsonAssets/Overrides/ObjectPatches.cs", "max_stars_repo_name": "strobel1ght/StardewValleyMods", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "JsonAssets/Overrides/ObjectPatches.cs", "max_issues_repo_name": "strobel1ght/StardewValleyMods", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "JsonAssets/Overrides/ObjectPatches.cs", "max_forks_repo_name": "strobel1ght/StardewValleyMods", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 37.9545454545, "max_line_length": 164, "alphanum_fraction": 0.4816367265} | using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Harmony;
using JsonAssets.Data;
using Microsoft.Xna.Framework;
using SpaceShared;
using StardewValley;
using StardewValley.Network;
using StardewValley.Objects;
using SObject = StardewValley.Object;
namespace JsonAssets.Overrides
{
[SuppressMessage("ReSharper", "InconsistentNaming", Justification = "The naming convention is set by Harmony.")]
public class ObjectPatches
{
public static bool CanBePlacedHere_Prefix(SObject __instance, GameLocation l, Vector2 tile, ref bool __result)
{
try
{
if (!__instance.bigCraftable.Value && Mod.instance.objectIds.Values.Contains(__instance.ParentSheetIndex))
{
if (__instance.Category == SObject.SeedsCategory)
{
bool isTree = false;
foreach (var tree in Mod.instance.fruitTrees)
{
if (tree.sapling.id == __instance.ParentSheetIndex)
{
isTree = true;
break;
}
}
var tileObj = l.objects.ContainsKey(tile) ? l.objects[tile] : null;
if (isTree)
{
__result = tileObj == null && !l.isTileOccupiedForPlacement(tile, __instance);
return false;
}
else
{
if (l.isTileHoeDirt(tile) || tileObj is IndoorPot)
__result = !l.isTileOccupiedForPlacement(tile, __instance);
else
__result = false;
return false;
}
}
return true;
}
else
return true;
}
catch (Exception ex)
{
Log.error($"Failed in {nameof(CanBePlacedHere_Prefix)} for #{__instance?.ParentSheetIndex} {__instance?.Name}:\n{ex}");
return true;
}
}
public static bool CheckForAction_Prefix(SObject __instance)
{
try
{
if (__instance.bigCraftable.Value && Mod.instance.bigCraftableIds.Values.Contains(__instance.ParentSheetIndex) && __instance.name.Contains("Chair"))
return false;
return true;
}
catch (Exception ex)
{
Log.error($"Failed in {nameof(CheckForAction_Prefix)} for #{__instance?.ParentSheetIndex} {__instance?.Name}:\n{ex}");
return true;
}
}
public static bool LoadDisplayName_Prefix(SObject __instance, ref string __result)
{
try
{
if (!__instance.Name?.Contains("Honey") == true)
return true;
if (!__instance.bigCraftable.Value && Mod.instance.objectIds.Values.Contains(__instance.ParentSheetIndex))
{
Game1.objectInformation.TryGetValue(__instance.ParentSheetIndex, out string str);
if (!string.IsNullOrEmpty(str))
__result = str.Split('/')[4];
return false;
}
else if (__instance.bigCraftable.Value && Mod.instance.bigCraftableIds.Values.Contains(__instance.ParentSheetIndex))
{
Game1.bigCraftablesInformation.TryGetValue(__instance.ParentSheetIndex, out string str);
if (!string.IsNullOrEmpty(str))
{
string[] strArray = str.Split('/');
__result = strArray[strArray.Length - 1];
}
return false;
}
return true;
}
catch (Exception ex)
{
Log.error($"Failed in {nameof(LoadDisplayName_Prefix)} for #{__instance?.ParentSheetIndex} {__instance?.Name}:\n{ex}");
return true;
}
}
public static bool GetCategoryName_Prefix(SObject __instance, ref string __result)
{
try
{
ObjectData objData = null;
foreach (var obj in Mod.instance.objects)
{
if (obj.GetObjectId() == __instance.ParentSheetIndex)
{
objData = obj;
break;
}
}
if (objData?.CategoryTextOverride != null)
{
__result = objData.CategoryTextOverride;
return false;
}
return true;
}
catch (Exception ex)
{
Log.error($"Failed in {nameof(GetCategoryName_Prefix)} for #{__instance?.ParentSheetIndex} {__instance?.Name}:\n{ex}");
return true;
}
}
public static void IsIndexOkForBasicShippedCategory_Postfix(int index, ref bool __result)
{
try
{
foreach (var ring in Mod.instance.myRings)
{
if (ring.GetObjectId() == index)
{
__result = false;
break;
}
}
if ( Mod.instance.objectIds.Values.Contains(index) )
{
var obj = new List<ObjectData>(Mod.instance.objects).Find(od => od.GetObjectId() == index);
if ( obj != null && ( !obj.CanSell || obj.HideFromShippingCollection ) )
__result = false;
}
}
catch (Exception ex)
{
Log.error($"Failed in {nameof(IsIndexOkForBasicShippedCategory_Postfix)} for #{index}:\n{ex}");
}
}
public static bool GetCategoryColor_Prefix(SObject __instance, ref Color __result)
{
try
{
ObjectData objData = null;
foreach (var obj in Mod.instance.objects)
{
if (obj.GetObjectId() == __instance.ParentSheetIndex)
{
objData = obj;
break;
}
}
if (objData != null && objData.CategoryColorOverride.A != 0)
{
__result = objData.CategoryColorOverride;
return false;
}
return true;
}
catch (Exception ex)
{
Log.error($"Failed in {nameof(GetCategoryColor_Prefix)} for #{__instance?.ParentSheetIndex} {__instance?.Name}:\n{ex}");
return true;
}
}
public static void CanBeGivenAsGift_Postfix(StardewValley.Object __instance, ref bool __result)
{
try
{
if (!__instance.bigCraftable.Value && Mod.instance.objectIds.Values.Contains(__instance.ParentSheetIndex))
{
var obj = new List<ObjectData>(Mod.instance.objects).Find(od => od.GetObjectId() == __instance.ParentSheetIndex);
if (obj != null && !obj.CanBeGifted)
__result = false;
}
}
catch (Exception ex)
{
Log.error($"Failed in {nameof(CanBeGivenAsGift_Postfix)} for #{__instance?.ParentSheetIndex} {__instance?.Name}:\n{ex}");
}
}
}
[HarmonyPatch(typeof(StardewValley.Object), nameof(StardewValley.Object.isPlaceable))]
public static class ObjectIsPlaceablePatch
{
public static bool Prefix( StardewValley.Object __instance, ref bool __result )
{
if ( __instance.bigCraftable.Value )
return true;
if ( __instance.Category == StardewValley.Object.CraftingCategory && Mod.instance.objectIds.Values.Contains( __instance.ParentSheetIndex ) )
{
if ( !Mod.instance.fences.Any( f => f.correspondingObject.id == __instance.ParentSheetIndex ) )
{
__result = false;
return false;
}
}
return true;
}
}
[HarmonyPatch(typeof(StardewValley.Object), nameof(StardewValley.Object.placementAction))]
public static class ObjectPlacementActionPatch
{
public static bool Prefix(StardewValley.Object __instance, GameLocation location, int x, int y, Farmer who, ref bool __result )
{
Vector2 pos = new Vector2( x / 64, y / 64 );
if ( !__instance.bigCraftable.Value && !(__instance is Furniture) )
{
foreach ( var fence in Mod.instance.fences )
{
if ( __instance.ParentSheetIndex == fence.correspondingObject.GetObjectId() )
{
if ( location.objects.ContainsKey( pos ) )
{
__result = false;
return false;
}
location.objects.Add( pos, new Fence( pos, fence.correspondingObject.GetObjectId(), false ) );
location.playSound( fence.PlacementSound, NetAudio.SoundContext.Default );
__result = true;
return false;
}
}
}
return true;
}
}
}
|
||||
TheStack | e8fb66ec2065b13d702cf9a941647189509004cc | C#code:C# | {"size": 298, "ext": "cs", "max_stars_repo_path": "aspnet/web-forms/overview/older-versions-getting-started/deploying-web-site-projects/core-differences-between-iis-and-the-asp-net-development-server-cs/samples/sample1.cs", "max_stars_repo_name": "crowchirp/aspnet-docs", "max_stars_repo_stars_event_min_datetime": "2020-02-20T05:22:34.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-29T12:07:40.000Z", "max_issues_repo_path": "aspnet/web-forms/overview/older-versions-getting-started/deploying-web-site-projects/core-differences-between-iis-and-the-asp-net-development-server-cs/samples/sample1.cs", "max_issues_repo_name": "crowchirp/aspnet-docs", "max_issues_repo_issues_event_min_datetime": "2020-02-20T15:57:30.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-25T03:49:08.000Z", "max_forks_repo_path": "aspnet/web-forms/overview/older-versions-getting-started/deploying-web-site-projects/core-differences-between-iis-and-the-asp-net-development-server-cs/samples/sample1.cs", "max_forks_repo_name": "crowchirp/aspnet-docs", "max_forks_repo_forks_event_min_datetime": "2020-02-20T07:49:28.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-31T13:37:20.000Z"} | {"max_stars_count": 159.0, "max_issues_count": 130.0, "max_forks_count": 672.0, "avg_line_length": 22.9230769231, "max_line_length": 64, "alphanum_fraction": 0.7248322148} | protected void Page_Load(object sender, EventArgs e)
{
string filePath = Server.MapPath("~/LastTYASP35Access.txt");
string contents = string.Format("Last accessed on {0} by {1}",
DateTime.Now.ToString(), Request.UserHostAddress);
System.IO.File.WriteAllText(filePath, contents);
} |
||||
TheStack | e8fb84e927c20e762c13e7e00b92abb7791270ca | C#code:C# | {"size": 618, "ext": "cs", "max_stars_repo_path": "Owinofy/Any.WebConsole/Program.cs", "max_stars_repo_name": "yadavanuj/Owinofy", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Owinofy/Any.WebConsole/Program.cs", "max_issues_repo_name": "yadavanuj/Owinofy", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Owinofy/Any.WebConsole/Program.cs", "max_forks_repo_name": "yadavanuj/Owinofy", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.7692307692, "max_line_length": 65, "alphanum_fraction": 0.6003236246} | using System;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Owin.Hosting;
namespace Any.WebConsole
{
class Program
{
static void Main(string[] args)
{
string url = ConfigurationManager.AppSettings["url"];
using (WebApp.Start<Startup>(url))
{
Process.Start(url); // Launch the browser.
Console.WriteLine("Press Enter to exit...");
Console.ReadLine();
}
}
}
}
|
||||
TheStack | e8fef42496d2119e249a3e621a65d03ff4e441bf | C#code:C# | {"size": 773, "ext": "cs", "max_stars_repo_path": "api/src/Microsoft.Azure.IIoT.OpcUa.Api.Vault/src/Models/CertificateRequestType.cs", "max_stars_repo_name": "JMayrbaeurl/Industrial-IoT", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "api/src/Microsoft.Azure.IIoT.OpcUa.Api.Vault/src/Models/CertificateRequestType.cs", "max_issues_repo_name": "JMayrbaeurl/Industrial-IoT", "max_issues_repo_issues_event_min_datetime": "2020-10-26T07:37:32.000Z", "max_issues_repo_issues_event_max_datetime": "2020-11-16T11:05:58.000Z", "max_forks_repo_path": "api/src/Microsoft.Azure.IIoT.OpcUa.Api.Vault/src/Models/CertificateRequestType.cs", "max_forks_repo_name": "JMayrbaeurl/Industrial-IoT", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": 33.0, "max_forks_count": null, "avg_line_length": 26.6551724138, "max_line_length": 99, "alphanum_fraction": 0.5006468305} | // ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
// ------------------------------------------------------------
namespace Microsoft.Azure.IIoT.OpcUa.Api.Vault.Models {
using System.Runtime.Serialization;
/// <summary>
/// The certificate request type.
/// </summary>
[DataContract]
public enum CertificateRequestType {
/// <summary>
/// Signing request
/// </summary>
[EnumMember]
SigningRequest,
/// <summary>
/// Key pair request
/// </summary>
[EnumMember]
KeyPairRequest,
}
}
|
||||
TheStack | e8fefd91e786b08e5ec906204831fee06c56149a | C#code:C# | {"size": 1608, "ext": "cs", "max_stars_repo_path": "Assets/Script/Game/World/Object/Pulsar.cs", "max_stars_repo_name": "DmitrySibert/nova", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Assets/Script/Game/World/Object/Pulsar.cs", "max_issues_repo_name": "DmitrySibert/nova", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Assets/Script/Game/World/Object/Pulsar.cs", "max_forks_repo_name": "DmitrySibert/nova", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 28.2105263158, "max_line_length": 97, "alphanum_fraction": 0.6498756219} | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Pulsar : MonoBehaviour {
[SerializeField]
private GameObject pulse;
[SerializeField]
private Renderer render;
private Transform trans;
private Dispatcher dispatcher;
private DiscreteHealthScore health;
void Start ()
{
trans = gameObject.GetComponent<Transform>();
dispatcher = gameObject.GetComponent<Dispatcher>();
health = gameObject.GetComponent<DiscreteHealthScore>();
FindObjectOfType<EventBus>().TriggerEvent(new Event("PulsarBirth"));
}
void Update ()
{
Event evt = dispatcher.ReceiveEvent();
if (evt.Name.Equals("PlayerTurn")) {
SpawnPulse();
health.DecreaseBy(1);
}
if (health.CurrentLife == 0) {
Death();
}
}
private void SpawnPulse()
{
GameObject pulseGo = Instantiate<GameObject>(pulse, trans.position, Quaternion.identity);
Bounds pulseBounds = pulseGo.GetComponent<Renderer>().bounds;
Vector3 oldSize = pulseBounds.size;
pulseBounds.Encapsulate(render.bounds);
Vector3 newSize = pulseBounds.size;
float scale = newSize.x / oldSize.x;
pulseGo.GetComponent<Transform>().localScale *= scale;
LimitedSizeExtend extend = pulseGo.gameObject.GetComponent<LimitedSizeExtend>();
extend.limit = render.bounds.size * 2;
}
private void Death()
{
FindObjectOfType<EventBus>().TriggerEvent(new Event("PulsarDeath"));
Destroy(gameObject);
}
}
|
||||
TheStack | e8ffc7cbb23801b0cff25a801a4ba43bd856fb42 | C#code:C# | {"size": 1357, "ext": "cs", "max_stars_repo_path": "vMerge/Model/Interfaces/IProfileProvider.cs", "max_stars_repo_name": "ChristopherGe/vmerge", "max_stars_repo_stars_event_min_datetime": "2021-04-06T13:57:19.000Z", "max_stars_repo_stars_event_max_datetime": "2021-04-28T21:41:07.000Z", "max_issues_repo_path": "vMerge/Model/Interfaces/IProfileProvider.cs", "max_issues_repo_name": "ChristopherGe/vmerge", "max_issues_repo_issues_event_min_datetime": "2022-03-08T07:19:16.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-09T11:28:25.000Z", "max_forks_repo_path": "vMerge/Model/Interfaces/IProfileProvider.cs", "max_forks_repo_name": "seyfiyumlu/vMerge2022", "max_forks_repo_forks_event_min_datetime": "2017-08-14T07:36:26.000Z", "max_forks_repo_forks_event_max_datetime": "2021-04-05T13:37:00.000Z"} | {"max_stars_count": 2.0, "max_issues_count": 1.0, "max_forks_count": 3.0, "avg_line_length": 33.925, "max_line_length": 97, "alphanum_fraction": 0.7229182019} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace alexbegh.vMerge.Model.Interfaces
{
public class DefaultProfileChangedEventArgs : EventArgs
{
public DefaultProfileChangedEventArgs(IProfileSettings settings)
{
Settings = settings;
}
public IProfileSettings Settings
{
get;
private set;
}
}
public interface IProfileProvider
{
IProfileSettings GetDefaultProfile(Uri teamProjectUri = null);
IEnumerable<IProfileSettings> GetAllProfilesForProject(Uri teamProjectUri = null);
IEnumerable<IProfileSettings> GetAllProfiles();
bool SaveProfileAs(Uri teamProjectUri, string profileName, bool overwrite);
bool DeleteProfile(Uri teamProjectUri, string profileName);
bool DeleteProfile(IProfileSettings profile);
bool LoadProfile(Uri teamProjectUri, string profileName);
bool GetActiveProfile(out IProfileSettings mostRecentSettings, out bool alreadyModified);
event EventHandler<DefaultProfileChangedEventArgs> DefaultProfileChanged;
event EventHandler ProfilesChanged;
event EventHandler ActiveProjectProfileListChanged;
void SetProfileDirty(IProfileSettings profileSettings);
}
}
|
||||
TheStack | 330065f60ce27016dcf7e3f7c7b25fcf65814947 | C#code:C# | {"size": 612, "ext": "cs", "max_stars_repo_path": "CefSharp.Owin.Example.Wpf/MainWindow.xaml.cs", "max_stars_repo_name": "amaitland/CefSharp.Owin", "max_stars_repo_stars_event_min_datetime": "2016-01-10T10:39:49.000Z", "max_stars_repo_stars_event_max_datetime": "2021-05-02T04:25:09.000Z", "max_issues_repo_path": "CefSharp.Owin.Example.Wpf/MainWindow.xaml.cs", "max_issues_repo_name": "amaitland/CefSharp.Owin", "max_issues_repo_issues_event_min_datetime": "2016-08-09T02:01:01.000Z", "max_issues_repo_issues_event_max_datetime": "2021-03-13T02:15:27.000Z", "max_forks_repo_path": "CefSharp.Owin.Example.Wpf/MainWindow.xaml.cs", "max_forks_repo_name": "amaitland/CefSharp.Owin", "max_forks_repo_forks_event_min_datetime": "2016-04-14T18:27:05.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T11:06:37.000Z"} | {"max_stars_count": 6.0, "max_issues_count": 7.0, "max_forks_count": 6.0, "avg_line_length": 23.5384615385, "max_line_length": 106, "alphanum_fraction": 0.5866013072} | using System.Windows;
namespace CefSharp.Owin.Example.Wpf
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
Browser.IsBrowserInitializedChanged += OnIsBrowserInitializedChanged;
}
private void OnIsBrowserInitializedChanged(object sender, DependencyPropertyChangedEventArgs args)
{
if((bool)args.NewValue == true)
{
//Browser.ShowDevTools();
}
}
}
}
|
||||
TheStack | 3302df997bb8780d6246d4752dea64549b5413e6 | C#code:C# | {"size": 375, "ext": "cs", "max_stars_repo_path": "src/Takenet.MessagingHub.Client/Extensions/Registrator.cs", "max_stars_repo_name": "andre-takenet/messaginghub-client-csharp", "max_stars_repo_stars_event_min_datetime": "2016-09-29T12:12:55.000Z", "max_stars_repo_stars_event_max_datetime": "2017-07-29T16:52:09.000Z", "max_issues_repo_path": "src/Takenet.MessagingHub.Client/Extensions/Registrator.cs", "max_issues_repo_name": "andre-takenet/messaginghub-client-csharp", "max_issues_repo_issues_event_min_datetime": "2016-04-13T18:01:27.000Z", "max_issues_repo_issues_event_max_datetime": "2017-09-05T20:06:35.000Z", "max_forks_repo_path": "src/Takenet.MessagingHub.Client/Extensions/Registrator.cs", "max_forks_repo_name": "andre-takenet/messaginghub-client-csharp", "max_forks_repo_forks_event_min_datetime": "2016-03-10T17:32:02.000Z", "max_forks_repo_forks_event_max_datetime": "2017-12-16T15:46:20.000Z"} | {"max_stars_count": 3.0, "max_issues_count": 7.0, "max_forks_count": 8.0, "avg_line_length": 25.0, "max_line_length": 59, "alphanum_fraction": 0.6933333333} | using Lime.Protocol.Serialization;
using Takenet.MessagingHub.Client.Extensions.Session;
namespace Takenet.MessagingHub.Client.Extensions
{
public static class Registrator
{
public static void RegisterDocuments()
{
TypeUtil.RegisterDocument<NavigationSession>();
TypeUtil.RegisterDocument<StateDocument>();
}
}
}
|
||||
TheStack | 330440cb72cd737659d6876ef9ef0e547c0c2cba | C#code:C# | {"size": 124, "ext": "cs", "max_stars_repo_path": "Sudoku.CSPSolver/CSPInference.cs", "max_stars_repo_name": "Chamalomg/MSMIN5IN31-20-Sudoku", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Sudoku.CSPSolver/CSPInference.cs", "max_issues_repo_name": "Chamalomg/MSMIN5IN31-20-Sudoku", "max_issues_repo_issues_event_min_datetime": "2020-10-21T23:16:17.000Z", "max_issues_repo_issues_event_max_datetime": "2020-10-21T23:16:17.000Z", "max_forks_repo_path": "Sudoku.CSPSolver/CSPInference.cs", "max_forks_repo_name": "PerrineBouey/MSMIN5IN31-20-Sudoku", "max_forks_repo_forks_event_min_datetime": "2020-10-09T13:41:10.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-10T09:52:11.000Z"} | {"max_stars_count": null, "max_issues_count": 1.0, "max_forks_count": 13.0, "avg_line_length": 13.7777777778, "max_line_length": 28, "alphanum_fraction": 0.5483870968} | namespace Sudoku.CSPSolver
{
public enum CSPInference
{
None,
ForwardChecking,
AC3,
}
} |
||||
TheStack | 3306e1c7f70cec46f3d140d10ae58ff38014a098 | C#code:C# | {"size": 471, "ext": "cs", "max_stars_repo_path": "Assets/Blue/Menu/Editor/MenuUpdater.cs", "max_stars_repo_name": "Bullrich/Unity-Menu", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Assets/Blue/Menu/Editor/MenuUpdater.cs", "max_issues_repo_name": "Bullrich/Unity-Menu", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Assets/Blue/Menu/Editor/MenuUpdater.cs", "max_forks_repo_name": "Bullrich/Unity-Menu", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 22.4285714286, "max_line_length": 65, "alphanum_fraction": 0.5966029724} | using Blue.Updater;
using UnityEditor;
// by @Bullrich
namespace Blue.Menu.Updater
{
public class MenuUpdater : PluginUpdater
{
private const string
USERNAME = "Bullrich",
REPONAME = "Unity-Menu",
CURRENT_VERSION = "0.4";
[MenuItem("Window/Blue/Menu/Search for updates")]
public static void SearchUpdate()
{
SearchForUpdate(CURRENT_VERSION, USERNAME, REPONAME);
}
}
} |
||||
TheStack | 330846e0027aafc786c0b675282d9acdb7357aa5 | C#code:C# | {"size": 710, "ext": "cs", "max_stars_repo_path": "AstGraphDbConnector/AstArangoDbConnector/MapperProfile.cs", "max_stars_repo_name": "arise-project/iso3", "max_stars_repo_stars_event_min_datetime": "2021-01-20T07:04:56.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-23T12:21:57.000Z", "max_issues_repo_path": "AstGraphDbConnector/AstArangoDbConnector/MapperProfile.cs", "max_issues_repo_name": "arise-project/iso3", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "AstGraphDbConnector/AstArangoDbConnector/MapperProfile.cs", "max_forks_repo_name": "arise-project/iso3", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": 5.0, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 28.4, "max_line_length": 74, "alphanum_fraction": 0.6690140845} | using AstArangoDbConnector.Syntax;
using AstDomain;
using AutoMapper;
namespace AstArangoDbConnector
{
public class MapperProfile : Profile
{
public MapperProfile()
{
CreateMap<ConcreteSyntax, ConcreteSyntaxEntity>();
CreateMap<ConcreteSyntaxEntity, ConcreteSyntax>();
CreateMap<CodeSyntax, CodeSyntaxEntity>();
CreateMap<CodeSyntaxEntity, CodeSyntax>();
CreateMap<BaseSyntax, BaseSyntaxEntity>();
CreateMap<BaseSyntaxEntity, BaseSyntax>();
CreateMap<BaseSyntaxCollection, BaseSyntaxCollectionEntity>();
CreateMap<BaseSyntaxCollectionEntity, BaseSyntaxCollection>();
}
}
}
|
||||
TheStack | 330a4f753d9dfae5d891e4a00c512052e1efe228 | C#code:C# | {"size": 1000, "ext": "cs", "max_stars_repo_path": "src/Bbt.Campaign.Api/Bbt.Campaign.Public/Models/Target/Detail/TargetDetailInsertRequest.cs", "max_stars_repo_name": "evrenarifoglu69/bbt.loyalty", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Bbt.Campaign.Api/Bbt.Campaign.Public/Models/Target/Detail/TargetDetailInsertRequest.cs", "max_issues_repo_name": "evrenarifoglu69/bbt.loyalty", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Bbt.Campaign.Api/Bbt.Campaign.Public/Models/Target/Detail/TargetDetailInsertRequest.cs", "max_forks_repo_name": "evrenarifoglu69/bbt.loyalty", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 38.4615384615, "max_line_length": 55, "alphanum_fraction": 0.659} | using Bbt.Campaign.Public.Dtos.Target.TriggerTime;
using Bbt.Campaign.Public.Dtos.Target.VerificationTime;
using Bbt.Campaign.Public.Dtos.Target.ViewType;
namespace Bbt.Campaign.Public.Models.Target.Detail
{
public class TargetDetailInsertRequest
{
public int TargetSourceId { get; set; }
public int TargetViewTypeId { get; set; }
public int TriggerTimeId { get; set; }
public int VerificationTimeId { get; set; }
public string FlowName { get; set; }
public string TargetDetailEn { get; set; }
public string TargetDetailTr { get; set; }
public string DescriptionEn { get; set; }
public string DescriptionTr { get; set; }
public decimal TotalAmount { get; set; }
public int NumberOfTransaction { get; set; }
public int FlowFrequency { get; set; }
public int AdditionalFlowTime { get; set; }
public string Query { get; set; }
public string Condition { get; set; }
}
}
|
||||
TheStack | 330c19a02e97d635a533fd02b0af711c8f4412d3 | C#code:C# | {"size": 6512, "ext": "cs", "max_stars_repo_path": "src/Refactorings/CSharp/Refactorings/PostfixUnaryExpressionRefactoring.cs", "max_stars_repo_name": "ProphetLamb-Organistion/Roslynator", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/Refactorings/CSharp/Refactorings/PostfixUnaryExpressionRefactoring.cs", "max_issues_repo_name": "ProphetLamb-Organistion/Roslynator", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Refactorings/CSharp/Refactorings/PostfixUnaryExpressionRefactoring.cs", "max_forks_repo_name": "ProphetLamb-Organistion/Roslynator", "max_forks_repo_forks_event_min_datetime": "2022-02-28T08:25:53.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-28T08:25:53.000Z"} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": 1.0, "avg_line_length": 44.602739726, "max_line_length": 156, "alphanum_fraction": 0.6752149877} | // Copyright (c) Josef Pihrt and Contributors. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
using static Roslynator.CSharp.CSharpFactory;
namespace Roslynator.CSharp.Refactorings
{
internal static class PostfixUnaryExpressionRefactoring
{
public static void ComputeRefactorings(RefactoringContext context, PostfixUnaryExpressionSyntax postfixUnaryExpression)
{
if (!context.Span.IsEmptyAndContainedInSpanOrBetweenSpans(postfixUnaryExpression.OperatorToken))
return;
switch (postfixUnaryExpression.Kind())
{
case SyntaxKind.PostIncrementExpression:
{
InvertPostIncrement(context, postfixUnaryExpression);
ReplacePostIncrementWithPreIncrement(context, postfixUnaryExpression);
break;
}
case SyntaxKind.PostDecrementExpression:
{
InvertPostDecrement(context, postfixUnaryExpression);
ReplacePostDecrementWithPreDecrement(context, postfixUnaryExpression);
break;
}
}
}
private static void ReplacePostIncrementWithPreIncrement(RefactoringContext context, PostfixUnaryExpressionSyntax postIncrement)
{
if (!context.IsRefactoringEnabled(RefactoringDescriptors.ReplacePrefixOperatorWithPostfixOperator))
return;
ExpressionSyntax operand = postIncrement.Operand;
if (operand == null)
return;
PrefixUnaryExpressionSyntax preIncrement = PreIncrementExpression(operand.WithoutTrivia())
.WithTriviaFrom(postIncrement)
.WithFormatterAnnotation();
context.RegisterRefactoring(
$"Replace '{postIncrement}' with '{preIncrement}'",
ct => ChangePostIncrementToPreIncrementAsync(context.Document, postIncrement, preIncrement, ct),
RefactoringDescriptors.ReplacePrefixOperatorWithPostfixOperator);
}
private static void InvertPostIncrement(RefactoringContext context, PostfixUnaryExpressionSyntax postIncrement)
{
if (!context.IsRefactoringEnabled(RefactoringDescriptors.InvertPrefixOrPostfixUnaryOperator))
return;
PostfixUnaryExpressionSyntax postDecrement = postIncrement
.WithOperatorToken(Token(SyntaxKind.MinusMinusToken))
.WithTriviaFrom(postIncrement)
.WithFormatterAnnotation();
context.RegisterRefactoring(
$"Invert {postIncrement.OperatorToken}",
ct => ChangePostIncrementToPostDecrementAsync(context.Document, postIncrement, postDecrement, ct),
RefactoringDescriptors.InvertPrefixOrPostfixUnaryOperator);
}
private static void ReplacePostDecrementWithPreDecrement(RefactoringContext context, PostfixUnaryExpressionSyntax postDecrement)
{
if (!context.IsRefactoringEnabled(RefactoringDescriptors.ReplacePrefixOperatorWithPostfixOperator))
return;
ExpressionSyntax operand = postDecrement.Operand;
if (operand == null)
return;
PrefixUnaryExpressionSyntax preDecrement = PreDecrementExpression(operand.WithoutTrivia())
.WithTriviaFrom(postDecrement)
.WithFormatterAnnotation();
context.RegisterRefactoring(
$"Replace '{postDecrement}' with '{preDecrement}'",
ct => ChangePostDecrementToPreDecrementAsync(context.Document, postDecrement, preDecrement, ct),
RefactoringDescriptors.ReplacePrefixOperatorWithPostfixOperator);
}
private static void InvertPostDecrement(RefactoringContext context, PostfixUnaryExpressionSyntax postDecrement)
{
if (!context.IsRefactoringEnabled(RefactoringDescriptors.InvertPrefixOrPostfixUnaryOperator))
return;
PostfixUnaryExpressionSyntax postIncrement = postDecrement
.WithOperatorToken(Token(SyntaxKind.PlusPlusToken))
.WithTriviaFrom(postDecrement)
.WithFormatterAnnotation();
context.RegisterRefactoring(
$"Invert {postDecrement.OperatorToken}",
ct => ChangePostDecrementToPostIncrementAsync(context.Document, postDecrement, postIncrement, ct),
RefactoringDescriptors.InvertPrefixOrPostfixUnaryOperator);
}
private static Task<Document> ChangePostIncrementToPreIncrementAsync(
Document document,
PostfixUnaryExpressionSyntax postIncrement,
PrefixUnaryExpressionSyntax preIncrement,
CancellationToken cancellationToken = default)
{
return document.ReplaceNodeAsync(postIncrement, preIncrement, cancellationToken);
}
private static Task<Document> ChangePostIncrementToPostDecrementAsync(
Document document,
PostfixUnaryExpressionSyntax postIncrement,
PostfixUnaryExpressionSyntax postDecrement,
CancellationToken cancellationToken = default)
{
return document.ReplaceNodeAsync(postIncrement, postDecrement, cancellationToken);
}
private static Task<Document> ChangePostDecrementToPreDecrementAsync(
Document document,
PostfixUnaryExpressionSyntax postDecrement,
PrefixUnaryExpressionSyntax preDecrement,
CancellationToken cancellationToken = default)
{
return document.ReplaceNodeAsync(postDecrement, preDecrement, cancellationToken);
}
private static Task<Document> ChangePostDecrementToPostIncrementAsync(
Document document,
PostfixUnaryExpressionSyntax postDecrement,
PostfixUnaryExpressionSyntax postIncrement,
CancellationToken cancellationToken = default)
{
return document.ReplaceNodeAsync(postDecrement, postIncrement, cancellationToken);
}
}
}
|
||||
TheStack | 330cecb9faf60badc4d35d3cafb018321447be82 | C#code:C# | {"size": 2298, "ext": "cs", "max_stars_repo_path": "Blish HUD/_Extensions/Texture2DExtension.cs", "max_stars_repo_name": "eksime/Blish-HUD", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Blish HUD/_Extensions/Texture2DExtension.cs", "max_issues_repo_name": "eksime/Blish-HUD", "max_issues_repo_issues_event_min_datetime": "2019-05-28T21:37:30.000Z", "max_issues_repo_issues_event_max_datetime": "2019-05-28T23:06:58.000Z", "max_forks_repo_path": "Blish HUD/_Extensions/Texture2DExtension.cs", "max_forks_repo_name": "eksime/Blish-HUD", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": 1.0, "max_forks_count": null, "avg_line_length": 40.3157894737, "max_line_length": 119, "alphanum_fraction": 0.6275021758} | using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace Blish_HUD {
public static class Texture2DExtension {
/// <remarks>https://stackoverflow.com/a/16141281/595437</remarks>
public static Texture2D GetRegion(this Texture2D texture2D, Rectangle region) {
using var ctx = GameService.Graphics.LendGraphicsDeviceContext();
var croppedTexture = new Texture2D(ctx.GraphicsDevice, region.Width, region.Height);
Color[] clrData = new Color[region.Width * region.Height];
texture2D.GetData(0, region, clrData, 0, region.Width * region.Height);
croppedTexture.SetData(clrData);
return croppedTexture;
}
public static Texture2D GetRegion(this Texture2D texture2D, int x, int y, int width, int height) {
return GetRegion(texture2D, new Rectangle(x, y, width, height));
}
public static Texture2D Duplicate(this Texture2D texture2D) {
return GetRegion(texture2D, texture2D.Bounds);
}
public static Texture2D SetRegion(this Texture2D texture2D, Rectangle region, Color color) {
if (texture2D == null)
throw new ArgumentNullException(nameof(texture2D));
if (region.X < 0)
throw new ArgumentOutOfRangeException(nameof(region.X));
if (region.Y < 0)
throw new ArgumentOutOfRangeException(nameof(region.Y));
if (region.Right > texture2D.Bounds.Right)
throw new ArgumentOutOfRangeException(nameof(region.Right));
if (region.Bottom > texture2D.Bounds.Bottom)
throw new ArgumentOutOfRangeException(nameof(region.Bottom));
Color[] colorData = new Color[region.Width * region.Height];
for (int i = 0; i < colorData.Length - 1; i++) {
colorData[i] = color;
}
texture2D.SetData(0, region, colorData, 0, colorData.Length);
return texture2D;
}
public static Texture2D SetRegion(this Texture2D texture2D, int x, int y, int width, int height, Color color) {
return SetRegion(texture2D, new Rectangle(x, y, width, height), color);
}
}
}
|
||||
TheStack | 330e9776274744e029473600619f8c5e7f3feabf | C#code:C# | {"size": 5599, "ext": "cs", "max_stars_repo_path": "src/Analyzers/CSharp/Analysis/AddParenthesesWhenNecessaryAnalyzer.cs", "max_stars_repo_name": "PrimoDev23/Roslynator", "max_stars_repo_stars_event_min_datetime": "2016-10-04T03:51:52.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T11:30:49.000Z", "max_issues_repo_path": "src/Analyzers/CSharp/Analysis/AddParenthesesWhenNecessaryAnalyzer.cs", "max_issues_repo_name": "PrimoDev23/Roslynator", "max_issues_repo_issues_event_min_datetime": "2016-10-31T05:59:49.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T23:50:33.000Z", "max_forks_repo_path": "src/Analyzers/CSharp/Analysis/AddParenthesesWhenNecessaryAnalyzer.cs", "max_forks_repo_name": "PrimoDev23/Roslynator", "max_forks_repo_forks_event_min_datetime": "2016-10-08T03:22:35.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-07T14:56:15.000Z"} | {"max_stars_count": 2374.0, "max_issues_count": 823.0, "max_forks_count": 225.0, "avg_line_length": 36.5947712418, "max_line_length": 160, "alphanum_fraction": 0.6110019646} | // Copyright (c) Josef Pihrt. All rights reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Diagnostics;
namespace Roslynator.CSharp.Analysis
{
[DiagnosticAnalyzer(LanguageNames.CSharp)]
public sealed class AddParenthesesWhenNecessaryAnalyzer : BaseDiagnosticAnalyzer
{
private static ImmutableArray<DiagnosticDescriptor> _supportedDiagnostics;
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics
{
get
{
if (_supportedDiagnostics.IsDefault)
Immutable.InterlockedInitialize(ref _supportedDiagnostics, DiagnosticRules.AddParenthesesWhenNecessary);
return _supportedDiagnostics;
}
}
public override void Initialize(AnalysisContext context)
{
base.Initialize(context);
context.RegisterSyntaxNodeAction(
f => AnalyzeBinaryExpression(f),
SyntaxKind.MultiplyExpression,
SyntaxKind.DivideExpression,
SyntaxKind.ModuloExpression,
SyntaxKind.AddExpression,
SyntaxKind.SubtractExpression,
SyntaxKind.LeftShiftExpression,
SyntaxKind.RightShiftExpression,
SyntaxKind.LessThanExpression,
SyntaxKind.GreaterThanExpression,
SyntaxKind.LessThanOrEqualExpression,
SyntaxKind.GreaterThanOrEqualExpression,
SyntaxKind.EqualsExpression,
SyntaxKind.NotEqualsExpression,
SyntaxKind.BitwiseAndExpression,
SyntaxKind.ExclusiveOrExpression,
SyntaxKind.BitwiseOrExpression,
SyntaxKind.LogicalAndExpression,
SyntaxKind.LogicalOrExpression);
}
private static void AnalyzeBinaryExpression(SyntaxNodeAnalysisContext context)
{
var binaryExpression = (BinaryExpressionSyntax)context.Node;
if (binaryExpression.ContainsDiagnostics)
return;
SyntaxKind binaryExpressionKind = binaryExpression.Kind();
ExpressionSyntax left = binaryExpression.Left;
if (left?.IsMissing == false)
Analyze(context, left, binaryExpressionKind);
ExpressionSyntax right = binaryExpression.Right;
if (right?.IsMissing == false)
Analyze(context, right, binaryExpressionKind);
}
private static void Analyze(SyntaxNodeAnalysisContext context, ExpressionSyntax expression, SyntaxKind binaryExpressionKind)
{
if (expression.ContainsUnbalancedIfElseDirectives())
return;
if (!IsFixable(expression, binaryExpressionKind))
return;
if (IsNestedDiagnostic(expression))
return;
DiagnosticHelpers.ReportDiagnostic(context, DiagnosticRules.AddParenthesesWhenNecessary, expression);
}
private static bool IsNestedDiagnostic(SyntaxNode node)
{
for (SyntaxNode current = node.Parent; current != null; current = current.Parent)
{
if (IsFixable(current))
return true;
}
return false;
}
internal static bool IsFixable(SyntaxNode node)
{
SyntaxNode parent = node.Parent;
return parent != null
&& IsFixable(node, parent.Kind());
}
private static bool IsFixable(SyntaxNode node, SyntaxKind binaryExpressionKind)
{
int groupNumber = GetGroupNumber(binaryExpressionKind);
return groupNumber != 0
&& groupNumber == GetGroupNumber(node)
&& CSharpFacts.GetOperatorPrecedence(node.Kind()) < CSharpFacts.GetOperatorPrecedence(binaryExpressionKind);
}
private static int GetGroupNumber(SyntaxNode node)
{
return GetGroupNumber(node.Kind());
}
private static int GetGroupNumber(SyntaxKind kind)
{
switch (kind)
{
case SyntaxKind.MultiplyExpression:
case SyntaxKind.DivideExpression:
case SyntaxKind.ModuloExpression:
case SyntaxKind.AddExpression:
case SyntaxKind.SubtractExpression:
return 1;
case SyntaxKind.LeftShiftExpression:
case SyntaxKind.RightShiftExpression:
return 2;
case SyntaxKind.LessThanExpression:
case SyntaxKind.GreaterThanExpression:
case SyntaxKind.LessThanOrEqualExpression:
case SyntaxKind.GreaterThanOrEqualExpression:
return 3;
case SyntaxKind.EqualsExpression:
case SyntaxKind.NotEqualsExpression:
return 4;
case SyntaxKind.BitwiseAndExpression:
case SyntaxKind.ExclusiveOrExpression:
case SyntaxKind.BitwiseOrExpression:
case SyntaxKind.LogicalAndExpression:
case SyntaxKind.LogicalOrExpression:
return 5;
default:
return 0;
}
}
}
}
|
||||
TheStack | 330ec20aadfb3cf23c8d555c8dac44bbc6dc75cd | C#code:C# | {"size": 405, "ext": "cshtml", "max_stars_repo_path": "BXSim/Views/Shared/bx104_sc002.cshtml", "max_stars_repo_name": "moauris/MomiTestAsp", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "BXSim/Views/Shared/bx104_sc002.cshtml", "max_issues_repo_name": "moauris/MomiTestAsp", "max_issues_repo_issues_event_min_datetime": "2021-06-16T16:30:47.000Z", "max_issues_repo_issues_event_max_datetime": "2021-06-29T03:48:26.000Z", "max_forks_repo_path": "BXSim/Views/Shared/bx104_sc002.cshtml", "max_forks_repo_name": "moauris/MomiTestAsp", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": 3.0, "max_forks_count": null, "avg_line_length": 101.25, "max_line_length": 143, "alphanum_fraction": 0.7777777778} | <p>You have an Azure subscription named Subscription1 that contains a resource group named RG1.</p>
<p>In RG1, you create an internal load balancer named LB1 and a public load balancer named LB2.</p>
<p>You need to ensure that an administrator named Admin1 can manage LB1 and LB2. The solution must follow the principle of least privilege.</p>
<p>Which role should you assign to Admin1 for each task?</p> |
||||
TheStack | 330f257b400a9689e4fc4d9f7955f8c64d13d8c1 | C#code:C# | {"size": 9244, "ext": "cs", "max_stars_repo_path": "Assets/Scripts/Pathfinder.cs", "max_stars_repo_name": "hbgl/snapped-alliance", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Assets/Scripts/Pathfinder.cs", "max_issues_repo_name": "hbgl/snapped-alliance", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Assets/Scripts/Pathfinder.cs", "max_forks_repo_name": "hbgl/snapped-alliance", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 31.3355932203, "max_line_length": 119, "alphanum_fraction": 0.448615318} | using UnityEngine;
using System.Collections;
using Assets.Scripts.Pipeline;
using System.Collections.Generic;
using System.Linq;
using Priority_Queue;
using System;
using Unity.Mathematics;
using UnityEngine.Events;
namespace Assets.Scripts
{
public class Pathfinder : MonoBehaviour, ILifecycleObject
{
public GameObject DebugSpherePrefab;
public bool DebugPath = true;
public NavNode[,] Grid;
public Tile[,] Tiles;
public Tile[,][] Neighbors;
public GameObject Player;
private List<int2> Path;
private List<Vector3> Points;
private FastPriorityQueue<Tile> OpenSet;
private Dictionary<Tile, bool> Touched;
public NavNode PathStart;
private List<GameObject> DebugPathObjects;
public void OnSceneLoaded()
{
}
public void OnEnable()
{
var navNodes = new List<NavNode>();
var gameObjects = this.gameObject.scene.GetRootGameObjects();
foreach (var gameObject in gameObjects)
{
var navNode = gameObject.GetComponent<NavNode>();
if (navNode != null)
{
navNodes.Add(navNode);
}
}
var width = navNodes.Max(n => n.X) + 1;
var height = navNodes.Max(n => n.Y) + 1;
var grid = new NavNode[height, width];
var tiles = new Tile[height, width];
var neighbors = new Tile[height, width][];
foreach (var navNode in navNodes)
{
var y = navNode.Y;
var x = navNode.X;
ref var cell = ref grid[y, x];
if (cell != null)
{
Debug.Log($"Cell ({x},{y}) is already occupied.]");
}
else
{
cell = navNode;
tiles[y, x] = new Tile(x, y);
}
}
foreach (var navNode in navNodes)
{
var neighborGameObjects = navNode.Neighbors;
var neighborLength = neighborGameObjects.Length;
ref var neighborTiles = ref neighbors[navNode.Y, navNode.X];
neighborTiles = new Tile[neighborLength];
for (var i = 0; i < neighborLength; i++)
{
var neighborNavNode = neighborGameObjects[i].GetComponent<NavNode>();
neighborTiles[i] = tiles[neighborNavNode.Y, neighborNavNode.X];
}
}
Grid = grid;
Tiles = tiles;
Neighbors = neighbors;
OpenSet = new FastPriorityQueue<Tile>(width * height);
Path = new List<int2>(width * height);
Points = new List<Vector3>(width * height);
Touched = new Dictionary<Tile, bool>(width * height);
foreach (var navNode in navNodes)
{
navNode.Activated.AddListener(this.NavNodeActivated);
}
}
private void NavNodeActivated(NavNode navNode)
{
if (this.PathStart == null)
{
this.PathStart = navNode;
}
else
{
var start = this.PathStart;
this.PathStart = null;
var end = navNode;
var startCoords = new int2(start.X, start.Y);
var endCoords = new int2(end.X, end.Y);
var result = this.FindPath(startCoords, endCoords);
if (result.IsNone)
{
Debug.Log("No path found.");
}
else
{
Debug.Log($"Found path consisting of {result.Points.Count} points with a cost of {result.Cost}.");
}
}
}
private Tile NavNodeToTile(NavNode navNode)
{
return this.Tiles[navNode.Y, navNode.X];
}
private NavNode TileToNavNode(Tile tile)
{
return this.Grid[tile.Y, tile.X];
}
private float Heuristic(Tile current, Tile goal)
{
return Mathf.Abs(current.X - goal.X) + Mathf.Abs(current.Y - goal.Y);
}
private float Weight(Tile current, Tile neighbor)
{
var isDiagonal = current.X != neighbor.X && current.Y != neighbor.Y;
if (isDiagonal)
{
// Diagonal move costs more
return 1.5f;
}
// Horizontal or vertical
return 1f;
}
public PathResult FindPath(int2 startCoords, int2 goalCoords)
{
var touched = this.Touched;
var openSet = OpenSet;
var tiles = this.Tiles;
var start = tiles[startCoords.y, startCoords.x];
var goal = tiles[goalCoords.y, goalCoords.x];
var path = this.Path;
// Clean up previous state.
foreach (var kv in touched)
{
kv.Key.Reset();
}
touched.Clear();
// Clean up previous priority queue.
openSet.Clear();
// Clear previous path.
path.Clear();
#region Debug
var h = this.Tiles.GetLength(0);
var w = this.Tiles.GetLength(1);
for (var i = 0; i < h; i++)
{
for (var j = 0; j < w; j++)
{
var tile = tiles[i, j];
if (!tile.IsReset())
{
Debug.Log($"Tile ({j},{i}) is not reset.");
tile.Reset();
}
}
}
#endregion
start.G = 0;
start.F = Heuristic(start, goal);
OpenSet.Enqueue(start, 0);
touched[start] = true;
Tile current;
while (openSet.Count > 0)
{
current = openSet.Dequeue();
if (current == goal)
{
goto Reconstruct;
}
var neighbors = Neighbors[current.Y, current.X];
var currentG = current.G;
foreach (var neighbor in neighbors)
{
var maybeG = currentG + Weight(current, neighbor);
if (maybeG < neighbor.G)
{
neighbor.G = maybeG;
neighbor.F = maybeG + Heuristic(neighbor, goal);
neighbor.Previous = current;
if (!openSet.Contains(neighbor))
{
touched[neighbor] = true;
openSet.Enqueue(neighbor, neighbor.F);
}
}
}
}
// There is no path from start to goal.
return PathResult.None;
Reconstruct:
var totalCost = 0.0f;
while (current.Previous != null && current != start)
{
totalCost += current.G;
path.Add(new int2(current.X, current.Y));
current = current.Previous;
}
path.Add(new int2(start.X, start.Y));
path.Reverse();
if (this.DebugPath)
{
this.ShwoDebugPath(path);
}
var points = Points;
points.Clear();
foreach (var coords in path)
{
var navNode = this.Grid[coords.y, coords.x];
var point = navNode.GetComponent<Renderer>().bounds.center;
point.y = 0;
points.Add(point);
}
StartCoroutine(PathMover.Move(this.Player, points, () => { }));
return new PathResult { Points = path, Cost = totalCost };
}
public void OnSceneUnloaded()
{
}
private void ShwoDebugPath(List<int2> path)
{
if (this.DebugPathObjects != null)
{
foreach (var gameObject in this.DebugPathObjects)
{
GameObject.Destroy(gameObject);
}
this.DebugPathObjects = null;
}
this.DebugPathObjects = new List<GameObject>(path.Count);
foreach (var coords in path)
{
var navNode = Grid[coords.y, coords.x];
var pos = navNode.GetComponent<Renderer>().bounds.center;
pos.y = 0;
var gameObject = Instantiate(this.DebugSpherePrefab, pos, Quaternion.identity);
this.DebugPathObjects.Add(gameObject);
}
}
}
} |
||||
TheStack | 3310790d52e1c390fabb1f84439b2d10a1189fba | C#code:C# | {"size": 613, "ext": "cs", "max_stars_repo_path": "TabbedTemplate/Converters/DateToDayConverter.cs", "max_stars_repo_name": "sophia-whale/TimeofLove", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "TabbedTemplate/Converters/DateToDayConverter.cs", "max_issues_repo_name": "sophia-whale/TimeofLove", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "TabbedTemplate/Converters/DateToDayConverter.cs", "max_forks_repo_name": "sophia-whale/TimeofLove", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 26.652173913, "max_line_length": 103, "alphanum_fraction": 0.6492659054} | using System;
using System.Globalization;
using TabbedTemplate.Utils;
using Xamarin.Forms;
namespace TabbedTemplate.Converters
{
public class DateToDayConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
string date = value.ToString();
string day = date.Substring(3, 2) + "日";
return day;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new DoNotCallThisException();
}
}
}
|
||||
TheStack | 331171c56c38136262d877e191b82a7214a24346 | C#code:C# | {"size": 3221, "ext": "cs", "max_stars_repo_path": "EltraCommon/ObjectDictionary/Epos4/DeviceDescription/Profiles/Device/DataRecorder/RecorderTemplateList.cs", "max_stars_repo_name": "eltra-ch/eltra-common", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "EltraCommon/ObjectDictionary/Epos4/DeviceDescription/Profiles/Device/DataRecorder/RecorderTemplateList.cs", "max_issues_repo_name": "eltra-ch/eltra-common", "max_issues_repo_issues_event_min_datetime": "2020-09-10T05:34:15.000Z", "max_issues_repo_issues_event_max_datetime": "2021-11-06T13:09:35.000Z", "max_forks_repo_path": "EltraCommon/ObjectDictionary/Epos4/DeviceDescription/Profiles/Device/DataRecorder/RecorderTemplateList.cs", "max_forks_repo_name": "eltra-ch/eltra-common", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": 11.0, "max_forks_count": null, "avg_line_length": 29.5504587156, "max_line_length": 97, "alphanum_fraction": 0.5805650419} | using System;
using System.Collections.Generic;
using System.Xml;
using EltraCommon.ObjectDictionary.Common.DeviceDescription.Profiles.Application.Parameters;
using EltraCommon.ObjectDictionary.Xdd.DeviceDescription.Profiles.Application.Parameters;
using EltraCommon.ObjectDictionary.Epos4.DeviceDescription.Profiles.Device.DataRecorder.Channels;
#pragma warning disable 1591
namespace EltraCommon.ObjectDictionary.Epos4.DeviceDescription.Profiles.Device.DataRecorder
{
public class RecorderTemplateList
{
public ChannelSelection ChannelSelection { get; set; }
public TriggerCondition TriggerCondition { get; set; }
public bool Parse(XmlNode node)
{
bool result = true;
foreach (XmlNode childNode in node.ChildNodes)
{
if (childNode.Name == "channelSelection")
{
var channelSelection = new ChannelSelection();
if (!channelSelection.Parse(childNode))
{
result = false;
break;
}
ChannelSelection = channelSelection;
}
else if (childNode.Name == "triggerCondition")
{
var triggerCondition = new TriggerCondition();
if (!triggerCondition.Parse(childNode))
{
result = false;
break;
}
TriggerCondition = triggerCondition;
}
}
return result;
}
public void Resolve(List<Channel> channelsChannels, XddParameterList parameterList)
{
ChannelSelection.Resolve(channelsChannels);
TriggerCondition.Resolve(parameterList);
}
public Parameter GetRecorderChannelParameter(byte channelNumber)
{
Parameter result = null;
if (ChannelSelection != null)
{
result = ChannelSelection.GetRecorderChannelParameter(channelNumber);
}
return result;
}
public byte GetRecorderChannelCount()
{
byte result = 0;
if (ChannelSelection != null)
{
result = ChannelSelection.GetRecorderChannelCount();
}
return result;
}
public Parameter GetRecorderTriggerVariableParameter()
{
return TriggerCondition?.TriggerConditionParam?.Parameter;
}
public Parameter GetRecorderTriggerModeParameter()
{
return TriggerCondition?.TriggerConditionMode?.Parameter;
}
public Parameter GetRecorderTriggerHighValueParameter()
{
return TriggerCondition?.TriggerConditionHigh?.Parameter;
}
public Parameter GetRecorderTriggerLowValueParameter()
{
return TriggerCondition?.TriggerConditionLow?.Parameter;
}
public Parameter GetRecorderTriggerMaskParameter()
{
return TriggerCondition?.TriggerConditionMask?.Parameter;
}
}
}
|
||||
TheStack | 33178d152695177ead360a6b68d7c8a081963474 | C#code:C# | {"size": 747, "ext": "cs", "max_stars_repo_path": "UniversalDownloaderPlatform.Common/Interfaces/IPageCrawler.cs", "max_stars_repo_name": "JDR-Ninja/UniversalDownloaderPlatform", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "UniversalDownloaderPlatform.Common/Interfaces/IPageCrawler.cs", "max_issues_repo_name": "JDR-Ninja/UniversalDownloaderPlatform", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "UniversalDownloaderPlatform.Common/Interfaces/IPageCrawler.cs", "max_forks_repo_name": "JDR-Ninja/UniversalDownloaderPlatform", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 39.3157894737, "max_line_length": 145, "alphanum_fraction": 0.8152610442} | using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using UniversalDownloaderPlatform.Common.Enums;
using UniversalDownloaderPlatform.Common.Events;
using UniversalDownloaderPlatform.Common.Interfaces.Models;
namespace UniversalDownloaderPlatform.Common.Interfaces
{
public interface IPageCrawler
{
event EventHandler<PostCrawlEventArgs> PostCrawlStart;
event EventHandler<PostCrawlEventArgs> PostCrawlEnd;
event EventHandler<NewCrawledUrlEventArgs> NewCrawledUrl;
event EventHandler<CrawlerMessageEventArgs> CrawlerMessage;
Task<List<ICrawledUrl>> Crawl(ICrawlTargetInfo crawlTargetInfo, IUniversalDownloaderPlatformSettings settings, string downloadDirectory);
}
}
|
||||
TheStack | 331905197dc3c78ba683ca6884813cdb071c3b6d | C#code:C# | {"size": 267, "ext": "cs", "max_stars_repo_path": "tests/TStack.RedisExchange.Tests/ProjectProvider.cs", "max_stars_repo_name": "ferhatcandas/TStack.RedisExchange", "max_stars_repo_stars_event_min_datetime": "2019-06-26T08:03:44.000Z", "max_stars_repo_stars_event_max_datetime": "2019-06-26T08:03:44.000Z", "max_issues_repo_path": "tests/TStack.RedisExchange.Tests/ProjectProvider.cs", "max_issues_repo_name": "ferhatcandas/TStack.RedisExchange", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "tests/TStack.RedisExchange.Tests/ProjectProvider.cs", "max_forks_repo_name": "ferhatcandas/TStack.RedisExchange", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": 1.0, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 20.5384615385, "max_line_length": 62, "alphanum_fraction": 0.7865168539} | using System;
using System.Collections.Generic;
using System.Text;
using TStack.RedisExchange.Provider;
using TStack.RedisExchange.Tests.Connection;
namespace TStack.RedisExchange.Tests
{
public class ProjectProvider : RedisProvider<RedisContext>
{
}
}
|
||||
TheStack | 33191c6cab09a8881c9ec805089b290d771560f7 | C#code:C# | {"size": 2784, "ext": "cshtml", "max_stars_repo_path": "src/module/Areas/Manager/Pages/TemplateModule.cshtml", "max_stars_repo_name": "i-love-code/piranha.core.templates", "max_stars_repo_stars_event_min_datetime": "2019-05-18T14:13:40.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-29T19:09:25.000Z", "max_issues_repo_path": "src/module/Areas/Manager/Pages/TemplateModule.cshtml", "max_issues_repo_name": "i-love-code/piranha.core.templates", "max_issues_repo_issues_event_min_datetime": "2019-03-05T23:01:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-02T19:53:03.000Z", "max_forks_repo_path": "src/module/Areas/Manager/Pages/TemplateModule.cshtml", "max_forks_repo_name": "i-love-code/piranha.core.templates", "max_forks_repo_forks_event_min_datetime": "2019-03-03T01:28:43.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-03T06:29:49.000Z"} | {"max_stars_count": 19.0, "max_issues_count": 37.0, "max_forks_count": 20.0, "avg_line_length": 36.6315789474, "max_line_length": 104, "alphanum_fraction": 0.4403735632} | @page "~/manager/templatemodule"
@{
ViewBag.Title = "TemplateModule";
ViewBag.MenuItem = "TemplateModule";
}
<div id="TemplateModule">
<div class="top">
<nav aria-label="breadcrumb">
<ol class="breadcrumb mb-0">
<li class="breadcrumb-item">Content</li>
<li class="breadcrumb-item active" aria-current="page">TemplateModule</li>
</ol>
</nav>
<div class="container-fluid">
<div class="top-nav">
<button class="btn btn-icon btn-info">
<i class="fas fa-cog"></i>
</button>
<button class="btn btn-labeled btn-primary">
<i class="fas fa-plus"></i>Secondary action
</button>
<button class="btn btn-labeled btn-success">
<i class="fas fa-check"></i>Main action
</button>
</div>
</div>
</div>
<div class="container-fluid">
<table class="table table-borderless">
<thead>
<tr>
<th>Standard Column</th>
<th class="td-medium">Medium Column</th>
<th class="td-small">Date</th>
<th class="actions one"></th>
</tr>
</thead>
<tbody>
<tr>
<td>Bibendum Ornare Venenatis</td>
<td>Fringilla Vehicula</td>
<td>@DateTime.Now.ToString("yyyy-MM-dd")</td>
<td class="actions"><a href="#" class="danger"><i class="fas fa-trash"></i></a></td>
</tr>
<tr>
<td>Tellus Etiam Ligula</td>
<td>Condimentum Tristique</td>
<td>@DateTime.Now.ToString("yyyy-MM-dd")</td>
<td class="actions"><a href="#" class="danger"><i class="fas fa-trash"></i></a></td>
</tr>
<tr>
<td>Quam Consectetur Malesuada</td>
<td>Dapibus Vehicula</td>
<td>@DateTime.Now.ToString("yyyy-MM-dd")</td>
<td class="actions"><a href="#" class="danger"><i class="fas fa-trash"></i></a></td>
</tr>
</tbody>
</table>
<div class="card">
<div class="card-header">
<span class="title">Form Test</span>
</div>
<div class="card-body">
<div class="form-group">
<label>Standard input</label>
<input type="text" class="form-control" placeholder="Standard text input">
</div>
</div>
</div>
</div>
</div>
|
||||
TheStack | 331938f1a04d33e1ae74c5c09d4e6b50218ca44f | C#code:C# | {"size": 382, "ext": "cs", "max_stars_repo_path": "src/Testinator.EntityFrameworkCore.SqlServer.Test/Domain/Models/Store.cs", "max_stars_repo_name": "graemechristie/testinator", "max_stars_repo_stars_event_min_datetime": "2019-04-07T04:11:19.000Z", "max_stars_repo_stars_event_max_datetime": "2019-04-07T04:11:19.000Z", "max_issues_repo_path": "src/Testinator.EntityFrameworkCore.SqlServer.Test/Domain/Models/Store.cs", "max_issues_repo_name": "graemechristie/testinator", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/Testinator.EntityFrameworkCore.SqlServer.Test/Domain/Models/Store.cs", "max_forks_repo_name": "graemechristie/testinator", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": 1.0, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.875, "max_line_length": 70, "alphanum_fraction": 0.6387434555} | using System;
using System.Collections.Generic;
using System.Text;
namespace Testinator.EntityFrameworkCore.SqlServer.Test.Domain.Models
{
public class Store
{
public int Id { get; set; }
public string Name { get; set; }
public string Address { get; set; }
public ICollection<StoreWidget> StoreWidgets { get; set; }
}
}
|
||||
TheStack | 3319cd2fe4c4a438376e1b9df99626f83130d300 | C#code:C# | {"size": 19360, "ext": "cs", "max_stars_repo_path": "Game1/Game1/Input.cs", "max_stars_repo_name": "MrGrak/CompressedController", "max_stars_repo_stars_event_min_datetime": "2021-11-27T14:36:23.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-20T09:46:10.000Z", "max_issues_repo_path": "Game1/Game1/Input.cs", "max_issues_repo_name": "MrGrak/CompressedController", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Game1/Game1/Input.cs", "max_forks_repo_name": "MrGrak/CompressedController", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": 8.0, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 40.6722689076, "max_line_length": 136, "alphanum_fraction": 0.5379132231} | using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Game1
{
public static class Input
{
public static Game G;
public static GraphicsDeviceManager GDM;
public static SpriteBatch SB;
//4 recs for direction pad, 4 recs for abxy, 1 for start
public static byte Size = 9;
public static Texture2D Texture;
public static List<Rectangle> Rectangles;
//structs to store this frame and prev frames input
public static GameInputStruct thisFrame;
public static GameInputStruct prevFrame;
public static GamePadState ControllerState;
//the amount of joystick movement classified as noise
public static float deadzone = 0.20f;
//stores gamepad state in a byte
public static byte CompressedState;
//allocate a buffer of game input structs to write to - 60 fps x N seconds
public static short InputRecBufferSize = 60 * 10;
public static byte[] InputRecordingBuffer = new byte[InputRecBufferSize];
public static short InputRecordingCounter = 0;
//controls if class is recording or playing back input
public static bool Recording = true;
public static void Constructor(GraphicsDeviceManager gdm, SpriteBatch sb, Game g)
{
//store references to what this class needs to function
G = g; GDM = gdm; SB = sb;
//create a tiny texture to draw with + tint
Texture = new Texture2D(GDM.GraphicsDevice, 1, 1);
Texture.SetData<Color>(new Color[] { Color.White });
CompressedState = 0; //reset controller state
//place rectangles in controller positions
Point Pos = new Point(75, 50); //controls overall ui position
byte scale = 25;
int Off = scale * 7; //padding between dir buttons and abxy buttons
Rectangles = new List<Rectangle>();
for (int i = 0; i < Size; i++)
{
switch (i)
{
case 0: { Rectangles.Add(new Rectangle(Pos.X + 0, Pos.Y + 0, scale, scale)); break; } //direction pad up
case 1: { Rectangles.Add(new Rectangle(Pos.X + scale, Pos.Y + scale, scale, scale)); break; } //right
case 2: { Rectangles.Add(new Rectangle(Pos.X + 0, Pos.Y + scale * 2, scale, scale)); break; } //down
case 3: { Rectangles.Add(new Rectangle(Pos.X - scale, Pos.Y + scale, scale, scale)); break; } //left
case 4: { Rectangles.Add(new Rectangle(Pos.X + Off + 0, Pos.Y + 0, scale, scale)); break; } //A
case 5: { Rectangles.Add(new Rectangle(Pos.X + Off + scale, Pos.Y + scale, scale, scale)); break; } //B
case 6: { Rectangles.Add(new Rectangle(Pos.X + Off + 0, Pos.Y + scale * 2, scale, scale)); break; } //X
case 7: { Rectangles.Add(new Rectangle(Pos.X + Off - scale, Pos.Y + scale, scale, scale)); break; } //Y
case 8: { Rectangles.Add(new Rectangle(Pos.X + scale * 3, Pos.Y + scale, scale * 2, scale)); break; } //start button
default: { break; }
}
}
}
public static void Update()
{
if(Recording)
{
//map controller to input struct, store in input buffer
//store this frames input in prev frame
prevFrame = thisFrame;
//clear this frame's input
thisFrame = new GameInputStruct();
//assume player one, this is brittle
ControllerState = GamePad.GetState(PlayerIndex.One);
//map controller state to struct - useful when mapping diff inputs (like keys)
MapController(ref ControllerState, ref thisFrame);
//convert input struct to byte, store in buffer
InputRecordingBuffer[InputRecordingCounter] = ConvertToByte(thisFrame);
//update compressed state that we draw later
CompressedState = InputRecordingBuffer[InputRecordingCounter];
//using a counter, track where input is stored in buffer
InputRecordingCounter++;
//treat this data stream as a ring, loop back to start
if (InputRecordingCounter >= InputRecBufferSize)
{
InputRecordingCounter = 0;
Recording = false; //begin playback of buffer
}
}
else
{
//play back input from input buffer
//store this frames input in prev frame
prevFrame = thisFrame;
//update this frame's input
thisFrame = ConvertToInputStruct(InputRecordingBuffer[InputRecordingCounter]);
//update compressed state that we draw later
CompressedState = InputRecordingBuffer[InputRecordingCounter];
//using a counter, track where input is stored in buffer
InputRecordingCounter++;
//treat this data stream as a ring, loop back to start
if (InputRecordingCounter >= InputRecBufferSize)
{
InputRecordingCounter = 0;
Recording = true; //begin recording into buffer
}
}
}
public static void Draw()
{
SB.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp);
//draw all buttons with black background
for (int i = 0; i < Size; i++)
{
if (Recording) //visually show player we are recording
{ DrawRectangle(Rectangles[i], Color.DarkRed); }
else { DrawRectangle(Rectangles[i], Color.DarkGreen); }
}
//draw direction buttons being used in white (up/down)
if (thisFrame.Direction == Direction.Up
|| thisFrame.Direction == Direction.UpLeft
|| thisFrame.Direction == Direction.UpRight)
{ DrawRectangle(Rectangles[0], Color.White); }
else if (thisFrame.Direction == Direction.Down
|| thisFrame.Direction == Direction.DownLeft
|| thisFrame.Direction == Direction.DownRight)
{ DrawRectangle(Rectangles[2], Color.White); }
//draw buttons being used in white (left/right)
if (thisFrame.Direction == Direction.Right
|| thisFrame.Direction == Direction.UpRight
|| thisFrame.Direction == Direction.DownRight)
{ DrawRectangle(Rectangles[1], Color.White); }
else if (thisFrame.Direction == Direction.Left
|| thisFrame.Direction == Direction.DownLeft
|| thisFrame.Direction == Direction.UpLeft)
{ DrawRectangle(Rectangles[3], Color.White); }
//draw buttons pressed down in white (abxy + start)
if (thisFrame.A) { DrawRectangle(Rectangles[6], Color.White); }
if (thisFrame.B) { DrawRectangle(Rectangles[5], Color.White); }
if (thisFrame.X) { DrawRectangle(Rectangles[7], Color.White); }
if (thisFrame.Y) { DrawRectangle(Rectangles[4], Color.White); }
if (thisFrame.Start) { DrawRectangle(Rectangles[8], Color.White); }
SB.End();
}
public static void DrawRectangle(Rectangle Rec, Color color)
{
Vector2 pos = new Vector2(Rec.X, Rec.Y);
SB.Draw(Texture, pos, Rec,
color * 1.0f,
0, Vector2.Zero, 1.0f,
SpriteEffects.None, 0.00001f);
}
//methods to map gamepad state to game input struct (add more, like for keyboard, etc)
public static void MapController(ref GamePadState GPS, ref GameInputStruct GIS)
{
#region Map gamepad left joystick
if (GPS.ThumbSticks.Left.X > deadzone &
GPS.ThumbSticks.Left.Y > deadzone)
{
GIS.Direction = Direction.UpRight;
}
else if (GPS.ThumbSticks.Left.X < -deadzone &
GPS.ThumbSticks.Left.Y > deadzone)
{
GIS.Direction = Direction.UpLeft;
}
else if (GPS.ThumbSticks.Left.X > deadzone &
GPS.ThumbSticks.Left.Y < -deadzone)
{
GIS.Direction = Direction.DownRight;
}
else if (GPS.ThumbSticks.Left.X < -deadzone &
GPS.ThumbSticks.Left.Y < -deadzone)
{
GIS.Direction = Direction.DownLeft;
}
else if (GPS.ThumbSticks.Left.X > deadzone)
{
GIS.Direction = Direction.Right;
}
else if (GPS.ThumbSticks.Left.X < -deadzone)
{
GIS.Direction = Direction.Left;
}
else if (GPS.ThumbSticks.Left.Y > deadzone)
{
GIS.Direction = Direction.Up;
}
else if (GPS.ThumbSticks.Left.Y < -deadzone)
{
GIS.Direction = Direction.Down;
}
#endregion
#region Map gamepad Dpad
if (GPS.IsButtonDown(Buttons.DPadRight) &
GPS.IsButtonDown(Buttons.DPadUp))
{ GIS.Direction = Direction.UpRight; }
else if (GPS.IsButtonDown(Buttons.DPadLeft) &
GPS.IsButtonDown(Buttons.DPadUp))
{ GIS.Direction = Direction.UpLeft;}
else if (GPS.IsButtonDown(Buttons.DPadLeft) &
GPS.IsButtonDown(Buttons.DPadDown))
{ GIS.Direction = Direction.DownLeft; }
else if (GPS.IsButtonDown(Buttons.DPadRight) &
GPS.IsButtonDown(Buttons.DPadDown))
{ GIS.Direction = Direction.DownRight; }
else if (GPS.IsButtonDown(Buttons.DPadRight))
{ GIS.Direction = Direction.Right; }
else if (GPS.IsButtonDown(Buttons.DPadLeft))
{ GIS.Direction = Direction.Left; }
else if (GPS.IsButtonDown(Buttons.DPadUp))
{ GIS.Direction = Direction.Up; }
else if (GPS.IsButtonDown(Buttons.DPadDown))
{ GIS.Direction = Direction.Down; }
#endregion
#region Map Start Button
//map singular start button
if (GPS.IsButtonDown(Buttons.Start))
{
GIS.Start = true;
}
#endregion
#region Map Default Button Inputs
if (GPS.IsButtonDown(Buttons.A))
{
GIS.A = true;
}
if (GPS.IsButtonDown(Buttons.X))
{
GIS.X = true;
}
if (GPS.IsButtonDown(Buttons.B))
{
GIS.B = true;
}
if (GPS.IsButtonDown(Buttons.Y))
{
GIS.Y = true;
}
#endregion
#region Map Additional Button Inputs
if (GPS.IsButtonDown(Buttons.LeftTrigger))
{
GIS.X = true;
}
if (GPS.IsButtonDown(Buttons.RightTrigger))
{
GIS.Y = true;
}
#endregion
}
//methods to convert input struct to byte value
static byte DirectionOffset = 17;
public static byte ConvertToByte(GameInputStruct Input)
{
byte value = 0;
switch (Input.Direction)
{ //based on direction + button combination, calculate a byte value
//based on 9 directions, plus 17 button combinations = 153 total states
case Direction.None: { value = (byte)(0 + GetButtonDownValue(Input)); break; }
case Direction.Up: { value = (byte)(DirectionOffset * 1 + GetButtonDownValue(Input)); break; }
case Direction.UpRight: { value = (byte)(DirectionOffset * 2 + GetButtonDownValue(Input)); break; }
case Direction.Right: { value = (byte)(DirectionOffset * 3 + GetButtonDownValue(Input)); break; }
case Direction.DownRight: { value = (byte)(DirectionOffset * 4 + GetButtonDownValue(Input)); break; }
case Direction.Down: { value = (byte)(DirectionOffset * 5 + GetButtonDownValue(Input)); break; }
case Direction.DownLeft: { value = (byte)(DirectionOffset * 6 + GetButtonDownValue(Input)); break; }
case Direction.Left: { value = (byte)(DirectionOffset * 7 + GetButtonDownValue(Input)); break; }
case Direction.UpLeft: { value = (byte)(DirectionOffset * 8 + GetButtonDownValue(Input)); break; }
default: { break; }
}
return value;
}
public static byte GetButtonDownValue(GameInputStruct Input)
{
//check for single button presses
if (!Input.A && !Input.B && !Input.X && !Input.Y && !Input.Start) { return 0; }
else if (Input.A && !Input.B && !Input.X && !Input.Y && !Input.Start) { return 1; }
else if (!Input.A && Input.B && !Input.X && !Input.Y && !Input.Start) { return 2; }
else if (!Input.A && !Input.B && Input.X && !Input.Y && !Input.Start) { return 3; }
else if (!Input.A && !Input.B && !Input.X && Input.Y && !Input.Start) { return 4; }
else if (Input.Start) { return 5; } //special case for start
//check for two button presses starting with A
else if (Input.A && Input.B && !Input.X && !Input.Y) { return 6; }
else if (Input.A && !Input.B && Input.X && !Input.Y) { return 7; }
else if (Input.A && !Input.B && !Input.X && Input.Y) { return 8; }
//check for two button presses starting with B
else if (!Input.A && Input.B && Input.X && !Input.Y) { return 9; }
else if (!Input.A && Input.B && !Input.X && Input.Y) { return 10; }
//check for two button presses starting with X
else if (!Input.A && !Input.B && Input.X && Input.Y) { return 11; }
//check for three button presses
else if (Input.A && Input.B && Input.X && !Input.Y) { return 12; }
else if (Input.A && Input.B && !Input.X && Input.Y) { return 13; }
else if (!Input.A && Input.B && Input.X && Input.Y) { return 14; }
else if (Input.A && !Input.B && Input.X && Input.Y) { return 15; }
//check for 4 buttons down
else if (Input.A && Input.B && Input.X && Input.Y) { return 16; }
//total of 17 unique button combinations
return 0;
}
//methods to convert byte value to input struct
public static GameInputStruct ConvertToInputStruct(byte Input)
{
GameInputStruct GIS = new GameInputStruct();
//reduce input value to button value, set buttons
byte dirCount = 0, btnID = Input;
while (btnID >= DirectionOffset) { btnID -= DirectionOffset; dirCount++; }
SetButtons(ref GIS, btnID);
//determine direction to apply based on number of reductions
switch (dirCount)
{
case 0: { break; }
case 1: { GIS.Direction = Direction.Up; break; }
case 2: { GIS.Direction = Direction.UpRight; break; }
case 3: { GIS.Direction = Direction.Right; break; }
case 4: { GIS.Direction = Direction.DownRight; break; }
case 5: { GIS.Direction = Direction.Down; break; }
case 6: { GIS.Direction = Direction.DownLeft; break; }
case 7: { GIS.Direction = Direction.Left; break; }
case 8: { GIS.Direction = Direction.UpLeft; break; }
default: { break; }
}
return GIS;
}
public static void SetButtons(ref GameInputStruct GIS, byte btnID)
{ //check for single button presses
switch (btnID)
{ //check for single button presses
case 0: { break; }
case 1: { GIS.A = true; break; }
case 2: { GIS.B = true; break; }
case 3: { GIS.X = true; break; }
case 4: { GIS.Y = true; break; }
case 5: { GIS.Start = true; break; }
//check for two button presses starting with A
case 6: { GIS.A = true; GIS.B = true; break; }
case 7: { GIS.A = true; GIS.X = true; break; }
case 8: { GIS.A = true; GIS.Y = true; break; }
//check for two button presses starting with B
case 9: { GIS.B = true; GIS.X = true; break; }
case 10: { GIS.B = true; GIS.Y = true; break; }
//check for two button presses starting with X
case 11: { GIS.X = true; GIS.Y = true; break; }
//check for three button presses
case 12: { GIS.A = true; GIS.B = true; GIS.X = true; break; }
case 13: { GIS.A = true; GIS.B = true; GIS.Y = true; break; }
case 14: { GIS.B = true; GIS.Y = true; GIS.X = true; break; }
case 15: { GIS.X = true; GIS.Y = true; GIS.A = true; break; }
//check for four button presses
case 16: { GIS.A = true; GIS.B = true; GIS.X = true; GIS.Y = true; break; }
}
}
//button PRESS methods
public static bool IsNewButtonPress_A()
{ return (thisFrame.A && !prevFrame.A); }
public static bool IsNewButtonPress_B()
{ return (thisFrame.B && !prevFrame.B); }
public static bool IsNewButtonPress_X()
{ return (thisFrame.X && !prevFrame.X); }
public static bool IsNewButtonPress_Y()
{ return (thisFrame.Y && !prevFrame.Y); }
public static bool IsNewButtonPress_Start()
{ return (thisFrame.Start && !prevFrame.Start); }
public static bool IsNewButtonPress_ANY()
{
if (IsNewButtonPress_A() ||
IsNewButtonPress_B() ||
IsNewButtonPress_X() ||
IsNewButtonPress_Y() ||
IsNewButtonPress_Start())
{ return true; }
else { return false; }
}
//button HELD methods
public static bool IsNewButtonHeld_A()
{ return (thisFrame.A && prevFrame.A); }
public static bool IsNewButtonHeld_B()
{ return (thisFrame.B && prevFrame.B); }
public static bool IsNewButtonHeld_X()
{ return (thisFrame.X && prevFrame.X); }
public static bool IsNewButtonHeld_Y()
{ return (thisFrame.Y && prevFrame.Y); }
public static bool IsNewButtonHeld_Start()
{ return (thisFrame.Start && prevFrame.Start); }
}
} |
||||
TheStack | 331a66c5824e5c6c6ee66585fa1ea61f26da5cb6 | C#code:C# | {"size": 479, "ext": "cs", "max_stars_repo_path": "RiotSharp/GameEndpoint/RecentGames.cs", "max_stars_repo_name": "TRangeman/RSharp", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "RiotSharp/GameEndpoint/RecentGames.cs", "max_issues_repo_name": "TRangeman/RSharp", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "RiotSharp/GameEndpoint/RecentGames.cs", "max_forks_repo_name": "TRangeman/RSharp", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 22.8095238095, "max_line_length": 53, "alphanum_fraction": 0.5657620042} | using System.Collections.Generic;
using Newtonsoft.Json;
namespace RiotSharp.GameEndpoint
{
class RecentGames
{
/// <summary>
/// A list of games for a summoner.
/// </summary>
[JsonProperty("games")]
public List<Game> Games { get; set; }
/// <summary>
/// The summonerId assosiated with the games.
/// </summary>
[JsonProperty("summonerId")]
public long SummonerId { get; set; }
}
}
|
||||
TheStack | 331b8b532a459f9b3e0a8d3d73383fa07f01f5fd | C#code:C# | {"size": 2860, "ext": "cs", "max_stars_repo_path": "sdk/src/Services/Pinpoint/Generated/Model/SimpleEmail.cs", "max_stars_repo_name": "yazanpro/aws-sdk-net", "max_stars_repo_stars_event_min_datetime": "2018-12-03T16:03:19.000Z", "max_stars_repo_stars_event_max_datetime": "2018-12-03T16:03:19.000Z", "max_issues_repo_path": "sdk/src/Services/Pinpoint/Generated/Model/SimpleEmail.cs", "max_issues_repo_name": "yazanpro/aws-sdk-net", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "sdk/src/Services/Pinpoint/Generated/Model/SimpleEmail.cs", "max_forks_repo_name": "yazanpro/aws-sdk-net", "max_forks_repo_forks_event_min_datetime": "2018-12-18T10:19:44.000Z", "max_forks_repo_forks_event_max_datetime": "2018-12-18T10:19:44.000Z"} | {"max_stars_count": 1.0, "max_issues_count": null, "max_forks_count": 1.0, "avg_line_length": 31.7777777778, "max_line_length": 106, "alphanum_fraction": 0.6223776224} | /*
* Copyright 2010-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.
*/
/*
* Do not modify this file. This file is generated from the pinpoint-2016-12-01.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.Text;
using System.IO;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
namespace Amazon.Pinpoint.Model
{
/// <summary>
/// An email composed of a subject, a text part and a html part.
/// </summary>
public partial class SimpleEmail
{
private SimpleEmailPart _htmlPart;
private SimpleEmailPart _subject;
private SimpleEmailPart _textPart;
/// <summary>
/// Gets and sets the property HtmlPart. The content of the message, in HTML format. Use
/// this for email clients that can process HTML. You can include clickable links, formatted
/// text, and much more in an HTML message.
/// </summary>
public SimpleEmailPart HtmlPart
{
get { return this._htmlPart; }
set { this._htmlPart = value; }
}
// Check to see if HtmlPart property is set
internal bool IsSetHtmlPart()
{
return this._htmlPart != null;
}
/// <summary>
/// Gets and sets the property Subject. The subject of the message: A short summary of
/// the content, which will appear in the recipient's inbox.
/// </summary>
public SimpleEmailPart Subject
{
get { return this._subject; }
set { this._subject = value; }
}
// Check to see if Subject property is set
internal bool IsSetSubject()
{
return this._subject != null;
}
/// <summary>
/// Gets and sets the property TextPart. The content of the message, in text format. Use
/// this for text-based email clients, or clients on high-latency networks (such as mobile
/// devices).
/// </summary>
public SimpleEmailPart TextPart
{
get { return this._textPart; }
set { this._textPart = value; }
}
// Check to see if TextPart property is set
internal bool IsSetTextPart()
{
return this._textPart != null;
}
}
} |
||||
TheStack | 331ba9859051021476ce7d6bbf8eadfc0c5f946b | C#code:C# | {"size": 12011, "ext": "cs", "max_stars_repo_path": "GuiWorldNpc/NewWorldNpc.cs", "max_stars_repo_name": "ANDSORA/Taiwu_mods", "max_stars_repo_stars_event_min_datetime": "2018-09-25T08:37:27.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-02T10:30:59.000Z", "max_issues_repo_path": "GuiWorldNpc/NewWorldNpc.cs", "max_issues_repo_name": "ANDSORA/Taiwu_mods", "max_issues_repo_issues_event_min_datetime": "2018-09-26T03:03:48.000Z", "max_issues_repo_issues_event_max_datetime": "2021-05-30T03:41:50.000Z", "max_forks_repo_path": "GuiWorldNpc/NewWorldNpc.cs", "max_forks_repo_name": "inpayhuang/Taiwu_mods", "max_forks_repo_forks_event_min_datetime": "2018-09-25T13:16:22.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-22T09:45:08.000Z"} | {"max_stars_count": 1047.0, "max_issues_count": 95.0, "max_forks_count": 811.0, "avg_line_length": 40.0366666667, "max_line_length": 335, "alphanum_fraction": 0.5207726251} | using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using GuiBaseUI;
using System.Linq;
namespace GuiWorldNpc
{
public class NewWorldNpc : MonoBehaviour
{
private int partId;
private int placeId;
BigDataScroll bigDataScroll;
public ScrollRect scrollRect;
private RectTransform rectContent;
private int[] m_data;
public int[] data
{
set
{
m_data = value;
SetData();
}
get
{
return m_data;
}
}
public bool isInit = false;
//脚本附带ActorHolder上面
public void Init(int partId, int placeId)
{
// Main.Logger.Log("初始化新世界NPC " + partId.ToString() + " " + placeId.ToString());
this.partId = partId;
this.placeId = placeId;
InitUI();
}
private void InitUI()
{
isInit = true;
Vector2 size = new Vector2(200, 600);
Vector2 pos = new Vector2(0, 0);
Vector2 cellSize = new Vector2(165.0f, 78.0f);
float cellWidth = 165.0f;
float cellHeight = 78.0f + 38.5f;
// Main.Logger.Log("10");
GameObject scrollView = CreateUI.NewScrollView(size, BarType.Vertical, ContentType.VerticalLayout);
scrollRect = scrollView.GetComponent<ScrollRect>();
WorldMapSystem.instance.actorHolder = scrollRect.content;
rectContent = scrollRect.content;
rectContent.GetComponent<ContentSizeFitter>().enabled = false;
rectContent.GetComponent<VerticalLayoutGroup>().enabled = false;
// Main.Logger.Log("完");
scrollRect.verticalNormalizedPosition = 1;
Image imgScrollView = scrollView.GetComponentInChildren<Image>();
imgScrollView.color = new Color(0.5f, 0.5f, 0.5f, 0.005f);
imgScrollView.raycastTarget = false;
RectTransform rScrollView = ((RectTransform)scrollView.transform);
rScrollView.SetParent(gameObject.transform, false);
rScrollView.anchoredPosition = pos;
//scrollView.GetComponentInChildren<Mask>().enabled = false;
// Main.Logger.Log("完0");
GameObject gItemCell = new GameObject("line", new System.Type[] { typeof(RectTransform) });
RectTransform rItemCell = gItemCell.GetComponent<RectTransform>();
rItemCell.SetParent(transform, false);
rItemCell.anchoredPosition = new Vector2(10000, 10000);
rItemCell.sizeDelta = new Vector2(cellWidth, cellHeight);
//Image imgItemCell = gItemCell.AddComponent<Image>();
//imgItemCell.color = new Color(1, 0, 0, 0.5f);
// Main.Logger.Log("完成");
GameObject prefab = WorldMapSystem.instance.actorIcon;
for (int i = 0; i < Main.settings.numberOfColumns; i++)
{
GameObject go = UnityEngine.Object.Instantiate(prefab);
go.transform.SetParent(rItemCell, false);
}
// Main.Logger.Log("完成0");
GridLayoutGroup gridLayoutGroup = gItemCell.AddComponent<GridLayoutGroup>();
gridLayoutGroup.cellSize = cellSize;
gridLayoutGroup.spacing = new Vector2(0, 0);
gridLayoutGroup.padding.left = (int)(0);
gridLayoutGroup.padding.top = (int)(0);
// Main.Logger.Log("完成1");
NpcItem itemCell = gItemCell.AddComponent<NpcItem>();
bigDataScroll = gameObject.AddComponent<BigDataScroll>();
bigDataScroll.Init(scrollRect, itemCell, SetCell);
bigDataScroll.cellHeight = cellHeight;
//GuiBaseUI.Main.LogAllChild(transform, true);
ScrollRect scroll = transform.GetComponent<ScrollRect>();
// Main.Logger.Log("完成v");
RectTransform otherRect = scroll.verticalScrollbar.GetComponent<RectTransform>();
Image other = otherRect.GetComponent<Image>();
// Main.Logger.Log("完成a");
RectTransform myRect = scrollRect.verticalScrollbar.GetComponent<RectTransform>();
//myRect.sizeDelta = new Vector2(10, 0);
// Main.Logger.Log("完成b");
Image my = myRect.GetComponent<Image>();
// Main.Logger.Log("完成e");
//my.color = new Color(0.9490196f, 0.509803951f, 0.503921571f);
my.sprite = other.sprite;
my.type = Image.Type.Sliced;
// Main.Logger.Log("完成p");
// Main.Logger.Log("完成V");
RectTransform otherRect2 = scrollRect.verticalScrollbar.targetGraphic.GetComponent<RectTransform>();
Image other2 = otherRect2.GetComponent<Image>();
// Main.Logger.Log("完成A");
RectTransform myRect2 = scrollRect.verticalScrollbar.targetGraphic.GetComponent<RectTransform>();
// Main.Logger.Log("完成B");
//myRect2.sizeDelta = new Vector2(10, 10);
Image my2 = myRect2.GetComponent<Image>();
// Main.Logger.Log("完成C");
//my2.color = new Color(0.5882353f, 0.807843149f, 0.8156863f);
my2.sprite = other2.sprite;
my2.type = Image.Type.Sliced;
// Main.Logger.Log("完成D");
// Main.Logger.Log("完成3");
SetData();
////test
//Image imgContent = rectContent.gameObject.GetComponent<Image>();
//if (imgContent == null)
//{
// imgContent = rectContent.gameObject.AddComponent<Image>();
//}
//imgContent.color = new Color(0, 1, 0, 0.9f);
//Image imgTop = bigDataScroll.top.gameObject.GetComponent<Image>();
//if (imgTop == null)
//{
// imgTop = bigDataScroll.top.gameObject.AddComponent<Image>();
//}
//imgTop.color = new Color(1, 1, 1, 0.9f);
//Image imgBtm = bigDataScroll.btm.gameObject.GetComponent<Image>();
//if (imgBtm == null)
//{
// imgBtm = bigDataScroll.btm.gameObject.AddComponent<Image>();
//}
//imgContent.color = new Color(0, 0, 0, 0.9f);
//bigDataScroll.top.name = "Actor,0";
//bigDataScroll.btm.name = "Actor,0";
//transform.localScale = transform.localScale * 0.33f;
}
private void SetData()
{
if (bigDataScroll != null && m_data != null && isInit)
{
int count = m_data.Length / Main.settings.numberOfColumns + 1;
//Main.Logger.Log("=======!!!!!=======数据数量"+count);
bigDataScroll.cellCount = count;
//if (!Main.OnChangeList)
//{
// scrollRect.verticalNormalizedPosition = 1;
//}
}
}
private void SetCell(ItemCell itemCell, int index)
{
//Main.Logger.Log(index.ToString() + "设置 itemCell。。。" + itemCell.ToString() + " pos=" + scrollRect.verticalNormalizedPosition.ToString());
NpcItem item = itemCell as NpcItem;
if (item == null)
{
//Main.Logger.Log("WarehouseItem出错。。。");
return;
}
ChildData[] childDatas = item.childDatas;
for (int i = 0; i < Main.settings.numberOfColumns; i++)
{
int idx = (index - 1) * Main.settings.numberOfColumns + i;
//Main.Logger.Log("循环"+i+"获取第几个元素的数据" + idx.ToString());
if (i < childDatas.Length)
{
ChildData childData = childDatas[i];
GameObject go = childData.gameObject;
if (idx < m_data.Length)
{
int num4 = m_data[idx];
if (!go.activeSelf)
{
go.SetActive(true);
}
itemCell.name = "Actor," + num4;
if(itemCell.transform.childCount > 0)
{
itemCell.transform.GetChild(0).name = "Actor," + num4;
}
childData.setPlaceActor.SetActor(num4, Main.showNpcInfo);
//int key = num4;
//int num3 = int.Parse(DateFile.instance.GetActorDate(key, 19, false));
//int num2 = int.Parse(DateFile.instance.GetActorDate(key, 20, false));
//int key2 = (num2 < 0) ? (1001 + int.Parse(DateFile.instance.GetActorDate(key, 14, false))) : 1001;
//int gangValueId = DateFile.instance.GetGangValueId(num3, num2);
//int actorFavor = DateFile.instance.GetActorFavor(false, DateFile.instance.MianActorID(), key, false, false);
//string des = "======"+((actorFavor != -1) ? ActorMenu.instance.Color5(actorFavor, true, -1) : DateFile.instance.SetColoer(20002, DateFile.instance.massageDate[303][2], false));
//des += "\n======" + ((int.Parse(DateFile.instance.GetActorDate(key, 8, false)) != 1) ? DateFile.instance.SetColoer((int.Parse(DateFile.instance.GetActorDate(key, 19, false)) == 18) ? 20005 : 20010, DateFile.instance.GetActorName(key, false, false), false) : DateFile.instance.GetActorName(key, false, false));
//des += "\n======" + DateFile.instance.SetColoer(10003, DateFile.instance.GetGangDate(num3, 0), false) + ((num3 == 0) ? "" : DateFile.instance.SetColoer(20011 - Mathf.Abs(num2), DateFile.instance.presetGangGroupDateValue[gangValueId][key2], false));
//Main.Logger.Log(des);
}
else
{
if (go.activeSelf)
{
go.SetActive(false);
}
}
if (i == 0 && !go.transform.parent.gameObject.activeSelf)
go.transform.parent.gameObject.SetActive(true);
}
else
{
Main.Logger.Log("数据出错。。。");
}
}
}
private void Update()
{
if (!gameObject.activeInHierarchy | m_data == null | scrollRect == null)
{
return;
}
var mousePosition = Input.mousePosition;
var mouseOnPackage = mousePosition.x < Screen.width / 10 && mousePosition.y > Screen.width / 10 && mousePosition.y < Screen.width / 10 * 9;
var v = Input.GetAxis("Mouse ScrollWheel");
if (v != 0)
{
if (mouseOnPackage)
{
float count = m_data.Length / Main.settings.numberOfColumns + 1;
scrollRect.verticalNormalizedPosition += v / count * Main.settings.scrollSpeed;
}
}
}
//private bool late_update;
//private void LateUpdate()
//{
// if (!late_update)
// return;
// late_update = false;
// if (bigDataScroll != null && m_data != null && isInit)
// {
// int count = m_data.Length / Main.settings.numberOfColumns + 1;
// Main.Logger.Log("数量"+count);
// bigDataScroll.cellCount = count;
// if (!Main.OnChangeList)
// {
// scrollRect.verticalNormalizedPosition = 1;
// }
// }
//}
//void OnGUI()
//{
// if (GUILayout.Button("Test"))
// {
// GuiBaseUI.Main.LogAllChild(transform);
// }
//}
}
}
|
||||
TheStack | 331cd96ba812a2b6901cb0b77b7d56bb82ae4fbe | C#code:C# | {"size": 969, "ext": "cs", "max_stars_repo_path": "WebStoreWeb/Global.asax.cs", "max_stars_repo_name": "Muhammad-Taimur/Webstore", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "WebStoreWeb/Global.asax.cs", "max_issues_repo_name": "Muhammad-Taimur/Webstore", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "WebStoreWeb/Global.asax.cs", "max_forks_repo_name": "Muhammad-Taimur/Webstore", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 30.28125, "max_line_length": 81, "alphanum_fraction": 0.6904024768} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Http.Cors;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using WebStoreWeb.App_Start;
namespace WebStoreWeb
{
public class WebApiApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
//Registring Container Globally.
ContainerConfig.RegisterContainer(GlobalConfiguration.Configuration);
//Enabling corsss
EnableCorsAttribute cors = new EnableCorsAttribute("*", "*", "*");
}
}
}
|
||||
TheStack | 331d3baa38c3831fb7288e78e5885c60ff9be8e3 | C#code:C# | {"size": 12226, "ext": "cs", "max_stars_repo_path": "Database/Entities/Operations/Prepared/PreparedArrayLoadOperation.cs", "max_stars_repo_name": "telmengedar/NightlyCode.DB", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Database/Entities/Operations/Prepared/PreparedArrayLoadOperation.cs", "max_issues_repo_name": "telmengedar/NightlyCode.DB", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Database/Entities/Operations/Prepared/PreparedArrayLoadOperation.cs", "max_forks_repo_name": "telmengedar/NightlyCode.DB", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 50.7302904564, "max_line_length": 168, "alphanum_fraction": 0.631359398} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using NightlyCode.Database.Clients;
using NightlyCode.Database.Clients.Tables;
using NightlyCode.Database.Entities.Descriptors;
using NightlyCode.Database.Extern;
namespace NightlyCode.Database.Entities.Operations.Prepared {
/// <summary>
/// <see cref="PreparedArrayLoadOperation"/> containing array parameters
/// </summary>
class PreparedArrayLoadOperation : PreparedLoadOperation {
/// <summary>
/// creates a new <see cref="PreparedArrayLoadOperation"/>
/// </summary>
/// <param name="dbclient">database access</param>
/// <param name="modelcache">access to entity model information</param>
/// <param name="commandtext">command text</param>
/// <param name="parameters">parameters for operation</param>
/// <param name="arrayparameters">array parameters for operation</param>
public PreparedArrayLoadOperation(IDBClient dbclient, Func<Type, EntityDescriptor> modelcache, string commandtext, object[] parameters, Array[] arrayparameters)
: base(dbclient, modelcache, commandtext, parameters) {
ConstantArrayParameters = arrayparameters;
}
/// <summary>
/// array parameters for command
/// </summary>
public Array[] ConstantArrayParameters { get; }
/// <summary>
/// executes the statement
/// </summary>
/// <param name="transaction">transaction used to execute operation</param>
/// <param name="parameters">parameters for execution</param>
/// <returns>data table containing results</returns>
public override DataTable Execute(Transaction transaction, params object[] parameters) {
PreparedOperationData operation = PreparedOperationData.Create(DBClient,
CommandText,
ConstantParameters,
ConstantArrayParameters,
parameters.Where(p => !(p is Array)).ToArray(),
parameters.OfType<Array>().ToArray());
return DBClient.Query(transaction, operation.Command, operation.Parameters);
}
/// <summary>
/// executes the statement returning a scalar
/// </summary>
/// <returns>first value of the result set or default of TScalar</returns>
public override TScalar ExecuteScalar<TScalar>(Transaction transaction, params object[] parameters) {
PreparedOperationData operation = PreparedOperationData.Create(DBClient,
CommandText,
ConstantParameters,
ConstantArrayParameters,
parameters.Where(p => !(p is Array)).ToArray(),
parameters.OfType<Array>().ToArray());
return Converter.Convert<TScalar>(DBClient.Scalar(transaction, operation.Command, operation.Parameters), true);
}
/// <summary>
/// executes the statement returning a set of scalars
/// </summary>
/// <typeparam name="TScalar">type of scalar to return</typeparam>
/// <returns>values of first column of result set converted to TScalar</returns>
public override IEnumerable<TScalar> ExecuteSet<TScalar>(Transaction transaction, params object[] parameters) {
PreparedOperationData operation = PreparedOperationData.Create(DBClient,
CommandText,
ConstantParameters,
ConstantArrayParameters,
parameters.Where(p => !(p is Array)).ToArray(),
parameters.OfType<Array>().ToArray());
foreach (object value in DBClient.Set(transaction, operation.Command, operation.Parameters))
yield return Converter.Convert<TScalar>(value, true);
}
/// <summary>
/// executes the statement
/// </summary>
/// <param name="transaction">transaction used to execute operation</param>
/// <param name="parameters">parameters for execution</param>
/// <returns>data table containing results</returns>
public override Task<DataTable> ExecuteAsync(Transaction transaction, params object[] parameters)
{
PreparedOperationData operation = PreparedOperationData.Create(DBClient,
CommandText,
ConstantParameters,
ConstantArrayParameters,
parameters.Where(p => !(p is Array)).ToArray(),
parameters.OfType<Array>().ToArray());
return DBClient.QueryAsync(transaction, operation.Command, operation.Parameters);
}
/// <summary>
/// executes the statement returning a scalar
/// </summary>
/// <returns>first value of the result set or default of TScalar</returns>
public override async Task<TScalar> ExecuteScalarAsync<TScalar>(Transaction transaction, params object[] parameters)
{
PreparedOperationData operation = PreparedOperationData.Create(DBClient,
CommandText,
ConstantParameters,
ConstantArrayParameters,
parameters.Where(p => !(p is Array)).ToArray(),
parameters.OfType<Array>().ToArray());
return Converter.Convert<TScalar>(await DBClient.ScalarAsync(transaction, operation.Command, operation.Parameters), true);
}
/// <summary>
/// executes the statement returning a set of scalars
/// </summary>
/// <typeparam name="TScalar">type of scalar to return</typeparam>
/// <returns>values of first column of result set converted to TScalar</returns>
public override async Task<TScalar[]> ExecuteSetAsync<TScalar>(Transaction transaction, params object[] parameters)
{
PreparedOperationData operation = PreparedOperationData.Create(DBClient,
CommandText,
ConstantParameters,
ConstantArrayParameters,
parameters.Where(p => !(p is Array)).ToArray(),
parameters.OfType<Array>().ToArray());
return (await DBClient.SetAsync(transaction, operation.Command, operation.Parameters)).Select(v => Converter.Convert<TScalar>(v, true)).ToArray();
}
}
class PreparedArrayLoadOperation<T> : PreparedLoadOperation<T> {
/// <summary>
/// creates a new <see cref="PreparedArrayLoadOperation"/>
/// </summary>
/// <param name="dbclient">database access</param>
/// <param name="modelcache">access to entity model information</param>
/// <param name="commandtext">command text</param>
/// <param name="parameters">parameters for operation</param>
/// <param name="arrayparameters">array parameters for operation</param>
public PreparedArrayLoadOperation(IDBClient dbclient, Func<Type, EntityDescriptor> modelcache, string commandtext, object[] parameters, Array[] arrayparameters)
: base(dbclient, modelcache, commandtext, parameters) {
ConstantArrayParameters = arrayparameters;
}
/// <summary>
/// array parameters for command
/// </summary>
public Array[] ConstantArrayParameters { get; }
/// <summary>
/// executes the statement
/// </summary>
/// <param name="transaction">transaction used to execute operation</param>
/// <param name="parameters">parameters for execution</param>
/// <returns>data table containing results</returns>
public override DataTable Execute(Transaction transaction, params object[] parameters) {
PreparedOperationData operation = PreparedOperationData.Create(DBClient,
CommandText,
ConstantParameters,
ConstantArrayParameters,
parameters.Where(p => !(p is Array)).ToArray(),
parameters.OfType<Array>().ToArray());
return DBClient.Query(transaction, operation.Command, operation.Parameters);
}
/// <summary>
/// executes the statement returning a scalar
/// </summary>
/// <returns>first value of the result set or default of TScalar</returns>
public override TScalar ExecuteScalar<TScalar>(Transaction transaction, params object[] parameters) {
PreparedOperationData operation = PreparedOperationData.Create(DBClient,
CommandText,
ConstantParameters,
ConstantArrayParameters,
parameters.Where(p => !(p is Array)).ToArray(),
parameters.OfType<Array>().ToArray());
return Converter.Convert<TScalar>(DBClient.Scalar(transaction, operation.Command, operation.Parameters), true);
}
/// <summary>
/// executes the statement returning a set of scalars
/// </summary>
/// <typeparam name="TScalar">type of scalar to return</typeparam>
/// <returns>values of first column of result set converted to TScalar</returns>
public override IEnumerable<TScalar> ExecuteSet<TScalar>(Transaction transaction, params object[] parameters) {
PreparedOperationData operation = PreparedOperationData.Create(DBClient,
CommandText,
ConstantParameters,
ConstantArrayParameters,
parameters.Where(p => !(p is Array)).ToArray(),
parameters.OfType<Array>().ToArray());
foreach(object value in DBClient.Set(transaction, operation.Command, operation.Parameters))
yield return Converter.Convert<TScalar>(value, true);
}
/// <summary>
/// executes the statement
/// </summary>
/// <param name="transaction">transaction used to execute operation</param>
/// <param name="parameters">parameters for execution</param>
/// <returns>data table containing results</returns>
public override Task<DataTable> ExecuteAsync(Transaction transaction, params object[] parameters) {
PreparedOperationData operation = PreparedOperationData.Create(DBClient,
CommandText,
ConstantParameters,
ConstantArrayParameters,
parameters.Where(p => !(p is Array)).ToArray(),
parameters.OfType<Array>().ToArray());
return DBClient.QueryAsync(transaction, operation.Command, operation.Parameters);
}
/// <summary>
/// executes the statement returning a scalar
/// </summary>
/// <returns>first value of the result set or default of TScalar</returns>
public override async Task<TScalar> ExecuteScalarAsync<TScalar>(Transaction transaction, params object[] parameters) {
PreparedOperationData operation = PreparedOperationData.Create(DBClient,
CommandText,
ConstantParameters,
ConstantArrayParameters,
parameters.Where(p => !(p is Array)).ToArray(),
parameters.OfType<Array>().ToArray());
return Converter.Convert<TScalar>(await DBClient.ScalarAsync(transaction, operation.Command, operation.Parameters), true);
}
/// <summary>
/// executes the statement returning a set of scalars
/// </summary>
/// <typeparam name="TScalar">type of scalar to return</typeparam>
/// <returns>values of first column of result set converted to TScalar</returns>
public override async Task<TScalar[]> ExecuteSetAsync<TScalar>(Transaction transaction, params object[] parameters) {
PreparedOperationData operation = PreparedOperationData.Create(DBClient,
CommandText,
ConstantParameters,
ConstantArrayParameters,
parameters.Where(p => !(p is Array)).ToArray(),
parameters.OfType<Array>().ToArray());
return (await DBClient.SetAsync(transaction, operation.Command, operation.Parameters)).Select(v => Converter.Convert<TScalar>(v, true)).ToArray();
}
}
} |
||||
TheStack | 331d632a3a1d741aa21579be6c16e2738d980f94 | C#code:C# | {"size": 873, "ext": "cs", "max_stars_repo_path": "DoorScript.cs", "max_stars_repo_name": "bewithSachin/HorrorGame", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "DoorScript.cs", "max_issues_repo_name": "bewithSachin/HorrorGame", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "DoorScript.cs", "max_forks_repo_name": "bewithSachin/HorrorGame", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.25, "max_line_length": 114, "alphanum_fraction": 0.704467354} | using UnityEngine;
using System.Collections;
public class DoorScript : MonoBehaviour {
public bool open = false;
public float doorOpenAngle = 90f;
public float doorCloseAngle = 0f;
public float smooth = 2f;
public AudioClip DoorOpenSound;
new AudioSource audio;
public void ChangeDoorState()
{
open = !open;
GetComponent<AudioSource> ().PlayOneShot (DoorOpenSound);
}
void Update ()
{
if(open) //open == true
{
Quaternion targetRotation = Quaternion.Euler(0, doorOpenAngle, 70);
transform.localRotation = Quaternion.Slerp(transform.localRotation, targetRotation, smooth * Time.deltaTime);
}
else
{
Quaternion targetRotation2 = Quaternion.Euler(0, doorCloseAngle, 0);
transform.localRotation = Quaternion.Slerp(transform.localRotation, targetRotation2, smooth * Time.deltaTime);
}
}
}
|
||||
TheStack | 331db568bff20c0397aaee71599714e345678c1c | C#code:C# | {"size": 3527, "ext": "cs", "max_stars_repo_path": "APIChrysallis/Controllers/valoracionsController.cs", "max_stars_repo_name": "shuansanchez/APIChrysallis", "max_stars_repo_stars_event_min_datetime": "2021-07-23T01:01:31.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-23T01:01:31.000Z", "max_issues_repo_path": "APIChrysallis/Controllers/valoracionsController.cs", "max_issues_repo_name": "shuansanchez/APIChrysallis", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "APIChrysallis/Controllers/valoracionsController.cs", "max_forks_repo_name": "shuansanchez/APIChrysallis", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": 1.0, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 26.3208955224, "max_line_length": 95, "alphanum_fraction": 0.5114828466} | using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web.Http;
using System.Web.Http.Description;
using APIChrysallis.Models;
namespace APIChrysallis.Controllers
{
public class valoracionsController : ApiController
{
private CHRYSALLISEntities db = new CHRYSALLISEntities();
// GET: api/valoracions
public IQueryable<valoracions> Getvaloracions()
{
return db.valoracions;
}
// GET: api/valoracions/5
[ResponseType(typeof(valoracions))]
public async Task<IHttpActionResult> Getvaloracions(int id)
{
valoracions valoracions = await db.valoracions.FindAsync(id);
if (valoracions == null)
{
return NotFound();
}
return Ok(valoracions);
}
// PUT: api/valoracions/5
[ResponseType(typeof(void))]
public async Task<IHttpActionResult> Putvaloracions(int id, valoracions valoracions)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
if (id != valoracions.id_soci)
{
return BadRequest();
}
db.Entry(valoracions).State = EntityState.Modified;
try
{
await db.SaveChangesAsync();
}
catch (DbUpdateConcurrencyException)
{
if (!valoracionsExists(id))
{
return NotFound();
}
else
{
throw;
}
}
return StatusCode(HttpStatusCode.NoContent);
}
// POST: api/valoracions
[ResponseType(typeof(valoracions))]
public async Task<IHttpActionResult> Postvaloracions(valoracions valoracions)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
db.valoracions.Add(valoracions);
try
{
await db.SaveChangesAsync();
}
catch (DbUpdateException)
{
if (valoracionsExists(valoracions.id_soci))
{
return Conflict();
}
else
{
throw;
}
}
return CreatedAtRoute("DefaultApi", new { id = valoracions.id_soci }, valoracions);
}
// DELETE: api/valoracions/5
[ResponseType(typeof(valoracions))]
public async Task<IHttpActionResult> Deletevaloracions(int id)
{
valoracions valoracions = await db.valoracions.FindAsync(id);
if (valoracions == null)
{
return NotFound();
}
db.valoracions.Remove(valoracions);
await db.SaveChangesAsync();
return Ok(valoracions);
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
db.Dispose();
}
base.Dispose(disposing);
}
private bool valoracionsExists(int id)
{
return db.valoracions.Count(e => e.id_soci == id) > 0;
}
}
} |
||||
TheStack | 331ee1beec353c19a223f7547d1044ab0c2895bc | C#code:C# | {"size": 3185, "ext": "cs", "max_stars_repo_path": "src/Xamarin.CustomControls.GifLoader/GifLoader.cs", "max_stars_repo_name": "jtorresm2010/CustomAccordion", "max_stars_repo_stars_event_min_datetime": "2017-04-10T13:22:17.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-15T09:30:46.000Z", "max_issues_repo_path": "src/Xamarin.CustomControls.GifLoader/GifLoader.cs", "max_issues_repo_name": "DottorPagliaccius/xamarin-awesome-controls", "max_issues_repo_issues_event_min_datetime": "2017-04-12T12:53:53.000Z", "max_issues_repo_issues_event_max_datetime": "2020-07-03T01:35:08.000Z", "max_forks_repo_path": "src/Xamarin.CustomControls.GifLoader/GifLoader.cs", "max_forks_repo_name": "DottorPagliaccius/xamarin-awesome-controls", "max_forks_repo_forks_event_min_datetime": "2017-04-28T09:23:52.000Z", "max_forks_repo_forks_event_max_datetime": "2021-08-10T12:23:58.000Z"} | {"max_stars_count": 111.0, "max_issues_count": 40.0, "max_forks_count": 40.0, "avg_line_length": 28.9545454545, "max_line_length": 184, "alphanum_fraction": 0.5736263736} | using System;
using Rg.Plugins.Popup.Animations;
using Rg.Plugins.Popup.Animations.Base;
using Rg.Plugins.Popup.Extensions;
using Rg.Plugins.Popup.Pages;
using Xamarin.Forms;
namespace Xamarin.CustomControls
{
public class GifLoader : PopupPage, IDisposable
{
private bool _disposed;
private readonly INavigation _navigation;
private readonly string _gifFile;
private static string DefaultGifFile;
private static BaseAnimation DefaultPopupAnimation = new ScaleAnimation
{
ScaleIn = 0.8,
ScaleOut = 0.8,
DurationIn = 400,
DurationOut = 300,
EasingIn = Easing.SinOut,
EasingOut = Easing.SinIn,
HasBackgroundAnimation = true
};
public GifLoader(INavigation navigation, string gifFile = null, BaseAnimation animation = null, bool autoShow = true)
{
if (string.IsNullOrEmpty(DefaultGifFile) && string.IsNullOrEmpty(gifFile))
throw new ArgumentException("Please specify a jsonAnimationFile or call Init() to set a deafult one", nameof(gifFile));
_navigation = navigation;
_gifFile = gifFile;
if (animation != null)
SetAnimation(animation);
SetContent();
if (autoShow)
Show();
}
public static void SetDefaultJsonFile(string defaultJsonAnimationFile)
{
if (string.IsNullOrEmpty(defaultJsonAnimationFile))
throw new ArgumentException(nameof(defaultJsonAnimationFile));
DefaultGifFile = defaultJsonAnimationFile;
}
public static void SetDefaultPopupAnimation(BaseAnimation defaultPopupAnimation)
{
DefaultPopupAnimation = defaultPopupAnimation ?? throw new ArgumentNullException(nameof(defaultPopupAnimation));
}
private void SetAnimation(BaseAnimation animation)
{
Animation = animation;
}
private void SetContent()
{
var gifFile = string.IsNullOrEmpty(_gifFile) ? DefaultGifFile : _gifFile;
Content = new StackLayout
{
Padding = new Thickness(90),
Children = { new FFImageLoading.Forms.CachedImage { Source = gifFile, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand } }
};
}
public void Show()
{
_navigation.PushPopupAsync(this);
}
public void Close()
{
try
{
_navigation.PopPopupAsync();
}
catch //shitty and I hope temporary way to prevent occasional "There is not page in PopupStack" errors
{
}
}
protected virtual void Dispose(bool disposing)
{
if (!_disposed)
{
if (disposing)
{
Close();
}
_disposed = true;
}
}
public void Dispose()
{
Dispose(true);
}
}
} |
||||
TheStack | 331f0f506bb97ae7e89544d31967368e05d5fff0 | C#code:C# | {"size": 998, "ext": "cs", "max_stars_repo_path": "WPWebSockets/Server/ConnectionDetails.cs", "max_stars_repo_name": "manderson88/WPWebSocket", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "WPWebSockets/Server/ConnectionDetails.cs", "max_issues_repo_name": "manderson88/WPWebSocket", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "WPWebSockets/Server/ConnectionDetails.cs", "max_forks_repo_name": "manderson88/WPWebSocket", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null} | {"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 34.4137931034, "max_line_length": 141, "alphanum_fraction": 0.6132264529} | using System;
using System.IO;
using System.Net.Sockets;
namespace WPWebSockets.Server
{
public class ConnectionDetails : WPWebSockets.Server.IConnectionDetails
{
public Stream Stream { get; private set; }
public TcpClient TcpClient { get; private set; }
public ConnectionType ConnectionType { get; private set; }
public string Header { get; private set; }
public Int64 uuid { get; set; }
public Int64 connectionID { get; set; }
// this is the path attribute in the first line of the http header
public string Path { get; private set; }
public ConnectionDetails (Stream stream, TcpClient tcpClient, string path, ConnectionType connectionType, string header,Int64 _uuid)
{
Stream = stream;
TcpClient = tcpClient;
Path = path;
ConnectionType = connectionType;
Header = header;
uuid = _uuid;
}
}
}
|
||||
TheStack | 331f6e9637b9cbbb32f37c87b44eb9af073b73ed | C#code:C# | {"size": 6055, "ext": "cs", "max_stars_repo_path": "samples/snippets/csharp/VS_Snippets_CFX/isafeserializationdata/cs/source.cs", "max_stars_repo_name": "antmdvs/docs", "max_stars_repo_stars_event_min_datetime": "2020-02-22T09:30:21.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-02T23:44:31.000Z", "max_issues_repo_path": "samples/snippets/csharp/VS_Snippets_CFX/isafeserializationdata/cs/source.cs", "max_issues_repo_name": "antmdvs/docs", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "samples/snippets/csharp/VS_Snippets_CFX/isafeserializationdata/cs/source.cs", "max_forks_repo_name": "antmdvs/docs", "max_forks_repo_forks_event_min_datetime": "2021-08-02T23:44:31.000Z", "max_forks_repo_forks_event_max_datetime": "2021-08-02T23:44:31.000Z"} | {"max_stars_count": 2.0, "max_issues_count": null, "max_forks_count": 1.0, "avg_line_length": 37.6086956522, "max_line_length": 86, "alphanum_fraction": 0.5308009909} | //<snippet1>
using System;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Serialization;
using System.IO;
using System.Runtime.Serialization.Formatters.Soap;
using System.Security;
// [assembly: SecurityCritical(SecurityCriticalScope.Everything)]
// Using the SecurityCriticalAttribute prohibits usage of the
// ISafeSerializationData interface.
[assembly: AllowPartiallyTrustedCallers]
namespace ISafeSerializationDataExample
{
class Test
{
public static void Main()
{
try
{
// This code forces a division by 0 and catches the
// resulting exception.
try
{
int zero = 0;
int ecks = 1 / zero;
}
catch (Exception ex)
{
// Create a new exception to throw.
NewException newExcept = new NewException("Divided by", 0);
// This FileStream is used for the serialization.
FileStream fs =
new FileStream("NewException.dat",
FileMode.Create);
try
{
// Serialize the exception.
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(fs, newExcept);
// Rewind the stream and deserialize the exception.
fs.Position = 0;
NewException deserExcept =
(NewException)formatter.Deserialize(fs);
Console.WriteLine(
"Forced a division by 0, caught the resulting exception, \n" +
"and created a derived exception with custom data. \n" +
"Serialized the exception and deserialized it:\n");
Console.WriteLine("StringData: {0}", deserExcept.StringData);
Console.WriteLine("intData: {0}", deserExcept.IntData);
}
catch (SerializationException se)
{
Console.WriteLine("Failed to serialize: {0}",
se.ToString());
}
finally
{
fs.Close();
Console.ReadLine();
}
}
}
catch (NewException ex)
{
Console.WriteLine("StringData: {0}", ex.StringData);
Console.WriteLine("IntData: {0}", ex.IntData);
}
}
}
[Serializable]
public class NewException : Exception
{
// Because we don't want the exception state to be serialized normally,
// we take care of that in the constructor.
[NonSerialized]
private NewExceptionState m_state = new NewExceptionState();
public NewException(string stringData, int intData)
{
// Instance data is stored directly in the exception state object.
m_state.StringData = stringData;
m_state.IntData = intData;
// In response to SerializeObjectState, we need to provide
// any state to serialize with the exception. In this
// case, since our state is already stored in an
// ISafeSerializationData implementation, we can
// just provide that.
SerializeObjectState += delegate(object exception,
SafeSerializationEventArgs eventArgs)
{
eventArgs.AddSerializedState(m_state);
};
// An alternate implementation would be to store the state
// as local member variables, and in response to this
// method create a new instance of an ISafeSerializationData
// object and populate it with the local state here before
// passing it through to AddSerializedState.
}
// There is no need to supply a deserialization constructor
// (with SerializationInfo and StreamingContext parameters),
// and no need to supply a GetObjectData implementation.
// Data access is through the state object (m_State).
public string StringData
{
get { return m_state.StringData; }
}
public int IntData
{
get { return m_state.IntData; }
}
// Implement the ISafeSerializationData interface
// to contain custom exception data in a partially trusted
// assembly. Use this interface to replace the
// Exception.GetObjectData method,
// which is now marked with the SecurityCriticalAttribute.
[Serializable]
private struct NewExceptionState : ISafeSerializationData
{
private string m_stringData;
private int m_intData;
public string StringData
{
get { return m_stringData; }
set { m_stringData = value; }
}
public int IntData
{
get { return m_intData; }
set { m_intData = value; }
}
//<snippet2>
// This method is called when deserialization of the
// exception is complete.
void ISafeSerializationData.CompleteDeserialization
(object obj)
{
// Since the exception simply contains an instance of
// the exception state object, we can repopulate it
// here by just setting its instance field to be equal
// to this deserialized state instance.
NewException exception = obj as NewException;
exception.m_state = this;
}
//</snippet2>
}
}
}
//</snippet1> |
||||
TheStack | 332013f9981b5714659b77309536f230eff37168 | C#code:C# | {"size": 18392, "ext": "cs", "max_stars_repo_path": "Nuqleon/Core/JSON/Nuqleon.Json.Serialization/GlobalSuppressions.cs", "max_stars_repo_name": "ScriptBox99/reaqtor", "max_stars_repo_stars_event_min_datetime": "2021-05-18T14:32:32.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-29T21:23:46.000Z", "max_issues_repo_path": "Nuqleon/Core/JSON/Nuqleon.Json.Serialization/GlobalSuppressions.cs", "max_issues_repo_name": "ScriptBox99/reaqtor", "max_issues_repo_issues_event_min_datetime": "2021-05-18T19:08:03.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-21T20:21:26.000Z", "max_forks_repo_path": "Nuqleon/Core/JSON/Nuqleon.Json.Serialization/GlobalSuppressions.cs", "max_forks_repo_name": "ScriptBox99/reaqtor", "max_forks_repo_forks_event_min_datetime": "2021-05-18T14:35:48.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-21T23:35:35.000Z"} | {"max_stars_count": 485.0, "max_issues_count": 54.0, "max_forks_count": 35.0, "avg_line_length": 334.4, "max_line_length": 433, "alphanum_fraction": 0.8167681601} | // 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.
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0051:Remove unused private members", Justification = "Used through reflection.", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.ParserStringBuilder.NullOr``1(Nuqleon.Json.Serialization.ParseStringFunc{``0})~Nuqleon.Json.Serialization.ParseStringFunc{System.Nullable{``0}}")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0051:Remove unused private members", Justification = "Used through reflection.", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.EmitterStringBuilder.CreateAnyObjectEmitter``2(Nuqleon.Json.Serialization.FastJsonSerializerFactory.EmitterStringBuilder.BuilderContext)~Nuqleon.Json.Serialization.EmitStringAction{``1}")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0051:Remove unused private members", Justification = "Used through reflection.", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.EmitterStringBuilder.CreateArrayEmitter``1(Nuqleon.Json.Serialization.FastJsonSerializerFactory.EmitterStringBuilder.BuilderContext)~Nuqleon.Json.Serialization.EmitStringAction{``0[]}")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0051:Remove unused private members", Justification = "Used through reflection.", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.EmitterStringBuilder.CreateListEmitter``2(Nuqleon.Json.Serialization.FastJsonSerializerFactory.EmitterStringBuilder.BuilderContext)~Nuqleon.Json.Serialization.EmitStringAction{``1}")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0051:Remove unused private members", Justification = "Used through reflection.", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.EmitterStringBuilder.NullOr``1(Nuqleon.Json.Serialization.EmitStringAction{``0})~Nuqleon.Json.Serialization.EmitStringAction{System.Nullable{``0}}")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0051:Remove unused private members", Justification = "Used through reflection.", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.EmitterWriterBuilder.CreateAnyObjectEmitter``2(Nuqleon.Json.Serialization.FastJsonSerializerFactory.EmitterWriterBuilder.BuilderContext)~Nuqleon.Json.Serialization.EmitWriterAction{``1}")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0051:Remove unused private members", Justification = "Used through reflection.", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.EmitterWriterBuilder.CreateArrayEmitter``1(Nuqleon.Json.Serialization.FastJsonSerializerFactory.EmitterWriterBuilder.BuilderContext)~Nuqleon.Json.Serialization.EmitWriterAction{``0[]}")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0051:Remove unused private members", Justification = "Used through reflection.", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.EmitterWriterBuilder.CreateListEmitter``2(Nuqleon.Json.Serialization.FastJsonSerializerFactory.EmitterWriterBuilder.BuilderContext)~Nuqleon.Json.Serialization.EmitWriterAction{``1}")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0051:Remove unused private members", Justification = "Used through reflection.", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.EmitterWriterBuilder.NullOr``1(Nuqleon.Json.Serialization.EmitWriterAction{``0})~Nuqleon.Json.Serialization.EmitWriterAction{System.Nullable{``0}}")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0051:Remove unused private members", Justification = "Used through reflection.", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.ParserStringBuilder.CreateAnyObjectParser``1~Nuqleon.Json.Serialization.ParseStringFunc{System.Collections.Generic.Dictionary{System.String,``0}}")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0051:Remove unused private members", Justification = "Used through reflection.", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.ParserStringBuilder.CreateArrayParser``2(System.Func{Nuqleon.Json.Serialization.ArrayBuilder{``0},``1})~Nuqleon.Json.Serialization.ParseStringFunc{``1}")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0051:Remove unused private members", Justification = "Used through reflection.", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.ParserStringBuilder.ToArray``1(Nuqleon.Json.Serialization.ArrayBuilder{``0})~``0[]")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0051:Remove unused private members", Justification = "Used through reflection.", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.ParserStringBuilder.ToList``1(Nuqleon.Json.Serialization.ArrayBuilder{``0})~System.Collections.Generic.List{``0}")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0051:Remove unused private members", Justification = "Used through reflection.", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.ParserReaderBuilder.CreateArrayParser``2(System.Func{Nuqleon.Json.Serialization.ArrayBuilder{``0},``1})~Nuqleon.Json.Serialization.ParseReaderFunc{``1}")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0051:Remove unused private members", Justification = "Used through reflection.", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.ParserReaderBuilder.CreateAnyObjectParser``1~Nuqleon.Json.Serialization.ParseReaderFunc{System.Collections.Generic.Dictionary{System.String,``0}}")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0051:Remove unused private members", Justification = "Used through reflection.", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.ParserReaderBuilder.NullOr``1(Nuqleon.Json.Serialization.ParseReaderFunc{``0})~Nuqleon.Json.Serialization.ParseReaderFunc{System.Nullable{``0}}")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0051:Remove unused private members", Justification = "Used through reflection.", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.ParserReaderBuilder.ToList``1(Nuqleon.Json.Serialization.ArrayBuilder{``0})~System.Collections.Generic.List{``0}")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Used via delegate (https://github.com/dotnet/roslyn/issues/32851)", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.Emitter.EmitBoolean(System.Text.StringBuilder,System.Boolean,Nuqleon.Json.Serialization.EmitterContext)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Used via delegate (https://github.com/dotnet/roslyn/issues/32851)", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.Emitter.EmitBoolean(System.IO.TextWriter,System.Boolean,Nuqleon.Json.Serialization.EmitterContext)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Used via delegate (https://github.com/dotnet/roslyn/issues/32851)", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.Emitter.EmitChar(System.IO.TextWriter,System.Char,Nuqleon.Json.Serialization.EmitterContext)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Used via delegate (https://github.com/dotnet/roslyn/issues/32851)", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.Emitter.EmitChar(System.Text.StringBuilder,System.Char,Nuqleon.Json.Serialization.EmitterContext)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Used via delegate (https://github.com/dotnet/roslyn/issues/32851)", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.Emitter.EmitDateTimeOffset(System.IO.TextWriter,System.DateTimeOffset,Nuqleon.Json.Serialization.EmitterContext)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Used via delegate (https://github.com/dotnet/roslyn/issues/32851)", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.Emitter.EmitDateTimeOffset(System.Text.StringBuilder,System.DateTimeOffset,Nuqleon.Json.Serialization.EmitterContext)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Used via delegate (https://github.com/dotnet/roslyn/issues/32851)", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.Emitter.EmitString(System.IO.TextWriter,System.String,Nuqleon.Json.Serialization.EmitterContext)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Used via delegate (https://github.com/dotnet/roslyn/issues/32851)", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.Emitter.EmitString(System.Text.StringBuilder,System.String,Nuqleon.Json.Serialization.EmitterContext)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Used via delegate (https://github.com/dotnet/roslyn/issues/32851)", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.Parser.ParseChar(System.IO.TextReader,Nuqleon.Json.Serialization.ParserContext)~System.Char")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Used via delegate (https://github.com/dotnet/roslyn/issues/32851)", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.Parser.ParseChar(System.String,System.Int32,System.Int32@,Nuqleon.Json.Serialization.ParserContext)~System.Char")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Used via delegate (https://github.com/dotnet/roslyn/issues/32851)", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.Parser.ParseDateTimeOffset(System.IO.TextReader,Nuqleon.Json.Serialization.ParserContext)~System.DateTimeOffset")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Used via delegate (https://github.com/dotnet/roslyn/issues/32851)", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.Parser.ParseDateTimeOffset(System.String,System.Int32,System.Int32@,Nuqleon.Json.Serialization.ParserContext)~System.DateTimeOffset")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0052:Remove unread private members", Justification = "Called through reflection", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.EmitterStringBuilder.CreateAnyObjectEmitter``2(Nuqleon.Json.Serialization.FastJsonSerializerFactory.EmitterStringBuilder.BuilderContext)~Nuqleon.Json.Serialization.EmitStringAction{``1}")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0052:Remove unread private members", Justification = "Called through reflection", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.EmitterStringBuilder.CreateArrayEmitter``1(Nuqleon.Json.Serialization.FastJsonSerializerFactory.EmitterStringBuilder.BuilderContext)~Nuqleon.Json.Serialization.EmitStringAction{``0[]}")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0052:Remove unread private members", Justification = "Called through reflection", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.EmitterStringBuilder.CreateListEmitter``2(Nuqleon.Json.Serialization.FastJsonSerializerFactory.EmitterStringBuilder.BuilderContext)~Nuqleon.Json.Serialization.EmitStringAction{``1}")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0052:Remove unread private members", Justification = "Called through reflection", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.EmitterStringBuilder.NullOr``1(Nuqleon.Json.Serialization.EmitStringAction{``0})~Nuqleon.Json.Serialization.EmitStringAction{System.Nullable{``0}}")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0052:Remove unread private members", Justification = "Called through reflection", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.EmitterWriterBuilder.CreateAnyObjectEmitter``2(Nuqleon.Json.Serialization.FastJsonSerializerFactory.EmitterWriterBuilder.BuilderContext)~Nuqleon.Json.Serialization.EmitWriterAction{``1}")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0052:Remove unread private members", Justification = "Called through reflection", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.EmitterWriterBuilder.CreateArrayEmitter``1(Nuqleon.Json.Serialization.FastJsonSerializerFactory.EmitterWriterBuilder.BuilderContext)~Nuqleon.Json.Serialization.EmitWriterAction{``0[]}")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0052:Remove unread private members", Justification = "Called through reflection", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.EmitterWriterBuilder.CreateListEmitter``2(Nuqleon.Json.Serialization.FastJsonSerializerFactory.EmitterWriterBuilder.BuilderContext)~Nuqleon.Json.Serialization.EmitWriterAction{``1}")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0052:Remove unread private members", Justification = "Called through reflection", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.EmitterWriterBuilder.NullOr``1(Nuqleon.Json.Serialization.EmitWriterAction{``0})~Nuqleon.Json.Serialization.EmitWriterAction{System.Nullable{``0}}")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0052:Remove unread private members", Justification = "Called through reflection", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.ParserReaderBuilder.CreateAnyObjectParser``1~Nuqleon.Json.Serialization.ParseReaderFunc{System.Collections.Generic.Dictionary{System.String,``0}}")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0052:Remove unread private members", Justification = "Called through reflection", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.ParserReaderBuilder.CreateArrayParser``2(System.Func{Nuqleon.Json.Serialization.ArrayBuilder{``0},``1})~Nuqleon.Json.Serialization.ParseReaderFunc{``1}")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0052:Remove unread private members", Justification = "Called through reflection", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.ParserReaderBuilder.NullOr``1(Nuqleon.Json.Serialization.ParseReaderFunc{``0})~Nuqleon.Json.Serialization.ParseReaderFunc{System.Nullable{``0}}")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0052:Remove unread private members", Justification = "Called through reflection", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.ParserReaderBuilder.ToArray``1(Nuqleon.Json.Serialization.ArrayBuilder{``0})~``0[]")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0052:Remove unread private members", Justification = "Called through reflection", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.ParserReaderBuilder.ToList``1(Nuqleon.Json.Serialization.ArrayBuilder{``0})~System.Collections.Generic.List{``0}")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0052:Remove unread private members", Justification = "Called through reflection", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.ParserStringBuilder.CreateAnyObjectParser``1~Nuqleon.Json.Serialization.ParseStringFunc{System.Collections.Generic.Dictionary{System.String,``0}}")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0052:Remove unread private members", Justification = "Called through reflection", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.ParserStringBuilder.CreateArrayParser``2(System.Func{Nuqleon.Json.Serialization.ArrayBuilder{``0},``1})~Nuqleon.Json.Serialization.ParseStringFunc{``1}")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0052:Remove unread private members", Justification = "Called through reflection", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.ParserStringBuilder.NullOr``1(Nuqleon.Json.Serialization.ParseStringFunc{``0})~Nuqleon.Json.Serialization.ParseStringFunc{System.Nullable{``0}}")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0052:Remove unread private members", Justification = "Called through reflection", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.ParserStringBuilder.ToArray``1(Nuqleon.Json.Serialization.ArrayBuilder{``0})~``0[]")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Code Quality", "IDE0052:Remove unread private members", Justification = "Called through reflection", Scope = "member", Target = "~M:Nuqleon.Json.Serialization.FastJsonSerializerFactory.ParserStringBuilder.ToList``1(Nuqleon.Json.Serialization.ArrayBuilder{``0})~System.Collections.Generic.List{``0}")]
|