示例#1
0
        public async Task<IActionResult> Put(Put.Command command)
        {
            var result = await _mediator.SendAsync(command);

            if (result == null)
            {
                return NotFound();
            }

            return await Get(new Get.Query {Id = result.DocumentId});
        }
示例#2
0
        public void Sample1()
        {
            var file = GetTestFilePath.FromDirectory(CsvFiles)
                       .AndFileName("Sample1.csv");

            var csv = Read.Csv.FromFile(file)
                      .ThatReturns.ArrayOf <(string Name, int Age)>()
                      .Put.Column("name").Into(a => a.Name)
                      .Put.Column("age").As <int>().Into(a => a.Age)
                      .GetAll();

            Debug.WriteLine("CSV DATA");
            csv.ResultSet.ForEach(r => Debug.WriteLine($"Name : {r.Name} - Age : {r.Age}"));

            Debug.WriteLine("ERRORS");
            csv.Errors.ForEach(e => Debug.WriteLine($"Error at line {e.LineNumber} column index {e.ColumnZeroBasedIndex} : {e.ErrorMessage}"));
        }
        public void WhenIUpdateTheCarResourceWithTheFollowingChanges(Table table)
        {
            _storedCar.Should().NotBeNull();

            var values = table.Rows.Single();

            _updatedCarInput = new CarInfo
            {
                Registration        = _storedCar.Registration,
                CustomerId          = _storedCar.CustomerId,
                Make                = _storedCar.Make,
                Model               = values["Model"],
                MotExpiry           = values.GetDateOrDefault("MOT Expiry"),
                SuppressMotReminder = _storedCar.SuppressMotReminder
            };

            _lastResponse.Response = _actor.Calls(Put.Resource(_updatedCarInput).At($"api/car/{_updatedCarInput.Registration}"));
        }
示例#4
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Selector.Length != 0)
            {
                hash ^= Selector.GetHashCode();
            }
            if (patternCase_ == PatternOneofCase.Get)
            {
                hash ^= Get.GetHashCode();
            }
            if (patternCase_ == PatternOneofCase.Put)
            {
                hash ^= Put.GetHashCode();
            }
            if (patternCase_ == PatternOneofCase.Post)
            {
                hash ^= Post.GetHashCode();
            }
            if (patternCase_ == PatternOneofCase.Delete)
            {
                hash ^= Delete.GetHashCode();
            }
            if (patternCase_ == PatternOneofCase.Patch)
            {
                hash ^= Patch.GetHashCode();
            }
            if (patternCase_ == PatternOneofCase.Custom)
            {
                hash ^= Custom.GetHashCode();
            }
            if (Body.Length != 0)
            {
                hash ^= Body.GetHashCode();
            }
            hash ^= additionalBindings_.GetHashCode();
            hash ^= (int)patternCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
示例#5
0
        public async Task ShouldReturnUnauthorizedIfPatientTriesToAssignAnExistingAppointmentToADifferentDoctor()
        {
            // arrange;
            // appointment with this ID exists in the test data set so can be modified;
            var appointmentId = new Guid("134f3726-3369-492b-b3bd-b62be67b96f8");
            var command       = new Put.Command(
                appointmentId,
                "SOME_OTHER_DOCTOR", // the only actual modification, but PUT requires entire object;
                new(2021, 7, 1, 10, 0, 0),
                60,
                null,
                null);

            // act;
            var res = await SendMediatorRequestInScopeOnBehalfOfTheTestPatient(command);

            // assert;
            res.Should().BeOfType <UnauthorizedResult>();
        }
示例#6
0
        internal static Message CreatePutMessage(IEnumerable <ResourceObject> resources)
        {
            int count = resources.Count();

            if (count == 0)
            {
                throw new ArgumentNullException("resources");
            }
            else if (count == 1)
            {
                return(MessageComposer.CreatePutMessage(resources.First(), null));
            }

            Put op = new Put();

            op.Dialect = Namespaces.RMIdentityAttributeType;
            List <PutFragmentType> fragments = new List <PutFragmentType>();

            foreach (ResourceObject resource in resources)
            {
                foreach (PutFragmentType fragment in resource.GetPutFragements())
                {
                    fragment.TargetIdentifier = resource.ObjectID.Value;
                    fragments.Add(fragment);
                }
            }

            if (fragments.Count == 0)
            {
                return(null);
            }

            op.Fragments = fragments.ToArray();
            Message message;

            message = Message.CreateMessage(MessageVersion.Default, Namespaces.Put, new SerializerBodyWriter(op));
            message.AddHeader(Namespaces.IdMDirectoryAccess, HeaderConstants.IdentityManagementOperation, null, true);
            message.AddHeader(Namespaces.ResourceManagement, HeaderConstants.CompositeTypeOperation, null);
            message.AddHeader(HeaderConstants.ResourceReferenceProperty, resources.Select(t => t.ObjectID.ToString()).ToCommaSeparatedString());

            return(message);
        }
示例#7
0
 internal void Put(ref Veza[] vz, int n, ref Put[] pt, ref int brojac, Stanica cilj)
 {
     if (this == cilj)
     {
         pt[brojac] = new Put(cilj, vz, n);
         brojac++;
         return;
     }
     posecena = true;
     for (int i = 0; i < brveza; i++)
     {
         Stanica t = veze[i].DrugaStanicaVeze(this);
         if (!t.posecena)
         {
             vz[n] = veze[i];
             t.Put(ref vz, n + 1, ref pt, ref brojac, cilj);
         }
     }
     posecena = false;
 }
