public override void Execute(IEnumerable <String> arguments) { UserToMirror = arguments.FirstOrDefault(); if (UserToMirror is null) { Writer.WriteLine("Copy disabled"); UpdateState(SettingState.Disable); } if (arguments.Count() > 1) { Mode = (arguments.Skip(1).FirstOrDefault()?.ToLower()) switch { "m" => CopyMode.Mock, "mock" => CopyMode.Mock, "r" => CopyMode.Reverse, "reverse" => CopyMode.Reverse, _ => CopyMode.Default, }; } else { Mode = CopyMode.Default; } MessagePrefix = String.Join(" ", arguments.Skip(Mode == CopyMode.Default ? 1 : 2)); Writer.WriteLine($"Copying user \"{UserToMirror}\" Mode: \"{Mode}\" Prefix: \"{MessagePrefix}\""); UpdateState(SettingState.Enable); }
private void PasteTo(IEnumerable <GameObject> targetObjects, CopyMode copyMode) { foreach (var targetGameObject in targetObjects) { _context.PasteComponents(targetGameObject, copyMode); } }
public void Restore(List <ModifierDTO> dtoList) { mode = CopyMode.Restore; copiedEntries.Clear(); copiedEntries = dtoList.ToList(); PasteCopiedModifiers(); }
/// Paste all components and their checked properties into the target GameObject. public void PasteComponents(GameObject targetGameObject, CopyMode copyMode) { var orderedComponents = SortByRequiredFirst(Components.Where(c => c.Checked)); foreach (var wrapper in orderedComponents) { Type componentType = wrapper.Component.GetType(); if (copyMode == CopyMode.PasteAsNew) { var newComponent = Undo.AddComponent(targetGameObject, componentType); // Might return null if component already exists. if (newComponent != null) { CopyComponentWithUndo(wrapper, newComponent); } } else { var otherComponent = targetGameObject.GetComponent(componentType); if (otherComponent == null) { otherComponent = Undo.AddComponent(targetGameObject, componentType); } // otherComponent can still be null if adding the component failed for any reason. if (otherComponent != null) { CopyComponentWithUndo(wrapper, otherComponent); } } } }
} // ctor internal LuaResult(CopyMode copyMode, object[] values) { if (copyMode != CopyMode.None) { throw new ArgumentException(nameof(copyMode)); } result = values; } // ctor
/// <summary> /// Copies an image from the specified CopyMode part of the screen with the specified dimensions to the system's clipboard. See also: Player.Video.ToClipboard. /// </summary> /// <param name="width">The width of the image.</param> /// <param name="height">The height of the image.</param> /// <param name="mode">A value that indicates the part of the screen to copy. The Player.Copy.Mode setting is not changed.</param> public int ToClipboard(int width, int height, CopyMode mode) { CopyMode oldMode = _base._copyMode; _base._copyMode = mode; ToClipboard(width, height); _base._copyMode = oldMode; return((int)_base._lastError); }
/// <summary> /// Copies an image from the specified CopyMode part of the screen with the specified dimensions to the system's clipboard. See also: Player.Video.ToClipboard. /// </summary> /// <param name="size">The size of the longest side of the image while maintaining the aspect ratio.</param> /// <param name="mode">A value that indicates the part of the screen to copy. The Player.Copy.Mode setting is not changed.</param> public int ToClipboard(int size, CopyMode mode) { CopyMode oldMode = _base._copyMode; _base._copyMode = mode; ToClipboard(size); _base._copyMode = oldMode; return((int)_base._lastError); }
/// <summary> /// Saves an image from the specified CopyMode part of the screen with the specified dimensions to the specified file. See also: Player.Video.ToFile. /// </summary> /// <param name="fileName">The name of the file to save.</param> /// <param name="imageFormat">The file format of the image to save.</param> /// <param name="width">The width of the image to save.</param> /// <param name="height">The height of the image to save.</param> /// <param name="mode">A value that indicates the part of the screen to copy. The Player.Copy.Mode setting is not changed.</param> public int ToFile(string fileName, System.Drawing.Imaging.ImageFormat imageFormat, int width, int height, CopyMode mode) { CopyMode oldMode = _base._copyMode; _base._copyMode = mode; ToFile(fileName, imageFormat, width, height); _base._copyMode = oldMode; return((int)_base._lastError); }
/// <summary> /// Returns an image from the specified part of the screen with the specified dimensions. See also: Player.Video.ToImage. /// </summary> /// <param name="width">The width of the image.</param> /// <param name="height">The height of the image.</param> /// <param name="mode">A value that indicates the part of the screen to copy. The Player.Copy.Mode setting is not changed.</param> public Image ToImage(int width, int height, CopyMode mode) { CopyMode oldMode = _base._copyMode; _base._copyMode = mode; Image image = ToImage(width, height); _base._copyMode = oldMode; return(image); }
/// <summary> /// Returns an image from the specified part of the screen with the specified dimensions. See also: Player.Video.ToImage. /// </summary> /// <param name="size">The size of the longest side of the image while maintaining the aspect ratio.</param> /// <param name="mode">A value that indicates the part of the screen to copy. The Player.Copy.Mode setting is not changed.</param> public Image ToImage(int size, CopyMode mode) { CopyMode oldMode = _base._copyMode; _base._copyMode = mode; Image image = ToImage(size); _base._copyMode = oldMode; return(image); }
public PackageContainerBase(CopyMode mode, PackageContainerBase other, PackageCentral packageCentral = null) { if ((mode & CopyMode.Serialized) > 0 && other != null) { // nothing here } if (packageCentral != null) { _packageCentral = packageCentral; } }
/// <summary> /// toggle copy mode /// </summary> /// <returns>mode is on</returns> private void ToggleCopyModeAlways() { if (this._copyMode == CopyMode.Always) { this._copyMode = CopyMode.None; } else { this._copyMode = CopyMode.Always; } }
/// <summary> /// toggle copy mode /// </summary> /// <returns>mode is on</returns> private void ToggleCopyModeOnce() { if (this._copyMode == CopyMode.Once) { this._copyMode = CopyMode.None; } else { this._copyMode = CopyMode.Once; } }
public PackageContainerBuffered(CopyMode mode, PackageContainerBase other, PackageCentral packageCentral = null) : base(mode, other, packageCentral) { if ((mode & CopyMode.Serialized) > 0 && other != null) { } if ((mode & CopyMode.BusinessData) > 0 && other is PackageContainerBuffered o) { IndirectLoadSave = o.IndirectLoadSave; } }
public void PasteCopiedModifiers() { if (copiedEntries.Count == 0) { return; } copiedEntries.Sort((mod1, mod2) => mod1.startTick.CompareTo(mod2.startTick)); ModifierHandler.Instance.DropCurrentModifier(); QNT_Timestamp newStartTick = Timeline.time; QNT_Timestamp firstTick = new QNT_Timestamp((ulong)copiedEntries.First().startTick); float tickOffset = newStartTick.tick - copiedEntries.First().startTick; posGetter.position = Vector3.zero; float positionOffset = posGetter.position.x - copiedEntries.First().startPosX; float miniOffset = MiniTimeline.Instance.GetXForTheBookmarkThingy() - copiedEntries.First().miniStartX; if (tickOffset == 0 && mode == CopyMode.Copy) { return; } isPasting = mode != CopyMode.Restore; if (mode != CopyMode.Restore) { foreach (ModifierDTO dto in copiedEntries) { dto.startTick += tickOffset; dto.startPosX += positionOffset; dto.miniStartX += miniOffset; if (dto.endTick != 0) { dto.endTick += tickOffset; dto.endPosX += positionOffset; dto.miniEndX += miniOffset; } } } StartCoroutine(ModifierHandler.Instance.LoadModifiers(copiedEntries, false, true)); isPasting = false; DeselectAllModifiers(); if (mode == CopyMode.Restore) { copiedEntries.Clear(); mode = CopyMode.Copy; } else { ModifierUndoRedo.Instance.AddAction(tempCopiedModifiers.ToList(), Action.Create); tempCopiedModifiers.Clear(); } }
public PackageContainerRepoItem(CopyMode mode, PackageContainerBase other, PackageCentral packageCentral = null) : base(mode, other, packageCentral) { if ((mode & CopyMode.Serialized) > 0 && other is PackageContainerRepoItem o) { _assetIds = new List <string>(o.AssetIds); _aasIds = new List <string>(o.AasIds); _location = "" + o.Location; _description = "" + o.Description; _tag = "" + o.Tag; this.CodeType2D = "" + o.CodeType2D; } }
/// <summary> /// Constructor from array. /// </summary> /// <param name="members"></param> /// <param name="createMode"></param> /// <param name="storageMode"></param> public ListBounded(T[] members, CopyMode createMode, StorageMode storageMode = StorageMode.AllocatedArray) { Debug.Assert(!(createMode == CopyMode.ReferencePassedMembers && storageMode == StorageMode.RentedArrayPool)); // inconsistent MaxLength = length = members.Length; if (createMode == CopyMode.ReferencePassedMembers) { array = members; } else { DoCreate(members.Length, storageMode); Array.Copy(members, array, members.Length); } }
/// <summary> /// Window Closed event /// </summary> private void MainWindowMinimized() { if (this._isActivated) { var setting = AppSettingsRepo.GetInstance(); setting.X = this.Left; setting.Y = this.Top; setting.Height = this.Height; setting.Width = this.Width; setting.Save(); this._copyMode = CopyMode.None; this._copyObserver.Stop(); this.ShowWindowTitle(); } }
/// <summary> /// Converts View level CopyMode to CopyMode at service level /// </summary> /// <param name="serviceCopyMode"></param> /// <returns></returns> public static JsonPostsRepositoryService.CopyMode Convert(CopyMode serviceCopyMode) { JsonPostsRepositoryService.CopyMode copyMode = JsonPostsRepositoryService.CopyMode.TEXT; switch (serviceCopyMode) { case CopyMode.HTML: copyMode = JsonPostsRepositoryService.CopyMode.HTML; break; case CopyMode.JSON: copyMode = JsonPostsRepositoryService.CopyMode.JSON; break; } return(copyMode); }
/// <summary> /// Function to flush the cache data into the buffers and render the renderables. /// </summary> /// <param name="drawCall">The draw call that will be used to render the renderables.</param> public void RenderBatches(GorgonDrawIndexCall drawCall) { GorgonVertexBuffer vertexBuffer = VertexBuffer.VertexBuffer; int cacheIndex = _currentVertexIndex - _allocatedVertexCount; while (_allocatedVertexCount > 0) { int vertexCount = _allocatedVertexCount.Min(MaxVertexCount); int indexCount = _indexCount.Min(MaxIndexCount); int byteCount = Gorgon2DVertex.SizeInBytes * vertexCount; // If we've exceeded our vertex or index buffer size, we need to reset from the beginning. if (((_vertexBufferByteOffset + byteCount) >= vertexBuffer.SizeInBytes) || ((_indexStart + _indexCount) >= MaxIndexCount)) { _indexStart = 0; _vertexBufferByteOffset = 0; _vertexBufferIndex = 0; _indexBufferBaseVertexIndex = 0; } CopyMode copyMode = _vertexBufferByteOffset == 0 ? CopyMode.Discard : CopyMode.NoOverwrite; // Copy a chunk of the cache. vertexBuffer.SetData(_vertexCache, cacheIndex, vertexCount, _vertexBufferByteOffset, copyMode); drawCall.BaseVertexIndex = _indexBufferBaseVertexIndex; drawCall.IndexStart = _indexStart; drawCall.IndexCount = indexCount; Graphics.Submit(drawCall); // Move to the next block of bytes to render. _vertexBufferByteOffset += byteCount; _vertexBufferIndex += vertexCount; _allocatedVertexCount -= vertexCount; cacheIndex += vertexCount; _indexStart += indexCount; _indexCount -= indexCount; } // Invalidate the cache. _currentVertexIndex = 0; _allocatedVertexCount = 0; _indexCount = 0; }
/// <summary> /// clipboard change event /// </summary> /// <param name="text">copy text</param> private void ClipboardChanged(string text) { LogUtil.DebugLog("#### ClipboardChanged " + text); if (this._copyMode == CopyMode.Once) { this._copyMode = CopyMode.None; this.StopClipboardObserve(); this.ShowWindowTitle(); } if (0 < text.Length && this.cKeyword.Text != text) { this.Activate(); this.cKeyword.Text = text.Trim(); this.cKeyword.Focus(); this.cKeyword.SelectAll(); DoEvents(); this.Search(); } }
/// <summary> /// Copies a component with all its public and private dynamic fields, and adds it to the given target /// </summary> /// <param name="original">Component to copy</param> /// <param name="to">GameObject to add the component to</param> /// <param name="copyMode">Copy mode</param> /// <param name="removeOriginalComponent">If TRUE, removes the original components after copying it</param> public static T CopyTo <T>(this T original, GameObject to, CopyMode copyMode = CopyMode.AddIfMissing, bool removeOriginalComponent = false) where T : Component { Type type = original.GetType(); Component copy = copyMode == CopyMode.AddIfMissing ? to.GetComponent <T>() : null; if (copy == null) { copy = to.AddComponent(type); } FieldInfo[] fInfos = type.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); foreach (FieldInfo fi in fInfos) { fi.SetValue(copy, fi.GetValue(original)); } if (removeOriginalComponent) { Object.Destroy(original); } return(copy as T); }
private static void CopyFolder(string sourceDir, string targetDir, string filter, CopyMode mode) { CopyTopFiles(sourceDir, targetDir, filter); foreach (var folder in Directory.GetDirectories(sourceDir)) { string target; switch (mode) { case CopyMode.RestoreHierarchie: target = Path.Combine(targetDir, Path.GetFileName(folder)); break; case CopyMode.Flat: target = targetDir; break; default: throw new NotSupportedException("CopyMode " + mode + " is not supported yet"); } CopyFolder(folder, target, filter, mode); } }
public void CutSelectedModifiers() { if (selectedEntries.Count == 0) { return; } mode = CopyMode.Cut; copiedEntries.Clear(); copiedEntries = GetDTOList(); ModifierUndoRedo.Instance.AddAction(selectedEntries.ToList(), Action.Delete); /*for (int i = 0; i < selectedEntries.Count; i++) * { * ModifierHandler.Instance.DeleteModifier(); * selectedEntries[i].Delete(); * }*/ ModifierHandler.Instance.DeleteModifier(); selectedEntries.Clear(); StartCoroutine(ModifierHandler.Instance.IUpdateLevels()); }
public PackageContainerNetworkHttpFile(CopyMode mode, PackageContainerBase other, PackageCentral packageCentral = null, string sourceUri = null, PackageContainerOptionsBase containerOptions = null) : base(mode, other, packageCentral) { if ((mode & CopyMode.Serialized) > 0 && other != null) { } if ((mode & CopyMode.BusinessData) > 0 && other is PackageContainerNetworkHttpFile o) { sourceUri = o.Location; } if (sourceUri != null) { SetNewLocation(sourceUri); } if (containerOptions != null) { ContainerOptions = containerOptions; } }
/// <summary> /// Method that parses the Model object into plain texe, Json, Html /// </summary> /// <param name="model"></param> /// <param name="mode"></param> /// <returns></returns> public string ParseModelData(JsonPostDetailModel model, CopyMode mode) { string data = string.Empty; switch (mode) { case CopyMode.JSON: var jsSerializer = new JavaScriptSerializer(); data = jsSerializer.Serialize(model); break; case CopyMode.HTML: var htmlSerializer = new XmlSerializer(typeof(JsonPostDetailModel)); using (var srtWriter = new StringWriter()) { using (var writer = XmlWriter.Create(srtWriter)) { htmlSerializer.Serialize(writer, model); data = srtWriter.ToString(); //Just Convert the object to Html string representation XmlDocument document = new XmlDocument(); document.LoadXml(data); XmlNode node = document.SelectSingleNode(Constants.JSONPOSTDETAILMODEL); if (node != null) { data = node.InnerXml.ToString(); } } } break; default: return(model.ToString()); } return(data); }
public static void CopyDirectory(string source, string target, CopyMode copyMode, Regex directoryRegex = null, Regex fileRegex = null, Action <string> OnCopiedFile = null) { if (!Directory.Exists(source)) { throw new EBPException("要拷贝的源目录不存在:" + source); } switch (copyMode) { case CopyMode.New: if (Directory.Exists(target)) { throw new EBPException("目录已存在:" + target); } RecursiveCopyDirectory(source, target, directoryRegex, fileRegex, OnCopiedFile); break; case CopyMode.Add: RecursiveCopyDirectory(source, target, directoryRegex, fileRegex, OnCopiedFile, true); break; case CopyMode.Overwrite: RecursiveCopyDirectory(source, target, directoryRegex, fileRegex, OnCopiedFile); break; case CopyMode.Replace: if (Directory.Exists(target)) { Directory.Delete(target, true); } RecursiveCopyDirectory(source, target, directoryRegex, fileRegex, OnCopiedFile); break; default: break; } }
} // ctor internal LuaResult(CopyMode copyMode, object[] values) { this.result = values; } // ctor
public void LoadConfig() { string iniFilePath = IniConfigFileName; if (!File.Exists(iniFilePath)) { SaveConfig(); // Generate default config file } IniFile iniFile = new IniFile(); iniFile.TryLoad(iniFilePath); if (iniFile.ContainsKey("sourcePath")) { sourcePath = iniFile["sourcePath"]; } if (iniFile.ContainsKey("destinationPath")) { destinationPath = iniFile["destinationPath"]; } if (iniFile.ContainsKey("recursive")) { Recursive = iniFile["recursive"].ToBool(); } if (iniFile.ContainsKey("locale")) { Locale = new CultureInfo(iniFile["locale"]); } if (iniFile.ContainsKey("patternImage")) { DestinationPatternImage = iniFile["patternImage"]; } if (iniFile.ContainsKey("patternAudio")) { DestinationPatternAudio = iniFile["patternAudio"]; } if (iniFile.ContainsKey("patternVideo")) { DestinationPatternVideo = iniFile["patternVideo"]; } if (iniFile.ContainsKey("precondition")) { CopyPrecondition = iniFile["precondition"].ToEnum <CopyPrecondition>(); } if (iniFile.ContainsKey("comparator")) { FileComparator = iniFile["comparator"].ToEnum <FileComparator>(); } if (iniFile.ContainsKey("copyMode")) { CopyMode = iniFile["copyMode"].ToEnum <CopyMode>(); } if (iniFile.ContainsKey("exceptionHandling")) { ExceptionHandling = iniFile["exceptionHandling"].ToEnum <ExceptionHandling>(); } if (iniFile.ContainsKey("fileVerification")) { FileVerification = iniFile["fileVerification"].ToEnum <FileComparator>(); } }
public void LoadConfig() { string iniFilePath = IniConfigFileName; if (!File.Exists(iniFilePath)) SaveConfig(); // Generate default config file IniFile iniFile = new IniFile(); iniFile.TryLoad(iniFilePath); if (iniFile.ContainsKey("sourcePath")) sourcePath = iniFile["sourcePath"]; if (iniFile.ContainsKey("destinationPath")) destinationPath = iniFile["destinationPath"]; if (iniFile.ContainsKey("recursive")) Recursive = iniFile["recursive"].ToBool(); if (iniFile.ContainsKey("locale")) Locale = new CultureInfo(iniFile["locale"]); if (iniFile.ContainsKey("patternImage")) DestinationPatternImage = iniFile["patternImage"]; if (iniFile.ContainsKey("patternAudio")) DestinationPatternAudio = iniFile["patternAudio"]; if (iniFile.ContainsKey("patternVideo")) DestinationPatternVideo = iniFile["patternVideo"]; if (iniFile.ContainsKey("precondition")) CopyPrecondition = iniFile["precondition"].ToEnum<CopyPrecondition>(); if (iniFile.ContainsKey("comparator")) FileComparator = iniFile["comparator"].ToEnum<FileComparator>(); if (iniFile.ContainsKey("copyMode")) CopyMode = iniFile["copyMode"].ToEnum<CopyMode>(); if (iniFile.ContainsKey("exceptionHandling")) ExceptionHandling = iniFile["exceptionHandling"].ToEnum<ExceptionHandling>(); if (iniFile.ContainsKey("verifyFiles")) VerifyFiles = iniFile["verifyFiles"].ToBool(); }
private bool CopySystem(IVirtualItem sourceFile, IVirtualItem destFile) { long processed; object obj2; lock ((obj2 = this.FSnapshotLock)) { processed = this.FTotalProcessed.Processed; this.FCopyMode = CopyMode.System; } bool pbCancel = false; CopyProgressRoutine lpProgressRoutine = new CopyProgressRoutine(this.SystemCopyProgress); if (!System.IO.File.Exists(destFile.FullName)) { using (System.IO.File.Create(destFile.FullName)) { LocalFileSystemCreator.RaiseFileChangedEvent(WatcherChangeTypes.Created, destFile.FullName); } } IntPtr ptr = Marshal.AllocHGlobal(8); try { Marshal.WriteInt64(ptr, 0L); if (!Windows.CopyFileEx(sourceFile.FullName, destFile.FullName, lpProgressRoutine, ptr, ref pbCancel, (COPY_FILE) 0)) { lock ((obj2 = this.FSnapshotLock)) { this.FTotalProcessed.SetProcessedSize(processed); } int error = Marshal.GetLastWin32Error(); switch (error) { case 5: { Win32Exception inner = new Win32Exception(error); throw new UnauthorizedAccessException(inner.Message, inner); } case 0x57: { IVirtualFolder parent = destFile.Parent; if (parent != null) { throw new WarningException(string.Format(Resources.sNotEnoughSpaceInDest, parent.FullName, sourceFile.FullName)); } throw new Win32IOException(error); } case 0x4d3: return false; } throw new Win32IOException(error); } } finally { Marshal.FreeHGlobal(ptr); } LocalFileSystemCreator.RaiseFileChangedEvent(WatcherChangeTypes.Changed, destFile.FullName); return true; }
private CopyItemAction CopyStreamAsync(Stream sourceStream, Stream destStream, IVirtualItem sourceItem, IVirtualItem destItem) { object obj2; lock ((obj2 = this.FSnapshotLock)) { this.FCopyMode = CopyMode.Async; } if (this.Buffer2 == null) { this.Buffer2 = new byte[this.Buffer1.Length]; } byte[] buffer = this.Buffer1; byte[] buffer2 = this.Buffer2; int count = 0; ProcessedSize processed = CreateFileProcessed(sourceStream, sourceItem); if (!((processed.Total <= buffer.Length) || this.RaiseFileProgress(ref processed))) { return CopyItemAction.SkipUndoDest; } IAsyncResult asyncResult = sourceStream.BeginRead(buffer, 0, buffer.Length, null, null); do { count = sourceStream.EndRead(asyncResult); if (base.CheckCancellationPending()) { return CopyItemAction.SkipUndoDest; } IAsyncResult result2 = destStream.BeginWrite(buffer, 0, count, null, null); byte[] buffer3 = buffer; if (count > 0) { asyncResult = sourceStream.BeginRead(buffer2, 0, buffer2.Length, null, null); buffer2 = Interlocked.Exchange<byte[]>(ref buffer, buffer2); } try { destStream.EndWrite(result2); } catch (IOException exception) { CopyItemAction action = this.HandleCopyIOException(destItem, sourceItem, destItem, destStream, buffer3, count, exception); if (action != CopyItemAction.Next) { return action; } } lock ((obj2 = this.FSnapshotLock)) { this.FTotalProcessed.AddProcessedSize((long) count); } this.RaiseProgress(); processed.AddProcessedSize((long) count); if (!this.RaiseFileProgress(ref processed)) { return CopyItemAction.SkipUndoDest; } } while (count > 0); return CopyItemAction.Next; }
private CopyItemAction CopyStream(Stream sourceStream, Stream destStream, IVirtualItem sourceItem, IVirtualItem destItem) { object obj2; lock ((obj2 = this.FSnapshotLock)) { this.FCopyMode = CopyMode.Sync; } int count = 0; ProcessedSize processed = CreateFileProcessed(sourceStream, sourceItem); if (!((processed.Total <= this.Buffer1.Length) || this.RaiseFileProgress(ref processed))) { return CopyItemAction.SkipUndoDest; } do { if (base.CheckCancellationPending()) { return CopyItemAction.SkipUndoDest; } count = sourceStream.Read(this.Buffer1, 0, this.Buffer1.Length); try { destStream.Write(this.Buffer1, 0, count); } catch (IOException exception) { CopyItemAction action = this.HandleCopyIOException(destItem, sourceItem, destItem, destStream, this.Buffer1, count, exception); if (action != CopyItemAction.Next) { return action; } } lock ((obj2 = this.FSnapshotLock)) { this.FTotalProcessed.AddProcessedSize((long) count); } this.RaiseProgress(); processed.AddProcessedSize((long) count); if (!this.RaiseFileProgress(ref processed)) { return CopyItemAction.SkipUndoDest; } } while (count > 0); return CopyItemAction.Next; }
private static void CopyFolder(string sourceDir, string targetDir, string filter, CopyMode mode) { CopyTopFiles(sourceDir, targetDir, filter); foreach (var folder in Directory.GetDirectories(sourceDir)) { string target; switch (mode) { case CopyMode.RestoreHierarchie: target = Path.Combine(targetDir, Path.GetFileName(folder)); break; case CopyMode.Flat: target = targetDir; break; default: throw new NotSupportedException("CopyMode " + mode + " is not supported yet"); } CopyFolder(folder, target, filter, mode); } }
private static List<string> CopyFolder(string sourceDir, string targetDir, IEnumerable<string> filesToIgnore = null, string filter = null, CopyMode mode = CopyMode.RestoreHierarchie) { var result = CopyTopFiles(sourceDir, targetDir, filesToIgnore, filter); foreach (var folder in Directory.GetDirectories(sourceDir)) { string target; switch (mode) { case CopyMode.RestoreHierarchie: target = Path.Combine(targetDir, Path.GetFileName(folder)); break; case CopyMode.Flat: target = targetDir; break; default: throw new NotSupportedException("CopyMode " + mode + " is not supported yet"); } result.AddRange(CopyFolder(folder, target, filesToIgnore, filter, mode)); } return result; }
private static void InstallGeneratedBinaries(string source, string target, CopyMode copyMode) { if (string.IsNullOrEmpty(source) || string.IsNullOrEmpty(target) || source == target) return; if (!Directory.Exists(source)) { LogTitle("Skipping Generated Binaries: source ({0}) doesn't exist", source); return; } LogTitle("Installing Generated Binaries"); var sourcePaths = ExpandPath(source); var isWildcard = sourcePaths.Count() > 1; foreach (var sourcePath in sourcePaths) { LogAction("copying Binaries from " + sourcePath); if (isWildcard && !Directory.Exists(sourcePath)) continue; CopyFolder(sourcePath, target, null, null, copyMode); } }
public static ISetupActivity <OutFile> WithMode(this ISetupActivity <OutFile> setup, CopyMode mode) => setup.Set(x => x.Mode, mode);
static Int64[] GetCopyInstruction(CopyMode copyMode, Int64 count, Int64 target, Int64 source) { Int64[] instruction=new Int64[5]; instruction[0]=2; instruction[1]=(Int64)copyMode; instruction[2]=count; instruction[3]=target; instruction[4]=source; return instruction; }
private string Write203_CopyMode(CopyMode v) { switch (v) { case CopyMode.Sync: return "Sync"; case CopyMode.Async: return "Async"; case CopyMode.System: return "System"; } long num = (long) v; throw base.CreateInvalidEnumValueException(num.ToString(CultureInfo.InvariantCulture), "Nomad.Workers.CopyMode"); }