Skip to content

Commit 13238a2

Browse files
committed
Add support for enfuse ref dukus#151
1 parent e064609 commit 13238a2

File tree

16 files changed

+998
-14
lines changed

16 files changed

+998
-14
lines changed
Binary file not shown.
Binary file not shown.

CameraControl.Core/CameraControl.Core.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@
226226
<Compile Include="Classes\PhotoSession.cs" />
227227
<Compile Include="Classes\PhotoUtils.cs" />
228228
<Compile Include="Classes\PipeServerT.cs" />
229+
<Compile Include="Classes\PluginSetting.cs" />
229230
<Compile Include="Classes\PrintSettings.cs" />
230231
<Compile Include="Classes\Queue\QueueItemFileItem.cs" />
231232
<Compile Include="Classes\Settings.cs" />

CameraControl.Core/Classes/PhotoSession.cs

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -392,13 +392,7 @@ public bool AskSavePath
392392
}
393393
}
394394

395-
private string _configFile;
396-
397-
public string ConfigFile
398-
{
399-
get { return _configFile; }
400-
set { _configFile = value; }
401-
}
395+
public string ConfigFile { get; set; }
402396

403397
public TimeLapseSettings TimeLapseSettings { get; set; }
404398
public PrintSettings PrintSettings { get; set; }
@@ -696,6 +690,10 @@ public override string ToString()
696690
return Name;
697691
}
698692

693+
/// <summary>
694+
/// Return selected items
695+
/// </summary>
696+
/// <returns>Empty list if no item is selected</returns>
699697
public AsyncObservableCollection<FileItem> GetSelectedFiles()
700698
{
701699
lock (_locker)
@@ -710,6 +708,24 @@ public AsyncObservableCollection<FileItem> GetSelectedFiles()
710708
}
711709
}
712710

711+
/// <summary>
712+
/// Return items with i series
713+
/// </summary>
714+
/// <returns>Empty list if no item was found</returns>
715+
public AsyncObservableCollection<FileItem> GetSeries(int i)
716+
{
717+
lock (_locker)
718+
{
719+
AsyncObservableCollection<FileItem> list = new AsyncObservableCollection<FileItem>();
720+
foreach (FileItem fileItem in Files)
721+
{
722+
if (fileItem.Series==i)
723+
list.Add(fileItem);
724+
}
725+
return list;
726+
}
727+
}
728+
713729
public void SelectAll()
714730
{
715731
lock (_locker)
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using System.Xml.Serialization;
7+
8+
namespace CameraControl.Core.Classes
9+
{
10+
public class PluginSetting
11+
{
12+
public string Name { get; set; }
13+
public List<ValuePair> Values { get; set; }
14+
15+
public PluginSetting()
16+
{
17+
Values = new List<ValuePair>();
18+
}
19+
20+
/// <summary>
21+
/// Return value for name parameter
22+
/// </summary>
23+
/// <param name="name"></param>
24+
/// <returns> string</returns>
25+
[XmlIgnore]
26+
public object this[string name]
27+
{
28+
get
29+
{
30+
foreach (var value in Values)
31+
{
32+
if (value.Name == name)
33+
return value.Value;
34+
}
35+
return "";
36+
}
37+
set
38+
{
39+
foreach (var values in Values)
40+
{
41+
if (values.Name == name)
42+
{
43+
values.Value = value.ToString();
44+
return;
45+
}
46+
}
47+
Values.Add(new ValuePair() {Name = name, Value = value.ToString()});
48+
}
49+
}
50+
51+
52+
public bool GetBool(string name)
53+
{
54+
return (from value in Values where value.Name == name select value.Value == "True").FirstOrDefault();
55+
}
56+
57+
public int GetInt(string name)
58+
{
59+
int i = 0;
60+
foreach (var value in Values)
61+
{
62+
if (value.Name == name)
63+
{
64+
if (int.TryParse(value.Value, out i))
65+
return i;
66+
}
67+
}
68+
return 0;
69+
}
70+
}
71+
}

CameraControl.Core/Classes/Settings.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,7 @@ public bool LoadCanonTransferMode
886886

887887
public bool FullScreenInSecondaryMonitor { get; set; }
888888
public bool Autorotate { get; set; }
889+
public ObservableCollection<PluginSetting> PluginSettings { get; set; }
889890

890891
public bool ShowThumbInfo
891892
{
@@ -943,6 +944,26 @@ public static string ApplicationFolder
943944
get { return Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); }
944945
}
945946

