|
|
|
@ -1,6 +1,5 @@
|
|
|
|
|
using CleanFlashCommon;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Reflection;
|
|
|
|
@ -8,7 +7,7 @@ using System.Diagnostics;
|
|
|
|
|
using SharpCompress.Archives.SevenZip;
|
|
|
|
|
using SharpCompress.Common;
|
|
|
|
|
using SharpCompress.Readers;
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
using IWshRuntimeLibrary;
|
|
|
|
|
|
|
|
|
|
namespace CleanFlashInstaller {
|
|
|
|
|
public class Installer {
|
|
|
|
@ -85,24 +84,16 @@ namespace CleanFlashInstaller {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void CreateShortcut(string folder, string executable, string name, string description) {
|
|
|
|
|
Type t = Type.GetTypeFromCLSID(new Guid("72C24DD5-D70A-438B-8A42-98424B88AFB8"));
|
|
|
|
|
dynamic shell = Activator.CreateInstance(t);
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
var lnk = shell.CreateShortcut(Path.Combine(folder, name + ".lnk"));
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
lnk.TargetPath = executable;
|
|
|
|
|
lnk.IconLocation = executable;
|
|
|
|
|
lnk.Description = description;
|
|
|
|
|
lnk.WorkingDirectory = folder;
|
|
|
|
|
lnk.Save();
|
|
|
|
|
} finally {
|
|
|
|
|
Marshal.FinalReleaseComObject(lnk);
|
|
|
|
|
}
|
|
|
|
|
} finally {
|
|
|
|
|
Marshal.FinalReleaseComObject(shell);
|
|
|
|
|
}
|
|
|
|
|
WshShell wsh = new WshShell();
|
|
|
|
|
IWshShortcut shortcut = wsh.CreateShortcut(Path.Combine(folder, name + ".lnk")) as IWshShortcut;
|
|
|
|
|
|
|
|
|
|
shortcut.Arguments = "";
|
|
|
|
|
shortcut.TargetPath = executable;
|
|
|
|
|
shortcut.WindowStyle = (int) WshWindowStyle.WshNormalFocus;
|
|
|
|
|
shortcut.Description = description;
|
|
|
|
|
shortcut.WorkingDirectory = Path.GetDirectoryName(executable);
|
|
|
|
|
shortcut.IconLocation = executable;
|
|
|
|
|
shortcut.Save();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void InstallFromArchive(SevenZipArchive archive, IProgressForm form, InstallFlags flags) {
|
|
|
|
@ -184,4 +175,4 @@ namespace CleanFlashInstaller {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|