deviant art

Deviant Login Shop  Join deviantART for FREE Take the Tour
[x]
Shop Similar Prints
This Print Not Available
Download File
ZIP, 131 KB
more ▶

More from ~scritperkid2

Featured in Groups:

Details

July 13, 2012
131 KB
Sta.sh
Link
Thumb

Statistics

Comments: 19
Favourites: 12 [who?]

Views: 2,292 (3 today)
Downloads: 1,055 (1 today)
[x]
:iconscritperkid2:
AFTER UNZIPPING, RENAME "HOSTS FILE EDITOR" TO "HOSTS FILE EDITOR.EXE" DA WON'T LET ME UPLOAD EXES, EVEN IF THEY'RE IN ARCHIVES.
=====UPDATE 7/18/2012=====
New version 2.0!
List of new features:
- Improved UI (columns)
- Choice between IPv4 and IPv6
- Better detection of duplicates
Be sure to Run as Administrator!
Thank you ~vhanla for the great ideas!
=======================
=====UPDATE 7/15/2012=====
New version 1.2!
List of new features:
- Auto-detect drive letter
- Automatically starts a new line (don't have to hit enter first)
- Detects duplicate entries
Thank you ~vhanla for the great ideas!
Please be sure to run it as Administrator!
=====UPDATE 7/14/2012=====
New version 1.1!
Added option to select drive letter. Thanks to ~Tangmeister for the idea!
=======================
My first application :D! A tool that lets you add entries to your hosts file. Type your entry and click the button!

Written in Visual Studio Ultimate 2012 RC
Add a Comment:
 
love 0 0 joy 2 2 wow 0 0 mad 0 0 sad 0 0 fear 0 0 neutral 0 0
:iconrevengexx14:
~revengexx14 Jul 15, 2012  Student Digital Artist
Nice!
Reply
:iconvhanla:
Nice tool, I was writing a hosts editor too. Mine is part of a development software tool (IDE).

So here are some suggestions that you might include:
- Add admin manifest file to start it with elevated privileges
- Detect Windows path and you won't need that ugly letter combobox
Use either GetWindowsDirectory or GetSystemDirectory from Windows API. You will only need to complete it with "\System32\drivers\etc\hosts" or "\drivers\etc\hosts" to the returned string
- Another suggestion would be to find out if a domain has already been added
- Use columns to separate IP from domain as well as validating IPv4 and IPv6 :P
but IPv6 is a bit tricky, you need to know the Index of your network interface, be it a real hardware or our loopback (1 by default)

BTW there is a bug, it doesn't write the new entry in a new line, add a \n\r before adding it to hosts file.

Keep up the good work. :)
Reply
:iconscritperkid2:
Implemented some of your ideas in v1.2! I tried to add admin manifest, but Click-Once doesn't support it, and I have no idea how else to publish it. Fixed the "bug", added auto-detect drive letter, and added detection of existing entry. I will try to implement your columns idea and Ipv6 validation in the next version.
Reply
:iconvhanla:
Nice, it gets better and better :)

Here are some little bugs:
- Detection of duplicates doesn't respect spaces, i.e.

127.0.0.1 local
127.0.0.1    local
127.0.0.1 local #even comments

I would suggest you to get rid of comments first, then get rid of ips and finally evaluate only domains which are the important ones that they should not be duplicated.

And about administrator privileges, a clickonce application can't be run as admin, but it can run other apps with admin privileges so it would be great if it launches itself as admin. I don't know much about C# so here a link that might help you Running a ClickOnce Application as Administrator [link]

BTW: about columns it might be great to pre-write 127.0.0.1 or ::1 so users will only need to input the domain name and hit enter (and on success clear input), and I don't know if you will leave multiline input because I hit enter and it adds another line to write in which also allows repeated domains on add entry.

He he, it might be a simple application but involves many and maybe complicated things unknown by users, nice work and as I said before, keep up the good work.
Reply
:iconscritperkid2:
Ok, I am working on a new version of the application. I implemented the column idea, and made it so it only evaluates domains. The admin privileges thing is one I am still trying to figure out. And I was pretty sure I removed multiline input...
Reply
:iconscritperkid2:
Thank you for the bugs and ideas :D. However, the link won't help b/c I wrote this in VB, not C#.
Reply
:iconscritperkid2:
First off, I would like to say thank you for the plethora of ideas and help :D! When making this I was thinking of a way to detect windows path, but as I am a complete novice at writing programs I had no idea how I would go about doing it (so thanks for the GetWindowsDirectory and GetSystemDirectory idea!). I especially like your last two ideas, detecting if a domain has already been added, and the columns. I will try and see if i can do that, but as I mentioned before I am a complete novice (just got into the whole thing four days ago when I downloaded VS 2012).
I do know about the bug, in my description I said to hit enter once in the textbox, then the entry. That is really inconvenient, but I couldn't think of a better way. Thanks for the \n\r!
Reply
:iconwook-stwoo:
~wook-stwoo Jul 14, 2012  Hobbyist Traditional Artist
afaik there was few apis that will give you system drive letter, i had somewhere.
nice tool and it's very useful for command line ads removers.
btw, maybe app would be looking better (and working) if it would be listview so that we can edit all hosts, vhosts and addresses...though (or however file is configured)
Reply
:iconscritperkid2:
Um...can you better explain what you mean by your listview idea? :)
Reply
Add a Comment: