public virtual void Save() { voxelFilePath = controller.voxelFilePath; voxelFileGUID = controller.voxelFileGUID; voxelFileObject = controller.voxelFileObject; voxelFileSubIndex = controller.voxelFileSubIndex; legacyVoxImport = controller.legacyVoxImport; legacySubAssetNaming = controller.legacyAssetNaming; importMode = controller.importMode; importFlags = controller.importFlags; importScale = controller.importScale; importOffset = controller.importOffset; enableFaceFlags = controller.enableFaceFlags; combineFaces = controller.combineFaces; ignoreCavity = controller.ignoreCavity; shareSameFace = controller.shareSameFace; removeUnusedPalettes = controller.removeUnusedPalettes; generateLightmapUVs = controller.generateLightmapUVs; generateLightmapUVsAngleError = controller.generateLightmapUVsAngleError; generateLightmapUVsAreaError = controller.generateLightmapUVsAreaError; generateLightmapUVsHardAngle = controller.generateLightmapUVsHardAngle; generateLightmapUVsPackMargin = controller.generateLightmapUVsPackMargin; generateTangents = controller.generateTangents; meshFaceVertexOffset = controller.meshFaceVertexOffset; generateMipMaps = controller.generateMipMaps; if (controller.disableData != null) { disableData = controller.disableData.Clone(); } else { disableData = null; } if (controller.materialData != null) { materialData = new MaterialData[controller.materialData.Count]; for (int i = 0; i < controller.materialData.Count; i++) { if (controller.materialData[i] != null) { materialData[i] = controller.materialData[i].Clone(); } } } else { materialData = null; } materialIndexes = controller.materialIndexes != null?controller.materialIndexes.ToArray() : null; }
public virtual void Save() { voxelFilePath = controller.voxelFilePath; voxelFileGUID = controller.voxelFileGUID; voxelFileObject = controller.voxelFileObject; voxelFileSubIndex = controller.voxelFileSubIndex; legacyVoxImport = controller.legacyVoxImport; importMode = controller.importMode; importFlags = controller.importFlags; importScale = controller.importScale; importOffset = controller.importOffset; enableFaceFlags = controller.enableFaceFlags; generateLightmapUVs = controller.generateLightmapUVs; generateLightmapUVsAngleError = controller.generateLightmapUVsAngleError; generateLightmapUVsAreaError = controller.generateLightmapUVsAreaError; generateLightmapUVsHardAngle = controller.generateLightmapUVsHardAngle; generateLightmapUVsPackMargin = controller.generateLightmapUVsPackMargin; generateTangents = controller.generateTangents; meshFaceVertexOffset = controller.meshFaceVertexOffset; generateMipMaps = controller.generateMipMaps; if (controller.disableData != null) disableData = controller.disableData.Clone(); else disableData = null; if (controller.materialData != null) { materialData = new MaterialData[controller.materialData.Count]; for (int i = 0; i < controller.materialData.Count; i++) { if (controller.materialData[i] != null) materialData[i] = controller.materialData[i].Clone(); } } else { materialData = null; } materialIndexes = controller.materialIndexes != null ? controller.materialIndexes.ToArray() : null; }
/// <summary> /// Parse the RopSynchronizationImportMessageChangeRequest structure. /// </summary> /// <param name="s">An stream containing RopSynchronizationImportMessageChangeRequest structure.</param> public override void Parse(Stream s) { base.Parse(s); this.RopId = (RopIdType)ReadByte(); this.LogonId = ReadByte(); this.InputHandleIndex = ReadByte(); this.OutputHandleIndex = ReadByte(); this.ImportFlag = (ImportFlag)ReadByte(); this.PropertyValueCount = ReadUshort(); TaggedPropertyValue[] InterValue = new TaggedPropertyValue[(int)this.PropertyValueCount]; for (int i = 0; i < this.PropertyValueCount; i++) { InterValue[i] = new TaggedPropertyValue(); InterValue[i].Parse(s); } this.PropertyValues = InterValue; }
/// <summary> /// Reset the adapter. /// </summary> public override void Reset() { try { if (this.needDoCleanup) { this.RevertPublicFolder(LogonFlags.PublicFolder); foreach (KeyValuePair<int, OxcropsClient> oxcrop in this.oxcropsClient) { if (oxcrop.Key == 1 || (oxcrop.Key == 2 && this.isSecondSUTServerConnected)) { this.HardDeleteMessageAndSubfolders(oxcrop.Key); } } } foreach (KeyValuePair<int, OxcropsClient> oxcrop in this.oxcropsClient) { bool result = this.oxcropsClient[oxcrop.Key].Disconnect(); string comment = "Disconnecting server" + oxcrop.Key + " should be successful."; Site.Assert.IsTrue(result, comment); } } catch (SEHException e) { Site.Assume.Fail(e.Message); } finally { this.isImportMessageMoveROP = false; this.importMessageTimes = 0; this.isNonImportMessageChangeOperation = false; this.lastChangeMadeByServer = false; this.lastChangeMadeByClient = false; this.importFlag = ImportFlag.InvalidParameter; this.importPidTagChangeKeyValue = new byte[22]; this.previousGetBufferResult = RopResult.Success; this.needDoCleanup = true; this.isOrderByDeliveryTimeExtraFlagNotSet = false; AdapterHelper.ClearIndex(); this.isSecondSUTServerConnected = false; this.localIdOffSet = 0; this.localId = new byte[6]; this.serverReplicaGuid = new Guid(); this.localReplicaGuid = Guid.NewGuid(); this.handleContainer.Clear(); this.objectIdContainer.Clear(); this.streamBufferContainer.Clear(); this.icsStateContainer.Clear(); this.existNoPermissionFolder = false; this.cnsetRead.Clear(); this.cnsetSeen.Clear(); this.cnsetSeenFAI.Clear(); base.Reset(); } }
/// <summary> /// Import new messages or changes to existing messages into the server replica. /// </summary> /// <param name="serverId">A 32-bit signed integer represent the Identity of server.</param> /// <param name="uploadContextHandleIndex">A synchronization upload context handle index.</param> /// <param name="localMessageidIndex">Message Id index.</param> /// <param name="importFlag">An 8-bit flag .</param> /// <param name="importMessageHandleIndex">The index of handle that indicate the Message object into which the client will upload the rest of the message changes.</param> /// <returns>Indicate the result of this ROP operation.</returns> public RopResult SynchronizationImportMessageChange(int serverId, int uploadContextHandleIndex, int localMessageidIndex, ImportFlag importFlag, out int importMessageHandleIndex) { // Initialize ROP data. importMessageHandleIndex = -1; uint synchronizationImportMessageChangeHandle = this.handleContainer[uploadContextHandleIndex]; RopResult result = RopResult.InvalidParameter; // Construct ROP request. RopSynchronizationImportMessageChangeRequest synchronizationImportMessageChangeRequest; // Synchronization ImportHierarchy Change. TaggedPropertyValue[] messagePropertyValues = this.CreateSamplePropertyValues(localMessageidIndex); // Construct the RopSynchronizationImportMessageChange request. synchronizationImportMessageChangeRequest.RopId = 0x72; synchronizationImportMessageChangeRequest.LogonId = 0x00; synchronizationImportMessageChangeRequest.InputHandleIndex = 0x00; synchronizationImportMessageChangeRequest.OutputHandleIndex = 0x01; synchronizationImportMessageChangeRequest.ImportFlag = (byte)importFlag; synchronizationImportMessageChangeRequest.PropertyValueCount = (ushort)messagePropertyValues.Length; synchronizationImportMessageChangeRequest.PropertyValues = messagePropertyValues; // Send ROP request and get response. RopSynchronizationImportMessageChangeResponse synchronizationImportMessageChangeResponse = (RopSynchronizationImportMessageChangeResponse)this.Process(serverId, synchronizationImportMessageChangeRequest, synchronizationImportMessageChangeHandle); result = (RopResult)synchronizationImportMessageChangeResponse.ReturnValue; if (result == RopResult.Success) { importMessageHandleIndex = AdapterHelper.GetHandleIndex(); this.handleContainer.Add(importMessageHandleIndex, this.responseSOHs[synchronizationImportMessageChangeResponse.OutputHandleIndex]); this.importFlag = importFlag; // Verify ROP SynchronizationImportMessageChange this.VerifyRopSynchronizationImportMessageChange(synchronizationImportMessageChangeResponse); this.importMessageTimes += 1; } return result; }
private string Import_INTERNAL(string filename, bool silent, ImportFlag flag) { filename = filename.ToLower(); var filepath = System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), filename + ".xml"); if (File.Exists(filepath) == false) { if (silent == true) return string.Empty; return "File `" + filepath + "` not found."; } this.screen.AddLine("<color=grey>Importing `" + filepath + "`...</color>"); XmlSerializer serializer = new XmlSerializer(typeof(Data)); FileStream fs = new FileStream(filepath, FileMode.Open); var data = (Data)serializer.Deserialize(fs); if (flag == ImportFlag.Override) { this.data = data; this.AutoStartPlay(this.data); } else if (flag == ImportFlag.Merge) { foreach (var newItem in data.items) { if (this.Exists(newItem.name) == false) { var item = new Data.Item(newItem); this.data.items.Add(item); } } foreach (var item in this.data.items) { foreach (var newItem in data.items) { if (item.name.ToLower().Trim() == newItem.name.ToLower().Trim()) { item.autostart = newItem.autostart; item.commands = newItem.commands; if (item.autostart == true) { this.Play(item.name); } } } } } fs.Close(); this.Save(); this.screen.AddLine("<color=grey>File `" + filepath + "` has been imported.</color>"); return string.Empty; }
public string Import(string filename, ImportFlag flag) { return this.Import_INTERNAL(filename, silent: false, flag: flag); }
private string Import_INTERNAL(string filename, bool silent, ImportFlag flag) { filename = filename.ToLower(); var filepath = System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), filename + ".xml"); if (File.Exists(filepath) == false) { if (silent == true) { return(string.Empty); } return("File `" + filepath + "` not found."); } this.screen.AddLine("<color=grey>Importing `" + filepath + "`...</color>"); XmlSerializer serializer = new XmlSerializer(typeof(Data)); FileStream fs = new FileStream(filepath, FileMode.Open); var data = (Data)serializer.Deserialize(fs); if (flag == ImportFlag.Override) { this.data = data; this.AutoStartPlay(this.data); } else if (flag == ImportFlag.Merge) { foreach (var newItem in data.items) { if (this.Exists(newItem.name) == false) { var item = new Data.Item(newItem); this.data.items.Add(item); } } foreach (var item in this.data.items) { foreach (var newItem in data.items) { if (item.name.ToLower().Trim() == newItem.name.ToLower().Trim()) { item.autostart = newItem.autostart; item.commands = newItem.commands; if (item.autostart == true) { this.Play(item.name); } } } } } fs.Close(); this.Save(); this.screen.AddLine("<color=grey>File `" + filepath + "` has been imported.</color>"); return(string.Empty); }
public string Import(string filename, ImportFlag flag) { return(this.Import_INTERNAL(filename, silent: false, flag: flag)); }
public static RopResult SynchronizationImportMessageChange(int serverId, int uploadContextHandleIndex, int messageIdindex, ImportFlag importFlag, out int importMessageHandleIndex) { // The contractions conditions. Condition.IsTrue(connections.Count > 0); Condition.IsTrue(connections.Keys.Contains(serverId)); Condition.IsTrue(connections[serverId].UploadContextContainer.Count > 0 && connections[serverId].LogonHandleIndex > 0); // Initialize the return value. RopResult result = RopResult.InvalidParameter; importMessageHandleIndex = -1; if ((importFlag & ImportFlag.InvalidParameter) == ImportFlag.InvalidParameter && requirementContainer.ContainsKey(3509001) && requirementContainer[3509001]) { result = RopResult.InvalidParameter; ModelHelper.CaptureRequirement( 3509001, @"[In Appendix A: Product Behavior] If unknown flags are set, implementation does fail the operation. <40> Section 3.2.5.9.4.2: Exchange 2010, Exchange 2013 and Exchange 2016 fail the ROP [RopSynchronizationImportMessageChange] if unknown bit flags are set."); return result; } else if ((importFlag & ImportFlag.InvalidParameter) == ImportFlag.InvalidParameter && requirementContainer.ContainsKey(350900201) && requirementContainer[350900201]) { result = RopResult.Success; ModelHelper.CaptureRequirement( 350900201, @"[In Appendix A: Product Behavior] If unknown flags are set, implementation does not fail the operation. <41> Section 3.2.5.9.4.2: Exchange 2007 do not fail the ROP [RopSynchronizationImportMessageChange] if unknown bit flags are set."); } // Get ConnectionData value. ConnectionData changeConnection = connections[serverId]; AbstractUploadInfo uploadInfo = new AbstractUploadInfo(); // Identify whether the current Upload information is existent or not. bool isCurrentUploadinfoExist = false; // Record current Upload information. int currentUploadIndex = 0; foreach (AbstractUploadInfo tempUploadInfo in changeConnection.UploadContextContainer) { if (tempUploadInfo.UploadHandleIndex == uploadContextHandleIndex) { // Set the value to the current upload context variable when the current upload context is existent. isCurrentUploadinfoExist = true; uploadInfo = tempUploadInfo; currentUploadIndex = changeConnection.UploadContextContainer.IndexOf(tempUploadInfo); } } if (isCurrentUploadinfoExist) { // Create a new Message AbstractMessage currentMessage = new AbstractMessage(); // Identify whether the current message is existent or not. bool isMessageExist = false; // Record the current Message. int currentMessageIndex = 0; foreach (AbstractMessage tempMessage in changeConnection.MessageContainer) { if (tempMessage.MessageIdIndex == messageIdindex) { // Set the value to the variable when the message is existent. isMessageExist = true; currentMessage = tempMessage; currentMessageIndex = changeConnection.MessageContainer.IndexOf(tempMessage); } } if (isMessageExist) { // Set new change number currentMessage.ChangeNumberIndex = ModelHelper.GetChangeNumberIndex(); ModelHelper.CaptureRequirement(1898, "[In Identifying Objects and Maintaining Change Numbers]A new change number is assigned to a messaging object each time it is modified."); // Update the MessageContainer changeConnection.MessageContainer = changeConnection.MessageContainer.Update(currentMessageIndex, currentMessage); } else { // Set the new message handle currentMessage.MessageHandleIndex = AdapterHelper.GetHandleIndex(); // Set property value of abstract message object currentMessage.FolderHandleIndex = uploadInfo.RelatedObjectHandleIndex; currentMessage.FolderIdIndex = uploadInfo.RelatedObjectIdIndex; currentMessage.MessageProperties = new Sequence<string>(); currentMessage.IsRead = true; if ((importFlag & ImportFlag.Normal) == ImportFlag.Normal) { currentMessage.IsFAImessage = false; } if ((importFlag & ImportFlag.Associated) == ImportFlag.Associated) { currentMessage.IsFAImessage = true; // When the Associated is set and the message being imported is an FAI message this requirement is captured. ModelHelper.CaptureRequirement( 813, @"[In RopSynchronizationImportMessageChange ROP Request Buffer] [ImportFlag,when the name is Associated, the value is 0x10] If this flag is set, the message being imported is an FAI message."); } else { currentMessage.IsFAImessage = false; // When the Associated is not set and the message being imported is a normal message this requirement is captured. ModelHelper.CaptureRequirement( 814, @"[In RopSynchronizationImportMessageChange ROP Request Buffer] [ImportFlag,when the name is Associated, the value is 0x10] If this flag is not set, the message being imported is a normal message."); } // Out the new message handle importMessageHandleIndex = currentMessage.MessageHandleIndex; // Because this is out messageHandle so the OutputServerObject is a Message object. ModelHelper.CaptureRequirement(805, "[In RopSynchronizationImportMessageChange ROP Response Buffer]OutputServerObject: The value of this field MUST be the Message object into which the client will upload the rest of the message changes."); currentMessage.ChangeNumberIndex = ModelHelper.GetChangeNumberIndex(); ModelHelper.CaptureRequirement(1897, "[In Identifying Objects and Maintaining Change Numbers]When a new object is created, it is assigned a change number."); // Add new Message to MessageContainer changeConnection.MessageContainer = changeConnection.MessageContainer.Add(currentMessage); // Record the related FastTransferOperation for Upload Information. uploadInfo.RelatedFastTransferOperation = EnumFastTransferOperation.SynchronizationImportMessageChange; // Update the UploadContextContainer. changeConnection.UploadContextContainer = changeConnection.UploadContextContainer.Update(currentUploadIndex, uploadInfo); connections[serverId] = changeConnection; // Record RopSynchronizationImportMessageChange operation. priorOperation = PriorOperation.RopSynchronizationImportMessageChange; result = RopResult.Success; ModelHelper.CaptureRequirement( 2449, @"[In Uploading Changes Using ICS] Value is Success indicates No error occurred, or a conflict has been resolved."); // Because if the result is success means the messages or changes are imported. ModelHelper.CaptureRequirement( 782, @"[In RopSynchronizationImportMessageChange ROP] The RopSynchronizationImportMessageChange ROP ([MS-OXCROPS] section 2.2.13.2) is used to import new messages or changes to existing messages into the server replica."); } } return result; }