diff options
author | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2017-05-07 18:30:15 +0300 |
---|---|---|
committer | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2017-05-07 18:30:15 +0300 |
commit | 78d43197c2c7dfc778d2fd044ab9112e40d33a6a (patch) | |
tree | 2c1870a746083b54d266ee2085b803fe0ac85bb0 /MainForm.cs | |
parent | e9572a54d406a19e72150b1019203796d0900f1c (diff) |
Fixed automatic shutdown issue
Diffstat (limited to 'MainForm.cs')
-rw-r--r-- | MainForm.cs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/MainForm.cs b/MainForm.cs index e799852d..aae48923 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -217,7 +217,16 @@ namespace com.clusterrr.hakchi_gui try
{
ConfigIni.CustomFlashed = true; // Just in case of new installation
+ // Requesting autoshutdown state
+ var autoshutdown = Clovershell.ExecuteSimple("cat /var/lib/clover/profiles/0/shutdown.txt");
+ // Disable automatic shutdown
+ if (autoshutdown != "0")
+ Clovershell.ExecuteSimple("echo -n 0 > /var/lib/clover/profiles/0/shutdown.txt");
+ // Setting actual time for file transfer operations
Clovershell.ExecuteSimple(string.Format("date -s \"{0:yyyy-MM-dd HH:mm:ss}\"", DateTime.UtcNow));
+ // Restoring automatic shutdown
+ if (autoshutdown != "0")
+ Clovershell.ExecuteSimple(string.Format("echo -n {0} > /var/lib/clover/profiles/0/shutdown.txt", autoshutdown));
var customFirmware = Clovershell.ExecuteSimple("[ -d /var/lib/hakchi/firmware/ ] && [ -f /var/lib/hakchi/firmware/*.hsqs ] && echo YES || echo NO");
if (customFirmware == "NO")
{
@@ -406,7 +415,7 @@ namespace com.clusterrr.hakchi_gui var displayName = Regex.Replace(language, @" \(.+\)", "");
if (langCodes.Keys.Count(o => Regex.Replace(o, @" \(.+\)", "") == displayName) == 1)
item.Text = displayName;
- else
+ else
item.Text = language;
item.Click += delegate(object sender, EventArgs e)
{
@@ -1491,7 +1500,7 @@ namespace com.clusterrr.hakchi_gui if (WaitingClovershellForm.WaitForDevice(this))
{
var screenshot = WorkerForm.TakeScreenshot();
- var screenshotPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()+".png");
+ var screenshotPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName() + ".png");
screenshot.Save(screenshotPath, ImageFormat.Png);
var showProcess = new Process()
{
@@ -1501,7 +1510,8 @@ namespace com.clusterrr.hakchi_gui }
};
showProcess.Start();
- new Thread(delegate() {
+ new Thread(delegate()
+ {
showProcess.WaitForExit();
try
{
|