content
stringlengths
5
1.04M
avg_line_length
float64
1.75
12.9k
max_line_length
int64
2
244k
alphanum_fraction
float64
0
0.98
licenses
sequence
repository_name
stringlengths
7
92
path
stringlengths
3
249
size
int64
5
1.04M
lang
stringclasses
2 values
using System; namespace TypeGen.Core.TypeAnnotations { /// <summary> /// Specifies a default value for a TypeScript property /// </summary> [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] public class TsDefaultValueAttribute : Attribute { /// <summary> /// Default value for a property /// </summary> public string DefaultValue { get; set; } public TsDefaultValueAttribute(string defaultValue) { DefaultValue = defaultValue; } } }
25.045455
72
0.626134
[ "MIT" ]
Allov/TypeGen
src/TypeGen/TypeGen.Core/TypeAnnotations/TsDefaultValueAttribute.cs
553
C#
//-----------------------------------------------【脚本说明】------------------------------------------------------- // 脚本功能: 在游戏运行时显示帧率相关信息 // 使用语言: C# // 开发所用IDE版本:Unity4.5 06f 、Visual Studio 2010 // 2014年10月 Created by 浅墨 // 更多内容或交流请访问浅墨的博客:http://blog.csdn.net/poem_qianmo //--------------------------------------------------------------------------------------------------------------------- //-----------------------------------------------【使用方法】------------------------------------------------------- // 方法一:在Unity中拖拽此脚本到场景主摄像机之上 // 方法二:在Inspector中[Add Component]->[浅墨's Toolkit v1.0]->[ShowFPS] //--------------------------------------------------------------------------------------------------------------------- using UnityEngine; using System.Collections; //添加组件菜单 [AddComponentMenu("浅墨's Toolkit/ShowFPS")] //开始ShowFPS类 public class ShowFPS : MonoBehaviour { private static int count = 0;//用于控制帧率的显示速度的count private static float milliSecond = 0;//毫秒数 private static float fps = 0;//帧率值 private static float deltaTime = 0.0f;//用于显示帧率的deltaTime //OnGUI函数 void OnGUI() { //左上方帧数显示 if (++count > 10) { count = 0; milliSecond = deltaTime * 1000.0f; fps = 1.0f / deltaTime; } string text = string.Format(" 当前每帧渲染间隔:{0:0.0} ms ({1:0.} 帧每秒)", milliSecond, fps); GUILayout.Label(text); } //Update函数 void Update() { //帧数显示的计时delataTime deltaTime += (Time.deltaTime - deltaTime) * 0.1f; } }
30.056604
119
0.424984
[ "MIT" ]
zsutxz/QFramework
Assets/QFramework/0.Libs/8.Info/ShowFPS.cs
1,911
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace JSDocNet { /// <summary> /// A context class. /// It contains all the available information after parsing the javascript source files and the config file. /// An instance of this class is passed to the template module which then is responsible for generating the documentation. /// </summary> public class DocContext { /* construction */ /// <summary> /// Constructor /// </summary> internal DocContext(DocItemGlobal Global, Settings Settings, List<Tutorial> Tutorials) { this.Global = Global; this.Settings = Settings; this.Tutorials = Tutorials; } /* properties */ /// <summary> /// The global namespace. It is actually the root of a tree of DocItem objects. /// </summary> public DocItemGlobal Global { get; private set; } /// <summary> /// The settings of the config file of the active template. /// </summary> public Settings Settings { get; private set; } /// <summary> /// Information about the tutorials that should be used with the documentation. /// </summary> public List<Tutorial> Tutorials { get; private set; } } }
32.255814
126
0.612833
[ "Unlicense" ]
tbebekis/JSDocNet
JSDocNet/DocContext.cs
1,389
C#
// Copyright (c) 2022 AccelByte Inc. All Rights Reserved. // This is licensed software from AccelByte Inc, for limitations // and restrictions contact your company contract manager. // This code is generated by tool. DO NOT EDIT. using System.Net; using System.IO; using System.Text.Json; using AccelByte.Sdk.Api.Leaderboard.Model; using AccelByte.Sdk.Core; using AccelByte.Sdk.Core.Util; namespace AccelByte.Sdk.Api.Leaderboard.Operation { /// <summary> /// getUserLeaderboardRankingsAdminV1 /// /// /// /// Required permission 'ADMIN:NAMESPACE:{namespace}:LEADERBOARD [READ]' /// /// /// /// /// Get user leaderboard rankings /// </summary> public class GetUserLeaderboardRankingsAdminV1 : AccelByte.Sdk.Core.Operation { #region Builder Part public static GetUserLeaderboardRankingsAdminV1Builder Builder = new GetUserLeaderboardRankingsAdminV1Builder(); public class GetUserLeaderboardRankingsAdminV1Builder : OperationBuilder<GetUserLeaderboardRankingsAdminV1Builder> { public long? Limit { get; set; } public long? Offset { get; set; } internal GetUserLeaderboardRankingsAdminV1Builder() { } public GetUserLeaderboardRankingsAdminV1Builder SetLimit(long _limit) { Limit = _limit; return this; } public GetUserLeaderboardRankingsAdminV1Builder SetOffset(long _offset) { Offset = _offset; return this; } public GetUserLeaderboardRankingsAdminV1 Build( string namespace_, string userId ) { GetUserLeaderboardRankingsAdminV1 op = new GetUserLeaderboardRankingsAdminV1(this, namespace_, userId ); op.PreferredSecurityMethod = PreferredSecurityMethod; return op; } } private GetUserLeaderboardRankingsAdminV1(GetUserLeaderboardRankingsAdminV1Builder builder, string namespace_, string userId ) { PathParams["namespace"] = namespace_; PathParams["userId"] = userId; if (builder.Limit != null) QueryParams["limit"] = Convert.ToString(builder.Limit)!; if (builder.Offset != null) QueryParams["offset"] = Convert.ToString(builder.Offset)!; Securities.Add(AccelByte.Sdk.Core.Operation.SECURITY_BEARER); } #endregion public GetUserLeaderboardRankingsAdminV1( string namespace_, string userId, long? limit, long? offset ) { PathParams["namespace"] = namespace_; PathParams["userId"] = userId; if (limit != null) QueryParams["limit"] = Convert.ToString(limit)!; if (offset != null) QueryParams["offset"] = Convert.ToString(offset)!; Securities.Add(AccelByte.Sdk.Core.Operation.SECURITY_BEARER); } public override string Path => "/leaderboard/v1/admin/namespaces/{namespace}/users/{userId}/leaderboards"; public override HttpMethod Method => HttpMethod.Get; public override string[] Consumes => new string[] { }; public override string[] Produces => new string[] { "application/json" }; [Obsolete("Use 'Securities' property instead.")] public override string? Security { get; set; } = "Bearer"; public Model.ModelsGetAllUserLeaderboardsResp? ParseResponse(HttpStatusCode code, string contentType, Stream payload) { if (code == (HttpStatusCode)204) { return null; } else if (code == (HttpStatusCode)201) { return JsonSerializer.Deserialize<Model.ModelsGetAllUserLeaderboardsResp>(payload); } else if (code == (HttpStatusCode)200) { return JsonSerializer.Deserialize<Model.ModelsGetAllUserLeaderboardsResp>(payload); } var payloadString = Helper.ConvertInputStreamToString(payload); throw new HttpResponseException(code, payloadString); } } }
31.5
125
0.56435
[ "MIT" ]
AccelByte/accelbyte-csharp-sdk
AccelByte.Sdk/Api/Leaderboard/Operation/UserData/GetUserLeaderboardRankingsAdminV1.cs
4,662
C#
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ public partial class CMSModules_SmartSearch_Controls_UI_SearchIndex_OnLineForm_Edit { /// <summary> /// pnlConetnEdit control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::CMS.Base.Web.UI.CMSUpdatePanel pnlConetnEdit; /// <summary> /// ucDisabledModule control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::CMSAdminControls_Basic_DisabledModuleInfo ucDisabledModule; /// <summary> /// plcMess control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::CMS.Base.Web.UI.MessagesPlaceHolder plcMess; /// <summary> /// pnlForm control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.WebControls.Panel pnlForm; /// <summary> /// lblSite control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::CMS.Base.Web.UI.LocalizedLabel lblSite; /// <summary> /// selSite control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::CMSFormControls_Sites_SiteSelector selSite; /// <summary> /// lblCustomTable control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::CMS.Base.Web.UI.LocalizedLabel lblCustomTable; /// <summary> /// selectForm control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::CMSAdminControls_UI_UniSelector_UniSelector selectForm; /// <summary> /// lblWhere control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::CMS.Base.Web.UI.LocalizedLabel lblWhere; /// <summary> /// txtWhere control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::CMSFormControls_Inputs_LargeTextArea txtWhere; /// <summary> /// btnOk control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::CMS.FormEngine.Web.UI.FormSubmitButton btnOk; }
32.80531
86
0.585919
[ "MIT" ]
CMeeg/kentico-contrib
src/CMS/CMSModules/SmartSearch/Controls/UI/SearchIndex_OnLineForm_Edit.ascx.designer.cs
3,709
C#
// // AssemblyInfo.cs // // Author: // Lluis Sanchez Gual ([email protected]) // // (C) 2005 Novell, Inc. http://www.novell.com // // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Diagnostics; using System.Reflection; using System.Resources; using System.Security; using System.Security.Permissions; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about the System.Configuration (.Net 2.0 only) assembly [assembly: AssemblyTitle ("System.Configuration.dll")] [assembly: AssemblyDescription ("System.Configuration.dll")] [assembly: AssemblyDefaultAlias ("System.Configuration.dll")] [assembly: AssemblyCompany (Consts.MonoCompany)] [assembly: AssemblyProduct (Consts.MonoProduct)] [assembly: AssemblyCopyright (Consts.MonoCopyright)] [assembly: AssemblyVersion (Consts.FxVersion)] [assembly: SatelliteContractVersion (Consts.FxVersion)] [assembly: AssemblyInformationalVersion (Consts.FxFileVersion)] [assembly: CLSCompliant (true)] [assembly: NeutralResourcesLanguage ("en-US")] [assembly: ComVisible (false)] [assembly: AllowPartiallyTrustedCallers] [assembly: AssemblyDelaySign (true)] [assembly: AssemblyKeyFile ("../msfinal.pub")] [assembly: InternalsVisibleTo ("System.Web, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: AssemblyFileVersion (Consts.FxFileVersion)] [assembly: ComCompatibleVersion (1, 0, 3300, 0)]
42.2
377
0.798396
[ "Apache-2.0" ]
AvolitesMarkDaniel/mono
mcs/class/System.Configuration/Assembly/AssemblyInfo.cs
2,743
C#
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using SkillBuilder.Skills; namespace SkillBuilder { public partial class frmSkillPicker : Form { private SkillPartInfo pickedPart; public frmSkillPicker(List<SkillPartInfo> parts) { InitializeComponent(); cboChoices.Items.Clear(); foreach (SkillPartInfo part in parts) { cboChoices.Items.Add(part); } } public static SkillPartInfo Show(IWin32Window parent, List<SkillPartInfo> parts) { frmSkillPicker form = new frmSkillPicker(parts); form.ShowDialog(parent); return form.pickedPart; } private void cboChoices_SelectedIndexChanged(object sender, EventArgs e) { if (cboChoices.SelectedItem != null) { this.pickedPart = (SkillPartInfo)cboChoices.SelectedItem; } else { this.pickedPart = null; } } private void btnOkay_Click(object sender, EventArgs e) { this.Close(); } private void btnCancel_Click(object sender, EventArgs e) { this.pickedPart = null; this.Close(); } } }
24.95
88
0.575818
[ "MIT" ]
NoahWright87/SkillBuilder
SkillBuilder/frmSkillPicker.cs
1,499
C#
namespace MADE.Networking.Extensions { using System; using System.Collections.Specialized; /// <summary> /// Defines a collection of extensions for <see cref="Uri"/> objects. /// </summary> public static class UriExtensions { /// <summary> /// Gets a value from a query in the specified <paramref name="uri"/> with the specified query parameter key. /// </summary> /// <param name="uri">The <see cref="Uri"/> to extract a query value from.</param> /// <param name="queryParam">The key of the parameter in the query to extract the value for.</param> /// <returns>The value for the query parameter.</returns> public static string GetQueryValue(this Uri uri, string queryParam) { NameValueCollection queryDictionary = System.Web.HttpUtility.ParseQueryString(uri.Query); return queryDictionary.Get(queryParam); } } }
40.913043
117
0.643996
[ "MIT" ]
jamesmcroft/MS-MVP-API-PCL
samples/MVP.Api.TestApp/Extensions/UriExtensions.cs
941
C#
using System; namespace Biletix.Models { public class Item { public string Id { get; set; } public string Text { get; set; } public string Description { get; set; } } }
18.727273
47
0.57767
[ "MIT" ]
Fumigatus/Biletix-Clone
Biletix/Biletix/Models/Item.cs
208
C#
using FluentBehave; using System.Collections.Generic; using Bibliotheca.Server.ServiceDiscovery.ServiceClient.Model; using System.Threading.Tasks; using Xunit; using System.Linq; namespace Bibliotheca.Server.ServiceDiscovery.ServiceClient.Specs.Implementations { [Feature("ServiceDiscoveryQueryGetServicesByTags", "Getting service by tags have to return correct information about services")] public class ServiceDiscoveryQueryGetServicesByTags { private IList<ServiceDto> _services; [Scenario("Service discovery application should return information about registered services when user get service by tag")] public async Task ServiceDiscoveryApplicationShouldReturnInformationAboutRegisteredServicesWhenUserGetServiceByTag() { GivenServiceDiscoveryApplicationIsUpAndRunning(); await GivenApplicationIsRegisteredWithTag("fake-getbytag-id1", "tag1"); await GivenApplicationIsRegisteredWithTag("fake-getbytag-id2", "tag1"); await GivenApplicationIsRegisteredWithTag("fake-getbytag-id3", "tag2"); await GivenApplicationIsRegisteredWithTag("fake-getbytag-id4", "tag3"); await WhenUserGetInformationAboutServicesWithTag("tag1"); ThenApplicationWithIdExistsOnList("fake-getbytag-id1"); ThenApplicationWithIdExistsOnList("fake-getbytag-id2"); } [Given("Service discovery application is up and running")] private void GivenServiceDiscoveryApplicationIsUpAndRunning() { } [Given("Application is registered with tag")] private async Task GivenApplicationIsRegisteredWithTag(string serviceId, string tag) { var options = new ServiceDiscoveryOptions(); options.ServiceOptions.Id = serviceId; options.ServiceOptions.Name = "Fake name"; options.ServiceOptions.Address = "10.1.1.1"; options.ServiceOptions.Port = 5555; options.ServiceOptions.HttpHealthCheck = string.Empty; options.ServiceOptions.Tags = new List<string>() { tag }; options.ServerOptions.Address = "http://127.0.0.1:8500"; var serviceDiscovery = new ServiceDiscoveryClient(null); await serviceDiscovery.RegisterAsync(options); } [When("User get information about services with tag")] private async Task WhenUserGetInformationAboutServicesWithTag(string tag) { var serviceQuery = new ServiceDiscoveryQuery(null); _services = await serviceQuery.GetServicesAsync(new ServerOptions { Address = "http://127.0.0.1:8500" }, new string[] { tag }); } [Then("Application with id exists on list")] private void ThenApplicationWithIdExistsOnList(string serviceId) { Assert.True(_services.SelectMany(x => x.Instances).Any(y => y.Id == serviceId)); } } }
48.290323
140
0.682699
[ "MIT" ]
mczachurski/Bibliotheca.Server.ServiceDiscovery
test/Bibliotheca.Server.ServiceDiscovery.ServiceClient.Specs/Implementations/ServiceDiscoveryQueryGetServicesByTags.cs
2,994
C#
using System; using Mono.CecilX; using Mono.CecilX.Cil; namespace Mirror.Weaver { public static class PropertySiteProcessor { public static void ProcessSitesModule(ModuleDefinition moduleDef) { DateTime startTime = DateTime.Now; //Search through the types foreach (TypeDefinition td in moduleDef.Types) { if (td.IsClass) { ProcessSiteClass(td); } } if (Weaver.WeaveLists.generateContainerClass != null) { moduleDef.Types.Add(Weaver.WeaveLists.generateContainerClass); Weaver.CurrentAssembly.MainModule.ImportReference(Weaver.WeaveLists.generateContainerClass); foreach (MethodDefinition f in Weaver.WeaveLists.generatedReadFunctions) { Weaver.CurrentAssembly.MainModule.ImportReference(f); } foreach (MethodDefinition f in Weaver.WeaveLists.generatedWriteFunctions) { Weaver.CurrentAssembly.MainModule.ImportReference(f); } } Console.WriteLine(" ProcessSitesModule " + moduleDef.Name + " elapsed time:" + (DateTime.Now - startTime)); } static void ProcessSiteClass(TypeDefinition td) { //Console.WriteLine(" ProcessSiteClass " + td); foreach (MethodDefinition md in td.Methods) { ProcessSiteMethod(td, md); } foreach (TypeDefinition nested in td.NestedTypes) { ProcessSiteClass(nested); } } static void ProcessSiteMethod(TypeDefinition td, MethodDefinition md) { // process all references to replaced members with properties //Weaver.DLog(td, " ProcessSiteMethod " + md); if (md.Name == ".cctor" || md.Name == NetworkBehaviourProcessor.ProcessedFunctionName || md.Name.StartsWith("CallCmd") || md.Name.StartsWith("InvokeCmd") || md.Name.StartsWith("InvokeRpc") || md.Name.StartsWith("InvokeSyn")) return; if (md.Body != null && md.Body.Instructions != null) { // TODO move this to NetworkBehaviourProcessor foreach (CustomAttribute attr in md.CustomAttributes) { switch (attr.Constructor.DeclaringType.ToString()) { case "Mirror.ServerAttribute": InjectServerGuard(td, md, true); break; case "Mirror.ServerCallbackAttribute": InjectServerGuard(td, md, false); break; case "Mirror.ClientAttribute": InjectClientGuard(td, md, true); break; case "Mirror.ClientCallbackAttribute": InjectClientGuard(td, md, false); break; } } for (int iCount= 0; iCount < md.Body.Instructions.Count;) { Instruction instr = md.Body.Instructions[iCount]; iCount += ProcessInstruction(md, instr, iCount); } } } static void InjectServerGuard(TypeDefinition td, MethodDefinition md, bool logWarning) { if (!Weaver.IsNetworkBehaviour(td)) { Log.Error("[Server] guard on non-NetworkBehaviour script at [" + md.FullName + "]"); return; } ILProcessor worker = md.Body.GetILProcessor(); Instruction top = md.Body.Instructions[0]; worker.InsertBefore(top, worker.Create(OpCodes.Call, Weaver.NetworkServerGetActive)); worker.InsertBefore(top, worker.Create(OpCodes.Brtrue, top)); if (logWarning) { worker.InsertBefore(top, worker.Create(OpCodes.Ldstr, "[Server] function '" + md.FullName + "' called on client")); worker.InsertBefore(top, worker.Create(OpCodes.Call, Weaver.logWarningReference)); } InjectGuardParameters(md, worker, top); InjectGuardReturnValue(md, worker, top); worker.InsertBefore(top, worker.Create(OpCodes.Ret)); } static void InjectClientGuard(TypeDefinition td, MethodDefinition md, bool logWarning) { if (!Weaver.IsNetworkBehaviour(td)) { Log.Error("[Client] guard on non-NetworkBehaviour script at [" + md.FullName + "]"); return; } ILProcessor worker = md.Body.GetILProcessor(); Instruction top = md.Body.Instructions[0]; worker.InsertBefore(top, worker.Create(OpCodes.Call, Weaver.NetworkClientGetActive)); worker.InsertBefore(top, worker.Create(OpCodes.Brtrue, top)); if (logWarning) { worker.InsertBefore(top, worker.Create(OpCodes.Ldstr, "[Client] function '" + md.FullName + "' called on server")); worker.InsertBefore(top, worker.Create(OpCodes.Call, Weaver.logWarningReference)); } InjectGuardParameters(md, worker, top); InjectGuardReturnValue(md, worker, top); worker.InsertBefore(top, worker.Create(OpCodes.Ret)); } // replaces syncvar write access with the NetworkXYZ.get property calls static void ProcessInstructionSetterField(MethodDefinition md, Instruction i, FieldDefinition opField) { // dont replace property call sites in constructors if (md.Name == ".ctor") return; // does it set a field that we replaced? if (Weaver.WeaveLists.replacementSetterProperties.TryGetValue(opField, out MethodDefinition replacement)) { //replace with property //DLog(td, " replacing " + md.Name + ":" + i); i.OpCode = OpCodes.Call; i.Operand = replacement; //DLog(td, " replaced " + md.Name + ":" + i); } } // replaces syncvar read access with the NetworkXYZ.get property calls static void ProcessInstructionGetterField(MethodDefinition md, Instruction i, FieldDefinition opField) { // dont replace property call sites in constructors if (md.Name == ".ctor") return; // does it set a field that we replaced? if (Weaver.WeaveLists.replacementGetterProperties.TryGetValue(opField, out MethodDefinition replacement)) { //replace with property //DLog(td, " replacing " + md.Name + ":" + i); i.OpCode = OpCodes.Call; i.Operand = replacement; //DLog(td, " replaced " + md.Name + ":" + i); } } static int ProcessInstruction(MethodDefinition md, Instruction instr, int iCount) { if (instr.OpCode == OpCodes.Call || instr.OpCode == OpCodes.Callvirt) { if (instr.Operand is MethodReference opMethod) { ProcessInstructionMethod(md, instr, opMethod, iCount); } } if (instr.OpCode == OpCodes.Stfld) { // this instruction sets the value of a field. cache the field reference. if (instr.Operand is FieldDefinition opField) { ProcessInstructionSetterField(md, instr, opField); } } if (instr.OpCode == OpCodes.Ldfld) { // this instruction gets the value of a field. cache the field reference. if (instr.Operand is FieldDefinition opField) { ProcessInstructionGetterField(md, instr, opField); } } if (instr.OpCode == OpCodes.Ldflda) { // loading a field by reference, watch out for initobj instruction // see https://github.com/vis2k/Mirror/issues/696 if (instr.Operand is FieldDefinition opField) { return ProcessInstructionLoadAddress(md, instr, opField, iCount); } } return 1; } static int ProcessInstructionLoadAddress(MethodDefinition md, Instruction instr, FieldDefinition opField, int iCount) { // dont replace property call sites in constructors if (md.Name == ".ctor") return 1; // does it set a field that we replaced? if (Weaver.WeaveLists.replacementSetterProperties.TryGetValue(opField, out MethodDefinition replacement)) { // we have a replacement for this property // is the next instruction a initobj? Instruction nextInstr = md.Body.Instructions[iCount + 1]; if (nextInstr.OpCode == OpCodes.Initobj) { // we need to replace this code with: // var tmp = new MyStruct(); // this.set_Networkxxxx(tmp); ILProcessor worker = md.Body.GetILProcessor(); VariableDefinition tmpVariable = new VariableDefinition(opField.FieldType); md.Body.Variables.Add(tmpVariable); worker.InsertBefore(instr, worker.Create(OpCodes.Ldloca, tmpVariable)); worker.InsertBefore(instr, worker.Create(OpCodes.Initobj, opField.FieldType)); worker.InsertBefore(instr, worker.Create(OpCodes.Ldloc, tmpVariable)); worker.InsertBefore(instr, worker.Create(OpCodes.Call, replacement)); worker.Remove(instr); worker.Remove(nextInstr); return 4; } } return 1; } static void ProcessInstructionMethod(MethodDefinition md, Instruction instr, MethodReference opMethodRef, int iCount) { //DLog(td, "ProcessInstructionMethod " + opMethod.Name); if (opMethodRef.Name == "Invoke") { // Events use an "Invoke" method to call the delegate. // this code replaces the "Invoke" instruction with the generated "Call***" instruction which send the event to the server. // but the "Invoke" instruction is called on the event field - where the "call" instruction is not. // so the earlier instruction that loads the event field is replaced with a Noop. // go backwards until find a ldfld instruction that matches ANY event bool found = false; while (iCount > 0 && !found) { iCount -= 1; Instruction inst = md.Body.Instructions[iCount]; if (inst.OpCode == OpCodes.Ldfld) { FieldReference opField = inst.Operand as FieldReference; // find replaceEvent with matching name // NOTE: original weaver compared .Name, not just the MethodDefinition, // that's why we use dict<string,method>. if (Weaver.WeaveLists.replaceEvents.TryGetValue(opField.Name, out MethodDefinition replacement)) { instr.Operand = replacement; inst.OpCode = OpCodes.Nop; found = true; } } } } else { // should it be replaced? // NOTE: original weaver compared .FullName, not just the MethodDefinition, // that's why we use dict<string,method>. if (Weaver.WeaveLists.replaceMethods.TryGetValue(opMethodRef.FullName, out MethodDefinition replacement)) { //DLog(td, " replacing " + md.Name + ":" + i); instr.Operand = replacement; //DLog(td, " replaced " + md.Name + ":" + i); } } } // this is required to early-out from a function with "ref" or "out" parameters static void InjectGuardParameters(MethodDefinition md, ILProcessor worker, Instruction top) { int offset = md.Resolve().IsStatic ? 0 : 1; for (int index = 0; index < md.Parameters.Count; index++) { ParameterDefinition param = md.Parameters[index]; if (param.IsOut) { TypeReference elementType = param.ParameterType.GetElementType(); if (elementType.IsPrimitive) { worker.InsertBefore(top, worker.Create(OpCodes.Ldarg, index + offset)); worker.InsertBefore(top, worker.Create(OpCodes.Ldc_I4_0)); worker.InsertBefore(top, worker.Create(OpCodes.Stind_I4)); } else { md.Body.Variables.Add(new VariableDefinition(elementType)); md.Body.InitLocals = true; worker.InsertBefore(top, worker.Create(OpCodes.Ldarg, index + offset)); worker.InsertBefore(top, worker.Create(OpCodes.Ldloca_S, (byte)(md.Body.Variables.Count - 1))); worker.InsertBefore(top, worker.Create(OpCodes.Initobj, elementType)); worker.InsertBefore(top, worker.Create(OpCodes.Ldloc, md.Body.Variables.Count - 1)); worker.InsertBefore(top, worker.Create(OpCodes.Stobj, elementType)); } } } } // this is required to early-out from a function with a return value. static void InjectGuardReturnValue(MethodDefinition md, ILProcessor worker, Instruction top) { if (md.ReturnType.FullName != Weaver.voidType.FullName) { if (md.ReturnType.IsPrimitive) { worker.InsertBefore(top, worker.Create(OpCodes.Ldc_I4_0)); } else { md.Body.Variables.Add(new VariableDefinition(md.ReturnType)); md.Body.InitLocals = true; worker.InsertBefore(top, worker.Create(OpCodes.Ldloca_S, (byte)(md.Body.Variables.Count - 1))); worker.InsertBefore(top, worker.Create(OpCodes.Initobj, md.ReturnType)); worker.InsertBefore(top, worker.Create(OpCodes.Ldloc, md.Body.Variables.Count - 1)); } } } } }
43.098039
139
0.528662
[ "MIT" ]
Fewes/Mirror
Assets/Mirror/Editor/Weaver/Processors/PropertySiteProcessor.cs
15,386
C#
namespace Bazzigg.Database.Model.Match { public class RecentMatchSummary { public const int RECENT_MATCH_SUMMARY_COUNT = 30; public double WinRate { get; set; } public int Win { get; set; } public int Lose { get; set; } public double AverageRank { get; set; } public string MostPlayedTrack { get; set; } public string MostUsedKartbody { get; set; } } }
28.2
57
0.621749
[ "MIT" ]
bazzi-gg/database
Bazzigg.Database/Model/Match/RecentMatchSummary.cs
425
C#
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. using System; using Brigadier.NET.Builder; using Brigadier.NET.Tree; using FluentAssertions; using NSubstitute; using Xunit; namespace Brigadier.NET.Tests.builder { public class ArgumentBuilderTest { private readonly TestableArgumentBuilder<object> _builder; public ArgumentBuilderTest() { _builder = new TestableArgumentBuilder<object>(); } [Fact] public void TestArguments() { var argument = RequiredArgumentBuilder<object, int>.RequiredArgument("bar", Arguments.Integer()); _builder.Then(argument); _builder.Arguments.Should().HaveCount(1); _builder.Arguments.Should().ContainSingle().Which.Should().Be(argument.Build()); } [Fact] public void TestRedirect(){ var target = Substitute.For<CommandNode<object>>(null, null, null, null, false); _builder.Redirect(target); _builder.RedirectTarget.Should().Be(target); } [Fact] public void testRedirect_withChild(){ var target = Substitute.For<CommandNode<object>>(null, null, null, null, false); _builder.Then(r => r.Literal("foot")); _builder.Invoking(b => b.Redirect(target)) .Should().Throw<InvalidOperationException>(); } [Fact] public void testThen_withRedirect() { var target = Substitute.For<CommandNode<object>>(null, null, null, null, false); _builder.Redirect(target); _builder.Invoking(b => b.Then(r => r.Literal("foot"))) .Should().Throw<InvalidOperationException>(); } internal class TestableArgumentBuilder<TSource> : ArgumentBuilder<TSource, TestableArgumentBuilder<TSource>, CommandNode<TSource>> { public override CommandNode<TSource> Build() { throw new NotImplementedException(); } } } }
27.578125
134
0.724079
[ "MIT" ]
AtomicBlom/Brigadier.NET
Brigadier.NET.Tests/builder/ArgumentBuilderTest.cs
1,765
C#
using System; namespace MeuAppReservedNames { class Program { static void Main(string[] args) { //int internal = 25; // <-- "internal" é uma palavra reservada em c# var text = "Testing"; Console.WriteLine(text.ToLower()); } } }
22.066667
80
0.483384
[ "MIT" ]
NiziulLuizin/EstudosP
FundamentosDoC#/ProgrammingLanguageWithC#/MeuAppReservedNames/Program.cs
334
C#
/* * 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 dms-2016-01-01.normal.json service model. */ using System; using System.Collections.Generic; using System.Xml.Serialization; using System.Text; using System.IO; using System.Net; using Amazon.Runtime; using Amazon.Runtime.Internal; namespace Amazon.DatabaseMigrationService.Model { /// <summary> /// The storage quota has been exceeded. /// </summary> #if !PCL && !NETSTANDARD [Serializable] #endif public partial class StorageQuotaExceededException : AmazonDatabaseMigrationServiceException { /// <summary> /// Constructs a new StorageQuotaExceededException with the specified error /// message. /// </summary> /// <param name="message"> /// Describes the error encountered. /// </param> public StorageQuotaExceededException(string message) : base(message) {} /// <summary> /// Construct instance of StorageQuotaExceededException /// </summary> /// <param name="message"></param> /// <param name="innerException"></param> public StorageQuotaExceededException(string message, Exception innerException) : base(message, innerException) {} /// <summary> /// Construct instance of StorageQuotaExceededException /// </summary> /// <param name="innerException"></param> public StorageQuotaExceededException(Exception innerException) : base(innerException) {} /// <summary> /// Construct instance of StorageQuotaExceededException /// </summary> /// <param name="message"></param> /// <param name="innerException"></param> /// <param name="errorType"></param> /// <param name="errorCode"></param> /// <param name="requestId"></param> /// <param name="statusCode"></param> public StorageQuotaExceededException(string message, Exception innerException, ErrorType errorType, string errorCode, string requestId, HttpStatusCode statusCode) : base(message, innerException, errorType, errorCode, requestId, statusCode) {} /// <summary> /// Construct instance of StorageQuotaExceededException /// </summary> /// <param name="message"></param> /// <param name="errorType"></param> /// <param name="errorCode"></param> /// <param name="requestId"></param> /// <param name="statusCode"></param> public StorageQuotaExceededException(string message, ErrorType errorType, string errorCode, string requestId, HttpStatusCode statusCode) : base(message, errorType, errorCode, requestId, statusCode) {} #if !PCL && !NETSTANDARD /// <summary> /// Constructs a new instance of the StorageQuotaExceededException class with serialized data. /// </summary> /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown.</param> /// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination.</param> /// <exception cref="T:System.ArgumentNullException">The <paramref name="info" /> parameter is null. </exception> /// <exception cref="T:System.Runtime.Serialization.SerializationException">The class name is null or <see cref="P:System.Exception.HResult" /> is zero (0). </exception> protected StorageQuotaExceededException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { } /// <summary> /// Sets the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> with information about the exception. /// </summary> /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown.</param> /// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination.</param> /// <exception cref="T:System.ArgumentNullException">The <paramref name="info" /> parameter is a null reference (Nothing in Visual Basic). </exception> #if BCL35 [System.Security.Permissions.SecurityPermission( System.Security.Permissions.SecurityAction.LinkDemand, Flags = System.Security.Permissions.SecurityPermissionFlag.SerializationFormatter)] #endif [System.Security.SecurityCritical] // These FxCop rules are giving false-positives for this method [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2123:OverrideLinkDemandsShouldBeIdenticalToBase")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2134:MethodsMustOverrideWithConsistentTransparencyFxCopRule")] public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { base.GetObjectData(info, context); } #endif } }
47.830645
178
0.683696
[ "Apache-2.0" ]
JeffAshton/aws-sdk-net
sdk/src/Services/DatabaseMigrationService/Generated/Model/StorageQuotaExceededException.cs
5,931
C#
using System; using System.Collections.Specialized; using NUnit.Framework; namespace HelperSharp.UnitTests { [TestFixture] public class NameValueCollectionExtensionsTest { #region Fields private NameValueCollection m_target; #endregion #region Initialize [TestFixtureSetUp] public void InitializeFixture() { m_target = new NameValueCollection(); m_target.Add("booleanTrue", "true"); m_target.Add("booleanFalse", "false"); m_target.Add("int32", "123"); m_target.Add("single", "1.23"); } #endregion #region Tests [Test] public void GetBoolean_Name_Boolean() { Assert.IsTrue(m_target.GetBoolean("booleanTrue")); Assert.IsFalse(m_target.GetBoolean("booleanFalse")); } [Test] public void GetInt32_Name_Int32() { Assert.AreEqual(123, m_target.GetInt32("int32")); } [Test] public void GetSingle_Name_Single() { Assert.AreEqual(1.23f, m_target.GetSingle("single")); } #endregion } }
24.75
65
0.573232
[ "MIT" ]
eduardobursa/HelperSharp
HelperSharp.UnitTests/NameValueCollectionExtensionsTest.cs
1,188
C#
// 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 namespace DotNetNuke.Services.Tokens { using System.Collections; using System.Data; using System.Web; using DotNetNuke.Common.Utilities; using DotNetNuke.Entities.Host; using DotNetNuke.Entities.Modules; using DotNetNuke.Entities.Portals; using DotNetNuke.Entities.Users; /// <summary> /// The TokenReplace class provides the option to replace tokens formatted /// [object:property] or [object:property|format] or [custom:no] within a string /// with the appropriate current property/custom values. /// Example for Newsletter: 'Dear [user:Displayname],' ==> 'Dear Superuser Account,' /// Supported Token Sources: User, Host, Portal, Tab, Module, Membership, Profile, /// Row, Date, Ticks, ArrayList (Custom), IDictionary. /// </summary> /// <remarks></remarks> public class TokenReplace : BaseCustomTokenReplace { /// <summary> /// Initializes a new instance of the <see cref="TokenReplace"/> class. /// creates a new TokenReplace object for default context. /// </summary> public TokenReplace() : this(Scope.DefaultSettings, null, null, null, Null.NullInteger) { } /// <summary> /// Initializes a new instance of the <see cref="TokenReplace"/> class. /// creates a new TokenReplace object for default context and the current module. /// </summary> /// <param name="moduleID">ID of the current module.</param> public TokenReplace(int moduleID) : this(Scope.DefaultSettings, null, null, null, moduleID) { } /// <summary> /// Initializes a new instance of the <see cref="TokenReplace"/> class. /// creates a new TokenReplace object for custom context. /// </summary> /// <param name="accessLevel">Security level granted by the calling object.</param> public TokenReplace(Scope accessLevel) : this(accessLevel, null, null, null, Null.NullInteger) { } /// <summary> /// Initializes a new instance of the <see cref="TokenReplace"/> class. /// creates a new TokenReplace object for custom context. /// </summary> /// <param name="accessLevel">Security level granted by the calling object.</param> /// <param name="moduleID">ID of the current module.</param> public TokenReplace(Scope accessLevel, int moduleID) : this(accessLevel, null, null, null, moduleID) { } /// <summary> /// Initializes a new instance of the <see cref="TokenReplace"/> class. /// creates a new TokenReplace object for custom context. /// </summary> /// <param name="accessLevel">Security level granted by the calling object.</param> /// <param name="language">Locale to be used for formatting etc.</param> /// <param name="portalSettings">PortalSettings to be used.</param> /// <param name="user">user, for which the properties shall be returned.</param> public TokenReplace(Scope accessLevel, string language, PortalSettings portalSettings, UserInfo user) : this(accessLevel, language, portalSettings, user, Null.NullInteger) { } /// <summary> /// Initializes a new instance of the <see cref="TokenReplace"/> class. /// creates a new TokenReplace object for custom context. /// </summary> /// <param name="accessLevel">Security level granted by the calling object.</param> /// <param name="language">Locale to be used for formatting etc.</param> /// <param name="portalSettings">PortalSettings to be used.</param> /// <param name="user">user, for which the properties shall be returned.</param> /// <param name="moduleID">ID of the current module.</param> public TokenReplace(Scope accessLevel, string language, PortalSettings portalSettings, UserInfo user, int moduleID) { this.CurrentAccessLevel = accessLevel; if (accessLevel != Scope.NoSettings) { DeterminePortal(portalSettings); DetermineUser(user); DetermineLanguage(language); DetermineModule(moduleID); } this.PropertySource["date"] = new DateTimePropertyAccess(); this.PropertySource["datetime"] = new DateTimePropertyAccess(); this.PropertySource["ticks"] = new TicksPropertyAccess(); this.PropertySource["culture"] = new CulturePropertyAccess(); } private void DeterminePortal(PortalSettings portalSettings) { PortalSettings = portalSettings ?? PortalController.Instance.GetCurrentPortalSettings(); } private void DetermineUser(UserInfo user) { AccessingUser = HttpContext.Current != null ? (UserInfo)HttpContext.Current.Items["UserInfo"] : new UserInfo(); User = user ?? AccessingUser; } private void DetermineLanguage(string language) { Language = string.IsNullOrEmpty(language) ? new Localization.Localization().CurrentUICulture : language; } private void DetermineModule(int moduleID) { if (moduleID != Null.NullInteger) ModuleId = moduleID; } /// <summary> /// Gets or sets /sets the current ModuleID to be used for 'User:' token replacement. /// </summary> /// <value>ModuleID (Integer).</value> public int ModuleId { get => TokenContext.Module?.ModuleID ?? Null.NullInteger; set => TokenContext.Module = GetModule(value); } /// <summary> /// Load the module for the Module Token Provider /// </summary> /// <param name="moduleId"></param> /// <returns>The populated ModuleInfo or null</returns> /// <remarks> /// This method is called by the Setter of ModuleId. /// Because of this, it may NOT access ModuleId itself (which will still be -1) but use moduleId (lower case) /// </remarks> private ModuleInfo GetModule(int moduleId) { if (moduleId == TokenContext.Module?.ModuleID) return TokenContext.Module; if (moduleId <= 0) return null; var tab = TokenContext.Tab ?? PortalSettings?.ActiveTab; if (tab != null && tab.TabID > 0) return ModuleController.Instance.GetModule(moduleId, tab.TabID, false); return ModuleController.Instance.GetModule(moduleId, Null.NullInteger, true); } /// <summary> /// Gets or sets the module settings object to use for 'Module:' token replacement. /// </summary> public ModuleInfo ModuleInfo { get => TokenContext.Module; set => TokenContext.Module = value; } /// <summary> /// Gets or sets /sets the portal settings object to use for 'Portal:' token replacement. /// </summary> /// <value>PortalSettings oject.</value> public PortalSettings PortalSettings { get => TokenContext.Portal; set => TokenContext.Portal = value; } /// <summary> /// Gets or sets /sets the user object to use for 'User:' token replacement. /// </summary> /// <value>UserInfo oject.</value> public UserInfo User { get => TokenContext.User; set => TokenContext.User = value; } /// <summary> /// Replaces tokens in sourceText parameter with the property values. /// </summary> /// <param name="sourceText">String with [Object:Property] tokens.</param> /// <returns>string containing replaced values.</returns> public string ReplaceEnvironmentTokens(string sourceText) { return this.ReplaceTokens(sourceText); } /// <summary> /// Replaces tokens in sourceText parameter with the property values. /// </summary> /// <param name="sourceText">String with [Object:Property] tokens.</param> /// <param name="row"></param> /// <returns>string containing replaced values.</returns> public string ReplaceEnvironmentTokens(string sourceText, DataRow row) { var rowProperties = new DataRowPropertyAccess(row); this.PropertySource["field"] = rowProperties; this.PropertySource["row"] = rowProperties; return this.ReplaceTokens(sourceText); } /// <summary> /// Replaces tokens in sourceText parameter with the property values. /// </summary> /// <param name="sourceText">String with [Object:Property] tokens.</param> /// <param name="custom"></param> /// <param name="customCaption"></param> /// <returns>string containing replaced values.</returns> public string ReplaceEnvironmentTokens(string sourceText, ArrayList custom, string customCaption) { this.PropertySource[customCaption.ToLowerInvariant()] = new ArrayListPropertyAccess(custom); return this.ReplaceTokens(sourceText); } /// <summary> /// Replaces tokens in sourceText parameter with the property values. /// </summary> /// <param name="sourceText">String with [Object:Property] tokens.</param> /// <param name="custom">NameValueList for replacing [custom:name] tokens, where 'custom' is specified in next param and name is either thekey or the index number in the string. </param> /// <param name="customCaption">Token name to be used inside token [custom:name].</param> /// <returns>string containing replaced values.</returns> public string ReplaceEnvironmentTokens(string sourceText, IDictionary custom, string customCaption) { this.PropertySource[customCaption.ToLowerInvariant()] = new DictionaryPropertyAccess(custom); return this.ReplaceTokens(sourceText); } /// <summary> /// Replaces tokens in sourceText parameter with the property values. /// </summary> /// <param name="sourceText">String with [Object:Property] tokens.</param> /// <param name="custom">NameValueList for replacing [custom:name] tokens, where 'custom' is specified in next param and name is either thekey or the index number in the string. </param> /// <param name="customCaptions">Token names to be used inside token [custom:name], where 'custom' is one of the values in the string array. </param> /// <returns>string containing replaced values.</returns> public string ReplaceEnvironmentTokens(string sourceText, IDictionary custom, string[] customCaptions) { foreach (var customCaption in customCaptions) { this.PropertySource[customCaption.ToLowerInvariant()] = new DictionaryPropertyAccess(custom); } return this.ReplaceTokens(sourceText); } /// <summary> /// Replaces tokens in sourceText parameter with the property values. /// </summary> /// <param name="sourceText">String with [Object:Property] tokens.</param> /// <param name="custom">NameValueList for replacing [custom:name] tokens, where 'custom' is specified in next param and name is either thekey or the index number in the string. </param> /// <param name="customCaption">Token name to be used inside token [custom:name].</param> /// <param name="row">DataRow, from which field values shall be used for replacement.</param> /// <returns>string containing replaced values.</returns> public string ReplaceEnvironmentTokens(string sourceText, ArrayList custom, string customCaption, DataRow row) { var rowProperties = new DataRowPropertyAccess(row); this.PropertySource["field"] = rowProperties; this.PropertySource["row"] = rowProperties; this.PropertySource[customCaption.ToLowerInvariant()] = new ArrayListPropertyAccess(custom); return this.ReplaceTokens(sourceText); } /// <summary> /// Replaces tokens in sourceText parameter with the property values, skipping environment objects. /// </summary> /// <param name="sourceText">String with [Object:Property] tokens.</param> /// <returns>string containing replaced values.</returns> protected override string ReplaceTokens(string sourceText) { this.InitializePropertySources(); return base.ReplaceTokens(sourceText); } /// <summary> /// setup context by creating appropriate objects. /// </summary> /// <remarks > /// security is not the purpose of the initialization, this is in the responsibility of each property access class. /// </remarks> private void InitializePropertySources() { // Cleanup, by default "" is returned for these objects and any property IPropertyAccess defaultPropertyAccess = new EmptyPropertyAccess(); this.PropertySource["portal"] = defaultPropertyAccess; this.PropertySource["tab"] = defaultPropertyAccess; this.PropertySource["host"] = defaultPropertyAccess; this.PropertySource["module"] = defaultPropertyAccess; this.PropertySource["user"] = defaultPropertyAccess; this.PropertySource["membership"] = defaultPropertyAccess; this.PropertySource["profile"] = defaultPropertyAccess; // initialization if (this.CurrentAccessLevel >= Scope.Configuration) { if (this.PortalSettings != null) { this.PropertySource["portal"] = this.PortalSettings; this.PropertySource["tab"] = this.PortalSettings.ActiveTab; } this.PropertySource["host"] = new HostPropertyAccess(); if (this.ModuleInfo != null) { this.PropertySource["module"] = this.ModuleInfo; } } if (this.CurrentAccessLevel >= Scope.DefaultSettings && !(this.User == null || this.User.UserID == -1)) { this.PropertySource["user"] = this.User; this.PropertySource["membership"] = new MembershipPropertyAccess(this.User); this.PropertySource["profile"] = new ProfilePropertyAccess(this.User); } } } }
45.736364
194
0.613728
[ "MIT" ]
Acidburn0zzz/Dnn.Platform
DNN Platform/Library/Services/Tokens/TokenReplace.cs
15,095
C#
/* * Copyright 2020 Sage Intacct, 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 * * 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. */ namespace Intacct.SDK.Functions.Common.NewQuery.QueryOrderBy { public class OrderAscending : AbstractOrderDirection { private const string Ascending = "ascending"; public OrderAscending(string fieldName) : base(fieldName) { } protected override string GetDirection() { return Ascending; } } }
30.516129
80
0.678647
[ "Apache-2.0" ]
Intacct/intacct-sdk-net
Intacct.SDK/Functions/Common/NewQuery/QueryOrderBy/OrderAscending.cs
946
C#
namespace ThuHoach.Sessions.Dto { public class GetCurrentLoginInformationsOutput { public ApplicationInfoDto Application { get; set; } public UserLoginInfoDto User { get; set; } public TenantLoginInfoDto Tenant { get; set; } } }
22.333333
59
0.675373
[ "MIT" ]
nguyenvanchuong98/thuhoach
aspnet-core/src/ThuHoach.Application/Sessions/Dto/GetCurrentLoginInformationsOutput.cs
270
C#
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated from a template. // // Manual changes to this file may cause unexpected behavior in your application. // Manual changes to this file will be overwritten if the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace ParcInfo { using System; using System.Collections.Generic; public partial class Installer { public int id { get; set; } public Nullable<System.DateTime> Dateexpiration { get; set; } public Nullable<int> Idhardsoft { get; set; } public Nullable<int> Idproduitclient { get; set; } public Nullable<System.DateTime> Datecreation { get; set; } public Nullable<System.DateTime> Datemodification { get; set; } public Nullable<int> Creepar { get; set; } public Nullable<int> Modifierpar { get; set; } public int IsDeleted { get; set; } public virtual Utilisateur Utilisateur { get; set; } public virtual ProduitClient ProduitClient { get; set; } public virtual ProduitClient ProduitClient1 { get; set; } public virtual Utilisateur Utilisateur1 { get; set; } } }
40.060606
85
0.578669
[ "MIT" ]
driwand/ParcInfo-Dev
ParcInfo/Installer.cs
1,322
C#
#pragma warning disable 108 // new keyword hiding #pragma warning disable 114 // new keyword hiding namespace Windows.UI.StartScreen { #if false || false || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ [global::Uno.NotImplemented] #endif public partial class JumpListItem { #if false || false || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ [global::Uno.NotImplemented("NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public global::System.Uri Logo { get { throw new global::System.NotImplementedException("The member Uri JumpListItem.Logo is not implemented in Uno."); } set { global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.StartScreen.JumpListItem", "Uri JumpListItem.Logo"); } } #endif #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public string GroupName { get { throw new global::System.NotImplementedException("The member string JumpListItem.GroupName is not implemented in Uno."); } set { global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.StartScreen.JumpListItem", "string JumpListItem.GroupName"); } } #endif #if false || false || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ [global::Uno.NotImplemented("NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public string DisplayName { get { throw new global::System.NotImplementedException("The member string JumpListItem.DisplayName is not implemented in Uno."); } set { global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.StartScreen.JumpListItem", "string JumpListItem.DisplayName"); } } #endif #if false || false || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ [global::Uno.NotImplemented("NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public string Description { get { throw new global::System.NotImplementedException("The member string JumpListItem.Description is not implemented in Uno."); } set { global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.StartScreen.JumpListItem", "string JumpListItem.Description"); } } #endif #if false || false || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ [global::Uno.NotImplemented("NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public string Arguments { get { throw new global::System.NotImplementedException("The member string JumpListItem.Arguments is not implemented in Uno."); } } #endif #if false || false || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ [global::Uno.NotImplemented("NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public global::Windows.UI.StartScreen.JumpListItemKind Kind { get { throw new global::System.NotImplementedException("The member JumpListItemKind JumpListItem.Kind is not implemented in Uno."); } } #endif #if false || false || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ [global::Uno.NotImplemented("NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public bool RemovedByUser { get { throw new global::System.NotImplementedException("The member bool JumpListItem.RemovedByUser is not implemented in Uno."); } } #endif // Forced skipping of method Windows.UI.StartScreen.JumpListItem.Kind.get // Forced skipping of method Windows.UI.StartScreen.JumpListItem.Arguments.get // Forced skipping of method Windows.UI.StartScreen.JumpListItem.RemovedByUser.get // Forced skipping of method Windows.UI.StartScreen.JumpListItem.Description.get // Forced skipping of method Windows.UI.StartScreen.JumpListItem.Description.set // Forced skipping of method Windows.UI.StartScreen.JumpListItem.DisplayName.get // Forced skipping of method Windows.UI.StartScreen.JumpListItem.DisplayName.set // Forced skipping of method Windows.UI.StartScreen.JumpListItem.GroupName.get // Forced skipping of method Windows.UI.StartScreen.JumpListItem.GroupName.set // Forced skipping of method Windows.UI.StartScreen.JumpListItem.Logo.get // Forced skipping of method Windows.UI.StartScreen.JumpListItem.Logo.set #if false || false || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ [global::Uno.NotImplemented("NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public static global::Windows.UI.StartScreen.JumpListItem CreateWithArguments( string arguments, string displayName) { throw new global::System.NotImplementedException("The member JumpListItem JumpListItem.CreateWithArguments(string arguments, string displayName) is not implemented in Uno."); } #endif #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public static global::Windows.UI.StartScreen.JumpListItem CreateSeparator() { throw new global::System.NotImplementedException("The member JumpListItem JumpListItem.CreateSeparator() is not implemented in Uno."); } #endif } }
45.373984
177
0.74019
[ "Apache-2.0" ]
AbdalaMask/uno
src/Uno.UWP/Generated/3.0.0.0/Windows.UI.StartScreen/JumpListItem.cs
5,581
C#
namespace ForumNet.Services.Reactions { using System.Linq; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using Data; using Data.Models; using Data.Models.Enums; public class PostReactionsService : IPostReactionsService { private readonly ForumDbContext db; private readonly IDateTimeProvider dateTimeProvider; public PostReactionsService(ForumDbContext db, IDateTimeProvider dateTimeProvider) { this.db = db; this.dateTimeProvider = dateTimeProvider; } public async Task ReactAsync(ReactionType reactionType, int postId, string authorId) { var postReaction = await this.db.PostReactions .FirstOrDefaultAsync(pr => pr.PostId == postId && pr.AuthorId == authorId); if (postReaction == null) { postReaction = new PostReaction { ReactionType = reactionType, PostId = postId, AuthorId = authorId, CreatedOn = this.dateTimeProvider.Now() }; await this.db.PostReactions.AddAsync(postReaction); } else { postReaction.ModifiedOn = this.dateTimeProvider.Now(); postReaction.ReactionType = postReaction.ReactionType == reactionType ? ReactionType.Neutral : reactionType; } await this.db.SaveChangesAsync(); } public async Task<int> GetTotalCountAsync() => await this.db.PostReactions .Where(pr => !pr.Post.IsDeleted) .CountAsync(); public async Task<ReactionsCountServiceModel> GetCountByPostIdAsync(int postId) => new ReactionsCountServiceModel { Likes = await this.GetCountByTypeAndPostIdAsync(ReactionType.Like, postId), Loves = await this.GetCountByTypeAndPostIdAsync(ReactionType.Love, postId), HahaCount = await this.GetCountByTypeAndPostIdAsync(ReactionType.Haha, postId), WowCount = await this.GetCountByTypeAndPostIdAsync(ReactionType.Wow, postId), SadCount = await this.GetCountByTypeAndPostIdAsync(ReactionType.Sad, postId), AngryCount = await this.GetCountByTypeAndPostIdAsync(ReactionType.Angry, postId) }; private async Task<int> GetCountByTypeAndPostIdAsync(ReactionType reactionType, int postId) => await this.db.PostReactions .Where(pr => !pr.Post.IsDeleted && pr.PostId == postId) .CountAsync(pr => pr.ReactionType == reactionType); } }
38.541667
100
0.602883
[ "MIT" ]
AnthonyDisasi/ForumNet
Services/ForumNet.Services/Reactions/PostReactionsService.cs
2,777
C#
using UnityEngine; using System.Collections; using NFSDK; using UnityStandardAssets.Cameras; using UnityStandardAssets.CrossPlatformInput; using UnityStandardAssets.Characters.ThirdPerson; public class MainPlayer : MonoBehaviour { // Use this for initialization private float mSyncTime = 1.0f; private float mSyncTimeTick = 0.0f; private FreeLookCam mCamera; private Vector3 m_LastMove; private ThirdPersonCharacter m_Character; // A reference to the ThirdPersonCharacter on the object private Transform m_Cam; // A reference to the main camera in the scenes transform private Vector3 m_CamForward; // The current forward direction of the camera private Vector3 m_Move; private bool m_Jump; // the world-relative desired move direction, calculated from the camForward and user input. void Start () { mCamera = GameObject.Find("FreeLookCameraRig").GetComponent<FreeLookCam>(); mCamera.SetTarget(transform); // get the transform of the main camera if (Camera.main != null) { m_Cam = Camera.main.transform; } else { Debug.LogWarning( "Warning: no main camera found. Third person character needs a Camera tagged \"MainCamera\", for camera-relative controls."); // we use self-relative controls in this case, which probably isn't what the user wants, but hey, we warned them! } // get the third person character ( this should never be null due to require component ) m_Character = GetComponent<ThirdPersonCharacter>(); } private void Update() { if (!m_Jump) { m_Jump = CrossPlatformInputManager.GetButtonDown("Jump"); } } // Update is called once per frame void FixedUpdate() { // read inputs float h = CrossPlatformInputManager.GetAxis("Horizontal"); float v = CrossPlatformInputManager.GetAxis("Vertical"); bool crouch = Input.GetKey(KeyCode.C); // calculate move direction to pass to character if (m_Cam != null) { // calculate camera relative direction to move: m_CamForward = Vector3.Scale(m_Cam.forward, new Vector3(1, 0, 1)).normalized; m_Move = v * m_CamForward + h * m_Cam.right; } else { // we use world-relative directions in the case of no main camera m_Move = v * Vector3.forward + h * Vector3.right; } #if !MOBILE_INPUT // walk speed multiplier if (Input.GetKey(KeyCode.LeftShift)) m_Move *= 0.5f; #endif // pass all parameters to the character control script m_Character.Move(m_Move, crouch, m_Jump); m_Jump = false; // 同步坐标给服务器 bool bMove = false; if((h != 0.0f || v != 0.0f)) bMove = true; if (mSyncTimeTick > mSyncTime || (mSyncTimeTick > 0 && !bMove) || m_LastMove != m_Move) { NFCPlayerLogic.Instance().RequireMove(transform.position); mSyncTimeTick = 0.0f; } if (bMove) { mSyncTimeTick += Time.deltaTime; } m_LastMove = m_Move; } }
33.89899
142
0.601907
[ "Apache-2.0" ]
Kuovane/NoahGameFrame
NFClient/UnitySDK/Assets/NF/Scene/MainPlayer.cs
3,374
C#
// In Package Manager, run: // Install-Package Twilio.AspNet.Mvc -DependencyVersion HighestMinor using System.Web.Mvc; using Twilio.AspNet.Mvc; using Twilio.TwiML; public class SmsController : TwilioController { [HttpPost] public ActionResult Index() { var messagingResponse = new MessagingResponse(); messagingResponse.Message("The Robots are coming! Head for the hills!"); return TwiML(messagingResponse); } }
23.947368
80
0.716484
[ "MIT" ]
berkus/twilio-api-snippets
rest/messages/generate-twiml-sms/generate-twiml-sms.5.x.cs
455
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Ancora { public enum ParserFlags { NONE = 0, PASSTHROUGH = 1, FLATTEN = 2, VALUE = 4, IGNORE_LEADING_WHITESPACE = 8, IGNORE_TRAILING_WHITESPACE = 16, CREATE_AST = 32, } public abstract class Parser { public static Parser WhitespaceParser = new Parsers.Maybe(new Parsers.Token(c => "\t\r\n ".Contains(c))); internal String AstNodeType = null; internal ParserFlags Flags = ParserFlags.NONE; internal String _Name = null; internal ParseResult Fail(String Message, CompoundFailure SubFailures = null) { Failure failReason = SubFailures; if (failReason == null) failReason = new Failure(this, Message); else { failReason.FailedAt = this; failReason.Message = Message; } return new ParseResult { ResultType = ResultType.Failure, FailReason = failReason }; } #region Flag Modifiers public Parser Name(String Name) { var r = this.Clone(); r._Name = Name; return r; } public Parser CreateAst(String AstNodeType) { var r = this.Clone(); r.Flags |= ParserFlags.CREATE_AST; r.AstNodeType = AstNodeType; return r; } public Parser Flatten() { var r = this.Clone(); r.Flags |= ParserFlags.FLATTEN; return r; } public Parser Value() { var r = this.Clone(); r.Flags |= ParserFlags.VALUE; return r; } public Parser PassThrough() { var r = this.Clone(); r.Flags |= ParserFlags.PASSTHROUGH; return r; } public Parser IgnoreLeadingWhitespace() { var r = this.Clone(); r.Flags |= ParserFlags.IGNORE_LEADING_WHITESPACE; return r; } public Parser IgnoreTrailingWhitespace() { var r = this.Clone(); r.Flags |= ParserFlags.IGNORE_TRAILING_WHITESPACE; return r; } #endregion protected Parser Clone() { var r = this.ImplementClone(); r.Flags = Flags; r.AstNodeType = AstNodeType; return r; } public ParseResult Parse(StringIterator InputStream) { if ((Flags & ParserFlags.IGNORE_LEADING_WHITESPACE) == ParserFlags.IGNORE_LEADING_WHITESPACE) InputStream = Parser.WhitespaceParser.Parse(InputStream).StreamState; var r = ImplementParse(InputStream); if (r.ResultType == ResultType.Success && (Flags & ParserFlags.IGNORE_TRAILING_WHITESPACE) == ParserFlags.IGNORE_TRAILING_WHITESPACE) r.StreamState = Parser.WhitespaceParser.Parse(r.StreamState).StreamState; return r; } protected abstract ParseResult ImplementParse(StringIterator InputStream); protected abstract Parser ImplementClone(); #region Construction Ops public static Parsers.Sequence operator +(Parser LHS, Parser RHS) { return new Parsers.Sequence(LHS, RHS); } public static Parsers.Sequence operator +(Parser LHS, char RHS) { return new Parsers.Sequence(LHS, new Parsers.Character(RHS)); } public static Parsers.Sequence operator +(char LHS, Parser RHS) { return new Parsers.Sequence(new Parsers.Character(LHS), RHS); } public static Parsers.Sequence operator +(Parser LHS, String RHS) { return new Parsers.Sequence(LHS, new Parsers.KeyWord(RHS)); } public static Parsers.Alternative operator |(Parser LHS, Parser RHS) { return new Parsers.Alternative(LHS, RHS); } public static Parsers.Alternative operator |(Parser LHS, char RHS) { return new Parsers.Alternative(LHS, new Parsers.Character(RHS)); } #endregion } }
27.840764
145
0.560055
[ "MIT" ]
Blecki/Ancora
Ancora/Parser.cs
4,373
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace StrategyMode { class Test { // Just to give an example public void TestMode(string type) { Strategy strategy; switch (type) { case "A": strategy = new Context(new ConcreteStrategyA()).Strategy; break; case "B": strategy = new Context(new ConcreteStrategyB()).Strategy; break; case "C": strategy = new Context(new ConcreteStrategyC()).Strategy; break; default: strategy = new Context(new ConcreteStrategyA()).Strategy; break; } strategy.AlgorithmInterface(); } } }
26.314286
77
0.488599
[ "Unlicense" ]
xbfighting/LearnDesignPatterns
DesignPatternsPractices/StrategyMode/Test.cs
923
C#
using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; namespace Kalendar.Zero.ApiTerminal.Clients.Response { [Serializable] [DataContract] public class MsonlineRecurrenceRange { [DataMember(Name = "type")] public string Type { get; set; } [DataMember(Name = "startDate")] public string StartDate { get; set; } [DataMember(Name = "endDate")] public string EndDate { get; set; } [DataMember(Name = "recurrenceTimeZone")] public string RecurrenceTimeZone { get; set; } [DataMember(Name = "numberOfOccurrences")] public int NumberOfOccurrences { get; set; } } }
24.125
54
0.650259
[ "MIT" ]
karl-rao/Kalendar
Libraries/ApiTerminal/Clients/Response/MsonlineRecurrenceRange.cs
774
C#
// Copyright (c) MarinAtanasov. All rights reserved. // Licensed under the MIT License (MIT). See License.txt in the project root for license information. using AppBrix.Configuration; using AppBrix.Data.SqlServer; using AppBrix.Data.SqlServer.Configuration; namespace AppBrix; /// <summary> /// Extension methods for the <see cref="SqlServerDataModule"/>. /// </summary> public static class SqlServerDataExtensions { /// <summary> /// Gets the <see cref="SqlServerDataConfig"/> from <see cref="IConfigService"/>. /// </summary> /// <param name="service">The configuration service.</param> /// <returns>The <see cref="SqlServerDataConfig"/>.</returns> public static SqlServerDataConfig GetSqlServerDataConfig(this IConfigService service) => (SqlServerDataConfig)service.Get(typeof(SqlServerDataConfig)); }
37.818182
155
0.740385
[ "MIT" ]
MarinAtanasov/AppBrix
Modules/AppBrix.Data.SqlServer/SqlServerDataExtensions.cs
832
C#
using System.Threading.Tasks; namespace Zaaby.MessageBus.RabbitMQ { public interface IZaabyMessagePublisher { void Publish<TMessage>(TMessage message); Task PublishAsync<TMessage>(TMessage message); } }
23.1
54
0.722944
[ "MIT" ]
Mutuduxf/Zaaby
src/Messaging/Zaaby.MessageBus.RabbitMQ/IZaabyMessagePublisher.cs
231
C#
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Runtime.CompilerServices; using System.Diagnostics.CodeAnalysis; namespace System.Diagnostics.Tracing { [EventSource(Guid = "8E9F5090-2D75-4d03-8A81-E5AFBF85DAF1", Name = "System.Diagnostics.Eventing.FrameworkEventSource")] [EventSourceAutoGenerate] internal sealed partial class FrameworkEventSource : EventSource { #if !ES_BUILD_STANDALONE private const string EventSourceSuppressMessage = "Parameters to this method are primitive and are trimmer safe"; #endif public static readonly FrameworkEventSource Log = new FrameworkEventSource(); // Keyword definitions. These represent logical groups of events that can be turned on and off independently // Often each task has a keyword, but where tasks are determined by subsystem, keywords are determined by // usefulness to end users to filter. Generally users don't mind extra events if they are not high volume // so grouping low volume events together in a single keywords is OK (users can post-filter by task if desired) public static class Keywords { public const EventKeywords ThreadPool = (EventKeywords)0x0002; public const EventKeywords ThreadTransfer = (EventKeywords)0x0010; } /// <summary>ETW tasks that have start/stop events.</summary> public static class Tasks // this name is important for EventSource { /// <summary>Send / Receive - begin transfer/end transfer</summary> public const EventTask ThreadTransfer = (EventTask)3; } // Parameterized constructor to block initialization and ensure the EventSourceGenerator is creating the default constructor // as you can't make a constructor partial. private FrameworkEventSource(int _) { } // optimized for common signatures (used by the ThreadTransferSend/Receive events) #if !ES_BUILD_STANDALONE [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern", Justification = EventSourceSuppressMessage)] #endif [NonEvent] private unsafe void WriteEvent(int eventId, long arg1, int arg2, string? arg3, bool arg4, int arg5, int arg6) { if (IsEnabled()) { arg3 ??= ""; fixed (char* string3Bytes = arg3) { EventSource.EventData* descrs = stackalloc EventSource.EventData[6]; descrs[0].DataPointer = (IntPtr)(&arg1); descrs[0].Size = 8; descrs[0].Reserved = 0; descrs[1].DataPointer = (IntPtr)(&arg2); descrs[1].Size = 4; descrs[1].Reserved = 0; descrs[2].DataPointer = (IntPtr)string3Bytes; descrs[2].Size = ((arg3.Length + 1) * 2); descrs[2].Reserved = 0; descrs[3].DataPointer = (IntPtr)(&arg4); descrs[3].Size = 4; descrs[3].Reserved = 0; descrs[4].DataPointer = (IntPtr)(&arg5); descrs[4].Size = 4; descrs[4].Reserved = 0; descrs[5].DataPointer = (IntPtr)(&arg6); descrs[5].Size = 4; descrs[5].Reserved = 0; WriteEventCore(eventId, 6, descrs); } } } // optimized for common signatures (used by the ThreadTransferSend/Receive events) #if !ES_BUILD_STANDALONE [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern", Justification = EventSourceSuppressMessage)] #endif [NonEvent] private unsafe void WriteEvent(int eventId, long arg1, int arg2, string? arg3) { if (IsEnabled()) { arg3 ??= ""; fixed (char* string3Bytes = arg3) { EventSource.EventData* descrs = stackalloc EventSource.EventData[3]; descrs[0].DataPointer = (IntPtr)(&arg1); descrs[0].Size = 8; descrs[0].Reserved = 0; descrs[1].DataPointer = (IntPtr)(&arg2); descrs[1].Size = 4; descrs[1].Reserved = 0; descrs[2].DataPointer = (IntPtr)string3Bytes; descrs[2].Size = ((arg3.Length + 1) * 2); descrs[2].Reserved = 0; WriteEventCore(eventId, 3, descrs); } } } [Event(30, Level = EventLevel.Verbose, Keywords = Keywords.ThreadPool | Keywords.ThreadTransfer)] public void ThreadPoolEnqueueWork(long workID) { WriteEvent(30, workID); } // The object's current location in memory was being used before. Since objects can be moved, it may be difficult to // associate Enqueue/Dequeue events with the object's at-the-time location in memory, the ETW listeners would have to // know specifics about the events and track GC movements to associate events. The hash code is a stable value and // easier to use for association, though there may be collisions. [NonEvent] [MethodImpl(MethodImplOptions.NoInlining)] public void ThreadPoolEnqueueWorkObject(object workID) => ThreadPoolEnqueueWork(workID.GetHashCode()); [Event(31, Level = EventLevel.Verbose, Keywords = Keywords.ThreadPool | Keywords.ThreadTransfer)] public void ThreadPoolDequeueWork(long workID) { WriteEvent(31, workID); } // The object's current location in memory was being used before. Since objects can be moved, it may be difficult to // associate Enqueue/Dequeue events with the object's at-the-time location in memory, the ETW listeners would have to // know specifics about the events and track GC movements to associate events. The hash code is a stable value and // easier to use for association, though there may be collisions. [NonEvent] [MethodImpl(MethodImplOptions.NoInlining)] public void ThreadPoolDequeueWorkObject(object workID) => ThreadPoolDequeueWork(workID.GetHashCode()); // id - represents a correlation ID that allows correlation of two activities, one stamped by // ThreadTransferSend, the other by ThreadTransferReceive // kind - identifies the transfer: values below 64 are reserved for the runtime. Currently used values: // 1 - managed Timers ("roaming" ID) // 2 - managed async IO operations (FileStream, PipeStream, a.o.) // 3 - WinRT dispatch operations // info - any additional information user code might consider interesting // intInfo1/2 - any additional integer information user code might consider interesting [Event(150, Level = EventLevel.Informational, Keywords = Keywords.ThreadTransfer, Task = Tasks.ThreadTransfer, Opcode = EventOpcode.Send)] public void ThreadTransferSend(long id, int kind, string info, bool multiDequeues, int intInfo1, int intInfo2) { WriteEvent(150, id, kind, info, multiDequeues, intInfo1, intInfo2); } // id - is a managed object's hash code [NonEvent] public void ThreadTransferSendObj(object id, int kind, string info, bool multiDequeues, int intInfo1, int intInfo2) => ThreadTransferSend(id.GetHashCode(), kind, info, multiDequeues, intInfo1, intInfo2); // id - represents a correlation ID that allows correlation of two activities, one stamped by // ThreadTransferSend, the other by ThreadTransferReceive // - The object's current location in memory was being used before. Since objects can be moved, it may be difficult to // associate Enqueue/Dequeue events with the object's at-the-time location in memory, the ETW listeners would have to // know specifics about the events and track GC movements to associate events. The hash code is a stable value and // easier to use for association, though there may be collisions. // kind - identifies the transfer: values below 64 are reserved for the runtime. Currently used values: // 1 - managed Timers ("roaming" ID) // 2 - managed async IO operations (FileStream, PipeStream, a.o.) // 3 - WinRT dispatch operations // info - any additional information user code might consider interesting [Event(151, Level = EventLevel.Informational, Keywords = Keywords.ThreadTransfer, Task = Tasks.ThreadTransfer, Opcode = EventOpcode.Receive)] public void ThreadTransferReceive(long id, int kind, string? info) { WriteEvent(151, id, kind, info); } // id - is a managed object. it gets translated to the object's address. // - The object's current location in memory was being used before. Since objects can be moved, it may be difficult to // associate Enqueue/Dequeue events with the object's at-the-time location in memory, the ETW listeners would have to // know specifics about the events and track GC movements to associate events. The hash code is a stable value and // easier to use for association, though there may be collisions. [NonEvent] public void ThreadTransferReceiveObj(object id, int kind, string? info) => ThreadTransferReceive(id.GetHashCode(), kind, info); } }
55.337079
149
0.632183
[ "MIT" ]
AUTOMATE-2001/runtime
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/FrameworkEventSource.cs
9,850
C#
using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using OnLineShop.Data.Models.Contracts; namespace OnLineShop.Data.Models { public class Address : IDbModel { public const int StreetMinLength = 2; public const int StreetMaxLength = 100; public ICollection<ContactInfo> contactInfo; public Address() { this.contactInfo = new HashSet<ContactInfo>(); } public int Id { get; set; } [Required] [MinLength(StreetMinLength)] [MaxLength(StreetMaxLength)] [RegularExpression(Utils.Constants.EnBgSpaceMinus)] public string AddressLine { get; set; } public string PostCode { get; set; } [ForeignKey("Town")] public int TownId { get; set; } public virtual Town Town { get; set; } //public virtual ContactInfo ContactInfo { get; set; } public bool IsDeleted { get; set; } } }
25.9
62
0.642857
[ "MIT" ]
dushka-dragoeva/OnLineShop
OnLineShop/OnLineShop.Data.Models/Address.cs
1,038
C#
using System; using System.Collections.Generic; using System.Text; namespace NoCommons.Banking { /** * This class calculates valid Kontonummer instances. */ public class KontonummerCalculator { private static List<Kontonummer> GetKontonummerListUsingGenerator(KontonummerDigitGenerator generator, int length) { var result = new List<Kontonummer>(); int numAddedToList = 0; while (numAddedToList < length) { Kontonummer kontoNr; try { kontoNr = KontonummerValidator.GetAndForceValidKontonummer(generator.GenerateKontonummer()); } catch (ArgumentException) { // this number has no valid checksum continue; } result.Add(kontoNr); numAddedToList++; } return result; } /** * Returns a List with random but syntactically valid Kontonummer instances * for a given AccountType. * * @param accountType * A String representing the AccountType to use for all * Kontonummer instances * @param length * Specifies the number of Kontonummer instances to create in the * returned List * @return A List with Kontonummer instances */ public static List<Kontonummer> GetKontonummerListForAccountType(string accountType, int length) { KontonummerValidator.ValidateAccountTypeSyntax(accountType); return GetKontonummerListUsingGenerator(new AccountTypeKontonrDigitGenerator(accountType), length); } /** * Returns a List with random but syntactically valid Kontonummer instances * for a given Registernummer. * * @param registernummer * A String representing the Registernummer to use for all * Kontonummer instances * @param length * Specifies the number of Kontonummer instances to create in the * returned List * @return A List with Kontonummer instances */ public static List<Kontonummer> GetKontonummerListForRegisternummer(string registernummer, int length) { KontonummerValidator.ValidateRegisternummerSyntax(registernummer); return GetKontonummerListUsingGenerator(new RegisternummerKontonrDigitGenerator(registernummer), length); } /** * Returns a List with completely random but syntactically valid Kontonummer * instances. * * @param length * Specifies the number of Kontonummer instances to create in the * returned List * * @return A List with random valid Kontonummer instances */ public static List<Kontonummer> GetKontonummerList(int length) { return GetKontonummerListUsingGenerator(new NormalKontonrDigitGenerator(), length); } } internal abstract class KontonummerDigitGenerator { protected const int REGISTERNUMMER_START_DIGIT = 0; protected const int LENGTH = 11; internal abstract string GenerateKontonummer(); } internal class AccountTypeKontonrDigitGenerator : KontonummerDigitGenerator { private const int ACCOUNTTYPE_START_DIGIT = 4; private readonly string _accountType; internal AccountTypeKontonrDigitGenerator(String accountType) { _accountType = accountType; } internal override string GenerateKontonummer() { var kontonrBuffer = new StringBuilder(LENGTH); for (var i = 0; i < LENGTH; ) { if (i == ACCOUNTTYPE_START_DIGIT) { kontonrBuffer.Append(_accountType); i += _accountType.Length; } else { var randomNum = new Random(); var ran = randomNum.Next(0, 10); kontonrBuffer.Append(ran); i++; } } return kontonrBuffer.ToString(); } } internal class RegisternummerKontonrDigitGenerator : KontonummerDigitGenerator { private readonly string _registerNr; internal RegisternummerKontonrDigitGenerator(String registerNr) { _registerNr = registerNr; } internal override string GenerateKontonummer() { var kontonrBuffer = new StringBuilder(LENGTH); for (int i = 0; i < LENGTH; ) { if (i == REGISTERNUMMER_START_DIGIT) { kontonrBuffer.Append(_registerNr); i += _registerNr.Length; } else { var rand = new Random(); var ran = rand.Next(0, 10); kontonrBuffer.Append(ran); i++; } } return kontonrBuffer.ToString(); } } internal class NormalKontonrDigitGenerator : KontonummerDigitGenerator { internal override string GenerateKontonummer() { var kontonrBuffer = new StringBuilder(LENGTH); for (int i = 0; i < LENGTH; i++) { var random = new Random(); var ran = random.Next(0, 10); kontonrBuffer.Append(ran); } return kontonrBuffer.ToString(); } } }
32.817143
122
0.561727
[ "MIT" ]
alnimin/NoCommonsNET
NoCommons/Banking/KontonummerCalculator.cs
5,745
C#
using CnAppForAzureDev.ViewModels; using System; using System.Collections.Generic; using System.Linq; using System.Security.Claims; using System.Threading.Tasks; namespace CnAppForAzureDev.ViewServices { public interface ICatalogItemViewService { Task<IEnumerable<CatalogItemViewModel>> GetCatalogItemsAsync(ClaimsPrincipal user); Task<IEnumerable<CatalogItemViewModel>> GetCatalogItemsWhenNewItemWasAddedAsync(ClaimsPrincipal user); } }
29.25
110
0.807692
[ "MIT" ]
flyingoverclouds/CloudNativeAppDansAzure
Episode_1/STEP_4_MESSAGING/src/WebAppUI/ViewServices/ICatalogItemViewService.cs
470
C#
using Newtonsoft.Json.Linq; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; namespace fbchat_sharp.API { /// <summary> /// Facebook messenger group class /// </summary> public class FB_Group : FB_Thread { /// Unique list (set) of the group thread"s participants public ISet<FB_Thread> participants { get; set; } /// Dict, containing user nicknames mapped to their IDs public Dictionary<string, string> nicknames { get; set; } /// A `ThreadColor`. The groups"s message color public string color { get; set; } /// The groups"s default emoji public JToken emoji { get; set; } /// Set containing user IDs of thread admins public ISet<string> admins { get; set; } /// True if users need approval to join public bool approval_mode { get; set; } /// Set containing user IDs requesting to join public ISet<string> approval_requests { get; set; } /// Link for joining group public string join_link { get; set; } /// <summary> /// Represents a Facebook group. Inherits `Thread` /// </summary> /// <param name="uid"></param> /// <param name="session"></param> /// <param name="photo"></param> /// <param name="name"></param> /// <param name="message_count"></param> /// <param name="last_message_timestamp"></param> /// <param name="plan"></param> /// <param name="participants"></param> /// <param name="nicknames"></param> /// <param name="color"></param> /// <param name="emoji"></param> /// <param name="admins"></param> /// <param name="approval_mode"></param> /// <param name="approval_requests"></param> /// <param name="join_link"></param> public FB_Group(string uid, Session session, FB_Image photo = null, string name = null, int message_count = 0, string last_message_timestamp = null, FB_Plan plan = null, ISet<FB_Thread> participants = null, Dictionary<string, string> nicknames = null, string color = null, JToken emoji = null, ISet<string> admins = null, bool approval_mode = false, ISet<string> approval_requests = null, string join_link = null) : base(uid, session, photo, name, message_count: message_count, last_message_timestamp: last_message_timestamp, plan: plan) { this.participants = participants ?? new HashSet<FB_Thread>(); this.nicknames = nicknames ?? new Dictionary<string, string>(); this.color = color ?? ThreadColor.MESSENGER_BLUE; this.emoji = emoji; this.admins = admins ?? new HashSet<string>(); this.approval_mode = approval_mode; this.approval_requests = approval_requests ?? new HashSet<string>(); this.join_link = join_link; } /// <summary> /// Represents a Facebook group. Inherits `Thread` /// </summary> /// <param name="uid"></param> /// <param name="session"></param> public FB_Group(string uid, Session session) : base(uid, session) { } internal override FB_Thread _copy() { return new FB_Group(session: this.session, uid: this.uid); } internal static FB_Group _from_graphql(Session session, JToken data) { if (data.get("image") == null) data["image"] = new JObject(new JProperty("uri", "")); var c_info = FB_Group._parse_customization_info(data); var last_message_timestamp = data.get("last_message")?.get("nodes")?.FirstOrDefault()?.get("timestamp_precise")?.Value<string>(); var plan = data.get("event_reminders")?.get("nodes")?.FirstOrDefault() != null ? FB_Plan._from_graphql(data.get("event_reminders")?.get("nodes")?.FirstOrDefault(), session) : null; return new FB_Group( uid: data.get("thread_key")?.get("thread_fbid")?.Value<string>(), session: session, participants: new HashSet<FB_Thread>(FB_Thread._parse_participants(data.get("all_participants"), session)), nicknames: (Dictionary<string, string>)c_info.GetValueOrDefault("nicknames"), color: (string)c_info.GetValueOrDefault("color"), emoji: (JToken)c_info.GetValueOrDefault("emoji"), admins: new HashSet<string>(data.get("thread_admins")?.Select(node => node.get("id")?.Value<string>())), approval_mode: data.get("approval_mode")?.Value<bool>() ?? false, approval_requests: data.get("group_approval_queue") != null ? new HashSet<string>(data.get("group_approval_queue")?.get("nodes")?.Select(node => node.get("requester")?.get("id")?.Value<string>())) : null, photo: FB_Image._from_uri_or_none(data?.get("image")), name: data.get("name")?.Value<string>(), message_count: data.get("messages_count")?.Value<int>() ?? 0, last_message_timestamp: last_message_timestamp, plan: plan); } internal override Dictionary<string, object> _to_send_data() { return new Dictionary<string, object>() { { "thread_fbid", this.uid } }; } /// <summary> /// Add users to the group. /// If the group's approval mode is set to require admin approval, and you're not an /// admin, the participants won't actually be added, they will be set as pending. /// In that case, the returned `ParticipantsAdded` event will not be correct. /// Args: /// user_ids: One or more user IDs to add /// Example: /// >>> group.add_participants(["1234", "2345"]) /// </summary> /// <param name="user_ids">One or more user IDs to add</param> /// <returns></returns> public async Task<FB_ParticipantsAdded> addParticipants(List<string> user_ids) { var data = this._to_send_data(); data["action_type"] = "ma-type:log-message"; data["log_message_type"] = "log:subscribe"; var uuser_ids = Utils.require_list<string>(user_ids); foreach (var obj in user_ids.Select((x, index) => new { user_id = x, i = index })) { if (obj.user_id == this.session.user.uid) throw new FBchatUserError( "Error when adding users: Cannot add self to group thread" ); else data[ string.Format("log_message_data[added_participants][{0}]", obj.i) ] = string.Format("fbid:{0}", obj.user_id); } var req = await this.session._do_send_request(data); return FB_ParticipantsAdded._from_send(thread: this, added_ids: user_ids); } /// <summary> /// Remove user from the group. /// If the group's approval mode is set to require admin approval, and you're not an /// admin, this will fail. /// Args: /// user_id: User ID to remove /// Example: /// >>> group.remove_participant("1234") /// </summary> /// <param name="user_id">User ID to remove</param> /// <returns></returns> public async Task<FB_ParticipantRemoved> removeParticipant(string user_id) { /* * Removes users from a group. * :param user_id: User ID to remove * :raises: FBchatException if request failed * */ var data = new Dictionary<string, object>() { { "uid", user_id }, { "tid", this.uid } }; var j = await this.session._payload_post("/chat/remove_participants/", data); return FB_ParticipantRemoved._from_send(thread: this, removed_id: user_id); } /// <summary> /// Leave the group. /// This will succeed regardless of approval mode and admin status. /// Example: /// >>> group.leave() /// </summary> /// <returns></returns> public async Task<FB_ParticipantRemoved> leave() { return await this.removeParticipant(this.session.user.uid); } private async Task _adminStatus(List<string> admin_ids, bool admin) { var data = new Dictionary<string, object>() { { "add", admin.ToString() }, { "thread_fbid", this.uid } }; var uadmin_ids = Utils.require_list<string>(admin_ids); foreach (var obj in admin_ids.Select((x, index) => new { admin_id = x, i = index })) data[string.Format("admin_ids[{0}]", obj.i)] = obj.admin_id; var j = await this.session._payload_post("/messaging/save_admins/?dpr=1", data); } /// <summary> /// Sets specifed users as group admins. /// </summary> /// <param name="admin_ids">One or more user IDs to set admin</param> /// <returns></returns> public async Task addAdmins(List<string> admin_ids) { /* * Sets specifed users as group admins. * :param admin_ids: One or more user IDs to set admin * :raises: FBchatException if request failed * */ await this._adminStatus(admin_ids, true); } /// <summary> /// Removes admin status from specifed users. /// </summary> /// <param name="admin_ids">One or more user IDs to remove admin</param> /// <returns></returns> public async Task removeAdmins(List<string> admin_ids) { /* * Removes admin status from specifed users. * :param admin_ids: One or more user IDs to remove admin * :raises: FBchatException if request failed * */ await this._adminStatus(admin_ids, false); } /// <summary> /// Changes group's approval mode /// </summary> /// <param name="require_admin_approval">true or false</param> /// <returns></returns> public async Task changeApprovalMode(bool require_admin_approval) { /* * Changes group's approval mode * :param require_admin_approval: true or false * :raises: FBchatException if request failed * */ var data = new Dictionary<string, object>() { { "set_mode", require_admin_approval ? 1 : 0 }, { "thread_fbid", this.uid } }; var j = await this.session._payload_post("/messaging/set_approval_mode/?dpr=1", data); } private async Task _usersApproval(List<string> user_ids, bool approve) { var uuser_ids = Utils.require_list<string>(user_ids).ToList(); var data = new Dictionary<string, object>(){ { "client_mutation_id", "0"}, { "actor_id", this.session.user.uid }, { "thread_fbid", this.uid }, { "user_ids", user_ids }, { "response", approve ? "ACCEPT" : "DENY"}, { "surface", "ADMIN_MODEL_APPROVAL_CENTER"} }; var j = await this.session.graphql_request( GraphQL.from_doc_id("1574519202665847", new Dictionary<string, object>(){ { "data", data} }) ); } /// <summary> /// Accepts users to the group from the group's approval /// </summary> /// <param name="user_ids">One or more user IDs to accept</param> /// <returns></returns> public async Task acceptUsers(List<string> user_ids) { /* * Accepts users to the group from the group's approval * :param user_ids: One or more user IDs to accept * :raises: FBchatException if request failed * */ await this._usersApproval(user_ids, true); } /// <summary> /// Denies users from the group 's approval /// </summary> /// <param name="user_ids">One or more user IDs to deny</param> /// <returns></returns> public async Task denyUsers(List<string> user_ids) { /* * Denies users from the group 's approval * :param user_ids: One or more user IDs to deny * :raises: FBchatException if request failed * */ await this._usersApproval(user_ids, false); } /// <summary> /// Changes title of a thread. /// </summary> /// <param name="title">New group thread title</param> /// <returns></returns> public async Task<FB_TitleSet> changeTitle(string title) { /* * Changes title of a thread. * If this is executed on a user thread, this will change the nickname of that user, effectively changing the title * :param title: New group thread title * : raises: FBchatException if request failed * */ var data = new Dictionary<string, object>() { { "thread_name", title }, { "thread_id", this.uid } }; var j = await this.session._payload_post("/messaging/set_thread_name/?dpr=1", data); return new FB_TitleSet() { author = this.session.user, thread = this._copy() as FB_Group, title = title, at = Utils.now() }; } /// <summary> /// Changes a thread image from an image id /// </summary> /// <param name="image_id">ID of uploaded image</param> /// <returns></returns> public async Task<string> _changeImage(string image_id) { /* * Changes a thread image from an image id * :param image_id: ID of uploaded image * :raises: FBchatException if request failed * */ var data = new Dictionary<string, object>() { { "thread_image_id", image_id }, { "thread_id", this.uid } }; var j = await this.session._payload_post("/messaging/set_thread_image/?dpr=1", data); return image_id; } /// <summary> /// Changes a thread image from a URL /// </summary> /// <param name="image_url">URL of an image to upload and change</param> /// <returns></returns> public async Task<string> changeImageRemote(string image_url) { /* * Changes a thread image from a URL * :param image_url: URL of an image to upload and change * :raises: FBchatException if request failed * */ var upl = await this.session._upload(await this.session.get_files_from_urls(new HashSet<string>() { image_url })); return await this._changeImage(upl[0].mimeKey); } /// <summary> /// Changes a thread image from a local path /// </summary> /// <param name="image_path">Path of an image to upload and change</param> /// <param name="image_stream"></param> /// <returns></returns> public async Task<string> changeImageLocal(string image_path, Stream image_stream) { /* * Changes a thread image from a local path * :param image_path: Path of an image to upload and change * :raises: FBchatException if request failed * */ var files = this.session.get_files_from_paths(new Dictionary<string, Stream>() { { image_path, image_stream } }); var upl = await this.session._upload(files); return await this._changeImage(upl[0].mimeKey); } } }
43.782967
421
0.563343
[ "BSD-3-Clause" ]
DD2XAlpha/fbchat-sharp
fbchat-sharp/API/Threads/Group.cs
15,939
C#
// ------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. // ------------------------------------------------------------------------------ // **NOTE** This file was generated by a tool and any changes will be overwritten. // <auto-generated/> // Template Source: Templates\CSharp\Requests\IEntityCollectionRequestBuilder.cs.tt namespace Microsoft.Graph { using System; using System.Collections.Generic; /// <summary> /// The interface IAndroidForWorkScepCertificateProfileManagedDeviceCertificateStatesCollectionRequestBuilder. /// </summary> public partial interface IAndroidForWorkScepCertificateProfileManagedDeviceCertificateStatesCollectionRequestBuilder : IBaseRequestBuilder { /// <summary> /// Builds the request. /// </summary> /// <returns>The built request.</returns> IAndroidForWorkScepCertificateProfileManagedDeviceCertificateStatesCollectionRequest Request(); /// <summary> /// Builds the request. /// </summary> /// <param name="options">The query and header options for the request.</param> /// <returns>The built request.</returns> IAndroidForWorkScepCertificateProfileManagedDeviceCertificateStatesCollectionRequest Request(IEnumerable<Option> options); /// <summary> /// Gets an <see cref="IManagedDeviceCertificateStateRequestBuilder"/> for the specified ManagedDeviceCertificateState. /// </summary> /// <param name="id">The ID for the ManagedDeviceCertificateState.</param> /// <returns>The <see cref="IManagedDeviceCertificateStateRequestBuilder"/>.</returns> IManagedDeviceCertificateStateRequestBuilder this[string id] { get; } } }
45.714286
153
0.655208
[ "MIT" ]
OfficeGlobal/msgraph-beta-sdk-dotnet
src/Microsoft.Graph/Requests/Generated/IAndroidForWorkScepCertificateProfileManagedDeviceCertificateStatesCollectionRequestBuilder.cs
1,920
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace StrategyPattern { /// <summary> /// Context class /// </summary> public class SearchList { private ISearchStrategy objISearchStrategy; public void SetSearchStrategy(ISearchStrategy objSearchStrategy) { objISearchStrategy = objSearchStrategy; } public void Search(int[] list, int item) { int postion = objISearchStrategy.Search(list, item); Console.WriteLine("Position of the item: " + item + " is " + postion); } } }
21.2
82
0.617925
[ "MIT" ]
mahedee/code-sample
StrategyPattern/StrategyPattern/StrategyPattern/SearchList.cs
638
C#
using System; using System.Net; namespace nUpdate.Internal.Core { public class WebRequestWrapper { /// <summary> /// Initializes a new WebRequest instance for the specified URI scheme. /// </summary> /// <param name="requestUri">A Uri containing the URI of the requested resource.</param> /// <returns>A WebRequest descendant for the specified URI scheme.</returns> /// <exception cref="NotSupportedException">The request scheme specified in requestUri is not registered.</exception> /// <exception cref="ArgumentNullException">requestUri is null.</exception> /// <exception cref="SecurityException">The caller does not have WebPermissionAttribute permission to connect to the requested URI or a URI that the request is redirected to.</exception> public static WebRequest Create(Uri requestUri) { var request = (HttpWebRequest) WebRequest.Create(requestUri); request.UserAgent = HttpHeader.GetUserAgent(); return request; } } }
44.583333
194
0.676636
[ "MIT" ]
dbforge/nUpdate
nUpdate.Internal/Core/WebRequestWrapper.cs
1,072
C#
namespace Cluster.Batch.Impl { internal class Program { private static void Main(string[] args) { RunExe.Run(); } } }
21.857143
49
0.555556
[ "Apache-2.0" ]
NakedObjectsGroup/Clusters
Cluster.Batch.Impl/Program.cs
153
C#
using System.Collections.Generic; using UnityEngine; #if UNITY_EDITOR using UnityEditor; using UnityEngine.AI; #endif namespace MyBox { public class ColliderGizmo : MonoBehaviour { #if UNITY_EDITOR public Presets Preset; public Color CustomWireColor; public Color CustomFillColor; public Color CustomCenterColor; public float Alpha = 1.0f; public Color WireColor = new Color(.6f, .6f, 1f, .5f); public Color FillColor = new Color(.6f, .7f, 1f, .1f); public Color CenterColor = new Color(.6f, .7f, 1f, .7f); public bool DrawFill = true; public bool DrawWire = true; public bool DrawCenter; /// <summary> /// The radius of the center marker on your collider(s) /// </summary> public float CenterMarkerRadius = 1.0f; public bool IncludeChildColliders; private NavMeshObstacle _navMeshObstacle; private List<EdgeCollider2D> _edgeColliders2D; private List<BoxCollider2D> _boxColliders2D; private List<CircleCollider2D> _circleColliders2D; private List<BoxCollider> _boxColliders; private List<SphereCollider> _sphereColliders; private List<MeshCollider> _meshColliders; private readonly HashSet<Transform> _withColliders = new HashSet<Transform>(); private Color _wireGizmoColor; private Color _fillGizmoColor; private Color _centerGizmoColor; private bool _initialized; private void OnDrawGizmos() { if (!enabled) return; if (!_initialized) Refresh(); DrawColliders(); } #region Refresh public void Refresh() { _initialized = true; _wireGizmoColor = new Color(WireColor.r, WireColor.g, WireColor.b, WireColor.a * Alpha); _fillGizmoColor = new Color(FillColor.r, FillColor.g, FillColor.b, FillColor.a * Alpha); _centerGizmoColor = new Color(CenterColor.r, CenterColor.g, CenterColor.b, CenterColor.a * Alpha); _withColliders.Clear(); if (_edgeColliders2D != null) _edgeColliders2D.Clear(); if (_boxColliders2D != null) _boxColliders2D.Clear(); if (_circleColliders2D != null) _circleColliders2D.Clear(); if (_boxColliders != null) _boxColliders.Clear(); if (_sphereColliders != null) _sphereColliders.Clear(); if (_meshColliders != null) _meshColliders.Clear(); _navMeshObstacle = gameObject.GetComponent<NavMeshObstacle>(); Collider2D[] colliders2d = IncludeChildColliders ? gameObject.GetComponentsInChildren<Collider2D>() : gameObject.GetComponents<Collider2D>(); Collider[] colliders = IncludeChildColliders ? gameObject.GetComponentsInChildren<Collider>() : gameObject.GetComponents<Collider>(); for (var i = 0; i < colliders2d.Length; i++) { var c = colliders2d[i]; var box2d = c as BoxCollider2D; if (box2d != null) { if (_boxColliders2D == null) _boxColliders2D = new List<BoxCollider2D>(); _boxColliders2D.Add(box2d); _withColliders.Add(box2d.transform); continue; } var edge = c as EdgeCollider2D; if (edge != null) { if (_edgeColliders2D == null) _edgeColliders2D = new List<EdgeCollider2D>(); _edgeColliders2D.Add(edge); _withColliders.Add(edge.transform); continue; } var circle2d = c as CircleCollider2D; if (circle2d != null) { if (_circleColliders2D == null) _circleColliders2D = new List<CircleCollider2D>(); _circleColliders2D.Add(circle2d); _withColliders.Add(circle2d.transform); } } for (var i = 0; i < colliders.Length; i++) { var c = colliders[i]; var box = c as BoxCollider; if (box != null) { if (_boxColliders == null) _boxColliders = new List<BoxCollider>(); _boxColliders.Add(box); _withColliders.Add(box.transform); continue; } var sphere = c as SphereCollider; if (sphere != null) { if (_sphereColliders == null) _sphereColliders = new List<SphereCollider>(); _sphereColliders.Add(sphere); _withColliders.Add(sphere.transform); } var mesh = c as MeshCollider; if (mesh != null) { if (_meshColliders == null) _meshColliders = new List<MeshCollider>(); _meshColliders.Add(mesh); _withColliders.Add(mesh.transform); } } } #endregion #region Drawers private void DrawEdgeCollider2D(EdgeCollider2D coll) { var target = coll.transform; var lossyScale = target.lossyScale; var position = target.position; Gizmos.color = WireColor; Vector3 previous = Vector2.zero; bool first = true; for (int i = 0; i < coll.points.Length; i++) { var collPoint = coll.points[i]; Vector3 pos = new Vector3(collPoint.x * lossyScale.x, collPoint.y * lossyScale.y, 0); Vector3 rotated = target.rotation * pos; if (first) first = false; else { Gizmos.color = _wireGizmoColor; Gizmos.DrawLine(position + previous, position + rotated); } previous = rotated; DrawColliderGizmo(target.position + rotated, .05f); } } private void DrawBoxCollider2D(BoxCollider2D coll) { var target = coll.transform; Gizmos.matrix = Matrix4x4.TRS(target.position, target.rotation, target.lossyScale); DrawColliderGizmo(coll.offset, coll.size); Gizmos.matrix = Matrix4x4.identity; } private void DrawBoxCollider(BoxCollider coll) { var target = coll.transform; Gizmos.matrix = Matrix4x4.TRS(target.position, target.rotation, target.lossyScale); DrawColliderGizmo(coll.center, coll.size); Gizmos.matrix = Matrix4x4.identity; } private void DrawCircleCollider2D(CircleCollider2D coll) { var target = coll.transform; var offset = coll.offset; var scale = target.lossyScale; DrawColliderGizmo(target.position + new Vector3(offset.x, offset.y, 0.0f), coll.radius * Mathf.Max(scale.x, scale.y)); } private void DrawSphereCollider(SphereCollider coll) { var target = coll.transform; var scale = target.lossyScale; var center = coll.center; var max = Mathf.Max(scale.x, Mathf.Max(scale.y, scale.z)); // to not use Mathf.Max version with params[] DrawColliderGizmo(target.position + new Vector3(center.x, center.y, 0.0f), coll.radius * max); } private void DrawMeshCollider(MeshCollider coll) { var target = coll.transform; if (DrawWire) { Gizmos.color = _wireGizmoColor; Gizmos.DrawWireMesh(coll.sharedMesh, target.position, target.rotation, target.localScale * 1.01f); } if (DrawFill) { Gizmos.color = _fillGizmoColor; Gizmos.DrawMesh(coll.sharedMesh, target.position, target.rotation, target.localScale * 1.01f); } } private void DrawNavMeshObstacle(NavMeshObstacle obstacle) { var target = obstacle.transform; if (obstacle.shape == NavMeshObstacleShape.Box) { Gizmos.matrix = Matrix4x4.TRS(target.position, target.rotation, target.lossyScale); DrawColliderGizmo(obstacle.center, obstacle.size); Gizmos.matrix = Matrix4x4.identity; } else { var scale = target.lossyScale; var center = obstacle.center; var max = Mathf.Max(scale.x, Mathf.Max(scale.y, scale.z)); // to not use Mathf.Max version with params[] DrawColliderGizmo(target.position + new Vector3(center.x, center.y, 0.0f), obstacle.radius * max); } } private void DrawColliders() { if (DrawCenter) { Gizmos.color = _centerGizmoColor; foreach (var withCollider in _withColliders) { Gizmos.DrawSphere(withCollider.position, CenterMarkerRadius); } } if (!DrawWire && !DrawFill) return; if (_navMeshObstacle != null) DrawNavMeshObstacle(_navMeshObstacle); if (_edgeColliders2D != null) { foreach (var edge in _edgeColliders2D) { if (edge == null) continue; DrawEdgeCollider2D(edge); } } if (_boxColliders2D != null) { foreach (var box in _boxColliders2D) { if (box == null) continue; DrawBoxCollider2D(box); } } if (_circleColliders2D != null) { foreach (var circle in _circleColliders2D) { if (circle == null) continue; DrawCircleCollider2D(circle); } } if (_boxColliders != null) { foreach (var box in _boxColliders) { if (box == null) continue; DrawBoxCollider(box); } } if (_sphereColliders != null) { foreach (var sphere in _sphereColliders) { if (sphere == null) continue; DrawSphereCollider(sphere); } } if (_meshColliders != null) { foreach (var mesh in _meshColliders) { if (mesh == null) continue; DrawMeshCollider(mesh); } } } private void DrawColliderGizmo(Vector3 position, Vector3 size) { if (DrawWire) { Gizmos.color = _wireGizmoColor; Gizmos.DrawWireCube(position, size); } if (DrawFill) { Gizmos.color = _fillGizmoColor; Gizmos.DrawCube(position, size); } } private void DrawColliderGizmo(Vector3 position, float radius) { if (DrawWire) { Gizmos.color = _wireGizmoColor; Gizmos.DrawWireSphere(position, radius); } if (DrawFill) { Gizmos.color = _fillGizmoColor; Gizmos.DrawSphere(position, radius); } } #endregion #region Change Preset public enum Presets { Custom, Red, Blue, Green, Purple, Yellow, Aqua, White, Lilac, DirtySand } public void ChangePreset(Presets preset) { Preset = preset; switch (Preset) { case Presets.Red: WireColor = new Color32(143, 0, 21, 202); FillColor = new Color32(218, 0, 0, 37); CenterColor = new Color32(135, 36, 36, 172); break; case Presets.Blue: WireColor = new Color32(0, 116, 214, 202); FillColor = new Color32(0, 110, 218, 37); CenterColor = new Color32(57, 160, 221, 172); break; case Presets.Green: WireColor = new Color32(153, 255, 187, 128); FillColor = new Color32(153, 255, 187, 62); CenterColor = new Color32(153, 255, 187, 172); break; case Presets.Purple: WireColor = new Color32(138, 138, 234, 128); FillColor = new Color32(173, 178, 255, 26); CenterColor = new Color32(153, 178, 255, 172); break; case Presets.Yellow: WireColor = new Color32(255, 231, 35, 128); FillColor = new Color32(255, 252, 153, 100); CenterColor = new Color32(255, 242, 84, 172); break; case Presets.DirtySand: WireColor = new Color32(255, 170, 0, 60); FillColor = new Color32(180, 160, 80, 175); CenterColor = new Color32(255, 242, 84, 172); break; case Presets.Aqua: WireColor = new Color32(255, 255, 255, 120); FillColor = new Color32(0, 230, 255, 140); CenterColor = new Color32(255, 255, 255, 120); break; case Presets.White: WireColor = new Color32(255, 255, 255, 130); FillColor = new Color32(255, 255, 255, 130); CenterColor = new Color32(255, 255, 255, 130); break; case Presets.Lilac: WireColor = new Color32(255, 255, 255, 255); FillColor = new Color32(160, 190, 255, 140); CenterColor = new Color32(255, 255, 255, 130); break; case Presets.Custom: WireColor = CustomWireColor; FillColor = CustomFillColor; CenterColor = CustomCenterColor; break; } Refresh(); } #endregion #endif } #if UNITY_EDITOR namespace MyBox.Internal { [CustomEditor(typeof(ColliderGizmo)), CanEditMultipleObjects] public class ColliderGizmoEditor : Editor { private SerializedProperty _enabledProperty; private SerializedProperty _alphaProperty; private SerializedProperty _drawWireProperty; private SerializedProperty _wireColorProperty; private SerializedProperty _drawFillProperty; private SerializedProperty _fillColorProperty; private SerializedProperty _drawCenterProperty; private SerializedProperty _centerColorProperty; private SerializedProperty _centerRadiusProperty; private SerializedProperty _includeChilds; private ColliderGizmo _target; private int _collidersCount; private void OnEnable() { _target = target as ColliderGizmo; _enabledProperty = serializedObject.FindProperty("m_Enabled"); _alphaProperty = serializedObject.FindProperty("Alpha"); _drawWireProperty = serializedObject.FindProperty("DrawWire"); _wireColorProperty = serializedObject.FindProperty("WireColor"); _drawFillProperty = serializedObject.FindProperty("DrawFill"); _fillColorProperty = serializedObject.FindProperty("FillColor"); _drawCenterProperty = serializedObject.FindProperty("DrawCenter"); _centerColorProperty = serializedObject.FindProperty("CenterColor"); _centerRadiusProperty = serializedObject.FindProperty("CenterMarkerRadius"); _includeChilds = serializedObject.FindProperty("IncludeChildColliders"); _collidersCount = CollidersCount(); } public override void OnInspectorGUI() { Undo.RecordObject(_target, "CG_State"); EditorGUILayout.PropertyField(_enabledProperty); EditorGUI.BeginChangeCheck(); _target.Preset = (ColliderGizmo.Presets) EditorGUILayout.EnumPopup("Color Preset", _target.Preset); if (EditorGUI.EndChangeCheck()) { foreach (var singleTarget in targets) { var gizmo = (ColliderGizmo) singleTarget; gizmo.ChangePreset(_target.Preset); EditorUtility.SetDirty(gizmo); } } _alphaProperty.floatValue = EditorGUILayout.Slider("Overall Transparency", _alphaProperty.floatValue, 0, 1); EditorGUI.BeginChangeCheck(); using (new EditorGUILayout.HorizontalScope()) { EditorGUILayout.PropertyField(_drawWireProperty); if (_drawWireProperty.boolValue) EditorGUILayout.PropertyField(_wireColorProperty, new GUIContent("")); } using (new EditorGUILayout.HorizontalScope()) { EditorGUILayout.PropertyField(_drawFillProperty); if (_drawFillProperty.boolValue) EditorGUILayout.PropertyField(_fillColorProperty, new GUIContent("")); } using (new EditorGUILayout.HorizontalScope()) { EditorGUILayout.PropertyField(_drawCenterProperty); if (_drawCenterProperty.boolValue) { EditorGUILayout.PropertyField(_centerColorProperty, GUIContent.none); EditorGUILayout.PropertyField(_centerRadiusProperty); } } if (EditorGUI.EndChangeCheck()) { var presetProp = serializedObject.FindProperty("Preset"); var customWireColor = serializedObject.FindProperty("CustomWireColor"); var customFillColor = serializedObject.FindProperty("CustomFillColor"); var customCenterColor = serializedObject.FindProperty("CustomCenterColor"); presetProp.enumValueIndex = (int) ColliderGizmo.Presets.Custom; customWireColor.colorValue = _wireColorProperty.colorValue; customFillColor.colorValue = _fillColorProperty.colorValue; customCenterColor.colorValue = _centerColorProperty.colorValue; } EditorGUILayout.PropertyField(_includeChilds); int collidersCountCheck = CollidersCount(); bool collidersCountChanged = collidersCountCheck != _collidersCount; _collidersCount = collidersCountCheck; if (GUI.changed || collidersCountChanged) { serializedObject.ApplyModifiedProperties(); EditorUtility.SetDirty(_target); _target.Refresh(); } } private int CollidersCount() { if (_includeChilds.boolValue) { return _target.gameObject.GetComponentsInChildren<Collider>().Length + _target.gameObject.GetComponentsInChildren<Collider2D>().Length; } return _target.gameObject.GetComponents<Collider>().Length + _target.gameObject.GetComponents<Collider2D>().Length; } } } #endif }
26.752151
144
0.69163
[ "CC0-1.0" ]
juanFrancoSalcedo/Pitacos
PitacosMaths/Assets/External Assests/MyBox-master/Types/ColliderGizmo.cs
15,545
C#
/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 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. * * Neither the name of the OpenSimulator Project nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``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 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. */ using log4net; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Server.Base; using OpenSim.Server.Handlers.Base; using OpenSim.Services.Interfaces; using System; using System.Collections.Generic; using System.Net; using System.Reflection; namespace OpenSim.Server.Handlers.Inventory { public class InventoryServiceInConnector : ServiceConnector { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected IInventoryService m_InventoryService; private bool m_doLookup = false; //private static readonly int INVENTORY_DEFAULT_SESSION_TIME = 30; // secs //private AuthedSessionCache m_session_cache = new AuthedSessionCache(INVENTORY_DEFAULT_SESSION_TIME); private string m_userserver_url; protected string m_ConfigName = "InventoryService"; public InventoryServiceInConnector(IConfigSource config, IHttpServer server, string configName) : base(config, server, configName) { if (configName != string.Empty) m_ConfigName = configName; IConfig serverConfig = config.Configs[m_ConfigName]; if (serverConfig == null) throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); string inventoryService = serverConfig.GetString("LocalServiceModule", String.Empty); if (inventoryService == String.Empty) throw new Exception("No LocalServiceModule in config file"); Object[] args = new Object[] { config }; m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(inventoryService, args); m_userserver_url = serverConfig.GetString("UserServerURI", String.Empty); m_doLookup = serverConfig.GetBoolean("SessionAuthentication", false); AddHttpHandlers(server); m_log.Debug("[INVENTORY HANDLER]: handlers initialized"); } protected virtual void AddHttpHandlers(IHttpServer m_httpServer) { m_httpServer.AddStreamHandler( new RestDeserialiseSecureHandler<Guid, List<InventoryFolderBase>>( "POST", "/SystemFolders/", GetSystemFolders, CheckAuthSession)); m_httpServer.AddStreamHandler( new RestDeserialiseSecureHandler<Guid, InventoryCollection>( "POST", "/GetFolderContent/", GetFolderContent, CheckAuthSession)); m_httpServer.AddStreamHandler( new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( "POST", "/UpdateFolder/", m_InventoryService.UpdateFolder, CheckAuthSession)); m_httpServer.AddStreamHandler( new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( "POST", "/MoveFolder/", m_InventoryService.MoveFolder, CheckAuthSession)); m_httpServer.AddStreamHandler( new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( "POST", "/PurgeFolder/", m_InventoryService.PurgeFolder, CheckAuthSession)); m_httpServer.AddStreamHandler( new RestDeserialiseSecureHandler<List<Guid>, bool>( "POST", "/DeleteFolders/", DeleteFolders, CheckAuthSession)); m_httpServer.AddStreamHandler( new RestDeserialiseSecureHandler<List<Guid>, bool>( "POST", "/DeleteItem/", DeleteItems, CheckAuthSession)); m_httpServer.AddStreamHandler( new RestDeserialiseSecureHandler<InventoryItemBase, InventoryItemBase>( "POST", "/QueryItem/", m_InventoryService.GetItem, CheckAuthSession)); m_httpServer.AddStreamHandler( new RestDeserialiseSecureHandler<InventoryFolderBase, InventoryFolderBase>( "POST", "/QueryFolder/", m_InventoryService.GetFolder, CheckAuthSession)); m_httpServer.AddStreamHandler( new RestDeserialiseTrustedHandler<Guid, bool>( "POST", "/CreateInventory/", CreateUsersInventory, CheckTrustSource)); m_httpServer.AddStreamHandler( new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( "POST", "/NewFolder/", m_InventoryService.AddFolder, CheckAuthSession)); m_httpServer.AddStreamHandler( new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( "POST", "/CreateFolder/", m_InventoryService.AddFolder, CheckAuthSession)); m_httpServer.AddStreamHandler( new RestDeserialiseSecureHandler<InventoryItemBase, bool>( "POST", "/NewItem/", m_InventoryService.AddItem, CheckAuthSession)); m_httpServer.AddStreamHandler( new RestDeserialiseTrustedHandler<InventoryItemBase, bool>( "POST", "/AddNewItem/", m_InventoryService.AddItem, CheckTrustSource)); m_httpServer.AddStreamHandler( new RestDeserialiseSecureHandler<Guid, List<InventoryItemBase>>( "POST", "/GetItems/", GetFolderItems, CheckAuthSession)); m_httpServer.AddStreamHandler( new RestDeserialiseSecureHandler<List<InventoryItemBase>, bool>( "POST", "/MoveItems/", MoveItems, CheckAuthSession)); m_httpServer.AddStreamHandler(new InventoryServerMoveItemsHandler(m_InventoryService)); // for persistent active gestures m_httpServer.AddStreamHandler( new RestDeserialiseTrustedHandler<Guid, List<InventoryItemBase>> ("POST", "/ActiveGestures/", GetActiveGestures, CheckTrustSource)); // WARNING: Root folders no longer just delivers the root and immediate child folders (e.g // system folders such as Objects, Textures), but it now returns the entire inventory skeleton. // It would have been better to rename this request, but complexities in the BaseHttpServer // (e.g. any http request not found is automatically treated as an xmlrpc request) make it easier // to do this for now. m_httpServer.AddStreamHandler( new RestDeserialiseTrustedHandler<Guid, List<InventoryFolderBase>> ("POST", "/RootFolders/", GetInventorySkeleton, CheckTrustSource)); } #region Wrappers for converting the Guid parameter public List<InventoryFolderBase> GetSystemFolders(Guid guid) { UUID userID = new UUID(guid); return new List<InventoryFolderBase>(GetSystemFolders(userID).Values); } // This shouldn't be here, it should be in the inventory service. // But I don't want to deal with types and dependencies for now. private Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID) { InventoryFolderBase root = m_InventoryService.GetRootFolder(userID); if (root != null) { InventoryCollection content = m_InventoryService.GetFolderContent(userID, root.ID); if (content != null) { Dictionary<AssetType, InventoryFolderBase> folders = new Dictionary<AssetType, InventoryFolderBase>(); foreach (InventoryFolderBase folder in content.Folders) { if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown)) folders[(AssetType)folder.Type] = folder; } // Put the root folder there, as type Folder folders[AssetType.Folder] = root; return folders; } } m_log.WarnFormat("[INVENTORY SERVICE]: System folders for {0} not found", userID); return new Dictionary<AssetType, InventoryFolderBase>(); } public InventoryCollection GetFolderContent(Guid guid) { return m_InventoryService.GetFolderContent(UUID.Zero, new UUID(guid)); } public List<InventoryItemBase> GetFolderItems(Guid folderID) { List<InventoryItemBase> allItems = new List<InventoryItemBase>(); // TODO: UUID.Zero is passed as the userID here, making the old assumption that the OpenSim // inventory server only has a single inventory database and not per-user inventory databases. // This could be changed but it requirs a bit of hackery to pass another parameter into this // callback List<InventoryItemBase> items = m_InventoryService.GetFolderItems(UUID.Zero, new UUID(folderID)); if (items != null) { allItems.InsertRange(0, items); } return allItems; } public bool CreateUsersInventory(Guid rawUserID) { UUID userID = new UUID(rawUserID); return m_InventoryService.CreateUserInventory(userID); } public List<InventoryItemBase> GetActiveGestures(Guid rawUserID) { UUID userID = new UUID(rawUserID); return m_InventoryService.GetActiveGestures(userID); } public List<InventoryFolderBase> GetInventorySkeleton(Guid rawUserID) { UUID userID = new UUID(rawUserID); return m_InventoryService.GetInventorySkeleton(userID); } public bool DeleteFolders(List<Guid> items) { List<UUID> uuids = new List<UUID>(); foreach (Guid g in items) uuids.Add(new UUID(g)); // oops we lost the user info here. Bad bad handlers return m_InventoryService.DeleteFolders(UUID.Zero, uuids); } public bool DeleteItems(List<Guid> items) { List<UUID> uuids = new List<UUID>(); foreach (Guid g in items) uuids.Add(new UUID(g)); // oops we lost the user info here. Bad bad handlers return m_InventoryService.DeleteItems(UUID.Zero, uuids); } public bool MoveItems(List<InventoryItemBase> items) { // oops we lost the user info here. Bad bad handlers // let's peek at one item UUID ownerID = UUID.Zero; if (items.Count > 0) ownerID = items[0].Owner; return m_InventoryService.MoveItems(ownerID, items); } #endregion /// <summary> /// Check that the source of an inventory request is one that we trust. /// </summary> /// <param name="peer"></param> /// <returns></returns> public bool CheckTrustSource(IPEndPoint peer) { if (m_doLookup) { m_log.InfoFormat("[INVENTORY IN CONNECTOR]: Checking trusted source {0}", peer); UriBuilder ub = new UriBuilder(m_userserver_url); IPAddress[] uaddrs = Dns.GetHostAddresses(ub.Host); foreach (IPAddress uaddr in uaddrs) { if (uaddr.Equals(peer.Address)) { return true; } } m_log.WarnFormat( "[INVENTORY IN CONNECTOR]: Rejecting request since source {0} was not in the list of trusted sources", peer); return false; } else { return true; } } /// <summary> /// Check that the source of an inventory request for a particular agent is a current session belonging to /// that agent. /// </summary> /// <param name="session_id"></param> /// <param name="avatar_id"></param> /// <returns></returns> public virtual bool CheckAuthSession(string session_id, string avatar_id) { return true; } } }
43.509375
122
0.62702
[ "BSD-3-Clause" ]
Michelle-Argus/ArribasimExtract
OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs
13,923
C#
 using Improbable.Gdk.Core; using Improbable.Gdk.Core.Commands; using Improbable.Gdk.GameObjectCreation; using Improbable.Worker.CInterop; using UnityEngine; public class EntityCreationBehaviour : MonoBehaviour { //private WorldCommands.Requirable.WorldCommandRequestSender commandSender; //private WorldCommands.Requirable.WorldCommandResponseHandler responseHandler; void OnEnable() { // Register callback for listening to any incoming create entity command responses for this entity //if (responseHandler != null) //responseHandler.OnCreateEntityResponse += OnCreateEntityResponse; } private void Start() { } public void CreateExampleEntity(EntityTemplate entityTemplate) { //if(commandSender != null) //commandSender.CreateEntity(entityTemplate); } void OnCreateEntityResponse(WorldCommands.CreateEntity.ReceivedResponse response) { if (response.StatusCode == StatusCode.Success) { var createdEntityId = response.EntityId.Value; // handle success } else { // handle failure } } }
20.5
106
0.677881
[ "MIT" ]
r00f/LeyLineNetworking
workers/unity/Assets/Scripts/EntityCreationBehaviour.cs
1,191
C#
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated from a template. // // Manual changes to this file may cause unexpected behavior in your application. // Manual changes to this file will be overwritten if the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace EmpowerBusiness { using System; using System.Collections.Generic; public partial class Eval_CheckIn { public int CheckInID { get; set; } public int UserID { get; set; } public int LocationID { get; set; } public System.DateTime CheckInTime { get; set; } public string IPAddress { get; set; } } }
33.125
85
0.522013
[ "Apache-2.0" ]
HaloImageEngine/EmpowerClaim-hotfix-1.25.1
EmpowerBusiness/Eval_CheckIn.cs
795
C#
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("ConcatenateData")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ConcatenateData")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("831fb14c-3db4-4d34-8071-047e7fcd0dd4")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
37.918919
84
0.746258
[ "MIT" ]
pavlinpetkov88/ProgramingBasic
SimpleCalculations/ConcatenateData/Properties/AssemblyInfo.cs
1,406
C#
using System; namespace Iridium.DB { public class TimedSqlLogEntry { public TimedSqlLogEntry() { } public TimedSqlLogEntry(TimeSpan timeTaken, string sql) { TimeTaken = timeTaken; Sql = sql; } public TimeSpan TimeTaken { get; set; } public string Sql { get; set; } } }
18.55
63
0.539084
[ "MIT" ]
ArwinNL/iridium
src/Iridium.DB/DataProviders/Sql/Logging/TimedSqlLogEntry.cs
371
C#
using Microsoft.Extensions.Configuration; using RabbitMQ.Client; using RabbitMQ.Client.Events; using System; using System.Text; namespace Greeter { class Greeter { private static IConnection connection; static void Main(string[] args) { var config = new ConfigurationBuilder() .AddEnvironmentVariables() .Build(); Console.WriteLine("Greeter starting to listen"); var factory = new ConnectionFactory() { HostName = config["rabbitmq:url"] }; connection = factory.CreateConnection(); using (var channel = connection.CreateModel()) { channel.QueueDeclare(queue: "greeter", durable: false, exclusive: false, autoDelete: false, arguments: null); var consumer = new EventingBasicConsumer(channel); consumer.Received += (model, ea) => { HandleMessage(ea); }; channel.BasicConsume(queue: "greeter", autoAck: true, consumer: consumer); while (true) System.Threading.Thread.Sleep(50); } } private static void HandleMessage(BasicDeliverEventArgs ea) { var message = Encoding.UTF8.GetString(ea.Body); Console.WriteLine($" [x] Recieved '{message}', replying to {ea.BasicProperties.ReplyTo} id {ea.BasicProperties.CorrelationId}"); SendReply(ea.BasicProperties.ReplyTo, ea.BasicProperties.CorrelationId, $" [x] Received {message}"); } private static void SendReply(string replyTo, string correlationId, string reply) { using (var channel = connection.CreateModel()) { channel.QueueDeclare(queue: replyTo, durable: false, exclusive: false, autoDelete: false, arguments: null); var body = Encoding.UTF8.GetBytes(reply); var props = channel.CreateBasicProperties(); props.CorrelationId = correlationId; channel.BasicPublish(exchange: "", routingKey: replyTo, basicProperties: props, body: body); Console.WriteLine($" [x] Sent '{reply}'"); } } } }
32.836066
134
0.664004
[ "MIT" ]
rockfordlhotka/xplat-netcore-webassembly
src/02-services/Greeter/Greeter.cs
2,005
C#
// <auto-generated/> #pragma warning disable 1591 namespace Test { #line hidden using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Components; public class TestComponent : Microsoft.AspNetCore.Components.ComponentBase { #pragma warning disable 1998 protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) { __builder.OpenElement(0, "input"); __builder.AddAttribute(1, "type", "text"); __builder.AddAttribute(2, "data-slider-min", #nullable restore #line 1 "x:\dir\subdir\Test\TestComponent.cshtml" Min #line default #line hidden #nullable disable ); __builder.SetKey( #nullable restore #line 1 "x:\dir\subdir\Test\TestComponent.cshtml" someObject #line default #line hidden #nullable disable ); __builder.CloseElement(); } #pragma warning restore 1998 #nullable restore #line 3 "x:\dir\subdir\Test\TestComponent.cshtml" private object someObject = new object(); [Parameter] public int Min { get; set; } #line default #line hidden #nullable disable } } #pragma warning restore 1591
26.207547
118
0.632109
[ "Apache-2.0" ]
Therzok/AspNetCore-Tooling
src/Razor/test/RazorLanguage.Test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/Element_WithKey_AndOtherAttributes/TestComponent.codegen.cs
1,389
C#
using System; using System.Collections.Generic; using System.IO; using System.IO.Compression; using System.Threading.Tasks; using E2ETests.Common; using Microsoft.AspNetCore.Server.IntegrationTesting; using Microsoft.AspNetCore.Testing.xunit; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; using Xunit; using Xunit.Abstractions; namespace E2ETests { public class SmokeTestsOnNanoServerUsingStandaloneRuntime : IDisposable { private readonly SmokeTestsOnNanoServer _smokeTestsOnNanoServer; private readonly XunitLogger _logger; private readonly RemoteDeploymentConfig _remoteDeploymentConfig; public SmokeTestsOnNanoServerUsingStandaloneRuntime(ITestOutputHelper output) { _logger = new XunitLogger(output, LogLevel.Information); _remoteDeploymentConfig = RemoteDeploymentConfigHelper.GetConfiguration(); _smokeTestsOnNanoServer = new SmokeTestsOnNanoServer(output, _remoteDeploymentConfig, _logger); } [ConditionalTheory, Trait("E2Etests", "NanoServer")] [OSSkipCondition(OperatingSystems.Linux)] [OSSkipCondition(OperatingSystems.MacOSX)] [SkipIfEnvironmentVariableNotEnabled("RUN_TESTS_ON_NANO")] [InlineData(ServerType.Kestrel, 5000, ApplicationType.Standalone)] [InlineData(ServerType.WebListener, 5000, ApplicationType.Standalone)] [InlineData(ServerType.IIS, 8080, ApplicationType.Standalone)] public async Task Test(ServerType serverType, int portToListen, ApplicationType applicationType) { var applicationBaseUrl = $"http://{_remoteDeploymentConfig.ServerName}:{portToListen}/"; await _smokeTestsOnNanoServer.RunTestsAsync(serverType, applicationBaseUrl, applicationType); } public void Dispose() { _logger.Dispose(); } } // Tests here test portable app scenario, so we copy the dotnet runtime onto the // target server's file share and after setting up a remote session to the server, we update the PATH environment // to have the path to this copied dotnet runtime folder in the share. // The dotnet runtime is copied only once for all the tests in this class. public class SmokeTestsOnNanoServerUsingSharedRuntime : IClassFixture<SmokeTestsOnNanoServerUsingSharedRuntime.DotnetRuntimeSetupTestFixture>, IDisposable { private readonly SmokeTestsOnNanoServer _smokeTestsOnNanoServer; private readonly RemoteDeploymentConfig _remoteDeploymentConfig; private readonly XunitLogger _logger; public SmokeTestsOnNanoServerUsingSharedRuntime( DotnetRuntimeSetupTestFixture dotnetRuntimeSetupTestFixture, ITestOutputHelper output) { _logger = new XunitLogger(output, LogLevel.Information); _remoteDeploymentConfig = RemoteDeploymentConfigHelper.GetConfiguration(); _remoteDeploymentConfig.DotnetRuntimePathOnShare = dotnetRuntimeSetupTestFixture.DotnetRuntimePathOnShare; _smokeTestsOnNanoServer = new SmokeTestsOnNanoServer(output, _remoteDeploymentConfig, _logger); } [ConditionalTheory, Trait("E2Etests", "NanoServer")] [OSSkipCondition(OperatingSystems.Linux)] [OSSkipCondition(OperatingSystems.MacOSX)] [SkipIfEnvironmentVariableNotEnabled("RUN_TESTS_ON_NANO")] [InlineData(ServerType.Kestrel, 5000, ApplicationType.Portable)] [InlineData(ServerType.WebListener, 5000, ApplicationType.Portable)] [InlineData(ServerType.IIS, 8080, ApplicationType.Portable)] public async Task Test(ServerType serverType, int portToListen, ApplicationType applicationType) { var applicationBaseUrl = $"http://{_remoteDeploymentConfig.ServerName}:{portToListen}/"; await _smokeTestsOnNanoServer.RunTestsAsync(serverType, applicationBaseUrl, applicationType); } public void Dispose() { _logger.Dispose(); } // Copies dotnet runtime to the target server's file share. public class DotnetRuntimeSetupTestFixture : IDisposable { private bool copiedDotnetRuntime; public DotnetRuntimeSetupTestFixture() { var runNanoServerTests = Environment.GetEnvironmentVariable("RUN_TESTS_ON_NANO"); if (string.IsNullOrWhiteSpace(runNanoServerTests) || string.IsNullOrEmpty(runNanoServerTests) || runNanoServerTests.ToLower() == "false") { return; } RemoteDeploymentConfig = RemoteDeploymentConfigHelper.GetConfiguration(); DotnetRuntimePathOnShare = Path.Combine(RemoteDeploymentConfig.FileSharePath, "dotnet"); // Prefer copying the zip file to fileshare and extracting on file share over copying the extracted // dotnet runtime folder from source to file share as the size could be significantly huge. if (!string.IsNullOrEmpty(RemoteDeploymentConfig.DotnetRuntimeZipFilePath)) { if (!File.Exists(RemoteDeploymentConfig.DotnetRuntimeZipFilePath)) { throw new InvalidOperationException( $"Expected dotnet runtime zip file at '{RemoteDeploymentConfig.DotnetRuntimeFolderPath}', but didn't find one."); } ZippedDotnetRuntimePathOnShare = Path.Combine( RemoteDeploymentConfig.FileSharePath, Path.GetFileName(RemoteDeploymentConfig.DotnetRuntimeZipFilePath)); if (!File.Exists(ZippedDotnetRuntimePathOnShare)) { File.Copy(RemoteDeploymentConfig.DotnetRuntimeZipFilePath, ZippedDotnetRuntimePathOnShare, overwrite: true); Console.WriteLine($"Copied the local dotnet zip folder '{RemoteDeploymentConfig.DotnetRuntimeZipFilePath}' " + $"to the file share path '{RemoteDeploymentConfig.FileSharePath}'"); } if (Directory.Exists(DotnetRuntimePathOnShare)) { Directory.Delete(DotnetRuntimePathOnShare, recursive: true); } ZipFile.ExtractToDirectory(ZippedDotnetRuntimePathOnShare, DotnetRuntimePathOnShare); copiedDotnetRuntime = true; Console.WriteLine($"Extracted dotnet runtime to folder '{DotnetRuntimePathOnShare}'"); } else if (!string.IsNullOrEmpty(RemoteDeploymentConfig.DotnetRuntimeFolderPath)) { if (!Directory.Exists(RemoteDeploymentConfig.DotnetRuntimeFolderPath)) { throw new InvalidOperationException( $"Expected dotnet runtime folder at '{RemoteDeploymentConfig.DotnetRuntimeFolderPath}', but didn't find one."); } Console.WriteLine($"Copying dotnet runtime folder from '{RemoteDeploymentConfig.DotnetRuntimeFolderPath}' to '{DotnetRuntimePathOnShare}'."); Console.WriteLine("This could take some time."); DirectoryCopy(RemoteDeploymentConfig.DotnetRuntimeFolderPath, DotnetRuntimePathOnShare, copySubDirs: true); copiedDotnetRuntime = true; } else { throw new InvalidOperationException("Dotnet runtime is required to be copied for testing portable apps scenario. " + $"Either supply '{nameof(RemoteDeploymentConfig.DotnetRuntimeFolderPath)}' containing the unzipped dotnet runtime content or " + $"supply the dotnet runtime zip file path via '{nameof(RemoteDeploymentConfig.DotnetRuntimeZipFilePath)}'."); } } public RemoteDeploymentConfig RemoteDeploymentConfig { get; } public string ZippedDotnetRuntimePathOnShare { get; } public string DotnetRuntimePathOnShare { get; } private static void DirectoryCopy(string sourceDirName, string destDirName, bool copySubDirs) { var dir = new DirectoryInfo(sourceDirName); if (!dir.Exists) { throw new DirectoryNotFoundException( "Source directory does not exist or could not be found: " + sourceDirName); } var dirs = dir.GetDirectories(); if (!Directory.Exists(destDirName)) { Directory.CreateDirectory(destDirName); } var files = dir.GetFiles(); foreach (var file in files) { var temppath = Path.Combine(destDirName, file.Name); file.CopyTo(temppath, false); } if (copySubDirs) { foreach (var subdir in dirs) { var temppath = Path.Combine(destDirName, subdir.Name); DirectoryCopy(subdir.FullName, temppath, copySubDirs); } } } public void Dispose() { if (!copiedDotnetRuntime) { return; } // In case the source is provided as a folder itself, then we wouldn't have the zip file to begin with. if (!string.IsNullOrEmpty(ZippedDotnetRuntimePathOnShare)) { try { Console.WriteLine($"Deleting the dotnet runtime zip file '{ZippedDotnetRuntimePathOnShare}'"); File.Delete(ZippedDotnetRuntimePathOnShare); } catch (Exception ex) { Console.WriteLine($"Failed to delete the dotnet runtime zip file '{ZippedDotnetRuntimePathOnShare}'. Exception: " + ex.ToString()); } } try { Console.WriteLine($"Deleting the dotnet runtime folder '{DotnetRuntimePathOnShare}'"); Directory.Delete(DotnetRuntimePathOnShare, recursive: true); } catch (Exception ex) { Console.WriteLine($"Failed to delete the dotnet runtime folder '{DotnetRuntimePathOnShare}'. Exception: " + ex.ToString()); } } } } class SmokeTestsOnNanoServer { private readonly XunitLogger _logger; private readonly RemoteDeploymentConfig _remoteDeploymentConfig; public SmokeTestsOnNanoServer(ITestOutputHelper output, RemoteDeploymentConfig config, XunitLogger logger) { _logger = logger; _remoteDeploymentConfig = config; } public async Task RunTestsAsync( ServerType serverType, string applicationBaseUrl, ApplicationType applicationType) { using (_logger.BeginScope(nameof(SmokeTestsOnNanoServerUsingStandaloneRuntime))) { var deploymentParameters = new RemoteWindowsDeploymentParameters( Helpers.GetApplicationPath(applicationType), _remoteDeploymentConfig.DotnetRuntimePathOnShare, serverType, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, _remoteDeploymentConfig.FileSharePath, _remoteDeploymentConfig.ServerName, _remoteDeploymentConfig.AccountName, _remoteDeploymentConfig.AccountPassword) { TargetFramework = "netcoreapp1.1", ApplicationBaseUriHint = applicationBaseUrl, ApplicationType = applicationType }; deploymentParameters.EnvironmentVariables.Add( new KeyValuePair<string, string>("ASPNETCORE_ENVIRONMENT", "SocialTesting")); using (var deployer = new RemoteWindowsDeployer(deploymentParameters, _logger)) { var deploymentResult = deployer.Deploy(); await SmokeTestHelper.RunTestsAsync(deploymentResult, _logger); } } } } static class RemoteDeploymentConfigHelper { private static RemoteDeploymentConfig _remoteDeploymentConfig; public static RemoteDeploymentConfig GetConfiguration() { if (_remoteDeploymentConfig == null) { var configuration = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("remoteDeploymentConfig.json") .AddUserSecrets() .AddEnvironmentVariables() .Build(); _remoteDeploymentConfig = new RemoteDeploymentConfig(); configuration.GetSection("NanoServer").Bind(_remoteDeploymentConfig); } return _remoteDeploymentConfig; } } }
45.195364
161
0.608909
[ "Apache-2.0" ]
BrennanConroy/MusicStore
test/E2ETests/SmokeTestsOnNanoServer.cs
13,649
C#
using Newtonsoft.Json; namespace FreshdeskApi.Client.Conversations.Requests { /// <summary> /// Set the properties required for creating a new reply to a ticket. /// /// c.f. https://developers.freshdesk.com/api/#reply_ticket /// </summary> public class CreateReplyRequest { /// <summary> /// Content of the note in HTML format /// </summary> [JsonProperty("body")] public string BodyHtml { get; } /// <summary> /// The email address from which the reply is sent. By default the /// global support email will be used. /// </summary> [JsonProperty("from_email")] public string FromEmail { get; } /// <summary> /// ID of the agent who is adding the note. /// /// By default will use the API user. /// </summary> [JsonProperty("user_id")] public long? UserId { get; } /// <summary> /// Email address added in the 'cc' field of the outgoing ticket email. /// </summary> [JsonProperty("cc_emails")] public string[] CcEmails { get; } /// <summary> /// Email address added in the 'bcc' field of the outgoing ticket /// email. /// </summary> [JsonProperty("bcc_emails")] public string[] BccEmails { get; } public CreateReplyRequest(string bodyHtml, string fromEmail = null, long? userId = null, string[] ccEmails = null, string[] bccEmails = null) { BodyHtml = bodyHtml; FromEmail = fromEmail; UserId = userId; CcEmails = ccEmails; BccEmails = bccEmails; } public override string ToString() { return $"{nameof(BodyHtml)}: {BodyHtml}, {nameof(FromEmail)}: {FromEmail}, {nameof(UserId)}: {UserId}, {nameof(CcEmails)}: {CcEmails}, {nameof(BccEmails)}: {BccEmails}"; } } }
32.016393
181
0.558628
[ "MIT" ]
tschlecht06/FreshdeskApiDotnet
FreshdeskApi.Client/Conversations/Requests/CreateReplyRequest.cs
1,955
C#
using Microsoft.EntityFrameworkCore.Migrations; namespace sage.poc_001.Migrations { public partial class Upgraded_To_Abp_2_1_0 : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_AbpRoleClaims_AbpRoles_UserId", table: "AbpRoleClaims"); migrationBuilder.DropIndex( name: "IX_AbpRoleClaims_UserId", table: "AbpRoleClaims"); migrationBuilder.DropColumn( name: "UserId", table: "AbpRoleClaims"); migrationBuilder.AddColumn<bool>( name: "IsDisabled", table: "AbpLanguages", nullable: false, defaultValue: false); migrationBuilder.AddForeignKey( name: "FK_AbpRoleClaims_AbpRoles_RoleId", table: "AbpRoleClaims", column: "RoleId", principalTable: "AbpRoles", principalColumn: "Id", onDelete: ReferentialAction.Cascade); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_AbpRoleClaims_AbpRoles_RoleId", table: "AbpRoleClaims"); migrationBuilder.DropColumn( name: "IsDisabled", table: "AbpLanguages"); migrationBuilder.AddColumn<int>( name: "UserId", table: "AbpRoleClaims", nullable: true); migrationBuilder.CreateIndex( name: "IX_AbpRoleClaims_UserId", table: "AbpRoleClaims", column: "UserId"); migrationBuilder.AddForeignKey( name: "FK_AbpRoleClaims_AbpRoles_UserId", table: "AbpRoleClaims", column: "UserId", principalTable: "AbpRoles", principalColumn: "Id", onDelete: ReferentialAction.Restrict); } } }
32.333333
71
0.542174
[ "MIT" ]
PaulCoetser/SdiPoc
aspnet-core/src/sage.poc_001.EntityFrameworkCore/Migrations/20170608053244_Upgraded_To_Abp_2_1_0.cs
2,136
C#
using System; using WMNW.Core; using System.IO; namespace System.Xml { /// <summary> /// This class is used to manage and give short cuts to loading and writing xml files /// </summary> public sealed class XmlSettingManager { #region Fields /// <summary> /// The instance. /// </summary> private static XmlSettingManager _instance; /// <summary> /// The sets. /// </summary> private static XmlWriterSettings _sets; #endregion #region Constructor /// <summary> /// Initializes a new instance of the <see cref="System.Xml.XmlSettingManager"/> class. /// </summary> public XmlSettingManager () { InstanceManager.CheckInstance ( _instance, "Xml Setting Manager", true ); _instance = this; _sets = new XmlWriterSettings (){ Indent = true }; } #endregion #region Game Logic /// <summary> /// Creates the xml writer. /// </summary> /// <returns>The xml writer.</returns> /// <param name="path">Path.</param> public static XmlWriter CreateXmlWriter( string path ) { InstanceManager.CheckInstance ( _instance, "Xml Setting Manager" ); Directory.CreateDirectory ( Path.GetDirectoryName ( path ) ); return XmlWriter.Create ( path, _sets ); } /// <summary> /// Gets the xml docfor file. /// </summary> /// <returns>The xml docfor file.</returns> /// <param name="path">Path.</param> public static XmlDocument GetXmlDocforFile( string path ) { XmlDocument doc = new XmlDocument (); doc.Load ( path ); return doc; } #endregion } }
26.428571
95
0.546486
[ "MIT" ]
MuteLovestone/WM_NewWorld
Code/WM New World/Whore Master New World/Core/WMNW.Core/Loading/XmlSettingManager.cs
1,852
C#
using System; using System.Collections.Generic; namespace Myrtille.Fleck.Handlers { public class ComposableHandler : IHandler { public Func<string, byte[]> Handshake = s => new byte[0]; public Func<string, byte[]> TextFrame = x => new byte[0]; public Func<byte[], byte[]> BinaryFrame = x => new byte[0]; public Action<List<byte>> ReceiveData = delegate { }; public Func<byte[], byte[]> PingFrame = i => new byte[0]; public Func<byte[], byte[]> PongFrame = i => new byte[0]; public Func<int, byte[]> CloseFrame = i => new byte[0]; private readonly List<byte> _data = new List<byte>(); public byte[] CreateHandshake(string subProtocol = null) { return Handshake(subProtocol); } public void Receive(IEnumerable<byte> data) { _data.AddRange(data); ReceiveData(_data); } public byte[] FrameText(string text) { return TextFrame(text); } public byte[] FrameBinary(byte[] bytes) { return BinaryFrame(bytes); } public byte[] FramePing(byte[] bytes) { return PingFrame(bytes); } public byte[] FramePong(byte[] bytes) { return PongFrame(bytes); } public byte[] FrameClose(int code) { return CloseFrame(code); } } }
27.561404
68
0.502864
[ "Apache-2.0" ]
YongboZhu/myrtille
Myrtille.Common/Fleck/Handlers/ComposableHandler.cs
1,571
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DesignPatternCore.Proxy { class Pursuit : IGiveGift { SchoolGirl sg; public Pursuit(SchoolGirl sg) { this.sg = sg; } public void GiveChocolate() { Console.WriteLine($"{sg.Name} 送你巧克力"); } public void GiveDolls() { Console.WriteLine($"{sg.Name} 送你洋娃娃"); } public void GiveFlowers() { Console.WriteLine($"{sg.Name} 送你鲜花"); } } }
20.375
51
0.513804
[ "Apache-2.0" ]
MarsonShine/Books
DesignPattern/DesignPatternCore/Proxy/Pursuit.cs
682
C#
using System.Runtime.CompilerServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.X86; using static MathSharp.SoftwareFallbacks; namespace MathSharp { public static partial class Vector { [MethodImpl(MaxOpt)] public static Vector256<double> CompareEqual(Vector256<double> left, Vector256<double> right) { if (Avx.IsSupported) { return Avx.Compare(left, right, FloatComparisonMode.OrderedEqualNonSignaling); } return CompareEqual_Software(left, right); } [MethodImpl(MaxOpt)] public static Vector256<double> CompareNotEqual(Vector256<double> left, Vector256<double> right) { if (Avx.IsSupported) { return Avx.Compare(left, right, FloatComparisonMode.UnorderedNotEqualNonSignaling); } return CompareNotEqual_Software(left, right); } [MethodImpl(MaxOpt)] public static Vector256<double> CompareGreaterThan(Vector256<double> left, Vector256<double> right) { if (Avx.IsSupported) { return Avx.Compare(left, right, FloatComparisonMode.UnorderedNotLessThanOrEqualNonSignaling); } return CompareGreaterThan_Software(left, right); } [MethodImpl(MaxOpt)] public static Vector256<double> CompareLessThan(Vector256<double> left, Vector256<double> right) { if (Avx.IsSupported) { return Avx.Compare(left, right, FloatComparisonMode.OrderedLessThanSignaling); } return CompareLessThan_Software(left, right); } [MethodImpl(MaxOpt)] public static Vector256<double> CompareGreaterThanOrEqual(Vector256<double> left, Vector256<double> right) { if (Avx.IsSupported) { return Avx.Compare(left, right, FloatComparisonMode.UnorderedNotLessThanSignaling); } return CompareGreaterThanOrEqual_Software(left, right); } [MethodImpl(MaxOpt)] public static Vector256<double> CompareLessThanOrEqual(Vector256<double> left, Vector256<double> right) { if (Avx.IsSupported) { return Avx.Compare(left, right, FloatComparisonMode.OrderedLessThanOrEqualSignaling); } return CompareLessThanOrEqual_Software(left, right); } } }
30.317647
114
0.606907
[ "MIT" ]
Svengali/MathSharp
sources/MathSharp/Vector/VectorFloatingPoint/VectorDouble/Comparisons.cs
2,579
C#
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Generic; using Microsoft.CodeAnalysis.Differencing; using Microsoft.CodeAnalysis.EditAndContinue; using Microsoft.CodeAnalysis.EditAndContinue.UnitTests; using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.EditAndContinue; using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; namespace Microsoft.CodeAnalysis.CSharp.EditAndContinue.UnitTests { internal static class Extensions { internal static void VerifyUnchangedDocument( string source, ActiveStatementsDescription description) { CSharpEditAndContinueTestHelpers.Instance.VerifyUnchangedDocument( ActiveStatementsDescription.ClearTags(source), description.OldStatements, description.OldTrackingSpans, description.NewSpans, description.OldRegions, description.NewRegions); } internal static void VerifyRudeDiagnostics( this EditScript<SyntaxNode> editScript, params RudeEditDiagnosticDescription[] expectedDiagnostics) { VerifyRudeDiagnostics(editScript, ActiveStatementsDescription.Empty, expectedDiagnostics); } internal static void VerifyRudeDiagnostics( this EditScript<SyntaxNode> editScript, ActiveStatementsDescription description, params RudeEditDiagnosticDescription[] expectedDiagnostics) { CSharpEditAndContinueTestHelpers.Instance.VerifyRudeDiagnostics( editScript, description, expectedDiagnostics); } internal static void VerifyLineEdits( this EditScript<SyntaxNode> editScript, IEnumerable<LineChange> expectedLineEdits, IEnumerable<string> expectedNodeUpdates, params RudeEditDiagnosticDescription[] expectedDiagnostics) { CSharpEditAndContinueTestHelpers.Instance.VerifyLineEdits( editScript, expectedLineEdits, expectedNodeUpdates, expectedDiagnostics); } internal static void VerifySemanticDiagnostics( this EditScript<SyntaxNode> editScript, params RudeEditDiagnosticDescription[] expectedDiagnostics) { VerifySemantics( editScript, expectedDiagnostics: expectedDiagnostics); } internal static void VerifySemanticDiagnostics( this EditScript<SyntaxNode> editScript, TargetFramework[] targetFrameworks, params RudeEditDiagnosticDescription[] expectedDiagnostics) { VerifySemantics( editScript, targetFrameworks: targetFrameworks, expectedDiagnostics: expectedDiagnostics); } internal static void VerifySemanticDiagnostics( this EditScript<SyntaxNode> editScript, DiagnosticDescription expectedDeclarationError, params RudeEditDiagnosticDescription[] expectedDiagnostics) { VerifySemantics( editScript, expectedDeclarationError: expectedDeclarationError, expectedDiagnostics: expectedDiagnostics); } internal static void VerifySemantics( this EditScript<SyntaxNode> editScript, ActiveStatementsDescription activeStatements, SemanticEditDescription[] expectedSemanticEdits) { VerifySemantics( editScript, activeStatements, expectedSemanticEdits: expectedSemanticEdits, expectedDiagnostics: null); } internal static void VerifySemantics( this EditScript<SyntaxNode> editScript, ActiveStatementsDescription activeStatements = null, TargetFramework[] targetFrameworks = null, IEnumerable<string> additionalOldSources = null, IEnumerable<string> additionalNewSources = null, SemanticEditDescription[] expectedSemanticEdits = null, DiagnosticDescription expectedDeclarationError = null, RudeEditDiagnosticDescription[] expectedDiagnostics = null) { foreach (var targetFramework in targetFrameworks ?? new[] { TargetFramework.NetStandard20, TargetFramework.NetCoreApp30 }) { new CSharpEditAndContinueTestHelpers(targetFramework).VerifySemantics( editScript, activeStatements, additionalOldSources, additionalNewSources, expectedSemanticEdits, expectedDeclarationError, expectedDiagnostics); } } } }
39.835938
134
0.647186
[ "MIT" ]
BertanAygun/roslyn
src/EditorFeatures/CSharpTest/EditAndContinue/Helpers/Extensions.cs
5,101
C#
using UnityEngine; using System.Collections; /// <summary> /// Defines a consumable (called "power up" in game). Each consumable is derived from this and implements its functions. /// </summary> public abstract class Consumable : MonoBehaviour { public float duration; public enum ConsumableType { NONE, COIN_MAG, SCORE_MULTIPLAYER, INVINCIBILITY, EXTRALIFE, MAX_COUNT } public Sprite icon; public AudioClip activatedSound; public ParticleSystem activatedParticle; public bool canBeSpawned = true; public bool active { get { return m_Active; } } public float timeActive { get { return m_SinceStart; } } protected bool m_Active = true; protected float m_SinceStart; protected ParticleSystem m_ParticleSpawned; // Here - for the sake of showing diverse way of doing things - we use abstract functions to get the data for each consumable. // Another way to do it would be to have public field, like the Character or Accesories use, and define all those on the prefabs instead of here. // This method allows information to be all in code (so no need for prefab etc.) the other make it easier to modify without recompiling/by non-programmer. public abstract ConsumableType GetConsumableType(); public abstract string GetConsumableName(); public abstract int GetPrice(); public abstract int GetPremiumCost(); public void ResetTime() { m_SinceStart = 0; } //override this to do test to make a consumable not usable (e.g. used by the ExtraLife to avoid using it when at full health) public virtual bool CanBeUsed(CharacterInputController c) { return true; } public virtual void Started(CharacterInputController c) { m_SinceStart = 0; if (activatedSound != null) { c.powerupSource.clip = activatedSound; c.powerupSource.Play(); } if(activatedParticle != null) { m_ParticleSpawned = Instantiate(activatedParticle); if (!m_ParticleSpawned.main.loop) Destroy(m_ParticleSpawned.gameObject, m_ParticleSpawned.main.duration); m_ParticleSpawned.transform.SetParent(c.characterCollider.transform); m_ParticleSpawned.transform.localPosition = activatedParticle.transform.position; } } public virtual void Tick(CharacterInputController c) { // By default do nothing, override to do per frame manipulation m_SinceStart += Time.deltaTime; if (m_SinceStart >= duration) { m_Active = false; return; } } public virtual void Ended(CharacterInputController c) { if (m_ParticleSpawned != null) { if (activatedParticle.main.loop) Destroy(m_ParticleSpawned.gameObject); } if (activatedSound != null && c.powerupSource.clip == activatedSound) c.powerupSource.Stop(); //if this one the one using the audio source stop it for (int i = 0; i < c.consumables.Count; ++i) { if (c.consumables[i].active && c.consumables[i].activatedSound != null) {//if there is still an active consumable that have a sound, this is the one playing now c.powerupSource.clip = c.consumables[i].activatedSound; c.powerupSource.Play(); } } } }
33.704762
159
0.638598
[ "MIT" ]
Berklee-Game-Audio/Unity-Wwise-Game-Template-Trashcat
Assets/Scripts/Consumable/Consumable.cs
3,541
C#
using System.Collections.Generic; namespace Inasync.OnionFunc.Tests { public class SpyHandler : SpyComponent { public SpyHandler(List<SpyComponent> invokedComponents, DummyResult result) : base(invokedComponents, result) { } } }
23.363636
119
0.719844
[ "MIT" ]
in-async/MiddlewarePipelines
tests/Inasync.OnionFunc.Tests/TestHelpers/TestDoubles/SpyHandler.cs
259
C#
// Copyright (c) DotSpatial Team. All rights reserved. // Licensed under the MIT license. See License.txt file in the project root for full license information. using System; using System.Collections.Generic; using System.Linq; namespace DotSpatial.Symbology { /// <summary> /// Jenks natural breaks optimization used for symbolizing based on minimizing variance within categories. /// </summary> /// <remarks> /// This code replaces the JenksBreaks code which was based on MapWinGIS and was buggy. /// This version is based on (http://en.wikipedia.org/wiki/Jenks_natural_breaks_optimization) /// Implementations: [1](http://danieljlewis.org/files/2010/06/Jenks.pdf) (python), /// [2](https://github.com/vvoovv/djeo-jenks/blob/master/main.js) (buggy), /// [3](https://github.com/simogeo/geostats/blob/master/lib/geostats.js#L407) (works) /// Adapted by Dan Ames from "literate" version created by Tom MacWright /// presented here: https://macwright.org/2013/02/18/literate-jenks.html and here https://gist.github.com/tmcw/4977508. /// </remarks> internal class NaturalBreaks { #region Fields private readonly double[] _values; private readonly int _numClasses; private int[,] _lowerClassLimits; private double[,] _varianceCombinations; private List<double> _resultClasses; #endregion #region Constructors /// <summary> /// Initializes a new instance of the <see cref="NaturalBreaks"/> class. /// </summary> /// <param name="values">data values used for calculation.</param> /// <param name="numClasses">Number of breaks that should be calculated.</param> public NaturalBreaks(List<double> values, int numClasses) { _numClasses = numClasses; _values = values.ToArray(); // the number of classes must be greater than one and less than the number of data elements. if (_numClasses > _values.Length) return; if (_numClasses < 2) return; // sort data in numerical order, since this is expected by the matrices function Array.Sort(_values); // get our basic matrices GetMatrices(); // extract n_classes out of the computed matrices GetBreaks(); } #endregion #region Methods /// <summary> /// Returns the list of the results. /// </summary> /// <returns>The list of results.</returns> public List<double> GetResults() { return _resultClasses; } /// <summary> /// Compute the matrices required for Jenks breaks. These matrices can be used for any classing of data with `classes smaller or equal to n_classes`. /// </summary> private void GetMatrices() { // in the original implementation, these matrices are referred to as `LC` and `OP` // * lower_class_limits (LC): optimal lower class limits // * variance_combinations (OP): optimal variance combinations for all classes - declared at class level now loop counters int i, j; // the variance, as computed at each step in the calculation double variance = 0; // Initialize and fill each matrix with zeroes _lowerClassLimits = new int[_values.Length + 1, _numClasses + 1]; _varianceCombinations = new double[_values.Length + 1, _numClasses + 1]; for (i = 1; i < _numClasses + 1; i++) { _lowerClassLimits[1, i] = 1; _varianceCombinations[1, i] = 0; // in the original implementation, 9999999 is used but since C# has `PositiveInfinity`, we use that. for (j = 2; j < _values.Length + 1; j++) { _varianceCombinations[j, i] = double.PositiveInfinity; } } for (var l = 2; l < _values.Length + 1; l++) { // `SZ` originally. this is the sum of the values seen thus far when calculating variance. double sum = 0; // `ZSQ` originally. the sum of squares of values seen thus far double sumSquares = 0; // `WT` originally. This is the number of int w = 0; // in several instances, you could say `Math.pow(x, 2)` instead of `x * x`, but this is slower in some browsers introduces an unnecessary concept. for (var m = 1; m < l + 1; m++) { // `III` originally var lowerClassLimit = l - m + 1; var val = _values[lowerClassLimit - 1]; // here we're estimating variance for each potential classing of the data, for each potential number of classes. `w` is the number of data points considered so far. w++; // increase the current sum and sum-of-squares sum += val; sumSquares += val * val; // the variance at this point in the sequence is the difference between the sum of squares and the total x 2, over the number of samples. variance = sumSquares - ((sum * sum) / w); // `IV` originally var i4 = lowerClassLimit - 1; if (i4 == 0) continue; for (j = 2; j < _numClasses + 1; j++) { // if adding this element to an existing class will increase its variance beyond the limit, break the class at this point, setting the lower_class_limit at this point. if (_varianceCombinations[l, j] >= (variance + _varianceCombinations[i4, j - 1])) { _lowerClassLimits[l, j] = lowerClassLimit; _varianceCombinations[l, j] = variance + _varianceCombinations[i4, j - 1]; } } } _lowerClassLimits[l, 1] = 1; _varianceCombinations[l, 1] = variance; } } /// <summary> /// the second part of the jenks recipe: take the calculated matrices and derive an array of n breaks. /// </summary> private void GetBreaks() { int k = _values.Length - 1; double[] kclass = new double[_numClasses + 1]; int countNum = _numClasses; // the calculation of classes will never include the upper and lower bounds, so we need to explicitly set them kclass[_numClasses] = _values[_values.Length - 1]; kclass[0] = _values[0]; // the lower_class_limits matrix is used as indexes into itself // here: the `k` variable is reused in each iteration. while (countNum > 1) { kclass[countNum - 1] = _values[_lowerClassLimits[k, countNum] - 2]; k = _lowerClassLimits[k, countNum] - 1; countNum--; } _resultClasses = kclass.ToList(); } #endregion } }
41.305085
191
0.56285
[ "MIT" ]
eapbokma/DotSpatial
Source/DotSpatial.Symbology/NaturalBreaks.cs
7,313
C#
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("HideKnowledgeItemFileFormHelpBox")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("HideKnowledgeItemFileFormHelpBoxAddon")] [assembly: AssemblyCopyright("Copyright © 2018 Daniel Lutz")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("8c13445c-aa66-4285-8556-48fe11b14278")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
39.297297
84
0.753783
[ "MIT" ]
lutz/HideKnowledgeItemFileFormHelpBoxAddon
src/HideKnowledgeItemFileFormHelpBoxAddon/Properties/AssemblyInfo.cs
1,457
C#
using Business.Abstract; using Core.Entities.Concrete; using Entities.Concrete; using Entities.DTO_s; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace WebAPI.Controllers { [Route("api/[controller]")] [ApiController] public class UsersController : ControllerBase { IUserService _userService; public UsersController(IUserService userService) { _userService = userService; } [HttpPost("add")] public IActionResult Add(User user) { var result = _userService.Add(user); if (result.Success) { return Ok(result); } return BadRequest(result); } [HttpPost("delete")] public IActionResult Delete(User user) { var result = _userService.Delete(user); if (result.Success) { return Ok(result); } return BadRequest(result); } [HttpPost("update")] public IActionResult Update(User user) { var result = _userService.Update(user); if (result.Success) { return Ok(result); } return BadRequest(result); } [HttpGet("getall")] public IActionResult GetAll() { var result = _userService.GetAll(); if (result.Success) { return Ok(result); } return BadRequest(result); } [HttpGet("getbyid")] public IActionResult GetById(int id) { var result = _userService.GetById(id); if (result.Success) { return Ok(result); } return BadRequest(result); } [HttpGet("getbymail")] public IActionResult GetByMail(string email) { var result = _userService.GetByMail(email); if (result.Success) { return Ok(result); } return BadRequest(result); } } }
23.946809
56
0.519325
[ "MIT" ]
hlmclgl/RentaCarProject
WebAPI/Controllers/UsersController.cs
2,253
C#
using Microsoft.Extensions.DependencyInjection; using Sitecore.DependencyInjection; using Sitecore.Foundation.Web.Context; using Sitecore.Foundation.Web.DependencyInjection; namespace Sitecore.Foundation.Web.Services { public class Configurator : IServicesConfigurator { public void Configure(IServiceCollection serviceCollection) { serviceCollection.AddTransient<IContentContext, ApplicationContext>(); serviceCollection.AddTransient<IWebContext, ApplicationContext>(); serviceCollection.AddMvcControllers( "Sitecore.Feature.*", "Sitecore.*.Website"); } } }
34.947368
82
0.712349
[ "MIT" ]
GuitarRich/sitecore.react.project
src/Foundation/Web/code/Services/Configurator.cs
666
C#
using BenchmarkDotNet.Attributes; namespace StringyEnums.Benchmarks { [MemoryDiagnoser] [Config(typeof(NoOptimizationConfig))] public class EnumParserExtensionBenchmark { [Benchmark] public BenchmarkEnum ParseToEnum() => (BenchmarkEnum)EnumParser.EnumParser.Parse(typeof(BenchmarkEnum),"Value 5"); } }
22.571429
82
0.787975
[ "MIT" ]
TwentyFourMinutes/StringyEnums
src/StringyEnums/StringyEnums.Benchmarks/Benchmarks/EnumParserExtensionBenchmark.cs
318
C#
using System.IO; using System.Threading; using Macad.Common.Interop; using Macad.Test.Utils; using NUnit.Framework; namespace Macad.Test.Unit { [SetUpFixture, Apartment(ApartmentState.STA)] public class TestEnvironment { [OneTimeSetUp] public void SetUp() { // Install Mesa3D var mesaDir = Path.GetFullPath(Path.Combine(TestContext.CurrentContext.TestDirectory, @"..\..\Packages\Mesa3D.20.1.8")); Assume.That(File.Exists(Path.Combine(mesaDir, "opengl32.dll")), "Mesa3D OpenGL driver not found, please call 'restore' in script console."); Win32Api.SetDllDirectory(mesaDir); // Init context Context.InitEmpty(); } [OneTimeTearDown] public void TearDown() { } } }
27.741935
153
0.59186
[ "MIT" ]
Macad3D/Macad3D
Source/Test.Unit/TestEnvironment.cs
862
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using OpenQA.Selenium; using OpenQA.Selenium.Firefox; using OpenQA.Selenium.Support.UI; namespace WebAddressbookTests { public class NavigationHelper : HelperBase { private string baseURL; public NavigationHelper(ApplicationManager manager, string baseURL) : base(manager) { this.baseURL = baseURL; } public void GoToHomePage() { if (driver.Url == baseURL + "/addressbook/") { return; } driver.Navigate().GoToUrl(baseURL + "/addressbook/"); } public void GoToGroupsPage() { if (driver.Url == baseURL + "/addressbook/group.php" && IsElementPresent(By.Name("new"))) { return; } driver.FindElement(By.LinkText("groups")).Click(); } public void GoToNewContactPage() { if (driver.Url == baseURL + "/addressbook/edit.php" && IsElementPresent(By.Name("firstname"))) { return; } driver.FindElement(By.LinkText("add new")).Click(); } } }
26.04
91
0.543011
[ "Apache-2.0" ]
rmikhajlov/csharp_training
addressbook-web-tests/addressbook-web-tests/AppManager/NavigationHelper.cs
1,304
C#
namespace StoryTeller.UserInterface.Screens { public interface IScreenFactory { T Build<T>() where T : IScreen; IScreen<T> Build<T>(T subject); } }
22.75
44
0.60989
[ "Apache-2.0" ]
DarthFubuMVC/storyteller
src/StoryTeller.UserInterface/Screens/IScreenFactory.cs
182
C#
using System.Collections; using System.Collections.Generic; using System; using UnityEngine.UI; using UnityEngine.SceneManagement; using UnityEngine; public class DailyReward : MonoBehaviour { [SerializeField] bool tmp; [SerializeField] GameObject rewardWindow; [SerializeField] GameObject leftButton; [SerializeField] GameObject rightButton; [SerializeField] GameObject doubleButton; [SerializeField] Text rewardText; [SerializeField] GameObject CloseButton; [SerializeField] DailyRewardSlot[] dailySlots; [SerializeField] Image lightCircle; [SerializeField] GameObject chest; [SerializeField] Sprite chestOpen; [SerializeField] Sprite chestClose; [SerializeField] GameObject activateButton; [SerializeField] GameObject chestFade; [SerializeField] Text timer; [SerializeField] Image rewardedButtonImage; [SerializeField] Sprite freeSprite; [SerializeField] GameObject freeText; [SerializeField] GameObject getRewardButton; bool musicWasPlaying; Image chestImage; bool isSpined = false; Quaternion rotationVector; Animator lootAnimator; public static bool isRewardCollected; int rewardDay; bool is24hoursPast; bool isTimerTick; bool _isRewardedVideoWatched; DateTime lastOpenDate; TimeSpan span; TimeSpan hours24; public class Reward//conteiner for reward, made to give it for rewarded video { public string type; public string itemType; public int rewardValue; public void SetReward(string _type, int _rewardValue = 0, string _itemType = null) { type = _type; rewardValue = _rewardValue; itemType = _itemType; } public void GiveReward() { switch (type) { case "Coins": GameManager.AddCoins(rewardValue); break; case "Crystals": GameManager.AddCrystals(rewardValue); break; case "Item": Inventory.Instance.AddItem(itemType, rewardValue); break; case "Pots": Inventory.Instance.AddItem(Inventory.IMMORTAL_BONUS, 1); Inventory.Instance.AddItem(Inventory.DAMAGE_BONUS, 1); Inventory.Instance.AddItem(Inventory.SPEED_BONUS, 1); Inventory.Instance.AddItem(Inventory.TIME_BONUS, 1); break; case "Skin": break; default: break; } } } public Reward myReward; private void Start() { myReward = new Reward(); SetRewardWindow(); if (PlayerPrefs.GetInt("NoAds") > 0) { rewardedButtonImage.sprite = freeSprite; freeText.SetActive(true); } isTimerTick = false; hours24 = new TimeSpan(24, 0, 0);// 24hours in timespan format chestImage = chest.GetComponent<Image>(); if (!PlayerPrefs.HasKey("RewardDay")) { PlayerPrefs.SetInt("RewardDay", 0); } if (!PlayerPrefs.HasKey("LastOpenDate")) { PlayerPrefs.SetString("LastOpenDate", "7/4/2016 8:30:52 AM"); lastOpenDate = DateTime.Parse(PlayerPrefs.GetString("LastOpenDate")); } lastOpenDate = DateTime.Parse(PlayerPrefs.GetString("LastOpenDate")); rewardDay = PlayerPrefs.GetInt("RewardDay"); if (rewardDay == 9) { doubleButton.GetComponent<Button>().interactable = false; } is24hoursPast = NetworkTime.Check24hours(lastOpenDate); if (!is24hoursPast) { chest.GetComponent<Animator>().enabled = false; doubleButton.GetComponent<Button>().interactable = false; chestImage.sprite = chestClose; lightCircle.gameObject.SetActive(false); isSpined = false; span = lastOpenDate - NetworkTime.GetNetworkTime(); isTimerTick = true; timer.gameObject.SetActive(true); isRewardCollected = true; } else { ActivateChest(); isRewardCollected = false; } _isRewardedVideoWatched = false; } public void TMP() { tmp = true; } private void Update() { if (isSpined) { rotationVector = lightCircle.rectTransform.rotation; rotationVector.z -= 0.0005f; lightCircle.rectTransform.rotation = rotationVector; } if (tmp) { PlayerPrefs.SetString("LastOpenDate", "7/4/2016 8:30:52 AM"); lastOpenDate = DateTime.Parse(PlayerPrefs.GetString("LastOpenDate")); isRewardCollected = false; tmp = false; } if (isTimerTick) { span = hours24 + (lastOpenDate - DateTime.Now); timer.text = span.ToString().Substring(0, 8); if (span <= TimeSpan.Zero) { ActivateChest(); } } if (AdsManager.Instance.isRewardVideoWatched && _isRewardedVideoWatched) { doubleButton.GetComponent<Button>().interactable = false; if (musicWasPlaying) { musicWasPlaying = false; SoundManager.PlayRandomMusic("kid_music", true); } AdsManager.Instance.isRewardVideoWatched = false; rewardText.text = (int.Parse(rewardText.text)*2).ToString(); myReward.GiveReward(); } } void SetRewardWindow() { leftButton.GetComponent<Button>().enabled = false; Color tmp = leftButton.GetComponent<Image>().color; tmp -= new Color(0.05f, 0.05f, 0.05f); leftButton.GetComponent<Image>().color = tmp; rewardWindow.SetActive(false); } public void OpenChestButton() { chest.GetComponent<Animator>().enabled = false; chestFade.SetActive(true); if (!isRewardCollected) { rewardDay++; PlayerPrefs.SetInt("RewardDay", rewardDay); getRewardButton.SetActive(true); CloseButton.SetActive(false); doubleButton.GetComponent<Button>().interactable = true; chestImage.sprite = chestOpen; lightCircle.gameObject.SetActive(false); isSpined = false; span = lastOpenDate - NetworkTime.GetNetworkTime(); isTimerTick = true; timer.gameObject.SetActive(true); PlayerPrefs.SetString("LastOpenDate", NetworkTime.GetNetworkTime().ToString()); lastOpenDate = DateTime.Parse(PlayerPrefs.GetString("LastOpenDate")); AppMetrica.Instance.ReportEvent("#CHEST Daily chest activate"); DevToDev.Analytics.CustomEvent("#CHEST Daily chest activate"); } else { getRewardButton.SetActive(false); CloseButton.SetActive(true); doubleButton.GetComponent<Button>().interactable = false; } int i; if (rewardDay <= 5) { i = 1; } else { i = 6; } for (int j = 0; j < dailySlots.Length; j++) { dailySlots[j].dayNum = i; dailySlots[j].SetReward(); i++; } rewardWindow.SetActive(true); } public void ClaimButton() { chestFade.SetActive(false); rewardWindow.SetActive(false); } void ActivateChest() { chest.GetComponent<Animator>().enabled = true; chestImage.sprite = chestClose; chestImage.color = new Color(chestImage.color.r, chestImage.color.g, chestImage.color.b, 1); lightCircle.gameObject.SetActive(true); isSpined = true; activateButton.SetActive(true); isTimerTick = false; timer.gameObject.SetActive(false); } public void ButtonLeft() { leftButton.GetComponent<Button>().enabled = false; Color tmp = leftButton.GetComponent<Image>().color; tmp -= new Color(0.05f, 0.05f, 0.05f); leftButton.GetComponent<Image>().color = tmp; rightButton.GetComponent<Button>().enabled = true; Color tmp1 = rightButton.GetComponent<Image>().color; tmp1 += new Color(0.05f, 0.05f, 0.05f); rightButton.GetComponent<Image>().color = tmp1; int i = 1; for (int j = 0; j < dailySlots.Length; j++) { dailySlots[j].dayNum = i; dailySlots[j].SetReward(); i++; } } public void ButtonRight() { rightButton.GetComponent<Button>().enabled = false; Color tmp = rightButton.GetComponent<Image>().color; tmp -= new Color(0.05f, 0.05f, 0.05f); rightButton.GetComponent<Image>().color = tmp; leftButton.GetComponent<Button>().enabled = true; Color tmp1 = leftButton.GetComponent<Image>().color; tmp1 += new Color(0.05f, 0.05f, 0.05f); leftButton.GetComponent<Image>().color = tmp1; int i = 6; for (int j = 0; j < dailySlots.Length; j++) { dailySlots[j].dayNum = i; dailySlots[j].SetReward(); i++; } } public void RewardedVideoButton() { AppMetrica.Instance.ReportEvent("#REWARDx2_BUTTON pressed"); DevToDev.Analytics.CustomEvent("#REWARDx2_BUTTON pressed"); _isRewardedVideoWatched = true; if (PlayerPrefs.GetInt("MusicIsOn") == 1) { musicWasPlaying = true; //PlayerPrefs.SetInt("MusicIsOn", 0); //SoundManager.MuteMusic(true); SoundManager.Instance.currentMusic.Stop(); } #if UNITY_EDITOR AdsManager.Instance.isRewardVideoWatched = true; #elif UNITY_ANDROID || UNITY_IOS AdsManager.Instance.ShowRewardedVideo(); #endif } }
27.603774
100
0.571917
[ "Apache-2.0" ]
MadGriffonGames/BiltyBlop
Assets/Scripts/Menu&UI/DailyReward.cs
10,243
C#
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; using System.Collections.Immutable; using System.ComponentModel.Composition; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.CodeRefactorings; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Editor.Host; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Editor.Tags; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.CodeAnalysis.Shared.Utilities; using Microsoft.VisualStudio.Language.Intellisense; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Editor; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.Editor.Implementation.Suggestions { [Export(typeof(ISuggestedActionsSourceProvider))] [Export(typeof(SuggestedActionsSourceProvider))] [VisualStudio.Utilities.ContentType(ContentTypeNames.RoslynContentType)] [VisualStudio.Utilities.ContentType(ContentTypeNames.XamlContentType)] [VisualStudio.Utilities.Name("Roslyn Code Fix")] [VisualStudio.Utilities.Order] internal partial class SuggestedActionsSourceProvider : ISuggestedActionsSourceProvider { private static readonly Guid s_CSharpSourceGuid = new Guid("b967fea8-e2c3-4984-87d4-71a38f49e16a"); private static readonly Guid s_visualBasicSourceGuid = new Guid("4de30e93-3e0c-40c2-a4ba-1124da4539f6"); private static readonly Guid s_xamlSourceGuid = new Guid("a0572245-2eab-4c39-9f61-06a6d8c5ddda"); private const int InvalidSolutionVersion = -1; private readonly IThreadingContext _threadingContext; private readonly ICodeRefactoringService _codeRefactoringService; private readonly IDiagnosticAnalyzerService _diagnosticService; private readonly ICodeFixService _codeFixService; private readonly ISuggestedActionCategoryRegistryService _suggestedActionCategoryRegistry; public readonly ICodeActionEditHandlerService EditHandler; public readonly IAsynchronousOperationListener OperationListener; public readonly IWaitIndicator WaitIndicator; public readonly ImmutableArray<Lazy<ISuggestedActionCallback>> ActionCallbacks; public readonly ImmutableArray<Lazy<IImageMonikerService, OrderableMetadata>> ImageMonikerServices; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public SuggestedActionsSourceProvider( IThreadingContext threadingContext, ICodeRefactoringService codeRefactoringService, IDiagnosticAnalyzerService diagnosticService, ICodeFixService codeFixService, ICodeActionEditHandlerService editHandler, IWaitIndicator waitIndicator, ISuggestedActionCategoryRegistryService suggestedActionCategoryRegistry, IAsynchronousOperationListenerProvider listenerProvider, [ImportMany] IEnumerable<Lazy<IImageMonikerService, OrderableMetadata>> imageMonikerServices, [ImportMany] IEnumerable<Lazy<ISuggestedActionCallback>> actionCallbacks) { _threadingContext = threadingContext; _codeRefactoringService = codeRefactoringService; _diagnosticService = diagnosticService; _codeFixService = codeFixService; _suggestedActionCategoryRegistry = suggestedActionCategoryRegistry; ActionCallbacks = actionCallbacks.ToImmutableArray(); EditHandler = editHandler; WaitIndicator = waitIndicator; OperationListener = listenerProvider.GetListener(FeatureAttribute.LightBulb); ImageMonikerServices = ExtensionOrderer.Order(imageMonikerServices).ToImmutableArray(); } public ISuggestedActionsSource CreateSuggestedActionsSource(ITextView textView, ITextBuffer textBuffer) { Contract.ThrowIfNull(textView); Contract.ThrowIfNull(textBuffer); return new SuggestedActionsSource(_threadingContext, this, textView, textBuffer, _suggestedActionCategoryRegistry); } } }
50.186047
161
0.772243
[ "Apache-2.0" ]
20chan/roslyn
src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActionsSourceProvider.cs
4,318
C#
/* * 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 cloudfront-2019-03-26.normal.json service model. */ using System; using System.Net; using Amazon.Runtime; namespace Amazon.CloudFront.Model { ///<summary> /// CloudFront exception /// </summary> #if !PCL && !NETSTANDARD [Serializable] #endif public class MissingBodyException : AmazonCloudFrontException { /// <summary> /// Constructs a new MissingBodyException with the specified error /// message. /// </summary> /// <param name="message"> /// Describes the error encountered. /// </param> public MissingBodyException(string message) : base(message) {} /// <summary> /// Construct instance of MissingBodyException /// </summary> /// <param name="message"></param> /// <param name="innerException"></param> public MissingBodyException(string message, Exception innerException) : base(message, innerException) {} /// <summary> /// Construct instance of MissingBodyException /// </summary> /// <param name="innerException"></param> public MissingBodyException(Exception innerException) : base(innerException) {} /// <summary> /// Construct instance of MissingBodyException /// </summary> /// <param name="message"></param> /// <param name="innerException"></param> /// <param name="errorType"></param> /// <param name="errorCode"></param> /// <param name="requestId"></param> /// <param name="statusCode"></param> public MissingBodyException(string message, Exception innerException, ErrorType errorType, string errorCode, string requestId, HttpStatusCode statusCode) : base(message, innerException, errorType, errorCode, requestId, statusCode) {} /// <summary> /// Construct instance of MissingBodyException /// </summary> /// <param name="message"></param> /// <param name="errorType"></param> /// <param name="errorCode"></param> /// <param name="requestId"></param> /// <param name="statusCode"></param> public MissingBodyException(string message, ErrorType errorType, string errorCode, string requestId, HttpStatusCode statusCode) : base(message, errorType, errorCode, requestId, statusCode) {} #if !PCL && !NETSTANDARD /// <summary> /// Constructs a new instance of the MissingBodyException class with serialized data. /// </summary> /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown.</param> /// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination.</param> /// <exception cref="T:System.ArgumentNullException">The <paramref name="info" /> parameter is null. </exception> /// <exception cref="T:System.Runtime.Serialization.SerializationException">The class name is null or <see cref="P:System.Exception.HResult" /> is zero (0). </exception> protected MissingBodyException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { } #endif } }
42.525773
178
0.645091
[ "Apache-2.0" ]
NGL321/aws-sdk-net
sdk/src/Services/CloudFront/Generated/Model/MissingBodyException.cs
4,125
C#
using Abp.AutoMapper; using MahjongBuddy.Game; using MahjongBuddy.Users; using System.Collections.Generic; namespace MahjongBuddy.MjGames.Dto { [AutoMap(typeof(MjGameSession))] public class CreateMjGameSessionInput { public long MjGameId { get; set; } public ICollection<long> UsersId { get; set; } public MjGameWind Wind { get; set; } public int GameNo { get; set; } public CreateMjGameSessionInput() { UsersId = new List<long>(); } } }
24.818182
55
0.613553
[ "MIT" ]
tthiatma/mj-buddy-ntier
MahjongBuddy.Application/MjGames/Dto/CreateMjGameSessionInput.cs
548
C#
using System; namespace Nyan.Core.Modules.Data { [AttributeUsage(AttributeTargets.Class)] public sealed class CacheEntityAttribute : Attribute { // ReSharper restore InconsistentNaming [NotNull] public string IdentifierPropertyName; } }
24.545455
56
0.722222
[ "MIT" ]
bucknellu/Nyan
Core/Modules/Data/CacheEntityAttribute.cs
272
C#
using System; using System.Diagnostics; namespace SqlPad.Oracle { [DebuggerDisplay("OracleCodeCompletionItem (Name={Label}; Category={Category}; Priority={Priority})")] public class OracleCodeCompletionItem : ICodeCompletionItem { public string Category { get; set; } public string Label { get; set; } public StatementGrammarNode StatementNode { get; set; } public int Priority { get; set; } public int CategoryPriority { get; set; } public int InsertOffset { get; set; } public int CaretOffset { get; set; } public string Text { get; set; } public string Description { get; set; } protected bool Equals(OracleCodeCompletionItem other) { return String.Equals(Category, other.Category) && String.Equals(Label, other.Label) && Equals(StatementNode, other.StatementNode) && Priority == other.Priority && CategoryPriority == other.CategoryPriority && InsertOffset == other.InsertOffset && CaretOffset == other.CaretOffset && String.Equals(Text, other.Text) && String.Equals(Description, other.Description); } public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) { return false; } if (ReferenceEquals(this, obj)) { return true; } return obj.GetType() == GetType() && Equals((OracleCodeCompletionItem)obj); } public override int GetHashCode() { unchecked { var hashCode = Category?.GetHashCode() ?? 0; hashCode = (hashCode * 397) ^ (Label?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (StatementNode?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ Priority; hashCode = (hashCode * 397) ^ CategoryPriority; hashCode = (hashCode * 397) ^ InsertOffset; hashCode = (hashCode * 397) ^ CaretOffset; hashCode = (hashCode * 397) ^ (Text?.GetHashCode() ?? 0); return hashCode; } } } public static class OracleCodeCompletionCategory { public const string Keyword = "Keyword"; public const string DataType = "Data type"; public const string DatabaseSchema = "Database Schema"; public const string SchemaObject = "Schema Object"; public const string InlineView = "Inline View"; public const string CommonTableExpression = "Common Table Expression"; public const string Column = "Column"; public const string Pseudocolumn = "Pseudo column"; public const string AllColumns = "All Columns"; public const string JoinMethod = "Join Method"; public const string JoinConditionByReferenceConstraint = "Join Condition (foreign key)"; public const string JoinConditionByName = "Join Condition (column name)"; public const string PackageFunction = "Package function"; public const string SchemaFunction = "Schema function"; public const string Package = "Package"; public const string DatabaseLink = "Database link"; public const string Partition = "Partition"; public const string Subpartition = "Sub-partition"; public const string FunctionParameter = "Function parameter"; public const string BuiltInFunction = "Built-in function"; public const string XmlTable = "XML table"; public const string JsonTable = "JSON table"; public const string TableCollection = "Table collection"; public const string SqlModel = "Model clause"; public const string PivotTable = "Pivot table"; public const string BindVariable = "Bind variable"; public const string PlSqlVariable = "PL/SQL variable"; } }
33.699029
103
0.698646
[ "MIT" ]
Husqvik/SQLPad
SqlPad.Oracle/OracleCodeCompletionItem.cs
3,471
C#
// <copyright file="IFavoriteDistributionListMemberDataRepository.cs" company="Microsoft"> // Copyright (c) Microsoft. All rights reserved. // </copyright> namespace Microsoft.Teams.Apps.DLLookup.Repositories.Interfaces { using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.Teams.Apps.DLLookup.Models; /// <summary> /// This interface contains read and write operations for distribution list member. /// </summary> public interface IFavoriteDistributionListMemberDataRepository { /// <summary> /// Add favorite distribution list member data to storage. /// </summary> /// <param name="favoriteDistributionListMemberData">Favorite distribution list member data to be stored in table storage.</param> /// <returns>A <see cref="Task"/> representing the result of the asynchronous operation.</returns> Task AddFavoriteDistributionListMemberAsync(FavoriteDistributionListMemberData favoriteDistributionListMemberData); /// <summary> /// Get list of distribution list members based on group id and user id. /// </summary> /// <param name="groupId">Distribution list id to filter records.</param> /// <param name="accessToken">Token to access MS graph</param> /// <param name="userObjectId">User's Azure AD Id.</param> /// <returns>A collection of distribution lists.</returns> Task<List<DistributionListMember>> GetMembersAsync(string groupId, string accessToken, string userObjectId); /// <summary> /// Adds user favorite distribution list member to storage. /// </summary> /// <param name="favoriteDistributionListMemberDataEntity">Favorite distribution list member data to be added to storage.</param> /// <returns>A task that represents the work queued to execute.</returns> Task AddFavoriteMemberToStorageAsync(FavoriteDistributionListMemberTableEntity favoriteDistributionListMemberDataEntity); /// <summary> /// Get favorite distribution list members from storage. /// </summary> /// <param name="userObjectId">User's Azure AD id.</param> /// <returns>Favorite Distribution List members from storage.</returns> Task<IEnumerable<FavoriteDistributionListMemberTableEntity>> GetFavoriteMembersFromStorageAsync(string userObjectId); /// <summary> /// Removes distribution list member from storage. /// </summary> /// <param name="favoriteDistributionListMemberTableEntity">Favorite distribution list member data to be deleted from storage.</param> /// <returns>A task that represents the work queued to execute.</returns> Task DeleteFavoriteMemberFromStorageAsync(FavoriteDistributionListMemberTableEntity favoriteDistributionListMemberTableEntity); /// <summary> /// Get user favorite distribution list member from storage. /// </summary> /// <param name="pinnedDistributionListId">Unique member id.</param> /// <param name="userObjectId">User's Azure AD id.</param> /// <returns>User favorite distribution list record based on pinned member and group id.</returns> Task<FavoriteDistributionListMemberTableEntity> GetFavoriteMemberFromStorageAsync(string pinnedDistributionListId, string userObjectId); } }
54.66129
144
0.709649
[ "MIT" ]
KennethBWSong/microsoft-teams-apps-contactgrouplookup
Source/Microsoft.Teams.Apps.DLLookup/Repositories/Interfaces/IFavoriteDistributionListMemberDataRepository.cs
3,391
C#
using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Text; using System.Windows.Forms; using ExampleBase; using NetOffice; using Outlook = NetOffice.OutlookApi; using NetOffice.OutlookApi.Enums; namespace OutlookExamplesCS4 { /// <summary> /// Example 1 - Inbox Folder /// </summary> internal partial class Example01 : UserControl , IExample { #region Ctor public Example01() { InitializeComponent(); } #endregion #region IExample public void RunExample() { // its an example with an own visual control // checkout buttonStartExample_Click } public string Caption { get { return HostApplication.LCID == 1033 ? "Example01" : "Beispiel01"; } } public string Description { get { return HostApplication.LCID == 1033 ? "Inbox Folder" : "Posteingang"; } } public void Connect(IHost hostApplication) { HostApplication = hostApplication; } public UserControl Panel { get { return this; } } #endregion #region Properties internal IHost HostApplication { get; private set; } #endregion #region UI Trigger private void buttonStartExample_Click(object sender, EventArgs e) { // start outlook Outlook.Application outlookApplication = new Outlook.Application(); // get inbox Outlook._NameSpace outlookNS = outlookApplication.GetNamespace("MAPI"); Outlook.MAPIFolder inboxFolder = outlookNS.GetDefaultFolder(OlDefaultFolders.olFolderInbox); // setup gui listViewInboxFolder.Items.Clear(); labelItemsCount.Text = string.Format("You have {0} e-mails.", inboxFolder.Items.Count); // we fetch the inbox folder items. foreach (COMObject item in inboxFolder.Items) { // not every item in the inbox is a mail item Outlook.MailItem mailItem = item as Outlook.MailItem; if (null != mailItem) { ListViewItem newItem = listViewInboxFolder.Items.Add(mailItem.SenderName); newItem.SubItems.Add(mailItem.Subject); } } // close outlook and dispose outlookApplication.Quit(); outlookApplication.Dispose(); } #endregion } }
27.29703
105
0.556765
[ "MIT" ]
NetOffice/NetOffice
Examples/Outlook/C#/Standard Examples/OutookExamples/Examples/Example01.cs
2,759
C#
using System.Text.RegularExpressions; using Microsoft.Xna.Framework; using Pathoschild.Stardew.ChestsAnywhere.Framework.Containers; using StardewValley; using StardewValley.Menus; namespace Pathoschild.Stardew.ChestsAnywhere.Framework { /// <summary>A chest with metadata.</summary> internal class ManagedChest { /********* ** Properties *********/ /// <summary>A regular expression which matches a group of tags in the chest name.</summary> private const string TagGroupPattern = @"\|([^\|]+)\|"; /// <summary>The default name to display if it hasn't been customised.</summary> private readonly string DefaultName; /********* ** Accessors *********/ /// <summary>The storage container.</summary> public IContainer Container { get; } /// <summary>The chest's display name.</summary> public string Name { get; private set; } /// <summary>The category name (if any).</summary> public string Category { get; private set; } /// <summary>Whether the chest should be ignored.</summary> public bool IsIgnored { get; private set; } /// <summary>The sort value (if any).</summary> public int? Order { get; private set; } /// <summary>The location or building which contains the chest.</summary> public GameLocation Location { get; } /// <summary>The chest's tile position within its location or building.</summary> public Vector2 Tile { get; } /********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="container">The storage container.</param> /// <param name="location">The location or building which contains the chest.</param> /// <param name="tile">The chest's tile position within its location or building.</param> /// <param name="defaultName">The default name to display if it hasn't been customised.</param> public ManagedChest(IContainer container, GameLocation location, Vector2 tile, string defaultName) { // save values this.Container = container; this.Location = location; this.Tile = tile; this.DefaultName = defaultName; // parse name if (container.HasDefaultName() || string.IsNullOrWhiteSpace(container.Name)) this.Name = this.DefaultName; else { string name = !container.HasDefaultName() ? container.Name : defaultName; // read |tags| foreach (Match match in Regex.Matches(name, ManagedChest.TagGroupPattern)) { string tag = match.Groups[1].Value; // ignore if (tag.ToLower() == "ignore") { this.IsIgnored = true; continue; } // category if (tag.ToLower().StartsWith("cat:")) { this.Category = tag.Substring(4).Trim(); continue; } // order if (int.TryParse(tag, out int order)) this.Order = order; } // read display name name = Regex.Replace(name, ManagedChest.TagGroupPattern, "").Trim(); this.Name = !string.IsNullOrWhiteSpace(name) && name != this.Container.DefaultName ? name : this.DefaultName; } // normalise if (this.Category == null) this.Category = ""; } /// <summary>Get the grouping category for a chest.</summary> public string GetGroup() { return !string.IsNullOrWhiteSpace(this.Category) ? this.Category : this.Location.Name; } /// <summary>Update the chest metadata.</summary> /// <param name="name">The chest's display name.</param> /// <param name="category">The category name (if any).</param> /// <param name="order">The sort value (if any).</param> /// <param name="ignored">Whether the chest should be ignored.</param> public void Update(string name, string category, int? order, bool ignored) { // update high-level metadata this.Name = !string.IsNullOrWhiteSpace(name) ? name.Trim() : this.DefaultName; this.Category = category?.Trim() ?? ""; this.Order = order; this.IsIgnored = ignored; // build internal name string internalName = !this.HasDefaultName() ? this.Name : this.Container.DefaultName; if (this.Order.HasValue) internalName += $" |{this.Order}|"; if (this.IsIgnored) internalName += " |ignore|"; if (!string.IsNullOrWhiteSpace(this.Category) && this.Category != this.Location.Name) internalName += $" |cat:{this.Category}|"; // update container this.Container.Name = !string.IsNullOrWhiteSpace(internalName) ? internalName : this.Container.DefaultName; } /// <summary>Open a menu to transfer items between the player's inventory and this chest.</summary> public ItemGrabMenu OpenMenu() { return this.Container.OpenMenu(); } /// <summary>Get whether the container has its default name.</summary> public bool HasDefaultName() { return string.IsNullOrWhiteSpace(this.Name) || this.Name == this.DefaultName; } } }
38.025974
107
0.545765
[ "MIT" ]
CrimsonTautology/StardewMods
ChestsAnywhere/Framework/ManagedChest.cs
5,856
C#
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // <auto-generated/> #nullable disable using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.MachineLearning.Models { /// <summary> Strictly used in update requests. </summary> public partial class OnlineDeploymentPatch { /// <summary> Initializes a new instance of OnlineDeploymentPatch. </summary> public OnlineDeploymentPatch() { Tags = new ChangeTrackingDictionary<string, string>(); } /// <summary> Managed service identity (system assigned and/or user assigned identities). </summary> public PartialManagedServiceIdentity Identity { get; set; } /// <summary> Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. </summary> public string Kind { get; set; } /// <summary> The geo-location where the resource lives. </summary> public string Location { get; set; } /// <summary> /// Additional attributes of the entity. /// Please note <see cref="PartialOnlineDeployment"/> is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include <see cref="PartialKubernetesOnlineDeployment"/> and <see cref="PartialManagedOnlineDeployment"/>. /// </summary> public PartialOnlineDeployment Properties { get; set; } /// <summary> Sku details required for ARM contract for Autoscaling. </summary> public PartialSku Sku { get; set; } /// <summary> Resource tags. </summary> public IDictionary<string, string> Tags { get; } } }
46.325
249
0.683216
[ "MIT" ]
damodaravadhani/azure-sdk-for-net
sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/Models/OnlineDeploymentPatch.cs
1,853
C#
using SimpleChat.Core; using SimpleChat.Core.ViewModel; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Text; namespace SimpleChat.ViewModel.User { public record UserUpdateVM : UpdateVM { [Required(ErrorMessage= APIStatusCode.ERR03001)] [MinLength(5, ErrorMessage= APIStatusCode.ERR03002)] [MaxLength(100, ErrorMessage= APIStatusCode.ERR03003)] public string DisplayName { get; set; } [MinLength(5, ErrorMessage= APIStatusCode.ERR03002)] [MaxLength(500, ErrorMessage= APIStatusCode.ERR03003)] public string About { get; set; } } }
31.380952
62
0.720789
[ "MIT" ]
SimpleChatApp/SimpleChat-WebAPI
SimpleChat.ViewModel/User/UserUpdateVM.cs
661
C#
using ConstChile.Indicators; using ConstChile.Persistance; using System; using System.Collections.Generic; using System.Data.Entity; using System.Linq; using System.Threading.Tasks; using System.Web.Http; using System.Web.Http.Cors; using System.Web.Http.Description; namespace WS.Controllers { [EnableCors(origins: "*", headers: "*", methods: "*")] [RoutePrefix("api/Dolar")] public class DolarController : ApiController { private IndicatorsContext db = new IndicatorsContext(); // GET api/Dolar public IQueryable<Dolar> GetDolars() { return db.Dolars; } // GET api/Dolar/5 [ResponseType(typeof(IList<Dolar>))] public async Task<IHttpActionResult> GetDolar(string id) { DateTime date; int year; IList<Dolar> Dolars = null; Dolars = new List<Dolar>(1); if (DateTime.TryParse(id, out date)) { var Dolar = await db.Dolars.FindAsync(date); Dolars.Add(Dolar); } else { int.TryParse(id, out year); Dolars = await db.Dolars.Where(it => it.Date.Year == year).ToListAsync(); } if (Dolars.Count == 0) { return NotFound(); } return Ok(Dolars); } // GET api/Dolar/year/month [HttpGet] [ResponseType(typeof(IList<Dolar>))] [Route("{year}/{month}")] public async Task<IHttpActionResult> GetDolar(int year, int month) { var Dolars = await db.Dolars.Where(it => it.Date.Year == year && it.Date.Month == month).ToListAsync(); if (Dolars == null) { return NotFound(); } return Ok(Dolars); } // GET api/Dolar/year [HttpGet] [ResponseType(typeof(Dolar))] [Route("{year}/{month}/{day}")] public async Task<IHttpActionResult> GetDolar(int year, int month, int day) { var Dolars = await db.Dolars.Where(it => it.Date.Year == year && it.Date.Month == month && it.Date.Day == day).FirstOrDefaultAsync(); if (Dolars == null) { return NotFound(); } return Ok(Dolars); } protected override void Dispose(bool disposing) { if (disposing) { db.Dispose(); } base.Dispose(disposing); } } }
28.340659
145
0.519193
[ "MIT" ]
darsen/const-chile
WS/Controllers/DolarController.cs
2,581
C#
//=================================================================================== // Microsoft patterns & practices // Composite Application Guidance for Windows Presentation Foundation and Silverlight //=================================================================================== // Copyright (c) Microsoft Corporation. All rights reserved. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT // LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND // FITNESS FOR A PARTICULAR PURPOSE. //=================================================================================== // The example companies, organizations, products, domain names, // e-mail addresses, logos, people, places, and events depicted // herein are fictitious. No association with any real company, // organization, product, domain name, email address, logo, person, // places, or events is intended or should be inferred. //=================================================================================== using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Windows; using Microsoft.Practices.Prism.Properties; using Microsoft.Practices.ServiceLocation; namespace Microsoft.Practices.Prism.Regions { /// <summary> /// Implementation of <see cref="IRegionNavigationContentLoader"/> that relies on a <see cref="IServiceLocator"/> /// to create new views when necessary. /// </summary> public class RegionNavigationContentLoader : IRegionNavigationContentLoader { private readonly IServiceLocator serviceLocator; /// <summary> /// Initializes a new instance of the <see cref="RegionNavigationContentLoader"/> class with a service locator. /// </summary> /// <param name="serviceLocator">The service locator.</param> public RegionNavigationContentLoader(IServiceLocator serviceLocator) { this.serviceLocator = serviceLocator; } /// <summary> /// Gets the view to which the navigation request represented by <paramref name="navigationContext"/> applies. /// </summary> /// <param name="region">The region.</param> /// <param name="navigationContext">The context representing the navigation request.</param> /// <returns> /// The view to be the target of the navigation request. /// </returns> /// <remarks> /// If none of the views in the region can be the target of the navigation request, a new view /// is created and added to the region. /// </remarks> /// <exception cref="ArgumentException">when a new view cannot be created for the navigation request.</exception> public object LoadContent(IRegion region, NavigationContext navigationContext) { if (region == null) throw new ArgumentNullException("region"); if (navigationContext == null) throw new ArgumentNullException("navigationContext"); string candidateTargetContract = this.GetContractFromNavigationContext(navigationContext); var candidates = this.GetCandidatesFromRegion(region, candidateTargetContract); var acceptingCandidates = candidates.Where( v => { var navigationAware = v as INavigationAware; if (navigationAware != null && !navigationAware.IsNavigationTarget(navigationContext)) { return false; } var frameworkElement = v as FrameworkElement; if (frameworkElement == null) { return true; } navigationAware = frameworkElement.DataContext as INavigationAware; return navigationAware == null || navigationAware.IsNavigationTarget(navigationContext); }); var view = acceptingCandidates.FirstOrDefault(); if (view != null) { return view; } view = this.CreateNewRegionItem(candidateTargetContract); region.Add(view); return view; } /// <summary> /// Provides a new item for the region based on the supplied candidate target contract name. /// </summary> /// <param name="candidateTargetContract">The target contract to build.</param> /// <returns>An instance of an item to put into the <see cref="IRegion"/>.</returns> protected virtual object CreateNewRegionItem(string candidateTargetContract) { object newRegionItem; try { newRegionItem = this.serviceLocator.GetInstance<object>(candidateTargetContract); } catch (ActivationException e) { throw new InvalidOperationException( string.Format(CultureInfo.CurrentCulture, Resources.CannotCreateNavigationTarget, candidateTargetContract), e); } return newRegionItem; } /// <summary> /// Returns the candidate TargetContract based on the <see cref="NavigationContext"/>. /// </summary> /// <param name="navigationContext">The navigation contract.</param> /// <returns>The candidate contract to seek within the <see cref="IRegion"/> and to use, if not found, when resolving from the container.</returns> protected virtual string GetContractFromNavigationContext(NavigationContext navigationContext) { if (navigationContext == null) throw new ArgumentNullException("navigationContext"); var candidateTargetContract = UriParsingHelper.GetAbsolutePath(navigationContext.Uri); candidateTargetContract = candidateTargetContract.TrimStart('/'); return candidateTargetContract; } /// <summary> /// Returns the set of candidates that may satisfiy this navigation request. /// </summary> /// <param name="region">The region containing items that may satisfy the navigation request.</param> /// <param name="candidateNavigationContract">The candidate navigation target as determined by <see cref="GetContractFromNavigationContext"/></param> /// <returns>An enumerable of candidate objects from the <see cref="IRegion"/></returns> protected virtual IEnumerable<object> GetCandidatesFromRegion(IRegion region, string candidateNavigationContract) { if (region == null) throw new ArgumentNullException("region"); return region.Views.Where(v => string.Equals(v.GetType().Name, candidateNavigationContract, StringComparison.Ordinal) || string.Equals(v.GetType().FullName, candidateNavigationContract, StringComparison.Ordinal)); } } }
47.112583
157
0.608237
[ "Apache-2.0" ]
andrewdbond/CompositeWPF
sourceCode/compositewpf/V4/PrismLibrary/Desktop/Prism/Regions/RegionNavigationContentLoader.cs
7,114
C#
 namespace XamarinShot.Models.GameplayState { using Foundation; using GameplayKit; using SceneKit; using System; public class SlingshotComponent : GKComponent { private readonly SCNVector3 restPosition; private readonly SCNNode catapult; private SCNVector3 currentPosition; private SCNVector3 velocity; private bool physicsMode; public SlingshotComponent(SCNNode catapult) : base() { this.catapult = catapult; this.restPosition = catapult.Position; this.currentPosition = this.restPosition; this.physicsMode = false; // Started off and gets turned on only if needed this.velocity = SCNVector3.Zero; } public SlingshotComponent(NSCoder coder) => throw new NotImplementedException("init(coder:) has not been implemented"); public void SetGrabMode(bool state) { this.physicsMode = !state; // physics mode is off when grab mode is on if (this.physicsMode) { this.currentPosition = catapult.Position; } } public override void Update(double deltaTimeInSeconds) { if (this.physicsMode) { // add force in direction to rest point var offset = this.restPosition - this.currentPosition; var force = offset * 1000f - this.velocity * 10f; this.velocity += force * (float)deltaTimeInSeconds; this.currentPosition += this.velocity * (float)deltaTimeInSeconds; this.catapult.Position = this.currentPosition; // bring back to 0 this.catapult.EulerAngles = new SCNVector3(this.catapult.EulerAngles.X * 0.9f, this.catapult.EulerAngles.Y, this.catapult.EulerAngles.Z); } } } }
35.438596
127
0.570792
[ "MIT" ]
Art-Lav/ios-samples
ios12/XamarinShot/XamarinShot/Core/Gameplay State/Components/SlingshotComponent.cs
2,022
C#
namespace wcf_reference_client { public interface IFlights { void DisplayFlights(); void DisplayAirports(); } }
15.666667
31
0.631206
[ "Apache-2.0" ]
mjbradvica/wcf-reference
wcf-reference-client/wcf-reference-client/IFlights.cs
143
C#
/* * Copyright 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 robomaker-2018-06-29.normal.json service model. */ using System; using Amazon.Runtime; using Amazon.Util.Internal; namespace Amazon.RoboMaker { /// <summary> /// Configuration for accessing Amazon RoboMaker service /// </summary> public partial class AmazonRoboMakerConfig : ClientConfig { private static readonly string UserAgentString = InternalSDKUtils.BuildUserAgentString("3.5.0.34"); private string _userAgent = UserAgentString; /// <summary> /// Default constructor /// </summary> public AmazonRoboMakerConfig() { this.AuthenticationServiceName = "robomaker"; } /// <summary> /// The constant used to lookup in the region hash the endpoint. /// </summary> public override string RegionEndpointServiceName { get { return "robomaker"; } } /// <summary> /// Gets the ServiceVersion property. /// </summary> public override string ServiceVersion { get { return "2018-06-29"; } } /// <summary> /// Gets the value of UserAgent property. /// </summary> public override string UserAgent { get { return _userAgent; } } } }
26.0625
107
0.58705
[ "Apache-2.0" ]
altso/aws-sdk-net
sdk/src/Services/RoboMaker/Generated/AmazonRoboMakerConfig.cs
2,085
C#
using System; using System.Activities; using System.ServiceModel; using System.Globalization; using System.Runtime.Serialization; using System.IO; using System.Text; using System.Collections.Generic; using System.Net; using Microsoft.Xrm.Sdk; using Microsoft.Crm.Sdk.Messages; using Microsoft.Xrm.Sdk.Workflow; using Microsoft.Xrm.Sdk.Query; using System.Linq; using System.Data; namespace DataSnapshots { public sealed class TakeSnapshot : CodeActivity { [Input("FetchXML query")] public InArgument<String> FetchXMLQuery { get; set; } [Input("Snapshot mappings")] public InArgument<String> SnapshotMappings { get; set; } [Input("Target entity")] public InArgument<String> TargetEntity { get; set; } //name of your custom workflow activity for tracing/error logging private string _activityName = "TakeSnapshot"; /// <summary> /// Executes the workflow activity. /// </summary> /// <param name="executionContext">The execution context.</param> protected override void Execute(CodeActivityContext executionContext) { // Create the tracing service ITracingService tracingService = executionContext.GetExtension<ITracingService>(); if (tracingService == null) { throw new InvalidPluginExecutionException("Failed to retrieve tracing service."); } tracingService.Trace("Entered " + _activityName + ".Execute(), Activity Instance Id: {0}, Workflow Instance Id: {1}", executionContext.ActivityInstanceId, executionContext.WorkflowInstanceId); // Create the context IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>(); if (context == null) { throw new InvalidPluginExecutionException("Failed to retrieve workflow context."); } tracingService.Trace(_activityName + ".Execute(), Correlation Id: {0}, Initiating User: {1}", context.CorrelationId, context.InitiatingUserId); IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>(); IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId); try { //get the source->target field mappings from the input parameters string mappingsText = SnapshotMappings.Get(executionContext); //split up the lines into an array string[] mappingLines = mappingsText.Split(Environment.NewLine.ToCharArray()); //create a dictionary object to hold the mappings Dictionary<string, string> mappingDictionary = new Dictionary<string,string>(); //for each line in the array, split it on the ">" character and store the source->target as a key-value pair foreach(string s in mappingLines) { try { string targetfield = s.Split(">".ToCharArray())[1]; string sourcefield = s.Split(">".ToCharArray())[0]; tracingService.Trace("line: " + s + " source: " + sourcefield + " target: " + targetfield); mappingDictionary.Add(sourcefield, targetfield); } catch(Exception ex) { throw new InvalidPluginExecutionException("Error parsing source->target mappings."); } } //get the target entity name from the input parameters string targetEntityType = TargetEntity.Get(executionContext); //execute the fetchxml query and loop through the results EntityCollection recordsToProcess = service.RetrieveMultiple(new FetchExpression(FetchXMLQuery.Get(executionContext))); recordsToProcess.Entities.ToList().ForEach(a => { tracingService.Trace("instantiating new entity of type: " + targetEntityType); Entity targetRecord = new Entity(targetEntityType); //loop through the mapping key-value pairs foreach (string key in mappingDictionary.Keys) { //check to see if attribute exists in this particular result //fetchxml results don't return fields with null values if (a.Contains(key)) { //if the result field is an aliasedvalue, we need to handle it differently than non-aliasedvalue types if (a[key].GetType().FullName.ToUpperInvariant().EndsWith("ALIASEDVALUE")) { //cast it to aliasedvalue var resultfield = (AliasedValue)a[key]; //set the target field to the casted resultfield value targetRecord[mappingDictionary[key]] = resultfield.Value; //trace just in case tracingService.Trace("new source column [" + key + "]: destination [" + mappingDictionary[key] + "]: " + (resultfield.Value).ToString()); } else { //set the target field to the resultfield //target field needs to be of EXACT same type as result field //for example, this code doesn't work if you try to store an integer in a decimal field targetRecord[mappingDictionary[key]] = a[key]; //trace just in case tracingService.Trace("new source column [" + key + "]: destination [" + mappingDictionary[key] + "]: " + (a[key]).ToString()); } } } try { //create the record service.Create(targetRecord); } catch (FaultException<OrganizationServiceFault> e) { //catch orgservice faults tracingService.Trace("Exception: {0}", e.ToString()); // Handle the exception. throw new InvalidPluginExecutionException("Could not create snapshot record."); } catch (Exception ex) { //catch anything else throw new InvalidPluginExecutionException("Could not create snapshot record."); } }); } catch (FaultException<OrganizationServiceFault> e) { tracingService.Trace("Exception: {0}", e.ToString()); throw; } catch (Exception e) { tracingService.Trace("Exception: {0}", e.ToString()); throw; } tracingService.Trace("Exiting " + _activityName + ".Execute(), Correlation Id: {0}", context.CorrelationId); } } }
44.664706
169
0.534966
[ "Apache-2.0" ]
jasonlcook/Crm-Sample-Code
CrmDataSnapshots/DataSnapshots/TakeSnapshot.cs
7,595
C#
using loon.utils; namespace loon.geom { public class RectF : XY { public class Range : XY { public float left; public float top; public float right; public float bottom; public Range() { } public Range(RectF rect) : this(rect.Left(), rect.Top(), rect.Right(), rect.Bottom()) { } public Range(float left, float top, float right, float bottom) { this.left = left; this.top = top; this.right = right; this.bottom = bottom; } public Range(Range r) { left = r.left; top = r.top; right = r.right; bottom = r.bottom; } public override int GetHashCode() { uint prime = 31; uint result = 1; result = prime * result + NumberUtils.FloatToIntBits(left); result = prime * result + NumberUtils.FloatToIntBits(top); result = prime * result + NumberUtils.FloatToIntBits(right); result = prime * result + NumberUtils.FloatToIntBits(bottom); return (int)result; } public override bool Equals(object obj) { Range r = (Range)obj; if (r != null) { return left == r.left && top == r.top && right == r.right && bottom == r.bottom; } return false; } public bool IsEmpty() { return left >= right || top >= bottom; } public float X() { return left; } public float Y() { return top; } public float Width() { return right - left; } public float Height() { return bottom - top; } public float CenterX() { return ((int)(left + right)) >> 1; } public float CenterY() { return ((int)(top + bottom)) >> 1; } public float ExactCenterX() { return (left + right) * 0.5f; } public float ExactCenterY() { return (top + bottom) * 0.5f; } public void SetEmpty() { left = right = top = bottom = 0; } public void Set(float left, float top, float right, float bottom) { this.left = left; this.top = top; this.right = right; this.bottom = bottom; } public void Set(Range src) { this.left = src.left; this.top = src.top; this.right = src.right; this.bottom = src.bottom; } public void OffSet(float dx, float dy) { left += dx; top += dy; right += dx; bottom += dy; } public void OffSetTo(float newLeft, float newTop) { right += newLeft - left; bottom += newTop - top; left = newLeft; top = newTop; } public void InSet(float dx, float dy) { left += dx; top += dy; right -= dx; bottom -= dy; } public bool Contains(float x, float y) { return left < right && top < bottom && x >= left && x < right && y >= top && y < bottom; } public bool Contains(Circle circle) { float xmin = circle.x - circle.boundingCircleRadius; float xmax = xmin + 2f * circle.boundingCircleRadius; float ymin = circle.y - circle.boundingCircleRadius; float ymax = ymin + 2f * circle.boundingCircleRadius; return ((xmin > GetX() && xmin < GetX() + Width()) && (xmax > GetX() && xmax < GetX() + Width())) && ((ymin > GetY() && ymin < GetY() + Height()) && (ymax > GetY() && ymax < GetY() + Height())); } public bool Contains(float left, float top, float right, float bottom) { return this.left < this.right && this.top < this.bottom && this.left <= left && this.top <= top && this.right >= right && this.bottom >= bottom; } public bool Contains(Range r) { return this.left < this.right && this.top < this.bottom && left <= r.left && top <= r.top && right >= r.right && bottom >= r.bottom; } public bool Intersect(float left, float top, float right, float bottom) { if (this.left < right && left < this.right && this.top < bottom && top < this.bottom) { if (this.left < left) { this.left = left; } if (this.top < top) { this.top = top; } if (this.right > right) { this.right = right; } if (this.bottom > bottom) { this.bottom = bottom; } return true; } return false; } public bool Intersect(Range r) { return Intersect(r.left, r.top, r.right, r.bottom); } public bool SetIntersect(Range a, Range b) { if (a.left < b.right && b.left < a.right && a.top < b.bottom && b.top < a.bottom) { left = MathUtils.Max(a.left, b.left); top = MathUtils.Max(a.top, b.top); right = MathUtils.Min(a.right, b.right); bottom = MathUtils.Min(a.bottom, b.bottom); return true; } return false; } public bool Intersects(float left, float top, float right, float bottom) { return this.left < right && left < this.right && this.top < bottom && top < this.bottom; } public bool Intersects(Range a, Range b) { return a.left < b.right && b.left < a.right && a.top < b.bottom && b.top < a.bottom; } public void Union(float left, float top, float right, float bottom) { if ((left < right) && (top < bottom)) { if ((this.left < this.right) && (this.top < this.bottom)) { if (this.left > left) this.left = left; if (this.top > top) this.top = top; if (this.right < right) this.right = right; if (this.bottom < bottom) this.bottom = bottom; } else { this.left = left; this.top = top; this.right = right; this.bottom = bottom; } } } public void Union(Range r) { Union(r.left, r.top, r.right, r.bottom); } public void Union(float x, float y) { if (x < left) { left = x; } else if (x > right) { right = x; } if (y < top) { top = y; } else if (y > bottom) { bottom = y; } } public void Sort() { if (left > right) { float temp = left; left = right; right = temp; } if (top > bottom) { float temp = top; top = bottom; bottom = temp; } } public void Scale(float scale) { if (scale != 1.0f) { left = (float)(left * scale + 0.5f); top = (float)(top * scale + 0.5f); right = (float)(right * scale + 0.5f); bottom = (float)(bottom * scale + 0.5f); } } public RectF GetRect() { return new RectF(this); } public float GetX() { return X(); } public float GetY() { return Y(); } } public float width = 0f; public float height = 0f; public float x = 0f; public float y = 0f; public RectF() : this(0, 0, 0, 0) { } public RectF(float w, float h) : this(0, 0, w, h) { } public RectF(RectF rect) : this(rect.x, rect.y, rect.width, rect.height) { } public RectF(Range range) : this(range.X(), range.Y(), range.Width(), range.Height()) { } public RectF Set(RectF r) { this.x = r.x; this.y = r.y; this.width = r.width; this.height = r.height; return this; } public RectF Set(float x1, float y1, float w1, float h1) { this.x = x1; this.y = y1; this.width = w1; this.height = h1; return this; } public RectF(float x1, float y1, float w1, float h1) { this.x = x1; this.y = y1; this.width = w1; this.height = h1; } public bool Inside(float x, float y) { return (x >= this.x) && ((x - this.x) < this.width) && (y >= this.y) && ((y - this.y) < this.height); } public float GetRight() { return this.x + this.width; } public float GetBottom() { return this.y + this.height; } public RectF GetIntersection(RectF rect) { float x1 = MathUtils.Max(x, rect.x); float x2 = MathUtils.Min(x + width, rect.x + rect.width); float y1 = MathUtils.Max(y, rect.y); float y2 = MathUtils.Min(y + height, rect.y + rect.height); return new RectF(x1, y1, x2 - x1, y2 - y1); } public static RectF GetIntersection(RectF a, RectF b) { float a_x = a.x; float a_r = a.GetRight(); float a_y = a.y; float a_t = a.GetBottom(); float b_x = b.x; float b_r = b.GetRight(); float b_y = b.y; float b_t = b.GetBottom(); float i_x = MathUtils.Max(a_x, b_x); float i_r = MathUtils.Min(a_r, b_r); float i_y = MathUtils.Max(a_y, b_y); float i_t = MathUtils.Min(a_t, b_t); return i_x < i_r && i_y < i_t ? new RectF(i_x, i_y, i_r - i_x, i_t - i_y) : new RectF(); } public static RectF GetIntersection(RectF a, RectF b, RectF result) { float a_x = a.x; float a_r = a.GetRight(); float a_y = a.y; float a_t = a.GetBottom(); float b_x = b.x; float b_r = b.GetRight(); float b_y = b.y; float b_t = b.GetBottom(); float i_x = MathUtils.Max(a_x, b_x); float i_r = MathUtils.Min(a_r, b_r); float i_y = MathUtils.Max(a_y, b_y); float i_t = MathUtils.Min(a_t, b_t); if (i_x < i_r && i_y < i_t) { result.Set(i_x, i_y, i_r - i_x, i_t - i_y); return result; } return result; } public float Left() { return this.x; } public float Right() { return this.x + this.width; } public float Top() { return this.y; } public float Bottom() { return this.y + this.height; } public float MiddleX() { return this.x + this.width / 2f; } public float MiddleY() { return this.y + this.height / 2f; } public float CenterX() { return x + width / 2; } public float CenterY() { return y + height / 2; } public Range GetRange() { return new Range(this); } public float GetX() { return x; } public float GetY() { return y; } public float GetWidth() { return width; } public float GetHeight() { return height; } public bool isEmpty() { return width <= 0 && height <= 0; } public static void GetNearestCorner(float x, float y, float w, float h, float px, float py, PointF result) { result.Set(MathUtils.Nearest(px, x, x + w), MathUtils.Nearest(y, y, y + h)); } public static bool GetSegmentIntersectionIndices(float x, float y, float w, float h, float x1, float y1, float x2, float y2, float ti1, float ti2, PointF ti, PointF n1, PointF n2) { float dx = x2 - x1; float dy = y2 - y1; float nx = 0, ny = 0; float nx1 = 0, ny1 = 0, nx2 = 0, ny2 = 0; float p, q, r; for (int side = 1; side <= 4; side++) { switch (side) { case 1: nx = -1; ny = 0; p = -dx; q = x1 - x; break; case 2: nx = 1; ny = 0; p = dx; q = x + w - x1; break; case 3: nx = 0; ny = -1; p = -dy; q = y1 - y; break; default: nx = 0; ny = -1; p = dy; q = y + h - y1; break; } if (p == 0) { if (q <= 0) { return false; } } else { r = q / p; if (p < 0) { if (r > ti2) { return false; } else if (r > ti1) { ti1 = r; nx1 = nx; ny1 = ny; } } else { if (r < ti1) { return false; } else if (r < ti2) { ti2 = r; nx2 = nx; ny2 = ny; } } } } ti.Set(ti1, ti2); n1.Set(nx1, ny1); n2.Set(nx2, ny2); return true; } public static void GetDiff(float x1, float y1, float w1, float h1, float x2, float y2, float w2, float h2, RectF result) { result.Set(x2 - x1 - w1, y2 - y1 - h1, w1 + w2, h1 + h2); } public static bool ContainsPoint(float x, float y, float w, float h, float px, float py, float delta) { return px - x > delta && py - y > delta && x + w - px > delta && y + h - py > delta; } public static bool IsIntersecting(float x1, float y1, float w1, float h1, float x2, float y2, float w2, float h2) { return x1 < x2 + w2 && x2 < x1 + w1 && y1 < y2 + h2 && y2 < y1 + h1; } public static float GetSquareDistance(float x1, float y1, float w1, float h1, float x2, float y2, float w2, float h2) { float dx = x1 - x2 + (w1 - w2) / 2; float dy = y1 - y2 + (h1 - h2) / 2; return dx * dx + dy * dy; } public RectF Random() { this.x = MathUtils.Random(0f, LSystem.viewSize.GetWidth()); this.y = MathUtils.Random(0f, LSystem.viewSize.GetHeight()); this.width = MathUtils.Random(0f, LSystem.viewSize.GetWidth()); this.height = MathUtils.Random(0f, LSystem.viewSize.GetHeight()); return this; } public override int GetHashCode() { uint prime = 31; uint result = 1; result = prime * result + NumberUtils.FloatToIntBits(x); result = prime * result + NumberUtils.FloatToIntBits(y); result = prime * result + NumberUtils.FloatToIntBits(width); result = prime * result + NumberUtils.FloatToIntBits(height); return (int)result; } public override string ToString() { StringKeyValue builder = new StringKeyValue("RectF"); builder.Kv("x", x).Comma().Kv("y", y).Comma().Kv("width", width).Comma().Kv("height", height); return builder.ToString(); } } }
28.60574
120
0.375772
[ "Apache-2.0" ]
TheMadTitanSkid/LGame
C#/Loon2MonoGame/LoonMonoGame-Lib/loon/geom/RectF.cs
18,939
C#
using System; using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("NMoneys.Exchange")] [assembly: AssemblyDescription("Currency exchange capabilities for NMoneys")] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("6008a10f-70bd-400b-8ebb-112069622351")] [assembly: CLSCompliant(true)]
41.285714
85
0.778547
[ "BSD-3-Clause" ]
CenterEdge/nmoneys
src/NMoneys.Exchange/Properties/AssemblyInfo.cs
580
C#
/******************************************************************************* * Copyright 2019 Esri * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************/ using Esri.ArcGISRuntime.OpenSourceApps.DataCollection.Shared.Utilities; using Esri.ArcGISRuntime.OpenSourceApps.DataCollection.UWP.Views; using System; using System.Threading.Tasks; using Windows.Media.Capture; using Windows.Storage; namespace Esri.ArcGISRuntime.OpenSourceApps.DataCollection.UWP.Helpers { /// <summary> /// Helper class to process media inputs from both camera and file browsing /// </summary> class MediaHelper { /// <summary> /// Calls camera API to capture photo or video /// </summary> public static async Task<StorageFile> RecordMediaAsync() { CameraCaptureUI captureUI = new CameraCaptureUI(); captureUI.PhotoSettings.Format = CameraCaptureUIPhotoFormat.Jpeg; captureUI.PhotoSettings.AllowCropping = false; StorageFile storageFile = await captureUI.CaptureFileAsync(CameraCaptureUIMode.PhotoOrVideo); if (storageFile == null) { // User cancelled capture return null; } // prompt user to enter file name for the new attachment FileNameDialog fnd = new FileNameDialog(); await fnd.ShowAsync(); // rename file await storageFile.RenameAsync(fnd.FileName + storageFile.FileType, NameCollisionOption.ReplaceExisting); return storageFile; } /// <summary> /// Prompts user to choose a file from a list of supported files /// </summary> public static async Task<StorageFile> GetFileFromUser() { var picker = new Windows.Storage.Pickers.FileOpenPicker(); picker.ViewMode = Windows.Storage.Pickers.PickerViewMode.Thumbnail; picker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.PicturesLibrary; // create list of supported file for the picker filter foreach (var extension in FileExtensionHelper.AllowedExtensions) { picker.FileTypeFilter.Add(extension.Key); } var file = await picker.PickSingleFileAsync(); return file; } } }
38.688312
116
0.619671
[ "Apache-2.0" ]
krisbuote/data-collection-dotnet
src/DataCollection.UWP/Helpers/MediaHelper.cs
2,981
C#
// ------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See License.txt in the repo root for license information. // ------------------------------------------------------------ namespace Fabrikam.Workflow.Service { internal class WorkflowServiceOptions { public WorkflowServiceOptions() { MaxConcurrency = 20; PrefetchCount = 3000; } public string QueueEndpoint { get; set; } public string QueueName { get; set; } public string QueueAccessPolicyName { get; set; } public string QueueAccessPolicyKey { get; set; } public int MaxConcurrency { get; internal set; } public int PrefetchCount { get; internal set; } } }
29.103448
99
0.543839
[ "MIT" ]
DivyeshTikmani-MSFT/microservices-reference-implementation
src/shipping/workflow/Fabrikam.Workflow.Service/WorkflowServiceOptions.cs
846
C#
using System; using System.Collections.Generic; using System.Web; using System.Web.Routing; using Microsoft.AspNet.FriendlyUrls; namespace WebFormExample { public static class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { var settings = new FriendlyUrlSettings(); settings.AutoRedirectMode = RedirectMode.Permanent; routes.EnableFriendlyUrls(settings); } } }
26.5
66
0.668763
[ "Apache-2.0" ]
namlai000/WebFormExample
App_Code/RouteConfig.cs
479
C#
using System; using System.Threading.Tasks; using AElf.Kernel; using AElf.Kernel.Blockchain.Application; using AElf.OS.BlockSync.Application; using AElf.OS.BlockSync.Dto; using AElf.OS.BlockSync.Infrastructure; using AElf.OS.BlockSync.Types; using AElf.Sdk.CSharp; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Volo.Abp.BackgroundWorkers; using Volo.Abp.Threading; namespace AElf.OS.BlockSync.Worker { public class BlockDownloadWorker : PeriodicBackgroundWorkerBase { private readonly IBlockchainService _blockchainService; private readonly IBlockDownloadService _blockDownloadService; private readonly IBlockDownloadJobStore _blockDownloadJobStore; private readonly BlockSyncOptions _blockSyncOptions; public BlockDownloadWorker(AbpTimer timer, IBlockchainService blockchainService, IBlockDownloadService blockDownloadService, IBlockDownloadJobStore blockDownloadJobStore, IOptionsSnapshot<BlockSyncOptions> blockSyncOptions) : base(timer) { _blockchainService = blockchainService; _blockDownloadService = blockDownloadService; _blockDownloadJobStore = blockDownloadJobStore; _blockSyncOptions = blockSyncOptions.Value; Timer.Period = _blockSyncOptions.BlockDownloadTimerPeriod; } protected override void DoWork() { AsyncHelper.RunSync(ProcessDownloadJobAsync); } internal async Task ProcessDownloadJobAsync() { while (true) { var chain = await _blockchainService.GetChainAsync(); var jobInfo = await GetFirstAvailableWaitingJobAsync(chain); try { if (!ValidateBeforeDownload(jobInfo)) { return; } if (jobInfo.IsFinished) { await RemoveJobAndTargetStateAsync(jobInfo); continue; } Logger.LogDebug( $"Execute download job: CurrentTargetBlockHeight: {jobInfo.CurrentTargetBlockHeight}, TargetBlockHeight:{jobInfo.TargetBlockHeight}, SuggestedPeerPubkey:{jobInfo.SuggestedPeerPubkey}."); var downloadResult = await DownloadBlocksAsync(chain, jobInfo); if (downloadResult.DownloadBlockCount == 0) { Logger.LogDebug( $"Download block job finished: CurrentTargetBlockHeight: {jobInfo.CurrentTargetBlockHeight}, TargetBlockHeight:{jobInfo.TargetBlockHeight}."); await RemoveJobAndTargetStateAsync(jobInfo); continue; } _blockDownloadService.RemoveDownloadJobTargetState(jobInfo.CurrentTargetBlockHash); jobInfo.Deadline = TimestampHelper.GetUtcNow().AddMilliseconds(downloadResult.DownloadBlockCount * 300); jobInfo.CurrentTargetBlockHash = downloadResult.LastDownloadBlockHash; jobInfo.CurrentTargetBlockHeight = downloadResult.LastDownloadBlockHeight; jobInfo.IsFinished = downloadResult.DownloadBlockCount < _blockSyncOptions.MaxBlockDownloadCount; await _blockDownloadJobStore.UpdateAsync(jobInfo); Logger.LogDebug( $"Current download block job finished: CurrentTargetBlockHeight: {jobInfo.CurrentTargetBlockHeight}."); return; } catch (Exception e) { await RemoveJobAndTargetStateAsync(jobInfo); Logger.LogError(e,"Handle download job failed."); throw; } } } private async Task<BlockDownloadJobInfo> GetFirstAvailableWaitingJobAsync(Chain chain) { while (true) { var blockDownloadJob = await _blockDownloadJobStore.GetFirstWaitingJobAsync(); if (blockDownloadJob == null) return null; if (blockDownloadJob.CurrentTargetBlockHeight == 0 && blockDownloadJob.TargetBlockHeight <= chain.BestChainHeight) { await _blockDownloadJobStore.RemoveAsync(blockDownloadJob.JobId); continue; } return blockDownloadJob; } } private bool ValidateBeforeDownload(BlockDownloadJobInfo blockDownloadJobInfo) { if (blockDownloadJobInfo == null) return false; if (!_blockDownloadService.ValidateQueueAvailabilityBeforeDownload()) return false; if (blockDownloadJobInfo.CurrentTargetBlockHash != null && _blockDownloadService.IsNotReachedDownloadTarget(blockDownloadJobInfo.CurrentTargetBlockHash) && TimestampHelper.GetUtcNow() < blockDownloadJobInfo.Deadline) return false; return true; } private async Task<DownloadBlocksResult> DownloadBlocksAsync(Chain chain, BlockDownloadJobInfo jobInfo) { var downloadResult = new DownloadBlocksResult(); if (jobInfo.CurrentTargetBlockHeight == 0) { // Download blocks from longest chain downloadResult = await _blockDownloadService.DownloadBlocksAsync(new DownloadBlockDto { PreviousBlockHash = chain.LongestChainHash, PreviousBlockHeight = chain.LongestChainHeight, BatchRequestBlockCount = jobInfo.BatchRequestBlockCount, SuggestedPeerPubkey = jobInfo.SuggestedPeerPubkey, MaxBlockDownloadCount = _blockSyncOptions.MaxBlockDownloadCount, UseSuggestedPeer = true }); // Download blocks from best chain if (downloadResult.Success && downloadResult.DownloadBlockCount == 0) { downloadResult = await _blockDownloadService.DownloadBlocksAsync(new DownloadBlockDto { PreviousBlockHash = chain.BestChainHash, PreviousBlockHeight = chain.BestChainHeight, BatchRequestBlockCount = jobInfo.BatchRequestBlockCount, SuggestedPeerPubkey = jobInfo.SuggestedPeerPubkey, MaxBlockDownloadCount = _blockSyncOptions.MaxBlockDownloadCount, UseSuggestedPeer = true }); } // Download blocks from LIB if (downloadResult.Success && downloadResult.DownloadBlockCount == 0) { Logger.LogDebug($"Resynchronize from lib, lib height: {chain.LastIrreversibleBlockHeight}."); downloadResult = await _blockDownloadService.DownloadBlocksAsync(new DownloadBlockDto { PreviousBlockHash = chain.LastIrreversibleBlockHash, PreviousBlockHeight = chain.LastIrreversibleBlockHeight, BatchRequestBlockCount = jobInfo.BatchRequestBlockCount, SuggestedPeerPubkey = jobInfo.SuggestedPeerPubkey, MaxBlockDownloadCount = _blockSyncOptions.MaxBlockDownloadCount, UseSuggestedPeer = true }); } } // If last target block didn't become the longest chain, stop this job. else if (jobInfo.CurrentTargetBlockHeight <= chain.LongestChainHeight + 8) { downloadResult = await _blockDownloadService.DownloadBlocksAsync(new DownloadBlockDto { PreviousBlockHash = jobInfo.CurrentTargetBlockHash, PreviousBlockHeight = jobInfo.CurrentTargetBlockHeight, BatchRequestBlockCount = jobInfo.BatchRequestBlockCount, SuggestedPeerPubkey = jobInfo.SuggestedPeerPubkey, MaxBlockDownloadCount = _blockSyncOptions.MaxBlockDownloadCount, UseSuggestedPeer = false }); } return downloadResult; } private async Task RemoveJobAndTargetStateAsync(BlockDownloadJobInfo blockDownloadJobInfo) { await _blockDownloadJobStore.RemoveAsync(blockDownloadJobInfo.JobId); _blockDownloadService.RemoveDownloadJobTargetState(blockDownloadJobInfo.CurrentTargetBlockHash); } } }
45.371287
211
0.587561
[ "MIT" ]
booggzen/AElf
src/AElf.OS/BlockSync/Worker/BlockDownloadWorker.cs
9,165
C#
using ApplicationCore.Entities; using System.Linq; namespace ApplicationCore.Specifications { public class CategorySpecification : BaseSpecification<Category> { public CategorySpecification() :base(x => !x.ParentId.HasValue && x.CatalogCategories.Count > 0 && x.CatalogCategories.Any(c => c.CatalogItem.CanCustomize)) { AddInclude(x => x.CatalogCategories); } public CategorySpecification(bool forMenuList) : base(x => x.CatalogCategories.Count > 0) { AddInclude(x => x.Parent); AddInclude(x => x.CatalogCategories); AddInclude($"{nameof(Category.CatalogCategories)}.{nameof(CatalogCategory.CatalogItem)}"); AddInclude(x => x.CatalogTypes); AddInclude($"{nameof(Category.CatalogTypes)}.{nameof(CatalogTypeCategory.CatalogType)}"); ApplyOrderBy(x => x.Order); } public CategorySpecification(string slug) : base(x => x.Slug == slug) { } } }
33.774194
137
0.614136
[ "MIT" ]
joaoGoncalves81/GrocerySales
src/Shared/ApplicationCore/Specifications/CategorySpecification.cs
1,049
C#
namespace DramaDice.Models; public class Die { public int Id { get; set; } public int Value { get; set; } public bool IsLegendary { get; set; } public DieStatus Status { get; set; } = DieStatus.New; public DieCategory Category { get; set; } = DieCategory.Live; } public enum DieStatus { New = 0, InGroup = 1 } public enum DieCategory { Live = 1, Exploding = 2 }
16.791667
65
0.630273
[ "MIT" ]
JSpring3/drama-dice
DramaDice/Models/Die.cs
405
C#
using Stylophone.Common.Interfaces; using System.IO; using System.Threading.Tasks; using Windows.Storage; using Newtonsoft.Json; using Microsoft.Toolkit.Uwp.Helpers; using System; using Windows.Foundation.Collections; namespace Stylophone.Services { public sealed class ApplicationStorageService : IApplicationStorageService { /// <summary> /// The <see cref="IPropertySet"/> with the settings targeted by the current instance. /// </summary> private readonly IPropertySet SettingsStorage = ApplicationData.Current.LocalSettings.Values; private async Task<StorageFolder> GetFolderAsync(string name) { var localFolder = ApplicationData.Current.LocalFolder; if (name != "") { localFolder = await localFolder.CreateFolderAsync(name, CreationCollisionOption.OpenIfExists); } return localFolder; } public async Task<bool> DoesFileExistAsync(string fileName, string parentFolder = "") { var folder = await GetFolderAsync(parentFolder); return await StorageFileHelper.FileExistsAsync(folder, fileName); } public async Task SaveDataToFileAsync(string fileName, byte[] data, string parentFolder = "") { var folder = await GetFolderAsync(parentFolder); await StorageFileHelper.WriteBytesToFileAsync(folder, data, fileName); } public async Task<Stream> OpenFileAsync(string fileName, string parentFolder = "") { var folder = await GetFolderAsync(parentFolder); var file = await folder.GetFileAsync(fileName); return await file.OpenStreamForReadAsync(); } public async Task DeleteFolderAsync(string folderName) { var folder = await GetFolderAsync(folderName); if (folder != ApplicationData.Current.LocalFolder) { await folder.DeleteAsync(); } } public void SetValue<T>(string key, T value) { if (!SettingsStorage.ContainsKey(key)) SettingsStorage.Add(key, value); else SettingsStorage[key] = value; } public T GetValue<T>(string key, T defaultValue = default) { if (SettingsStorage.TryGetValue(key, out object value)) { try { return (T)value; } catch { // Corrupted storage, return default } } return defaultValue; } } }
31.376471
110
0.59655
[ "MIT" ]
Difegue/Stylophone
Sources/Stylophone/Services/ApplicationStorageService.cs
2,669
C#
// <auto-generated> // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/ads/googleads/v6/resources/campaign.proto // </auto-generated> #pragma warning disable 1591, 0612, 3021 #region Designer generated code using pb = global::Google.Protobuf; using pbc = global::Google.Protobuf.Collections; using pbr = global::Google.Protobuf.Reflection; using scg = global::System.Collections.Generic; namespace Google.Ads.GoogleAds.V6.Resources { /// <summary>Holder for reflection information generated from google/ads/googleads/v6/resources/campaign.proto</summary> public static partial class CampaignReflection { #region Descriptor /// <summary>File descriptor for google/ads/googleads/v6/resources/campaign.proto</summary> public static pbr::FileDescriptor Descriptor { get { return descriptor; } } private static pbr::FileDescriptor descriptor; static CampaignReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "CjBnb29nbGUvYWRzL2dvb2dsZWFkcy92Ni9yZXNvdXJjZXMvY2FtcGFpZ24u", "cHJvdG8SIWdvb2dsZS5hZHMuZ29vZ2xlYWRzLnY2LnJlc291cmNlcxosZ29v", "Z2xlL2Fkcy9nb29nbGVhZHMvdjYvY29tbW9uL2JpZGRpbmcucHJvdG8aNWdv", "b2dsZS9hZHMvZ29vZ2xlYWRzL3Y2L2NvbW1vbi9jdXN0b21fcGFyYW1ldGVy", "LnByb3RvGjJnb29nbGUvYWRzL2dvb2dsZWFkcy92Ni9jb21tb24vZnJlcXVl", "bmN5X2NhcC5wcm90bxo+Z29vZ2xlL2Fkcy9nb29nbGVhZHMvdjYvY29tbW9u", "L3JlYWxfdGltZV9iaWRkaW5nX3NldHRpbmcucHJvdG8aNmdvb2dsZS9hZHMv", "Z29vZ2xlYWRzL3Y2L2NvbW1vbi90YXJnZXRpbmdfc2V0dGluZy5wcm90bxpC", "Z29vZ2xlL2Fkcy9nb29nbGVhZHMvdjYvZW51bXMvYWRfc2VydmluZ19vcHRp", "bWl6YXRpb25fc3RhdHVzLnByb3RvGkBnb29nbGUvYWRzL2dvb2dsZWFkcy92", "Ni9lbnVtcy9hZHZlcnRpc2luZ19jaGFubmVsX3N1Yl90eXBlLnByb3RvGjxn", "b29nbGUvYWRzL2dvb2dsZWFkcy92Ni9lbnVtcy9hZHZlcnRpc2luZ19jaGFu", "bmVsX3R5cGUucHJvdG8aOmdvb2dsZS9hZHMvZ29vZ2xlYWRzL3Y2L2VudW1z", "L2FwcF9jYW1wYWlnbl9hcHBfc3RvcmUucHJvdG8aS2dvb2dsZS9hZHMvZ29v", "Z2xlYWRzL3Y2L2VudW1zL2FwcF9jYW1wYWlnbl9iaWRkaW5nX3N0cmF0ZWd5", "X2dvYWxfdHlwZS5wcm90bxo5Z29vZ2xlL2Fkcy9nb29nbGVhZHMvdjYvZW51", "bXMvYmlkZGluZ19zdHJhdGVneV90eXBlLnByb3RvGjxnb29nbGUvYWRzL2dv", "b2dsZWFkcy92Ni9lbnVtcy9icmFuZF9zYWZldHlfc3VpdGFiaWxpdHkucHJv", "dG8aPGdvb2dsZS9hZHMvZ29vZ2xlYWRzL3Y2L2VudW1zL2NhbXBhaWduX2V4", "cGVyaW1lbnRfdHlwZS5wcm90bxo7Z29vZ2xlL2Fkcy9nb29nbGVhZHMvdjYv", "ZW51bXMvY2FtcGFpZ25fc2VydmluZ19zdGF0dXMucHJvdG8aM2dvb2dsZS9h", "ZHMvZ29vZ2xlYWRzL3Y2L2VudW1zL2NhbXBhaWduX3N0YXR1cy5wcm90bxo4", "Z29vZ2xlL2Fkcy9nb29nbGVhZHMvdjYvZW51bXMvbG9jYXRpb25fc291cmNl", "X3R5cGUucHJvdG8aPGdvb2dsZS9hZHMvZ29vZ2xlYWRzL3Y2L2VudW1zL25l", "Z2F0aXZlX2dlb190YXJnZXRfdHlwZS5wcm90bxo6Z29vZ2xlL2Fkcy9nb29n", "bGVhZHMvdjYvZW51bXMvb3B0aW1pemF0aW9uX2dvYWxfdHlwZS5wcm90bxow", "Z29vZ2xlL2Fkcy9nb29nbGVhZHMvdjYvZW51bXMvcGF5bWVudF9tb2RlLnBy", "b3RvGjxnb29nbGUvYWRzL2dvb2dsZWFkcy92Ni9lbnVtcy9wb3NpdGl2ZV9n", "ZW9fdGFyZ2V0X3R5cGUucHJvdG8aQmdvb2dsZS9hZHMvZ29vZ2xlYWRzL3Y2", "L2VudW1zL3Zhbml0eV9waGFybWFfZGlzcGxheV91cmxfbW9kZS5wcm90bxo2", "Z29vZ2xlL2Fkcy9nb29nbGVhZHMvdjYvZW51bXMvdmFuaXR5X3BoYXJtYV90", "ZXh0LnByb3RvGh9nb29nbGUvYXBpL2ZpZWxkX2JlaGF2aW9yLnByb3RvGhln", "b29nbGUvYXBpL3Jlc291cmNlLnByb3RvGhxnb29nbGUvYXBpL2Fubm90YXRp", "b25zLnByb3RvIrkvCghDYW1wYWlnbhJACg1yZXNvdXJjZV9uYW1lGAEgASgJ", "QingQQX6QSMKIWdvb2dsZWFkcy5nb29nbGVhcGlzLmNvbS9DYW1wYWlnbhIU", "CgJpZBg7IAEoA0ID4EEDSAGIAQESEQoEbmFtZRg6IAEoCUgCiAEBElAKBnN0", "YXR1cxgFIAEoDjJALmdvb2dsZS5hZHMuZ29vZ2xlYWRzLnY2LmVudW1zLkNh", "bXBhaWduU3RhdHVzRW51bS5DYW1wYWlnblN0YXR1cxJrCg5zZXJ2aW5nX3N0", "YXR1cxgVIAEoDjJOLmdvb2dsZS5hZHMuZ29vZ2xlYWRzLnY2LmVudW1zLkNh", "bXBhaWduU2VydmluZ1N0YXR1c0VudW0uQ2FtcGFpZ25TZXJ2aW5nU3RhdHVz", "QgPgQQMSggEKHmFkX3NlcnZpbmdfb3B0aW1pemF0aW9uX3N0YXR1cxgIIAEo", "DjJaLmdvb2dsZS5hZHMuZ29vZ2xlYWRzLnY2LmVudW1zLkFkU2VydmluZ09w", "dGltaXphdGlvblN0YXR1c0VudW0uQWRTZXJ2aW5nT3B0aW1pemF0aW9uU3Rh", "dHVzEncKGGFkdmVydGlzaW5nX2NoYW5uZWxfdHlwZRgJIAEoDjJQLmdvb2ds", "ZS5hZHMuZ29vZ2xlYWRzLnY2LmVudW1zLkFkdmVydGlzaW5nQ2hhbm5lbFR5", "cGVFbnVtLkFkdmVydGlzaW5nQ2hhbm5lbFR5cGVCA+BBBRKBAQocYWR2ZXJ0", "aXNpbmdfY2hhbm5lbF9zdWJfdHlwZRgKIAEoDjJWLmdvb2dsZS5hZHMuZ29v", "Z2xlYWRzLnY2LmVudW1zLkFkdmVydGlzaW5nQ2hhbm5lbFN1YlR5cGVFbnVt", "LkFkdmVydGlzaW5nQ2hhbm5lbFN1YlR5cGVCA+BBBRIiChV0cmFja2luZ191", "cmxfdGVtcGxhdGUYPCABKAlIA4gBARJOChV1cmxfY3VzdG9tX3BhcmFtZXRl", "cnMYDCADKAsyLy5nb29nbGUuYWRzLmdvb2dsZWFkcy52Ni5jb21tb24uQ3Vz", "dG9tUGFyYW1ldGVyElkKGXJlYWxfdGltZV9iaWRkaW5nX3NldHRpbmcYJyAB", "KAsyNi5nb29nbGUuYWRzLmdvb2dsZWFkcy52Ni5jb21tb24uUmVhbFRpbWVC", "aWRkaW5nU2V0dGluZxJVChBuZXR3b3JrX3NldHRpbmdzGA4gASgLMjsuZ29v", "Z2xlLmFkcy5nb29nbGVhZHMudjYucmVzb3VyY2VzLkNhbXBhaWduLk5ldHdv", "cmtTZXR0aW5ncxJYCg1ob3RlbF9zZXR0aW5nGCAgASgLMjwuZ29vZ2xlLmFk", "cy5nb29nbGVhZHMudjYucmVzb3VyY2VzLkNhbXBhaWduLkhvdGVsU2V0dGlu", "Z0luZm9CA+BBBRJnChpkeW5hbWljX3NlYXJjaF9hZHNfc2V0dGluZxghIAEo", "CzJDLmdvb2dsZS5hZHMuZ29vZ2xlYWRzLnY2LnJlc291cmNlcy5DYW1wYWln", "bi5EeW5hbWljU2VhcmNoQWRzU2V0dGluZxJVChBzaG9wcGluZ19zZXR0aW5n", "GCQgASgLMjsuZ29vZ2xlLmFkcy5nb29nbGVhZHMudjYucmVzb3VyY2VzLkNh", "bXBhaWduLlNob3BwaW5nU2V0dGluZxJLChF0YXJnZXRpbmdfc2V0dGluZxgr", "IAEoCzIwLmdvb2dsZS5hZHMuZ29vZ2xlYWRzLnY2LmNvbW1vbi5UYXJnZXRp", "bmdTZXR0aW5nEmEKF2dlb190YXJnZXRfdHlwZV9zZXR0aW5nGC8gASgLMkAu", "Z29vZ2xlLmFkcy5nb29nbGVhZHMudjYucmVzb3VyY2VzLkNhbXBhaWduLkdl", "b1RhcmdldFR5cGVTZXR0aW5nEmAKFmxvY2FsX2NhbXBhaWduX3NldHRpbmcY", "MiABKAsyQC5nb29nbGUuYWRzLmdvb2dsZWFkcy52Ni5yZXNvdXJjZXMuQ2Ft", "cGFpZ24uTG9jYWxDYW1wYWlnblNldHRpbmcSXAoUYXBwX2NhbXBhaWduX3Nl", "dHRpbmcYMyABKAsyPi5nb29nbGUuYWRzLmdvb2dsZWFkcy52Ni5yZXNvdXJj", "ZXMuQ2FtcGFpZ24uQXBwQ2FtcGFpZ25TZXR0aW5nEj4KBmxhYmVscxg9IAMo", "CUIu4EED+kEoCiZnb29nbGVhZHMuZ29vZ2xlYXBpcy5jb20vQ2FtcGFpZ25M", "YWJlbBJuCg9leHBlcmltZW50X3R5cGUYESABKA4yUC5nb29nbGUuYWRzLmdv", "b2dsZWFkcy52Ni5lbnVtcy5DYW1wYWlnbkV4cGVyaW1lbnRUeXBlRW51bS5D", "YW1wYWlnbkV4cGVyaW1lbnRUeXBlQgPgQQMSRQoNYmFzZV9jYW1wYWlnbhg4", "IAEoCUIp4EED+kEjCiFnb29nbGVhZHMuZ29vZ2xlYXBpcy5jb20vQ2FtcGFp", "Z25IBIgBARJKCg9jYW1wYWlnbl9idWRnZXQYPiABKAlCLPpBKQonZ29vZ2xl", "YWRzLmdvb2dsZWFwaXMuY29tL0NhbXBhaWduQnVkZ2V0SAWIAQESbgoVYmlk", "ZGluZ19zdHJhdGVneV90eXBlGBYgASgOMkouZ29vZ2xlLmFkcy5nb29nbGVh", "ZHMudjYuZW51bXMuQmlkZGluZ1N0cmF0ZWd5VHlwZUVudW0uQmlkZGluZ1N0", "cmF0ZWd5VHlwZUID4EEDEhcKCnN0YXJ0X2RhdGUYPyABKAlIBogBARIVCghl", "bmRfZGF0ZRhAIAEoCUgHiAEBEh0KEGZpbmFsX3VybF9zdWZmaXgYQSABKAlI", "CIgBARJJCg5mcmVxdWVuY3lfY2FwcxgoIAMoCzIxLmdvb2dsZS5hZHMuZ29v", "Z2xlYWRzLnY2LmNvbW1vbi5GcmVxdWVuY3lDYXBFbnRyeRJ9Ch52aWRlb19i", "cmFuZF9zYWZldHlfc3VpdGFiaWxpdHkYKiABKA4yUC5nb29nbGUuYWRzLmdv", "b2dsZWFkcy52Ni5lbnVtcy5CcmFuZFNhZmV0eVN1aXRhYmlsaXR5RW51bS5C", "cmFuZFNhZmV0eVN1aXRhYmlsaXR5QgPgQQMSTwoNdmFuaXR5X3BoYXJtYRgs", "IAEoCzI4Lmdvb2dsZS5hZHMuZ29vZ2xlYWRzLnY2LnJlc291cmNlcy5DYW1w", "YWlnbi5WYW5pdHlQaGFybWESYQoWc2VsZWN0aXZlX29wdGltaXphdGlvbhgt", "IAEoCzJBLmdvb2dsZS5hZHMuZ29vZ2xlYWRzLnY2LnJlc291cmNlcy5DYW1w", "YWlnbi5TZWxlY3RpdmVPcHRpbWl6YXRpb24SZgoZb3B0aW1pemF0aW9uX2dv", "YWxfc2V0dGluZxg2IAEoCzJDLmdvb2dsZS5hZHMuZ29vZ2xlYWRzLnY2LnJl", "c291cmNlcy5DYW1wYWlnbi5PcHRpbWl6YXRpb25Hb2FsU2V0dGluZxJaChB0", "cmFja2luZ19zZXR0aW5nGC4gASgLMjsuZ29vZ2xlLmFkcy5nb29nbGVhZHMu", "djYucmVzb3VyY2VzLkNhbXBhaWduLlRyYWNraW5nU2V0dGluZ0ID4EEDElAK", "DHBheW1lbnRfbW9kZRg0IAEoDjI6Lmdvb2dsZS5hZHMuZ29vZ2xlYWRzLnY2", "LmVudW1zLlBheW1lbnRNb2RlRW51bS5QYXltZW50TW9kZRIkChJvcHRpbWl6", "YXRpb25fc2NvcmUYQiABKAFCA+BBA0gJiAEBEkkKEGJpZGRpbmdfc3RyYXRl", "Z3kYQyABKAlCLfpBKgooZ29vZ2xlYWRzLmdvb2dsZWFwaXMuY29tL0JpZGRp", "bmdTdHJhdGVneUgAEkAKCmNvbW1pc3Npb24YMSABKAsyKi5nb29nbGUuYWRz", "Lmdvb2dsZWFkcy52Ni5jb21tb24uQ29tbWlzc2lvbkgAEj8KCm1hbnVhbF9j", "cGMYGCABKAsyKS5nb29nbGUuYWRzLmdvb2dsZWFkcy52Ni5jb21tb24uTWFu", "dWFsQ3BjSAASPwoKbWFudWFsX2NwbRgZIAEoCzIpLmdvb2dsZS5hZHMuZ29v", "Z2xlYWRzLnY2LmNvbW1vbi5NYW51YWxDcG1IABJECgptYW51YWxfY3B2GCUg", "ASgLMikuZ29vZ2xlLmFkcy5nb29nbGVhZHMudjYuY29tbW9uLk1hbnVhbENw", "dkID4EEDSAASUwoUbWF4aW1pemVfY29udmVyc2lvbnMYHiABKAsyMy5nb29n", "bGUuYWRzLmdvb2dsZWFkcy52Ni5jb21tb24uTWF4aW1pemVDb252ZXJzaW9u", "c0gAElwKGW1heGltaXplX2NvbnZlcnNpb25fdmFsdWUYHyABKAsyNy5nb29n", "bGUuYWRzLmdvb2dsZWFkcy52Ni5jb21tb24uTWF4aW1pemVDb252ZXJzaW9u", "VmFsdWVIABI/Cgp0YXJnZXRfY3BhGBogASgLMikuZ29vZ2xlLmFkcy5nb29n", "bGVhZHMudjYuY29tbW9uLlRhcmdldENwYUgAElgKF3RhcmdldF9pbXByZXNz", "aW9uX3NoYXJlGDAgASgLMjUuZ29vZ2xlLmFkcy5nb29nbGVhZHMudjYuY29t", "bW9uLlRhcmdldEltcHJlc3Npb25TaGFyZUgAEkEKC3RhcmdldF9yb2FzGB0g", "ASgLMiouZ29vZ2xlLmFkcy5nb29nbGVhZHMudjYuY29tbW9uLlRhcmdldFJv", "YXNIABJDCgx0YXJnZXRfc3BlbmQYGyABKAsyKy5nb29nbGUuYWRzLmdvb2ds", "ZWFkcy52Ni5jb21tb24uVGFyZ2V0U3BlbmRIABJBCgtwZXJjZW50X2NwYxgi", "IAEoCzIqLmdvb2dsZS5hZHMuZ29vZ2xlYWRzLnY2LmNvbW1vbi5QZXJjZW50", "Q3BjSAASPwoKdGFyZ2V0X2NwbRgpIAEoCzIpLmdvb2dsZS5hZHMuZ29vZ2xl", "YWRzLnY2LmNvbW1vbi5UYXJnZXRDcG1IABqZAgoPTmV0d29ya1NldHRpbmdz", "EiEKFHRhcmdldF9nb29nbGVfc2VhcmNoGAUgASgISACIAQESIgoVdGFyZ2V0", "X3NlYXJjaF9uZXR3b3JrGAYgASgISAGIAQESIwoWdGFyZ2V0X2NvbnRlbnRf", "bmV0d29yaxgHIAEoCEgCiAEBEioKHXRhcmdldF9wYXJ0bmVyX3NlYXJjaF9u", "ZXR3b3JrGAggASgISAOIAQFCFwoVX3RhcmdldF9nb29nbGVfc2VhcmNoQhgK", "Fl90YXJnZXRfc2VhcmNoX25ldHdvcmtCGQoXX3RhcmdldF9jb250ZW50X25l", "dHdvcmtCIAoeX3RhcmdldF9wYXJ0bmVyX3NlYXJjaF9uZXR3b3JrGkkKEEhv", "dGVsU2V0dGluZ0luZm8SIQoPaG90ZWxfY2VudGVyX2lkGAIgASgDQgPgQQVI", "AIgBAUISChBfaG90ZWxfY2VudGVyX2lkGvoBChRHZW9UYXJnZXRUeXBlU2V0", "dGluZxJwChhwb3NpdGl2ZV9nZW9fdGFyZ2V0X3R5cGUYASABKA4yTi5nb29n", "bGUuYWRzLmdvb2dsZWFkcy52Ni5lbnVtcy5Qb3NpdGl2ZUdlb1RhcmdldFR5", "cGVFbnVtLlBvc2l0aXZlR2VvVGFyZ2V0VHlwZRJwChhuZWdhdGl2ZV9nZW9f", "dGFyZ2V0X3R5cGUYAiABKA4yTi5nb29nbGUuYWRzLmdvb2dsZWFkcy52Ni5l", "bnVtcy5OZWdhdGl2ZUdlb1RhcmdldFR5cGVFbnVtLk5lZ2F0aXZlR2VvVGFy", "Z2V0VHlwZRrzAQoMVmFuaXR5UGhhcm1hEoABCh52YW5pdHlfcGhhcm1hX2Rp", "c3BsYXlfdXJsX21vZGUYASABKA4yWC5nb29nbGUuYWRzLmdvb2dsZWFkcy52", "Ni5lbnVtcy5WYW5pdHlQaGFybWFEaXNwbGF5VXJsTW9kZUVudW0uVmFuaXR5", "UGhhcm1hRGlzcGxheVVybE1vZGUSYAoSdmFuaXR5X3BoYXJtYV90ZXh0GAIg", "ASgOMkQuZ29vZ2xlLmFkcy5nb29nbGVhZHMudjYuZW51bXMuVmFuaXR5UGhh", "cm1hVGV4dEVudW0uVmFuaXR5UGhhcm1hVGV4dBqIAQoXT3B0aW1pemF0aW9u", "R29hbFNldHRpbmcSbQoXb3B0aW1pemF0aW9uX2dvYWxfdHlwZXMYASADKA4y", "TC5nb29nbGUuYWRzLmdvb2dsZWFkcy52Ni5lbnVtcy5PcHRpbWl6YXRpb25H", "b2FsVHlwZUVudW0uT3B0aW1pemF0aW9uR29hbFR5cGUawgEKF0R5bmFtaWNT", "ZWFyY2hBZHNTZXR0aW5nEhgKC2RvbWFpbl9uYW1lGAYgASgJQgPgQQISGgoN", "bGFuZ3VhZ2VfY29kZRgHIAEoCUID4EECEiMKFnVzZV9zdXBwbGllZF91cmxz", "X29ubHkYCCABKAhIAIgBARIxCgVmZWVkcxgJIAMoCUIi+kEfCh1nb29nbGVh", "ZHMuZ29vZ2xlYXBpcy5jb20vRmVlZEIZChdfdXNlX3N1cHBsaWVkX3VybHNf", "b25seRrVAQoPU2hvcHBpbmdTZXR0aW5nEh0KC21lcmNoYW50X2lkGAUgASgD", "QgPgQQVIAIgBARIfCg1zYWxlc19jb3VudHJ5GAYgASgJQgPgQQVIAYgBARIe", "ChFjYW1wYWlnbl9wcmlvcml0eRgHIAEoBUgCiAEBEhkKDGVuYWJsZV9sb2Nh", "bBgIIAEoCEgDiAEBQg4KDF9tZXJjaGFudF9pZEIQCg5fc2FsZXNfY291bnRy", "eUIUChJfY2FtcGFpZ25fcHJpb3JpdHlCDwoNX2VuYWJsZV9sb2NhbBpjChVT", "ZWxlY3RpdmVPcHRpbWl6YXRpb24SSgoSY29udmVyc2lvbl9hY3Rpb25zGAIg", "AygJQi76QSsKKWdvb2dsZWFkcy5nb29nbGVhcGlzLmNvbS9Db252ZXJzaW9u", "QWN0aW9uGqwCChJBcHBDYW1wYWlnblNldHRpbmcSjAEKGmJpZGRpbmdfc3Ry", "YXRlZ3lfZ29hbF90eXBlGAEgASgOMmguZ29vZ2xlLmFkcy5nb29nbGVhZHMu", "djYuZW51bXMuQXBwQ2FtcGFpZ25CaWRkaW5nU3RyYXRlZ3lHb2FsVHlwZUVu", "dW0uQXBwQ2FtcGFpZ25CaWRkaW5nU3RyYXRlZ3lHb2FsVHlwZRIYCgZhcHBf", "aWQYBCABKAlCA+BBBUgAiAEBEmIKCWFwcF9zdG9yZRgDIAEoDjJKLmdvb2ds", "ZS5hZHMuZ29vZ2xlYWRzLnY2LmVudW1zLkFwcENhbXBhaWduQXBwU3RvcmVF", "bnVtLkFwcENhbXBhaWduQXBwU3RvcmVCA+BBBUIJCgdfYXBwX2lkGkIKD1Ry", "YWNraW5nU2V0dGluZxIeCgx0cmFja2luZ191cmwYAiABKAlCA+BBA0gAiAEB", "Qg8KDV90cmFja2luZ191cmwafgoUTG9jYWxDYW1wYWlnblNldHRpbmcSZgoU", "bG9jYXRpb25fc291cmNlX3R5cGUYASABKA4ySC5nb29nbGUuYWRzLmdvb2ds", "ZWFkcy52Ni5lbnVtcy5Mb2NhdGlvblNvdXJjZVR5cGVFbnVtLkxvY2F0aW9u", "U291cmNlVHlwZTpX6kFUCiFnb29nbGVhZHMuZ29vZ2xlYXBpcy5jb20vQ2Ft", "cGFpZ24SL2N1c3RvbWVycy97Y3VzdG9tZXJfaWR9L2NhbXBhaWducy97Y2Ft", "cGFpZ25faWR9QhsKGWNhbXBhaWduX2JpZGRpbmdfc3RyYXRlZ3lCBQoDX2lk", "QgcKBV9uYW1lQhgKFl90cmFja2luZ191cmxfdGVtcGxhdGVCEAoOX2Jhc2Vf", "Y2FtcGFpZ25CEgoQX2NhbXBhaWduX2J1ZGdldEINCgtfc3RhcnRfZGF0ZUIL", "CglfZW5kX2RhdGVCEwoRX2ZpbmFsX3VybF9zdWZmaXhCFQoTX29wdGltaXph", "dGlvbl9zY29yZUL6AQolY29tLmdvb2dsZS5hZHMuZ29vZ2xlYWRzLnY2LnJl", "c291cmNlc0INQ2FtcGFpZ25Qcm90b1ABWkpnb29nbGUuZ29sYW5nLm9yZy9n", "ZW5wcm90by9nb29nbGVhcGlzL2Fkcy9nb29nbGVhZHMvdjYvcmVzb3VyY2Vz", "O3Jlc291cmNlc6ICA0dBQaoCIUdvb2dsZS5BZHMuR29vZ2xlQWRzLlY2LlJl", "c291cmNlc8oCIUdvb2dsZVxBZHNcR29vZ2xlQWRzXFY2XFJlc291cmNlc+oC", "JUdvb2dsZTo6QWRzOjpHb29nbGVBZHM6OlY2OjpSZXNvdXJjZXNiBnByb3Rv", "Mw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Google.Ads.GoogleAds.V6.Common.BiddingReflection.Descriptor, global::Google.Ads.GoogleAds.V6.Common.CustomParameterReflection.Descriptor, global::Google.Ads.GoogleAds.V6.Common.FrequencyCapReflection.Descriptor, global::Google.Ads.GoogleAds.V6.Common.RealTimeBiddingSettingReflection.Descriptor, global::Google.Ads.GoogleAds.V6.Common.TargetingSettingReflection.Descriptor, global::Google.Ads.GoogleAds.V6.Enums.AdServingOptimizationStatusReflection.Descriptor, global::Google.Ads.GoogleAds.V6.Enums.AdvertisingChannelSubTypeReflection.Descriptor, global::Google.Ads.GoogleAds.V6.Enums.AdvertisingChannelTypeReflection.Descriptor, global::Google.Ads.GoogleAds.V6.Enums.AppCampaignAppStoreReflection.Descriptor, global::Google.Ads.GoogleAds.V6.Enums.AppCampaignBiddingStrategyGoalTypeReflection.Descriptor, global::Google.Ads.GoogleAds.V6.Enums.BiddingStrategyTypeReflection.Descriptor, global::Google.Ads.GoogleAds.V6.Enums.BrandSafetySuitabilityReflection.Descriptor, global::Google.Ads.GoogleAds.V6.Enums.CampaignExperimentTypeReflection.Descriptor, global::Google.Ads.GoogleAds.V6.Enums.CampaignServingStatusReflection.Descriptor, global::Google.Ads.GoogleAds.V6.Enums.CampaignStatusReflection.Descriptor, global::Google.Ads.GoogleAds.V6.Enums.LocationSourceTypeReflection.Descriptor, global::Google.Ads.GoogleAds.V6.Enums.NegativeGeoTargetTypeReflection.Descriptor, global::Google.Ads.GoogleAds.V6.Enums.OptimizationGoalTypeReflection.Descriptor, global::Google.Ads.GoogleAds.V6.Enums.PaymentModeReflection.Descriptor, global::Google.Ads.GoogleAds.V6.Enums.PositiveGeoTargetTypeReflection.Descriptor, global::Google.Ads.GoogleAds.V6.Enums.VanityPharmaDisplayUrlModeReflection.Descriptor, global::Google.Ads.GoogleAds.V6.Enums.VanityPharmaTextReflection.Descriptor, global::Google.Api.FieldBehaviorReflection.Descriptor, global::Google.Api.ResourceReflection.Descriptor, global::Google.Api.AnnotationsReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Ads.GoogleAds.V6.Resources.Campaign), global::Google.Ads.GoogleAds.V6.Resources.Campaign.Parser, new[]{ "ResourceName", "Id", "Name", "Status", "ServingStatus", "AdServingOptimizationStatus", "AdvertisingChannelType", "AdvertisingChannelSubType", "TrackingUrlTemplate", "UrlCustomParameters", "RealTimeBiddingSetting", "NetworkSettings", "HotelSetting", "DynamicSearchAdsSetting", "ShoppingSetting", "TargetingSetting", "GeoTargetTypeSetting", "LocalCampaignSetting", "AppCampaignSetting", "Labels", "ExperimentType", "BaseCampaign", "CampaignBudget", "BiddingStrategyType", "StartDate", "EndDate", "FinalUrlSuffix", "FrequencyCaps", "VideoBrandSafetySuitability", "VanityPharma", "SelectiveOptimization", "OptimizationGoalSetting", "TrackingSetting", "PaymentMode", "OptimizationScore", "BiddingStrategy", "Commission", "ManualCpc", "ManualCpm", "ManualCpv", "MaximizeConversions", "MaximizeConversionValue", "TargetCpa", "TargetImpressionShare", "TargetRoas", "TargetSpend", "PercentCpc", "TargetCpm" }, new[]{ "CampaignBiddingStrategy", "Id", "Name", "TrackingUrlTemplate", "BaseCampaign", "CampaignBudget", "StartDate", "EndDate", "FinalUrlSuffix", "OptimizationScore" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.NetworkSettings), global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.NetworkSettings.Parser, new[]{ "TargetGoogleSearch", "TargetSearchNetwork", "TargetContentNetwork", "TargetPartnerSearchNetwork" }, new[]{ "TargetGoogleSearch", "TargetSearchNetwork", "TargetContentNetwork", "TargetPartnerSearchNetwork" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.HotelSettingInfo), global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.HotelSettingInfo.Parser, new[]{ "HotelCenterId" }, new[]{ "HotelCenterId" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.GeoTargetTypeSetting), global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.GeoTargetTypeSetting.Parser, new[]{ "PositiveGeoTargetType", "NegativeGeoTargetType" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.VanityPharma), global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.VanityPharma.Parser, new[]{ "VanityPharmaDisplayUrlMode", "VanityPharmaText" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.OptimizationGoalSetting), global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.OptimizationGoalSetting.Parser, new[]{ "OptimizationGoalTypes" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.DynamicSearchAdsSetting), global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.DynamicSearchAdsSetting.Parser, new[]{ "DomainName", "LanguageCode", "UseSuppliedUrlsOnly", "Feeds" }, new[]{ "UseSuppliedUrlsOnly" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.ShoppingSetting), global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.ShoppingSetting.Parser, new[]{ "MerchantId", "SalesCountry", "CampaignPriority", "EnableLocal" }, new[]{ "MerchantId", "SalesCountry", "CampaignPriority", "EnableLocal" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.SelectiveOptimization), global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.SelectiveOptimization.Parser, new[]{ "ConversionActions" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.AppCampaignSetting), global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.AppCampaignSetting.Parser, new[]{ "BiddingStrategyGoalType", "AppId", "AppStore" }, new[]{ "AppId" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.TrackingSetting), global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.TrackingSetting.Parser, new[]{ "TrackingUrl" }, new[]{ "TrackingUrl" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.LocalCampaignSetting), global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.LocalCampaignSetting.Parser, new[]{ "LocationSourceType" }, null, null, null, null)}) })); } #endregion } #region Messages /// <summary> /// A campaign. /// </summary> public sealed partial class Campaign : pb::IMessage<Campaign> #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { private static readonly pb::MessageParser<Campaign> _parser = new pb::MessageParser<Campaign>(() => new Campaign()); private pb::UnknownFieldSet _unknownFields; private int _hasBits0; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<Campaign> Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Ads.GoogleAds.V6.Resources.CampaignReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Campaign() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Campaign(Campaign other) : this() { _hasBits0 = other._hasBits0; resourceName_ = other.resourceName_; id_ = other.id_; name_ = other.name_; status_ = other.status_; servingStatus_ = other.servingStatus_; adServingOptimizationStatus_ = other.adServingOptimizationStatus_; advertisingChannelType_ = other.advertisingChannelType_; advertisingChannelSubType_ = other.advertisingChannelSubType_; trackingUrlTemplate_ = other.trackingUrlTemplate_; urlCustomParameters_ = other.urlCustomParameters_.Clone(); realTimeBiddingSetting_ = other.realTimeBiddingSetting_ != null ? other.realTimeBiddingSetting_.Clone() : null; networkSettings_ = other.networkSettings_ != null ? other.networkSettings_.Clone() : null; hotelSetting_ = other.hotelSetting_ != null ? other.hotelSetting_.Clone() : null; dynamicSearchAdsSetting_ = other.dynamicSearchAdsSetting_ != null ? other.dynamicSearchAdsSetting_.Clone() : null; shoppingSetting_ = other.shoppingSetting_ != null ? other.shoppingSetting_.Clone() : null; targetingSetting_ = other.targetingSetting_ != null ? other.targetingSetting_.Clone() : null; geoTargetTypeSetting_ = other.geoTargetTypeSetting_ != null ? other.geoTargetTypeSetting_.Clone() : null; localCampaignSetting_ = other.localCampaignSetting_ != null ? other.localCampaignSetting_.Clone() : null; appCampaignSetting_ = other.appCampaignSetting_ != null ? other.appCampaignSetting_.Clone() : null; labels_ = other.labels_.Clone(); experimentType_ = other.experimentType_; baseCampaign_ = other.baseCampaign_; campaignBudget_ = other.campaignBudget_; biddingStrategyType_ = other.biddingStrategyType_; startDate_ = other.startDate_; endDate_ = other.endDate_; finalUrlSuffix_ = other.finalUrlSuffix_; frequencyCaps_ = other.frequencyCaps_.Clone(); videoBrandSafetySuitability_ = other.videoBrandSafetySuitability_; vanityPharma_ = other.vanityPharma_ != null ? other.vanityPharma_.Clone() : null; selectiveOptimization_ = other.selectiveOptimization_ != null ? other.selectiveOptimization_.Clone() : null; optimizationGoalSetting_ = other.optimizationGoalSetting_ != null ? other.optimizationGoalSetting_.Clone() : null; trackingSetting_ = other.trackingSetting_ != null ? other.trackingSetting_.Clone() : null; paymentMode_ = other.paymentMode_; optimizationScore_ = other.optimizationScore_; switch (other.CampaignBiddingStrategyCase) { case CampaignBiddingStrategyOneofCase.BiddingStrategy: BiddingStrategy = other.BiddingStrategy; break; case CampaignBiddingStrategyOneofCase.Commission: Commission = other.Commission.Clone(); break; case CampaignBiddingStrategyOneofCase.ManualCpc: ManualCpc = other.ManualCpc.Clone(); break; case CampaignBiddingStrategyOneofCase.ManualCpm: ManualCpm = other.ManualCpm.Clone(); break; case CampaignBiddingStrategyOneofCase.ManualCpv: ManualCpv = other.ManualCpv.Clone(); break; case CampaignBiddingStrategyOneofCase.MaximizeConversions: MaximizeConversions = other.MaximizeConversions.Clone(); break; case CampaignBiddingStrategyOneofCase.MaximizeConversionValue: MaximizeConversionValue = other.MaximizeConversionValue.Clone(); break; case CampaignBiddingStrategyOneofCase.TargetCpa: TargetCpa = other.TargetCpa.Clone(); break; case CampaignBiddingStrategyOneofCase.TargetImpressionShare: TargetImpressionShare = other.TargetImpressionShare.Clone(); break; case CampaignBiddingStrategyOneofCase.TargetRoas: TargetRoas = other.TargetRoas.Clone(); break; case CampaignBiddingStrategyOneofCase.TargetSpend: TargetSpend = other.TargetSpend.Clone(); break; case CampaignBiddingStrategyOneofCase.PercentCpc: PercentCpc = other.PercentCpc.Clone(); break; case CampaignBiddingStrategyOneofCase.TargetCpm: TargetCpm = other.TargetCpm.Clone(); break; } _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Campaign Clone() { return new Campaign(this); } /// <summary>Field number for the "resource_name" field.</summary> public const int ResourceNameFieldNumber = 1; private string resourceName_ = ""; /// <summary> /// Immutable. The resource name of the campaign. /// Campaign resource names have the form: /// /// `customers/{customer_id}/campaigns/{campaign_id}` /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string ResourceName { get { return resourceName_; } set { resourceName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Field number for the "id" field.</summary> public const int IdFieldNumber = 59; private long id_; /// <summary> /// Output only. The ID of the campaign. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public long Id { get { if ((_hasBits0 & 1) != 0) { return id_; } else { return 0L; } } set { _hasBits0 |= 1; id_ = value; } } /// <summary>Gets whether the "id" field is set</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool HasId { get { return (_hasBits0 & 1) != 0; } } /// <summary>Clears the value of the "id" field</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void ClearId() { _hasBits0 &= ~1; } /// <summary>Field number for the "name" field.</summary> public const int NameFieldNumber = 58; private string name_; /// <summary> /// The name of the campaign. /// /// This field is required and should not be empty when creating new /// campaigns. /// /// It must not contain any null (code point 0x0), NL line feed /// (code point 0xA) or carriage return (code point 0xD) characters. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { get { return name_ ?? ""; } set { name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Gets whether the "name" field is set</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool HasName { get { return name_ != null; } } /// <summary>Clears the value of the "name" field</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void ClearName() { name_ = null; } /// <summary>Field number for the "status" field.</summary> public const int StatusFieldNumber = 5; private global::Google.Ads.GoogleAds.V6.Enums.CampaignStatusEnum.Types.CampaignStatus status_ = global::Google.Ads.GoogleAds.V6.Enums.CampaignStatusEnum.Types.CampaignStatus.Unspecified; /// <summary> /// The status of the campaign. /// /// When a new campaign is added, the status defaults to ENABLED. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Enums.CampaignStatusEnum.Types.CampaignStatus Status { get { return status_; } set { status_ = value; } } /// <summary>Field number for the "serving_status" field.</summary> public const int ServingStatusFieldNumber = 21; private global::Google.Ads.GoogleAds.V6.Enums.CampaignServingStatusEnum.Types.CampaignServingStatus servingStatus_ = global::Google.Ads.GoogleAds.V6.Enums.CampaignServingStatusEnum.Types.CampaignServingStatus.Unspecified; /// <summary> /// Output only. The ad serving status of the campaign. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Enums.CampaignServingStatusEnum.Types.CampaignServingStatus ServingStatus { get { return servingStatus_; } set { servingStatus_ = value; } } /// <summary>Field number for the "ad_serving_optimization_status" field.</summary> public const int AdServingOptimizationStatusFieldNumber = 8; private global::Google.Ads.GoogleAds.V6.Enums.AdServingOptimizationStatusEnum.Types.AdServingOptimizationStatus adServingOptimizationStatus_ = global::Google.Ads.GoogleAds.V6.Enums.AdServingOptimizationStatusEnum.Types.AdServingOptimizationStatus.Unspecified; /// <summary> /// The ad serving optimization status of the campaign. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Enums.AdServingOptimizationStatusEnum.Types.AdServingOptimizationStatus AdServingOptimizationStatus { get { return adServingOptimizationStatus_; } set { adServingOptimizationStatus_ = value; } } /// <summary>Field number for the "advertising_channel_type" field.</summary> public const int AdvertisingChannelTypeFieldNumber = 9; private global::Google.Ads.GoogleAds.V6.Enums.AdvertisingChannelTypeEnum.Types.AdvertisingChannelType advertisingChannelType_ = global::Google.Ads.GoogleAds.V6.Enums.AdvertisingChannelTypeEnum.Types.AdvertisingChannelType.Unspecified; /// <summary> /// Immutable. The primary serving target for ads within the campaign. /// The targeting options can be refined in `network_settings`. /// /// This field is required and should not be empty when creating new /// campaigns. /// /// Can be set only when creating campaigns. /// After the campaign is created, the field can not be changed. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Enums.AdvertisingChannelTypeEnum.Types.AdvertisingChannelType AdvertisingChannelType { get { return advertisingChannelType_; } set { advertisingChannelType_ = value; } } /// <summary>Field number for the "advertising_channel_sub_type" field.</summary> public const int AdvertisingChannelSubTypeFieldNumber = 10; private global::Google.Ads.GoogleAds.V6.Enums.AdvertisingChannelSubTypeEnum.Types.AdvertisingChannelSubType advertisingChannelSubType_ = global::Google.Ads.GoogleAds.V6.Enums.AdvertisingChannelSubTypeEnum.Types.AdvertisingChannelSubType.Unspecified; /// <summary> /// Immutable. Optional refinement to `advertising_channel_type`. /// Must be a valid sub-type of the parent channel type. /// /// Can be set only when creating campaigns. /// After campaign is created, the field can not be changed. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Enums.AdvertisingChannelSubTypeEnum.Types.AdvertisingChannelSubType AdvertisingChannelSubType { get { return advertisingChannelSubType_; } set { advertisingChannelSubType_ = value; } } /// <summary>Field number for the "tracking_url_template" field.</summary> public const int TrackingUrlTemplateFieldNumber = 60; private string trackingUrlTemplate_; /// <summary> /// The URL template for constructing a tracking URL. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string TrackingUrlTemplate { get { return trackingUrlTemplate_ ?? ""; } set { trackingUrlTemplate_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Gets whether the "tracking_url_template" field is set</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool HasTrackingUrlTemplate { get { return trackingUrlTemplate_ != null; } } /// <summary>Clears the value of the "tracking_url_template" field</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void ClearTrackingUrlTemplate() { trackingUrlTemplate_ = null; } /// <summary>Field number for the "url_custom_parameters" field.</summary> public const int UrlCustomParametersFieldNumber = 12; private static readonly pb::FieldCodec<global::Google.Ads.GoogleAds.V6.Common.CustomParameter> _repeated_urlCustomParameters_codec = pb::FieldCodec.ForMessage(98, global::Google.Ads.GoogleAds.V6.Common.CustomParameter.Parser); private readonly pbc::RepeatedField<global::Google.Ads.GoogleAds.V6.Common.CustomParameter> urlCustomParameters_ = new pbc::RepeatedField<global::Google.Ads.GoogleAds.V6.Common.CustomParameter>(); /// <summary> /// The list of mappings used to substitute custom parameter tags in a /// `tracking_url_template`, `final_urls`, or `mobile_final_urls`. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField<global::Google.Ads.GoogleAds.V6.Common.CustomParameter> UrlCustomParameters { get { return urlCustomParameters_; } } /// <summary>Field number for the "real_time_bidding_setting" field.</summary> public const int RealTimeBiddingSettingFieldNumber = 39; private global::Google.Ads.GoogleAds.V6.Common.RealTimeBiddingSetting realTimeBiddingSetting_; /// <summary> /// Settings for Real-Time Bidding, a feature only available for campaigns /// targeting the Ad Exchange network. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Common.RealTimeBiddingSetting RealTimeBiddingSetting { get { return realTimeBiddingSetting_; } set { realTimeBiddingSetting_ = value; } } /// <summary>Field number for the "network_settings" field.</summary> public const int NetworkSettingsFieldNumber = 14; private global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.NetworkSettings networkSettings_; /// <summary> /// The network settings for the campaign. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.NetworkSettings NetworkSettings { get { return networkSettings_; } set { networkSettings_ = value; } } /// <summary>Field number for the "hotel_setting" field.</summary> public const int HotelSettingFieldNumber = 32; private global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.HotelSettingInfo hotelSetting_; /// <summary> /// Immutable. The hotel setting for the campaign. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.HotelSettingInfo HotelSetting { get { return hotelSetting_; } set { hotelSetting_ = value; } } /// <summary>Field number for the "dynamic_search_ads_setting" field.</summary> public const int DynamicSearchAdsSettingFieldNumber = 33; private global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.DynamicSearchAdsSetting dynamicSearchAdsSetting_; /// <summary> /// The setting for controlling Dynamic Search Ads (DSA). /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.DynamicSearchAdsSetting DynamicSearchAdsSetting { get { return dynamicSearchAdsSetting_; } set { dynamicSearchAdsSetting_ = value; } } /// <summary>Field number for the "shopping_setting" field.</summary> public const int ShoppingSettingFieldNumber = 36; private global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.ShoppingSetting shoppingSetting_; /// <summary> /// The setting for controlling Shopping campaigns. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.ShoppingSetting ShoppingSetting { get { return shoppingSetting_; } set { shoppingSetting_ = value; } } /// <summary>Field number for the "targeting_setting" field.</summary> public const int TargetingSettingFieldNumber = 43; private global::Google.Ads.GoogleAds.V6.Common.TargetingSetting targetingSetting_; /// <summary> /// Setting for targeting related features. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Common.TargetingSetting TargetingSetting { get { return targetingSetting_; } set { targetingSetting_ = value; } } /// <summary>Field number for the "geo_target_type_setting" field.</summary> public const int GeoTargetTypeSettingFieldNumber = 47; private global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.GeoTargetTypeSetting geoTargetTypeSetting_; /// <summary> /// The setting for ads geotargeting. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.GeoTargetTypeSetting GeoTargetTypeSetting { get { return geoTargetTypeSetting_; } set { geoTargetTypeSetting_ = value; } } /// <summary>Field number for the "local_campaign_setting" field.</summary> public const int LocalCampaignSettingFieldNumber = 50; private global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.LocalCampaignSetting localCampaignSetting_; /// <summary> /// The setting for local campaign. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.LocalCampaignSetting LocalCampaignSetting { get { return localCampaignSetting_; } set { localCampaignSetting_ = value; } } /// <summary>Field number for the "app_campaign_setting" field.</summary> public const int AppCampaignSettingFieldNumber = 51; private global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.AppCampaignSetting appCampaignSetting_; /// <summary> /// The setting related to App Campaign. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.AppCampaignSetting AppCampaignSetting { get { return appCampaignSetting_; } set { appCampaignSetting_ = value; } } /// <summary>Field number for the "labels" field.</summary> public const int LabelsFieldNumber = 61; private static readonly pb::FieldCodec<string> _repeated_labels_codec = pb::FieldCodec.ForString(490); private readonly pbc::RepeatedField<string> labels_ = new pbc::RepeatedField<string>(); /// <summary> /// Output only. The resource names of labels attached to this campaign. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField<string> Labels { get { return labels_; } } /// <summary>Field number for the "experiment_type" field.</summary> public const int ExperimentTypeFieldNumber = 17; private global::Google.Ads.GoogleAds.V6.Enums.CampaignExperimentTypeEnum.Types.CampaignExperimentType experimentType_ = global::Google.Ads.GoogleAds.V6.Enums.CampaignExperimentTypeEnum.Types.CampaignExperimentType.Unspecified; /// <summary> /// Output only. The type of campaign: normal, draft, or experiment. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Enums.CampaignExperimentTypeEnum.Types.CampaignExperimentType ExperimentType { get { return experimentType_; } set { experimentType_ = value; } } /// <summary>Field number for the "base_campaign" field.</summary> public const int BaseCampaignFieldNumber = 56; private string baseCampaign_; /// <summary> /// Output only. The resource name of the base campaign of a draft or experiment campaign. /// For base campaigns, this is equal to `resource_name`. /// /// This field is read-only. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string BaseCampaign { get { return baseCampaign_ ?? ""; } set { baseCampaign_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Gets whether the "base_campaign" field is set</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool HasBaseCampaign { get { return baseCampaign_ != null; } } /// <summary>Clears the value of the "base_campaign" field</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void ClearBaseCampaign() { baseCampaign_ = null; } /// <summary>Field number for the "campaign_budget" field.</summary> public const int CampaignBudgetFieldNumber = 62; private string campaignBudget_; /// <summary> /// The budget of the campaign. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string CampaignBudget { get { return campaignBudget_ ?? ""; } set { campaignBudget_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Gets whether the "campaign_budget" field is set</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool HasCampaignBudget { get { return campaignBudget_ != null; } } /// <summary>Clears the value of the "campaign_budget" field</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void ClearCampaignBudget() { campaignBudget_ = null; } /// <summary>Field number for the "bidding_strategy_type" field.</summary> public const int BiddingStrategyTypeFieldNumber = 22; private global::Google.Ads.GoogleAds.V6.Enums.BiddingStrategyTypeEnum.Types.BiddingStrategyType biddingStrategyType_ = global::Google.Ads.GoogleAds.V6.Enums.BiddingStrategyTypeEnum.Types.BiddingStrategyType.Unspecified; /// <summary> /// Output only. The type of bidding strategy. /// /// A bidding strategy can be created by setting either the bidding scheme to /// create a standard bidding strategy or the `bidding_strategy` field to /// create a portfolio bidding strategy. /// /// This field is read-only. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Enums.BiddingStrategyTypeEnum.Types.BiddingStrategyType BiddingStrategyType { get { return biddingStrategyType_; } set { biddingStrategyType_ = value; } } /// <summary>Field number for the "start_date" field.</summary> public const int StartDateFieldNumber = 63; private string startDate_; /// <summary> /// The date when campaign started. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string StartDate { get { return startDate_ ?? ""; } set { startDate_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Gets whether the "start_date" field is set</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool HasStartDate { get { return startDate_ != null; } } /// <summary>Clears the value of the "start_date" field</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void ClearStartDate() { startDate_ = null; } /// <summary>Field number for the "end_date" field.</summary> public const int EndDateFieldNumber = 64; private string endDate_; /// <summary> /// The date when campaign ended. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string EndDate { get { return endDate_ ?? ""; } set { endDate_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Gets whether the "end_date" field is set</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool HasEndDate { get { return endDate_ != null; } } /// <summary>Clears the value of the "end_date" field</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void ClearEndDate() { endDate_ = null; } /// <summary>Field number for the "final_url_suffix" field.</summary> public const int FinalUrlSuffixFieldNumber = 65; private string finalUrlSuffix_; /// <summary> /// Suffix used to append query parameters to landing pages that are served /// with parallel tracking. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string FinalUrlSuffix { get { return finalUrlSuffix_ ?? ""; } set { finalUrlSuffix_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Gets whether the "final_url_suffix" field is set</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool HasFinalUrlSuffix { get { return finalUrlSuffix_ != null; } } /// <summary>Clears the value of the "final_url_suffix" field</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void ClearFinalUrlSuffix() { finalUrlSuffix_ = null; } /// <summary>Field number for the "frequency_caps" field.</summary> public const int FrequencyCapsFieldNumber = 40; private static readonly pb::FieldCodec<global::Google.Ads.GoogleAds.V6.Common.FrequencyCapEntry> _repeated_frequencyCaps_codec = pb::FieldCodec.ForMessage(322, global::Google.Ads.GoogleAds.V6.Common.FrequencyCapEntry.Parser); private readonly pbc::RepeatedField<global::Google.Ads.GoogleAds.V6.Common.FrequencyCapEntry> frequencyCaps_ = new pbc::RepeatedField<global::Google.Ads.GoogleAds.V6.Common.FrequencyCapEntry>(); /// <summary> /// A list that limits how often each user will see this campaign's ads. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField<global::Google.Ads.GoogleAds.V6.Common.FrequencyCapEntry> FrequencyCaps { get { return frequencyCaps_; } } /// <summary>Field number for the "video_brand_safety_suitability" field.</summary> public const int VideoBrandSafetySuitabilityFieldNumber = 42; private global::Google.Ads.GoogleAds.V6.Enums.BrandSafetySuitabilityEnum.Types.BrandSafetySuitability videoBrandSafetySuitability_ = global::Google.Ads.GoogleAds.V6.Enums.BrandSafetySuitabilityEnum.Types.BrandSafetySuitability.Unspecified; /// <summary> /// Output only. 3-Tier Brand Safety setting for the campaign. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Enums.BrandSafetySuitabilityEnum.Types.BrandSafetySuitability VideoBrandSafetySuitability { get { return videoBrandSafetySuitability_; } set { videoBrandSafetySuitability_ = value; } } /// <summary>Field number for the "vanity_pharma" field.</summary> public const int VanityPharmaFieldNumber = 44; private global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.VanityPharma vanityPharma_; /// <summary> /// Describes how unbranded pharma ads will be displayed. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.VanityPharma VanityPharma { get { return vanityPharma_; } set { vanityPharma_ = value; } } /// <summary>Field number for the "selective_optimization" field.</summary> public const int SelectiveOptimizationFieldNumber = 45; private global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.SelectiveOptimization selectiveOptimization_; /// <summary> /// Selective optimization setting for this campaign, which includes a set of /// conversion actions to optimize this campaign towards. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.SelectiveOptimization SelectiveOptimization { get { return selectiveOptimization_; } set { selectiveOptimization_ = value; } } /// <summary>Field number for the "optimization_goal_setting" field.</summary> public const int OptimizationGoalSettingFieldNumber = 54; private global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.OptimizationGoalSetting optimizationGoalSetting_; /// <summary> /// Optimization goal setting for this campaign, which includes a set of /// optimization goal types. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.OptimizationGoalSetting OptimizationGoalSetting { get { return optimizationGoalSetting_; } set { optimizationGoalSetting_ = value; } } /// <summary>Field number for the "tracking_setting" field.</summary> public const int TrackingSettingFieldNumber = 46; private global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.TrackingSetting trackingSetting_; /// <summary> /// Output only. Campaign-level settings for tracking information. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.TrackingSetting TrackingSetting { get { return trackingSetting_; } set { trackingSetting_ = value; } } /// <summary>Field number for the "payment_mode" field.</summary> public const int PaymentModeFieldNumber = 52; private global::Google.Ads.GoogleAds.V6.Enums.PaymentModeEnum.Types.PaymentMode paymentMode_ = global::Google.Ads.GoogleAds.V6.Enums.PaymentModeEnum.Types.PaymentMode.Unspecified; /// <summary> /// Payment mode for the campaign. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Enums.PaymentModeEnum.Types.PaymentMode PaymentMode { get { return paymentMode_; } set { paymentMode_ = value; } } /// <summary>Field number for the "optimization_score" field.</summary> public const int OptimizationScoreFieldNumber = 66; private double optimizationScore_; /// <summary> /// Output only. Optimization score of the campaign. /// /// Optimization score is an estimate of how well a campaign is set to perform. /// It ranges from 0% (0.0) to 100% (1.0), with 100% indicating that the /// campaign is performing at full potential. This field is null for unscored /// campaigns. /// /// See "About optimization score" at /// https://support.google.com/google-ads/answer/9061546. /// /// This field is read-only. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public double OptimizationScore { get { if ((_hasBits0 & 2) != 0) { return optimizationScore_; } else { return 0D; } } set { _hasBits0 |= 2; optimizationScore_ = value; } } /// <summary>Gets whether the "optimization_score" field is set</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool HasOptimizationScore { get { return (_hasBits0 & 2) != 0; } } /// <summary>Clears the value of the "optimization_score" field</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void ClearOptimizationScore() { _hasBits0 &= ~2; } /// <summary>Field number for the "bidding_strategy" field.</summary> public const int BiddingStrategyFieldNumber = 67; /// <summary> /// Portfolio bidding strategy used by campaign. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string BiddingStrategy { get { return campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.BiddingStrategy ? (string) campaignBiddingStrategy_ : ""; } set { campaignBiddingStrategy_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); campaignBiddingStrategyCase_ = CampaignBiddingStrategyOneofCase.BiddingStrategy; } } /// <summary>Field number for the "commission" field.</summary> public const int CommissionFieldNumber = 49; /// <summary> /// Commission is an automatic bidding strategy in which the advertiser pays /// a certain portion of the conversion value. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Common.Commission Commission { get { return campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.Commission ? (global::Google.Ads.GoogleAds.V6.Common.Commission) campaignBiddingStrategy_ : null; } set { campaignBiddingStrategy_ = value; campaignBiddingStrategyCase_ = value == null ? CampaignBiddingStrategyOneofCase.None : CampaignBiddingStrategyOneofCase.Commission; } } /// <summary>Field number for the "manual_cpc" field.</summary> public const int ManualCpcFieldNumber = 24; /// <summary> /// Standard Manual CPC bidding strategy. /// Manual click-based bidding where user pays per click. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Common.ManualCpc ManualCpc { get { return campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.ManualCpc ? (global::Google.Ads.GoogleAds.V6.Common.ManualCpc) campaignBiddingStrategy_ : null; } set { campaignBiddingStrategy_ = value; campaignBiddingStrategyCase_ = value == null ? CampaignBiddingStrategyOneofCase.None : CampaignBiddingStrategyOneofCase.ManualCpc; } } /// <summary>Field number for the "manual_cpm" field.</summary> public const int ManualCpmFieldNumber = 25; /// <summary> /// Standard Manual CPM bidding strategy. /// Manual impression-based bidding where user pays per thousand /// impressions. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Common.ManualCpm ManualCpm { get { return campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.ManualCpm ? (global::Google.Ads.GoogleAds.V6.Common.ManualCpm) campaignBiddingStrategy_ : null; } set { campaignBiddingStrategy_ = value; campaignBiddingStrategyCase_ = value == null ? CampaignBiddingStrategyOneofCase.None : CampaignBiddingStrategyOneofCase.ManualCpm; } } /// <summary>Field number for the "manual_cpv" field.</summary> public const int ManualCpvFieldNumber = 37; /// <summary> /// Output only. A bidding strategy that pays a configurable amount per video view. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Common.ManualCpv ManualCpv { get { return campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.ManualCpv ? (global::Google.Ads.GoogleAds.V6.Common.ManualCpv) campaignBiddingStrategy_ : null; } set { campaignBiddingStrategy_ = value; campaignBiddingStrategyCase_ = value == null ? CampaignBiddingStrategyOneofCase.None : CampaignBiddingStrategyOneofCase.ManualCpv; } } /// <summary>Field number for the "maximize_conversions" field.</summary> public const int MaximizeConversionsFieldNumber = 30; /// <summary> /// Standard Maximize Conversions bidding strategy that automatically /// maximizes number of conversions while spending your budget. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Common.MaximizeConversions MaximizeConversions { get { return campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.MaximizeConversions ? (global::Google.Ads.GoogleAds.V6.Common.MaximizeConversions) campaignBiddingStrategy_ : null; } set { campaignBiddingStrategy_ = value; campaignBiddingStrategyCase_ = value == null ? CampaignBiddingStrategyOneofCase.None : CampaignBiddingStrategyOneofCase.MaximizeConversions; } } /// <summary>Field number for the "maximize_conversion_value" field.</summary> public const int MaximizeConversionValueFieldNumber = 31; /// <summary> /// Standard Maximize Conversion Value bidding strategy that automatically /// sets bids to maximize revenue while spending your budget. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Common.MaximizeConversionValue MaximizeConversionValue { get { return campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.MaximizeConversionValue ? (global::Google.Ads.GoogleAds.V6.Common.MaximizeConversionValue) campaignBiddingStrategy_ : null; } set { campaignBiddingStrategy_ = value; campaignBiddingStrategyCase_ = value == null ? CampaignBiddingStrategyOneofCase.None : CampaignBiddingStrategyOneofCase.MaximizeConversionValue; } } /// <summary>Field number for the "target_cpa" field.</summary> public const int TargetCpaFieldNumber = 26; /// <summary> /// Standard Target CPA bidding strategy that automatically sets bids to /// help get as many conversions as possible at the target /// cost-per-acquisition (CPA) you set. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Common.TargetCpa TargetCpa { get { return campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetCpa ? (global::Google.Ads.GoogleAds.V6.Common.TargetCpa) campaignBiddingStrategy_ : null; } set { campaignBiddingStrategy_ = value; campaignBiddingStrategyCase_ = value == null ? CampaignBiddingStrategyOneofCase.None : CampaignBiddingStrategyOneofCase.TargetCpa; } } /// <summary>Field number for the "target_impression_share" field.</summary> public const int TargetImpressionShareFieldNumber = 48; /// <summary> /// Target Impression Share bidding strategy. An automated bidding strategy /// that sets bids to achieve a desired percentage of impressions. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Common.TargetImpressionShare TargetImpressionShare { get { return campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetImpressionShare ? (global::Google.Ads.GoogleAds.V6.Common.TargetImpressionShare) campaignBiddingStrategy_ : null; } set { campaignBiddingStrategy_ = value; campaignBiddingStrategyCase_ = value == null ? CampaignBiddingStrategyOneofCase.None : CampaignBiddingStrategyOneofCase.TargetImpressionShare; } } /// <summary>Field number for the "target_roas" field.</summary> public const int TargetRoasFieldNumber = 29; /// <summary> /// Standard Target ROAS bidding strategy that automatically maximizes /// revenue while averaging a specific target return on ad spend (ROAS). /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Common.TargetRoas TargetRoas { get { return campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetRoas ? (global::Google.Ads.GoogleAds.V6.Common.TargetRoas) campaignBiddingStrategy_ : null; } set { campaignBiddingStrategy_ = value; campaignBiddingStrategyCase_ = value == null ? CampaignBiddingStrategyOneofCase.None : CampaignBiddingStrategyOneofCase.TargetRoas; } } /// <summary>Field number for the "target_spend" field.</summary> public const int TargetSpendFieldNumber = 27; /// <summary> /// Standard Target Spend bidding strategy that automatically sets your bids /// to help get as many clicks as possible within your budget. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Common.TargetSpend TargetSpend { get { return campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetSpend ? (global::Google.Ads.GoogleAds.V6.Common.TargetSpend) campaignBiddingStrategy_ : null; } set { campaignBiddingStrategy_ = value; campaignBiddingStrategyCase_ = value == null ? CampaignBiddingStrategyOneofCase.None : CampaignBiddingStrategyOneofCase.TargetSpend; } } /// <summary>Field number for the "percent_cpc" field.</summary> public const int PercentCpcFieldNumber = 34; /// <summary> /// Standard Percent Cpc bidding strategy where bids are a fraction of the /// advertised price for some good or service. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Common.PercentCpc PercentCpc { get { return campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.PercentCpc ? (global::Google.Ads.GoogleAds.V6.Common.PercentCpc) campaignBiddingStrategy_ : null; } set { campaignBiddingStrategy_ = value; campaignBiddingStrategyCase_ = value == null ? CampaignBiddingStrategyOneofCase.None : CampaignBiddingStrategyOneofCase.PercentCpc; } } /// <summary>Field number for the "target_cpm" field.</summary> public const int TargetCpmFieldNumber = 41; /// <summary> /// A bidding strategy that automatically optimizes cost per thousand /// impressions. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Common.TargetCpm TargetCpm { get { return campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetCpm ? (global::Google.Ads.GoogleAds.V6.Common.TargetCpm) campaignBiddingStrategy_ : null; } set { campaignBiddingStrategy_ = value; campaignBiddingStrategyCase_ = value == null ? CampaignBiddingStrategyOneofCase.None : CampaignBiddingStrategyOneofCase.TargetCpm; } } private object campaignBiddingStrategy_; /// <summary>Enum of possible cases for the "campaign_bidding_strategy" oneof.</summary> public enum CampaignBiddingStrategyOneofCase { None = 0, BiddingStrategy = 67, Commission = 49, ManualCpc = 24, ManualCpm = 25, ManualCpv = 37, MaximizeConversions = 30, MaximizeConversionValue = 31, TargetCpa = 26, TargetImpressionShare = 48, TargetRoas = 29, TargetSpend = 27, PercentCpc = 34, TargetCpm = 41, } private CampaignBiddingStrategyOneofCase campaignBiddingStrategyCase_ = CampaignBiddingStrategyOneofCase.None; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public CampaignBiddingStrategyOneofCase CampaignBiddingStrategyCase { get { return campaignBiddingStrategyCase_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void ClearCampaignBiddingStrategy() { campaignBiddingStrategyCase_ = CampaignBiddingStrategyOneofCase.None; campaignBiddingStrategy_ = null; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as Campaign); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Campaign other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } if (ResourceName != other.ResourceName) return false; if (Id != other.Id) return false; if (Name != other.Name) return false; if (Status != other.Status) return false; if (ServingStatus != other.ServingStatus) return false; if (AdServingOptimizationStatus != other.AdServingOptimizationStatus) return false; if (AdvertisingChannelType != other.AdvertisingChannelType) return false; if (AdvertisingChannelSubType != other.AdvertisingChannelSubType) return false; if (TrackingUrlTemplate != other.TrackingUrlTemplate) return false; if(!urlCustomParameters_.Equals(other.urlCustomParameters_)) return false; if (!object.Equals(RealTimeBiddingSetting, other.RealTimeBiddingSetting)) return false; if (!object.Equals(NetworkSettings, other.NetworkSettings)) return false; if (!object.Equals(HotelSetting, other.HotelSetting)) return false; if (!object.Equals(DynamicSearchAdsSetting, other.DynamicSearchAdsSetting)) return false; if (!object.Equals(ShoppingSetting, other.ShoppingSetting)) return false; if (!object.Equals(TargetingSetting, other.TargetingSetting)) return false; if (!object.Equals(GeoTargetTypeSetting, other.GeoTargetTypeSetting)) return false; if (!object.Equals(LocalCampaignSetting, other.LocalCampaignSetting)) return false; if (!object.Equals(AppCampaignSetting, other.AppCampaignSetting)) return false; if(!labels_.Equals(other.labels_)) return false; if (ExperimentType != other.ExperimentType) return false; if (BaseCampaign != other.BaseCampaign) return false; if (CampaignBudget != other.CampaignBudget) return false; if (BiddingStrategyType != other.BiddingStrategyType) return false; if (StartDate != other.StartDate) return false; if (EndDate != other.EndDate) return false; if (FinalUrlSuffix != other.FinalUrlSuffix) return false; if(!frequencyCaps_.Equals(other.frequencyCaps_)) return false; if (VideoBrandSafetySuitability != other.VideoBrandSafetySuitability) return false; if (!object.Equals(VanityPharma, other.VanityPharma)) return false; if (!object.Equals(SelectiveOptimization, other.SelectiveOptimization)) return false; if (!object.Equals(OptimizationGoalSetting, other.OptimizationGoalSetting)) return false; if (!object.Equals(TrackingSetting, other.TrackingSetting)) return false; if (PaymentMode != other.PaymentMode) return false; if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(OptimizationScore, other.OptimizationScore)) return false; if (BiddingStrategy != other.BiddingStrategy) return false; if (!object.Equals(Commission, other.Commission)) return false; if (!object.Equals(ManualCpc, other.ManualCpc)) return false; if (!object.Equals(ManualCpm, other.ManualCpm)) return false; if (!object.Equals(ManualCpv, other.ManualCpv)) return false; if (!object.Equals(MaximizeConversions, other.MaximizeConversions)) return false; if (!object.Equals(MaximizeConversionValue, other.MaximizeConversionValue)) return false; if (!object.Equals(TargetCpa, other.TargetCpa)) return false; if (!object.Equals(TargetImpressionShare, other.TargetImpressionShare)) return false; if (!object.Equals(TargetRoas, other.TargetRoas)) return false; if (!object.Equals(TargetSpend, other.TargetSpend)) return false; if (!object.Equals(PercentCpc, other.PercentCpc)) return false; if (!object.Equals(TargetCpm, other.TargetCpm)) return false; if (CampaignBiddingStrategyCase != other.CampaignBiddingStrategyCase) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (ResourceName.Length != 0) hash ^= ResourceName.GetHashCode(); if (HasId) hash ^= Id.GetHashCode(); if (HasName) hash ^= Name.GetHashCode(); if (Status != global::Google.Ads.GoogleAds.V6.Enums.CampaignStatusEnum.Types.CampaignStatus.Unspecified) hash ^= Status.GetHashCode(); if (ServingStatus != global::Google.Ads.GoogleAds.V6.Enums.CampaignServingStatusEnum.Types.CampaignServingStatus.Unspecified) hash ^= ServingStatus.GetHashCode(); if (AdServingOptimizationStatus != global::Google.Ads.GoogleAds.V6.Enums.AdServingOptimizationStatusEnum.Types.AdServingOptimizationStatus.Unspecified) hash ^= AdServingOptimizationStatus.GetHashCode(); if (AdvertisingChannelType != global::Google.Ads.GoogleAds.V6.Enums.AdvertisingChannelTypeEnum.Types.AdvertisingChannelType.Unspecified) hash ^= AdvertisingChannelType.GetHashCode(); if (AdvertisingChannelSubType != global::Google.Ads.GoogleAds.V6.Enums.AdvertisingChannelSubTypeEnum.Types.AdvertisingChannelSubType.Unspecified) hash ^= AdvertisingChannelSubType.GetHashCode(); if (HasTrackingUrlTemplate) hash ^= TrackingUrlTemplate.GetHashCode(); hash ^= urlCustomParameters_.GetHashCode(); if (realTimeBiddingSetting_ != null) hash ^= RealTimeBiddingSetting.GetHashCode(); if (networkSettings_ != null) hash ^= NetworkSettings.GetHashCode(); if (hotelSetting_ != null) hash ^= HotelSetting.GetHashCode(); if (dynamicSearchAdsSetting_ != null) hash ^= DynamicSearchAdsSetting.GetHashCode(); if (shoppingSetting_ != null) hash ^= ShoppingSetting.GetHashCode(); if (targetingSetting_ != null) hash ^= TargetingSetting.GetHashCode(); if (geoTargetTypeSetting_ != null) hash ^= GeoTargetTypeSetting.GetHashCode(); if (localCampaignSetting_ != null) hash ^= LocalCampaignSetting.GetHashCode(); if (appCampaignSetting_ != null) hash ^= AppCampaignSetting.GetHashCode(); hash ^= labels_.GetHashCode(); if (ExperimentType != global::Google.Ads.GoogleAds.V6.Enums.CampaignExperimentTypeEnum.Types.CampaignExperimentType.Unspecified) hash ^= ExperimentType.GetHashCode(); if (HasBaseCampaign) hash ^= BaseCampaign.GetHashCode(); if (HasCampaignBudget) hash ^= CampaignBudget.GetHashCode(); if (BiddingStrategyType != global::Google.Ads.GoogleAds.V6.Enums.BiddingStrategyTypeEnum.Types.BiddingStrategyType.Unspecified) hash ^= BiddingStrategyType.GetHashCode(); if (HasStartDate) hash ^= StartDate.GetHashCode(); if (HasEndDate) hash ^= EndDate.GetHashCode(); if (HasFinalUrlSuffix) hash ^= FinalUrlSuffix.GetHashCode(); hash ^= frequencyCaps_.GetHashCode(); if (VideoBrandSafetySuitability != global::Google.Ads.GoogleAds.V6.Enums.BrandSafetySuitabilityEnum.Types.BrandSafetySuitability.Unspecified) hash ^= VideoBrandSafetySuitability.GetHashCode(); if (vanityPharma_ != null) hash ^= VanityPharma.GetHashCode(); if (selectiveOptimization_ != null) hash ^= SelectiveOptimization.GetHashCode(); if (optimizationGoalSetting_ != null) hash ^= OptimizationGoalSetting.GetHashCode(); if (trackingSetting_ != null) hash ^= TrackingSetting.GetHashCode(); if (PaymentMode != global::Google.Ads.GoogleAds.V6.Enums.PaymentModeEnum.Types.PaymentMode.Unspecified) hash ^= PaymentMode.GetHashCode(); if (HasOptimizationScore) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(OptimizationScore); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.BiddingStrategy) hash ^= BiddingStrategy.GetHashCode(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.Commission) hash ^= Commission.GetHashCode(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.ManualCpc) hash ^= ManualCpc.GetHashCode(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.ManualCpm) hash ^= ManualCpm.GetHashCode(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.ManualCpv) hash ^= ManualCpv.GetHashCode(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.MaximizeConversions) hash ^= MaximizeConversions.GetHashCode(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.MaximizeConversionValue) hash ^= MaximizeConversionValue.GetHashCode(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetCpa) hash ^= TargetCpa.GetHashCode(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetImpressionShare) hash ^= TargetImpressionShare.GetHashCode(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetRoas) hash ^= TargetRoas.GetHashCode(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetSpend) hash ^= TargetSpend.GetHashCode(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.PercentCpc) hash ^= PercentCpc.GetHashCode(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetCpm) hash ^= TargetCpm.GetHashCode(); hash ^= (int) campaignBiddingStrategyCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return hash; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else if (ResourceName.Length != 0) { output.WriteRawTag(10); output.WriteString(ResourceName); } if (Status != global::Google.Ads.GoogleAds.V6.Enums.CampaignStatusEnum.Types.CampaignStatus.Unspecified) { output.WriteRawTag(40); output.WriteEnum((int) Status); } if (AdServingOptimizationStatus != global::Google.Ads.GoogleAds.V6.Enums.AdServingOptimizationStatusEnum.Types.AdServingOptimizationStatus.Unspecified) { output.WriteRawTag(64); output.WriteEnum((int) AdServingOptimizationStatus); } if (AdvertisingChannelType != global::Google.Ads.GoogleAds.V6.Enums.AdvertisingChannelTypeEnum.Types.AdvertisingChannelType.Unspecified) { output.WriteRawTag(72); output.WriteEnum((int) AdvertisingChannelType); } if (AdvertisingChannelSubType != global::Google.Ads.GoogleAds.V6.Enums.AdvertisingChannelSubTypeEnum.Types.AdvertisingChannelSubType.Unspecified) { output.WriteRawTag(80); output.WriteEnum((int) AdvertisingChannelSubType); } urlCustomParameters_.WriteTo(output, _repeated_urlCustomParameters_codec); if (networkSettings_ != null) { output.WriteRawTag(114); output.WriteMessage(NetworkSettings); } if (ExperimentType != global::Google.Ads.GoogleAds.V6.Enums.CampaignExperimentTypeEnum.Types.CampaignExperimentType.Unspecified) { output.WriteRawTag(136, 1); output.WriteEnum((int) ExperimentType); } if (ServingStatus != global::Google.Ads.GoogleAds.V6.Enums.CampaignServingStatusEnum.Types.CampaignServingStatus.Unspecified) { output.WriteRawTag(168, 1); output.WriteEnum((int) ServingStatus); } if (BiddingStrategyType != global::Google.Ads.GoogleAds.V6.Enums.BiddingStrategyTypeEnum.Types.BiddingStrategyType.Unspecified) { output.WriteRawTag(176, 1); output.WriteEnum((int) BiddingStrategyType); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.ManualCpc) { output.WriteRawTag(194, 1); output.WriteMessage(ManualCpc); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.ManualCpm) { output.WriteRawTag(202, 1); output.WriteMessage(ManualCpm); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetCpa) { output.WriteRawTag(210, 1); output.WriteMessage(TargetCpa); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetSpend) { output.WriteRawTag(218, 1); output.WriteMessage(TargetSpend); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetRoas) { output.WriteRawTag(234, 1); output.WriteMessage(TargetRoas); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.MaximizeConversions) { output.WriteRawTag(242, 1); output.WriteMessage(MaximizeConversions); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.MaximizeConversionValue) { output.WriteRawTag(250, 1); output.WriteMessage(MaximizeConversionValue); } if (hotelSetting_ != null) { output.WriteRawTag(130, 2); output.WriteMessage(HotelSetting); } if (dynamicSearchAdsSetting_ != null) { output.WriteRawTag(138, 2); output.WriteMessage(DynamicSearchAdsSetting); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.PercentCpc) { output.WriteRawTag(146, 2); output.WriteMessage(PercentCpc); } if (shoppingSetting_ != null) { output.WriteRawTag(162, 2); output.WriteMessage(ShoppingSetting); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.ManualCpv) { output.WriteRawTag(170, 2); output.WriteMessage(ManualCpv); } if (realTimeBiddingSetting_ != null) { output.WriteRawTag(186, 2); output.WriteMessage(RealTimeBiddingSetting); } frequencyCaps_.WriteTo(output, _repeated_frequencyCaps_codec); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetCpm) { output.WriteRawTag(202, 2); output.WriteMessage(TargetCpm); } if (VideoBrandSafetySuitability != global::Google.Ads.GoogleAds.V6.Enums.BrandSafetySuitabilityEnum.Types.BrandSafetySuitability.Unspecified) { output.WriteRawTag(208, 2); output.WriteEnum((int) VideoBrandSafetySuitability); } if (targetingSetting_ != null) { output.WriteRawTag(218, 2); output.WriteMessage(TargetingSetting); } if (vanityPharma_ != null) { output.WriteRawTag(226, 2); output.WriteMessage(VanityPharma); } if (selectiveOptimization_ != null) { output.WriteRawTag(234, 2); output.WriteMessage(SelectiveOptimization); } if (trackingSetting_ != null) { output.WriteRawTag(242, 2); output.WriteMessage(TrackingSetting); } if (geoTargetTypeSetting_ != null) { output.WriteRawTag(250, 2); output.WriteMessage(GeoTargetTypeSetting); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetImpressionShare) { output.WriteRawTag(130, 3); output.WriteMessage(TargetImpressionShare); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.Commission) { output.WriteRawTag(138, 3); output.WriteMessage(Commission); } if (localCampaignSetting_ != null) { output.WriteRawTag(146, 3); output.WriteMessage(LocalCampaignSetting); } if (appCampaignSetting_ != null) { output.WriteRawTag(154, 3); output.WriteMessage(AppCampaignSetting); } if (PaymentMode != global::Google.Ads.GoogleAds.V6.Enums.PaymentModeEnum.Types.PaymentMode.Unspecified) { output.WriteRawTag(160, 3); output.WriteEnum((int) PaymentMode); } if (optimizationGoalSetting_ != null) { output.WriteRawTag(178, 3); output.WriteMessage(OptimizationGoalSetting); } if (HasBaseCampaign) { output.WriteRawTag(194, 3); output.WriteString(BaseCampaign); } if (HasName) { output.WriteRawTag(210, 3); output.WriteString(Name); } if (HasId) { output.WriteRawTag(216, 3); output.WriteInt64(Id); } if (HasTrackingUrlTemplate) { output.WriteRawTag(226, 3); output.WriteString(TrackingUrlTemplate); } labels_.WriteTo(output, _repeated_labels_codec); if (HasCampaignBudget) { output.WriteRawTag(242, 3); output.WriteString(CampaignBudget); } if (HasStartDate) { output.WriteRawTag(250, 3); output.WriteString(StartDate); } if (HasEndDate) { output.WriteRawTag(130, 4); output.WriteString(EndDate); } if (HasFinalUrlSuffix) { output.WriteRawTag(138, 4); output.WriteString(FinalUrlSuffix); } if (HasOptimizationScore) { output.WriteRawTag(145, 4); output.WriteDouble(OptimizationScore); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.BiddingStrategy) { output.WriteRawTag(154, 4); output.WriteString(BiddingStrategy); } if (_unknownFields != null) { _unknownFields.WriteTo(output); } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { if (ResourceName.Length != 0) { output.WriteRawTag(10); output.WriteString(ResourceName); } if (Status != global::Google.Ads.GoogleAds.V6.Enums.CampaignStatusEnum.Types.CampaignStatus.Unspecified) { output.WriteRawTag(40); output.WriteEnum((int) Status); } if (AdServingOptimizationStatus != global::Google.Ads.GoogleAds.V6.Enums.AdServingOptimizationStatusEnum.Types.AdServingOptimizationStatus.Unspecified) { output.WriteRawTag(64); output.WriteEnum((int) AdServingOptimizationStatus); } if (AdvertisingChannelType != global::Google.Ads.GoogleAds.V6.Enums.AdvertisingChannelTypeEnum.Types.AdvertisingChannelType.Unspecified) { output.WriteRawTag(72); output.WriteEnum((int) AdvertisingChannelType); } if (AdvertisingChannelSubType != global::Google.Ads.GoogleAds.V6.Enums.AdvertisingChannelSubTypeEnum.Types.AdvertisingChannelSubType.Unspecified) { output.WriteRawTag(80); output.WriteEnum((int) AdvertisingChannelSubType); } urlCustomParameters_.WriteTo(ref output, _repeated_urlCustomParameters_codec); if (networkSettings_ != null) { output.WriteRawTag(114); output.WriteMessage(NetworkSettings); } if (ExperimentType != global::Google.Ads.GoogleAds.V6.Enums.CampaignExperimentTypeEnum.Types.CampaignExperimentType.Unspecified) { output.WriteRawTag(136, 1); output.WriteEnum((int) ExperimentType); } if (ServingStatus != global::Google.Ads.GoogleAds.V6.Enums.CampaignServingStatusEnum.Types.CampaignServingStatus.Unspecified) { output.WriteRawTag(168, 1); output.WriteEnum((int) ServingStatus); } if (BiddingStrategyType != global::Google.Ads.GoogleAds.V6.Enums.BiddingStrategyTypeEnum.Types.BiddingStrategyType.Unspecified) { output.WriteRawTag(176, 1); output.WriteEnum((int) BiddingStrategyType); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.ManualCpc) { output.WriteRawTag(194, 1); output.WriteMessage(ManualCpc); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.ManualCpm) { output.WriteRawTag(202, 1); output.WriteMessage(ManualCpm); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetCpa) { output.WriteRawTag(210, 1); output.WriteMessage(TargetCpa); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetSpend) { output.WriteRawTag(218, 1); output.WriteMessage(TargetSpend); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetRoas) { output.WriteRawTag(234, 1); output.WriteMessage(TargetRoas); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.MaximizeConversions) { output.WriteRawTag(242, 1); output.WriteMessage(MaximizeConversions); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.MaximizeConversionValue) { output.WriteRawTag(250, 1); output.WriteMessage(MaximizeConversionValue); } if (hotelSetting_ != null) { output.WriteRawTag(130, 2); output.WriteMessage(HotelSetting); } if (dynamicSearchAdsSetting_ != null) { output.WriteRawTag(138, 2); output.WriteMessage(DynamicSearchAdsSetting); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.PercentCpc) { output.WriteRawTag(146, 2); output.WriteMessage(PercentCpc); } if (shoppingSetting_ != null) { output.WriteRawTag(162, 2); output.WriteMessage(ShoppingSetting); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.ManualCpv) { output.WriteRawTag(170, 2); output.WriteMessage(ManualCpv); } if (realTimeBiddingSetting_ != null) { output.WriteRawTag(186, 2); output.WriteMessage(RealTimeBiddingSetting); } frequencyCaps_.WriteTo(ref output, _repeated_frequencyCaps_codec); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetCpm) { output.WriteRawTag(202, 2); output.WriteMessage(TargetCpm); } if (VideoBrandSafetySuitability != global::Google.Ads.GoogleAds.V6.Enums.BrandSafetySuitabilityEnum.Types.BrandSafetySuitability.Unspecified) { output.WriteRawTag(208, 2); output.WriteEnum((int) VideoBrandSafetySuitability); } if (targetingSetting_ != null) { output.WriteRawTag(218, 2); output.WriteMessage(TargetingSetting); } if (vanityPharma_ != null) { output.WriteRawTag(226, 2); output.WriteMessage(VanityPharma); } if (selectiveOptimization_ != null) { output.WriteRawTag(234, 2); output.WriteMessage(SelectiveOptimization); } if (trackingSetting_ != null) { output.WriteRawTag(242, 2); output.WriteMessage(TrackingSetting); } if (geoTargetTypeSetting_ != null) { output.WriteRawTag(250, 2); output.WriteMessage(GeoTargetTypeSetting); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetImpressionShare) { output.WriteRawTag(130, 3); output.WriteMessage(TargetImpressionShare); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.Commission) { output.WriteRawTag(138, 3); output.WriteMessage(Commission); } if (localCampaignSetting_ != null) { output.WriteRawTag(146, 3); output.WriteMessage(LocalCampaignSetting); } if (appCampaignSetting_ != null) { output.WriteRawTag(154, 3); output.WriteMessage(AppCampaignSetting); } if (PaymentMode != global::Google.Ads.GoogleAds.V6.Enums.PaymentModeEnum.Types.PaymentMode.Unspecified) { output.WriteRawTag(160, 3); output.WriteEnum((int) PaymentMode); } if (optimizationGoalSetting_ != null) { output.WriteRawTag(178, 3); output.WriteMessage(OptimizationGoalSetting); } if (HasBaseCampaign) { output.WriteRawTag(194, 3); output.WriteString(BaseCampaign); } if (HasName) { output.WriteRawTag(210, 3); output.WriteString(Name); } if (HasId) { output.WriteRawTag(216, 3); output.WriteInt64(Id); } if (HasTrackingUrlTemplate) { output.WriteRawTag(226, 3); output.WriteString(TrackingUrlTemplate); } labels_.WriteTo(ref output, _repeated_labels_codec); if (HasCampaignBudget) { output.WriteRawTag(242, 3); output.WriteString(CampaignBudget); } if (HasStartDate) { output.WriteRawTag(250, 3); output.WriteString(StartDate); } if (HasEndDate) { output.WriteRawTag(130, 4); output.WriteString(EndDate); } if (HasFinalUrlSuffix) { output.WriteRawTag(138, 4); output.WriteString(FinalUrlSuffix); } if (HasOptimizationScore) { output.WriteRawTag(145, 4); output.WriteDouble(OptimizationScore); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.BiddingStrategy) { output.WriteRawTag(154, 4); output.WriteString(BiddingStrategy); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } } #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (ResourceName.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(ResourceName); } if (HasId) { size += 2 + pb::CodedOutputStream.ComputeInt64Size(Id); } if (HasName) { size += 2 + pb::CodedOutputStream.ComputeStringSize(Name); } if (Status != global::Google.Ads.GoogleAds.V6.Enums.CampaignStatusEnum.Types.CampaignStatus.Unspecified) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Status); } if (ServingStatus != global::Google.Ads.GoogleAds.V6.Enums.CampaignServingStatusEnum.Types.CampaignServingStatus.Unspecified) { size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) ServingStatus); } if (AdServingOptimizationStatus != global::Google.Ads.GoogleAds.V6.Enums.AdServingOptimizationStatusEnum.Types.AdServingOptimizationStatus.Unspecified) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) AdServingOptimizationStatus); } if (AdvertisingChannelType != global::Google.Ads.GoogleAds.V6.Enums.AdvertisingChannelTypeEnum.Types.AdvertisingChannelType.Unspecified) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) AdvertisingChannelType); } if (AdvertisingChannelSubType != global::Google.Ads.GoogleAds.V6.Enums.AdvertisingChannelSubTypeEnum.Types.AdvertisingChannelSubType.Unspecified) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) AdvertisingChannelSubType); } if (HasTrackingUrlTemplate) { size += 2 + pb::CodedOutputStream.ComputeStringSize(TrackingUrlTemplate); } size += urlCustomParameters_.CalculateSize(_repeated_urlCustomParameters_codec); if (realTimeBiddingSetting_ != null) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(RealTimeBiddingSetting); } if (networkSettings_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(NetworkSettings); } if (hotelSetting_ != null) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(HotelSetting); } if (dynamicSearchAdsSetting_ != null) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(DynamicSearchAdsSetting); } if (shoppingSetting_ != null) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(ShoppingSetting); } if (targetingSetting_ != null) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(TargetingSetting); } if (geoTargetTypeSetting_ != null) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(GeoTargetTypeSetting); } if (localCampaignSetting_ != null) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(LocalCampaignSetting); } if (appCampaignSetting_ != null) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(AppCampaignSetting); } size += labels_.CalculateSize(_repeated_labels_codec); if (ExperimentType != global::Google.Ads.GoogleAds.V6.Enums.CampaignExperimentTypeEnum.Types.CampaignExperimentType.Unspecified) { size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) ExperimentType); } if (HasBaseCampaign) { size += 2 + pb::CodedOutputStream.ComputeStringSize(BaseCampaign); } if (HasCampaignBudget) { size += 2 + pb::CodedOutputStream.ComputeStringSize(CampaignBudget); } if (BiddingStrategyType != global::Google.Ads.GoogleAds.V6.Enums.BiddingStrategyTypeEnum.Types.BiddingStrategyType.Unspecified) { size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) BiddingStrategyType); } if (HasStartDate) { size += 2 + pb::CodedOutputStream.ComputeStringSize(StartDate); } if (HasEndDate) { size += 2 + pb::CodedOutputStream.ComputeStringSize(EndDate); } if (HasFinalUrlSuffix) { size += 2 + pb::CodedOutputStream.ComputeStringSize(FinalUrlSuffix); } size += frequencyCaps_.CalculateSize(_repeated_frequencyCaps_codec); if (VideoBrandSafetySuitability != global::Google.Ads.GoogleAds.V6.Enums.BrandSafetySuitabilityEnum.Types.BrandSafetySuitability.Unspecified) { size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) VideoBrandSafetySuitability); } if (vanityPharma_ != null) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(VanityPharma); } if (selectiveOptimization_ != null) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(SelectiveOptimization); } if (optimizationGoalSetting_ != null) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(OptimizationGoalSetting); } if (trackingSetting_ != null) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(TrackingSetting); } if (PaymentMode != global::Google.Ads.GoogleAds.V6.Enums.PaymentModeEnum.Types.PaymentMode.Unspecified) { size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) PaymentMode); } if (HasOptimizationScore) { size += 2 + 8; } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.BiddingStrategy) { size += 2 + pb::CodedOutputStream.ComputeStringSize(BiddingStrategy); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.Commission) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(Commission); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.ManualCpc) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(ManualCpc); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.ManualCpm) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(ManualCpm); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.ManualCpv) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(ManualCpv); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.MaximizeConversions) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(MaximizeConversions); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.MaximizeConversionValue) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(MaximizeConversionValue); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetCpa) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(TargetCpa); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetImpressionShare) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(TargetImpressionShare); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetRoas) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(TargetRoas); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetSpend) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(TargetSpend); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.PercentCpc) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(PercentCpc); } if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetCpm) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(TargetCpm); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } return size; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Campaign other) { if (other == null) { return; } if (other.ResourceName.Length != 0) { ResourceName = other.ResourceName; } if (other.HasId) { Id = other.Id; } if (other.HasName) { Name = other.Name; } if (other.Status != global::Google.Ads.GoogleAds.V6.Enums.CampaignStatusEnum.Types.CampaignStatus.Unspecified) { Status = other.Status; } if (other.ServingStatus != global::Google.Ads.GoogleAds.V6.Enums.CampaignServingStatusEnum.Types.CampaignServingStatus.Unspecified) { ServingStatus = other.ServingStatus; } if (other.AdServingOptimizationStatus != global::Google.Ads.GoogleAds.V6.Enums.AdServingOptimizationStatusEnum.Types.AdServingOptimizationStatus.Unspecified) { AdServingOptimizationStatus = other.AdServingOptimizationStatus; } if (other.AdvertisingChannelType != global::Google.Ads.GoogleAds.V6.Enums.AdvertisingChannelTypeEnum.Types.AdvertisingChannelType.Unspecified) { AdvertisingChannelType = other.AdvertisingChannelType; } if (other.AdvertisingChannelSubType != global::Google.Ads.GoogleAds.V6.Enums.AdvertisingChannelSubTypeEnum.Types.AdvertisingChannelSubType.Unspecified) { AdvertisingChannelSubType = other.AdvertisingChannelSubType; } if (other.HasTrackingUrlTemplate) { TrackingUrlTemplate = other.TrackingUrlTemplate; } urlCustomParameters_.Add(other.urlCustomParameters_); if (other.realTimeBiddingSetting_ != null) { if (realTimeBiddingSetting_ == null) { RealTimeBiddingSetting = new global::Google.Ads.GoogleAds.V6.Common.RealTimeBiddingSetting(); } RealTimeBiddingSetting.MergeFrom(other.RealTimeBiddingSetting); } if (other.networkSettings_ != null) { if (networkSettings_ == null) { NetworkSettings = new global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.NetworkSettings(); } NetworkSettings.MergeFrom(other.NetworkSettings); } if (other.hotelSetting_ != null) { if (hotelSetting_ == null) { HotelSetting = new global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.HotelSettingInfo(); } HotelSetting.MergeFrom(other.HotelSetting); } if (other.dynamicSearchAdsSetting_ != null) { if (dynamicSearchAdsSetting_ == null) { DynamicSearchAdsSetting = new global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.DynamicSearchAdsSetting(); } DynamicSearchAdsSetting.MergeFrom(other.DynamicSearchAdsSetting); } if (other.shoppingSetting_ != null) { if (shoppingSetting_ == null) { ShoppingSetting = new global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.ShoppingSetting(); } ShoppingSetting.MergeFrom(other.ShoppingSetting); } if (other.targetingSetting_ != null) { if (targetingSetting_ == null) { TargetingSetting = new global::Google.Ads.GoogleAds.V6.Common.TargetingSetting(); } TargetingSetting.MergeFrom(other.TargetingSetting); } if (other.geoTargetTypeSetting_ != null) { if (geoTargetTypeSetting_ == null) { GeoTargetTypeSetting = new global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.GeoTargetTypeSetting(); } GeoTargetTypeSetting.MergeFrom(other.GeoTargetTypeSetting); } if (other.localCampaignSetting_ != null) { if (localCampaignSetting_ == null) { LocalCampaignSetting = new global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.LocalCampaignSetting(); } LocalCampaignSetting.MergeFrom(other.LocalCampaignSetting); } if (other.appCampaignSetting_ != null) { if (appCampaignSetting_ == null) { AppCampaignSetting = new global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.AppCampaignSetting(); } AppCampaignSetting.MergeFrom(other.AppCampaignSetting); } labels_.Add(other.labels_); if (other.ExperimentType != global::Google.Ads.GoogleAds.V6.Enums.CampaignExperimentTypeEnum.Types.CampaignExperimentType.Unspecified) { ExperimentType = other.ExperimentType; } if (other.HasBaseCampaign) { BaseCampaign = other.BaseCampaign; } if (other.HasCampaignBudget) { CampaignBudget = other.CampaignBudget; } if (other.BiddingStrategyType != global::Google.Ads.GoogleAds.V6.Enums.BiddingStrategyTypeEnum.Types.BiddingStrategyType.Unspecified) { BiddingStrategyType = other.BiddingStrategyType; } if (other.HasStartDate) { StartDate = other.StartDate; } if (other.HasEndDate) { EndDate = other.EndDate; } if (other.HasFinalUrlSuffix) { FinalUrlSuffix = other.FinalUrlSuffix; } frequencyCaps_.Add(other.frequencyCaps_); if (other.VideoBrandSafetySuitability != global::Google.Ads.GoogleAds.V6.Enums.BrandSafetySuitabilityEnum.Types.BrandSafetySuitability.Unspecified) { VideoBrandSafetySuitability = other.VideoBrandSafetySuitability; } if (other.vanityPharma_ != null) { if (vanityPharma_ == null) { VanityPharma = new global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.VanityPharma(); } VanityPharma.MergeFrom(other.VanityPharma); } if (other.selectiveOptimization_ != null) { if (selectiveOptimization_ == null) { SelectiveOptimization = new global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.SelectiveOptimization(); } SelectiveOptimization.MergeFrom(other.SelectiveOptimization); } if (other.optimizationGoalSetting_ != null) { if (optimizationGoalSetting_ == null) { OptimizationGoalSetting = new global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.OptimizationGoalSetting(); } OptimizationGoalSetting.MergeFrom(other.OptimizationGoalSetting); } if (other.trackingSetting_ != null) { if (trackingSetting_ == null) { TrackingSetting = new global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.TrackingSetting(); } TrackingSetting.MergeFrom(other.TrackingSetting); } if (other.PaymentMode != global::Google.Ads.GoogleAds.V6.Enums.PaymentModeEnum.Types.PaymentMode.Unspecified) { PaymentMode = other.PaymentMode; } if (other.HasOptimizationScore) { OptimizationScore = other.OptimizationScore; } switch (other.CampaignBiddingStrategyCase) { case CampaignBiddingStrategyOneofCase.BiddingStrategy: BiddingStrategy = other.BiddingStrategy; break; case CampaignBiddingStrategyOneofCase.Commission: if (Commission == null) { Commission = new global::Google.Ads.GoogleAds.V6.Common.Commission(); } Commission.MergeFrom(other.Commission); break; case CampaignBiddingStrategyOneofCase.ManualCpc: if (ManualCpc == null) { ManualCpc = new global::Google.Ads.GoogleAds.V6.Common.ManualCpc(); } ManualCpc.MergeFrom(other.ManualCpc); break; case CampaignBiddingStrategyOneofCase.ManualCpm: if (ManualCpm == null) { ManualCpm = new global::Google.Ads.GoogleAds.V6.Common.ManualCpm(); } ManualCpm.MergeFrom(other.ManualCpm); break; case CampaignBiddingStrategyOneofCase.ManualCpv: if (ManualCpv == null) { ManualCpv = new global::Google.Ads.GoogleAds.V6.Common.ManualCpv(); } ManualCpv.MergeFrom(other.ManualCpv); break; case CampaignBiddingStrategyOneofCase.MaximizeConversions: if (MaximizeConversions == null) { MaximizeConversions = new global::Google.Ads.GoogleAds.V6.Common.MaximizeConversions(); } MaximizeConversions.MergeFrom(other.MaximizeConversions); break; case CampaignBiddingStrategyOneofCase.MaximizeConversionValue: if (MaximizeConversionValue == null) { MaximizeConversionValue = new global::Google.Ads.GoogleAds.V6.Common.MaximizeConversionValue(); } MaximizeConversionValue.MergeFrom(other.MaximizeConversionValue); break; case CampaignBiddingStrategyOneofCase.TargetCpa: if (TargetCpa == null) { TargetCpa = new global::Google.Ads.GoogleAds.V6.Common.TargetCpa(); } TargetCpa.MergeFrom(other.TargetCpa); break; case CampaignBiddingStrategyOneofCase.TargetImpressionShare: if (TargetImpressionShare == null) { TargetImpressionShare = new global::Google.Ads.GoogleAds.V6.Common.TargetImpressionShare(); } TargetImpressionShare.MergeFrom(other.TargetImpressionShare); break; case CampaignBiddingStrategyOneofCase.TargetRoas: if (TargetRoas == null) { TargetRoas = new global::Google.Ads.GoogleAds.V6.Common.TargetRoas(); } TargetRoas.MergeFrom(other.TargetRoas); break; case CampaignBiddingStrategyOneofCase.TargetSpend: if (TargetSpend == null) { TargetSpend = new global::Google.Ads.GoogleAds.V6.Common.TargetSpend(); } TargetSpend.MergeFrom(other.TargetSpend); break; case CampaignBiddingStrategyOneofCase.PercentCpc: if (PercentCpc == null) { PercentCpc = new global::Google.Ads.GoogleAds.V6.Common.PercentCpc(); } PercentCpc.MergeFrom(other.PercentCpc); break; case CampaignBiddingStrategyOneofCase.TargetCpm: if (TargetCpm == null) { TargetCpm = new global::Google.Ads.GoogleAds.V6.Common.TargetCpm(); } TargetCpm.MergeFrom(other.TargetCpm); break; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE input.ReadRawMessage(this); #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { ResourceName = input.ReadString(); break; } case 40: { Status = (global::Google.Ads.GoogleAds.V6.Enums.CampaignStatusEnum.Types.CampaignStatus) input.ReadEnum(); break; } case 64: { AdServingOptimizationStatus = (global::Google.Ads.GoogleAds.V6.Enums.AdServingOptimizationStatusEnum.Types.AdServingOptimizationStatus) input.ReadEnum(); break; } case 72: { AdvertisingChannelType = (global::Google.Ads.GoogleAds.V6.Enums.AdvertisingChannelTypeEnum.Types.AdvertisingChannelType) input.ReadEnum(); break; } case 80: { AdvertisingChannelSubType = (global::Google.Ads.GoogleAds.V6.Enums.AdvertisingChannelSubTypeEnum.Types.AdvertisingChannelSubType) input.ReadEnum(); break; } case 98: { urlCustomParameters_.AddEntriesFrom(input, _repeated_urlCustomParameters_codec); break; } case 114: { if (networkSettings_ == null) { NetworkSettings = new global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.NetworkSettings(); } input.ReadMessage(NetworkSettings); break; } case 136: { ExperimentType = (global::Google.Ads.GoogleAds.V6.Enums.CampaignExperimentTypeEnum.Types.CampaignExperimentType) input.ReadEnum(); break; } case 168: { ServingStatus = (global::Google.Ads.GoogleAds.V6.Enums.CampaignServingStatusEnum.Types.CampaignServingStatus) input.ReadEnum(); break; } case 176: { BiddingStrategyType = (global::Google.Ads.GoogleAds.V6.Enums.BiddingStrategyTypeEnum.Types.BiddingStrategyType) input.ReadEnum(); break; } case 194: { global::Google.Ads.GoogleAds.V6.Common.ManualCpc subBuilder = new global::Google.Ads.GoogleAds.V6.Common.ManualCpc(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.ManualCpc) { subBuilder.MergeFrom(ManualCpc); } input.ReadMessage(subBuilder); ManualCpc = subBuilder; break; } case 202: { global::Google.Ads.GoogleAds.V6.Common.ManualCpm subBuilder = new global::Google.Ads.GoogleAds.V6.Common.ManualCpm(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.ManualCpm) { subBuilder.MergeFrom(ManualCpm); } input.ReadMessage(subBuilder); ManualCpm = subBuilder; break; } case 210: { global::Google.Ads.GoogleAds.V6.Common.TargetCpa subBuilder = new global::Google.Ads.GoogleAds.V6.Common.TargetCpa(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetCpa) { subBuilder.MergeFrom(TargetCpa); } input.ReadMessage(subBuilder); TargetCpa = subBuilder; break; } case 218: { global::Google.Ads.GoogleAds.V6.Common.TargetSpend subBuilder = new global::Google.Ads.GoogleAds.V6.Common.TargetSpend(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetSpend) { subBuilder.MergeFrom(TargetSpend); } input.ReadMessage(subBuilder); TargetSpend = subBuilder; break; } case 234: { global::Google.Ads.GoogleAds.V6.Common.TargetRoas subBuilder = new global::Google.Ads.GoogleAds.V6.Common.TargetRoas(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetRoas) { subBuilder.MergeFrom(TargetRoas); } input.ReadMessage(subBuilder); TargetRoas = subBuilder; break; } case 242: { global::Google.Ads.GoogleAds.V6.Common.MaximizeConversions subBuilder = new global::Google.Ads.GoogleAds.V6.Common.MaximizeConversions(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.MaximizeConversions) { subBuilder.MergeFrom(MaximizeConversions); } input.ReadMessage(subBuilder); MaximizeConversions = subBuilder; break; } case 250: { global::Google.Ads.GoogleAds.V6.Common.MaximizeConversionValue subBuilder = new global::Google.Ads.GoogleAds.V6.Common.MaximizeConversionValue(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.MaximizeConversionValue) { subBuilder.MergeFrom(MaximizeConversionValue); } input.ReadMessage(subBuilder); MaximizeConversionValue = subBuilder; break; } case 258: { if (hotelSetting_ == null) { HotelSetting = new global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.HotelSettingInfo(); } input.ReadMessage(HotelSetting); break; } case 266: { if (dynamicSearchAdsSetting_ == null) { DynamicSearchAdsSetting = new global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.DynamicSearchAdsSetting(); } input.ReadMessage(DynamicSearchAdsSetting); break; } case 274: { global::Google.Ads.GoogleAds.V6.Common.PercentCpc subBuilder = new global::Google.Ads.GoogleAds.V6.Common.PercentCpc(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.PercentCpc) { subBuilder.MergeFrom(PercentCpc); } input.ReadMessage(subBuilder); PercentCpc = subBuilder; break; } case 290: { if (shoppingSetting_ == null) { ShoppingSetting = new global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.ShoppingSetting(); } input.ReadMessage(ShoppingSetting); break; } case 298: { global::Google.Ads.GoogleAds.V6.Common.ManualCpv subBuilder = new global::Google.Ads.GoogleAds.V6.Common.ManualCpv(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.ManualCpv) { subBuilder.MergeFrom(ManualCpv); } input.ReadMessage(subBuilder); ManualCpv = subBuilder; break; } case 314: { if (realTimeBiddingSetting_ == null) { RealTimeBiddingSetting = new global::Google.Ads.GoogleAds.V6.Common.RealTimeBiddingSetting(); } input.ReadMessage(RealTimeBiddingSetting); break; } case 322: { frequencyCaps_.AddEntriesFrom(input, _repeated_frequencyCaps_codec); break; } case 330: { global::Google.Ads.GoogleAds.V6.Common.TargetCpm subBuilder = new global::Google.Ads.GoogleAds.V6.Common.TargetCpm(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetCpm) { subBuilder.MergeFrom(TargetCpm); } input.ReadMessage(subBuilder); TargetCpm = subBuilder; break; } case 336: { VideoBrandSafetySuitability = (global::Google.Ads.GoogleAds.V6.Enums.BrandSafetySuitabilityEnum.Types.BrandSafetySuitability) input.ReadEnum(); break; } case 346: { if (targetingSetting_ == null) { TargetingSetting = new global::Google.Ads.GoogleAds.V6.Common.TargetingSetting(); } input.ReadMessage(TargetingSetting); break; } case 354: { if (vanityPharma_ == null) { VanityPharma = new global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.VanityPharma(); } input.ReadMessage(VanityPharma); break; } case 362: { if (selectiveOptimization_ == null) { SelectiveOptimization = new global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.SelectiveOptimization(); } input.ReadMessage(SelectiveOptimization); break; } case 370: { if (trackingSetting_ == null) { TrackingSetting = new global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.TrackingSetting(); } input.ReadMessage(TrackingSetting); break; } case 378: { if (geoTargetTypeSetting_ == null) { GeoTargetTypeSetting = new global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.GeoTargetTypeSetting(); } input.ReadMessage(GeoTargetTypeSetting); break; } case 386: { global::Google.Ads.GoogleAds.V6.Common.TargetImpressionShare subBuilder = new global::Google.Ads.GoogleAds.V6.Common.TargetImpressionShare(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetImpressionShare) { subBuilder.MergeFrom(TargetImpressionShare); } input.ReadMessage(subBuilder); TargetImpressionShare = subBuilder; break; } case 394: { global::Google.Ads.GoogleAds.V6.Common.Commission subBuilder = new global::Google.Ads.GoogleAds.V6.Common.Commission(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.Commission) { subBuilder.MergeFrom(Commission); } input.ReadMessage(subBuilder); Commission = subBuilder; break; } case 402: { if (localCampaignSetting_ == null) { LocalCampaignSetting = new global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.LocalCampaignSetting(); } input.ReadMessage(LocalCampaignSetting); break; } case 410: { if (appCampaignSetting_ == null) { AppCampaignSetting = new global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.AppCampaignSetting(); } input.ReadMessage(AppCampaignSetting); break; } case 416: { PaymentMode = (global::Google.Ads.GoogleAds.V6.Enums.PaymentModeEnum.Types.PaymentMode) input.ReadEnum(); break; } case 434: { if (optimizationGoalSetting_ == null) { OptimizationGoalSetting = new global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.OptimizationGoalSetting(); } input.ReadMessage(OptimizationGoalSetting); break; } case 450: { BaseCampaign = input.ReadString(); break; } case 466: { Name = input.ReadString(); break; } case 472: { Id = input.ReadInt64(); break; } case 482: { TrackingUrlTemplate = input.ReadString(); break; } case 490: { labels_.AddEntriesFrom(input, _repeated_labels_codec); break; } case 498: { CampaignBudget = input.ReadString(); break; } case 506: { StartDate = input.ReadString(); break; } case 514: { EndDate = input.ReadString(); break; } case 522: { FinalUrlSuffix = input.ReadString(); break; } case 529: { OptimizationScore = input.ReadDouble(); break; } case 538: { BiddingStrategy = input.ReadString(); break; } } } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { ResourceName = input.ReadString(); break; } case 40: { Status = (global::Google.Ads.GoogleAds.V6.Enums.CampaignStatusEnum.Types.CampaignStatus) input.ReadEnum(); break; } case 64: { AdServingOptimizationStatus = (global::Google.Ads.GoogleAds.V6.Enums.AdServingOptimizationStatusEnum.Types.AdServingOptimizationStatus) input.ReadEnum(); break; } case 72: { AdvertisingChannelType = (global::Google.Ads.GoogleAds.V6.Enums.AdvertisingChannelTypeEnum.Types.AdvertisingChannelType) input.ReadEnum(); break; } case 80: { AdvertisingChannelSubType = (global::Google.Ads.GoogleAds.V6.Enums.AdvertisingChannelSubTypeEnum.Types.AdvertisingChannelSubType) input.ReadEnum(); break; } case 98: { urlCustomParameters_.AddEntriesFrom(ref input, _repeated_urlCustomParameters_codec); break; } case 114: { if (networkSettings_ == null) { NetworkSettings = new global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.NetworkSettings(); } input.ReadMessage(NetworkSettings); break; } case 136: { ExperimentType = (global::Google.Ads.GoogleAds.V6.Enums.CampaignExperimentTypeEnum.Types.CampaignExperimentType) input.ReadEnum(); break; } case 168: { ServingStatus = (global::Google.Ads.GoogleAds.V6.Enums.CampaignServingStatusEnum.Types.CampaignServingStatus) input.ReadEnum(); break; } case 176: { BiddingStrategyType = (global::Google.Ads.GoogleAds.V6.Enums.BiddingStrategyTypeEnum.Types.BiddingStrategyType) input.ReadEnum(); break; } case 194: { global::Google.Ads.GoogleAds.V6.Common.ManualCpc subBuilder = new global::Google.Ads.GoogleAds.V6.Common.ManualCpc(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.ManualCpc) { subBuilder.MergeFrom(ManualCpc); } input.ReadMessage(subBuilder); ManualCpc = subBuilder; break; } case 202: { global::Google.Ads.GoogleAds.V6.Common.ManualCpm subBuilder = new global::Google.Ads.GoogleAds.V6.Common.ManualCpm(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.ManualCpm) { subBuilder.MergeFrom(ManualCpm); } input.ReadMessage(subBuilder); ManualCpm = subBuilder; break; } case 210: { global::Google.Ads.GoogleAds.V6.Common.TargetCpa subBuilder = new global::Google.Ads.GoogleAds.V6.Common.TargetCpa(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetCpa) { subBuilder.MergeFrom(TargetCpa); } input.ReadMessage(subBuilder); TargetCpa = subBuilder; break; } case 218: { global::Google.Ads.GoogleAds.V6.Common.TargetSpend subBuilder = new global::Google.Ads.GoogleAds.V6.Common.TargetSpend(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetSpend) { subBuilder.MergeFrom(TargetSpend); } input.ReadMessage(subBuilder); TargetSpend = subBuilder; break; } case 234: { global::Google.Ads.GoogleAds.V6.Common.TargetRoas subBuilder = new global::Google.Ads.GoogleAds.V6.Common.TargetRoas(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetRoas) { subBuilder.MergeFrom(TargetRoas); } input.ReadMessage(subBuilder); TargetRoas = subBuilder; break; } case 242: { global::Google.Ads.GoogleAds.V6.Common.MaximizeConversions subBuilder = new global::Google.Ads.GoogleAds.V6.Common.MaximizeConversions(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.MaximizeConversions) { subBuilder.MergeFrom(MaximizeConversions); } input.ReadMessage(subBuilder); MaximizeConversions = subBuilder; break; } case 250: { global::Google.Ads.GoogleAds.V6.Common.MaximizeConversionValue subBuilder = new global::Google.Ads.GoogleAds.V6.Common.MaximizeConversionValue(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.MaximizeConversionValue) { subBuilder.MergeFrom(MaximizeConversionValue); } input.ReadMessage(subBuilder); MaximizeConversionValue = subBuilder; break; } case 258: { if (hotelSetting_ == null) { HotelSetting = new global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.HotelSettingInfo(); } input.ReadMessage(HotelSetting); break; } case 266: { if (dynamicSearchAdsSetting_ == null) { DynamicSearchAdsSetting = new global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.DynamicSearchAdsSetting(); } input.ReadMessage(DynamicSearchAdsSetting); break; } case 274: { global::Google.Ads.GoogleAds.V6.Common.PercentCpc subBuilder = new global::Google.Ads.GoogleAds.V6.Common.PercentCpc(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.PercentCpc) { subBuilder.MergeFrom(PercentCpc); } input.ReadMessage(subBuilder); PercentCpc = subBuilder; break; } case 290: { if (shoppingSetting_ == null) { ShoppingSetting = new global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.ShoppingSetting(); } input.ReadMessage(ShoppingSetting); break; } case 298: { global::Google.Ads.GoogleAds.V6.Common.ManualCpv subBuilder = new global::Google.Ads.GoogleAds.V6.Common.ManualCpv(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.ManualCpv) { subBuilder.MergeFrom(ManualCpv); } input.ReadMessage(subBuilder); ManualCpv = subBuilder; break; } case 314: { if (realTimeBiddingSetting_ == null) { RealTimeBiddingSetting = new global::Google.Ads.GoogleAds.V6.Common.RealTimeBiddingSetting(); } input.ReadMessage(RealTimeBiddingSetting); break; } case 322: { frequencyCaps_.AddEntriesFrom(ref input, _repeated_frequencyCaps_codec); break; } case 330: { global::Google.Ads.GoogleAds.V6.Common.TargetCpm subBuilder = new global::Google.Ads.GoogleAds.V6.Common.TargetCpm(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetCpm) { subBuilder.MergeFrom(TargetCpm); } input.ReadMessage(subBuilder); TargetCpm = subBuilder; break; } case 336: { VideoBrandSafetySuitability = (global::Google.Ads.GoogleAds.V6.Enums.BrandSafetySuitabilityEnum.Types.BrandSafetySuitability) input.ReadEnum(); break; } case 346: { if (targetingSetting_ == null) { TargetingSetting = new global::Google.Ads.GoogleAds.V6.Common.TargetingSetting(); } input.ReadMessage(TargetingSetting); break; } case 354: { if (vanityPharma_ == null) { VanityPharma = new global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.VanityPharma(); } input.ReadMessage(VanityPharma); break; } case 362: { if (selectiveOptimization_ == null) { SelectiveOptimization = new global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.SelectiveOptimization(); } input.ReadMessage(SelectiveOptimization); break; } case 370: { if (trackingSetting_ == null) { TrackingSetting = new global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.TrackingSetting(); } input.ReadMessage(TrackingSetting); break; } case 378: { if (geoTargetTypeSetting_ == null) { GeoTargetTypeSetting = new global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.GeoTargetTypeSetting(); } input.ReadMessage(GeoTargetTypeSetting); break; } case 386: { global::Google.Ads.GoogleAds.V6.Common.TargetImpressionShare subBuilder = new global::Google.Ads.GoogleAds.V6.Common.TargetImpressionShare(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.TargetImpressionShare) { subBuilder.MergeFrom(TargetImpressionShare); } input.ReadMessage(subBuilder); TargetImpressionShare = subBuilder; break; } case 394: { global::Google.Ads.GoogleAds.V6.Common.Commission subBuilder = new global::Google.Ads.GoogleAds.V6.Common.Commission(); if (campaignBiddingStrategyCase_ == CampaignBiddingStrategyOneofCase.Commission) { subBuilder.MergeFrom(Commission); } input.ReadMessage(subBuilder); Commission = subBuilder; break; } case 402: { if (localCampaignSetting_ == null) { LocalCampaignSetting = new global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.LocalCampaignSetting(); } input.ReadMessage(LocalCampaignSetting); break; } case 410: { if (appCampaignSetting_ == null) { AppCampaignSetting = new global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.AppCampaignSetting(); } input.ReadMessage(AppCampaignSetting); break; } case 416: { PaymentMode = (global::Google.Ads.GoogleAds.V6.Enums.PaymentModeEnum.Types.PaymentMode) input.ReadEnum(); break; } case 434: { if (optimizationGoalSetting_ == null) { OptimizationGoalSetting = new global::Google.Ads.GoogleAds.V6.Resources.Campaign.Types.OptimizationGoalSetting(); } input.ReadMessage(OptimizationGoalSetting); break; } case 450: { BaseCampaign = input.ReadString(); break; } case 466: { Name = input.ReadString(); break; } case 472: { Id = input.ReadInt64(); break; } case 482: { TrackingUrlTemplate = input.ReadString(); break; } case 490: { labels_.AddEntriesFrom(ref input, _repeated_labels_codec); break; } case 498: { CampaignBudget = input.ReadString(); break; } case 506: { StartDate = input.ReadString(); break; } case 514: { EndDate = input.ReadString(); break; } case 522: { FinalUrlSuffix = input.ReadString(); break; } case 529: { OptimizationScore = input.ReadDouble(); break; } case 538: { BiddingStrategy = input.ReadString(); break; } } } } #endif #region Nested types /// <summary>Container for nested types declared in the Campaign message type.</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static partial class Types { /// <summary> /// The network settings for the campaign. /// </summary> public sealed partial class NetworkSettings : pb::IMessage<NetworkSettings> #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { private static readonly pb::MessageParser<NetworkSettings> _parser = new pb::MessageParser<NetworkSettings>(() => new NetworkSettings()); private pb::UnknownFieldSet _unknownFields; private int _hasBits0; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<NetworkSettings> Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Ads.GoogleAds.V6.Resources.Campaign.Descriptor.NestedTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public NetworkSettings() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public NetworkSettings(NetworkSettings other) : this() { _hasBits0 = other._hasBits0; targetGoogleSearch_ = other.targetGoogleSearch_; targetSearchNetwork_ = other.targetSearchNetwork_; targetContentNetwork_ = other.targetContentNetwork_; targetPartnerSearchNetwork_ = other.targetPartnerSearchNetwork_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public NetworkSettings Clone() { return new NetworkSettings(this); } /// <summary>Field number for the "target_google_search" field.</summary> public const int TargetGoogleSearchFieldNumber = 5; private bool targetGoogleSearch_; /// <summary> /// Whether ads will be served with google.com search results. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool TargetGoogleSearch { get { if ((_hasBits0 & 1) != 0) { return targetGoogleSearch_; } else { return false; } } set { _hasBits0 |= 1; targetGoogleSearch_ = value; } } /// <summary>Gets whether the "target_google_search" field is set</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool HasTargetGoogleSearch { get { return (_hasBits0 & 1) != 0; } } /// <summary>Clears the value of the "target_google_search" field</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void ClearTargetGoogleSearch() { _hasBits0 &= ~1; } /// <summary>Field number for the "target_search_network" field.</summary> public const int TargetSearchNetworkFieldNumber = 6; private bool targetSearchNetwork_; /// <summary> /// Whether ads will be served on partner sites in the Google Search Network /// (requires `target_google_search` to also be `true`). /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool TargetSearchNetwork { get { if ((_hasBits0 & 2) != 0) { return targetSearchNetwork_; } else { return false; } } set { _hasBits0 |= 2; targetSearchNetwork_ = value; } } /// <summary>Gets whether the "target_search_network" field is set</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool HasTargetSearchNetwork { get { return (_hasBits0 & 2) != 0; } } /// <summary>Clears the value of the "target_search_network" field</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void ClearTargetSearchNetwork() { _hasBits0 &= ~2; } /// <summary>Field number for the "target_content_network" field.</summary> public const int TargetContentNetworkFieldNumber = 7; private bool targetContentNetwork_; /// <summary> /// Whether ads will be served on specified placements in the Google Display /// Network. Placements are specified using the Placement criterion. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool TargetContentNetwork { get { if ((_hasBits0 & 4) != 0) { return targetContentNetwork_; } else { return false; } } set { _hasBits0 |= 4; targetContentNetwork_ = value; } } /// <summary>Gets whether the "target_content_network" field is set</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool HasTargetContentNetwork { get { return (_hasBits0 & 4) != 0; } } /// <summary>Clears the value of the "target_content_network" field</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void ClearTargetContentNetwork() { _hasBits0 &= ~4; } /// <summary>Field number for the "target_partner_search_network" field.</summary> public const int TargetPartnerSearchNetworkFieldNumber = 8; private bool targetPartnerSearchNetwork_; /// <summary> /// Whether ads will be served on the Google Partner Network. /// This is available only to some select Google partner accounts. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool TargetPartnerSearchNetwork { get { if ((_hasBits0 & 8) != 0) { return targetPartnerSearchNetwork_; } else { return false; } } set { _hasBits0 |= 8; targetPartnerSearchNetwork_ = value; } } /// <summary>Gets whether the "target_partner_search_network" field is set</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool HasTargetPartnerSearchNetwork { get { return (_hasBits0 & 8) != 0; } } /// <summary>Clears the value of the "target_partner_search_network" field</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void ClearTargetPartnerSearchNetwork() { _hasBits0 &= ~8; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as NetworkSettings); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(NetworkSettings other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } if (TargetGoogleSearch != other.TargetGoogleSearch) return false; if (TargetSearchNetwork != other.TargetSearchNetwork) return false; if (TargetContentNetwork != other.TargetContentNetwork) return false; if (TargetPartnerSearchNetwork != other.TargetPartnerSearchNetwork) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (HasTargetGoogleSearch) hash ^= TargetGoogleSearch.GetHashCode(); if (HasTargetSearchNetwork) hash ^= TargetSearchNetwork.GetHashCode(); if (HasTargetContentNetwork) hash ^= TargetContentNetwork.GetHashCode(); if (HasTargetPartnerSearchNetwork) hash ^= TargetPartnerSearchNetwork.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return hash; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else if (HasTargetGoogleSearch) { output.WriteRawTag(40); output.WriteBool(TargetGoogleSearch); } if (HasTargetSearchNetwork) { output.WriteRawTag(48); output.WriteBool(TargetSearchNetwork); } if (HasTargetContentNetwork) { output.WriteRawTag(56); output.WriteBool(TargetContentNetwork); } if (HasTargetPartnerSearchNetwork) { output.WriteRawTag(64); output.WriteBool(TargetPartnerSearchNetwork); } if (_unknownFields != null) { _unknownFields.WriteTo(output); } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { if (HasTargetGoogleSearch) { output.WriteRawTag(40); output.WriteBool(TargetGoogleSearch); } if (HasTargetSearchNetwork) { output.WriteRawTag(48); output.WriteBool(TargetSearchNetwork); } if (HasTargetContentNetwork) { output.WriteRawTag(56); output.WriteBool(TargetContentNetwork); } if (HasTargetPartnerSearchNetwork) { output.WriteRawTag(64); output.WriteBool(TargetPartnerSearchNetwork); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } } #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (HasTargetGoogleSearch) { size += 1 + 1; } if (HasTargetSearchNetwork) { size += 1 + 1; } if (HasTargetContentNetwork) { size += 1 + 1; } if (HasTargetPartnerSearchNetwork) { size += 1 + 1; } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } return size; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(NetworkSettings other) { if (other == null) { return; } if (other.HasTargetGoogleSearch) { TargetGoogleSearch = other.TargetGoogleSearch; } if (other.HasTargetSearchNetwork) { TargetSearchNetwork = other.TargetSearchNetwork; } if (other.HasTargetContentNetwork) { TargetContentNetwork = other.TargetContentNetwork; } if (other.HasTargetPartnerSearchNetwork) { TargetPartnerSearchNetwork = other.TargetPartnerSearchNetwork; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE input.ReadRawMessage(this); #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 40: { TargetGoogleSearch = input.ReadBool(); break; } case 48: { TargetSearchNetwork = input.ReadBool(); break; } case 56: { TargetContentNetwork = input.ReadBool(); break; } case 64: { TargetPartnerSearchNetwork = input.ReadBool(); break; } } } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 40: { TargetGoogleSearch = input.ReadBool(); break; } case 48: { TargetSearchNetwork = input.ReadBool(); break; } case 56: { TargetContentNetwork = input.ReadBool(); break; } case 64: { TargetPartnerSearchNetwork = input.ReadBool(); break; } } } } #endif } /// <summary> /// Campaign-level settings for hotel ads. /// </summary> public sealed partial class HotelSettingInfo : pb::IMessage<HotelSettingInfo> #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { private static readonly pb::MessageParser<HotelSettingInfo> _parser = new pb::MessageParser<HotelSettingInfo>(() => new HotelSettingInfo()); private pb::UnknownFieldSet _unknownFields; private int _hasBits0; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<HotelSettingInfo> Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Ads.GoogleAds.V6.Resources.Campaign.Descriptor.NestedTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public HotelSettingInfo() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public HotelSettingInfo(HotelSettingInfo other) : this() { _hasBits0 = other._hasBits0; hotelCenterId_ = other.hotelCenterId_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public HotelSettingInfo Clone() { return new HotelSettingInfo(this); } /// <summary>Field number for the "hotel_center_id" field.</summary> public const int HotelCenterIdFieldNumber = 2; private long hotelCenterId_; /// <summary> /// Immutable. The linked Hotel Center account. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public long HotelCenterId { get { if ((_hasBits0 & 1) != 0) { return hotelCenterId_; } else { return 0L; } } set { _hasBits0 |= 1; hotelCenterId_ = value; } } /// <summary>Gets whether the "hotel_center_id" field is set</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool HasHotelCenterId { get { return (_hasBits0 & 1) != 0; } } /// <summary>Clears the value of the "hotel_center_id" field</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void ClearHotelCenterId() { _hasBits0 &= ~1; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as HotelSettingInfo); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(HotelSettingInfo other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } if (HotelCenterId != other.HotelCenterId) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (HasHotelCenterId) hash ^= HotelCenterId.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return hash; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else if (HasHotelCenterId) { output.WriteRawTag(16); output.WriteInt64(HotelCenterId); } if (_unknownFields != null) { _unknownFields.WriteTo(output); } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { if (HasHotelCenterId) { output.WriteRawTag(16); output.WriteInt64(HotelCenterId); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } } #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (HasHotelCenterId) { size += 1 + pb::CodedOutputStream.ComputeInt64Size(HotelCenterId); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } return size; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(HotelSettingInfo other) { if (other == null) { return; } if (other.HasHotelCenterId) { HotelCenterId = other.HotelCenterId; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE input.ReadRawMessage(this); #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 16: { HotelCenterId = input.ReadInt64(); break; } } } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 16: { HotelCenterId = input.ReadInt64(); break; } } } } #endif } /// <summary> /// Represents a collection of settings related to ads geotargeting. /// </summary> public sealed partial class GeoTargetTypeSetting : pb::IMessage<GeoTargetTypeSetting> #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { private static readonly pb::MessageParser<GeoTargetTypeSetting> _parser = new pb::MessageParser<GeoTargetTypeSetting>(() => new GeoTargetTypeSetting()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<GeoTargetTypeSetting> Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Ads.GoogleAds.V6.Resources.Campaign.Descriptor.NestedTypes[2]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public GeoTargetTypeSetting() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public GeoTargetTypeSetting(GeoTargetTypeSetting other) : this() { positiveGeoTargetType_ = other.positiveGeoTargetType_; negativeGeoTargetType_ = other.negativeGeoTargetType_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public GeoTargetTypeSetting Clone() { return new GeoTargetTypeSetting(this); } /// <summary>Field number for the "positive_geo_target_type" field.</summary> public const int PositiveGeoTargetTypeFieldNumber = 1; private global::Google.Ads.GoogleAds.V6.Enums.PositiveGeoTargetTypeEnum.Types.PositiveGeoTargetType positiveGeoTargetType_ = global::Google.Ads.GoogleAds.V6.Enums.PositiveGeoTargetTypeEnum.Types.PositiveGeoTargetType.Unspecified; /// <summary> /// The setting used for positive geotargeting in this particular campaign. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Enums.PositiveGeoTargetTypeEnum.Types.PositiveGeoTargetType PositiveGeoTargetType { get { return positiveGeoTargetType_; } set { positiveGeoTargetType_ = value; } } /// <summary>Field number for the "negative_geo_target_type" field.</summary> public const int NegativeGeoTargetTypeFieldNumber = 2; private global::Google.Ads.GoogleAds.V6.Enums.NegativeGeoTargetTypeEnum.Types.NegativeGeoTargetType negativeGeoTargetType_ = global::Google.Ads.GoogleAds.V6.Enums.NegativeGeoTargetTypeEnum.Types.NegativeGeoTargetType.Unspecified; /// <summary> /// The setting used for negative geotargeting in this particular campaign. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Enums.NegativeGeoTargetTypeEnum.Types.NegativeGeoTargetType NegativeGeoTargetType { get { return negativeGeoTargetType_; } set { negativeGeoTargetType_ = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as GeoTargetTypeSetting); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(GeoTargetTypeSetting other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } if (PositiveGeoTargetType != other.PositiveGeoTargetType) return false; if (NegativeGeoTargetType != other.NegativeGeoTargetType) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (PositiveGeoTargetType != global::Google.Ads.GoogleAds.V6.Enums.PositiveGeoTargetTypeEnum.Types.PositiveGeoTargetType.Unspecified) hash ^= PositiveGeoTargetType.GetHashCode(); if (NegativeGeoTargetType != global::Google.Ads.GoogleAds.V6.Enums.NegativeGeoTargetTypeEnum.Types.NegativeGeoTargetType.Unspecified) hash ^= NegativeGeoTargetType.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return hash; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else if (PositiveGeoTargetType != global::Google.Ads.GoogleAds.V6.Enums.PositiveGeoTargetTypeEnum.Types.PositiveGeoTargetType.Unspecified) { output.WriteRawTag(8); output.WriteEnum((int) PositiveGeoTargetType); } if (NegativeGeoTargetType != global::Google.Ads.GoogleAds.V6.Enums.NegativeGeoTargetTypeEnum.Types.NegativeGeoTargetType.Unspecified) { output.WriteRawTag(16); output.WriteEnum((int) NegativeGeoTargetType); } if (_unknownFields != null) { _unknownFields.WriteTo(output); } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { if (PositiveGeoTargetType != global::Google.Ads.GoogleAds.V6.Enums.PositiveGeoTargetTypeEnum.Types.PositiveGeoTargetType.Unspecified) { output.WriteRawTag(8); output.WriteEnum((int) PositiveGeoTargetType); } if (NegativeGeoTargetType != global::Google.Ads.GoogleAds.V6.Enums.NegativeGeoTargetTypeEnum.Types.NegativeGeoTargetType.Unspecified) { output.WriteRawTag(16); output.WriteEnum((int) NegativeGeoTargetType); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } } #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (PositiveGeoTargetType != global::Google.Ads.GoogleAds.V6.Enums.PositiveGeoTargetTypeEnum.Types.PositiveGeoTargetType.Unspecified) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) PositiveGeoTargetType); } if (NegativeGeoTargetType != global::Google.Ads.GoogleAds.V6.Enums.NegativeGeoTargetTypeEnum.Types.NegativeGeoTargetType.Unspecified) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) NegativeGeoTargetType); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } return size; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(GeoTargetTypeSetting other) { if (other == null) { return; } if (other.PositiveGeoTargetType != global::Google.Ads.GoogleAds.V6.Enums.PositiveGeoTargetTypeEnum.Types.PositiveGeoTargetType.Unspecified) { PositiveGeoTargetType = other.PositiveGeoTargetType; } if (other.NegativeGeoTargetType != global::Google.Ads.GoogleAds.V6.Enums.NegativeGeoTargetTypeEnum.Types.NegativeGeoTargetType.Unspecified) { NegativeGeoTargetType = other.NegativeGeoTargetType; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE input.ReadRawMessage(this); #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { PositiveGeoTargetType = (global::Google.Ads.GoogleAds.V6.Enums.PositiveGeoTargetTypeEnum.Types.PositiveGeoTargetType) input.ReadEnum(); break; } case 16: { NegativeGeoTargetType = (global::Google.Ads.GoogleAds.V6.Enums.NegativeGeoTargetTypeEnum.Types.NegativeGeoTargetType) input.ReadEnum(); break; } } } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 8: { PositiveGeoTargetType = (global::Google.Ads.GoogleAds.V6.Enums.PositiveGeoTargetTypeEnum.Types.PositiveGeoTargetType) input.ReadEnum(); break; } case 16: { NegativeGeoTargetType = (global::Google.Ads.GoogleAds.V6.Enums.NegativeGeoTargetTypeEnum.Types.NegativeGeoTargetType) input.ReadEnum(); break; } } } } #endif } /// <summary> /// Describes how unbranded pharma ads will be displayed. /// </summary> public sealed partial class VanityPharma : pb::IMessage<VanityPharma> #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { private static readonly pb::MessageParser<VanityPharma> _parser = new pb::MessageParser<VanityPharma>(() => new VanityPharma()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<VanityPharma> Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Ads.GoogleAds.V6.Resources.Campaign.Descriptor.NestedTypes[3]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public VanityPharma() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public VanityPharma(VanityPharma other) : this() { vanityPharmaDisplayUrlMode_ = other.vanityPharmaDisplayUrlMode_; vanityPharmaText_ = other.vanityPharmaText_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public VanityPharma Clone() { return new VanityPharma(this); } /// <summary>Field number for the "vanity_pharma_display_url_mode" field.</summary> public const int VanityPharmaDisplayUrlModeFieldNumber = 1; private global::Google.Ads.GoogleAds.V6.Enums.VanityPharmaDisplayUrlModeEnum.Types.VanityPharmaDisplayUrlMode vanityPharmaDisplayUrlMode_ = global::Google.Ads.GoogleAds.V6.Enums.VanityPharmaDisplayUrlModeEnum.Types.VanityPharmaDisplayUrlMode.Unspecified; /// <summary> /// The display mode for vanity pharma URLs. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Enums.VanityPharmaDisplayUrlModeEnum.Types.VanityPharmaDisplayUrlMode VanityPharmaDisplayUrlMode { get { return vanityPharmaDisplayUrlMode_; } set { vanityPharmaDisplayUrlMode_ = value; } } /// <summary>Field number for the "vanity_pharma_text" field.</summary> public const int VanityPharmaTextFieldNumber = 2; private global::Google.Ads.GoogleAds.V6.Enums.VanityPharmaTextEnum.Types.VanityPharmaText vanityPharmaText_ = global::Google.Ads.GoogleAds.V6.Enums.VanityPharmaTextEnum.Types.VanityPharmaText.Unspecified; /// <summary> /// The text that will be displayed in display URL of the text ad when /// website description is the selected display mode for vanity pharma URLs. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Enums.VanityPharmaTextEnum.Types.VanityPharmaText VanityPharmaText { get { return vanityPharmaText_; } set { vanityPharmaText_ = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as VanityPharma); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(VanityPharma other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } if (VanityPharmaDisplayUrlMode != other.VanityPharmaDisplayUrlMode) return false; if (VanityPharmaText != other.VanityPharmaText) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (VanityPharmaDisplayUrlMode != global::Google.Ads.GoogleAds.V6.Enums.VanityPharmaDisplayUrlModeEnum.Types.VanityPharmaDisplayUrlMode.Unspecified) hash ^= VanityPharmaDisplayUrlMode.GetHashCode(); if (VanityPharmaText != global::Google.Ads.GoogleAds.V6.Enums.VanityPharmaTextEnum.Types.VanityPharmaText.Unspecified) hash ^= VanityPharmaText.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return hash; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else if (VanityPharmaDisplayUrlMode != global::Google.Ads.GoogleAds.V6.Enums.VanityPharmaDisplayUrlModeEnum.Types.VanityPharmaDisplayUrlMode.Unspecified) { output.WriteRawTag(8); output.WriteEnum((int) VanityPharmaDisplayUrlMode); } if (VanityPharmaText != global::Google.Ads.GoogleAds.V6.Enums.VanityPharmaTextEnum.Types.VanityPharmaText.Unspecified) { output.WriteRawTag(16); output.WriteEnum((int) VanityPharmaText); } if (_unknownFields != null) { _unknownFields.WriteTo(output); } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { if (VanityPharmaDisplayUrlMode != global::Google.Ads.GoogleAds.V6.Enums.VanityPharmaDisplayUrlModeEnum.Types.VanityPharmaDisplayUrlMode.Unspecified) { output.WriteRawTag(8); output.WriteEnum((int) VanityPharmaDisplayUrlMode); } if (VanityPharmaText != global::Google.Ads.GoogleAds.V6.Enums.VanityPharmaTextEnum.Types.VanityPharmaText.Unspecified) { output.WriteRawTag(16); output.WriteEnum((int) VanityPharmaText); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } } #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (VanityPharmaDisplayUrlMode != global::Google.Ads.GoogleAds.V6.Enums.VanityPharmaDisplayUrlModeEnum.Types.VanityPharmaDisplayUrlMode.Unspecified) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) VanityPharmaDisplayUrlMode); } if (VanityPharmaText != global::Google.Ads.GoogleAds.V6.Enums.VanityPharmaTextEnum.Types.VanityPharmaText.Unspecified) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) VanityPharmaText); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } return size; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(VanityPharma other) { if (other == null) { return; } if (other.VanityPharmaDisplayUrlMode != global::Google.Ads.GoogleAds.V6.Enums.VanityPharmaDisplayUrlModeEnum.Types.VanityPharmaDisplayUrlMode.Unspecified) { VanityPharmaDisplayUrlMode = other.VanityPharmaDisplayUrlMode; } if (other.VanityPharmaText != global::Google.Ads.GoogleAds.V6.Enums.VanityPharmaTextEnum.Types.VanityPharmaText.Unspecified) { VanityPharmaText = other.VanityPharmaText; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE input.ReadRawMessage(this); #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { VanityPharmaDisplayUrlMode = (global::Google.Ads.GoogleAds.V6.Enums.VanityPharmaDisplayUrlModeEnum.Types.VanityPharmaDisplayUrlMode) input.ReadEnum(); break; } case 16: { VanityPharmaText = (global::Google.Ads.GoogleAds.V6.Enums.VanityPharmaTextEnum.Types.VanityPharmaText) input.ReadEnum(); break; } } } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 8: { VanityPharmaDisplayUrlMode = (global::Google.Ads.GoogleAds.V6.Enums.VanityPharmaDisplayUrlModeEnum.Types.VanityPharmaDisplayUrlMode) input.ReadEnum(); break; } case 16: { VanityPharmaText = (global::Google.Ads.GoogleAds.V6.Enums.VanityPharmaTextEnum.Types.VanityPharmaText) input.ReadEnum(); break; } } } } #endif } /// <summary> /// Optimization goal setting for this campaign, which includes a set of /// optimization goal types. /// </summary> public sealed partial class OptimizationGoalSetting : pb::IMessage<OptimizationGoalSetting> #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { private static readonly pb::MessageParser<OptimizationGoalSetting> _parser = new pb::MessageParser<OptimizationGoalSetting>(() => new OptimizationGoalSetting()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<OptimizationGoalSetting> Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Ads.GoogleAds.V6.Resources.Campaign.Descriptor.NestedTypes[4]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public OptimizationGoalSetting() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public OptimizationGoalSetting(OptimizationGoalSetting other) : this() { optimizationGoalTypes_ = other.optimizationGoalTypes_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public OptimizationGoalSetting Clone() { return new OptimizationGoalSetting(this); } /// <summary>Field number for the "optimization_goal_types" field.</summary> public const int OptimizationGoalTypesFieldNumber = 1; private static readonly pb::FieldCodec<global::Google.Ads.GoogleAds.V6.Enums.OptimizationGoalTypeEnum.Types.OptimizationGoalType> _repeated_optimizationGoalTypes_codec = pb::FieldCodec.ForEnum(10, x => (int) x, x => (global::Google.Ads.GoogleAds.V6.Enums.OptimizationGoalTypeEnum.Types.OptimizationGoalType) x); private readonly pbc::RepeatedField<global::Google.Ads.GoogleAds.V6.Enums.OptimizationGoalTypeEnum.Types.OptimizationGoalType> optimizationGoalTypes_ = new pbc::RepeatedField<global::Google.Ads.GoogleAds.V6.Enums.OptimizationGoalTypeEnum.Types.OptimizationGoalType>(); /// <summary> /// The list of optimization goal types. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField<global::Google.Ads.GoogleAds.V6.Enums.OptimizationGoalTypeEnum.Types.OptimizationGoalType> OptimizationGoalTypes { get { return optimizationGoalTypes_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as OptimizationGoalSetting); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(OptimizationGoalSetting other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } if(!optimizationGoalTypes_.Equals(other.optimizationGoalTypes_)) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= optimizationGoalTypes_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return hash; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else optimizationGoalTypes_.WriteTo(output, _repeated_optimizationGoalTypes_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { optimizationGoalTypes_.WriteTo(ref output, _repeated_optimizationGoalTypes_codec); if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } } #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += optimizationGoalTypes_.CalculateSize(_repeated_optimizationGoalTypes_codec); if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } return size; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(OptimizationGoalSetting other) { if (other == null) { return; } optimizationGoalTypes_.Add(other.optimizationGoalTypes_); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE input.ReadRawMessage(this); #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: case 8: { optimizationGoalTypes_.AddEntriesFrom(input, _repeated_optimizationGoalTypes_codec); break; } } } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: case 8: { optimizationGoalTypes_.AddEntriesFrom(ref input, _repeated_optimizationGoalTypes_codec); break; } } } } #endif } /// <summary> /// The setting for controlling Dynamic Search Ads (DSA). /// </summary> public sealed partial class DynamicSearchAdsSetting : pb::IMessage<DynamicSearchAdsSetting> #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { private static readonly pb::MessageParser<DynamicSearchAdsSetting> _parser = new pb::MessageParser<DynamicSearchAdsSetting>(() => new DynamicSearchAdsSetting()); private pb::UnknownFieldSet _unknownFields; private int _hasBits0; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<DynamicSearchAdsSetting> Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Ads.GoogleAds.V6.Resources.Campaign.Descriptor.NestedTypes[5]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public DynamicSearchAdsSetting() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public DynamicSearchAdsSetting(DynamicSearchAdsSetting other) : this() { _hasBits0 = other._hasBits0; domainName_ = other.domainName_; languageCode_ = other.languageCode_; useSuppliedUrlsOnly_ = other.useSuppliedUrlsOnly_; feeds_ = other.feeds_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public DynamicSearchAdsSetting Clone() { return new DynamicSearchAdsSetting(this); } /// <summary>Field number for the "domain_name" field.</summary> public const int DomainNameFieldNumber = 6; private string domainName_ = ""; /// <summary> /// Required. The Internet domain name that this setting represents, e.g., "google.com" /// or "www.google.com". /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string DomainName { get { return domainName_; } set { domainName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Field number for the "language_code" field.</summary> public const int LanguageCodeFieldNumber = 7; private string languageCode_ = ""; /// <summary> /// Required. The language code specifying the language of the domain, e.g., "en". /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string LanguageCode { get { return languageCode_; } set { languageCode_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Field number for the "use_supplied_urls_only" field.</summary> public const int UseSuppliedUrlsOnlyFieldNumber = 8; private bool useSuppliedUrlsOnly_; /// <summary> /// Whether the campaign uses advertiser supplied URLs exclusively. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool UseSuppliedUrlsOnly { get { if ((_hasBits0 & 1) != 0) { return useSuppliedUrlsOnly_; } else { return false; } } set { _hasBits0 |= 1; useSuppliedUrlsOnly_ = value; } } /// <summary>Gets whether the "use_supplied_urls_only" field is set</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool HasUseSuppliedUrlsOnly { get { return (_hasBits0 & 1) != 0; } } /// <summary>Clears the value of the "use_supplied_urls_only" field</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void ClearUseSuppliedUrlsOnly() { _hasBits0 &= ~1; } /// <summary>Field number for the "feeds" field.</summary> public const int FeedsFieldNumber = 9; private static readonly pb::FieldCodec<string> _repeated_feeds_codec = pb::FieldCodec.ForString(74); private readonly pbc::RepeatedField<string> feeds_ = new pbc::RepeatedField<string>(); /// <summary> /// The list of page feeds associated with the campaign. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField<string> Feeds { get { return feeds_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as DynamicSearchAdsSetting); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(DynamicSearchAdsSetting other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } if (DomainName != other.DomainName) return false; if (LanguageCode != other.LanguageCode) return false; if (UseSuppliedUrlsOnly != other.UseSuppliedUrlsOnly) return false; if(!feeds_.Equals(other.feeds_)) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (DomainName.Length != 0) hash ^= DomainName.GetHashCode(); if (LanguageCode.Length != 0) hash ^= LanguageCode.GetHashCode(); if (HasUseSuppliedUrlsOnly) hash ^= UseSuppliedUrlsOnly.GetHashCode(); hash ^= feeds_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return hash; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else if (DomainName.Length != 0) { output.WriteRawTag(50); output.WriteString(DomainName); } if (LanguageCode.Length != 0) { output.WriteRawTag(58); output.WriteString(LanguageCode); } if (HasUseSuppliedUrlsOnly) { output.WriteRawTag(64); output.WriteBool(UseSuppliedUrlsOnly); } feeds_.WriteTo(output, _repeated_feeds_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { if (DomainName.Length != 0) { output.WriteRawTag(50); output.WriteString(DomainName); } if (LanguageCode.Length != 0) { output.WriteRawTag(58); output.WriteString(LanguageCode); } if (HasUseSuppliedUrlsOnly) { output.WriteRawTag(64); output.WriteBool(UseSuppliedUrlsOnly); } feeds_.WriteTo(ref output, _repeated_feeds_codec); if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } } #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (DomainName.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(DomainName); } if (LanguageCode.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(LanguageCode); } if (HasUseSuppliedUrlsOnly) { size += 1 + 1; } size += feeds_.CalculateSize(_repeated_feeds_codec); if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } return size; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(DynamicSearchAdsSetting other) { if (other == null) { return; } if (other.DomainName.Length != 0) { DomainName = other.DomainName; } if (other.LanguageCode.Length != 0) { LanguageCode = other.LanguageCode; } if (other.HasUseSuppliedUrlsOnly) { UseSuppliedUrlsOnly = other.UseSuppliedUrlsOnly; } feeds_.Add(other.feeds_); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE input.ReadRawMessage(this); #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 50: { DomainName = input.ReadString(); break; } case 58: { LanguageCode = input.ReadString(); break; } case 64: { UseSuppliedUrlsOnly = input.ReadBool(); break; } case 74: { feeds_.AddEntriesFrom(input, _repeated_feeds_codec); break; } } } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 50: { DomainName = input.ReadString(); break; } case 58: { LanguageCode = input.ReadString(); break; } case 64: { UseSuppliedUrlsOnly = input.ReadBool(); break; } case 74: { feeds_.AddEntriesFrom(ref input, _repeated_feeds_codec); break; } } } } #endif } /// <summary> /// The setting for Shopping campaigns. Defines the universe of products that /// can be advertised by the campaign, and how this campaign interacts with /// other Shopping campaigns. /// </summary> public sealed partial class ShoppingSetting : pb::IMessage<ShoppingSetting> #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { private static readonly pb::MessageParser<ShoppingSetting> _parser = new pb::MessageParser<ShoppingSetting>(() => new ShoppingSetting()); private pb::UnknownFieldSet _unknownFields; private int _hasBits0; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<ShoppingSetting> Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Ads.GoogleAds.V6.Resources.Campaign.Descriptor.NestedTypes[6]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ShoppingSetting() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ShoppingSetting(ShoppingSetting other) : this() { _hasBits0 = other._hasBits0; merchantId_ = other.merchantId_; salesCountry_ = other.salesCountry_; campaignPriority_ = other.campaignPriority_; enableLocal_ = other.enableLocal_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ShoppingSetting Clone() { return new ShoppingSetting(this); } /// <summary>Field number for the "merchant_id" field.</summary> public const int MerchantIdFieldNumber = 5; private long merchantId_; /// <summary> /// Immutable. ID of the Merchant Center account. /// This field is required for create operations. This field is immutable for /// Shopping campaigns. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public long MerchantId { get { if ((_hasBits0 & 1) != 0) { return merchantId_; } else { return 0L; } } set { _hasBits0 |= 1; merchantId_ = value; } } /// <summary>Gets whether the "merchant_id" field is set</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool HasMerchantId { get { return (_hasBits0 & 1) != 0; } } /// <summary>Clears the value of the "merchant_id" field</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void ClearMerchantId() { _hasBits0 &= ~1; } /// <summary>Field number for the "sales_country" field.</summary> public const int SalesCountryFieldNumber = 6; private string salesCountry_; /// <summary> /// Immutable. Sales country of products to include in the campaign. /// This field is required for Shopping campaigns. This field is immutable. /// This field is optional for non-Shopping campaigns, but it must be equal /// to 'ZZ' if set. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string SalesCountry { get { return salesCountry_ ?? ""; } set { salesCountry_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Gets whether the "sales_country" field is set</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool HasSalesCountry { get { return salesCountry_ != null; } } /// <summary>Clears the value of the "sales_country" field</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void ClearSalesCountry() { salesCountry_ = null; } /// <summary>Field number for the "campaign_priority" field.</summary> public const int CampaignPriorityFieldNumber = 7; private int campaignPriority_; /// <summary> /// Priority of the campaign. Campaigns with numerically higher priorities /// take precedence over those with lower priorities. /// This field is required for Shopping campaigns, with values between 0 and /// 2, inclusive. /// This field is optional for Smart Shopping campaigns, but must be equal to /// 3 if set. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CampaignPriority { get { if ((_hasBits0 & 2) != 0) { return campaignPriority_; } else { return 0; } } set { _hasBits0 |= 2; campaignPriority_ = value; } } /// <summary>Gets whether the "campaign_priority" field is set</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool HasCampaignPriority { get { return (_hasBits0 & 2) != 0; } } /// <summary>Clears the value of the "campaign_priority" field</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void ClearCampaignPriority() { _hasBits0 &= ~2; } /// <summary>Field number for the "enable_local" field.</summary> public const int EnableLocalFieldNumber = 8; private bool enableLocal_; /// <summary> /// Whether to include local products. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool EnableLocal { get { if ((_hasBits0 & 4) != 0) { return enableLocal_; } else { return false; } } set { _hasBits0 |= 4; enableLocal_ = value; } } /// <summary>Gets whether the "enable_local" field is set</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool HasEnableLocal { get { return (_hasBits0 & 4) != 0; } } /// <summary>Clears the value of the "enable_local" field</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void ClearEnableLocal() { _hasBits0 &= ~4; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as ShoppingSetting); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(ShoppingSetting other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } if (MerchantId != other.MerchantId) return false; if (SalesCountry != other.SalesCountry) return false; if (CampaignPriority != other.CampaignPriority) return false; if (EnableLocal != other.EnableLocal) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (HasMerchantId) hash ^= MerchantId.GetHashCode(); if (HasSalesCountry) hash ^= SalesCountry.GetHashCode(); if (HasCampaignPriority) hash ^= CampaignPriority.GetHashCode(); if (HasEnableLocal) hash ^= EnableLocal.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return hash; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else if (HasMerchantId) { output.WriteRawTag(40); output.WriteInt64(MerchantId); } if (HasSalesCountry) { output.WriteRawTag(50); output.WriteString(SalesCountry); } if (HasCampaignPriority) { output.WriteRawTag(56); output.WriteInt32(CampaignPriority); } if (HasEnableLocal) { output.WriteRawTag(64); output.WriteBool(EnableLocal); } if (_unknownFields != null) { _unknownFields.WriteTo(output); } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { if (HasMerchantId) { output.WriteRawTag(40); output.WriteInt64(MerchantId); } if (HasSalesCountry) { output.WriteRawTag(50); output.WriteString(SalesCountry); } if (HasCampaignPriority) { output.WriteRawTag(56); output.WriteInt32(CampaignPriority); } if (HasEnableLocal) { output.WriteRawTag(64); output.WriteBool(EnableLocal); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } } #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (HasMerchantId) { size += 1 + pb::CodedOutputStream.ComputeInt64Size(MerchantId); } if (HasSalesCountry) { size += 1 + pb::CodedOutputStream.ComputeStringSize(SalesCountry); } if (HasCampaignPriority) { size += 1 + pb::CodedOutputStream.ComputeInt32Size(CampaignPriority); } if (HasEnableLocal) { size += 1 + 1; } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } return size; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(ShoppingSetting other) { if (other == null) { return; } if (other.HasMerchantId) { MerchantId = other.MerchantId; } if (other.HasSalesCountry) { SalesCountry = other.SalesCountry; } if (other.HasCampaignPriority) { CampaignPriority = other.CampaignPriority; } if (other.HasEnableLocal) { EnableLocal = other.EnableLocal; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE input.ReadRawMessage(this); #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 40: { MerchantId = input.ReadInt64(); break; } case 50: { SalesCountry = input.ReadString(); break; } case 56: { CampaignPriority = input.ReadInt32(); break; } case 64: { EnableLocal = input.ReadBool(); break; } } } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 40: { MerchantId = input.ReadInt64(); break; } case 50: { SalesCountry = input.ReadString(); break; } case 56: { CampaignPriority = input.ReadInt32(); break; } case 64: { EnableLocal = input.ReadBool(); break; } } } } #endif } /// <summary> /// Selective optimization setting for this campaign, which includes a set of /// conversion actions to optimize this campaign towards. /// </summary> public sealed partial class SelectiveOptimization : pb::IMessage<SelectiveOptimization> #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { private static readonly pb::MessageParser<SelectiveOptimization> _parser = new pb::MessageParser<SelectiveOptimization>(() => new SelectiveOptimization()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<SelectiveOptimization> Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Ads.GoogleAds.V6.Resources.Campaign.Descriptor.NestedTypes[7]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public SelectiveOptimization() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public SelectiveOptimization(SelectiveOptimization other) : this() { conversionActions_ = other.conversionActions_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public SelectiveOptimization Clone() { return new SelectiveOptimization(this); } /// <summary>Field number for the "conversion_actions" field.</summary> public const int ConversionActionsFieldNumber = 2; private static readonly pb::FieldCodec<string> _repeated_conversionActions_codec = pb::FieldCodec.ForString(18); private readonly pbc::RepeatedField<string> conversionActions_ = new pbc::RepeatedField<string>(); /// <summary> /// The selected set of conversion actions for optimizing this campaign. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField<string> ConversionActions { get { return conversionActions_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as SelectiveOptimization); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(SelectiveOptimization other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } if(!conversionActions_.Equals(other.conversionActions_)) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= conversionActions_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return hash; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else conversionActions_.WriteTo(output, _repeated_conversionActions_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { conversionActions_.WriteTo(ref output, _repeated_conversionActions_codec); if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } } #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += conversionActions_.CalculateSize(_repeated_conversionActions_codec); if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } return size; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(SelectiveOptimization other) { if (other == null) { return; } conversionActions_.Add(other.conversionActions_); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE input.ReadRawMessage(this); #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 18: { conversionActions_.AddEntriesFrom(input, _repeated_conversionActions_codec); break; } } } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 18: { conversionActions_.AddEntriesFrom(ref input, _repeated_conversionActions_codec); break; } } } } #endif } /// <summary> /// Campaign-level settings for App Campaigns. /// </summary> public sealed partial class AppCampaignSetting : pb::IMessage<AppCampaignSetting> #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { private static readonly pb::MessageParser<AppCampaignSetting> _parser = new pb::MessageParser<AppCampaignSetting>(() => new AppCampaignSetting()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<AppCampaignSetting> Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Ads.GoogleAds.V6.Resources.Campaign.Descriptor.NestedTypes[8]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public AppCampaignSetting() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public AppCampaignSetting(AppCampaignSetting other) : this() { biddingStrategyGoalType_ = other.biddingStrategyGoalType_; appId_ = other.appId_; appStore_ = other.appStore_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public AppCampaignSetting Clone() { return new AppCampaignSetting(this); } /// <summary>Field number for the "bidding_strategy_goal_type" field.</summary> public const int BiddingStrategyGoalTypeFieldNumber = 1; private global::Google.Ads.GoogleAds.V6.Enums.AppCampaignBiddingStrategyGoalTypeEnum.Types.AppCampaignBiddingStrategyGoalType biddingStrategyGoalType_ = global::Google.Ads.GoogleAds.V6.Enums.AppCampaignBiddingStrategyGoalTypeEnum.Types.AppCampaignBiddingStrategyGoalType.Unspecified; /// <summary> /// Represents the goal which the bidding strategy of this app campaign /// should optimize towards. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Enums.AppCampaignBiddingStrategyGoalTypeEnum.Types.AppCampaignBiddingStrategyGoalType BiddingStrategyGoalType { get { return biddingStrategyGoalType_; } set { biddingStrategyGoalType_ = value; } } /// <summary>Field number for the "app_id" field.</summary> public const int AppIdFieldNumber = 4; private string appId_; /// <summary> /// Immutable. A string that uniquely identifies a mobile application. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string AppId { get { return appId_ ?? ""; } set { appId_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Gets whether the "app_id" field is set</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool HasAppId { get { return appId_ != null; } } /// <summary>Clears the value of the "app_id" field</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void ClearAppId() { appId_ = null; } /// <summary>Field number for the "app_store" field.</summary> public const int AppStoreFieldNumber = 3; private global::Google.Ads.GoogleAds.V6.Enums.AppCampaignAppStoreEnum.Types.AppCampaignAppStore appStore_ = global::Google.Ads.GoogleAds.V6.Enums.AppCampaignAppStoreEnum.Types.AppCampaignAppStore.Unspecified; /// <summary> /// Immutable. The application store that distributes this specific app. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Enums.AppCampaignAppStoreEnum.Types.AppCampaignAppStore AppStore { get { return appStore_; } set { appStore_ = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as AppCampaignSetting); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(AppCampaignSetting other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } if (BiddingStrategyGoalType != other.BiddingStrategyGoalType) return false; if (AppId != other.AppId) return false; if (AppStore != other.AppStore) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (BiddingStrategyGoalType != global::Google.Ads.GoogleAds.V6.Enums.AppCampaignBiddingStrategyGoalTypeEnum.Types.AppCampaignBiddingStrategyGoalType.Unspecified) hash ^= BiddingStrategyGoalType.GetHashCode(); if (HasAppId) hash ^= AppId.GetHashCode(); if (AppStore != global::Google.Ads.GoogleAds.V6.Enums.AppCampaignAppStoreEnum.Types.AppCampaignAppStore.Unspecified) hash ^= AppStore.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return hash; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else if (BiddingStrategyGoalType != global::Google.Ads.GoogleAds.V6.Enums.AppCampaignBiddingStrategyGoalTypeEnum.Types.AppCampaignBiddingStrategyGoalType.Unspecified) { output.WriteRawTag(8); output.WriteEnum((int) BiddingStrategyGoalType); } if (AppStore != global::Google.Ads.GoogleAds.V6.Enums.AppCampaignAppStoreEnum.Types.AppCampaignAppStore.Unspecified) { output.WriteRawTag(24); output.WriteEnum((int) AppStore); } if (HasAppId) { output.WriteRawTag(34); output.WriteString(AppId); } if (_unknownFields != null) { _unknownFields.WriteTo(output); } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { if (BiddingStrategyGoalType != global::Google.Ads.GoogleAds.V6.Enums.AppCampaignBiddingStrategyGoalTypeEnum.Types.AppCampaignBiddingStrategyGoalType.Unspecified) { output.WriteRawTag(8); output.WriteEnum((int) BiddingStrategyGoalType); } if (AppStore != global::Google.Ads.GoogleAds.V6.Enums.AppCampaignAppStoreEnum.Types.AppCampaignAppStore.Unspecified) { output.WriteRawTag(24); output.WriteEnum((int) AppStore); } if (HasAppId) { output.WriteRawTag(34); output.WriteString(AppId); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } } #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (BiddingStrategyGoalType != global::Google.Ads.GoogleAds.V6.Enums.AppCampaignBiddingStrategyGoalTypeEnum.Types.AppCampaignBiddingStrategyGoalType.Unspecified) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) BiddingStrategyGoalType); } if (HasAppId) { size += 1 + pb::CodedOutputStream.ComputeStringSize(AppId); } if (AppStore != global::Google.Ads.GoogleAds.V6.Enums.AppCampaignAppStoreEnum.Types.AppCampaignAppStore.Unspecified) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) AppStore); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } return size; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(AppCampaignSetting other) { if (other == null) { return; } if (other.BiddingStrategyGoalType != global::Google.Ads.GoogleAds.V6.Enums.AppCampaignBiddingStrategyGoalTypeEnum.Types.AppCampaignBiddingStrategyGoalType.Unspecified) { BiddingStrategyGoalType = other.BiddingStrategyGoalType; } if (other.HasAppId) { AppId = other.AppId; } if (other.AppStore != global::Google.Ads.GoogleAds.V6.Enums.AppCampaignAppStoreEnum.Types.AppCampaignAppStore.Unspecified) { AppStore = other.AppStore; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE input.ReadRawMessage(this); #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { BiddingStrategyGoalType = (global::Google.Ads.GoogleAds.V6.Enums.AppCampaignBiddingStrategyGoalTypeEnum.Types.AppCampaignBiddingStrategyGoalType) input.ReadEnum(); break; } case 24: { AppStore = (global::Google.Ads.GoogleAds.V6.Enums.AppCampaignAppStoreEnum.Types.AppCampaignAppStore) input.ReadEnum(); break; } case 34: { AppId = input.ReadString(); break; } } } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 8: { BiddingStrategyGoalType = (global::Google.Ads.GoogleAds.V6.Enums.AppCampaignBiddingStrategyGoalTypeEnum.Types.AppCampaignBiddingStrategyGoalType) input.ReadEnum(); break; } case 24: { AppStore = (global::Google.Ads.GoogleAds.V6.Enums.AppCampaignAppStoreEnum.Types.AppCampaignAppStore) input.ReadEnum(); break; } case 34: { AppId = input.ReadString(); break; } } } } #endif } /// <summary> /// Campaign-level settings for tracking information. /// </summary> public sealed partial class TrackingSetting : pb::IMessage<TrackingSetting> #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { private static readonly pb::MessageParser<TrackingSetting> _parser = new pb::MessageParser<TrackingSetting>(() => new TrackingSetting()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<TrackingSetting> Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Ads.GoogleAds.V6.Resources.Campaign.Descriptor.NestedTypes[9]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TrackingSetting() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TrackingSetting(TrackingSetting other) : this() { trackingUrl_ = other.trackingUrl_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TrackingSetting Clone() { return new TrackingSetting(this); } /// <summary>Field number for the "tracking_url" field.</summary> public const int TrackingUrlFieldNumber = 2; private string trackingUrl_; /// <summary> /// Output only. The url used for dynamic tracking. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string TrackingUrl { get { return trackingUrl_ ?? ""; } set { trackingUrl_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Gets whether the "tracking_url" field is set</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool HasTrackingUrl { get { return trackingUrl_ != null; } } /// <summary>Clears the value of the "tracking_url" field</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void ClearTrackingUrl() { trackingUrl_ = null; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as TrackingSetting); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(TrackingSetting other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } if (TrackingUrl != other.TrackingUrl) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (HasTrackingUrl) hash ^= TrackingUrl.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return hash; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else if (HasTrackingUrl) { output.WriteRawTag(18); output.WriteString(TrackingUrl); } if (_unknownFields != null) { _unknownFields.WriteTo(output); } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { if (HasTrackingUrl) { output.WriteRawTag(18); output.WriteString(TrackingUrl); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } } #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (HasTrackingUrl) { size += 1 + pb::CodedOutputStream.ComputeStringSize(TrackingUrl); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } return size; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(TrackingSetting other) { if (other == null) { return; } if (other.HasTrackingUrl) { TrackingUrl = other.TrackingUrl; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE input.ReadRawMessage(this); #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 18: { TrackingUrl = input.ReadString(); break; } } } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 18: { TrackingUrl = input.ReadString(); break; } } } } #endif } /// <summary> /// Campaign setting for local campaigns. /// </summary> public sealed partial class LocalCampaignSetting : pb::IMessage<LocalCampaignSetting> #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { private static readonly pb::MessageParser<LocalCampaignSetting> _parser = new pb::MessageParser<LocalCampaignSetting>(() => new LocalCampaignSetting()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<LocalCampaignSetting> Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Ads.GoogleAds.V6.Resources.Campaign.Descriptor.NestedTypes[10]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public LocalCampaignSetting() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public LocalCampaignSetting(LocalCampaignSetting other) : this() { locationSourceType_ = other.locationSourceType_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public LocalCampaignSetting Clone() { return new LocalCampaignSetting(this); } /// <summary>Field number for the "location_source_type" field.</summary> public const int LocationSourceTypeFieldNumber = 1; private global::Google.Ads.GoogleAds.V6.Enums.LocationSourceTypeEnum.Types.LocationSourceType locationSourceType_ = global::Google.Ads.GoogleAds.V6.Enums.LocationSourceTypeEnum.Types.LocationSourceType.Unspecified; /// <summary> /// The location source type for this local campaign. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Ads.GoogleAds.V6.Enums.LocationSourceTypeEnum.Types.LocationSourceType LocationSourceType { get { return locationSourceType_; } set { locationSourceType_ = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as LocalCampaignSetting); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(LocalCampaignSetting other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } if (LocationSourceType != other.LocationSourceType) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (LocationSourceType != global::Google.Ads.GoogleAds.V6.Enums.LocationSourceTypeEnum.Types.LocationSourceType.Unspecified) hash ^= LocationSourceType.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return hash; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else if (LocationSourceType != global::Google.Ads.GoogleAds.V6.Enums.LocationSourceTypeEnum.Types.LocationSourceType.Unspecified) { output.WriteRawTag(8); output.WriteEnum((int) LocationSourceType); } if (_unknownFields != null) { _unknownFields.WriteTo(output); } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { if (LocationSourceType != global::Google.Ads.GoogleAds.V6.Enums.LocationSourceTypeEnum.Types.LocationSourceType.Unspecified) { output.WriteRawTag(8); output.WriteEnum((int) LocationSourceType); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } } #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (LocationSourceType != global::Google.Ads.GoogleAds.V6.Enums.LocationSourceTypeEnum.Types.LocationSourceType.Unspecified) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) LocationSourceType); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } return size; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(LocalCampaignSetting other) { if (other == null) { return; } if (other.LocationSourceType != global::Google.Ads.GoogleAds.V6.Enums.LocationSourceTypeEnum.Types.LocationSourceType.Unspecified) { LocationSourceType = other.LocationSourceType; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE input.ReadRawMessage(this); #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { LocationSourceType = (global::Google.Ads.GoogleAds.V6.Enums.LocationSourceTypeEnum.Types.LocationSourceType) input.ReadEnum(); break; } } } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 8: { LocationSourceType = (global::Google.Ads.GoogleAds.V6.Enums.LocationSourceTypeEnum.Types.LocationSourceType) input.ReadEnum(); break; } } } } #endif } } #endregion } #endregion } #endregion Designer generated code
45.2645
1,975
0.66217
[ "Apache-2.0" ]
PierrickVoulet/google-ads-dotnet
src/V6/Types/Campaign.cs
239,585
C#
namespace System.IO.BACnet { public enum BacnetBvlcFunctions : byte { BVLC_RESULT = 0, BVLC_WRITE_BROADCAST_DISTRIBUTION_TABLE = 1, BVLC_READ_BROADCAST_DIST_TABLE = 2, BVLC_READ_BROADCAST_DIST_TABLE_ACK = 3, BVLC_FORWARDED_NPDU = 4, BVLC_REGISTER_FOREIGN_DEVICE = 5, BVLC_READ_FOREIGN_DEVICE_TABLE = 6, BVLC_READ_FOREIGN_DEVICE_TABLE_ACK = 7, BVLC_DELETE_FOREIGN_DEVICE_TABLE_ENTRY = 8, BVLC_DISTRIBUTE_BROADCAST_TO_NETWORK = 9, BVLC_ORIGINAL_UNICAST_NPDU = 10, BVLC_ORIGINAL_BROADCAST_NPDU = 11, MAX_BVLC_FUNCTION = 12 } }
29.105263
46
0.799277
[ "MIT" ]
vberkaltun/BACnet
Base/BacnetBvlcFunctions.cs
555
C#
using Apollo.AdminStore.WebForm.Classes; using Apollo.Core.Domain; using Apollo.Core.Domain.Shipping; using Apollo.Core.Domain.Tax; using Apollo.Core.Model; using Apollo.Core.Model.OverviewModel; using Apollo.Core.Services.Interfaces; using System; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace Apollo.AdminStore.WebForm.FulFillment { public partial class order_packing_info : BasePage, ICallbackEventHandler { private const int SHOW_MAX_COMMENT = 8; public IAccountService AccountService { get; set; } public IOrderService OrderService { get; set; } public IShippingService ShippingService { get; set; } public AdminStoreUtility AdminStoreUtility { get; set; } public ShippingSettings ShippingSettings { get; set; } public TaxSettings TaxSettings { get; set; } public StoreInformationSettings StoreInformationSettings { get; set; } protected override void OnInit(EventArgs e) { int orderId = QueryOrderId; var order = OrderService.GetOrderOverviewModelById(orderId); if (order != null) ltlTitle.Text = string.Format("<h3 class='printHide'>Order # {0}</h3>", order.Id.ToString()); else Response.Redirect("/fulfillment/order_fulfillment.aspx?" + QueryKey.MSG_TYPE + "=" + (int)MessageType.OrderNotFound); base.OnInit(e); } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { var orderView = OrderService.GetOrderOverviewModelById(QueryOrderId); if (orderView != null) { bool charged = OrderService.HasFullyPaid(orderView.Id); LoadInfo(charged); } else Response.Redirect("/fulfillment/order_fulfillment.aspx?" + QueryKey.MSG_TYPE + "=" + (int)MessageType.OrderNotFound); } ClientScriptManager cm = Page.ClientScript; string cbReference = cm.GetCallbackEventReference(this, "arg", "receiveAlert", string.Empty); string callbackScript = "function checkAlert(arg, context) {" + cbReference + "; }"; cm.RegisterClientScriptBlock(this.GetType(), "checkAlert", callbackScript, true); } protected void ddlIssue_Init(object sender, EventArgs e) { ddlIssue.DataSource = OrderService.GetOrderIssueList(); ddlIssue.DataBind(); } /// <summary> /// The link button will only be enabled if order has already been charged. /// </summary> protected void lbSubmit_Click(object sender, EventArgs e) { OrderService.ProcessOrderShipment( QueryOrderId, Convert.ToInt32(HttpContext.Current.Profile.GetPropertyValue("ProfileId")), Convert.ToString(HttpContext.Current.Profile.GetPropertyValue("FullName")), esnShipping.Carrier, esnShipping.TrackingNumber, esnShipping.NotificationEmail); esnShipping.Clear(); // Display message after process enbInfo.Message = "Order was shipped successfully."; LoadInfo(true); } protected void lbGo_Click(object sender, EventArgs e) { Response.Redirect("/fulfillment/order_packing_info.aspx?orderid=" + txtGoOrderId.Text.Trim()); } protected void lbSubmitComment_Click(object sender, EventArgs e) { int orderId = QueryOrderId; string orderStatus = OrderService.GetOrderStatusCodeByOrderId(orderId); string issue = string.Empty; if (ddlOrderStatus.SelectedIndex > 0) { string code = ddlOrderStatus.SelectedValue; orderStatus = OrderService.GetOrderStatusByCode(code); OrderService.UpdateOrderStatusCodeByOrderId(orderId, code); } if (ddlIssue.SelectedIndex > 0) { issue = ", " + ddlIssue.SelectedItem.Text; OrderService.UpdateOrderIssueCodeByOrderId(orderId, ddlIssue.SelectedValue); } else OrderService.UpdateOrderIssueCodeByOrderId(orderId, ddlIssue.SelectedValue); OrderService.ProcessOrderCommentInsertion(orderId, Convert.ToInt32(HttpContext.Current.Profile.GetPropertyValue("ProfileId")), Convert.ToString(HttpContext.Current.Profile.GetPropertyValue("FullName")), orderStatus + issue, string.Empty, txtComment.Text.Trim()); OrderService.UpdateOrderLastActivityDateByOrderId(orderId, DateTime.Now); txtComment.Text = string.Empty; // Display message enbInfo.Message = "Order status / issue / comment was updated successfully."; LoadInfo(true); } protected void ProcessPayment(object sender, EventArgs e) { int orderId = QueryOrderId; int profileId = Convert.ToInt32(HttpContext.Current.Profile.GetPropertyValue("ProfileId")); string fullName = Convert.ToString(HttpContext.Current.Profile.GetPropertyValue("FullName")); var message = OrderService.ProcessPaymentForFulfillment(orderId, profileId, fullName); bool isCharged; if (string.IsNullOrEmpty(message)) { enbInfo.Message = "Order was charged successfully."; isCharged = true; } else { enbInfo.Message = "Order was FAILED to charge. " + message; isCharged = false; } LoadInfo(isCharged); } protected bool HasMoreComments() { var comments = OrderService.GetOrderCommentOverviewModelListByOrderId(QueryOrderId, AppConstant.SHOW_MAX_COMMENT + 1); return AppConstant.SHOW_MAX_COMMENT < comments.Count; } protected string CheckIfDifferentFromRRP(string currencyCode, decimal exchangeRate, decimal rrp, decimal priceInclTax) { if (rrp > 0M && rrp != priceInclTax) return string.Format("was {0}, now {1}", AdminStoreUtility.GetFormattedPrice(rrp, currencyCode, CurrencyType.HtmlEntity, exchangeRate), AdminStoreUtility.GetFormattedPrice(priceInclTax, currencyCode, CurrencyType.HtmlEntity, exchangeRate)); return string.Empty; } private void LoadInfo(bool charged) { int orderId = QueryOrderId; var shippingAddress = OrderService.GetShippingAddressViewModelByOrderId(orderId); ltlHeaderAddress.Text = "Ship To:" + HtmlElement.BR; if (string.IsNullOrEmpty(shippingAddress.Name) == false) ltlHeaderAddress.Text += shippingAddress.Name + HtmlElement.BR; if (string.IsNullOrEmpty(shippingAddress.AddressLine1) == false) ltlHeaderAddress.Text += shippingAddress.AddressLine1 + HtmlElement.BR; if (string.IsNullOrEmpty(shippingAddress.AddressLine2) == false) ltlHeaderAddress.Text += shippingAddress.AddressLine2 + HtmlElement.BR; if (string.IsNullOrEmpty(shippingAddress.City) == false) ltlHeaderAddress.Text += shippingAddress.City + HtmlElement.BR; if (string.IsNullOrEmpty(shippingAddress.PostCode) == false) ltlHeaderAddress.Text += shippingAddress.PostCode + HtmlElement.BR; if (string.IsNullOrEmpty(shippingAddress.USStateName) == false) ltlHeaderAddress.Text += shippingAddress.USStateName + HtmlElement.BR; if (string.IsNullOrEmpty(shippingAddress.CountryName) == false) ltlHeaderAddress.Text += shippingAddress.CountryName + HtmlElement.BR; ltlDeliveryAddr.Text = ltlHeaderAddress.Text; eohHeader.OrderId = orderId; eavShipping.OrderId = orderId; var orderView = OrderService.GetOrderOverviewModelById(orderId); esnShipping.OrderOverviewModel = orderView; // Exclude anonymous order if (orderView.ProfileId > 0) { var account = AccountService.GetAccountByProfileId(orderView.ProfileId); if (account != null) { eavShipping.Email = string.IsNullOrEmpty(account.Email) ? string.Empty : account.Email; eavShipping.Phone = string.IsNullOrEmpty(account.ContactNumber) ? string.Empty : account.ContactNumber; eavShipping.DisplayPhone = account.DisplayContactNumberInDespatch; ltContactNumber.Text = string.Empty; if (account.DisplayContactNumberInDespatch) ltContactNumber.Text = string.Format("<i class='fa fa-phone' aria-hidden='true'></i> {0}", account.ContactNumber); } } if (orderView.PointValue > 0) { phEarnPoint.Visible = true; ltlPointValue.Text = orderView.PointValue.ToString(); } else phEarnPoint.Visible = false; var items = OrderService.GetLineItemOverviewModelListByOrderId(orderId); rptItems.DataSource = items; rptItems.DataBind(); rptDnoteItems.DataSource = items; rptDnoteItems.DataBind(); rptComments.DataSource = OrderService.GetOrderCommentOverviewModelListByOrderId(orderId, AppConstant.SHOW_MAX_COMMENT); rptComments.DataBind(); if (orderView.StatusCode == OrderStatusCode.SHIPPING || orderView.StatusCode == OrderStatusCode.INVOICED || orderView.StatusCode == OrderStatusCode.CANCELLED || orderView.StatusCode == OrderStatusCode.DISCARDED || orderView.StatusCode == OrderStatusCode.PENDING || orderView.StatusCode == OrderStatusCode.SCHEDULED_FOR_CANCEL || orderView.StatusCode == OrderStatusCode.STOCK_WARNING) { phItems.Visible = false; esnShipping.Visible = false; } else { phItems.Visible = true; esnShipping.Visible = true; } var GAItems = items.Where(i => i.StatusCode == LineStatusCode.GOODS_ALLOCATED).ToList(); int weight = 0; decimal netValue = 0M; int quantityGA = GAItems.Select(i => i.Quantity).Sum(); int quantityOrder = items.Select(i => i.Quantity).Sum(); GAItems.ForEach(delegate (LineItemOverviewModel item) { weight += item.Weight * item.Quantity; netValue += (item.PriceExclTax * item.Quantity); }); // Discount only if quantities match if (quantityOrder == quantityGA) { decimal result = netValue - orderView.DiscountValue; if (result > 0M) netValue = result; } ltlWeightGrams.Text = "<input id=\"cn22Weight\" class=\"form-control\" type=\"text\" value=\"" + weight + "\" onkeyup=\"getWeightInput(event)\" />"; ltlNetValue.Text = "<input id=\"cn22Value\" class=\"form-control\" type=\"text\" value=\"" + orderView.CurrencyCode + " " + AdminStoreUtility.RoundPrice(netValue) + "\" onkeyup=\"getValueInput(event)\" />"; if (GAItems.Count == 0) { lbSubmitTop.Visible = false; lbSubmitBottom.Visible = false; } if (charged) { lbProcessPaymentTop.Visible = false; phAfterPaymentTop.Visible = true; lbProcessPaymentBottom.Visible = false; phAfterPaymentBottom.Visible = true; } else { lbProcessPaymentTop.Visible = true; phAfterPaymentTop.Visible = false; lbProcessPaymentBottom.Visible = true; phAfterPaymentBottom.Visible = false; enbInfo.Message = "This order was not fully paid. Please process payment first before proceed to packing."; } // Shipping Option ID // Next Day Shipping Option ID = 2 // Local Standard Shipping Option ID = 1 if (shippingAddress.CountryId == ShippingSettings.PrimaryStoreCountryId) { ltlFirstClass.Text = "<input type=\"radio\" name=\"stampType\" value=\"firstClass\" checked=\"checked\" /> 1st class"; ltlInternational.Text = "<input type=\"radio\" name=\"stampType\" value=\"international\" /> International"; } else { ltlFirstClass.Text = "<input type=\"radio\" name=\"stampType\" value=\"firstClass\" /> 1st class"; ltlInternational.Text = "<input type=\"radio\" name=\"stampType\" value=\"international\" checked=\"checked\" /> International"; } ltlCN22Date.Text = DateTime.Now.ToString(AppConstant.DATE_FORM1); ltlSignature.Text = "<img src=\"/img/diana-sig.jpg\" alt=\"diana\" width=\"50\" />"; // Default var country = ShippingService.GetCountryById(shippingAddress.CountryId); ltlDeminimis.Text = country.DeminimisValue; ltOrderNumber.Text = string.Format("Order # {0}", orderId); ltOrderNumberReturn.Text = ltOrderNumber.Text; int profileId = Convert.ToInt32(HttpContext.Current.Profile.GetPropertyValue("ProfileId")); string email = AccountService.GetEmailByProfileId(profileId); if (email.ToLower() == "[email protected]") { ltlSignature.Text = "<img src=\"/img/flory-sig.jpg\" alt=\"flory\" width=\"50\" />"; } } #region ICallbackEventHandler Members private string _alert = string.Empty; string ICallbackEventHandler.GetCallbackResult() { return _alert; } void ICallbackEventHandler.RaiseCallbackEvent(string eventArgument) { int count = 0; count = OrderService.GetOrderCountForSpecialDelivery(); if (count > 0) _alert = "Alert! Next day delivery order received."; else _alert = string.Empty; } #endregion } }
42.682857
218
0.592342
[ "MIT" ]
hancheester/apollo
Store Admin/Apollo.AdminStore.WebForm/Fulfillment/order_packing_info.aspx.cs
14,941
C#
using UnityEngine; using System.Collections; public class GameManager : MonoBehaviour { public static GameManager instance = null; //Awake is always called before any Start functions void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } } public GameObject startNode; public GameObject goalNode; public string nextLevel; private GameObject currentNode; private bool pendingIteration; private bool finishLevel; private bool resetedLevel; void Start() { currentNode = startNode; CharacterManager.instance.setCharacterPosition(currentNode.transform.parent); pendingIteration = false; finishLevel = false; resetedLevel = false; } //Update is called every frame. void Update() { if (finishLevel && allEntititesReady()) { SceneLoader.instance.loadScene(nextLevel); } if (resetedLevel && allEntititesReady()) { SceneLoader.instance.reloadScene(); } if (pendingIteration && allEntititesReady()) { iterateScenario(); pendingIteration = false; } } public void handleAction(Action action) { if (allEntititesReady()) { action.execute(); pendingIteration = action.triggersIteration(); } } public GameObject getCurrentNode() { return currentNode; } public void setCurrentNode(GameObject currentNode) { this.currentNode = currentNode; finishLevel = currentNode == goalNode; if (finishLevel) { SoundManager.instance.playVictoryMusic(); CharacterManager.instance.celebrateVictory(); } } public void enterPipe() { SpecialBlockManager.instance.enterPipe(currentNode); } public void resetLevel() { resetedLevel = true; } private bool allEntititesReady() { return CharacterManager.instance.ready() && SoundManager.instance.ready() && Fire.instance.ready() && SpecialBlockManager.instance.allSpecialBlocksReady() && EnemyManager.instance.allEnemiesReady() && ScenarioManager.instance.ready(); } private void iterateScenario() { ScenarioManager.instance.moveAllBlocks(); EnemyManager.instance.moveEnemies(); } }
23.961905
242
0.607711
[ "MIT" ]
codingwatching/SuperMarioGo
src/Assets/scripts/game/GameManager.cs
2,518
C#
using System; namespace DotNext { using Buffers; /// <summary> /// Represents various extension methods for type <see cref="string"/>. /// </summary> public static class StringExtensions { /// <summary> /// Returns alternative string if first string argument /// is <see langword="null"/> or empty. /// </summary> /// <example> /// This method is equivalent to /// <code> /// var result = string.IsNullOrEmpty(str) ? alt : str; /// </code> /// </example> /// <param name="str">A string to check.</param> /// <param name="alt">Alternative string to be returned if original string is <see langword="null"/> or empty.</param> /// <returns>Original or alternative string.</returns> public static string IfNullOrEmpty(this string str, string alt) => string.IsNullOrEmpty(str) ? alt : str; /// <summary> /// Reverse string characters. /// </summary> /// <param name="str">The string to reverse.</param> /// <returns>The string in inverse order of characters.</returns> public static unsafe string Reverse(this string str) { if (str.Length == 0) return str; var result = str.Length < 1024 ? stackalloc char[str.Length] : new Span<char>(new char[str.Length]); str.AsSpan().CopyTo(result); result.Reverse(); fixed (char* ptr = result) return new string(ptr, 0, result.Length); } /// <summary> /// Compares two string using <see cref="StringComparison.OrdinalIgnoreCase" />. /// </summary> /// <param name="strA">String A. Can be <see langword="null"/>.</param> /// <param name="strB">String B. Can be <see langword="null"/>.</param> /// <returns><see langword="true"/>, if the first string is equal to the second string; otherwise, <see langword="false"/>.</returns> public static bool IsEqualIgnoreCase(this string strA, string strB) => string.Compare(strA, strB, StringComparison.OrdinalIgnoreCase) == 0; /// <summary> /// Trims the source string to specified length if it exceeds it. /// If source string is less that <paramref name="maxLength" /> then the source string returned. /// </summary> /// <param name="str">Source string.</param> /// <param name="maxLength">Maximum length.</param> /// <returns>Trimmed string value.</returns> public static string TrimLength(this string str, int maxLength) => str is null || str.Length <= maxLength ? str : str.Substring(0, maxLength); /// <summary> /// Split a string into several substrings, each has a length not greater the specified one. /// </summary> /// <param name="str">The string to split.</param> /// <param name="chunkSize">The maximum length of the substring in the sequence.</param> /// <returns>The sequence of substrings.</returns> public static ChunkSequence<char> Split(this string str, int chunkSize) => new ChunkSequence<char>(str.AsMemory(), chunkSize); } }
45.535211
141
0.592638
[ "MIT" ]
kstanoev/dotNext
src/DotNext/StringExtensions.cs
3,233
C#
namespace Nancy.Hosting.Wcf.Tests { using Bootstrapper; using FakeItEasy; using Nancy.Helpers; using Nancy.Tests; using Nancy.Tests.xUnitExtensions; using System; using System.IO; using System.Linq; using System.Net; using System.ServiceModel; using System.ServiceModel.Web; using System.Threading; using Xunit; /// <remarks> /// These tests attempt to listen on port 56297, and so require either administrative /// privileges or that a command similar to the following has been run with /// administrative privileges: /// <code>netsh http add urlacl url=http://+:56297/base user=DOMAIN\user</code> /// See http://msdn.microsoft.com/en-us/library/ms733768.aspx for more information. /// </remarks> public class NancyWcfGenericServiceFixture { private static readonly Uri BaseUri = new Uri("http://localhost:56297/base/"); [SkippableFact] public void Should_be_able_to_get_any_header_from_selfhost() { // Given using (CreateAndOpenWebServiceHost()) { var request = WebRequest.Create(new Uri(BaseUri, "rel/header/?query=value")); request.Method = "GET"; // When var header = request.GetResponse().Headers["X-Some-Header"]; // Then header.ShouldEqual("Some value"); } } [SkippableFact] public void Should_set_query_string_and_uri_correctly() { // Given Request nancyRequest = null; var fakeEngine = A.Fake<INancyEngine>(); A.CallTo(() => fakeEngine.HandleRequest(A<Request>.Ignored, A<Func<NancyContext, NancyContext>>.Ignored, A<CancellationToken>.Ignored)) .Invokes(f => nancyRequest = (Request)f.Arguments[0]) .Returns(TaskHelpers.GetCompletedTask(new NancyContext())); var fakeBootstrapper = A.Fake<INancyBootstrapper>(); A.CallTo(() => fakeBootstrapper.GetEngine()).Returns(fakeEngine); // When using (CreateAndOpenWebServiceHost(fakeBootstrapper)) { var request = WebRequest.Create(new Uri(BaseUri, "test/stuff?query=value&query2=value2")); request.Method = "GET"; try { request.GetResponse(); } catch (WebException) { // Will throw because it returns 404 - don't care. } } // Then nancyRequest.Path.ShouldEqual("/test/stuff"); Assert.True(nancyRequest.Query.query.HasValue); Assert.True(nancyRequest.Query.query2.HasValue); } [SkippableFact] public void Should_set_path_and_url_correctly_without_trailing_slash() { // Given Request nancyRequest = null; var fakeEngine = A.Fake<INancyEngine>(); A.CallTo(() => fakeEngine.HandleRequest(A<Request>.Ignored, A<Func<NancyContext, NancyContext>>.Ignored, A<CancellationToken>.Ignored)) .Invokes(f => nancyRequest = (Request)f.Arguments[0]) .Returns(TaskHelpers.GetCompletedTask(new NancyContext())); var fakeBootstrapper = A.Fake<INancyBootstrapper>(); A.CallTo(() => fakeBootstrapper.GetEngine()).Returns(fakeEngine); var baseUriWithoutTrailingSlash = new Uri("http://localhost:56297/base"); // When using(CreateAndOpenWebServiceHost(fakeBootstrapper, baseUriWithoutTrailingSlash)) { var request = WebRequest.Create(new Uri(BaseUri, "test/stuff")); request.Method = "GET"; try { request.GetResponse(); } catch(WebException) { // Will throw because it returns 404 - don't care. } } // Then nancyRequest.Path.ShouldEqual("/test/stuff"); nancyRequest.Url.ToString().ShouldEqual("http://localhost:56297/base/test/stuff"); } [SkippableFact] public void Should_be_able_to_get_from_selfhost() { // Given using (CreateAndOpenWebServiceHost()) { var reader = new StreamReader(WebRequest.Create(new Uri(BaseUri, "rel")).GetResponse().GetResponseStream()); // When var response = reader.ReadToEnd(); // Then response.ShouldEqual("This is the site route"); } } [SkippableFact] public void Should_be_able_to_post_body_to_selfhost() { // Given using (CreateAndOpenWebServiceHost()) { const string testBody = "This is the body of the request"; var request = WebRequest.Create(new Uri(BaseUri, "rel")); request.Method = "POST"; var writer = new StreamWriter(request.GetRequestStream()) {AutoFlush = true}; writer.Write(testBody); // When var responseBody = new StreamReader(request.GetResponse().GetResponseStream()).ReadToEnd(); // Then responseBody.ShouldEqual(testBody); } } [SkippableFact] public void Should_nancyrequest_contain_hostname_port_and_scheme() { // Given Request nancyRequest = null; var fakeEngine = A.Fake<INancyEngine>(); var fakeBootstrapper = A.Fake<INancyBootstrapper>(); A.CallTo(() => fakeEngine.HandleRequest(A<Request>.Ignored, A<Func<NancyContext, NancyContext>>.Ignored, A<CancellationToken>.Ignored)) .Invokes(f => nancyRequest = (Request)f.Arguments[0]) .Returns(TaskHelpers.GetCompletedTask(new NancyContext())); A.CallTo(() => fakeBootstrapper.GetEngine()).Returns(fakeEngine); // When using (CreateAndOpenWebServiceHost(fakeBootstrapper)) { var request = WebRequest.Create(BaseUri); request.Method = "GET"; try { request.GetResponse(); } catch (WebException) { // Will throw because it returns 404 - don't care. } } // Then Assert.Equal(56297, nancyRequest.Url.Port); Assert.Equal("localhost", nancyRequest.Url.HostName); Assert.Equal("http", nancyRequest.Url.Scheme); } [SkippableFact] public void Should_not_have_content_type_header_for_not_modified_responses() { // Given var fakeEngine = A.Fake<INancyEngine>(); var fakeBootstrapper = A.Fake<INancyBootstrapper>(); // Context sends back a 304 Not Modified var context = new NancyContext { Response = new Response { ContentType = null, StatusCode = Nancy.HttpStatusCode.NotModified } }; A.CallTo(() => fakeEngine.HandleRequest(A<Request>.Ignored, A<Func<NancyContext, NancyContext>>.Ignored, A<CancellationToken>.Ignored)) .Returns(TaskHelpers.GetCompletedTask(context)); A.CallTo(() => fakeBootstrapper.GetEngine()).Returns(fakeEngine); // When a request is made and responded to with a status of 304 Not Modified WebResponse response = null; using (CreateAndOpenWebServiceHost(fakeBootstrapper)) { var request = WebRequest.Create(new Uri(BaseUri, "notmodified")); request.Method = "GET"; try { request.GetResponse(); } catch (WebException notModifiedEx) { // Will throw because it returns 304 response = notModifiedEx.Response; } } // Then Assert.NotNull(response); Assert.False(response.Headers.AllKeys.Any(header => header == "Content-Type")); } private static WebServiceHost CreateAndOpenWebServiceHost(INancyBootstrapper nancyBootstrapper = null, Uri baseUri = null) { if (nancyBootstrapper == null) { nancyBootstrapper = new DefaultNancyBootstrapper(); } var host = new WebServiceHost( new NancyWcfGenericService(nancyBootstrapper), baseUri ?? BaseUri); host.AddServiceEndpoint(typeof (NancyWcfGenericService), new WebHttpBinding(), ""); try { host.Open(); } catch (AddressAccessDeniedException) { throw new SkipException("Skipped due to no Administrator access - please see test fixture for more information."); } return host; } } }
37.10728
148
0.530201
[ "MIT" ]
Adalyat/Nancy
src/Nancy.Hosting.Wcf.Tests/NancyWcfGenericServiceFixture.cs
9,685
C#
#region License /* Copyright © 2014-2018 European Support Limited 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. */ #endregion using System.Windows.Controls; using GingerCore.Actions.Common; namespace Ginger.Actions._Common.ActUIElementLib { /// <summary> /// Interaction logic for LocateValueEditPage.xaml /// </summary> public partial class LocateValueEditPage : Page { ActUIElement mAction; public LocateValueEditPage(ActUIElement Action) { InitializeComponent(); mAction = Action; // Bind LocateValue and init VE App.ObjFieldBinding(txtLocateValue, TextBox.TextProperty, mAction, ActUIElement.Fields.ElementLocateValue); txtLocateValue.Init(mAction, ActUIElement.Fields.ElementLocateValue); } } }
30.255814
119
0.726364
[ "Apache-2.0" ]
DebasmitaGhosh/Ginger
Ginger/Ginger/Actions/_Common/ActUIElementLib/Locators/LocateValueEditPage.xaml.cs
1,302
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using NetWebScript.JsClr.Ast; using NetWebScript.JsClr.AstBuilder.Flow; using NetWebScript.JsClr.AstBuilder.Cil; namespace NetWebScript.JsClr.AstBuilder { internal sealed class InlineExpressionBuilder : IExpressionBuilderClient { private readonly ExpressionBuilder builder; private readonly IEnumerator<Sequence> enumerator; private SingleBlock current; private readonly Expression result; private InlineExpressionBuilder(ExpressionBuilder builder, List<Sequence> sequences) { this.builder = builder; builder.PushClient(this); enumerator = sequences.GetEnumerator(); while (enumerator.MoveNext()) { Process(enumerator.Current); } result = builder.Pop(); builder.PopClient(this); } internal static Expression Transform(ExpressionBuilder builder, List<Sequence> sequences) { return new InlineExpressionBuilder(builder, sequences).result; } private void Process(Sequence sequence) { current = sequence as SingleBlock; if (current != null) { if (current.GetType() != typeof(SingleBlock) && current.GetType() != typeof(Condition)) { throw new NotImplementedException(current.GetType().FullName); } foreach (Instruction instruction in current.Block) { builder.Visit(instruction); } } else { // Cas impossible throw new InvalidOperationException(); } } public void Exec(Expression expr) { throw new NotImplementedException(); } public void Branch(Expression condition, NetWebScript.JsClr.AstBuilder.Cil.Instruction instruction) { if (current.Block.Last != instruction) { // Cas impossible throw new InvalidOperationException(); } Condition cond = current as Condition; if (cond != null) { if (cond.StackAfter != 0) { int delta = cond.StackAfter - instruction.StackAfter; if (delta == 1 && cond.Jump != null && cond.NoJump != null) { Expression @then = Transform(builder, cond.Jump); Expression @else = Transform(builder, cond.NoJump); // Transformation en ternaire builder.Push(new ConditionExpression(instruction.Offset, condition, @then, @else)); return; } } throw new NotImplementedException(); } if (current.Block.Successors.Length != 1) { throw new NotImplementedException(); } } void IExpressionBuilderClient.Return(Expression expr) { throw new NotImplementedException(); } void IExpressionBuilderClient.Throw(Expression expr) { throw new NotImplementedException(); } } }
33.009346
108
0.525198
[ "MIT" ]
jetelain/NetWebScript
NetWebScript/NetWebScript/JsClr/AstBuilder/InlineExpressionBuilder.cs
3,534
C#
// 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. #if IS_SIGNING_SUPPORTED using System; using System.IO; using Moq; using NuGet.Common; using NuGet.Packaging.Signing; using NuGet.Test.Utility; using Xunit; namespace NuGet.Packaging.Test { public class SigningOptionsTests { [Fact] public void Constructor_WhenInputPackageStreamIsNull_Throws() { var exception = Assert.Throws<ArgumentNullException>( () => new SigningOptions( inputPackageStream: null, outputPackageStream: new Lazy<Stream>(() => Stream.Null), overwrite: true, signatureProvider: Mock.Of<ISignatureProvider>(), logger: Mock.Of<ILogger>())); Assert.Equal("inputPackageStream", exception.ParamName); } [Fact] public void Constructor_WhenOutputPackageStreamIsNull_Throws() { var exception = Assert.Throws<ArgumentNullException>( () => new SigningOptions( inputPackageStream: new Lazy<Stream>(() => Stream.Null), outputPackageStream: null, overwrite: true, signatureProvider: Mock.Of<ISignatureProvider>(), logger: Mock.Of<ILogger>())); Assert.Equal("outputPackageStream", exception.ParamName); } [Fact] public void Constructor_WhenSignatureProviderIsNull_Throws() { var exception = Assert.Throws<ArgumentNullException>( () => new SigningOptions( inputPackageStream: new Lazy<Stream>(() => Stream.Null), outputPackageStream: new Lazy<Stream>(() => Stream.Null), overwrite: true, signatureProvider: null, logger: Mock.Of<ILogger>())); Assert.Equal("signatureProvider", exception.ParamName); } [Fact] public void Constructor_WhenLoggerIsNull_Throws() { var exception = Assert.Throws<ArgumentNullException>( () => new SigningOptions( inputPackageStream: new Lazy<Stream>(() => Stream.Null), outputPackageStream: new Lazy<Stream>(() => Stream.Null), overwrite: true, signatureProvider: Mock.Of<ISignatureProvider>(), logger: null)); Assert.Equal("logger", exception.ParamName); } [Fact] public void Constructor_WithValidInput_InitializesProperties() { var inputPackageStream = new Lazy<Stream>(() => Stream.Null); var outputPackageStream = new Lazy<Stream>(() => Stream.Null); var overwrite = true; var signatureProvider = Mock.Of<ISignatureProvider>(); var logger = Mock.Of<ILogger>(); using (var options = new SigningOptions(inputPackageStream, outputPackageStream, overwrite, signatureProvider, logger)) { Assert.Same(inputPackageStream.Value, options.InputPackageStream); Assert.Same(outputPackageStream.Value, options.OutputPackageStream); Assert.Equal(overwrite, options.Overwrite); Assert.Same(signatureProvider, options.SignatureProvider); Assert.Same(logger, options.Logger); } } [Fact] public void Dispose_DisposesStreams() { var inputPackageStream = new Lazy<Stream>(() => new MemoryStream()); var outputPackageStream = new Lazy<Stream>(() => new MemoryStream()); var overwrite = true; var signatureProvider = Mock.Of<ISignatureProvider>(); var logger = Mock.Of<ILogger>(); using (var options = new SigningOptions(inputPackageStream, outputPackageStream, overwrite, signatureProvider, logger)) { Assert.True(inputPackageStream.Value.CanWrite); Assert.True(outputPackageStream.Value.CanWrite); } Assert.False(inputPackageStream.Value.CanWrite); Assert.False(outputPackageStream.Value.CanWrite); } [Theory] [InlineData(null)] [InlineData("")] public void CreateFromFilePaths_WhenInputPackageFilePathIsNullOrEmpty_Throws(string inputPackageFilePath) { var exception = Assert.Throws<ArgumentException>( () => SigningOptions.CreateFromFilePaths( inputPackageFilePath, outputPackageFilePath: "a", overwrite: true, signatureProvider: Mock.Of<ISignatureProvider>(), logger: Mock.Of<ILogger>())); Assert.Equal("inputPackageFilePath", exception.ParamName); } [Theory] [InlineData(null)] [InlineData("")] public void CreateFromFilePaths_WhenOutputPackageFilePathIsNullOrEmpty_Throws(string outputPackageFilePath) { var exception = Assert.Throws<ArgumentException>( () => SigningOptions.CreateFromFilePaths( inputPackageFilePath: "a", outputPackageFilePath: outputPackageFilePath, overwrite: true, signatureProvider: Mock.Of<ISignatureProvider>(), logger: Mock.Of<ILogger>())); Assert.Equal("outputPackageFilePath", exception.ParamName); } [Fact] public void CreateFromFilePaths_WhenInputPackageFilePathAndOutputPackageFilePathAreEquivalent_Throws() { var exception = Assert.Throws<ArgumentException>( () => SigningOptions.CreateFromFilePaths( inputPackageFilePath: Path.Combine(Path.GetTempPath(), "file"), outputPackageFilePath: Path.Combine(Path.GetTempPath(), "FILE"), overwrite: true, signatureProvider: Mock.Of<ISignatureProvider>(), logger: Mock.Of<ILogger>())); Assert.Equal("inputPackageFilePath and outputPackageFilePath should be different. Package signing cannot be done in place.", exception.Message); } [Fact] public void CreateFromFilePaths_WhenSignatureProviderIsNull_Throws() { using (var directory = TestDirectory.Create()) { var exception = Assert.Throws<ArgumentNullException>( () => SigningOptions.CreateFromFilePaths( inputPackageFilePath: Path.Combine(Path.GetTempPath(), "a"), outputPackageFilePath: Path.Combine(Path.GetTempPath(), "b"), overwrite: true, signatureProvider: null, logger: Mock.Of<ILogger>())); Assert.Equal("signatureProvider", exception.ParamName); } } [Fact] public void CreateFromFilePaths_WhenLoggerIsNull_Throws() { var exception = Assert.Throws<ArgumentNullException>( () => SigningOptions.CreateFromFilePaths( inputPackageFilePath: Path.Combine(Path.GetTempPath(), "a"), outputPackageFilePath: Path.Combine(Path.GetTempPath(), "b"), overwrite: true, signatureProvider: Mock.Of<ISignatureProvider>(), logger: null)); Assert.Equal("logger", exception.ParamName); } [Fact] public void CreateFromFilePaths_WithValidInput_InitializesProperties() { using (var directory = TestDirectory.Create()) { var inputPackageFilePath = Path.Combine(directory, "a"); var outputPackageFilePath = Path.Combine(directory, "b"); var overwrite = false; var signatureProvider = Mock.Of<ISignatureProvider>(); var logger = Mock.Of<ILogger>(); File.WriteAllBytes(inputPackageFilePath, Array.Empty<byte>()); using (var options = SigningOptions.CreateFromFilePaths( inputPackageFilePath, outputPackageFilePath, overwrite, signatureProvider, logger)) { Assert.NotNull(options.InputPackageStream); Assert.NotNull(options.OutputPackageStream); Assert.Equal(overwrite, options.Overwrite); Assert.Same(signatureProvider, options.SignatureProvider); Assert.Same(logger, options.Logger); } } } } } #endif
41.201835
156
0.574928
[ "Apache-2.0" ]
KirillOsenkov/NuGet.Client
test/NuGet.Core.Tests/NuGet.Packaging.Test/SigningTests/SigningOptionsTests.cs
8,982
C#
using System; using System.Linq; namespace MatrixShufflingEXERCISE { class StartUp { static void Main(string[] args) { int[] rowCol = Console.ReadLine().Split().Select(int.Parse).ToArray(); string[,] matrix = new string[rowCol[0], rowCol[1]]; for (int row = 0; row < rowCol[0]; row++) { string[] arr = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries).ToArray(); for (int col = 0; col < arr.Length; col++) { matrix[row, col] = arr[col]; } } string[] info = Console.ReadLine().Split().ToArray(); while (info[0] != "END") { if (info[0] == "swap") { if (info.Length == 5) { int row1 = int.Parse(info[1]); int col1 = int.Parse(info[2]); int row2 = int.Parse(info[3]); int col2 = int.Parse(info[4]); if ((row1 >= 0 && row1 <= rowCol[0] - 1) && (col1 >= 0 && col1 <= rowCol[1] - 1) && (row2 >= 0 && row2 <= rowCol[0] - 1) && (col2 >= 0 && col2 <= rowCol[1] - 1)) { string swap = matrix[row1, col1]; matrix[row1, col1] = matrix[row2, col2]; matrix[row2, col2] = swap; } else { Console.WriteLine("Invalid input!"); info = Console.ReadLine().Split().ToArray(); continue; } } else { Console.WriteLine("Invalid input!"); info = Console.ReadLine().Split().ToArray(); continue; } } else { Console.WriteLine("Invalid input!"); info = Console.ReadLine().Split().ToArray(); continue; } for (int row = 0; row < rowCol[0]; row++) { for (int col = 0; col < rowCol[1]; col++) { Console.Write(matrix[row, col] + " "); } Console.WriteLine(); } info = Console.ReadLine().Split().ToArray(); } } } }
35.089744
110
0.343807
[ "MIT" ]
Monna9505/CSharp-Advanced
MultidimensionalArrays/MultidimensionalArrays/MatrixShufflingEXERCISE/StartUp.cs
2,739
C#