-
Notifications
You must be signed in to change notification settings - Fork 0
/
Common.cs
38 lines (35 loc) · 994 Bytes
/
Common.cs
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Win32;
using System.Diagnostics;
using System.IO;
using osu_collection_manager.Models;
// common methods used in multiple places
namespace osu_collection_manager
{
public class Common
{
public static string OpenOsuExe()
{
string path = null;
var dialog = new OpenFileDialog() { Multiselect = false, Filter = "osu!.exe|osu!.exe"};
var result = dialog.ShowDialog();
if (result == true) path = Path.GetDirectoryName(dialog.FileName);
return path;
}
public static bool IsOsuOpen()
{
foreach (Process clsProcess in Process.GetProcesses())
{
if (clsProcess.ProcessName.Contains("osu!"))
{
return true;
}
}
return false;
}
}
}