Compare commits

..

10 Commits

39 changed files with 2556 additions and 0 deletions

View File

@ -0,0 +1,135 @@
using ImageHandlingLibrary.InterFaces;
using ImageHandlingLibrary.Models;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media.Imaging;
namespace ImageHandlingLibrary
{
public class Filing : IFiling
{
private readonly IRegistring _registring;
public Filing(IRegistring registring)
{
_registring = registring;
}
public BitmapImage ConvertFromDrawImage(System.Drawing.Image _image)
{
using (var ms = new MemoryStream())
{
//System.Drawing.Image.FromFile(@"D:\CsharpDevelop\PictureHandlingProject\pictures\AgueroVillage.JPG").Save(ms, ImageFormat.Bmp);
_image.Save(ms, ImageFormat.Bmp);
ms.Seek(0, SeekOrigin.Begin);
var bitmapImage = new BitmapImage();
bitmapImage.BeginInit();
bitmapImage.CacheOption = BitmapCacheOption.OnLoad;
bitmapImage.StreamSource = ms;
bitmapImage.EndInit();
return bitmapImage;
}
}
public string ShowText()
{
var output = _registring.GetRegistryRootDir();
return $"Root directory value is {output} OBS Test!!";
}
public List<LocalPicture> CreateListBoxDataSource(List<FileInfo> fileInfos, string rootCatalog)
{
var outPut = new List<LocalPicture>();
foreach (var fi in fileInfos)
{
var bufPicture = new LocalPicture();
bufPicture.RootPosition = rootCatalog;
bufPicture.PictureFileName = fi.Name;
bufPicture.InitialPath = fi.DirectoryName;
bufPicture.AktImage = Image.FromFile(bufPicture.PictureFullPath);
bufPicture.AktImWidth = bufPicture.AktImage.Width;
bufPicture.AktImHeight = bufPicture.AktImage.Height;
bufPicture.CreatedDate = TakenDate(bufPicture.AktImage);
outPut.Add(bufPicture);
}
return FillupDateGaps(outPut);
}
private string TakenDate(Image aktImage)
{
string sPropDatTaken = "";
for (int i = 0; i < aktImage.PropertyIdList.Length; i++)
{
if (aktImage.PropertyIdList[i] == 306)
{
for (int j = 0; j < aktImage.PropertyItems[i].Len; j++)
{
sPropDatTaken += Convert.ToChar(aktImage.PropertyItems[i].Value[j]);
}
}
}
return sPropDatTaken;
}
private List<LocalPicture> FillupDateGaps(List<LocalPicture> inPut)
{
var picReg = new SortedList<string, LocalPicture>();
foreach (var pict in inPut)
{
picReg.Add(pict.PictureFileName, pict);
}
var tmpPicture = new LocalPicture();
tmpPicture.CreatedDate = "";
Stack<string> stack = new Stack<string>();
var outPut = new List<LocalPicture>();
foreach (KeyValuePair<string, LocalPicture> lPic in picReg)
{
if (lPic.Value.CreatedDate == "")
{
if (tmpPicture.CreatedDate != "")
{
lPic.Value.CreatedDate = tmpPicture.CreatedDate;
lPic.Value.CreatedDateChanged = true;
outPut.Add(lPic.Value);
}
else
{
stack.Push(lPic.Key);
}
}
else
{
tmpPicture = lPic.Value;
while (stack.Count > 0)
{
var picRegKey = stack.Pop();
picReg[picRegKey].CreatedDate = tmpPicture.CreatedDate;
picReg[picRegKey].CreatedDateChanged = true;
outPut.Add(picReg[picRegKey]);
}
outPut.Add(lPic.Value);
}
}
return outPut;
}
}
}

View File

@ -0,0 +1,63 @@

using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using ImageHandlingLibrary.InterFaces;
namespace ImageHandlingLibrary.Helpers
{
public class Dialogs : IDialogs
{
public List<FileInfo> ChooseFiles()
{
using (OpenFileDialog ofd = new OpenFileDialog())
{
var outPut = new List<FileInfo>();
ofd.Title = "Välj bild-fil!";
ofd.InitialDirectory = "C:\\";
ofd.Filter = "Picture files (*.jpg)|*.jpg;*.jpeg|All files (*.*)|*.*";
ofd.FilterIndex = 1;
ofd.RestoreDirectory = true;
ofd.Multiselect = true;
ofd.ShowDialog();
var fnames = ofd.FileNames;
if (fnames.Length > 1)
{
foreach (var fname in fnames)
{
outPut.Add(new FileInfo(fname));
}
}
//else
//{
// string fName = ofd.FileName;
// if (fName.Trim() != "")
// {
// int fNamePos = fName.LastIndexOf(@"\") + 1;
// lblFileName.Text = fName.Substring(fNamePos);
// lblPath.Text = fName.Substring(0, fNamePos);
// listLocalFiles();
// for (int i = 0; i < lstPicFiles.Items.Count; i++)
// {
// if (lstPicFiles.Items[i].ToString() == lblFileName.Text)
// {
// lstPicFiles.SelectedIndex = i;
// break;
// }
// }
// }
//}
return outPut;
}
}
}
}

View File

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{CF1C98B6-5093-4B93-8B14-A0278B1AF724}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ImageHandlingLibrary</RootNamespace>
<AssemblyName>ImageHandlingLibrary</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="Filing.cs" />
<Compile Include="Helpers\Dialogs.cs" />
<Compile Include="InterFaces\IDialogs.cs" />
<Compile Include="InterFaces\IFiling.cs" />
<Compile Include="InterFaces\IRegistring.cs" />
<Compile Include="Models\LocalPicture.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Registring.cs" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ImageHandlingLibrary.InterFaces
{
public interface IDialogs
{
List<FileInfo> ChooseFiles();
}
}