示例#8
0
//        public Object servers { get; set; } // currently noe supported

        public void Accept(string path, IReferenceCollector collector)
        {
            if (Parameters != null)
            {
                foreach (var parameter in Parameters)
                {
                    collector.Visit($"{path}/parameters/{parameter.GetName()}", parameter);
                    parameter.GetObject()?.Accept($"{path}/parameters/{parameter.GetName()}", collector);
                }
            }

            Get?.Accept($"{path}/get", collector);
            Put?.Accept($"{path}/put", collector);
            Post?.Accept($"{path}/post", collector);
            Delete?.Accept($"{path}/delete", collector);
            Options?.Accept($"{path}/options", collector);
            Head?.Accept($"{path}/head", collector);
            Patch?.Accept($"{path}/patch", collector);
            Trace?.Accept($"{path}/trace", collector);
        }
示例#9
0
        public void WhenIUpdateTheCustomerResourceWithTheFollowingChanges(Table table)
        {
            _storedCustomer.Should().NotBeNull();

            var values = table.Rows.Single();

            _updatedCustomerInput = new CustomerInfo
            {
                Title               = _storedCustomer.Title,
                Name                = _storedCustomer.Name,
                AddressLine1        = _storedCustomer.AddressLine1,
                AddressLine2        = _storedCustomer.AddressLine2,
                AddressLine3        = _storedCustomer.AddressLine3,
                Postcode            = _storedCustomer.Postcode,
                HomePhone           = _storedCustomer.HomePhone,
                Mobile              = values["Mobile"],
                HasAccountInvoicing = values.GetBoolOrDefault("Account Invoicing")
            };

            _lastResponse.Response = _actor.Calls(Put.Resource(_updatedCustomerInput).At($"api/customer/{_storedCustomer.CustomerId}"));
        }
示例#10
0
    public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken)
    {
        oprot.IncrementRecursionDepth();
        try
        {
            var struc = new TStruct("TMutation");
            await oprot.WriteStructBeginAsync(struc, cancellationToken);

            var field = new TField();
            if (Put != null && __isset.put)
            {
                field.Name = "put";
                field.Type = TType.Struct;
                field.ID   = 1;
                await oprot.WriteFieldBeginAsync(field, cancellationToken);

                await Put.WriteAsync(oprot, cancellationToken);

                await oprot.WriteFieldEndAsync(cancellationToken);
            }
            if (DeleteSingle != null && __isset.deleteSingle)
            {
                field.Name = "deleteSingle";
                field.Type = TType.Struct;
                field.ID   = 2;
                await oprot.WriteFieldBeginAsync(field, cancellationToken);

                await DeleteSingle.WriteAsync(oprot, cancellationToken);

                await oprot.WriteFieldEndAsync(cancellationToken);
            }
            await oprot.WriteFieldStopAsync(cancellationToken);

            await oprot.WriteStructEndAsync(cancellationToken);
        }
        finally
        {
            oprot.DecrementRecursionDepth();
        }
    }
        public async Task Put_update_customer_and_response_not_content_status_code()
        {
            using (var server = CreateServer())
            {
                var customer = GetFakeCustomer();
                var content  = new StringContent(JsonConvert.SerializeObject(customer), Encoding.UTF8, "application/json");

                //add customer
                var customerResponse = await server.CreateClient()
                                       .PostAsync(Post.AddNewCustomer, content);

                if (int.TryParse(customerResponse.Headers.Location.Segments[3], out int id))
                {
                    customer.Surname = "Giamelli";
                    content          = new StringContent(JsonConvert.SerializeObject(customer), Encoding.UTF8, "application/json");
                    var response = await server.CreateClient()
                                   .PutAsync(Put.UpdateCustomer(id), content);

                    Assert.True(response.StatusCode == HttpStatusCode.Created);
                }

                customerResponse.EnsureSuccessStatusCode();
            }
        }
示例#12
0
        public async Task Put_update_campaign_and_response_not_content_status_code()
        {
            using (var server = CreateServer())
            {
                var fakeCampaignDto = GetFakeCampaignDto();
                var content         = new StringContent(JsonConvert.SerializeObject(fakeCampaignDto), Encoding.UTF8, "application/json");

                //add campaign
                var campaignResponse = await server.CreateClient()
                                       .PostAsync(Post.AddNewCampaign, content);

                if (int.TryParse(campaignResponse.Headers.Location.Segments[4], out int id))
                {
                    fakeCampaignDto.Description = "FakeCampaignUpdatedDescription";
                    content = new StringContent(JsonConvert.SerializeObject(fakeCampaignDto), Encoding.UTF8, "application/json");
                    var response = await server.CreateClient()
                                   .PutAsync(Put.CampaignBy(id), content);

                    Assert.True(response.StatusCode == HttpStatusCode.Created);
                }

                campaignResponse.EnsureSuccessStatusCode();
            }
        }
