Beispiel #1
0
 public static void SendDeviceJoinEmail(TBEmailValidation emailValidation, DeviceMembership deviceMembership, string[] ownerEmailAddresses)
 {
     string urlLink = GetUrlLink(emailValidation.ID);
     bool isAccount = emailValidation.DeviceJoinConfirmation.AccountID != null;
     string ownerID = isAccount
                          ? emailValidation.DeviceJoinConfirmation.AccountID
                          : emailValidation.DeviceJoinConfirmation.GroupID;
     string emailMessageFormat = InstanceConfiguration.EmailDeviceJoinMessageFormat;
     string message = String.Format(emailMessageFormat, deviceMembership.DeviceDescription,
                                    isAccount ? "account" : "collaboration group", ownerID, urlLink);
     string subject = String.Format(InstanceConfiguration.EmailDeviceJoinSubjectFormat, ownerID);
     foreach (string emailAddress in ownerEmailAddresses)
     {
         SendEmail(FromAddress, emailAddress, subject, message);
     }
 }
 public static void ExecuteMethod_PerformOperation(DeviceMembership currentDevice, DeviceOperationData deviceOperationData)
 {
     switch (deviceOperationData.OperationRequestString)
     {
         case "SYNCCOPYCONTENT":
             performSyncQueryForCopyContent(currentDevice, deviceOperationData);
             break;
         case "DELETEREMOTEDEVICE":
             currentDevice.DeleteInformationObject();
             break;
         case "GETCONTENTMD5LIST":
             getContentMD5List(deviceOperationData);
             break;
         case "COPYSYNCEDCONTENTTOOWNER":
             copySyncedContentToOwner(deviceOperationData);
             break;
         default:
             throw new NotImplementedException("Not implemented RemoteDevice operation for request string: " + deviceOperationData.OperationRequestString);
     }
     deviceOperationData.OperationResult = true;
 }
        private static void performSyncQueryForCopyContent(DeviceMembership currentDevice, DeviceOperationData deviceOperationData)
        {
            string targetNamedFolder = deviceOperationData.OperationParameters != null && deviceOperationData.OperationParameters.Length > 0 ?
                deviceOperationData.OperationParameters[0] : SyncSupport.RelativeRootFolderValue;
            List<ContentItemLocationWithMD5> itemsToCopy = new List<ContentItemLocationWithMD5>();
            List<ContentItemLocationWithMD5> itemsDeleted = new List<ContentItemLocationWithMD5>();
            SyncSupport.CopySourceToTargetMethod copySourceToTarget = (location, blobLocation) => itemsToCopy.Add(new ContentItemLocationWithMD5
                {
                    ContentLocation = StorageSupport.RemoveOwnerPrefixIfExists(location),
                    ItemDatas = new ItemData[] {new ItemData {DataName = "OPTODO", ItemTextData = "COPY"}}
                });
            SyncSupport.DeleteObsoleteTargetMethod deleteObsoleteTarget = (location) =>
                {
                    itemsDeleted.Add(new ContentItemLocationWithMD5
                        {
                            ContentLocation = location,
                            ItemDatas = new ItemData[] { new ItemData { DataName = "OPDONE", ItemTextData = "DELETED"}}
                        });
                    SyncSupport.DeleteObsoleteTarget(location);
                };

            string syncTargetRootFolder = getDeviceInputRoot(currentDevice.ID) + targetNamedFolder;
            if (syncTargetRootFolder.EndsWith("/") == false)
                syncTargetRootFolder += "/";
            SyncSupport.SynchronizeSourceListToTargetFolder(SyncSupport.RelativeRootFolderValue, deviceOperationData.OperationSpecificContentData, syncTargetRootFolder,
                                                            copySourceToTarget, deleteObsoleteTarget);
            deviceOperationData.OperationSpecificContentData = itemsToCopy.Union(itemsDeleted).ToArray();
        }
Beispiel #4
0
 private void CopyContentFrom(DeviceMembership sourceObject)
 {
     DeviceDescription = sourceObject.DeviceDescription;
             SharedSecret = sourceObject.SharedSecret;
             ActiveSymmetricAESKey = sourceObject.ActiveSymmetricAESKey;
             IsValidatedAndActive = sourceObject.IsValidatedAndActive;
 }
Beispiel #5
0
partial         static void CreateCustomDemo(ref DeviceMembership customDemoObject);
Beispiel #6
0
 public static DeviceMembership CreateDefault()
 {
     var result = new DeviceMembership();
             return result;
 }