View File

@ -0,0 +1,21 @@
using ImageHandlingLibrary.Models;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media.Imaging;
namespace ImageHandlingLibrary.InterFaces
{
public interface IFiling
{
BitmapImage ConvertFromDrawImage(Image _image);
List<LocalPicture> CreateListBoxDataSource(List<FileInfo> fileInfos, string rootCatalog);
string ShowText();
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ImageHandlingLibrary.InterFaces
{
public interface IRegistring
{
string GetRegistryRootDir();
void SetRegistryValues(string rootDir);
}
}

View File

@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ImageHandlingLibrary.Models
{
public class LocalPicture
{
public string PictureFileName { get; set; }
public string InitialPath { get; set; }
public string PictureFullPath
{
get
{
return Path.Combine(InitialPath, PictureFileName);
}
}
public Image AktImage { get; set; }
public int AktImWidth { get; set; }
public int AktImHeight { get; set; }
public string CreatedDate { get; set; }
public bool CreatedDateChanged { get; set; } = false;
public string AarManDir
{
get
{
if (string.IsNullOrEmpty(CreatedDate)) return RootPosition;
else
{
DateTime dttd = DateTime.Parse(CreatedDate.Substring(0, 10).Replace(":", "-"));
string subDir = dttd.Year.ToString("0000") + "-" + dttd.Month.ToString("00") + @"\";
return Path.Combine(RootPosition + subDir);
}
}
}
public string AarManDayDir
{
get
{
if (string.IsNullOrEmpty(CreatedDate)) return RootPosition;
else
{
DateTime dttd = DateTime.Parse(CreatedDate.Substring(0, 10).Replace(":", "-"));
string subDir = dttd.Year.ToString("0000") + "_" + dttd.Month.ToString("00") + "_" + dttd.Day.ToString("00") + @"\";
return Path.Combine(AarManDir + subDir);
}
}
}
public string ImageNewFullpath
{
get
{
return Path.Combine(AarManDayDir + PictureFileName);
}
}
public string RootPosition { get; set; }
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ImageHandlingLibrary")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ImageHandlingLibrary")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("cf1c98b6-5093-4b93-8b14-a0278b1af724")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,59 @@
using ImageHandlingLibrary.InterFaces;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ImageHandlingLibrary
{
public class Registring :IRegistring
{
public Registring()
{
CU = Registry.CurrentUser;
}
public RegistryKey CU { get; set; }
public string GetRegistryRootDir()
{
string output;
RegistryKey PictureHandling = CU.OpenSubKey(@"SOFTWARE\IdoIt4u\PictureHandling");
if (PictureHandling == null)
{
output = @"D:\OurPictures";
SetRegistryValues(output);
}
else
{
output = (string)PictureHandling.GetValue(@"RootMap");
}
return output;
}
public void SetRegistryValues(string rootDir)
{
RegistryKey IdoIt4u = CU.OpenSubKey(@"SOFTWARE\IdoIt4u", true);
RegistryKey PictureHandling = null;
if (IdoIt4u != null)
{
PictureHandling = IdoIt4u.OpenSubKey(@"PictureHandling", true);
}
if (PictureHandling == null)
{
if (IdoIt4u == null)
{
IdoIt4u = Registry.CurrentUser.CreateSubKey(@"Software\IdoIt4u", true);
}
else
PictureHandling = IdoIt4u.CreateSubKey(@"PictureHandling", true);
}
else
{
PictureHandling.SetValue(@"RootMap", rootDir);
}
}
}
}

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

14
ImageHandlingUI/App.xaml Normal file
View File

@ -0,0 +1,14 @@
<Application x:Class="ImageHandlingUI.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ImageHandlingUI">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<local:Bootstrapper x:Key="Bootstrapper"/>
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace ImageHandlingUI
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

View File

@ -0,0 +1,78 @@
using Caliburn.Micro;
using ImageHandlingLibrary;
using ImageHandlingLibrary.Helpers;
using ImageHandlingLibrary.InterFaces;
using ImageHandlingUI.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace ImageHandlingUI
{
public class Bootstrapper : BootstrapperBase
{
// implementing SimpleContainer (dependency injection system in Caliburn micro)
private SimpleContainer _container = new SimpleContainer();
public Bootstrapper()
{
Initialize();
}
// implementing SimpleContainer (dependency injection system in Caliburn micro)
//
protected override void Configure()
{
_container.Instance(_container);
_container
.Singleton<IWindowManager, WindowManager>()
.Singleton<IEventAggregator, EventAggregator>();
_container
.PerRequest<IRegistring, Registring>()
.PerRequest<IDialogs, Dialogs>()
.PerRequest<IFiling, Filing>();
GetType().Assembly.GetTypes()
.Where(type => type.IsClass)
.Where(type => type.Name.EndsWith("ViewModel"))
.ToList()
.ForEach(viewModelType => _container.RegisterPerRequest(
viewModelType, viewModelType.ToString(), viewModelType));
}
//
// implementing SimpleContainer (dependency injection system in Caliburn micro)
protected override void OnStartup(object sender, StartupEventArgs e)
{
DisplayRootViewFor<ShellViewModel>();
}
// implementing SimpleContainer (dependency injection system in Caliburn micro)
//
protected override object GetInstance(Type service, string key)
{
return _container.GetInstance(service, key);
}
protected override IEnumerable<object> GetAllInstances(Type service)
{
return _container.GetAllInstances(service);
}
protected override void BuildUp(object instance)
{
_container.BuildUp(instance);
}
//
// implementing SimpleContainer (dependency injection system in Caliburn micro)
}
}

View File

@ -0,0 +1,122 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{9F7FC0FF-02D4-4B31-8B8A-81B015483445}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>ImageHandlingUI</RootNamespace>
<AssemblyName>ImageHandlingUI</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Caliburn.Micro, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
<HintPath>..\packages\Caliburn.Micro.Core.3.2.0\lib\net45\Caliburn.Micro.dll</HintPath>
</Reference>
<Reference Include="Caliburn.Micro.Platform, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
<HintPath>..\packages\Caliburn.Micro.3.2.0\lib\net45\Caliburn.Micro.Platform.dll</HintPath>
</Reference>
<Reference Include="Caliburn.Micro.Platform.Core, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8e5891231f2ed21f, processorArchitecture=MSIL">
<HintPath>..\packages\Caliburn.Micro.3.2.0\lib\net45\Caliburn.Micro.Platform.Core.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Caliburn.Micro.3.2.0\lib\net45\System.Windows.Interactivity.dll</HintPath>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Bootstrapper.cs" />
<Compile Include="ViewModels\ShellViewModel.cs" />
<Compile Include="Views\ShellView.xaml.cs">
<DependentUpon>ShellView.xaml</DependentUpon>
</Compile>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="Views\ShellView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Folder Include="Models\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ImageHandlingLibrary\ImageHandlingLibrary.csproj">
<Project>{cf1c98b6-5093-4b93-8b14-a0278b1af724}</Project>
<Name>ImageHandlingLibrary</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -0,0 +1,55 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ImageHandlingUI")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ImageHandlingUI")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ImageHandlingUI.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ImageHandlingUI.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@ -0,0 +1,117 @@
<?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.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: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" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ImageHandlingUI.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@ -0,0 +1,118 @@
using Caliburn.Micro;
using ImageHandlingLibrary.InterFaces;
using ImageHandlingLibrary.Models;
using System;
using System.Collections.Generic;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
namespace ImageHandlingUI.ViewModels
{
public class ShellViewModel : Conductor<object>
{
private string _rootCatalog;
private readonly IRegistring _registring;
private readonly IFiling _filing;
private readonly IDialogs _dialogs;
private string initialFileName;
ImageSource _selectedImage = null;
private List<FileInfo> fileInfos;
private bool canChooseFile = true;
private BindableCollection<LocalPicture> picList = new BindableCollection<LocalPicture>();
public ShellViewModel(IRegistring registring, IFiling filing, IDialogs dialogs)
{
initialFileName = @"D:\CsharpDevelop\PictureHandlingProject\pictures\AgueroVillage.JPG";
_selectedImage = filing.ConvertFromDrawImage(System.Drawing.Image.FromFile(InitialFileName));
_registring = registring;
_filing = filing;
_dialogs = dialogs;
}
public ImageSource SelectedImage
{
get { return _selectedImage; }
set
{
_selectedImage = value;
NotifyOfPropertyChange(() => SelectedImage);
}
}
public string InitialFileName { get => initialFileName; set => initialFileName = value; }
public string RootCatalog
{
get
{
_rootCatalog = _registring.GetRegistryRootDir();
return _rootCatalog;
}
set
{
if (value != _rootCatalog)
{
_registring.SetRegistryValues(value);
}
_rootCatalog = value;
}
}
private string _groundPath;
public string GroundPath
{
get
{
_groundPath = _filing.ShowText();
return _groundPath;
}
set { _groundPath = value; }
}
public bool CanChooseFile
{
get { return canChooseFile; }
set { canChooseFile = value; }
}
public void ChooseFile()
{
fileInfos = _dialogs.ChooseFiles();
if (fileInfos.Count > 0)
{
//Cursor.Current = Cursors.WaitCursor;
var localPicList = _filing.CreateListBoxDataSource(fileInfos, _rootCatalog);
foreach (var lPicture in localPicList)
{
picList.Add(lPicture);
}
NotifyOfPropertyChange(() => PicList);
}
}
public BindableCollection<LocalPicture> PicList
{
get { return picList; }
set { picList = value; }
}
}
}

View File

@ -0,0 +1,132 @@
<Window x:Class="ImageHandlingUI.Views.ShellView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ImageHandlingUI.Views" FontSize="12"
mc:Ignorable="d" WindowStartupLocation="CenterScreen"
Title="ShellView" Height="650" Width="800" Background="Beige">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20" />
<!--Border-->
<ColumnDefinition Width="auto" />
<!--Depending on control?-->
<ColumnDefinition Width="auto" MinWidth="102" />
<!--Depending on control?-->
<ColumnDefinition Width="auto" MinWidth="248" />
<!--Depending on control?-->
<ColumnDefinition Width="auto" />
<!--Depending on control?-->
<ColumnDefinition />
<!--Resten-->
<ColumnDefinition Width="20" />
<!--Border-->
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="20" />
<RowDefinition Height="35" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="35" />
<RowDefinition Height="35" />
<RowDefinition Height="auto" />
<RowDefinition Height="35" />
<RowDefinition Height="auto" />
<RowDefinition Height="*" />
<RowDefinition Height="20" />
</Grid.RowDefinitions>
<!--Row 1-->
<TextBlock Grid.Row="1" Grid.Column="3"
HorizontalAlignment="Center" FontSize="18" Margin="119,0,1,0" Width="128">
Picture handling
</TextBlock>
<!--Row 2-->
<TextBlock Grid.Row="2" Grid.Column="1"
HorizontalAlignment="Left"
VerticalAlignment="Bottom" Height="16" Width="42" Margin="3 3 3 3">
Filnamn
</TextBlock>
<TextBox x:Name="InitialFileName"
Grid.Row="2" Grid.Column="2"
Grid.ColumnSpan="4"
Margin="3 3 3 3"/>
<!--Row 3-->
<TextBlock Grid.Row="3" Grid.Column="1"
HorizontalAlignment="Left" Width="23" Margin="3 3 3 3">
Path
</TextBlock>
<TextBox x:Name="InitialFilePath" Grid.Row="3"
Grid.Column="2" Grid.ColumnSpan="2"
MinWidth="350" Margin="3,3"/>
<TextBlock Grid.Row="3" Grid.Column="4" HorizontalAlignment="Left" Width="39" Margin="3 3 3 3">
Skapad
</TextBlock>
<TextBox x:Name="CreatedDate" Grid.Row="3"
Grid.Column="5"
Margin="3 3 3 3"/>
<!--Row 4-->
<TextBlock Grid.Row="4" Grid.Column="1" HorizontalAlignment="Left" Width="56" Margin="3 3 3 3">
GrundPath
</TextBlock>
<TextBox x:Name="GroundPath" Grid.Row="4"
Grid.Column="2" Grid.ColumnSpan="2"
Margin="3,3,3,3" Height="16" VerticalAlignment="Top"/>
<TextBlock Grid.Row="4" Grid.Column="4" HorizontalAlignment="Left" Width="44" Margin="3 3 3 3">
Slutpath
</TextBlock>
<TextBox x:Name="FinishPath"
Grid.Row="4" Grid.Column="5" Margin="3,3,3,3" Height="16" VerticalAlignment="Top"/>
<!--Row 5-->
<Button x:Name="ChooseFile" Margin="3 3 3 3"
Grid.Row="5" Grid.Column="1"
FontSize="14" Grid.ColumnSpan="2" >
Välj Fil
</Button>
<Image x:Name="SelectedImage" Margin="3 3 3 3"
Grid.Row="5" Grid.RowSpan="5"
Grid.Column="3" Grid.ColumnSpan="3"
VerticalAlignment="Top"
Source="{Binding Path=SelectedImage}" >
</Image>
<!--Source="D:\CsharpDevelop\PictureHandlingProject\pictures\AgueroVillage.JPG" >-->
<!--Row 6-->
<ListBox x:Name="PictureList"
Grid.Row="6" Grid.Column="1"
Grid.ColumnSpan="2" Margin="3,3,0,3"
MinHeight="300" MinWidth="150"
HorizontalAlignment="Left" Width="150"
ItemsSource="{Binding PicList}">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding PictureFileName}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<!--Row 7-->
<Button x:Name="ReorganizeFiles" Margin="3 3 3 3"
Grid.Row="7" Grid.Column="1"
FontSize="14" Grid.ColumnSpan="2" >
Reorganisera Filer
</Button>
<!--Row 8-->
<TextBlock Grid.Row="8" Grid.Column="1" HorizontalAlignment="Left" Margin="3 3 3 3">
Ny Rotkatalog
</TextBlock>
<TextBox x:Name="RootCatalog"
Grid.Row="9" Grid.Column="1" Grid.ColumnSpan="2" Margin="3,3,3,3" Height="18" VerticalAlignment="Top"/>
</Grid>
</Window>

View File

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace ImageHandlingUI.Views
{
/// <summary>
/// Interaction logic for ShellView.xaml
/// </summary>
public partial class ShellView : Window
{
public ShellView()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Caliburn.Micro" version="3.2.0" targetFramework="net472" />
<package id="Caliburn.Micro.Core" version="3.2.0" targetFramework="net472" />
</packages>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.6.0" newVersion="4.0.6.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

278
PictureHandling/Form1.Designer.cs generated Normal file
View File

@ -0,0 +1,278 @@
using System;
namespace PictureHandling
{
partial class Form1
{
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.Button btnFileDialog;
private System.Windows.Forms.Label lblPath;
private System.Windows.Forms.Label HPath;
private System.Windows.Forms.Label lblFileName;
private System.Windows.Forms.Label HFilnamn;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.ListBox lstPicFiles;
private System.Windows.Forms.Label HSkapad;
private System.Windows.Forms.Button btnReOrganize;
/// <summary>
/// Required designer variable.
/// </summary>
//private System.ComponentModel.Container components = null;
private System.Windows.Forms.Label HNyRotKatalog;
private System.Windows.Forms.TextBox txtRootDir;
private bool Deleting = false;
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.btnFileDialog = new System.Windows.Forms.Button();
this.lblPath = new System.Windows.Forms.Label();
this.HPath = new System.Windows.Forms.Label();
this.lblFileName = new System.Windows.Forms.Label();
this.HFilnamn = new System.Windows.Forms.Label();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.lstPicFiles = new System.Windows.Forms.ListBox();
this.HSkapad = new System.Windows.Forms.Label();
this.btnReOrganize = new System.Windows.Forms.Button();
this.HNyRotKatalog = new System.Windows.Forms.Label();
this.txtRootDir = new System.Windows.Forms.TextBox();
this.HGrundpath = new System.Windows.Forms.Label();
this.lblGroundPath = new System.Windows.Forms.Label();
this.HSlutpath = new System.Windows.Forms.Label();
this.lblFinalPath = new System.Windows.Forms.Label();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.lblCreated = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// btnFileDialog
//
this.btnFileDialog.Location = new System.Drawing.Point(35, 92);
this.btnFileDialog.Name = "btnFileDialog";
this.btnFileDialog.Size = new System.Drawing.Size(75, 23);
this.btnFileDialog.TabIndex = 0;
this.btnFileDialog.Text = "Välj fil";
this.btnFileDialog.Click += new System.EventHandler(this.btnFileDialog_Click);
//
// lblPath
//
this.lblPath.BackColor = System.Drawing.Color.Transparent;
this.lblPath.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblPath.Location = new System.Drawing.Point(75, 16);
this.lblPath.Name = "lblPath";
this.lblPath.Size = new System.Drawing.Size(279, 16);
this.lblPath.TabIndex = 1;
//
// HPath
//
this.HPath.Dock = System.Windows.Forms.DockStyle.Fill;
this.HPath.Location = new System.Drawing.Point(3, 16);
this.HPath.Name = "HPath";
this.HPath.Size = new System.Drawing.Size(66, 16);
this.HPath.TabIndex = 2;
this.HPath.Text = "Path";
//
// lblFileName
//
this.lblFileName.BackColor = System.Drawing.Color.Transparent;
this.tableLayoutPanel1.SetColumnSpan(this.lblFileName, 3);
this.lblFileName.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblFileName.Location = new System.Drawing.Point(75, 0);
this.lblFileName.Name = "lblFileName";
this.lblFileName.Size = new System.Drawing.Size(590, 16);
this.lblFileName.TabIndex = 3;
//
// HFilnamn
//
this.HFilnamn.Dock = System.Windows.Forms.DockStyle.Fill;
this.HFilnamn.Location = new System.Drawing.Point(3, 0);
this.HFilnamn.Name = "HFilnamn";
this.HFilnamn.Size = new System.Drawing.Size(66, 16);
this.HFilnamn.TabIndex = 4;
this.HFilnamn.Text = "Filnamn";
//
// pictureBox1
//
this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pictureBox1.Location = new System.Drawing.Point(179, 90);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(524, 509);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox1.TabIndex = 5;
this.pictureBox1.TabStop = false;
//
// lstPicFiles
//
this.lstPicFiles.FormattingEnabled = true;
this.lstPicFiles.Location = new System.Drawing.Point(35, 124);
this.lstPicFiles.Name = "lstPicFiles";
this.lstPicFiles.Size = new System.Drawing.Size(128, 394);
this.lstPicFiles.TabIndex = 6;
this.lstPicFiles.SelectedIndexChanged += new System.EventHandler(this.lstPicFiles_SelectedIndexChanged);
//
// HSkapad
//
this.HSkapad.Dock = System.Windows.Forms.DockStyle.Fill;
this.HSkapad.Location = new System.Drawing.Point(360, 16);
this.HSkapad.Name = "HSkapad";
this.HSkapad.Size = new System.Drawing.Size(50, 16);
this.HSkapad.TabIndex = 7;
this.HSkapad.Text = "Skapad: ";
//
// btnReOrganize
//
this.btnReOrganize.Enabled = false;
this.btnReOrganize.Location = new System.Drawing.Point(35, 532);
this.btnReOrganize.Name = "btnReOrganize";
this.btnReOrganize.Size = new System.Drawing.Size(136, 23);
this.btnReOrganize.TabIndex = 8;
this.btnReOrganize.Text = "Reorganisera filer";
this.btnReOrganize.Click += new System.EventHandler(this.btnReOrganize_Click);
//
// HNyRotKatalog
//
this.HNyRotKatalog.Location = new System.Drawing.Point(35, 564);
this.HNyRotKatalog.Name = "HNyRotKatalog";
this.HNyRotKatalog.Size = new System.Drawing.Size(128, 16);
this.HNyRotKatalog.TabIndex = 9;
this.HNyRotKatalog.Text = "Ny RotKatalog";
//
// txtRootDir
//
this.txtRootDir.Location = new System.Drawing.Point(35, 580);
this.txtRootDir.Name = "txtRootDir";
this.txtRootDir.Size = new System.Drawing.Size(136, 20);
this.txtRootDir.TabIndex = 10;
this.txtRootDir.Text = "\\\\TFOASUS\\OurPictures";
this.txtRootDir.TextChanged += new System.EventHandler(this.txtRootDir_TextChanged);
//
// HGrundpath
//
this.HGrundpath.Dock = System.Windows.Forms.DockStyle.Fill;
this.HGrundpath.Location = new System.Drawing.Point(3, 32);
this.HGrundpath.Name = "HGrundpath";
this.HGrundpath.Size = new System.Drawing.Size(66, 18);
this.HGrundpath.TabIndex = 12;
this.HGrundpath.Text = "GrundPath";
//
// lblGroundPath
//
this.lblGroundPath.BackColor = System.Drawing.Color.Transparent;
this.lblGroundPath.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblGroundPath.Location = new System.Drawing.Point(75, 32);
this.lblGroundPath.Name = "lblGroundPath";
this.lblGroundPath.Size = new System.Drawing.Size(279, 18);
this.lblGroundPath.TabIndex = 11;
//
// HSlutpath
//
this.HSlutpath.Dock = System.Windows.Forms.DockStyle.Fill;
this.HSlutpath.Location = new System.Drawing.Point(360, 32);
this.HSlutpath.Name = "HSlutpath";
this.HSlutpath.Size = new System.Drawing.Size(50, 18);
this.HSlutpath.TabIndex = 14;
this.HSlutpath.Text = "SlutPath";
//
// lblFinalPath
//
this.lblFinalPath.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblFinalPath.Location = new System.Drawing.Point(416, 32);
this.lblFinalPath.Name = "lblFinalPath";
this.lblFinalPath.Size = new System.Drawing.Size(249, 18);
this.lblFinalPath.TabIndex = 13;
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 4;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20.16807F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 79.83193F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 56F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 254F));
this.tableLayoutPanel1.Controls.Add(this.lblCreated, 3, 1);
this.tableLayoutPanel1.Controls.Add(this.HGrundpath, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.HFilnamn, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.HSlutpath, 2, 2);
this.tableLayoutPanel1.Controls.Add(this.HSkapad, 2, 1);
this.tableLayoutPanel1.Controls.Add(this.lblFinalPath, 3, 2);
this.tableLayoutPanel1.Controls.Add(this.lblGroundPath, 1, 2);
this.tableLayoutPanel1.Controls.Add(this.lblPath, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.HPath, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.lblFileName, 1, 0);
this.tableLayoutPanel1.Location = new System.Drawing.Point(35, 12);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 3;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(668, 50);
this.tableLayoutPanel1.TabIndex = 15;
//
// lblCreated
//
this.lblCreated.AutoSize = true;
this.lblCreated.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblCreated.Location = new System.Drawing.Point(416, 16);
this.lblCreated.Name = "lblCreated";
this.lblCreated.Size = new System.Drawing.Size(249, 16);
this.lblCreated.TabIndex = 16;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(716, 611);
this.Controls.Add(this.tableLayoutPanel1);
this.Controls.Add(this.txtRootDir);
this.Controls.Add(this.HNyRotKatalog);
this.Controls.Add(this.btnReOrganize);
this.Controls.Add(this.lstPicFiles);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.btnFileDialog);
this.Name = "Form1";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label HGrundpath;
private System.Windows.Forms.Label lblGroundPath;
private System.Windows.Forms.Label HSlutpath;
private System.Windows.Forms.Label lblFinalPath;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Label lblCreated;
}
}

