Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Former-commit-id: 713323240cc14a8d6445badcf6f2046ab874d2e0
- Loading branch information
Showing
6 changed files
with
328 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
source/ch/cyberduck/ui/controller/CreateSymlinkController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
// | ||
// Copyright (c) 2010-2012 Yves Langisch. All rights reserved. | ||
// http://cyberduck.ch/ | ||
// | ||
// This program is free software; you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation; either version 2 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// Bug fixes, suggestions and comments should be sent to: | ||
// yves@cyberduck.ch | ||
// | ||
|
||
using System; | ||
using System.Drawing; | ||
using System.Windows.Forms; | ||
using Ch.Cyberduck.Ui.Controller.Threading; | ||
using ch.cyberduck.core; | ||
using ch.cyberduck.core.i18n; | ||
|
||
namespace Ch.Cyberduck.Ui.Controller | ||
{ | ||
internal class CreateSymlinkController : FileController | ||
{ | ||
public CreateSymlinkController(ICreateSymlinkPromptView view, BrowserController browserController) | ||
: base(view, browserController) | ||
{ | ||
view.LinkForFile = browserController.SelectedPath.getName(); | ||
} | ||
|
||
public override Bitmap IconView | ||
{ | ||
get { return IconCache.Instance.OverlayIcon("_unknown", "aliasbadge", IconCache.IconSize.Large); } | ||
} | ||
|
||
public override void Callback(DialogResult result) | ||
{ | ||
if (DialogResult.OK == result && !String.IsNullOrEmpty(View.InputText) && | ||
!View.InputText.Trim().Equals(string.Empty)) | ||
{ | ||
BrowserController.background(new CreateSymlinkAction(BrowserController, Workdir, View.InputText)); | ||
} | ||
} | ||
|
||
private class CreateSymlinkAction : BrowserBackgroundAction | ||
{ | ||
private readonly Path _link; | ||
private readonly string _symlink; | ||
private readonly string _target; | ||
private readonly Path _workdir; | ||
|
||
public CreateSymlinkAction(BrowserController controller, Path workdir, string symlink) | ||
: base(controller) | ||
{ | ||
_workdir = workdir; | ||
_symlink = symlink; | ||
_link = PathFactory.createPath(controller.getSession(), | ||
_workdir.getAbsolute(), | ||
_symlink, AbstractPath.FILE_TYPE); | ||
_target = BrowserController.SelectedPath.getName(); | ||
} | ||
|
||
public override void run() | ||
{ | ||
// Symlink pointing to existing file | ||
_link.symlink(_target); | ||
} | ||
|
||
public override void cleanup() | ||
{ | ||
if (_symlink.StartsWith(".")) | ||
{ | ||
BrowserController.ShowHiddenFiles = true; | ||
} | ||
BrowserController.RefreshParentPath(_link); | ||
} | ||
|
||
public override string getActivity() | ||
{ | ||
return String.Format(Locale.localizedString("Uploading {0}", "Status"), _symlink); | ||
} | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
source/ch/cyberduck/ui/controller/ICreateSymlinkPromptView.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// Copyright (c) 2010 Yves Langisch. All rights reserved. | ||
// http://cyberduck.ch/ | ||
// | ||
// This program is free software; you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation; either version 2 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// Bug fixes, suggestions and comments should be sent to: | ||
// yves@cyberduck.ch | ||
// | ||
namespace Ch.Cyberduck.Ui.Controller | ||
{ | ||
internal interface ICreateSymlinkPromptView : IPromptView | ||
{ | ||
string LinkForFile { set; } | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
source/ch/cyberduck/ui/winforms/CreateSymlinkPromptForm.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
source/ch/cyberduck/ui/winforms/CreateSymlinkPromptForm.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// | ||
// Copyright (c) 2010-2012 Yves Langisch. All rights reserved. | ||
// http://cyberduck.ch/ | ||
// | ||
// This program is free software; you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation; either version 2 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// Bug fixes, suggestions and comments should be sent to: | ||
// yves@cyberduck.ch | ||
// | ||
|
||
using System; | ||
using Ch.Cyberduck.Ui.Controller; | ||
using ch.cyberduck.core.i18n; | ||
|
||
namespace Ch.Cyberduck.Ui.Winforms | ||
{ | ||
public partial class CreateSymlinkPromptForm : PromptForm, ICreateSymlinkPromptView | ||
{ | ||
public CreateSymlinkPromptForm() | ||
{ | ||
InitializeComponent(); | ||
Text = Locale.localizedString("Create new symbolic link", "File"); | ||
} | ||
|
||
public string LinkForFile | ||
{ | ||
set | ||
{ | ||
label.Text = | ||
String.Format(Locale.localizedString("Enter the name for the new symbolic link for {0}:", "File"), | ||
value); | ||
} | ||
} | ||
} | ||
} |
120 changes: 120 additions & 0 deletions
120
source/ch/cyberduck/ui/winforms/CreateSymlinkPromptForm.resx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<root> | ||
<!-- | ||
Microsoft ResX Schema | ||
Version 2.0 | ||
The primary goals of this format is to allow a simple XML format | ||
that is mostly human readable. The generation and parsing of the | ||
various data types are done through the TypeConverter classes | ||
associated with the data types. | ||
Example: | ||
... ado.net/XML headers & schema ... | ||
<resheader name="resmimetype">text/microsoft-resx</resheader> | ||
<resheader name="version">2.0</resheader> | ||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | ||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | ||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> | ||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | ||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | ||
<value>[base64 mime encoded serialized .NET Framework object]</value> | ||
</data> | ||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | ||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> | ||
<comment>This is a comment</comment> | ||
</data> | ||
There are any number of "resheader" rows that contain simple | ||
name/value pairs. | ||
Each data row contains a name, and value. The row also contains a | ||
type or mimetype. Type corresponds to a .NET class that support | ||
text/value conversion through the TypeConverter architecture. | ||
Classes that don't support this are serialized and stored with the | ||
mimetype set. | ||
The mimetype is used for serialized objects, and tells the | ||
ResXResourceReader how to depersist the object. This is currently not | ||
extensible. For a given mimetype the value must be set accordingly: | ||
Note - application/x-microsoft.net.object.binary.base64 is the format | ||
that the ResXResourceWriter will generate, however the reader can | ||
read any of the formats listed below. | ||
mimetype: application/x-microsoft.net.object.binary.base64 | ||
value : The object must be serialized with | ||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter | ||
: and then encoded with base64 encoding. | ||
mimetype: application/x-microsoft.net.object.soap.base64 | ||
value : The object must be serialized with | ||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter | ||
: and then encoded with base64 encoding. | ||
mimetype: application/x-microsoft.net.object.bytearray.base64 | ||
value : The object must be serialized into a byte array | ||
: using a System.ComponentModel.TypeConverter | ||
: and then encoded with base64 encoding. | ||
--> | ||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | ||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> | ||
<xsd:element name="root" msdata:IsDataSet="true"> | ||
<xsd:complexType> | ||
<xsd:choice maxOccurs="unbounded"> | ||
<xsd:element name="metadata"> | ||
<xsd:complexType> | ||
<xsd:sequence> | ||
<xsd:element name="value" type="xsd:string" minOccurs="0" /> | ||
</xsd:sequence> | ||
<xsd:attribute name="name" use="required" type="xsd:string" /> | ||
<xsd:attribute name="type" type="xsd:string" /> | ||
<xsd:attribute name="mimetype" type="xsd:string" /> | ||
<xsd:attribute ref="xml:space" /> | ||
</xsd:complexType> | ||
</xsd:element> | ||
<xsd:element name="assembly"> | ||
<xsd:complexType> | ||
<xsd:attribute name="alias" type="xsd:string" /> | ||
<xsd:attribute name="name" type="xsd:string" /> | ||
</xsd:complexType> | ||
</xsd:element> | ||
<xsd:element name="data"> | ||
<xsd:complexType> | ||
<xsd:sequence> | ||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | ||
</xsd:sequence> | ||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> | ||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | ||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | ||
<xsd:attribute ref="xml:space" /> | ||
</xsd:complexType> | ||
</xsd:element> | ||
<xsd:element name="resheader"> | ||
<xsd:complexType> | ||
<xsd:sequence> | ||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||
</xsd:sequence> | ||
<xsd:attribute name="name" type="xsd:string" use="required" /> | ||
</xsd:complexType> | ||
</xsd:element> | ||
</xsd:choice> | ||
</xsd:complexType> | ||
</xsd:element> | ||
</xsd:schema> | ||
<resheader name="resmimetype"> | ||
<value>text/microsoft-resx</value> | ||
</resheader> | ||
<resheader name="version"> | ||
<value>2.0</value> | ||
</resheader> | ||
<resheader name="reader"> | ||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
</resheader> | ||
<resheader name="writer"> | ||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
</resheader> | ||
</root> |