Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
namespace windows_spotlight_image_saver
{
public partial class Form1 : Form
{
private string spotlightDir;
private Button openInExplorerButton;
private Label CreateSimpleLabel(string text, Int32 left, Int32 top)
{
Label result = new Label();
result.Text = text;
result.Location = new Point(left, top);
result.Size = new Size(result.PreferredWidth, result.PreferredHeight);
return result;
}
private Button CreateSimpleButton(string text, Int32 left, Int32 top)
{
Button result = new Button();
result.Text = text;
result.Location = new Point(left, top);
return result;
}
private string GetSpotlightDir()
{
string LocalAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
return LocalAppData + "\\Packages\\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\\LocalState\\Assets";
}
private void openSpotlightDirInExplorer()
{
if (Directory.Exists(spotlightDir)) {
ProcessStartInfo startInfo = new ProcessStartInfo {
Arguments = spotlightDir,
FileName = "explorer.exe"
};
Process.Start(startInfo);
} else {
MessageBox.Show(string.Format("{0} Directory does not exist!", spotlightDir));
}
}
private void openInExplorerButton_Click(object sender, EventArgs e)
{
openSpotlightDirInExplorer();
}
public Form1()
{
string version = "0.1.0";
InitializeComponent();
this.Text = "Windows Spotlight Image Saver v" + version;
Int32 left0 = 30;
Int32 top0 = 30;
spotlightDir = GetSpotlightDir();
openInExplorerButton = CreateSimpleButton("Open Spotlight Dir in Explorer", left0, top0);
this.Controls.Add(openInExplorerButton);
openInExplorerButton.Click += new EventHandler(openInExplorerButton_Click);