947+
/// <summary>
948+
/// Return plugin settings with specified name
949+
/// </summary>
950+
/// <param name="name"></param>
951+
/// <returns></returns>
952+
public PluginSetting this[string name]
953+
{
954+
get
955+
{
956+
foreach (var pluginSetting in PluginSettings)
957+
{
958+
if (pluginSetting.Name == name)
959+
return pluginSetting;
960+
}
961+
var pl=new PluginSetting(){Name = name};
962+
PluginSettings.Add(pl);
963+
return pl;
964+
}
965+
}
966+
946967
public Settings()
947968
{
948969
ConfigFile = Path.Combine(DataFolder, "settings.xml");
@@ -953,6 +974,7 @@ public Settings()
953974
ImageLoading = false;
954975
CameraProperties = new CameraPropertyEnumerator();
955976
DeviceConfigs = new CustomConfigEnumerator();
977+
PluginSettings = new ObservableCollection<PluginSetting>();
956978
ResetSettings();
957979
}
958980

CameraControl.Plugins/CameraControl.Plugins.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,11 @@
294294
<Compile Include="Plugins.cs" />
295295
<Compile Include="ExportPlugins\ExportToFolder.cs" />
296296
<Compile Include="Properties\AssemblyInfo.cs" />
297+
<Compile Include="ToolPlugins\EnfusePlugin.cs" />
298+
<Compile Include="ToolPlugins\EnfusePluginViewModel.cs" />
299+
<Compile Include="ToolPlugins\EnfusePluginWindow.xaml.cs">
300+
<DependentUpon>EnfusePluginWindow.xaml</DependentUpon>
301+
</Compile>
297302
<Compile Include="ToolPlugins\GenMoviePlugin.cs" />
298303
<Compile Include="ToolPlugins\GenMovieViewModel.cs" />
299304
<Compile Include="ToolPlugins\GenMovieWindow.xaml.cs">
@@ -434,6 +439,10 @@
434439
<Generator>MSBuild:Compile</Generator>
435440
<SubType>Designer</SubType>
436441
</Page>
442+
<Page Include="ToolPlugins\EnfusePluginWindow.xaml">
443+
<SubType>Designer</SubType>
444+
<Generator>MSBuild:Compile</Generator>
445+
</Page>
437446
<Page Include="ToolPlugins\GenMovieWindow.xaml">
438447
<SubType>Designer</SubType>
439448
<Generator>MSBuild:Compile</Generator>

CameraControl.Plugins/Plugins.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public bool Register()
6363
ServiceProvider.PluginManager.ToolPlugins.Add(new GenThumbPlugin());
6464
ServiceProvider.PluginManager.ToolPlugins.Add(new ImageSequencerPlugin());
6565
ServiceProvider.PluginManager.ToolPlugins.Add(new GenMoviePlugin());
66+
ServiceProvider.PluginManager.ToolPlugins.Add(new EnfusePlugin());
6667

6768
ServiceProvider.ExternalDeviceManager.ExternalDevices.Add(new SerialPortShutterRelease());
6869
ServiceProvider.ExternalDeviceManager.ExternalDevices.Add(new DSUSBShutterRelease());
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using CameraControl.Core.Interfaces;
7+
8+
namespace CameraControl.Plugins.ToolPlugins
9+
{
10+
public class EnfusePlugin : IToolPlugin
11+
{
12+
public bool Execute()
13+
{
14+
EnfusePluginWindow window = new EnfusePluginWindow();
15+
window.DataContext = new EnfusePluginViewModel();
16+
window.ShowDialog();
17+
return true;
18+
}
19+
20+
public string Title { get; set; }
21+
22+
public string Id
23+
{
24+
get { return "{2495C316-F222-4AAC-8F2C-65DF524D75CC}"; }
25+
}
26+
27+
public EnfusePlugin()
28+
{
29+
Title = "Enfuse";
30+
}
31+
32+
}
33+
}

0 commit comments

Comments
 (0)