示例#13
0
    /// <summary>
    /// Called from a put when it is clicked.
    /// </summary>
    /// <param name="put">The clicked put</param>
    public void PutClicked(Put put)
    {
        if (put.connected) // Don't select already connected puts
        {
            return;
        }

        if (_selected == null)
        {
            _selected = put;
            put.Highlight(true);
            return;
        }

        if (_selected == put) // When clicked the highlighted put, cancel the selection
        {
            _selected.Highlight(false);
            _selected = null;
            return;
        }

        if (put.gate == _selected.gate || put.type == _selected.type) // Don't connect Put of the same type on on the same gate
        {
            return;
        }

        if (_selected.type == PutType.Out)
        {
            if (_selected.transform.position.x > put.transform.position.x)
            {
                return;
            }
        }
        else
        if (_selected.transform.position.x < put.transform.position.x)
        {
            return;
        }

        _selected.Highlight(false);
        put.Highlight(false);

        Wire w = Instantiate(wire, transform).GetComponent <Wire>();

        w.transform.position += Vector3.back;

        w.a = _selected;
        w.b = put;
        w.Move();

        if (put.type == PutType.Out)
        {
            put.wires.Add(w);
            _selected.connected = true;
            _selected.wires.Add(w);
        }
        else if (_selected.type == PutType.Out)
        {
            _selected.wires.Add(w);
            put.connected = true;
            put.wires.Add(w);
        }

        _selected = null;
    }
        public void PutMoney(decimal money)
        {
            Put put = money => _money + money;

            Show?.Invoke($"Added to account {money}");
        }
 public static void Delete(Put put)
 {
     Delete(put.Identifier);
 }
        public async Task Update_product_response_ok_status_code_should_replace_file_in_directory()
        {
            using (var server = CreateServer())
            {
                var ctx = server.Host.Services.GetRequiredService <CatalogContext>();
                var productViewModel = await GetTestProductVIewModelAsync(ctx);

                var productNameToUpdate = "zzz";

                #region Verify Product Tests case

                var testProduct = await ctx.Products
                                  .Include(x => x.ProductImages)
                                  .Include(x => x.ProductColors)
                                  .Include(x => x.ProductRatings)
                                  .Where(x => x.Name == productNameToUpdate)
                                  .ToListAsync();

                if (testProduct.Count() > 0)
                {
                    ctx.Products.RemoveRange(testProduct);
                    await ctx.SaveChangesAsync();
                }

                #endregion

                #region Verify Product To Edit

                var verifyProduct =
                    await ctx.Products
                    .Include(x => x.ProductImages)
                    .Include(x => x.ProductColors)
                    .SingleOrDefaultAsync(x => x.Name == productViewModel.Name);

                string id;
                if (verifyProduct == null)
                {
                    var contentToAdd = new StringContent(JsonConvert.SerializeObject(productViewModel), Encoding.UTF8,
                                                         "application/json");

                    var res = await server.CreateClient()
                              .PostAsync(Post.AddProduct, contentToAdd);


                    id = res.Headers.Location.Query.Split('=')[1];
                }
                else
                {
                    id = verifyProduct.Id;
                }

                #endregion

                productViewModel.Name        = productNameToUpdate;
                productViewModel.Description = "Test";

                productViewModel.ProductImages = new[]
                {
                    new ProductImage
                    {
                        ImageName = "test1.png",
                        ImageUrl  = productViewModel.ProductImages.First().ImageUrl
                    }
                };
                productViewModel.ProductColors = new ProductColor[0];

                var content = new StringContent(JsonConvert.SerializeObject(productViewModel), Encoding.UTF8,
                                                "application/json");

                var response = await server.CreateClient()
                               .PutAsync(Put.UpdateProduct(id), content);

                response.EnsureSuccessStatusCode();

                var insertedId = response.Headers.Location.Segments[4];

                var hostingEnvironment = server.Host.Services.GetRequiredService <IHostingEnvironment>();

                var insertedProduct = await ctx.Products
                                      .Include(x => x.ProductImages)
                                      .FirstOrDefaultAsync(x => x.Id == insertedId);

                foreach (var productImage in insertedProduct.ProductImages)
                {
                    var targetDir = hostingEnvironment.WebRootPath + "/ProductImage/" + insertedId + "/" +
                                    productImage.ImageName;
                    Assert.True(File.Exists(targetDir));
                }
            }
        }
示例#17
0
        /// <summary>Indicates whether the current object is equal to another object of the same type.</summary>
        /// <param name="other">An object to compare with this object.</param>
        /// <returns>true if the current object is equal to the <paramref name="other">other</paramref> parameter; otherwise, false.</returns>
        public virtual bool Equals(Path other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            if (!StringComparer.Ordinal.Equals(Summary, other.Summary))
            {
                return(false);
            }
            if (!StringComparer.Ordinal.Equals(Description, other.Description))
            {
                return(false);
            }
            if (!Get.NullableEquals(other.Get))
            {
                return(false);
            }
            if (!Put.NullableEquals(other.Put))
            {
                return(false);
            }
            if (!Post.NullableEquals(other.Post))
            {
                return(false);
            }
            if (!Delete.NullableEquals(other.Delete))
            {
                return(false);
            }
            if (!Options.NullableEquals(other.Options))
            {
                return(false);
            }
            if (!Head.NullableEquals(other.Head))
            {
                return(false);
            }
            if (!Patch.NullableEquals(other.Patch))
            {
                return(false);
            }
            if (!Trace.NullableEquals(other.Trace))
            {
                return(false);
            }
            if (!Servers.NullableListEquals(other.Servers))
            {
                return(false);
            }
            if (!Parameters.NullableDictionaryEquals(other.Parameters))
            {
                return(false);
            }

            return(true);
        }
示例#18
0
 public static void Write() => Put.WriteRandom();
示例#19
0
 protected override HttpInteraction GetHttpInteractionWithXmlContent(object content)
 {
     return(Put.DataAsXml(content).To(Urls.UsersApi));
 }
