Skip to content

File permissions #2

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

Open
wants to merge 370 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
370 commits
Select commit Hold shift + click to select a range
651b4db
Provides a more specific exception message for errors with WebRequest
drewkeller May 20, 2012
0bdbc1d
Added a means for the external application to be able to work with th…
drewkeller May 20, 2012
1a52e26
Somehow the icon file wasn't included in commit cca051277423913bb6d50…
drewkeller May 20, 2012
c6cf2bd
Somehow these files weren't included in commit 037a027433b8f2a657bc2d…
drewkeller May 20, 2012
040a887
Merge commit 'c3a1e578c3cfe3035862537306a69b9358d0ad5d'
drewkeller May 20, 2012
dc1083e
* Missed one of the CheckForUpdateAsync() functions in a previous com…
drewkeller May 21, 2012
65bdab5
Revamped the UpdateWindow in the WPF sample. This design uses a helpe…
drewkeller May 21, 2012
41e2968
Adjust window sizing, add throbber, add dummy time delay for the "pre…
drewkeller May 22, 2012
1cb03e6
Improve parsing of config file passed on the commandline... so it can…
drewkeller May 25, 2012
19c563e
Move bin files up to the solution level so they are easier to get to
drewkeller May 25, 2012
fb4ddb8
Add a button to the main window so checking can be testing more than …
drewkeller May 25, 2012
a07ea83
Fix file being created instead of arg not being recognized
drewkeller May 26, 2012
21d4c96
Add message to confirm user has latest version if no updates are needed
drewkeller May 26, 2012
8e9d50b
Provide actual file metadata attributes in the NauXML file (file size…
drewkeller May 26, 2012
a22ef74
* Fix issues with the form not able to be opened at design time
drewkeller May 26, 2012
cdffefc
* If an update task doesn't have any conditions, it will always say i…
drewkeller May 28, 2012
ba928d7
changes working directory of update process to application directory …
phillipp May 16, 2012
5f3bbf6
* Fix for FileDateCondition returning false positives due to variatio…
drewkeller May 29, 2012
94ec354
* Move updater log file to a subfolder so it doesn't get deleted duri…
drewkeller May 29, 2012
6f19d48
Merge branch 'master' of https://github.com/phillipp/NAppUpdate.git
synhershko Jun 1, 2012
592adac
gitignore
synhershko Jun 1, 2012
a27630d
Removing the _CS suffix from the FeedBuilder project
synhershko Jun 1, 2012
5536250
Reverting commits 0bdbc1 and 8e9d50b
synhershko Jun 1, 2012
8b9f294
Fixing sample application compilation
synhershko Jun 1, 2012
3ed87ba
Minor
synhershko Jun 1, 2012
160edcf
Merge branch 'patch-1' of https://github.com/stebueh/NAppUpdate.git
synhershko Jun 1, 2012
a2c9488
Minor
synhershko Jun 1, 2012
7ac5e86
Removing unused code
synhershko Jun 1, 2012
1acf7a2
Cleaning up
synhershko Jun 1, 2012
4d55531
FileUpdateTask now overwrites an existing backup file (before that th…
phillipp Jun 3, 2012
2873225
FileUpdateTask now overwrites an existing backup file (before that th…
phillipp Jun 3, 2012
b743e98
Merge branch 'master' of github.com:phillipp/NAppUpdate
phillipp Jun 3, 2012
92d1162
adding the current ticks to the backup folder, preventing access to t…
phillipp Jun 3, 2012
62e116d
Merge pull request #21 from phillipp/4d555318fab862165c352647e13bd78c…
synhershko Jun 4, 2012
adf9150
Reverting commit 651b4d
synhershko Jun 8, 2012
fd9de70
Adding means to be notified of update progress
synhershko Jun 10, 2012
6b7fb8a
FileUpdateTask and FileDownloader now report download progress
synhershko Jun 10, 2012
3659ad5
Cleaning up
synhershko Jun 10, 2012
d58f481
Adding sample application
synhershko Jun 10, 2012
b3922fa
Minor
synhershko Jun 10, 2012
0d67cac
Invocation doesn't mean anything in this context
synhershko Jun 10, 2012
5d95332
Merge branch 'master' of https://[email protected]/synhershko/NAp…
synhershko Jun 10, 2012
2902898
Safer, more robust recursive folder deletion
synhershko Jun 14, 2012
86456b4
Minor
synhershko Jun 14, 2012
fb110c6
Giving Tests full code access
synhershko Jun 14, 2012
9543904
Update starter work
synhershko Jun 14, 2012
9407cae
No need for this here
synhershko Jun 14, 2012
d1f8ddf
Moving config stuff to a Config objects
synhershko Jun 14, 2012
782cbb7
Introducing the NauDto, to be used by IPC to transfer more data more …
synhershko Jun 14, 2012
94368ea
Fixing folder deletion on cleanup
synhershko Jun 15, 2012
9eb111a
Marking everything as serializable
synhershko Jun 15, 2012
de4071d
INTRUSIVE CHANGE: tasks are now executed via the updater directly
synhershko Jun 15, 2012
d51b68b
NauXmlFeedReader is the default FeedReader implementation
synhershko Jun 19, 2012
937ce96
INTRUSIVE CHANGE: Now tasks are sent back from updater to calling app
synhershko Jun 19, 2012
4d2a594
Fixing some bugs with previous commits
synhershko Jun 19, 2012
1e28cb5
Merge branch 'master' of https://github.com/distantcam/NAppUpdate.git
synhershko Jun 28, 2012
c4cb3c9
Fixing merge
synhershko Jun 28, 2012
0792f7a
Gracefully ignore non-existing file in WPF sample
synhershko Jun 28, 2012
4499213
Fixing threading issues + misc tweaks
synhershko Jun 28, 2012
c238274
Adding UncSource implementation
synhershko Jun 28, 2012
ab7417d
It is enough to expose an IEnumerable of update tasks
synhershko Jun 28, 2012
00ce0ce
A few more fixes to the WPF sample
synhershko Jun 28, 2012
22cbe89
Minor
synhershko Jun 28, 2012
88e2e09
Support copying dependencies when going for cold-updates
synhershko Jun 28, 2012
9fe230b
Prevent updater host deployment from throwing
synhershko Jun 29, 2012
6782a16
Against all odds of name clashes
synhershko Jun 29, 2012
6e3e643
Fixing some issues with the IPC communication implementation
synhershko Jun 29, 2012
6b6a531
The philosophy behind NAppUpdate
synhershko Jun 29, 2012
ed2b72c
Stop assuming task.UpdateConditions is not null
synhershko Jul 3, 2012
9c499e8
Hack a way around some serialization related issues
synhershko Jul 3, 2012
a04bcc2
Serializable exceptions
synhershko Jul 3, 2012
b127c7f
TODO
synhershko Jul 3, 2012
a2c26cb
Rely on System exceptions to provide info on what went wrong
synhershko Jul 3, 2012
5e8317a
Breaking change: reworked how errors and async operations are handled
synhershko Jul 4, 2012
da814b5
Bringing samples up to speed
synhershko Jul 4, 2012
1ec754c
Minor
synhershko Jul 8, 2012
3a905df
Updates to flat solution:
drewkeller Jul 2, 2012
6e9ef31
Fixing an serious flaw with cold FileUpdateTask operation
synhershko Jul 10, 2012
419e5ba
Adding xUnit
synhershko Jul 11, 2012
086d2bc
Introducing proper logging capability
synhershko Jul 11, 2012
65a040a
Minor
synhershko Jul 11, 2012
bf09759
Fixing possible NRE
synhershko Jul 11, 2012
bd5769f
Minor Fixes
Jul 13, 2012
0d984d7
Proper exception printout
synhershko Jul 13, 2012
13ff650
Dump logs if asked to
synhershko Jul 13, 2012
96fe742
Another step towards better logging
synhershko Jul 13, 2012
9eaac75
Merge branch 'master' of https://github.com/TrickUK/NAppUpdate.git
synhershko Jul 25, 2012
2bad19e
Partially reverting commit bd5769f1
synhershko Jul 25, 2012
2b45994
Overwrite files when necessary
synhershko Jul 26, 2012
b7b626b
Now cold updates correctly load custom Task objects
synhershko Jul 26, 2012
f9eda34
Fixing errorneous logfile path
synhershko Jul 26, 2012
587e4c5
Stupid logfile output bug
synhershko Jul 26, 2012
a8cc18d
The mutex should be destroyed as late as possible
synhershko Jul 30, 2012
db1dc82
Easier way to dump the logfile in a handy location
synhershko Aug 10, 2012
73e2d89
Remember the calling app (HACK)
synhershko Aug 10, 2012
c571e51
Possibly resolving the permission issue while updating
synhershko Aug 10, 2012
4985464
Fixing download progress percentage
synhershko Sep 23, 2012
77169c2
Fixed an issue with Uri's not being resolved correctly when there's n…
synhershko Sep 23, 2012
54fc8ad
Updating nuget
synhershko Sep 23, 2012
8f1d26f
Named Pipe timeout and minor updates.
synhershko Sep 23, 2012
05b9ede
CRLF
synhershko Sep 23, 2012
002b347
Fixing possible NREs
synhershko Sep 23, 2012
7cdce1c
Logger need to be thread safe
synhershko Sep 23, 2012
9ca4860
Bing some missing events
xmkevin Nov 15, 2012
ebf21e0
Add sub directory support for FeedBuilder
xmkevin Nov 15, 2012
56e4235
add file exits condition check by default
xmkevin Nov 15, 2012
148b32a
Fix FileExistsCondition.IsMet logic.
xmkevin Nov 15, 2012
8f34066
Fixing check in FileExistsCondition
synhershko Feb 6, 2013
feedec4
Merge remote-tracking branch 'origin/master'
synhershko Feb 6, 2013
93ae508
Merge remote-tracking branch 'xmkevin/master'
synhershko Feb 6, 2013
de30d98
Allowing to access BooleanCondition children by inheritance
synhershko Feb 6, 2013
5045b9b
updater.exe placeholder to get away of circular issue when compiling
synhershko Feb 11, 2013
e708a27
Fixing compilation
synhershko Feb 11, 2013
1aac235
Merge remote-tracking branch 'origin/master'
synhershko Feb 11, 2013
d31ca39
Fixing compilation
synhershko Feb 11, 2013
820e4e5
Fixes NullReferenceException on IgnoreFiles collection because Initia…
dtarczynski Mar 4, 2014
a8c52c7
Merge pull request #46 from dtarczynski/master
synhershko Mar 6, 2014
ea8750b
Updating nuget
synhershko Jul 13, 2014
16dbf0c
WebSource now tries to do DNS query first
synhershko Jul 13, 2014
d12f35a
Remove regions
synhershko Jul 13, 2014
dc9f935
Better behavior for FileSizeCondition when local file doesn't exist
synhershko Jul 13, 2014
3a99672
Fix the logic in FileChecksumCondition for the case where the file do…
synhershko Jul 13, 2014
f067738
Cleanup
synhershko Jul 13, 2014
e2d71d7
Doco, should make the logic behind IsMet clearer for users
synhershko Jul 13, 2014
b3f2913
Fix FileDateCondition edge cases for when file doesn't exist
synhershko Jul 13, 2014
709b916
Fix FileVersionCondition edge cases for when file doesn't exist
synhershko Jul 13, 2014
0a33e71
Merge branch 'master' of https://github.com/synhershko/NAppUpdate
synhershko Jul 13, 2014
f1a81d7
Version replace , for . , closes #41
synhershko Aug 4, 2014
b5c33c0
Modified to fix problems with operating on a fast computer/SSD
Oct 7, 2014
0bd58fe
Merge pull request #48 from tcrutt/pipecheck
synhershko Oct 10, 2014
e5ab727
Use new Version(int major, int minor, int build, int rev) to generate…
Jan 26, 2015
bc22bb4
Merge pull request #52 from galendai/master
synhershko Jan 26, 2015
4810eb9
Improved the process launch error handling
robinwassen Jul 10, 2015
8d2beab
Merge pull request #55 from robinwassen/improve-process-error-handling
synhershko Jul 12, 2015
9a4bac4
± small fix for hash condition check => changed to case insensitive.
Aug 21, 2015
eb9f654
Merge pull request #56 from Liano/master
synhershko Aug 23, 2015
103a8d4
#54 Formatting clean up of Naulpc
robinwassen Oct 26, 2015
ff1deab
#54 Added better error handling when connecting pipe
robinwassen Oct 26, 2015
7f8769a
#62 Refactor BooleanCondition ConditionType checks for increased read…
robinwassen Oct 26, 2015
87ac3df
#62 Added unit tests for BooleanCondition
robinwassen Oct 26, 2015
e2fb300
#64 Removed the hasFirstCondition logic
robinwassen Oct 26, 2015
8ba2a5a
#66 Refactored ReadFiles() for readability
robinwassen Oct 26, 2015
9e1fa67
#66 Fixed bug with file names getting cropped in FeedBuilder
robinwassen Oct 26, 2015
5aefd0b
Merge pull request #63 from synhershko/62-booleancondition-unit-tests
robinwassen Oct 29, 2015
716b08c
Merge pull request #67 from synhershko/66-feedbuilder-name-cropping
robinwassen Oct 29, 2015
a007ed6
Merge pull request #61 from synhershko/54-improve-error-handling
robinwassen Oct 29, 2015
814e3e4
Merge pull request #65 from synhershko/64-remove-feedbuilder-hasfirst…
robinwassen Oct 29, 2015
508ab24
#37 Removed old nuget binaries
robinwassen Oct 29, 2015
fc0c0eb
#37 Added nuget spec file
robinwassen Oct 29, 2015
bc81d9c
#37 Added nuget packages to .gitignore
robinwassen Oct 29, 2015
0daccc9
#37 Updated the readme
robinwassen Oct 29, 2015
ed431e8
#37 Updated the assembly version to 0.4.0.0
robinwassen Oct 29, 2015
2117fc0
Merge pull request #70 from synhershko/37-nuget
robinwassen Feb 3, 2016
f79e559
Removed the broken nuget badge from the readme
robinwassen Feb 3, 2016
caed556
#60 Added .editorconfig file
robinwassen Feb 3, 2016
f13b7dd
Fixed spelling mistake in the readme
robinwassen Feb 3, 2016
a2f6550
#60 Updated all files to follow coding standards
robinwassen Feb 3, 2016
6e3af28
#60 Updated all files to follow coding standards
robinwassen Feb 3, 2016
7be8435
Merge pull request #71 from synhershko/60-indentation-fix
synhershko Feb 3, 2016
f43fbb9
Removed the nuget targets include in the unit test project file
robinwassen Feb 4, 2016
c19a83c
#72 Cleaned up inconsistent method signatures
robinwassen Feb 4, 2016
ae6df46
#54 Replaced the Win32 pipe handling with .NET
robinwassen Feb 4, 2016
168588f
#54 Increased the pipe timeout to 15s
robinwassen Feb 5, 2016
074039a
#54 More detailed error handling in LaunchProcessAndSendDto
robinwassen Feb 5, 2016
413b8eb
#54 Refactor of the updater
robinwassen Feb 5, 2016
c5ba68e
#54 Improved exception handling in Updater
robinwassen Feb 10, 2016
1b7e41f
#54 Code cleanup in the updater
robinwassen Feb 10, 2016
caa69aa
#54 Additional clean up of the updater
robinwassen Feb 10, 2016
9826ca0
#54 Commit of a csproj file that i forgot
robinwassen Feb 10, 2016
92da31e
#54 Refactored the process start options in updater.exe
robinwassen Feb 10, 2016
491be06
#54 Some further clean up of the updater
robinwassen Feb 10, 2016
8b752d0
#54 Removed my personal working notes
robinwassen Feb 10, 2016
b8a89a5
#54 Bumped up the updater.exe to .NET 3.5
robinwassen Feb 10, 2016
ed18e92
#54 Minor code cleanup
robinwassen Feb 10, 2016
504e5c3
#54 Changed the AfterRestart check
robinwassen Feb 10, 2016
52d99ed
#54 Pass the -nappupdate-afterrestart argument when relaunching appli…
Feb 11, 2016
398456e
#54 Increased target framework version of FeedBuilder to .NET 3.5
Feb 11, 2016
cd6048f
#54 The calls to Application.DoEvents are needed to make the console …
Feb 11, 2016
3a82629
#54 Pass HResult of exception as exit code if unhandled exceptions oc…
Feb 11, 2016
aa5c26b
#54 Instead of showing error message, always log unhandled exceptions…
Feb 11, 2016
f25af3c
#54 Simplified error handling logic of failed update tasks
Feb 11, 2016
95f9599
#54 Added the message box again but only show it if the application i…
Feb 11, 2016
f8267da
#54 Added check for null in Teardown
Feb 11, 2016
9d3f5ad
Merge pull request #75 from FWennerdahl/54-timeout-error-handling
robinwassen Feb 17, 2016
14fd0a7
Merge pull request #76 from synhershko/54-timeout-error-handling
robinwassen Feb 18, 2016
440278e
#72 Updated the win forms sample to reflect the changes
robinwassen Feb 18, 2016
46a7e67
Merge pull request #73 from synhershko/72-update-manager-args
robinwassen Feb 18, 2016
e32e31f
Upgraded the WinForms sample to .NET 3.5
robinwassen Feb 18, 2016
9939d69
Reversed Condition for MyFileVersion
Guacam-Ole May 2, 2016
91c2dc1
Merge pull request #82 from OleAlbers/patch-1
synhershko May 2, 2016
57be08e
Changing "or-not" to "or" on Version Condition
Guacam-Ole May 2, 2016
a45339d
added extension to deployed files
daniellor May 12, 2016
72a75e5
clean up after last commit
daniellor May 12, 2016
6173a14
formated text
daniellor May 12, 2016
6dadaba
Revert "formated text"
daniellor May 12, 2016
20bc2e9
Merge pull request #84 from daniellor/master
synhershko May 12, 2016
77d7904
Added Release 4.0 configuration for Framework and Updater
May 16, 2016
00c5dc2
Updated nuspec-file to contain both targets
May 16, 2016
36b7c8f
Merge pull request #85 from FWennerdahl/add-net40-target-framework-co…
robinwassen May 18, 2016
88457ad
Updated the assembly version to 0.5.0.0
robinwassen May 18, 2016
c617fd3
Merge pull request #83 from OleAlbers/patch-2
robinwassen May 18, 2016
b992efe
#35 Added delay in case there is a lock on files that are to be updated
robinwassen Jun 29, 2016
5d4a964
Merge pull request #86 from synhershko/35-unauthorized-exception-fix
robinwassen Jul 5, 2016
19b8b00
Updated the assembly version to 0.5.1.0
robinwassen Jul 5, 2016
9d023b5
Copy original file permissions to updated file.
ianwall Aug 26, 2016
a3ccf24
Change spaces to tabs as per standard.
ianwall Aug 26, 2016
81651ee
Only copy access if file exists (and before deleting it).
ianwall Aug 28, 2016
09c5755
Added support for output paths relative to executable
Sep 24, 2016
c005f21
Removed now redundant check for null
Sep 24, 2016
8d4de37
Fixed error that could occur when saving configuration
Sep 24, 2016
3dfbf2b
Persist current settings on close as intended
Sep 25, 2016
5e99c21
Fixed loading of stored configurations
Sep 25, 2016
eff1a90
Move debug build output to FeedBuilder/bin
Sep 25, 2016
6930523
Adopt configurations from other machines
Sep 25, 2016
1005445
Populate UI with config loaded from command line
Sep 25, 2016
d09100b
Fixed "New" button functionality
Oct 4, 2016
cd0fd8d
Move call to UpdateTitle back for non-existing files but remove a red…
Oct 4, 2016
5765df5
Merge pull request #89 from FWennerdahl/fixes-for-command-line-usage
synhershko Oct 4, 2016
d71999a
Merge branch 'fix-file-permissions' of git://github.com/ianwall/NAppU…
robinwassen Nov 13, 2016
bae5c6f
#43 Implemented inheritance aware access control copy when updating f…
robinwassen Nov 13, 2016
ba99ee2
Merge pull request #90 from synhershko/ianwall-fix-file-permissions
robinwassen Nov 13, 2016
c0103a9
Updated formatting of UpdateWindow in WPF sample
robinwassen Nov 13, 2016
e6a05ed
Merge branch 'master' of github.com:synhershko/NAppUpdate
robinwassen Nov 13, 2016
6fc8c6f
#49 Fixed an issue where the execution order of close and clean up in…
robinwassen Nov 13, 2016
6f69f69
Base relative paths on Feedbuilder executable path when building
Nov 25, 2016
6b9d5e4
Enabled writing to console when running from command-line
Nov 25, 2016
23bf5b7
Added constant for attaching to parent console matching Windows API
Nov 26, 2016
d6e1d1a
Merge pull request #91 from FWennerdahl/relative-build-paths
robinwassen Dec 18, 2016
1792cfa
Make projects depend on framework project build.
vbjay May 25, 2017
9f4e8a8
Added FeedBuilder.xml to .gitignore
vbjay May 26, 2017
dc0cd8b
Merge pull request #100 from synhershko/fix-proj-deps
robinwassen Jun 7, 2017
25bbea0
Refactored FileSystemEnumerator
vbjay May 25, 2017
b3ee96a
Merge pull request #101 from synhershko/gitignore-feedbuilder-xml
robinwassen Jun 7, 2017
af4a8cc
Fix ignore logic
vbjay May 25, 2017
1938104
Merge pull request #102 from synhershko/filesystemenum-refactor
robinwassen Jun 7, 2017
f9bdf9f
Prevent double period in filename in FeedBuilder
vbjay May 25, 2017
1291677
Merge pull request #103 from synhershko/file-ignore-logic
robinwassen Jun 7, 2017
a93ac05
Refactor security check
vbjay May 25, 2017
2e67e3a
Merge pull request #104 from synhershko/double-period-fix
robinwassen Jun 7, 2017
9cd98a3
Merge pull request #105 from synhershko/security-check-refactor
robinwassen Jun 7, 2017
4b103bd
Upgrade Feedbuilder to use framework 4.6.2
vbjay May 25, 2017
488af92
Merge pull request #107 from synhershko/feedbuilder-framework-upgrade
robinwassen Jun 7, 2017
3cdcc51
Minor Fixes
vbjay May 25, 2017
1577943
Merge pull request #108 from synhershko/minor-refactors
robinwassen Jun 7, 2017
0a438e0
Update FAQ
igorushi Aug 13, 2017
46cccf2
Merge pull request #110 from igorushi/patch-1
synhershko Aug 14, 2017
891275c
using AppDomain.CurrentDomain.BaseDirectory instead of Environment.Cu…
Feb 19, 2018
8f53d90
Merge pull request #122 from firsinanton/CurrentDirectory-issue
synhershko Feb 24, 2018
e00b096
Issue #120: Byteorder mark removal in UncSource removes first left an…
sonntam Mar 24, 2018
8ab2f8f
Update UpdateManager.cs (#127)
suren1525 Sep 29, 2018
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
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = crlf
indent_style = tab
insert_final_newline = true
tab_width = 4
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.nupkg
*.dep
*.aps
*.vbw
Expand All @@ -23,4 +24,9 @@
Thumbs.db
*.ncb
*.suo
*.cache
*.cache
*\TestResults
*\updater.exe
*.orig
packages/
FeedBuilder/FeedBuilder.xml
8 changes: 8 additions & 0 deletions FAQ
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Frequently Asked Questions
==========================

Q: My application settings are lost when I update; what do I do?
A: NAppUpdate wouldn't make changes to user.config files by design. Here's
how to handle this from your code:

http://cs.rthand.com/blogs/blog_with_righthand/archive/2005/12/09/246.aspx
78 changes: 78 additions & 0 deletions FeedBuilder/ArgumentsParser.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
using System.Windows.Forms;

namespace FeedBuilder
{
public class ArgumentsParser
{
public bool HasArgs { get; set; }
public string FileName { get; set; }
public bool ShowGui { get; set; }
public bool Build { get; set; }
public bool OpenOutputsFolder { get; set; }

public ArgumentsParser(IEnumerable<string> args)
{
foreach (string thisArg in args)
{
if (thisArg.ToLower() == Application.ExecutablePath.ToLower() || thisArg.ToLower().Contains(".vshost.exe")) continue;

string arg = CleanArg(thisArg);
if (arg == "build")
{
Build = true;
HasArgs = true;
}
else if (arg == "showgui")
{
ShowGui = true;
HasArgs = true;
}
else if (arg == "openoutputs")
{
OpenOutputsFolder = true;
HasArgs = true;
}
else if (IsValidFileName(thisArg))
{
// keep the same character casing as we were originally provided
FileName = thisArg;
HasArgs = true;
}
else Console.WriteLine("Unrecognized arg '{0}'", arg);
}
}

// this merely checks whether the parent folder exists and if it does,
// we say the filename is valid
private bool IsValidFileName(string filename)
{
if (File.Exists(filename)) return true;
try
{
// the URI test... filter out things that aren't even trying to look like filenames
// ReSharper disable UnusedVariable
Uri u = new Uri(filename);
// ReSharper restore UnusedVariable
// see if the arg's parent folder exists
var d = Directory.GetParent(filename);
if (d.Exists) return true;
}
catch { }
return false;
}

private string CleanArg(string arg)
{
const string pattern1 = "^(.*)([=,:](true|0))";
arg = arg.ToLower();
if (arg.StartsWith("-") || arg.StartsWith("/")) arg = arg.Substring(1);
Regex r = new Regex(pattern1);
arg = r.Replace(arg, "{$1}");
return arg;
}
}
}
161 changes: 161 additions & 0 deletions FeedBuilder/FeedBuilder.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion />
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{734FA44E-39AC-478E-A5AA-0F3D1F1974AA}</ProjectGuid>
<OutputType>Exe</OutputType>
<StartupObject>FeedBuilder.Program</StartupObject>
<RootNamespace>FeedBuilder</RootNamespace>
<AssemblyName>FeedBuilder</AssemblyName>
<FileAlignment>512</FileAlignment>
<MyType>WindowsForms</MyType>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<NoWarn>1591</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>FeedBuilder.xml</DocumentationFile>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DocumentationFile>FeedBuilder.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
</PropertyGroup>
<PropertyGroup>
<OptionCompare>Binary</OptionCompare>
</PropertyGroup>
<PropertyGroup>
<OptionStrict>On</OptionStrict>
</PropertyGroup>
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>component.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>FeedBuilder.xml</DocumentationFile>
<NoWarn>1591</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Release\</OutputPath>
<DocumentationFile>FeedBuilder.xml</DocumentationFile>
<Optimize>true</Optimize>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisFailOnMissingRules>true</CodeAnalysisFailOnMissingRules>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ArgumentsParser.cs" />
<Compile Include="FeedBuilderSettingsProvider.cs" />
<Compile Include="FileInfoEx.cs" />
<Compile Include="FileSystemEnumerator.cs" />
<Compile Include="frmMain.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmMain.Designer.cs">
<DependentUpon>frmMain.cs</DependentUpon>
<SubType>Form</SubType>
</Compile>
<Compile Include="HelpfulTextBox.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="HelpfulTextbox.Designer.cs">
<DependentUpon>HelpfulTextBox.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Program.cs" />
<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>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />
<Import Include="System.Diagnostics" />
<Import Include="System.Drawing" />
<Import Include="System.Linq" />
<Import Include="System.Windows.Forms" />
<Import Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="frmMain.resx">
<DependentUpon>frmMain.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<Content Include="component.ico" />
<Content Include="Readme.txt" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\src\NAppUpdate.Framework\NAppUpdate.Framework.csproj">
<Project>{5c07ebdf-d43f-4be9-b560-d7a443c0edce}</Project>
<Name>NAppUpdate.Framework</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>
Loading