Initial import
This commit is contained in:
1 parent
ea3f8549e4
commit
fa6feafba7
133 files changed
+17503
-4
No files matched your search
@@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DelphiProjectHandler.Dialogs.FileSelectors
|
||||
{
|
||||
public class FilesSelector: IFilesSelector
|
||||
{
|
||||
#region Private
|
||||
|
||||
private IFilesSelectorOptions fDefaultOptions;
|
||||
|
||||
#endregion
|
||||
#region Protected
|
||||
|
||||
protected IFilesSelectorOptions CreateDefaultOptions()
|
||||
{
|
||||
IFilesSelectorOptions vOptions = new FilesSelectorOptions();
|
||||
vOptions.Filter = "Pas files|*.pas|All files|*.*";
|
||||
vOptions.DefaultExt = "pas";
|
||||
vOptions.MultiSelect = true;
|
||||
vOptions.Title = "Select one or more units to add";
|
||||
return vOptions;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region Public
|
||||
|
||||
public FilesSelector()
|
||||
: base()
|
||||
{
|
||||
fDefaultOptions = CreateDefaultOptions();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region IFilesSelctor Implementation
|
||||
|
||||
public IFilesSelectorOptions DefaultOptions
|
||||
{
|
||||
get { return fDefaultOptions; }
|
||||
}
|
||||
|
||||
public ICollection<string> SelectFiles(IFilesSelectorOptions aOptions)
|
||||
{
|
||||
OpenFileDialog vDialog = new OpenFileDialog();
|
||||
vDialog.Filter = aOptions.Filter;
|
||||
vDialog.DefaultExt = aOptions.DefaultExt;
|
||||
vDialog.Multiselect = aOptions.MultiSelect;
|
||||
vDialog.SupportMultiDottedExtensions = true;
|
||||
vDialog.Title = aOptions.Title;
|
||||
|
||||
if (vDialog.ShowDialog() != DialogResult.OK)
|
||||
return new List<string>();
|
||||
|
||||
return vDialog.FileNames;
|
||||
}
|
||||
|
||||
public ICollection<string> SelectFiles()
|
||||
{
|
||||
return SelectFiles(DefaultOptions);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace DelphiProjectHandler.Dialogs.FileSelectors
|
||||
{
|
||||
public class FilesSelectorOptions: IFilesSelectorOptions
|
||||
{
|
||||
#region (Private)
|
||||
|
||||
private string fTitle;
|
||||
private string fFilter;
|
||||
private string fDefaultExt;
|
||||
private bool fMultiSelect;
|
||||
|
||||
#endregion
|
||||
#region (IFilesSelectorOptions Implementation)
|
||||
|
||||
public string Title
|
||||
{
|
||||
get
|
||||
{
|
||||
return fTitle;
|
||||
}
|
||||
set
|
||||
{
|
||||
fTitle = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string Filter
|
||||
{
|
||||
get
|
||||
{
|
||||
return fFilter;
|
||||
}
|
||||
set
|
||||
{
|
||||
fFilter = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string DefaultExt
|
||||
{
|
||||
get
|
||||
{
|
||||
return fDefaultExt;
|
||||
}
|
||||
set
|
||||
{
|
||||
fDefaultExt = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool MultiSelect
|
||||
{
|
||||
get
|
||||
{
|
||||
return fMultiSelect;
|
||||
}
|
||||
set
|
||||
{
|
||||
fMultiSelect = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
|
||||
namespace DelphiProjectHandler.Dialogs.FileSelectors
|
||||
{
|
||||
public class FolderFilesImporter: IFolderFilesImporter
|
||||
{
|
||||
public ICollection<string> SelectFiles(string aDescription, string aFileMask)
|
||||
{
|
||||
FolderBrowserDialog vDialog = new FolderBrowserDialog();
|
||||
vDialog.ShowNewFolderButton = false;
|
||||
vDialog.Description = aDescription;
|
||||
if (vDialog.ShowDialog() != DialogResult.OK)
|
||||
return new List<string>();
|
||||
|
||||
return Directory.GetFiles(vDialog.SelectedPath, aFileMask, SearchOption.AllDirectories);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace DelphiProjectHandler.Dialogs.FileSelectors
|
||||
{
|
||||
public interface IFilesSelectorOptions
|
||||
{
|
||||
string Title { get; set; }
|
||||
string Filter { get; set; }
|
||||
string DefaultExt { get; set; }
|
||||
bool MultiSelect { get; set; }
|
||||
}
|
||||
|
||||
public interface IFilesSelector
|
||||
{
|
||||
IFilesSelectorOptions DefaultOptions { get; }
|
||||
|
||||
ICollection<string> SelectFiles(IFilesSelectorOptions aOptions);
|
||||
ICollection<string> SelectFiles();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace DelphiProjectHandler.Dialogs.FileSelectors
|
||||
{
|
||||
public interface IFolderFilesImporter
|
||||
{
|
||||
ICollection<string> SelectFiles(string aDescription, string aFileMask);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using DelphiProjectHandler.Dialogs.FileSelectors;
|
||||
|
||||
namespace DelphiProjectHandler.Dialogs.FileSelectors.Specialized
|
||||
{
|
||||
public class DprFilesSelector: IFilesSelector
|
||||
{
|
||||
#region Private
|
||||
|
||||
private IFilesSelector fBaseSelector;
|
||||
private IFilesSelectorOptions fDefaultOptions;
|
||||
|
||||
#endregion
|
||||
#region Protected
|
||||
|
||||
protected IFilesSelector BaseSelector
|
||||
{
|
||||
get { return fBaseSelector; }
|
||||
}
|
||||
|
||||
protected IFilesSelectorOptions CreateDefaultOptions()
|
||||
{
|
||||
IFilesSelectorOptions vOptions = new FilesSelectorOptions();
|
||||
vOptions.Filter = "DPR files|*.dpr|All files|*.*";
|
||||
vOptions.DefaultExt = "dpr";
|
||||
vOptions.MultiSelect = true;
|
||||
vOptions.Title = "Select one or more projects";
|
||||
return vOptions;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region Public
|
||||
|
||||
public DprFilesSelector(IFilesSelector aBaseSelector): base()
|
||||
{
|
||||
fBaseSelector = aBaseSelector;
|
||||
fDefaultOptions = CreateDefaultOptions();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region IFilesSelector Members
|
||||
|
||||
public IFilesSelectorOptions DefaultOptions
|
||||
{
|
||||
get { return fDefaultOptions; }
|
||||
}
|
||||
|
||||
public ICollection<string> SelectFiles(IFilesSelectorOptions aOptions)
|
||||
{
|
||||
return BaseSelector.SelectFiles(aOptions);
|
||||
}
|
||||
|
||||
public ICollection<string> SelectFiles()
|
||||
{
|
||||
return SelectFiles(DefaultOptions);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace DelphiProjectHandler.Dialogs.FileSelectors.Specialized
|
||||
{
|
||||
public class PasFilesSelector: IFilesSelector
|
||||
{
|
||||
#region Private
|
||||
|
||||
private IFilesSelector fBaseSelector;
|
||||
private IFilesSelectorOptions fDefaultOptions;
|
||||
|
||||
#endregion
|
||||
#region Protected
|
||||
|
||||
protected IFilesSelector BaseSelector
|
||||
{
|
||||
get { return fBaseSelector; }
|
||||
}
|
||||
|
||||
protected IFilesSelectorOptions CreateDefaultOptions()
|
||||
{
|
||||
IFilesSelectorOptions vOptions = new FilesSelectorOptions();
|
||||
vOptions.Filter = "Pas files|*.pas|All files|*.*";
|
||||
vOptions.DefaultExt = "pas";
|
||||
vOptions.MultiSelect = true;
|
||||
vOptions.Title = "Select one or more units to add";
|
||||
return vOptions;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region Public
|
||||
|
||||
public PasFilesSelector(IFilesSelector aBaseSelector)
|
||||
: base()
|
||||
{
|
||||
fBaseSelector = aBaseSelector;
|
||||
fDefaultOptions = CreateDefaultOptions();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region IFilesSelector Members
|
||||
|
||||
public IFilesSelectorOptions DefaultOptions
|
||||
{
|
||||
get { return fDefaultOptions; }
|
||||
}
|
||||
|
||||
public ICollection<string> SelectFiles(IFilesSelectorOptions aOptions)
|
||||
{
|
||||
return BaseSelector.SelectFiles(aOptions);
|
||||
}
|
||||
|
||||
public ICollection<string> SelectFiles()
|
||||
{
|
||||
return SelectFiles(DefaultOptions);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace DelphiProjectHandler.Dialogs.FileSelectors.Specialized
|
||||
{
|
||||
public class XmlFileSelector: IFilesSelector
|
||||
{
|
||||
#region Private
|
||||
|
||||
private IFilesSelector fBaseSelector;
|
||||
private IFilesSelectorOptions fDefaultOptions;
|
||||
|
||||
#endregion
|
||||
#region Protected
|
||||
|
||||
protected IFilesSelector BaseSelector
|
||||
{
|
||||
get { return fBaseSelector; }
|
||||
}
|
||||
|
||||
protected IFilesSelectorOptions CreateDefaultOptions()
|
||||
{
|
||||
IFilesSelectorOptions vOptions = new FilesSelectorOptions();
|
||||
vOptions.Filter = "XML files|*.xml|All files|*.*";
|
||||
vOptions.DefaultExt = "xml";
|
||||
vOptions.MultiSelect = false;
|
||||
vOptions.Title = "Select existing XML file";
|
||||
return vOptions;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region Public
|
||||
|
||||
public XmlFileSelector(IFilesSelector aBaseSelector): base()
|
||||
{
|
||||
fBaseSelector = aBaseSelector;
|
||||
fDefaultOptions = CreateDefaultOptions();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region IFilesSelector Members
|
||||
|
||||
public IFilesSelectorOptions DefaultOptions
|
||||
{
|
||||
get { return fDefaultOptions; }
|
||||
}
|
||||
|
||||
public ICollection<string> SelectFiles(IFilesSelectorOptions aOptions)
|
||||
{
|
||||
return BaseSelector.SelectFiles(aOptions);
|
||||
}
|
||||
|
||||
public ICollection<string> SelectFiles()
|
||||
{
|
||||
return SelectFiles(DefaultOptions);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user