示例#20
0
 protected override HttpInteraction GetHttpInteractionWithCustomContent(string content)
 {
     return(Put.Data(content).To(Urls.UsersApi));
 }
        public async Task <bool> InsertRow(MembershipEntry entry, TableVersion tableVersion)
        {
            try
            {
                if (this.logger.IsEnabled(LogLevel.Debug))
                {
                    this.logger.Debug("InsertRow entry = {0}", entry.ToFullString());
                }
                var tableEntry = Convert(entry, tableVersion);

                if (!TryCreateTableVersionRecord(tableVersion.Version, tableVersion.VersionEtag, out var versionEntry))
                {
                    this.logger.Warn(ErrorCode.MembershipBase,
                                     $"Insert failed. Invalid ETag value. Will retry. Entry {entry.ToFullString()}, eTag {tableVersion.VersionEtag}");
                    return(false);
                }

                versionEntry.ETag++;

                bool result;

                try
                {
                    var notExistConditionExpression =
                        $"attribute_not_exists({SiloInstanceRecord.DEPLOYMENT_ID_PROPERTY_NAME}) AND attribute_not_exists({SiloInstanceRecord.SILO_IDENTITY_PROPERTY_NAME})";
                    var tableEntryInsert = new Put
                    {
                        Item = tableEntry.GetFields(true),
                        ConditionExpression = notExistConditionExpression,
                        TableName           = this.options.TableName
                    };

                    var conditionalValues = new Dictionary <string, AttributeValue> {
                        { CURRENT_ETAG_ALIAS, new AttributeValue {
                              N = tableVersion.VersionEtag
                          } }
                    };
                    var etagConditionalExpression = $"{SiloInstanceRecord.ETAG_PROPERTY_NAME} = {CURRENT_ETAG_ALIAS}";
                    var versionEntryUpdate        = new Update
                    {
                        TableName           = this.options.TableName,
                        Key                 = versionEntry.GetKeys(),
                        ConditionExpression = etagConditionalExpression
                    };
                    (versionEntryUpdate.UpdateExpression, versionEntryUpdate.ExpressionAttributeValues) =
                        this.storage.ConvertUpdate(versionEntry.GetFields(), conditionalValues);

                    await this.storage.WriteTxAsync(new[] { tableEntryInsert }, new[] { versionEntryUpdate });

                    result = true;
                }
                catch (TransactionCanceledException canceledException)
                {
                    if (canceledException.Message.Contains("ConditionalCheckFailed")) //not a good way to check for this currently
                    {
                        result = false;
                        this.logger.Warn(ErrorCode.MembershipBase,
                                         $"Insert failed due to contention on the table. Will retry. Entry {entry.ToFullString()}");
                    }
                    else
                    {
                        throw;
                    }
                }

                return(result);
            }
            catch (Exception exc)
            {
                this.logger.Warn(ErrorCode.MembershipBase,
                                 $"Intermediate error inserting entry {entry.ToFullString()} to the table {this.options.TableName}.", exc);
                throw;
            }
        }
示例#22
0
 private static Put ModifyEntire(User user)
 {
     return(Put.DataAsJson(user).To("api/Users/2"));
 }
