Skip to content
This repository has been archived by the owner on May 5, 2020. It is now read-only.

Commit

Permalink
Auto Delete Desktop "Arad.lnk" shortcut.
Browse files Browse the repository at this point in the history
  • Loading branch information
kagasu committed May 2, 2015
1 parent 3507f1d commit 2cd841b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
28 changes: 27 additions & 1 deletion ARADAutoLauncher/LoadingWindow.xaml.cs
Expand Up @@ -68,7 +68,33 @@ private void Window_Initialized(object sender, EventArgs e)
parameters.Add(new Regex("\\[\"CharCount\"\\] = \"(.*?)\"").Matches(str)[0].Groups[1].Value);
Process.Start("neoplecustomurl://" + string.Join("/", parameters));
Environment.Exit(0);
// Delete Arad.lnk if exists
if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + "\\Arad.lnk"))
{
File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + "\\Arad.lnk");
}
// monitoring Arad.lnk
var watcher = new FileSystemWatcher();
watcher.Path = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
watcher.Filter = "Arad.lnk";
watcher.NotifyFilter = NotifyFilters.FileName;
// exclude subdirectories
watcher.IncludeSubdirectories = false;
// start monitoring
var changedResult = watcher.WaitForChanged(WatcherChangeTypes.Created);
// Delete Arad.lnk when created
if (changedResult.ChangeType == WatcherChangeTypes.Created)
{
// wait for another process file handle dispose
Thread.Sleep(500);
File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + "\\Arad.lnk");
Environment.Exit(0);
}
}
catch (Exception ex)
{
Expand Down
Binary file added ARADAutoLauncher/fukidasi.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion ARADAutoLauncher/packages.config
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="DynamicJson" version="1.2.0.0" targetFramework="net45" />
<package id="WpfAnimatedGif" version="1.4.12" targetFramework="net45" />
<package id="WpfAnimatedGif" version="1.4.12" targetFramework="net40" />
</packages>

0 comments on commit 2cd841b

Please sign in to comment.