Skip to content

Commit

Permalink
v1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
user413 committed Jan 29, 2022
1 parent dd84fe3 commit 011530f
Show file tree
Hide file tree
Showing 21 changed files with 1,258 additions and 481 deletions.
10 changes: 5 additions & 5 deletions BackupHelper.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ VisualStudioVersion = 16.0.30413.136
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BackupHelper", "BackupHelper\BackupHelper.csproj", "{960576ED-78BD-460D-9C5E-3E422329FA1B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FileControlUtility", "..\..\Library\FileControlUtility\FileControlUtility\FileControlUtility.csproj", "{6284BB33-ABEB-40CF-BB97-2FCBB0085215}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FileControlUtility", "..\..\Library\FileControlUtility\FileControlUtility\FileControlUtility.csproj", "{67E7840B-0306-44EA-BBD6-641E388C3C9D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -17,10 +17,10 @@ Global
{960576ED-78BD-460D-9C5E-3E422329FA1B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{960576ED-78BD-460D-9C5E-3E422329FA1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{960576ED-78BD-460D-9C5E-3E422329FA1B}.Release|Any CPU.Build.0 = Release|Any CPU
{6284BB33-ABEB-40CF-BB97-2FCBB0085215}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6284BB33-ABEB-40CF-BB97-2FCBB0085215}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6284BB33-ABEB-40CF-BB97-2FCBB0085215}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6284BB33-ABEB-40CF-BB97-2FCBB0085215}.Release|Any CPU.Build.0 = Release|Any CPU
{67E7840B-0306-44EA-BBD6-641E388C3C9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{67E7840B-0306-44EA-BBD6-641E388C3C9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{67E7840B-0306-44EA-BBD6-641E388C3C9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{67E7840B-0306-44EA-BBD6-641E388C3C9D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
24 changes: 19 additions & 5 deletions BackupHelper/BackupHelper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>false</DebugSymbols>
<DebugType>none</DebugType>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
Expand All @@ -56,9 +56,8 @@
<NoWin32Manifest>true</NoWin32Manifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="FileControlUtility, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Library\FileControlUtility\FileControlUtility\bin\Debug\netstandard2.0\FileControlUtility.dll</HintPath>
<Reference Include="FileControlUtility, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\FileControlUtility.1.0.1\lib\netstandard2.0\FileControlUtility.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down Expand Up @@ -120,12 +119,27 @@
<Compile Include="FormReport.Designer.cs">
<DependentUpon>FormReport.cs</DependentUpon>
</Compile>
<Compile Include="GroupForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="GroupForm.Designer.cs">
<DependentUpon>GroupForm.cs</DependentUpon>
</Compile>
<Compile Include="LogManager.cs" />
<Compile Include="model\Option.cs" />
<Compile Include="model\Profile.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SQLiteAccess.cs" />
<EmbeddedResource Include="FormOptionsMenu.resx">
<DependentUpon>FormOptionsMenu.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FormProfileMenu.resx">
<DependentUpon>FormProfileMenu.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GroupForm.resx">
<DependentUpon>GroupForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
Expand Down
39 changes: 17 additions & 22 deletions BackupHelper/FormEditOption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Windows.Forms;

namespace BackupHelper
Expand All @@ -28,12 +29,12 @@ public FormEditOption(FormOptionsMenu optionsMenu, Option option = null)
if (option != null)
{
FormAction = FormAction.EDIT;
this.Option = option;
Option = option;
FillCamps(option);
}
else
{
this.Text = "Add option";
Text = "Add option";

FillCamps(new Option {
SourcePath = "C:\\origin...",
Expand All @@ -43,13 +44,12 @@ public FormEditOption(FormOptionsMenu optionsMenu, Option option = null)
KeepOriginFiles = true,
CleanDestinyDirectory = false,
AllowIgnoreFileExt = false,
DeleteUncommonFiles = false,
SpecifiedFileNamesAndExtensions = new List<string>()
DeleteUncommonFiles = false
});
}

this.KeyDown += new KeyEventHandler(this.FormEditOption_KeyDown);
this.KeyPreview = true;
KeyDown += new KeyEventHandler(FormEditOption_KeyDown);
KeyPreview = true;
}

private void FillCamps(Option option)
Expand All @@ -70,15 +70,10 @@ private void FillCamps(Option option)
checkBoxCleanDestinyDirectory.Checked = option.CleanDestinyDirectory;
checkBoxDeleteUncommonFiles.Checked = option.DeleteUncommonFiles;
checkBoxManageFileNamesAndExtensions.Checked = option.AllowIgnoreFileExt;

if (option.SpecifiedFileNamesOrExtensionsMode == SpecifiedFileNamesAndExtensionsMode.IGNORE)
radioButtonIgnore.Checked = true;
radioButtonIgnore.Checked = option.SpecifiedFileNamesOrExtensionsMode == SpecifiedFileNamesAndExtensionsMode.IGNORE;

foreach (string txt in option.SpecifiedFileNamesAndExtensions)
{
ListViewItem item = new ListViewItem(txt);
listViewFileNamesAndExtensions.Items.Add(item);
}
listViewFileNamesAndExtensions.Items.Add(new ListViewItem(txt));
}
catch (Exception e)
{
Expand Down Expand Up @@ -113,7 +108,7 @@ private void SubmitChanges()
ListViewItem item = new ListViewItem();
OptionsMenu.EditListViewItem(editedOption,item);
OptionsMenu.listViewOptions.Items.Add(item);
OptionsMenu.ResizeForm();
//OptionsMenu.ResizeForm();
}
else
{
Expand Down Expand Up @@ -196,18 +191,18 @@ private void SaveCampsToObject(Option editedOption)
editedOption.CleanDestinyDirectory = checkBoxCleanDestinyDirectory.Checked;
editedOption.DeleteUncommonFiles = checkBoxDeleteUncommonFiles.Checked;
editedOption.AllowIgnoreFileExt = checkBoxManageFileNamesAndExtensions.Checked;
editedOption.SpecifiedFileNamesAndExtensions = ListViewFileExtensionsToList();
editedOption.SpecifiedFileNamesAndExtensions = listViewFileNamesAndExtensions.Items.Cast<ListViewItem>().Select(i => i.Text).ToList();
}

private List<string> ListViewFileExtensionsToList()
{
List<string> extensions = new List<string>();
//private List<string> ListViewFileExtensionsToList()
//{
// List<string> extensions = new List<string>();

foreach(ListViewItem item in listViewFileNamesAndExtensions.Items)
extensions.Add(item.Text);
// foreach(ListViewItem item in listViewFileNamesAndExtensions.Items)
// extensions.Add(item.Text);

return extensions;
}
// return extensions;
//}

private void ButtonAddSource_Click(object sender, EventArgs e)
{
Expand Down
13 changes: 5 additions & 8 deletions BackupHelper/FormEditProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ namespace BackupHelper
{
public partial class FormEditProfile : Form
{
private enum FormEditProfileAction
{
ADD, EDIT
}
private enum FormEditProfileAction { ADD, EDIT }

private readonly Profile Profile;
private readonly FormProfileMenu ProfileMenu;
Expand Down Expand Up @@ -61,7 +58,7 @@ private void SaveProfile()
return;
}

if (ProfileMenu.Profiles.Find(x => x.Name == textBoxProfileName.Text) != null)
if (ProfileMenu.Profiles.Exists(p => p.Name == textBoxProfileName.Text))
{
MessageBox.Show("Name already exists.");
return;
Expand Down Expand Up @@ -98,12 +95,12 @@ private void AddProfile()
ListViewItem item = new ListViewItem();
ProfileMenu.EditListViewItem(profile, item);
ProfileMenu.listViewProfile.Items.Add(item);
ProfileMenu.ResizeForm();
//ProfileMenu.ResizeForm();
}

private void EditProfileName()
{
this.Profile.Name = textBoxProfileName.Text;
Profile.Name = textBoxProfileName.Text;
DBAccess.UpdateProfile(Profile);
ProfileMenu.EditListViewItem(Profile);
}
Expand All @@ -113,7 +110,7 @@ private void TextBoxProfileName_KeyDown(object o, KeyEventArgs e)
if (e.KeyCode == Keys.Enter)
SaveProfile();
else if (e.KeyCode == Keys.Escape)
this.Close();
Close();
}

private bool TextContainsInvalidCharacters(string text)
Expand Down
Loading

0 comments on commit 011530f

Please sign in to comment.