示例#23
0
 public override Verb CreateVerb(string[] tokens)
 {
     Item = new Put(tokens[1]);
     return(new NullOp());
 }
 public static void SetPut(Put put)
 {
     Singleton.put = put;
 }
        static WmiNetUtilsHelper()
        {
            IntPtr zero    = IntPtr.Zero;
            IntPtr hModule = IntPtr.Zero;

            hModule = LoadLibrary(myDllPath);
            if (hModule != IntPtr.Zero)
            {
                zero = GetProcAddress(hModule, "ResetSecurity");
                if (zero != IntPtr.Zero)
                {
                    ResetSecurity_f = (ResetSecurity)Marshal.GetDelegateForFunctionPointer(zero, typeof(ResetSecurity));
                }
                zero = GetProcAddress(hModule, "SetSecurity");
                if (zero != IntPtr.Zero)
                {
                    SetSecurity_f = (SetSecurity)Marshal.GetDelegateForFunctionPointer(zero, typeof(SetSecurity));
                }
                zero = GetProcAddress(hModule, "BlessIWbemServices");
                if (zero != IntPtr.Zero)
                {
                    BlessIWbemServices_f = (BlessIWbemServices)Marshal.GetDelegateForFunctionPointer(zero, typeof(BlessIWbemServices));
                }
                zero = GetProcAddress(hModule, "BlessIWbemServicesObject");
                if (zero != IntPtr.Zero)
                {
                    BlessIWbemServicesObject_f = (BlessIWbemServicesObject)Marshal.GetDelegateForFunctionPointer(zero, typeof(BlessIWbemServicesObject));
                }
                zero = GetProcAddress(hModule, "GetPropertyHandle");
                if (zero != IntPtr.Zero)
                {
                    GetPropertyHandle_f27 = (GetPropertyHandle)Marshal.GetDelegateForFunctionPointer(zero, typeof(GetPropertyHandle));
                }
                zero = GetProcAddress(hModule, "WritePropertyValue");
                if (zero != IntPtr.Zero)
                {
                    WritePropertyValue_f28 = (WritePropertyValue)Marshal.GetDelegateForFunctionPointer(zero, typeof(WritePropertyValue));
                }
                zero = GetProcAddress(hModule, "Clone");
                if (zero != IntPtr.Zero)
                {
                    Clone_f12 = (Clone)Marshal.GetDelegateForFunctionPointer(zero, typeof(Clone));
                }
                zero = GetProcAddress(hModule, "VerifyClientKey");
                if (zero != IntPtr.Zero)
                {
                    VerifyClientKey_f = (VerifyClientKey)Marshal.GetDelegateForFunctionPointer(zero, typeof(VerifyClientKey));
                }
                zero = GetProcAddress(hModule, "GetQualifierSet");
                if (zero != IntPtr.Zero)
                {
                    GetQualifierSet_f = (GetQualifierSet)Marshal.GetDelegateForFunctionPointer(zero, typeof(GetQualifierSet));
                }
                zero = GetProcAddress(hModule, "Get");
                if (zero != IntPtr.Zero)
                {
                    Get_f = (Get)Marshal.GetDelegateForFunctionPointer(zero, typeof(Get));
                }
                zero = GetProcAddress(hModule, "Put");
                if (zero != IntPtr.Zero)
                {
                    Put_f = (Put)Marshal.GetDelegateForFunctionPointer(zero, typeof(Put));
                }
                zero = GetProcAddress(hModule, "Delete");
                if (zero != IntPtr.Zero)
                {
                    Delete_f = (Delete)Marshal.GetDelegateForFunctionPointer(zero, typeof(Delete));
                }
                zero = GetProcAddress(hModule, "GetNames");
                if (zero != IntPtr.Zero)
                {
                    GetNames_f = (GetNames)Marshal.GetDelegateForFunctionPointer(zero, typeof(GetNames));
                }
                zero = GetProcAddress(hModule, "BeginEnumeration");
                if (zero != IntPtr.Zero)
                {
                    BeginEnumeration_f = (BeginEnumeration)Marshal.GetDelegateForFunctionPointer(zero, typeof(BeginEnumeration));
                }
                zero = GetProcAddress(hModule, "Next");
                if (zero != IntPtr.Zero)
                {
                    Next_f = (Next)Marshal.GetDelegateForFunctionPointer(zero, typeof(Next));
                }
                zero = GetProcAddress(hModule, "EndEnumeration");
                if (zero != IntPtr.Zero)
                {
                    EndEnumeration_f = (EndEnumeration)Marshal.GetDelegateForFunctionPointer(zero, typeof(EndEnumeration));
                }
                zero = GetProcAddress(hModule, "GetPropertyQualifierSet");
                if (zero != IntPtr.Zero)
                {
                    GetPropertyQualifierSet_f = (GetPropertyQualifierSet)Marshal.GetDelegateForFunctionPointer(zero, typeof(GetPropertyQualifierSet));
                }
                zero = GetProcAddress(hModule, "Clone");
                if (zero != IntPtr.Zero)
                {
                    Clone_f = (Clone)Marshal.GetDelegateForFunctionPointer(zero, typeof(Clone));
                }
                zero = GetProcAddress(hModule, "GetObjectText");
                if (zero != IntPtr.Zero)
                {
                    GetObjectText_f = (GetObjectText)Marshal.GetDelegateForFunctionPointer(zero, typeof(GetObjectText));
                }
                zero = GetProcAddress(hModule, "SpawnDerivedClass");
                if (zero != IntPtr.Zero)
                {
                    SpawnDerivedClass_f = (SpawnDerivedClass)Marshal.GetDelegateForFunctionPointer(zero, typeof(SpawnDerivedClass));
                }
                zero = GetProcAddress(hModule, "SpawnInstance");
                if (zero != IntPtr.Zero)
                {
                    SpawnInstance_f = (SpawnInstance)Marshal.GetDelegateForFunctionPointer(zero, typeof(SpawnInstance));
                }
                zero = GetProcAddress(hModule, "CompareTo");
                if (zero != IntPtr.Zero)
                {
                    CompareTo_f = (CompareTo)Marshal.GetDelegateForFunctionPointer(zero, typeof(CompareTo));
                }
                zero = GetProcAddress(hModule, "GetPropertyOrigin");
                if (zero != IntPtr.Zero)
                {
                    GetPropertyOrigin_f = (GetPropertyOrigin)Marshal.GetDelegateForFunctionPointer(zero, typeof(GetPropertyOrigin));
                }
                zero = GetProcAddress(hModule, "InheritsFrom");
                if (zero != IntPtr.Zero)
                {
                    InheritsFrom_f = (InheritsFrom)Marshal.GetDelegateForFunctionPointer(zero, typeof(InheritsFrom));
                }
                zero = GetProcAddress(hModule, "GetMethod");
                if (zero != IntPtr.Zero)
                {
                    GetMethod_f = (GetMethod)Marshal.GetDelegateForFunctionPointer(zero, typeof(GetMethod));
                }
                zero = GetProcAddress(hModule, "PutMethod");
                if (zero != IntPtr.Zero)
                {
                    PutMethod_f = (PutMethod)Marshal.GetDelegateForFunctionPointer(zero, typeof(PutMethod));
                }
                zero = GetProcAddress(hModule, "DeleteMethod");
                if (zero != IntPtr.Zero)
                {
                    DeleteMethod_f = (DeleteMethod)Marshal.GetDelegateForFunctionPointer(zero, typeof(DeleteMethod));
                }
                zero = GetProcAddress(hModule, "BeginMethodEnumeration");
                if (zero != IntPtr.Zero)
                {
                    BeginMethodEnumeration_f = (BeginMethodEnumeration)Marshal.GetDelegateForFunctionPointer(zero, typeof(BeginMethodEnumeration));
                }
                zero = GetProcAddress(hModule, "NextMethod");
                if (zero != IntPtr.Zero)
                {
                    NextMethod_f = (NextMethod)Marshal.GetDelegateForFunctionPointer(zero, typeof(NextMethod));
                }
                zero = GetProcAddress(hModule, "EndMethodEnumeration");
                if (zero != IntPtr.Zero)
                {
                    EndMethodEnumeration_f = (EndMethodEnumeration)Marshal.GetDelegateForFunctionPointer(zero, typeof(EndMethodEnumeration));
                }
                zero = GetProcAddress(hModule, "GetMethodQualifierSet");
                if (zero != IntPtr.Zero)
                {
                    GetMethodQualifierSet_f = (GetMethodQualifierSet)Marshal.GetDelegateForFunctionPointer(zero, typeof(GetMethodQualifierSet));
                }
                zero = GetProcAddress(hModule, "GetMethodOrigin");
                if (zero != IntPtr.Zero)
                {
                    GetMethodOrigin_f = (GetMethodOrigin)Marshal.GetDelegateForFunctionPointer(zero, typeof(GetMethodOrigin));
                }
                zero = GetProcAddress(hModule, "QualifierSet_Get");
                if (zero != IntPtr.Zero)
                {
                    QualifierGet_f = (QualifierSet_Get)Marshal.GetDelegateForFunctionPointer(zero, typeof(QualifierSet_Get));
                }
                zero = GetProcAddress(hModule, "QualifierSet_Put");
                if (zero != IntPtr.Zero)
                {
                    QualifierPut_f = (QualifierSet_Put)Marshal.GetDelegateForFunctionPointer(zero, typeof(QualifierSet_Put));
                }
                zero = GetProcAddress(hModule, "QualifierSet_Delete");
                if (zero != IntPtr.Zero)
                {
                    QualifierDelete_f = (QualifierSet_Delete)Marshal.GetDelegateForFunctionPointer(zero, typeof(QualifierSet_Delete));
                }
                zero = GetProcAddress(hModule, "QualifierSet_GetNames");
                if (zero != IntPtr.Zero)
                {
                    QualifierGetNames_f = (QualifierSet_GetNames)Marshal.GetDelegateForFunctionPointer(zero, typeof(QualifierSet_GetNames));
                }
                zero = GetProcAddress(hModule, "QualifierSet_BeginEnumeration");
                if (zero != IntPtr.Zero)
                {
                    QualifierBeginEnumeration_f = (QualifierSet_BeginEnumeration)Marshal.GetDelegateForFunctionPointer(zero, typeof(QualifierSet_BeginEnumeration));
                }
                zero = GetProcAddress(hModule, "QualifierSet_Next");
                if (zero != IntPtr.Zero)
                {
                    QualifierNext_f = (QualifierSet_Next)Marshal.GetDelegateForFunctionPointer(zero, typeof(QualifierSet_Next));
                }
                zero = GetProcAddress(hModule, "QualifierSet_EndEnumeration");
                if (zero != IntPtr.Zero)
                {
                    QualifierEndEnumeration_f = (QualifierSet_EndEnumeration)Marshal.GetDelegateForFunctionPointer(zero, typeof(QualifierSet_EndEnumeration));
                }
                zero = GetProcAddress(hModule, "GetCurrentApartmentType");
                if (zero != IntPtr.Zero)
                {
                    GetCurrentApartmentType_f = (GetCurrentApartmentType)Marshal.GetDelegateForFunctionPointer(zero, typeof(GetCurrentApartmentType));
                }
                zero = GetProcAddress(hModule, "GetDemultiplexedStub");
                if (zero != IntPtr.Zero)
                {
                    GetDemultiplexedStub_f = (GetDemultiplexedStub)Marshal.GetDelegateForFunctionPointer(zero, typeof(GetDemultiplexedStub));
                }
                zero = GetProcAddress(hModule, "CreateInstanceEnumWmi");
                if (zero != IntPtr.Zero)
                {
                    CreateInstanceEnumWmi_f = (CreateInstanceEnumWmi)Marshal.GetDelegateForFunctionPointer(zero, typeof(CreateInstanceEnumWmi));
                }
                zero = GetProcAddress(hModule, "CreateClassEnumWmi");
                if (zero != IntPtr.Zero)
                {
                    CreateClassEnumWmi_f = (CreateClassEnumWmi)Marshal.GetDelegateForFunctionPointer(zero, typeof(CreateClassEnumWmi));
                }
                zero = GetProcAddress(hModule, "ExecQueryWmi");
                if (zero != IntPtr.Zero)
                {
                    ExecQueryWmi_f = (ExecQueryWmi)Marshal.GetDelegateForFunctionPointer(zero, typeof(ExecQueryWmi));
                }
                zero = GetProcAddress(hModule, "ExecNotificationQueryWmi");
                if (zero != IntPtr.Zero)
                {
                    ExecNotificationQueryWmi_f = (ExecNotificationQueryWmi)Marshal.GetDelegateForFunctionPointer(zero, typeof(ExecNotificationQueryWmi));
                }
                zero = GetProcAddress(hModule, "PutInstanceWmi");
                if (zero != IntPtr.Zero)
                {
                    PutInstanceWmi_f = (PutInstanceWmi)Marshal.GetDelegateForFunctionPointer(zero, typeof(PutInstanceWmi));
                }
                zero = GetProcAddress(hModule, "PutClassWmi");
                if (zero != IntPtr.Zero)
                {
                    PutClassWmi_f = (PutClassWmi)Marshal.GetDelegateForFunctionPointer(zero, typeof(PutClassWmi));
                }
                zero = GetProcAddress(hModule, "CloneEnumWbemClassObject");
                if (zero != IntPtr.Zero)
                {
                    CloneEnumWbemClassObject_f = (CloneEnumWbemClassObject)Marshal.GetDelegateForFunctionPointer(zero, typeof(CloneEnumWbemClassObject));
                }
                zero = GetProcAddress(hModule, "ConnectServerWmi");
                if (zero != IntPtr.Zero)
                {
                    ConnectServerWmi_f = (ConnectServerWmi)Marshal.GetDelegateForFunctionPointer(zero, typeof(ConnectServerWmi));
                }
            }
        }
