Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master #7

Merged
merged 3 commits into from
Apr 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,5 @@ _Pvt_Extensions
# FAKE - F# Make
.fake/
/AutoSquirrel.asproj

*.asproj
3 changes: 2 additions & 1 deletion AutoSquirrel.sln
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26127.0
VisualStudioVersion = 15.0.26403.7
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoSquirrel", "AutoSquirrel\AutoSquirrel.csproj", "{CEEF6526-7DAA-4AE9-8FE5-7C6E6C07093D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CEFE0C7D-4652-49F4-BAAC-261053714A9C}"
ProjectSection(SolutionItems) = preProject
README.md = README.md
Rebracer.xml = Rebracer.xml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{708D7157-695C-4B62-8994-F1A0F84DA6C2}"
Expand Down
14 changes: 5 additions & 9 deletions AutoSquirrel/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,15 @@ protected override void OnStartup(StartupEventArgs e)
{
Trace.AutoFlush = true;

try
{
try {
var log = new TextWriterTraceListener(File.Create(traceFilename))
{
Filter = new EventTypeFilter(SourceLevels.Information),
TraceOutputOptions = TraceOptions.None
};

Trace.Listeners.Add(log);
}
catch
{
} catch {
}

this.DispatcherUnhandledException += this.App_DispatcherUnhandledException;
Expand Down Expand Up @@ -77,14 +74,13 @@ public class AppBootstrapper : BootstrapperBase
/// </summary>
public AppBootstrapper()
{
using (var mgr = new UpdateManager(@"https://s3-eu-west-1.amazonaws.com/autosquirrel", "AutoSquirrel"))
{
using (var mgr = new UpdateManager(@"https://s3-eu-west-1.amazonaws.com/autosquirrel", "AutoSquirrel")) {

// We have to re-implement the things Squirrel does for normal applications, because
// we're marked as Squirrel-aware
SquirrelAwareApp.HandleEvents(
onInitialInstall: v => mgr.CreateShortcutForThisExe(),
onAppUpdate: v =>
{
onAppUpdate: v => {
mgr.CreateShortcutForThisExe();

// Update the shortcuts
Expand Down
74 changes: 0 additions & 74 deletions AutoSquirrel/AppCustomStyle.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:AutoSquirrel">

<!--<Style TargetType="TextBox">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="local:SelectTextOnFocus.Active" Value="True" />
</Style>-->

<Style TargetType="{x:Type TextBlock}">
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
Expand Down Expand Up @@ -72,73 +67,4 @@
</Setter.Value>
</Setter>
</Style>

<!--<Style TargetType="{x:Type TextBox}">
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Foreground" Value="#FF272727" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBoxBase}">
<Border Name="MainBorder" Background="Transparent" CornerRadius="2">
<Grid Margin="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>

<Border Name="BorderUnderline"
Padding="2"
Margin="0,0,-1,0"
BorderBrush="#808080"
BorderThickness="0,0,0,1">
<ScrollViewer Margin="0" x:Name="PART_ContentHost" />
</Border>
<Path Grid.Column="1"
Name="PathTriangle"
Data="M0,60 L20,60 20,40 z"
Fill="#808080"
Height="15"
Stretch="Fill" Width="15"
VerticalAlignment="Bottom" />
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="BorderUnderline" Property="BorderBrush" Value="#cccccc" />
<Setter TargetName="PathTriangle" Property="Fill" Value="#cccccc" />
<Setter Property="Foreground" Value="#cccccc" />
</Trigger>
<Trigger Property="IsFocused" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<ColorAnimation Storyboard.TargetName="MainBorder" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
To="#55029cc7" Duration="0:0:0.3" />
<ColorAnimation Storyboard.TargetName="BorderUnderline" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)"
To="#029cc7" Duration="0:0:0.3" />
<ColorAnimation Storyboard.TargetName="PathTriangle" Storyboard.TargetProperty="(Path.Fill).(SolidColorBrush.Color)"
To="#029cc7" Duration="0:0:0.3" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<ColorAnimation Storyboard.TargetName="MainBorder" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
To="Transparent" Duration="0:0:0.3" />
<ColorAnimation Storyboard.TargetName="BorderUnderline" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)"
To="#808080" Duration="0:0:0.3" />
<ColorAnimation Storyboard.TargetName="PathTriangle" Storyboard.TargetProperty="(Path.Fill).(SolidColorBrush.Color)"
To="#808080" Duration="0:0:0.3" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>-->
</ResourceDictionary>
7 changes: 3 additions & 4 deletions AutoSquirrel/AssemblyVersion.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
 //1
//0
//0
//22
//24
//
// This code was generated by a tool. Any changes made manually will be lost
// the next time this code is regenerated.
//

using System.Reflection;
[assembly: AssemblyCopyright("Copyright © ChrisPulman 2017")]
[assembly: AssemblyVersion("1.1.22")]
[assembly: AssemblyVersion("1.1.24")]
[assembly: AssemblyMetadata("SquirrelAwareVersion", "1")]
[assembly: AssemblyFileVersion("1.1.22")]
[assembly: AssemblyFileVersion("1.1.24")]
11 changes: 3 additions & 8 deletions AutoSquirrel/AssemblyVersion.tt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
int major = 0;
int minor = 0;
int build = 0;
int revision = 0;
string year = DateTime.Now.Year.ToString();
try
{
Expand All @@ -14,33 +13,29 @@
string maj = f.ReadLine().Replace("//","");
string min = f.ReadLine().Replace("//","");
string b = f.ReadLine().Replace("//","");
string r = f.ReadLine().Replace("//","");

major = int.Parse(maj);
minor = int.Parse(min);
build = int.Parse(b);
revision = int.Parse(r) + 1;
build = int.Parse(b) + 1;
}
}
catch
{
major = 1;
minor = 0;
build = 0;
revision = 0;
}
#>
//<#= major #>
//<#= minor #>
//<#= build #>
//<#= revision #>
//
// This code was generated by a tool. Any changes made manually will be lost
// the next time this code is regenerated.
//

using System.Reflection;
[assembly: AssemblyCopyright("Copyright © ChrisPulman <#= year #>")]
[assembly: AssemblyVersion("1.1.<#= revision #>")]
[assembly: AssemblyVersion("1.1.<#= build #>")]
[assembly: AssemblyMetadata("SquirrelAwareVersion", "1")]
[assembly: AssemblyFileVersion("1.1.<#= revision #>")]
[assembly: AssemblyFileVersion("1.1.<#= build #>")]
2 changes: 1 addition & 1 deletion AutoSquirrel/AutoSquirrel.asproj

Large diffs are not rendered by default.

61 changes: 25 additions & 36 deletions AutoSquirrel/Classes/FileUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,19 @@ public static class FileUtility
/// <returns></returns>
public static TRet Deserialize<TRet>(string filePath)
{
try
{
using (StreamReader file = File.OpenText(filePath))
{
try {
using (StreamReader file = File.OpenText(filePath)) {
var serializer = new JsonSerializer()
{
TypeNameHandling = TypeNameHandling.All
};
if (typeof(TRet) == typeof(AutoSquirrelModel))
{
if (typeof(TRet) == typeof(AutoSquirrelModel)) {
serializer.Binder = new AutoSquirrelBindAll();
}

return (TRet)serializer.Deserialize(file, typeof(TRet));
}
}
catch (Exception ex)
{
} catch (Exception ex) {
MessageBox.Show(ex.ToString());
}
return default(TRet);
Expand All @@ -52,27 +47,22 @@ public static TRet Deserialize<TRet>(string filePath)
/// <param name="objectToSerialize">The object to serialize.</param>
public static void SerializeToFile<TRet>(string filePath, TRet objectToSerialize)
{
if (!File.Exists(filePath))
{
if (!File.Exists(filePath)) {
File.Create(filePath).Close();
}

try
{
try {
var serializer = new JsonSerializer()
{
TypeNameHandling = TypeNameHandling.All,
NullValueHandling = NullValueHandling.Ignore
};

using (var sw = new StreamWriter(filePath))
using (JsonWriter writer = new JsonTextWriter(sw))
{
using (JsonWriter writer = new JsonTextWriter(sw)) {
serializer.Serialize(writer, objectToSerialize);
}
}
catch (Exception ex)
{
} catch (Exception ex) {
MessageBox.Show(ex.ToString());
}
}
Expand All @@ -81,31 +71,30 @@ private class AutoSquirrelBindAll : SerializationBinder
{
public override Type BindToType(string assemblyName, string typeName)
{
switch (typeName)
{
case "AutoSquirrel.WebConnectionBase":
return typeof(WebConnectionBase);
switch (typeName) {
case "AutoSquirrel.WebConnectionBase":
return typeof(WebConnectionBase);

case "AutoSquirrel.AutoSquirrelModel":
return typeof(AutoSquirrelModel);
case "AutoSquirrel.AutoSquirrelModel":
return typeof(AutoSquirrelModel);

case "AutoSquirrel.FileSystemConnection":
return typeof(FileSystemConnection);
case "AutoSquirrel.FileSystemConnection":
return typeof(FileSystemConnection);

case "AutoSquirrel.AmazonS3Connection":
return typeof(AmazonS3Connection);
case "AutoSquirrel.AmazonS3Connection":
return typeof(AmazonS3Connection);

case "AutoSquirrel.ItemLink":
return typeof(ItemLink);
case "AutoSquirrel.ItemLink":
return typeof(ItemLink);

case "System.Collections.Generic.List`1[[AutoSquirrel.WebConnectionBase, AutoSquirrel]]":
return typeof(List<WebConnectionBase>);
case "System.Collections.Generic.List`1[[AutoSquirrel.WebConnectionBase, AutoSquirrel]]":
return typeof(List<WebConnectionBase>);

case "System.Collections.ObjectModel.ObservableCollection`1[[AutoSquirrel.ItemLink, AutoSquirrel]]":
return typeof(ObservableCollection<ItemLink>);
case "System.Collections.ObjectModel.ObservableCollection`1[[AutoSquirrel.ItemLink, AutoSquirrel]]":
return typeof(ObservableCollection<ItemLink>);

default:
return null;
default:
return null;
}
}
}
Expand Down
Loading