341
PictureHandling/Form1.cs Normal file
View File

@ -0,0 +1,341 @@
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Security.AccessControl;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace PictureHandling
{
public partial class Form1 : Form
{
public RegistryKey CU { get; set; }
public List<LocalPicture> pictureList = new List<LocalPicture>();
public List<string> DeleteList { get; set; } = new List<string>();
private bool noRegReact = false;
public Form1()
{
InitializeComponent();
//TestRegistryPermission();
try
{
CU = Registry.CurrentUser;
RegistryKey PictureHandling = CU.OpenSubKey(@"SOFTWARE\IdoIt4u\PictureHandling");
if (PictureHandling == null)
{
txtRootDir.Text = @"D:\OurPictures";
}
else
{
txtRootDir.Text = (string)PictureHandling.GetValue(@"RootMap");
}
}
catch (Exception ex)
{
MessageBox.Show($"RegistryError: {ex}");
}
}
private void txtRootDir_TextChanged(object sender, EventArgs e)
{
if (noRegReact) return;
try
{
RegistryKey IdoIt4u = CU.OpenSubKey(@"SOFTWARE\IdoIt4u", true);
RegistryKey PictureHandling = null;
if (IdoIt4u != null)
{
PictureHandling = IdoIt4u.OpenSubKey(@"PictureHandling", true);
}
if (PictureHandling == null)
{
if (IdoIt4u == null)
{
IdoIt4u = Registry.CurrentUser.CreateSubKey(@"Software\IdoIt4u", true);
}
else
PictureHandling = IdoIt4u.CreateSubKey(@"PictureHandling", true);
}
else
{
noRegReact = true;
txtRootDir.Text = txtRootDir.Text.Trim().EndsWith(@"\") ? txtRootDir.Text.Trim() : txtRootDir.Text.Trim() + @"\";
noRegReact = false;
PictureHandling.SetValue(@"RootMap", txtRootDir.Text);
if (pictureList.Count > 0 && txtRootDir.Text != pictureList[0].RootPosition)
{
btnReOrganize.Enabled = true;
}
}
}
catch (Exception ex)
{
MessageBox.Show($"RegistryError: {ex}");
}
}
private void btnReOrganize_Click(object sender, EventArgs e)
{
ReorganizeImages();
pictureList.Clear();
Deleting = true;
lstPicFiles.DataSource = null;
lstPicFiles.Refresh();
pictureBox1.Image = null;
pictureBox1.Refresh();
foreach (var fname in DeleteList)
{
File.Delete(fname);
}
Deleting = false;
}
private void ReorganizeImages()
{
DirectoryInfo di = new DirectoryInfo(txtRootDir.Text);
if (!di.Exists) di.Create();
// om den nya rotkatalogen saknas skapa den
foreach (var localPic in pictureList)
{
if (localPic.CreatedDateChanged)
{
PropertyItem prp;
try
{
prp = localPic.AktImage.GetPropertyItem(306);
}
catch (Exception ex)
{
if (ex.HResult == -2147024809)
{
prp = localPic.AktImage.PropertyItems[0];
prp.Id = 306;
prp.Len = localPic.CreatedDate.Length;
}
else
{
throw;
}
}
prp.Value = System.Text.ASCIIEncoding.ASCII.GetBytes(localPic.CreatedDate);
localPic.AktImage.SetPropertyItem(prp);
}
if (localPic.RootPosition != txtRootDir.Text)
{
localPic.RootPosition = txtRootDir.Text;
}
DirectoryInfo dis = new DirectoryInfo(localPic.AarManDir);
if (!dis.Exists) dis.Create();
DirectoryInfo diss = new DirectoryInfo(localPic.AarManDayDir);
if (!diss.Exists) diss.Create();
localPic.AktImage.Save(localPic.ImageNewFullpath);
localPic.AktImage.Dispose();
DeleteList.Add(localPic.PictureFullPath);
}
btnReOrganize.Enabled = false;
}
private void lstPicFiles_SelectedIndexChanged(object sender, EventArgs e)
{
if (!Deleting)
{
string fName = ((ListBox)sender).SelectedValue.ToString();
var lp = ((ListBox)sender).SelectedItem;
//var lp = lstPicFiles.SelectedValue;
lblFileName.Text = fName;
lblCreated.Text = ((LocalPicture)lp).CreatedDate;
lblGroundPath.Text = ((LocalPicture)lp).AarManDir;
lblFinalPath.Text = ((LocalPicture)lp).AarManDayDir;
int w = ((LocalPicture)lp).AktImWidth;
int h = ((LocalPicture)lp).AktImHeight;
int pw = pictureBox1.Width;
int ph = pictureBox1.Height;
pictureBox1.SizeMode = PictureBoxSizeMode.Normal;
using (var bmpTmp = new Bitmap(((LocalPicture)lp).PictureFullPath))
{
pictureBox1.Image = new Bitmap(bmpTmp, w * ph / h,ph);
}
}
}
private string TakenDate(Image actPic)
{
string sPropDatTaken = "";
for (int i = 0; i < actPic.PropertyIdList.Length; i++)
{
if (actPic.PropertyIdList[i] == 306)
{
for (int j = 0; j < actPic.PropertyItems[i].Len; j++)
{
sPropDatTaken += Convert.ToChar(actPic.PropertyItems[i].Value[j]);
}
}
}
return sPropDatTaken;
}
private void btnFileDialog_Click(object sender, EventArgs e)
{
openFileDialog1.Title = "Välj bild-fil!";
openFileDialog1.InitialDirectory = "C:\\";
openFileDialog1.Filter = "Picture files (*.jpg)|*.jpg;*.jpeg|All files (*.*)|*.*";
openFileDialog1.FilterIndex = 1;
openFileDialog1.RestoreDirectory = true;
openFileDialog1.Multiselect = true;
openFileDialog1.ShowDialog();
var fnames = openFileDialog1.FileNames;
if (fnames.Length > 1)
{
var outPut = new List<FileInfo>();
foreach (var fname in fnames)
{
outPut.Add(new FileInfo(fname));
}
listLocalFiles(outPut);
}
else
{
string fName = openFileDialog1.FileName;
if (fName.Trim() != "")
{
int fNamePos = fName.LastIndexOf(@"\") + 1;
lblFileName.Text = fName.Substring(fNamePos);
lblPath.Text = fName.Substring(0, fNamePos);
listLocalFiles();
for (int i = 0; i < lstPicFiles.Items.Count; i++)
{
if (lstPicFiles.Items[i].ToString() == lblFileName.Text)
{
lstPicFiles.SelectedIndex = i;
break;
}
}
}
}
}
private void listLocalFiles(List<FileInfo> files = null)
{
if (files == null)
{
DirectoryInfo di = new DirectoryInfo(lblPath.Text);
files = new List<FileInfo>();
files.AddRange(di.GetFiles("*.jpg"));
files.AddRange(di.GetFiles("*.jpeg"));
}
//
Deleting = true;
lstPicFiles.DataSource = null;
pictureList = listBoxDataSource(files);
lstPicFiles.DataSource = pictureList;
lstPicFiles.DisplayMember = "PictureFileName";
lstPicFiles.ValueMember = "PictureFullPath";
Deleting = false;
files.Clear();
files = null;
btnReOrganize.Enabled = true;
}
public List<LocalPicture> listBoxDataSource(List<FileInfo> fileInfos)
{
Cursor.Current = Cursors.WaitCursor;
var outPut = new List<LocalPicture>();
foreach (var fi in fileInfos)
{
var bufPicture = new LocalPicture();
bufPicture.RootPosition = txtRootDir.Text;
bufPicture.PictureFileName = fi.Name;
bufPicture.InitialPath = fi.DirectoryName;
bufPicture.AktImage = Image.FromFile(bufPicture.PictureFullPath);
bufPicture.AktImWidth = bufPicture.AktImage.Width;
bufPicture.AktImHeight = bufPicture.AktImage.Height;
bufPicture.CreatedDate = TakenDate(bufPicture.AktImage);
outPut.Add(bufPicture);
}
Cursor.Current = Cursors.Default;
return FillupDateGaps(outPut);
}
private List<LocalPicture> FillupDateGaps(List<LocalPicture> inPut)
{
var picReg = new SortedList<string, LocalPicture>();
foreach (var pict in inPut)
{
picReg.Add(pict.PictureFileName, pict);
}
var tmpPicture = new LocalPicture();
tmpPicture.CreatedDate = "";
Stack<string> stack = new Stack<string>();
var outPut = new List<LocalPicture>();
foreach (KeyValuePair<string, LocalPicture> lPic in picReg)
{
if (lPic.Value.CreatedDate == "")
{
if (tmpPicture.CreatedDate != "")
{
lPic.Value.CreatedDate = tmpPicture.CreatedDate;
lPic.Value.CreatedDateChanged = true;
outPut.Add(lPic.Value);
}
else
{
stack.Push(lPic.Key);
}
}
else
{
tmpPicture = lPic.Value;
while (stack.Count > 0)
{
var picRegKey = stack.Pop();
picReg[picRegKey].CreatedDate = tmpPicture.CreatedDate;
picReg[picRegKey].CreatedDateChanged = true;
outPut.Add(picReg[picRegKey]);
}
outPut.Add(lPic.Value);
}
}
return outPut;
}
}
}

123
PictureHandling/Form1.resx Normal file
View File

@ -0,0 +1,123 @@
<?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>
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PictureHandling
{
public class LocalPicture
{
public string PictureFileName { get; set; }
public string InitialPath { get; set; }
public string PictureFullPath
{
get
{
return Path.Combine(InitialPath, PictureFileName);
}
}
public Image AktImage { get; set; }
public int AktImWidth { get; set; }
public int AktImHeight { get; set; }
public string CreatedDate { get; set; }
public bool CreatedDateChanged { get; set; } = false;
public string AarManDir
{
get
{
if (string.IsNullOrEmpty(CreatedDate)) return RootPosition;
else
{
DateTime dttd = DateTime.Parse(CreatedDate.Substring(0, 10).Replace(":", "-"));
string subDir = dttd.Year.ToString("0000") + "-" + dttd.Month.ToString("00") + @"\";
return Path.Combine(RootPosition + subDir);
}
}
}
public string AarManDayDir
{
get
{
if (string.IsNullOrEmpty(CreatedDate)) return RootPosition;
else
{
DateTime dttd = DateTime.Parse(CreatedDate.Substring(0, 10).Replace(":", "-"));
string subDir = dttd.Year.ToString("0000") + "_" + dttd.Month.ToString("00") + "_" + dttd.Day.ToString("00") + @"\";
return Path.Combine(AarManDir + subDir);
}
}
}
public string ImageNewFullpath
{
get
{
return Path.Combine(AarManDayDir + PictureFileName);
}
}
public string RootPosition { get; set; }
}
}

View File

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E58E5CDD-88C0-45D3-B2E1-E27CEFFDD087}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>PictureHandling</RootNamespace>
<AssemblyName>PictureHandling</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Autofac, Version=5.2.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
<HintPath>..\packages\Autofac.5.2.0\lib\net461\Autofac.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.1.1.1\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Collections.Specialized, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Collections.Specialized.4.3.0\lib\net46\System.Collections.Specialized.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.7.1\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="LocalPicture.cs" />
<Compile Include="Program.cs" />
<Compile Include="ProgramModule.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ImageHandlingLibrary\ImageHandlingLibrary.csproj">
<Project>{cf1c98b6-5093-4b93-8b14-a0278b1af724}</Project>
<Name>ImageHandlingLibrary</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -0,0 +1,27 @@
using Autofac;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace PictureHandling
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
var containerBuilder = new ContainerBuilder();
containerBuilder.RegisterModule<ProgramModule>();
var container = containerBuilder.Build();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}

