Ejemplo n.º 1
0
        internal IntPtr ToNative(PinCollection pinCollection)
        {
            var nativeStartNodeDescriptionUsingNodeName = new NativeTypes.FABRIC_START_NODE_DESCRIPTION_USING_NODE_NAME();

            nativeStartNodeDescriptionUsingNodeName.NodeName = pinCollection.AddObject(this.NodeName);

            // make it Utility.To...
            nativeStartNodeDescriptionUsingNodeName.NodeInstance = (ulong)this.NodeInstance;

            nativeStartNodeDescriptionUsingNodeName.IPAddressOrFQDN = pinCollection.AddObject(this.IpAddressOrFQDN);

            nativeStartNodeDescriptionUsingNodeName.ClusterConnectionPort = (uint)this.ClusterConnectionPort;

            switch (this.CompletionMode)
            {
            case CompletionMode.DoNotVerify:
                nativeStartNodeDescriptionUsingNodeName.CompletionMode = NativeTypes.FABRIC_COMPLETION_MODE.FABRIC_COMPLETION_MODE_DO_NOT_VERIFY;
                break;

            case CompletionMode.Verify:
                nativeStartNodeDescriptionUsingNodeName.CompletionMode = NativeTypes.FABRIC_COMPLETION_MODE.FABRIC_COMPLETION_MODE_VERIFY;
                break;

            default:
                nativeStartNodeDescriptionUsingNodeName.CompletionMode = NativeTypes.FABRIC_COMPLETION_MODE.FABRIC_COMPLETION_MODE_INVALID;
                break;
            }

            var raw = pinCollection.AddBlittable(nativeStartNodeDescriptionUsingNodeName);

            var recreated = CreateFromNative(raw);

            return(raw);
        }
Ejemplo n.º 2
0
        internal IntPtr ToNative(PinCollection pinCollection)
        {
            var nativeBackupOperationResult = new NativeBackupRestoreTypes.FABRIC_BACKUP_OPERATION_RESULT
            {
                ServiceName  = pinCollection.AddObject(this.ServiceName),
                PartitionId  = this.PartitionId,
                ErrorCode    = this.ErrorCode,
                TimeStampUtc = NativeTypes.ToNativeFILETIME(this.TimeStampUtc),
                Message      = pinCollection.AddObject(this.Message),
                OperationId  = this.OperationId,
                Reserved     = IntPtr.Zero,
            };

            // Copy backup details in case of success
            if (this.ErrorCode == 0)
            {
                NativeTypes.FABRIC_EPOCH nativeEpoch;

                nativeBackupOperationResult.BackupId              = this.BackupId;
                nativeBackupOperationResult.BackupLocation        = pinCollection.AddObject(this.BackupLocation);
                nativeBackupOperationResult.LsnOfLastBackupRecord = this.LsnOfLastBackupRecord;

                this.EpochOfLastBackupRecord.ToNative(out nativeEpoch);

                unsafe
                {
                    nativeBackupOperationResult.EpochOfLastBackupRecord = nativeEpoch;
                }
            }

            return(pinCollection.AddBlittable(nativeBackupOperationResult));
        }