示例#26
0
 static WmiNetUtilsHelper()
 {
     myDllPath = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory() + "\\wminet_utils.dll";
     IntPtr procAddr = IntPtr.Zero;
     IntPtr loadLibrary = IntPtr.Zero;
     loadLibrary =  LoadLibrary(myDllPath);
     if( loadLibrary != IntPtr.Zero)
     {
         procAddr = GetProcAddress(loadLibrary, "ResetSecurity");
         if( procAddr != IntPtr.Zero)
         {
             ResetSecurity_f  =(ResetSecurity) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(ResetSecurity));
         }
         procAddr = GetProcAddress(loadLibrary, "SetSecurity");
         if( procAddr != IntPtr.Zero)
         {
             SetSecurity_f  =(SetSecurity) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(SetSecurity));
         }
         procAddr = GetProcAddress(loadLibrary, "BlessIWbemServices");
         if( procAddr != IntPtr.Zero)
         {
             BlessIWbemServices_f  =(BlessIWbemServices) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(BlessIWbemServices));
         }
         procAddr = GetProcAddress(loadLibrary, "BlessIWbemServicesObject");
         if( procAddr != IntPtr.Zero)
         {
             BlessIWbemServicesObject_f  =(BlessIWbemServicesObject) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(BlessIWbemServicesObject));
         }
         procAddr = GetProcAddress(loadLibrary, "GetPropertyHandle");
         if( procAddr != IntPtr.Zero)
         {
              GetPropertyHandle_f27=(GetPropertyHandle) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetPropertyHandle));
         }
         procAddr = GetProcAddress(loadLibrary, "WritePropertyValue");
         if( procAddr != IntPtr.Zero)
         {
              WritePropertyValue_f28=(WritePropertyValue) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(WritePropertyValue));
         }
         procAddr = GetProcAddress(loadLibrary, "Clone");
         if( procAddr != IntPtr.Zero)
         {
              Clone_f12=(Clone) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(Clone));
         }   
         procAddr = GetProcAddress(loadLibrary, "VerifyClientKey");
         if( procAddr != IntPtr.Zero)
         {
              VerifyClientKey_f  =(VerifyClientKey) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(VerifyClientKey));
         }
         procAddr = GetProcAddress(loadLibrary, "GetQualifierSet");
         if( procAddr != IntPtr.Zero)
         {
             GetQualifierSet_f  =(GetQualifierSet) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetQualifierSet));
         }
         procAddr = GetProcAddress(loadLibrary, "Get");
         if( procAddr != IntPtr.Zero)
         {
             Get_f  =(Get) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(Get));
         }
         procAddr = GetProcAddress(loadLibrary, "Put");
         if( procAddr != IntPtr.Zero)
         {
             Put_f  =(Put) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(Put));
         }
         procAddr = GetProcAddress(loadLibrary, "Delete");
         if( procAddr != IntPtr.Zero)
         {
             Delete_f  =(Delete) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(Delete));
         }
         procAddr = GetProcAddress(loadLibrary, "GetNames");
         if( procAddr != IntPtr.Zero)
         {
             GetNames_f  =(GetNames) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetNames));
         }
         procAddr = GetProcAddress(loadLibrary, "BeginEnumeration");
         if( procAddr != IntPtr.Zero)
         {
             BeginEnumeration_f  =(BeginEnumeration) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(BeginEnumeration));
         }
         procAddr = GetProcAddress(loadLibrary, "Next");
         if( procAddr != IntPtr.Zero)
         {
             Next_f  =(Next) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(Next));
         }
         procAddr = GetProcAddress(loadLibrary, "EndEnumeration");
         if( procAddr != IntPtr.Zero)
         {
             EndEnumeration_f  =(EndEnumeration) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(EndEnumeration));
         }
         procAddr = GetProcAddress(loadLibrary, "GetPropertyQualifierSet");
         if( procAddr != IntPtr.Zero)
         {
             GetPropertyQualifierSet_f  =(GetPropertyQualifierSet) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetPropertyQualifierSet));
         }
         procAddr = GetProcAddress(loadLibrary, "Clone");
         if( procAddr != IntPtr.Zero)
         {
             Clone_f  =(Clone) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(Clone));
         }
         procAddr = GetProcAddress(loadLibrary, "GetObjectText");
         if( procAddr != IntPtr.Zero)
         {
             GetObjectText_f  =(GetObjectText) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetObjectText));
         }
         procAddr = GetProcAddress(loadLibrary, "SpawnDerivedClass");
         if( procAddr != IntPtr.Zero)
         {
             SpawnDerivedClass_f  =(SpawnDerivedClass) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(SpawnDerivedClass));
         }
         procAddr = GetProcAddress(loadLibrary, "SpawnInstance");
         if( procAddr != IntPtr.Zero)
         {
             SpawnInstance_f  =(SpawnInstance) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(SpawnInstance));
         }
         procAddr = GetProcAddress(loadLibrary, "CompareTo");
         if( procAddr != IntPtr.Zero)
         {
             CompareTo_f  =(CompareTo) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(CompareTo));
         }
         procAddr = GetProcAddress(loadLibrary, "GetPropertyOrigin");
         if( procAddr != IntPtr.Zero)
         {
             GetPropertyOrigin_f  =(GetPropertyOrigin) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetPropertyOrigin));
         }
         procAddr = GetProcAddress(loadLibrary, "InheritsFrom");
         if( procAddr != IntPtr.Zero)
         {
             InheritsFrom_f  =(InheritsFrom) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(InheritsFrom));
         }
         procAddr = GetProcAddress(loadLibrary, "GetMethod");
         if( procAddr != IntPtr.Zero)
         {
             GetMethod_f  =(GetMethod) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetMethod));
         }
         procAddr = GetProcAddress(loadLibrary, "PutMethod");
         if( procAddr != IntPtr.Zero)
         {
             PutMethod_f  =(PutMethod) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(PutMethod));
         }
         procAddr = GetProcAddress(loadLibrary, "DeleteMethod");
         if( procAddr != IntPtr.Zero)
         {
             DeleteMethod_f  =(DeleteMethod) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(DeleteMethod));
         }
         procAddr = GetProcAddress(loadLibrary, "BeginMethodEnumeration");
         if( procAddr != IntPtr.Zero)
         {
             BeginMethodEnumeration_f  =(BeginMethodEnumeration) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(BeginMethodEnumeration));
         }
         procAddr = GetProcAddress(loadLibrary, "NextMethod");
         if( procAddr != IntPtr.Zero)
         {
             NextMethod_f  =(NextMethod) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(NextMethod));
         }
         procAddr = GetProcAddress(loadLibrary, "EndMethodEnumeration");
         if( procAddr != IntPtr.Zero)
         {
             EndMethodEnumeration_f  =(EndMethodEnumeration) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(EndMethodEnumeration));
         }
         procAddr = GetProcAddress(loadLibrary, "GetMethodQualifierSet");
         if( procAddr != IntPtr.Zero)
         {
             GetMethodQualifierSet_f  =(GetMethodQualifierSet) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetMethodQualifierSet));
         }
         procAddr = GetProcAddress(loadLibrary, "GetMethodOrigin");
         if( procAddr != IntPtr.Zero)
         {
             GetMethodOrigin_f  =(GetMethodOrigin) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetMethodOrigin));
         }
         procAddr = GetProcAddress(loadLibrary, "QualifierSet_Get");
         if( procAddr != IntPtr.Zero)
         {
              QualifierGet_f=(QualifierSet_Get) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(QualifierSet_Get));
         }
         procAddr = GetProcAddress(loadLibrary, "QualifierSet_Put");
         if( procAddr != IntPtr.Zero)
         {
              QualifierPut_f=(QualifierSet_Put) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(QualifierSet_Put));
         }
         procAddr = GetProcAddress(loadLibrary, "QualifierSet_Delete");
         if( procAddr != IntPtr.Zero)
         {
              QualifierDelete_f=(QualifierSet_Delete) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(QualifierSet_Delete));
         }
         procAddr = GetProcAddress(loadLibrary, "QualifierSet_GetNames");
         if( procAddr != IntPtr.Zero)
         {
              QualifierGetNames_f=(QualifierSet_GetNames) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(QualifierSet_GetNames));
         }
         procAddr = GetProcAddress(loadLibrary, "QualifierSet_BeginEnumeration");
         if( procAddr != IntPtr.Zero)
         {
              QualifierBeginEnumeration_f=(QualifierSet_BeginEnumeration) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(QualifierSet_BeginEnumeration));
         }
         procAddr = GetProcAddress(loadLibrary, "QualifierSet_Next");
         if( procAddr != IntPtr.Zero)
         {
              QualifierNext_f=(QualifierSet_Next) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(QualifierSet_Next));
         }
         procAddr = GetProcAddress(loadLibrary, "QualifierSet_EndEnumeration");
         if( procAddr != IntPtr.Zero)
         {
              QualifierEndEnumeration_f=(QualifierSet_EndEnumeration) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(QualifierSet_EndEnumeration));
         }
         procAddr = GetProcAddress(loadLibrary, "GetCurrentApartmentType");
         if( procAddr != IntPtr.Zero)
         {
             GetCurrentApartmentType_f  =(GetCurrentApartmentType) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetCurrentApartmentType));
         }
         procAddr = GetProcAddress(loadLibrary, "GetDemultiplexedStub");
         if( procAddr != IntPtr.Zero)
         {
              GetDemultiplexedStub_f =(GetDemultiplexedStub) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetDemultiplexedStub));
         }         
         procAddr = GetProcAddress(loadLibrary, "CreateInstanceEnumWmi");
         if( procAddr != IntPtr.Zero)
         {
             CreateInstanceEnumWmi_f  =(CreateInstanceEnumWmi) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(CreateInstanceEnumWmi));
         }
         procAddr = GetProcAddress(loadLibrary, "CreateClassEnumWmi");
         if( procAddr != IntPtr.Zero)
         {
             CreateClassEnumWmi_f  =(CreateClassEnumWmi) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(CreateClassEnumWmi));
         }
         procAddr = GetProcAddress(loadLibrary, "ExecQueryWmi");
         if( procAddr != IntPtr.Zero)
         {
             ExecQueryWmi_f  =(ExecQueryWmi) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(ExecQueryWmi));
         }
         procAddr = GetProcAddress(loadLibrary, "ExecNotificationQueryWmi");
         if( procAddr != IntPtr.Zero)
         {
             ExecNotificationQueryWmi_f  =(ExecNotificationQueryWmi) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(ExecNotificationQueryWmi));
         }
         procAddr = GetProcAddress(loadLibrary, "PutInstanceWmi");
         if( procAddr != IntPtr.Zero)
         {
             PutInstanceWmi_f  =(PutInstanceWmi) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(PutInstanceWmi));
         } 
         procAddr = GetProcAddress(loadLibrary, "PutClassWmi");
         if( procAddr != IntPtr.Zero)
         {
             PutClassWmi_f  =(PutClassWmi) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(PutClassWmi));
         }
         procAddr = GetProcAddress(loadLibrary, "CloneEnumWbemClassObject");
         if( procAddr != IntPtr.Zero)
         {
             CloneEnumWbemClassObject_f  =(CloneEnumWbemClassObject) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(CloneEnumWbemClassObject));
         }
         procAddr = GetProcAddress(loadLibrary, "ConnectServerWmi");
         if( procAddr != IntPtr.Zero)
         {
             ConnectServerWmi_f  =(ConnectServerWmi) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(ConnectServerWmi));
         }
         
     }
 }
示例#27
0
 //--- Constructors ---
 public DynamoTableTransactWriteItemsPutItem(DynamoTableTransactWriteItems parent, Put put, DynamoRequestConverter converter)
 {
     _parent    = parent ?? throw new ArgumentNullException(nameof(parent));
     _put       = put ?? throw new ArgumentNullException(nameof(put));
     _converter = converter ?? throw new ArgumentNullException(nameof(converter));
 }
 SqlConnection con = new SqlConnection(“Put your connection string here”);
示例#29
0
 public PutOnlyConveyer(Put <T> put)
 {
     this.put = put;
 }
示例#30
0
            public CanExecuteTests()
            {
                var httpClient = new HttpClient();

                put = new Put(httpClient);
            }
示例#31
0
 protected override HttpInteraction GetHttpInteraction(string resource)
 {
     return(Put.DataAsJson(ContentFactory.SomeContent()).To(resource));
 }