View File

@ -0,0 +1,20 @@
using Autofac;
using ImageHandlingLibrary;
using ImageHandlingLibrary.InterFaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PictureHandling
{
class ProgramModule : Module
{
protected override void Load(ContainerBuilder builder)
{
builder.RegisterType<Registring>().As<IRegistring>();
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PictureHandling")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PictureHandling")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e58e5cdd-88c0-45d3-b2e1-e27ceffdd087")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace PictureHandling.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PictureHandling.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@ -0,0 +1,117 @@
<?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.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: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" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace PictureHandling.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Autofac" version="5.2.0" targetFramework="net472" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="1.1.1" targetFramework="net472" />
<package id="System.Collections.Specialized" version="4.3.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.7.1" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
</packages>

View File

@ -0,0 +1,37 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30225.117
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PictureHandling", "PictureHandling\PictureHandling.csproj", "{E58E5CDD-88C0-45D3-B2E1-E27CEFFDD087}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageHandlingWPFUI", "ImageHandlingUI\ImageHandlingWPFUI.csproj", "{9F7FC0FF-02D4-4B31-8B8A-81B015483445}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageHandlingLibrary", "ImageHandlingLibrary\ImageHandlingLibrary.csproj", "{CF1C98B6-5093-4B93-8B14-A0278B1AF724}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E58E5CDD-88C0-45D3-B2E1-E27CEFFDD087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E58E5CDD-88C0-45D3-B2E1-E27CEFFDD087}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E58E5CDD-88C0-45D3-B2E1-E27CEFFDD087}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E58E5CDD-88C0-45D3-B2E1-E27CEFFDD087}.Release|Any CPU.Build.0 = Release|Any CPU
{9F7FC0FF-02D4-4B31-8B8A-81B015483445}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9F7FC0FF-02D4-4B31-8B8A-81B015483445}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9F7FC0FF-02D4-4B31-8B8A-81B015483445}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9F7FC0FF-02D4-4B31-8B8A-81B015483445}.Release|Any CPU.Build.0 = Release|Any CPU
{CF1C98B6-5093-4B93-8B14-A0278B1AF724}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CF1C98B6-5093-4B93-8B14-A0278B1AF724}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CF1C98B6-5093-4B93-8B14-A0278B1AF724}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CF1C98B6-5093-4B93-8B14-A0278B1AF724}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8B92BE04-61D9-4E94-9DB8-19CB29747DD7}
EndGlobalSection
EndGlobal

BIN
pictures/AgueroVillage.JPG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 420 KiB