public override void Invoke() { FieldInfo toInfo = CopyAction.Unravel(copyTo, pathTo); MethodInfo fromInfo = UnravelMethod(copyFrom, pathFrom); toInfo.SetValue(copyTo, fromInfo.Invoke(copyFrom, unravel.Select(x => x.Unravel()).ToArray())); }
public static void ExecuteCopyAction() { if (Current.Active && !CameraControler.IsInputFieldFocused()) { CopyAction?.Invoke(); } }
void Update() { if (!Active) { return; } if (!CameraControler.IsInputFieldFocused()) { if (AllowRemove && Input.GetKeyDown(KeyCode.Delete)) { DestroySelectedObjects(); } if (Input.GetKeyDown(KeyCode.C) && Input.GetKey(KeyCode.LeftControl)) { //Copy CopyAction?.Invoke(); } else if (Input.GetKeyDown(KeyCode.V) && Input.GetKey(KeyCode.LeftControl)) { //Paste PasteAction?.Invoke(); } else if (Input.GetKeyDown(KeyCode.D) && Input.GetKey(KeyCode.LeftControl)) { //Duplicate DuplicateAction?.Invoke(); } } }
MethodInfo UnravelMethod(Component objec, string path) { var obj = objec; FieldInfo info = CopyAction.Unravel(obj, String.Join(".", path.Split('.').Take(path.Split('.').Length - 1).ToArray())); string lastProp = path.Split('.').Last(); return(info.GetType().GetMethod(lastProp)); }
public bool CopyOrLinkFile(string file, bool exists, out CopyAction action, out bool applyforall) { var dialog = new AddItemDialog(file, exists, FileType.File); var result = dialog.Run(this) == DialogResult.Ok; action = dialog.Responce; applyforall = dialog.ApplyForAll; return(result); }
IAction ReadCopyAction(XElement actionElement, ISyncConfiguration configuration) { var enabled = ReadActionEnabled(actionElement); var inputFilterName = ReadActionInputFilterName(actionElement); var syncFolder = ReadActionSyncFolder(actionElement); var actionInstance = new CopyAction(enabled, configuration, inputFilterName, syncFolder); return(actionInstance); }
public override void Invoke() { float val = (float)CopyAction.Unravel(script, property).GetValue(script); string exp = ((string)expression.Clone()).Replace("x", val.ToString()); float toSet = (float)new System.Xml.XPath.XPathDocument (new System.IO.StringReader("< r />")).CreateNavigator().Evaluate (string.Format("number({0})", new System.Text.RegularExpressions.Regex(@"([\+\-\*])").Replace(exp, " ${1} ").Replace("/", " div ").Replace("%", " mod "))); CopyAction.Unravel(script, property).SetValue(script, toSet); }
public WriteErrorDialog(IEventAggregator eventAggregator, string sourceFile, string targetFile, CopyAction disableFlags) { _eventAggregator = eventAggregator; _sourceFile = sourceFile; _targetFile = targetFile; Owner = Application.Current.MainWindow; InitializeComponent(); if (string.IsNullOrEmpty(sourceFile)) SourceFileBox.Visibility = Visibility.Collapsed; if (string.IsNullOrEmpty(targetFile)) TargetFileBox.Visibility = Visibility.Collapsed; DisableButtons(disableFlags); _eventAggregator.GetEvent<ViewModelGeneratedEvent>().Subscribe(ViewModelGenerated); }
protected void OnButtonOkClicked(object sender, EventArgs e) { if (radiobuttonCopy.Active) responce = CopyAction.Copy; else if (radiobuttonLink.Active) responce = CopyAction.Link; else responce = CopyAction.Skip; applyforall = checkbutton1.Active; Respond(ResponseType.Ok); }
private void button2_Click(object sender, EventArgs e) { applyforall = checkBox1.Checked; if (radioButtonCopy.Checked) responce = CopyAction.Copy; else if (radioButtonLink.Checked) responce = CopyAction.Link; else responce = CopyAction.Skip; this.Close(); }
IEnumerator Wri() { FieldInfo info = CopyAction.Unravel(writeTo, path); info.SetValue(writeTo, ""); finished = false; foreach (var item in toWrite) { info.SetValue(writeTo, (string)info.GetValue(writeTo) + item); yield return(new WaitForSeconds(delay)); } finished = true; }
public bool CopyOrLinkFolder(string folder, out CopyAction action) { var dialog = new AddFolderDialog(folder); if (dialog.ShowDialog() == DialogResult.OK) { action = dialog.responce; return(true); } action = CopyAction.Link; return(false); }
protected void OnResponse(object sender, EventArgs e) { if (radiobuttonCopy.Active) responce = CopyAction.Copy; else if (radiobuttonLink.Active) responce = CopyAction.Link; else responce = CopyAction.Skip; applyforall = checkbutton1.Active; Destroy (); }
private void RadioButton_CheckedChanged(object sender, EventArgs e) { if (radioCopy.Checked) { Responce = CopyAction.Copy; } else if (radioLink.Checked) { Responce = CopyAction.Link; } else { Responce = CopyAction.Skip; } }
public bool CopyOrLinkFile(string file, bool exists, out CopyAction action, out bool applyforall) { AddFileDialog afd = new AddFileDialog(file, exists); if (afd.ShowDialog() == DialogResult.OK) { action = afd.responce; applyforall = afd.applyforall; return(true); } action = CopyAction.Skip; applyforall = false; return(false); }
public bool CopyOrLinkFolder(string folder, bool exists, out CopyAction action, out bool applyforall) { var dialog = new AddFolderDialog(folder); applyforall = false; if (dialog.ShowDialog() == DialogResult.OK) { action = dialog.responce; return(true); } action = CopyAction.Link; return(false); }
private void FinishOneCopyAction() { CopyAction copyAction = new CopyAction(); foreach (Entity item in _items) { Entity copyItem = item.Clone() as Entity; copyItem.Translate(this.translation); copyAction.copyItems.Add(copyItem); } copyAction.pathLine = _pathLine; _actions.Add(copyAction); }
public override bool Fulfilled() { switch (sign) { case Sign.less: return((float)CopyAction.Unravel(comp, path).GetValue(comp) < (float)CopyAction.Unravel(equal, equalTo).GetValue(equal)); case Sign.equal: return(CopyAction.Unravel(comp, path).GetValue(comp).Equals(CopyAction.Unravel(equal, equalTo).GetValue(equal))); case Sign.more: return((float)CopyAction.Unravel(comp, path).GetValue(comp) > (float)CopyAction.Unravel(equal, equalTo).GetValue(equal)); } return(false); }
public bool CopyOrLinkFolder(string folder, out CopyAction action) { var afd = new AddFolderDialog(folder); afd.TransientFor = this; if (afd.Run() == (int)ResponseType.Ok) { action = afd.responce; return(true); } action = CopyAction.Link; return(false); }
public bool CopyOrLinkFile(string file, bool exists, out CopyAction action, out bool applyforall) { var afd = new AddItemDialog(this, file, exists, FileType.File); if (afd.Run() == (int)ResponseType.Ok) { action = afd.responce; applyforall = afd.applyforall; return(true); } action = CopyAction.Link; applyforall = false; return(false); }
public bool CopyOrLinkFolder(string folder, bool exists, out CopyAction action, out bool applyforall) { var afd = new AddItemDialog(folder, exists, FileType.Folder); applyforall = false; if (afd.Run(this) == DialogResult.Ok) { action = afd.Responce; return(true); } action = CopyAction.Link; return(false); }
private void FinishOneCopyAction() { CopyAction copyAction = new CopyAction(); foreach (Entity item in _items) { // Entity copyItem = item.Clone() as Entity; // copyItem.Translate(translation); Entity copyItem = _mgr.presenter.AppendEntity((Entity)item.Clone()); copyItem.Translate(translation); copyItem.Draw(); copyAction.copyItems.Add(copyItem); } copyAction.pathLine = _pathLine; _actions.Add(copyAction); }
private void btnCoppy_Click(object sender, EventArgs e) { Button button = sender as Button; if (button.Name == btnCoppyCross.Name) { CopyAction?.Invoke(CanvasType.Cross); } if (button.Name == btnCoppyCircle.Name) { CopyAction?.Invoke(CanvasType.Circle); } if (button.Name == btCoppyBlank.Name) { CopyAction?.Invoke(CanvasType.Blank); } }
public bool CopyOrLink(string file, bool exists, out CopyAction action, out bool applyforall) { var afd = new AddFileDialog(file, exists); afd.TransientFor = this; if (afd.Run() == (int)ResponseType.Ok) { action = afd.responce; applyforall = afd.applyforall; return(true); } action = CopyAction.Link; applyforall = false; return(false); }
private void button2_Click(object sender, EventArgs e) { applyforall = checkBox1.Checked; if (radioButtonCopy.Checked) { responce = CopyAction.Copy; } else if (radioButtonLink.Checked) { responce = CopyAction.Link; } else { responce = CopyAction.Skip; } this.Close(); }
protected void OnButtonOkClicked(object sender, EventArgs e) { if (radiobuttonCopy.Active) { responce = CopyAction.Copy; } else if (radiobuttonLink.Active) { responce = CopyAction.Link; } else { responce = CopyAction.Skip; } applyforall = checkbutton1.Active; Respond(ResponseType.Ok); }
protected void OnResponse(object sender, EventArgs e) { if (radiobuttonCopy.Active) { responce = CopyAction.Copy; } else if (radiobuttonLink.Active) { responce = CopyAction.Link; } else { responce = CopyAction.Skip; } applyforall = checkbutton1.Active; Destroy(); }
public SaveActionFromForm() { _action = CopyAction.Value; _display = MainProgram.Self.actionView; NameViewSave(); StateViewSave(); PlatformInstalationSave(); ECCCSave(); CalculatioBySave(); PNCEstymationSave(); ANCChangeSave(); STKChangeSave(); NextANCSave(); CalculationGroupSave(); if (new CheckIfEqual().Check()) { } }
public LoadActionToForm() { _action = CopyAction.Value; _ = new ClearForm(); NameViewUpdate(); StateViewUpdate(); PlatformInstallation(); ECCCUpdate(); CalculationbyUpdate(); PNCEstymUpdate(); ANCChangeUpdate(); STKChangeUpdate(); NextChangeUpdate(); QuantityPercentChangeUpdate(); CalculationGroupUpdate(); SavingsLoadUpdate(); PNCListUpdate(); }
private void DisableButtons(CopyAction disableFlags) { if (disableFlags.HasFlag(CopyAction.Overwrite)) { Overwrite.IsEnabled = false; OverwriteAll.IsEnabled = false; OverwriteAllOlder.IsEnabled = false; } if (disableFlags.HasFlag(CopyAction.OverwriteOlder)) { OverwriteAllOlder.IsEnabled = false; } if (disableFlags.HasFlag(CopyAction.Resume)) { Resume.IsEnabled = false; ResumeAll.IsEnabled = false; } if (disableFlags.HasFlag(CopyAction.Rename)) { Rename.IsEnabled = false; } }
public void InitializeTransfer(Queue <QueueItem> queue, FileOperation mode) { _queue = queue; _paneCache.Clear(); _isPaused = false; _isAborted = false; _isContinued = false; _deleteAll = false; _skipAll = null; UserAction = mode; TransferAction = mode == FileOperation.Copy ? GetCopyActionText() : Resx.ResourceManager.GetString(mode.ToString()); _rememberedCopyAction = CopyAction.CreateNew; _currentFileBytesTransferred = 0; CurrentFileProgress = 0; FilesTransferred = 0; FileCount = _queue.Count; BytesTransferred = 0; TotalBytes = _queue.Where(item => item.FileSystemItem.Type == ItemType.File).Sum(item => item.FileSystemItem.Size ?? 0); Speed = 0; ElapsedTime = new TimeSpan(0); RemainingTime = new TimeSpan(0); WorkHandler.Run(BeforeTransferStart, BeforeTransferStartCallback); }
static CopyHelper() { Type[] args = { typeof(T), typeof(K) }; DynamicMethod convertMethod = new DynamicMethod("Convert", typeof(void), args); ILGenerator convertIL = convertMethod.GetILGenerator(); var ps = typeof(K).GetProperties(BindingFlags.Instance | BindingFlags.Public); foreach (var p2 in ps) { if (p2.GetIndexParameters().Length == 0) { var p1 = typeof(T).GetProperty(p2.Name); if (p1 != null && p1.GetIndexParameters().Length == 0) { convertIL.Emit(OpCodes.Ldarg_1); convertIL.Emit(OpCodes.Ldarg_0); convertIL.Emit(OpCodes.Callvirt, p1.GetGetMethod()); convertIL.Emit(OpCodes.Callvirt, p2.GetSetMethod()); } } } convertIL.Emit(OpCodes.Ret); action = (CopyAction <T, K>)convertMethod.CreateDelegate(typeof(CopyAction <T, K>)); }
public bool CopyOrLink(string file, bool exists, out CopyAction action, out bool applyforall) { action = CopyAction.Link; applyforall = true; return true; }
public bool CopyOrLinkFolder(string folder, out CopyAction action) { var dialog = new AddFolderDialog(folder); if (dialog.ShowDialog() == DialogResult.OK) { action = dialog.responce; return true; } action = CopyAction.Link; return false; }
void IParticleProcessor.Update(int particleCount, float particleCountF, float deltaTime, float[] globals, CopyAction[] copyActions, int copyActionCount, AddAction[] addActions, int addActionCount, int step) { float time = (float)(step / timeStepHz) + (float)(step % timeStepHz) * deltaTime; //first update all particles from the last frame... if (previousFrameCount > 0) { frameMethod(previousFrameCount, time, random, deltaTime, globals, this.lifeData, this.positions, this.velocity, this.colours, this.userdata); } //then, apply the move operations for (int i = 0; i < copyActionCount; i++) { CopyAction action = copyActions[i]; action.indexFrom = action.indexFrom & countMask; action.indexTo = action.indexTo & countMask; positions[action.indexTo] = positions[action.indexFrom]; velocity[action.indexTo] = velocity[action.indexFrom]; if (userdata != null) { userdata[action.indexTo] = userdata[action.indexFrom]; } if (colours != null) { colours[action.indexTo] = colours[action.indexFrom]; } if (lifeData != null) { lifeData[action.indexTo] = lifeData[action.indexFrom]; } } if (addActionCount > 0) { //make sure the indices array is big enough if (addActionCount > addIndices.Length) { int count = addIndices.Length; while (addActionCount > count) { count *= 2; } Array.Resize(ref addIndices, count); } //finally, add the new particles for (int i = 0; i < addActionCount; i++) { AddAction action = addActions[i]; // simply wrap if outside the expected range // this will produce similar glitches as the gpu processor action.index = action.index & countMask; if (action.cloneTypeIndex == -1) { //set all particle values to their defaults positions[action.index] = action.spawnDetails.PositionSize; velocity[action.index] = action.spawnDetails.VelocityRotation; if (userdata != null) { userdata[action.index] = action.spawnDetails.UserValues; } if (colours != null) { colours[action.index] = action.spawnDetails.Colour; } } else { //copy in particle values from another particle system CpuParticleProcessor other = (CpuParticleProcessor)processors[action.cloneTypeIndex]; uint fromIndex = (uint)action.cloneFromIndex & other.countMask; positions[action.index] = other.positions[fromIndex]; velocity[action.index] = other.velocity[fromIndex]; if (userdata != null) { if (other.userdata != null) { userdata[action.index] = other.userdata[fromIndex]; } else { userdata[action.index] = new Vector4(); } } if (colours != null) { if (other.colours != null) { colours[action.index] = other.colours[fromIndex]; } else { colours[action.index] = new Vector4(); } } } if (lifeData != null) { this.lifeData[action.index] = new Vector2((float)action.lifeSteps * deltaTime, time); } addIndices[i] = action.index; } //run the add logic onceMethod((uint)addActionCount, addIndices, time, random, deltaTime, globals, lifeData, positions, velocity, colours, userdata); } previousFrameCount = Math.Min((uint)particleCount, maxCount); // cannot process more }
//void ValidateSteps() //{ // for (int i = 0; i < this.timeSteps.Length; i++) // { // uint prev = uint.MaxValue; // uint index = this.timeSteps[i].firstParticleIndex; // // for (int p = 0; p < this.timeSteps[i].count; p++) // { // if (this.particles[index].previousParticleIndexForTimeStep != prev) // throw new ArgumentException(); // prev = index; // index = this.particles[index].nextParticleIndexForTimeStep; // } // // if (this.timeSteps[i].count > 0 && index != uint.MaxValue) // throw new ArgumentException(); // } //} //the meat of the system public void Update(ParticleSystem system, int step) { int stepIndex = step & timeStepMask; SystemTimeStep timestep = timeSteps[stepIndex]; timeSteps[stepIndex] = new SystemTimeStep(); uint particleIndex = timestep.firstParticleIndex; //run per frame logic for the type if (frameEmitter != null) frameEmitter.RunParticleType(system, this, step); //iterate twice. //first pass, generate the operations to remove the particles //in the second pass, run the remove emitter, if there is one. //this way, a particle created in the removed emitter will not be rearranged //by another removed particle later //this is mostly for the benfit of the GPU system // uint copyCount = copyActionCount; if (timestep.count > 0) { Particle particle, replace; //first, collect the indices for removal, if they exist if (removeEmitter != null) { uint removeIndex = particleIndex; int count = 2; while (timestep.count > count) count *= 2; if (removeIndices == null || count > removeIndices.Length) Array.Resize(ref removeIndices, count); RemoveIndex indexEntry; for (int i = 0; i < timestep.count; i++) { particle = this.particles[removeIndex]; indexEntry.index = removeIndex; indexEntry.indexF = particle.index; removeIndices[i] = indexEntry; removeIndex = particle.nextParticleIndexForTimeStep; } } //now remove them for (int i = 0; i < timestep.count; i++) { particle = this.particles[particleIndex]; --particleCapacityF; uint last = --particleCapacity; //move last particle into this one's position replace = this.particles[last]; //unless it's being removed anyway if (particleIndex != last) { //update the linked list indexing of the particles... if (replace.previousParticleIndexForTimeStep != uint.MaxValue) this.particles[replace.previousParticleIndexForTimeStep].nextParticleIndexForTimeStep = particleIndex; else { if (replace.timeStepIndex != stepIndex) this.timeSteps[replace.timeStepIndex].firstParticleIndex = particleIndex; } //particle has been moved once already in this update? (rare) if (replace.nextParticleIndexForTimeStep != uint.MaxValue) this.particles[replace.nextParticleIndexForTimeStep].previousParticleIndexForTimeStep = particleIndex; //may be moving the next particle in the list... if (particle.nextParticleIndexForTimeStep == last) particle.nextParticleIndexForTimeStep = particleIndex; //store the copy action... //but first... if (replace.addActionIndex < addActionCount && this.addActions[replace.addActionIndex].index == last) { //this particle was just added in this frame, now it's being moved //so modify the add action instead to directly write to the position this.addActions[replace.addActionIndex].index = particleIndex; this.addActions[replace.addActionIndex].indexF = particle.index; } else { if (replace.addActionIndex >= short.MaxValue) // add action indices above 32k are for copy indices { //the particle is already being copied... //so modify the existing copy op copyActions[replace.addActionIndex - short.MaxValue].indexTo = particleIndex; copyActions[replace.addActionIndex - short.MaxValue].indexToF = particle.index; } else { //otherwise do a copy CopyAction copy = new CopyAction(); copy.indexTo = particleIndex; copy.indexToF = particle.index; copy.indexFrom = last; copy.indexFromF = replace.index; replace.addActionIndex = (ushort)(short.MaxValue + copyActionCount); copyActions[copyActionCount] = copy; if (++copyActionCount == copyActions.Length) Array.Resize(ref copyActions, copyActions.Length * 2); } } replace.index = particle.index; this.particles[particleIndex] = replace; } particleIndex = particle.nextParticleIndexForTimeStep; } //now finally run the remove emitters. if (removeEmitter != null) { RemoveIndex index; for (int i = 0; i < timestep.count; i++) { index = removeIndices[i]; if (removeEmitter != null) removeEmitter.RunParticle(system, this, index.index, index.indexF, step); } } } for (uint i = copyCount; i < copyActionCount; i++) { this.particles[copyActions[i].indexTo].addActionIndex = 0; } }
public bool CopyOrLinkFile(string file, bool exists, out CopyAction action, out bool applyforall) { AddFileDialog afd = new AddFileDialog(file, exists); if (afd.ShowDialog() == DialogResult.OK) { action = afd.responce; applyforall = afd.applyforall; return true; } action = CopyAction.Skip; applyforall = false; return false; }
public bool CopyOrLink(string file, bool exists, out CopyAction action, out bool applyforall) { var afd = new AddFileDialog(file, exists); afd.TransientFor = this; if (afd.Run() == (int)ResponseType.Ok) { action = afd.responce; applyforall = afd.applyforall; return true; } action = CopyAction.Link; applyforall = false; return false; }
void IParticleProcessor.Update(int particleCount, float particleCountF, float deltaTime, float[] globals, CopyAction[] copyActions, int copyActionCount, AddAction[] addActions, int addActionCount, int step) { float time = (float)(step/timeStepHz) + (float)(step%timeStepHz) * deltaTime; //first update all particles from the last frame... if (previousFrameCount > 0) frameMethod(previousFrameCount, time, random, deltaTime, globals, this.lifeData, this.positions, this.velocity, this.colours, this.userdata); //then, apply the move operations for (int i = 0; i < copyActionCount; i++) { CopyAction action = copyActions[i]; action.indexFrom = action.indexFrom & countMask; action.indexTo = action.indexTo & countMask; positions[action.indexTo] = positions[action.indexFrom]; velocity[action.indexTo] = velocity[action.indexFrom]; if (userdata != null) userdata[action.indexTo] = userdata[action.indexFrom]; if (colours != null) colours[action.indexTo] = colours[action.indexFrom]; if (lifeData != null) lifeData[action.indexTo] = lifeData[action.indexFrom]; } if (addActionCount > 0) { //make sure the indices array is big enough if (addActionCount > addIndices.Length) { int count = addIndices.Length; while (addActionCount > count) count *= 2; Array.Resize(ref addIndices, count); } //finally, add the new particles for (int i = 0; i < addActionCount; i++) { AddAction action = addActions[i]; // simply wrap if outside the expected range // this will produce similar glitches as the gpu processor action.index = action.index & countMask; if (action.cloneTypeIndex == -1) { //set all particle values to their defaults positions[action.index] = action.spawnDetails.PositionSize; velocity[action.index] = action.spawnDetails.VelocityRotation; if (userdata != null) userdata[action.index] = action.spawnDetails.UserValues; if (colours != null) colours[action.index] = action.spawnDetails.Colour; } else { //copy in particle values from another particle system CpuParticleProcessor other = (CpuParticleProcessor)processors[action.cloneTypeIndex]; uint fromIndex = (uint)action.cloneFromIndex & other.countMask; positions[action.index] = other.positions[fromIndex]; velocity[action.index] = other.velocity[fromIndex]; if (userdata != null) { if (other.userdata != null) userdata[action.index] = other.userdata[fromIndex]; else userdata[action.index] = new Vector4(); } if (colours != null) { if (other.colours != null) colours[action.index] = other.colours[fromIndex]; else colours[action.index] = new Vector4(); } } if (lifeData != null) this.lifeData[action.index] = new Vector2((float)action.lifeSteps * deltaTime, time); addIndices[i] = action.index; } //run the add logic onceMethod((uint)addActionCount, addIndices, time, random, deltaTime, globals, lifeData, positions, velocity, colours, userdata); } previousFrameCount = Math.Min((uint)particleCount, maxCount); // cannot process more }
public bool CopyOrLinkFolder(string folder, out CopyAction action) { var afd = new AddFolderDialog(folder); afd.TransientFor = this; if (afd.Run() == (int)ResponseType.Ok) { action = afd.responce; return true; } action = CopyAction.Link; return false; }
protected void OnButtonOkClicked(object sender, EventArgs e) { responce = (radiobutton1.Active) ? CopyAction.Copy : CopyAction.Link; Respond(ResponseType.Ok); }
public void IncludeFolder(string initialDirectory, string[] dirs) { CopyAction caction = CopyAction.Copy; bool applyforall = false; List <string> ffiles = new List <string>(); List <string> ddirectories = new List <string>(); List <string> sc = new List <string>(), dc = new List <string>(); foreach (string fol in dirs) { List <string> files = new List <string>(); List <string> directories = new List <string>(); string folder = fol; if (!folder.EndsWith(Path.DirectorySeparatorChar.ToString())) { folder += Path.DirectorySeparatorChar; } files.AddRange(GetFiles(folder)); directories.Add(folder); directories.AddRange(GetDirectories(folder)); if (!folder.StartsWith(initialDirectory)) { string nd = folder.Replace(folder, Path.Combine(initialDirectory, (new DirectoryInfo(folder)).Name + Path.DirectorySeparatorChar)); if (!applyforall) { if (!View.CopyOrLinkFolder(folder, Directory.Exists(nd), out caction, out applyforall)) { return; } } if (caction == CopyAction.Copy) { for (int i = 0; i < directories.Count; i++) { ddirectories.Add(directories[i].Replace(folder, Path.Combine(initialDirectory, (new DirectoryInfo(folder)).Name + Path.DirectorySeparatorChar))); } for (int i = 0; i < files.Count; i++) { ffiles.Add(files[i].Replace(folder, Path.Combine(initialDirectory, (new DirectoryInfo(folder)).Name + Path.DirectorySeparatorChar))); } sc.Add(folder); dc.Add(nd); } else if (caction == CopyAction.Link) { string pl = _project.Location; if (!pl.EndsWith(Path.DirectorySeparatorChar.ToString())) { pl += Path.DirectorySeparatorChar; } Uri folderUri = new Uri(pl); for (int i = 0; i < directories.Count; i++) { Uri pathUri = new Uri(directories[i]); ddirectories.Add(Uri.UnescapeDataString(folderUri.MakeRelativeUri(pathUri).ToString().Replace('/', Path.DirectorySeparatorChar))); } for (int i = 0; i < files.Count; i++) { Uri pathUri = new Uri(files[i]); ffiles.Add(Uri.UnescapeDataString(folderUri.MakeRelativeUri(pathUri).ToString().Replace('/', Path.DirectorySeparatorChar))); } } } else { ddirectories.AddRange(directories); ffiles.AddRange(files); } } try { for (int i = 0; i < sc.Count; i++) { DirectoryCopy(sc[i], dc[i]); } var action2 = new IncludeAction(this, ffiles, ddirectories); if (action2.Do()) { _actionStack.Add(action2); } } catch { View.ShowError("Error While Copying Files", "An error occurred while the directories were being copied, aborting."); } }
private void button2_Click(object sender, EventArgs e) { responce = (radioButtonCopy.Checked) ? CopyAction.Copy : CopyAction.Link; this.Close(); }
public bool CopyOrLinkFolder(string folder, bool exists, out CopyAction action, out bool applyforall) { var afd = new AddItemDialog(this, folder, exists, FileType.Folder); applyforall = false; if (afd.Run() == (int)ResponseType.Ok) { action = afd.responce; return true; } action = CopyAction.Link; return false; }
public bool CopyOrLinkFolder(string folder, bool exists, out CopyAction action, out bool applyforall) { var dialog = new AddFolderDialog(folder); applyforall = false; if (dialog.ShowDialog() == DialogResult.OK) { action = dialog.responce; return true; } action = CopyAction.Link; return false; }
public TransferErrorDialogResult(ErrorResolutionBehavior behavior, CopyActionScope scope = Constants.CopyActionScope.Current, CopyAction? action = null) { Behavior = behavior; Scope = scope; Action = action; }