Ejemplo n.º 3
0
 /// <summary>
 /// <para>Encrypt text string with an installed X509 certificate.</para>
 /// </summary>
 /// <param name="textToEncrypt">
 /// <para>The text to encrypt.</para>
 /// </param>
 /// <param name="thumbprint">
 /// <para>The thumbprint of encryption certificate.</para>
 /// </param>
 /// <param name="storeName">
 /// <para>The name of certificate store, from which encryption certificate is retrieved.</para>
 /// </param>
 /// <param name="storeLocation">
 /// <para>The certificate store location to retrieve encryption certificate.</para>
 /// </param>
 /// <param name="algorithmOid">
 /// <para>The encryption algorithm object identifier (OID).</para>
 /// </param>
 /// <returns>
 /// <para>The encrypted text as <see cref="System.String" />.</para>
 /// </returns>
 public static string EncryptText(
     string textToEncrypt,
     string thumbprint,
     string storeName,
     StoreLocation storeLocation,
     string algorithmOid)
 {
     using (PinCollection pin = new PinCollection())
     {
         try
         {
             return(NativeTypes.FromNativeString(NativeCommon.FabricEncryptText(
                                                     pin.AddObject(textToEncrypt),
                                                     pin.AddObject(thumbprint),
                                                     pin.AddObject(storeName),
                                                     (NativeTypes.FABRIC_X509_STORE_LOCATION)storeLocation,
                                                     pin.AddObject(algorithmOid))));
         }
         catch (Exception ex)
         {
             COMException comEx = Utility.TryTranslateExceptionToCOM(ex);
             if (comEx != null)
             {
                 throw comEx;
             }
             throw;
         }
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// <para>Encrypt text string with an X509 certificate in a file.</para>
 /// </summary>
 /// <param name="textToEncrypt">
 /// <para>The text to encrypt.</para>
 /// </param>
 /// <param name="certFileName">
 /// <para>The encryption certificate file path.</para>
 /// </param>
 /// <param name="algorithmOid">
 /// <para>The encryption algorithm object identifier (OID).</para>
 /// </param>
 /// <returns>
 /// <para>The encrypted text as <see cref="System.String" />.</para>
 /// </returns>
 public static string EncryptTextByCertFile(
     string textToEncrypt,
     string certFileName,
     string algorithmOid)
 {
     using (PinCollection pin = new PinCollection())
     {
         try
         {
             return(NativeTypes.FromNativeString(NativeCommon.FabricEncryptText2(
                                                     pin.AddObject(textToEncrypt),
                                                     pin.AddObject(certFileName),
                                                     pin.AddObject(algorithmOid))));
         }
         catch (Exception ex)
         {
             COMException comEx = Utility.TryTranslateExceptionToCOM(ex);
             if (comEx != null)
             {
                 throw comEx;
             }
             throw;
         }
     }
 }
        internal IntPtr ToNative(PinCollection pinCollection)
        {
            var nativeDescription = new NativeTypes.FABRIC_COMPOSE_DEPLOYMENT_DESCRIPTION();

            nativeDescription.DeploymentName    = pinCollection.AddObject(this.DeploymentName);
            nativeDescription.ComposeFilePath   = pinCollection.AddObject(this.ComposeFilePath);
            nativeDescription.OverridesFilePath = IntPtr.Zero;

            if (this.ContainerRepositoryUserName != null)
            {
                nativeDescription.ContainerRepositoryUserName = pinCollection.AddObject(this.ContainerRepositoryUserName);
            }
            else
            {
                nativeDescription.ContainerRepositoryUserName = IntPtr.Zero;
            }

            if (this.ContainerRepositoryPassword != null)
            {
                nativeDescription.ContainerRepositoryPassword = pinCollection.AddObject(this.ContainerRepositoryPassword);
            }
            else
            {
                nativeDescription.ContainerRepositoryPassword = IntPtr.Zero;
            }

            nativeDescription.IsRepositoryPasswordEncrypted = NativeTypes.ToBOOLEAN(this.IsRepositoryPasswordEncrypted);

            return(pinCollection.AddBlittable(nativeDescription));
        }
Ejemplo n.º 6
0
        internal IntPtr ToNative(PinCollection pinCollection)
        {
            var nativeDescription = new NativeTypes.FABRIC_NODE_QUERY_DESCRIPTION();

            nativeDescription.NodeNameFilter = pinCollection.AddObject(this.NodeNameFilter);

            var ex1 = new NativeTypes.FABRIC_NODE_QUERY_DESCRIPTION_EX1();

            ex1.ContinuationToken = pinCollection.AddObject(this.ContinuationToken);

            var ex2 = new NativeTypes.FABRIC_NODE_QUERY_DESCRIPTION_EX2();

            ex2.NodeStatusFilter = (UInt32)this.NodeStatusFilter;

            var ex3 = new NativeTypes.FABRIC_NODE_QUERY_DESCRIPTION_EX3();

            if (this.MaxResults.HasValue)
            {
                ex3.MaxResults = this.MaxResults.Value;
            }

            ex3.Reserved = IntPtr.Zero;
            ex2.Reserved = pinCollection.AddBlittable(ex3);

            ex1.Reserved = pinCollection.AddBlittable(ex2);

            nativeDescription.Reserved = pinCollection.AddBlittable(ex1);
            return(pinCollection.AddBlittable(nativeDescription));
        }
Ejemplo n.º 7
0
        internal IntPtr ToNative(PinCollection pin)
        {
            var initializationData = NativeTypes.ToNativeBytes(pin, this.InitializationData);

            var serviceDnsName = "";

            if (!string.IsNullOrWhiteSpace(this.ServiceDnsName))
            {
                serviceDnsName = this.ServiceDnsName;
            }

            var desc = new NativeTypes.FABRIC_SERVICE_FROM_TEMPLATE_DESCRIPTION
            {
                ApplicationName = pin.AddObject(this.ApplicationName),
                ServiceName     = pin.AddObject(this.ServiceName),
                ServiceDnsName  = pin.AddBlittable(serviceDnsName),
                ServiceTypeName = pin.AddObject(this.ServiceTypeName),
                ServicePackageActivationMode = InteropHelpers.ToNativeServicePackageActivationMode(this.ServicePackageActivationMode),
                InitializationDataSize       = initializationData.Item1,
                InitializationData           = initializationData.Item2,
                Reserved = IntPtr.Zero
            };

            return(pin.AddBlittable(desc));
        }
Ejemplo n.º 8
0
 internal unsafe void ToNative(PinCollection pin, out NativeTypes.FABRIC_TOKEN_SERVICE_METADATA serviceMetadata)
 {
     serviceMetadata.Metadata       = pin.AddObject(this.Metadata);
     serviceMetadata.ServiceName    = pin.AddObject(this.ServiceName);
     serviceMetadata.ServiceDnsName = pin.AddObject(this.ServiceDnsName);
     serviceMetadata.Reserved       = IntPtr.Zero;
 }
Ejemplo n.º 9
0
        internal IntPtr ToNative(PinCollection pinCollection)
        {
            var nativeDescription = new NativeTypes.FABRIC_APPLICATION_TYPE_PAGED_QUERY_DESCRIPTION();

            nativeDescription.ApplicationTypeNameFilter = pinCollection.AddObject(this.ApplicationTypeNameFilter);

            // bools are not blittable (directly readable in native)
            nativeDescription.ExcludeApplicationParameters = NativeTypes.ToBOOLEAN(this.ExcludeApplicationParameters);
            nativeDescription.ContinuationToken            = pinCollection.AddObject(this.ContinuationToken);
            nativeDescription.MaxResults = this.MaxResults;

            var ex1 = new NativeTypes.FABRIC_APPLICATION_TYPE_PAGED_QUERY_DESCRIPTION_EX1();

            ex1.ApplicationTypeVersionFilter = pinCollection.AddObject(this.ApplicationTypeVersionFilter);

            var ex2 = new NativeTypes.FABRIC_APPLICATION_TYPE_PAGED_QUERY_DESCRIPTION_EX2();

            ex2.ApplicationTypeDefinitionKindFilter = (UInt32)this.ApplicationTypeDefinitionKindFilter;
            ex2.Reserved = IntPtr.Zero;

            ex1.Reserved = pinCollection.AddBlittable(ex2);

            nativeDescription.Reserved = pinCollection.AddBlittable(ex1);

            return(pinCollection.AddBlittable(nativeDescription));
        }
Ejemplo n.º 10
0
        internal override unsafe IntPtr ToNative(PinCollection pin, out NativeTypes.FABRIC_SERVICE_PARTITION_KIND kind)
        {
            var nativeDescription = new NativeTypes.FABRIC_NAMED_REPARTITION_DESCRIPTION[1];

            var toAddArray = new IntPtr[this.NamesToAdd.Count];

            for (var ix = 0; ix < toAddArray.Length; ++ix)
            {
                toAddArray[ix] = pin.AddObject(this.NamesToAdd[ix]);
            }
            nativeDescription[0].NamesToAddCount = (uint)toAddArray.Length;
            nativeDescription[0].NamesToAdd      = pin.AddBlittable(toAddArray);

            var toRemoveArray = new IntPtr[this.NamesToRemove.Count];

            for (var ix = 0; ix < toRemoveArray.Length; ++ix)
            {
                toRemoveArray[ix] = pin.AddObject(this.NamesToRemove[ix]);
            }
            nativeDescription[0].NamesToRemoveCount = (uint)toRemoveArray.Length;
            nativeDescription[0].NamesToRemove      = pin.AddBlittable(toRemoveArray);

            kind = NativeTypes.FABRIC_SERVICE_PARTITION_KIND.FABRIC_SERVICE_PARTITION_KIND_NAMED;

            return(pin.AddBlittable(nativeDescription));
        }
 internal unsafe void ToNative(PinCollection pinCollection, out NativeImageStore.FABRIC_IMAGE_STORE_LIST_DESCRIPTION description)
 {
     description.RemoteLocation    = pinCollection.AddObject(this.RemoteLocation);
     description.ContinuationToken = pinCollection.AddObject(this.ContinuationToken);
     description.IsRecursive       = NativeTypes.ToBOOLEAN(IsRecursive);
     description.Reserved          = IntPtr.Zero;
 }
        internal IntPtr ToNative(PinCollection pinCollection)
        {
            var nativeDescription = new NativeTypes.FABRIC_COMPOSE_DEPLOYMENT_UPGRADE_DESCRIPTION();

            nativeDescription.DeploymentName         = pinCollection.AddObject(this.DeploymentName);
            nativeDescription.ComposeFilePaths.Count = (uint)this.ComposeFilePaths.Length;

            if (this.ComposeFilePaths.Length != 0)
            {
                var nativeArray = new IntPtr[this.ComposeFilePaths.Length];
                for (int i = 0; i < this.ComposeFilePaths.Length; ++i)
                {
                    nativeArray[i] = pinCollection.AddBlittable(this.ComposeFilePaths[i]);
                }

                nativeDescription.ComposeFilePaths.Items = pinCollection.AddBlittable(nativeArray);
            }
            else
            {
                nativeDescription.ComposeFilePaths.Items = IntPtr.Zero;
            }

            nativeDescription.ServiceFabricSettingsFilePaths.Count = 0;
            nativeDescription.ServiceFabricSettingsFilePaths.Items = IntPtr.Zero;

            var rollingUpgradePolicyDescription = this.UpgradePolicyDescription as RollingUpgradePolicyDescription;

            if (rollingUpgradePolicyDescription != null)
            {
                nativeDescription.UpgradeKind = NativeTypes.FABRIC_APPLICATION_UPGRADE_KIND.FABRIC_APPLICATION_UPGRADE_KIND_ROLLING;
                nativeDescription.UpgradePolicyDescription = rollingUpgradePolicyDescription.ToNative(pinCollection);
            }
            else
            {
                throw new ArgumentException("description.UpgradePolicyDescription");
            }

            if (this.ContainerRegistryUserName != null)
            {
                nativeDescription.ContainerRegistryUserName = pinCollection.AddObject(this.ContainerRegistryUserName);
            }
            else
            {
                nativeDescription.ContainerRegistryUserName = IntPtr.Zero;
            }

            if (this.ContainerRegistryPassword != null)
            {
                nativeDescription.ContainerRegistryPassword = pinCollection.AddObject(this.ContainerRegistryPassword);
            }
            else
            {
                nativeDescription.ContainerRegistryPassword = IntPtr.Zero;
            }

            nativeDescription.IsRegistryPasswordEncrypted = NativeTypes.ToBOOLEAN(this.IsRegistryPasswordEncrypted);

            return(pinCollection.AddBlittable(nativeDescription));
        }
        internal IntPtr ToNative(PinCollection pinCollection)
        {
            var nativeDescription = new NativeTypes.FABRIC_APPLICATION_DESCRIPTION();

            nativeDescription.ApplicationName        = pinCollection.AddObject(this.ApplicationName);
            nativeDescription.ApplicationTypeName    = pinCollection.AddObject(this.ApplicationTypeName);
            nativeDescription.ApplicationTypeVersion = pinCollection.AddObject(this.ApplicationTypeVersion);

            if (this.ApplicationParameters.Count != 0)
            {
                var applicationParameterList = new ApplicationParameterList(this.ApplicationParameters);
                nativeDescription.ApplicationParameters = applicationParameterList.ToNative(pinCollection);
            }
            else
            {
                nativeDescription.ApplicationParameters = IntPtr.Zero;
            }

            if (this.MaximumNodes > 0 || this.MinimumNodes > 0 || this.Metrics != null)
            {
                var nativeDescriptionEx1 = new NativeTypes.FABRIC_APPLICATION_DESCRIPTION_EX1();
                var nativeApplicationCapacityDescription = new NativeTypes.FABRIC_APPLICATION_CAPACITY_DESCRIPTION();
                nativeApplicationCapacityDescription.MaximumNodes = checked ((uint)this.MaximumNodes);
                nativeApplicationCapacityDescription.MinimumNodes = checked ((uint)this.MinimumNodes);

                var nativeMetricsList = new NativeTypes.FABRIC_APPLICATION_METRIC_LIST();
                if (null != this.Metrics)
                {
                    nativeMetricsList.Count = (uint)this.Metrics.Count;
                    if (this.Metrics.Count > 0)
                    {
                        var nativeMetricsArray = new NativeTypes.FABRIC_APPLICATION_METRIC_DESCRIPTION[this.Metrics.Count];
                        for (int i = 0; i < this.Metrics.Count; i++)
                        {
                            Metrics[i].ToNative(pinCollection, ref nativeMetricsArray[i]);
                        }

                        nativeMetricsList.Metrics = pinCollection.AddBlittable(nativeMetricsArray);
                    }
                    else
                    {
                        nativeMetricsList.Metrics = IntPtr.Zero;
                    }
                }
                else
                {
                    nativeMetricsList.Count   = 0;
                    nativeMetricsList.Metrics = IntPtr.Zero;
                }
                nativeApplicationCapacityDescription.Metrics = pinCollection.AddBlittable(nativeMetricsList);

                nativeDescriptionEx1.ApplicationCapacity = pinCollection.AddBlittable(nativeApplicationCapacityDescription);

                nativeDescription.Reserved = pinCollection.AddBlittable(nativeDescriptionEx1);
            }

            return(pinCollection.AddBlittable(nativeDescription));
        }
Ejemplo n.º 14
0
        internal NativeTypes.FABRIC_SECRET_REFERENCE ToNative(PinCollection pinCollection)
        {
            var nativeSecretRef = new NativeTypes.FABRIC_SECRET_REFERENCE();

            nativeSecretRef.Name    = pinCollection.AddObject(this.Name);
            nativeSecretRef.Version = pinCollection.AddObject(this.Version);

            return(nativeSecretRef);
        }
Ejemplo n.º 15
0
        internal NativeTypes.FABRIC_SECRET ToNative(PinCollection pinCollection)
        {
            var nativeSecret = new NativeTypes.FABRIC_SECRET();

            nativeSecret.Name    = pinCollection.AddObject(this.Name);
            nativeSecret.Version = pinCollection.AddObject(this.Version);
            nativeSecret.Value   = pinCollection.AddObject(this.Value);

            return(nativeSecret);
        }
        internal override IntPtr ToNativeValue(PinCollection pinCollection)
        {
            var nativeDeployedApplicationHealthReport = new NativeTypes.FABRIC_DEPLOYED_APPLICATION_HEALTH_REPORT();

            nativeDeployedApplicationHealthReport.ApplicationName   = pinCollection.AddObject(this.ApplicationName);
            nativeDeployedApplicationHealthReport.NodeName          = pinCollection.AddObject(this.NodeName);
            nativeDeployedApplicationHealthReport.HealthInformation = this.HealthInformation.ToNative(pinCollection);

            return(pinCollection.AddBlittable(nativeDeployedApplicationHealthReport));
        }
Ejemplo n.º 17
0
        internal IntPtr ToNative(PinCollection pinCollection)
        {
            var nativeDescription = new NativeTypes.FABRIC_SERVICE_GROUP_MEMBER_QUERY_DESCRIPTION();

            nativeDescription.Reserved = IntPtr.Zero;

            nativeDescription.ApplicationName   = pinCollection.AddObject(this.ApplicationName);
            nativeDescription.ServiceNameFilter = pinCollection.AddObject(this.ServiceNameFilter);
            return(pinCollection.AddBlittable(nativeDescription));
        }
        internal IntPtr ToNative(PinCollection pinCollection)
        {
            var nativeDescription = new NativeTypes.FABRIC_DEPLOYED_SERVICE_PACKAGE_QUERY_DESCRIPTION();

            nativeDescription.Reserved = IntPtr.Zero;

            nativeDescription.ApplicationName           = pinCollection.AddObject(this.ApplicationName);
            nativeDescription.NodeName                  = pinCollection.AddObject(this.NodeName);
            nativeDescription.ServiceManifestNameFilter = pinCollection.AddObject(this.ServiceManifestNameFilter);
            return(pinCollection.AddBlittable(nativeDescription));
        }
Ejemplo n.º 19
0
 private NativeCommon.IFabricAsyncOperationContext InvokeInfrastructureQueryAsyncBeginWrapper(Uri serviceName, string command, TimeSpan timeout, NativeCommon.IFabricAsyncOperationCallback callback)
 {
     using (var pin = new PinCollection())
     {
         return(this.nativeInfraServiceClient.BeginInvokeInfrastructureQuery(
                    pin.AddObject(serviceName),
                    pin.AddObject(command),
                    Utility.ToMilliseconds(timeout, "timeout"),
                    callback));
     }
 }
        internal IntPtr ToNative(PinCollection pinCollection)
        {
            var nativeDescription = new NativeTypes.FABRIC_SERVICE_TYPE_QUERY_DESCRIPTION();

            nativeDescription.Reserved = IntPtr.Zero;

            nativeDescription.ApplicationTypeName    = pinCollection.AddObject(ApplicationTypeName);
            nativeDescription.ApplicationTypeVersion = pinCollection.AddObject(ApplicationTypeVersion);
            nativeDescription.ServiceTypeNameFilter  = pinCollection.AddObject(ServiceTypeNameFilter);
            return(pinCollection.AddBlittable(nativeDescription));
        }
        internal IntPtr ToNative(PinCollection pinCollection)
        {
            var nativeDescription = new NativeTypes.FABRIC_NETWORK_APPLICATION_QUERY_DESCRIPTION();

            nativeDescription.NetworkName           = pinCollection.AddObject(this.NetworkName);
            nativeDescription.ApplicationNameFilter = pinCollection.AddObject(this.ApplicationNameFilter);
            nativeDescription.PagingDescription     = this.ToNativePagingDescription(pinCollection);
            nativeDescription.Reserved = IntPtr.Zero;

            return(pinCollection.AddBlittable(nativeDescription));
        }
Ejemplo n.º 22
0
        internal IntPtr ToNative(PinCollection pin)
        {
            var nativeMovePrimaryResult = new NativeTypes.FABRIC_MOVE_PRIMARY_RESULT
            {
                NodeName    = pin.AddObject(this.NodeName),
                ServiceName = pin.AddObject(this.SelectedPartition.ServiceName),
                PartitionId = this.SelectedPartition.PartitionId
            };

            return(pin.AddBlittable(nativeMovePrimaryResult));
        }
Ejemplo n.º 23
0
 private static void ExpandSfpkgHelper(
     string sfpkgFilePath,
     string appPackageRootDirectory)
 {
     using (var pin = new PinCollection())
     {
         NativeImageStore.ExpandSfpkg(
             pin.AddObject(sfpkgFilePath),
             pin.AddObject(appPackageRootDirectory));
     }
 }
        internal IntPtr ToNative(PinCollection pinCollection)
        {
            var nativeDescription = new NativeTypes.FABRIC_COMPOSE_DEPLOYMENT_STATUS_QUERY_DESCRIPTION();

            nativeDescription.DeploymentNameFilter = pinCollection.AddObject(this.DeploymentNameFilter);
            nativeDescription.ContinuationToken    = pinCollection.AddObject(this.ContinuationToken);
            nativeDescription.MaxResults           = (long)this.MaxResults;

            nativeDescription.Reserved = IntPtr.Zero;

            return(pinCollection.AddBlittable(nativeDescription));
        }
Ejemplo n.º 25
0
        internal IntPtr ToNative(PinCollection pin)
        {
            var nativeMoveSecondaryResult = new NativeTypes.FABRIC_MOVE_SECONDARY_RESULT
            {
                CurrentNodeName = pin.AddObject(this.CurrentSecondaryNodeName),
                NewNodeName     = pin.AddObject(this.NewSecondaryNodeName),
                ServiceName     = pin.AddObject(this.SelectedPartition.ServiceName),
                PartitionId     = this.SelectedPartition.PartitionId
            };

            return(pin.AddBlittable(nativeMoveSecondaryResult));
        }
Ejemplo n.º 26
0
        internal IntPtr ToNative(PinCollection pinCollection)
        {
            var nativeUploadInfo = new NativeBackupRestoreTypes.FABRIC_BACKUP_UPLOAD_INFO
            {
                BackupMetadataFilePath = pinCollection.AddObject(this.backupMetadataFilePath),
                LocalBackupPath        = pinCollection.AddObject(this.uploadFolderOrFileLocation),
                DestinationFolderName  = pinCollection.AddObject(this.destinationFolderName),
                Reserved = IntPtr.Zero,
            };

            return(pinCollection.AddBlittable(nativeUploadInfo));
        }
Ejemplo n.º 27
0
        internal override IntPtr ToNativeValue(PinCollection pin)
        {
            var desc = new NativeTypes.FABRIC_EXTERNAL_STORE_PROVISION_APPLICATION_TYPE_DESCRIPTION();

            desc.Async = NativeTypes.ToBOOLEAN(this.Async);
            desc.ApplicationPackageDownloadUri = pin.AddObject(this.ApplicationPackageDownloadUri);
            desc.ApplicationTypeName           = pin.AddObject(this.ApplicationTypeName);
            desc.ApplicationTypeVersion        = pin.AddObject(this.ApplicationTypeVersion);
            desc.Reserved = IntPtr.Zero;

            return(pin.AddBlittable(desc));
        }
Ejemplo n.º 28
0
 public static string EncryptValue(string thumbprint, string storeLocation, string textToEncrypt)
 {
     using (PinCollection pin = new PinCollection())
     {
         return(NativeTypes.FromNativeString(NativeCommon.FabricEncryptText(
                                                 pin.AddObject(textToEncrypt),
                                                 pin.AddObject(thumbprint),
                                                 pin.AddObject(storeLocation),
                                                 NativeTypes.FABRIC_X509_STORE_LOCATION.FABRIC_X509_STORE_LOCATION_LOCALMACHINE,
                                                 IntPtr.Zero)));
     }
 }
Ejemplo n.º 29
0
 private void DownloadContentWrapper(string remoteSource, string localDestination, IImageStoreProgressHandler progressHandler, UInt32 timeoutMilliseconds, CopyFlag imageCopyFlag)
 {
     using (var pin = new PinCollection())
     {
         this.nativeClient.DownloadContent2(
             pin.AddObject(remoteSource),
             pin.AddObject(localDestination),
             progressHandler == null ? null : new NativeImageStoreProgressEventHandlerBroker(progressHandler),
             timeoutMilliseconds,
             ToNative(imageCopyFlag));
     }
 }
Ejemplo n.º 30
0
 private void CopyContentWrapper(string remoteSource, string remoteDestination, UInt32 timeoutMilliseconds, string[] skipFiles, CopyFlag imageCopyFlag, bool checkMarkFile)
 {
     using (var pin = new PinCollection())
     {
         this.nativeClient.CopyContent(
             pin.AddObject(remoteSource),
             pin.AddObject(remoteDestination),
             timeoutMilliseconds,
             NativeTypes.ToNativeStringList(pin, skipFiles),
             ToNative(imageCopyFlag),
             NativeTypes.ToBOOLEAN(checkMarkFile));
     }
 }