Skip to content

Commit

Permalink
V.3.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Special-Niewbie committed Sep 26, 2024
1 parent 18eee46 commit 6921ec6
Show file tree
Hide file tree
Showing 107 changed files with 4,826 additions and 1,391 deletions.
Binary file modified Console2Desk/.vs/Console2Desk/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Console2Desk/.vs/Console2Desk/v17/.futdcache.v2
Binary file not shown.
Binary file modified Console2Desk/.vs/Console2Desk/v17/.suo
Binary file not shown.
Binary file modified Console2Desk/.vs/Console2Desk/v17/Browse.VC.db
Binary file not shown.
839 changes: 839 additions & 0 deletions Console2Desk/.vs/Console2Desk/v17/DocumentLayout.backup.json

Large diffs are not rendered by default.

804 changes: 611 additions & 193 deletions Console2Desk/.vs/Console2Desk/v17/DocumentLayout.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"CustomColumnOrderings":{"name":0,"file-path":1,"file-name":2,"neutral-value":3,"neutral-comment":4,"type":5},"ShowValidationErrors":true,"SelectedResourceGroups":["C:\\Progetti_in_C\\C#\\Console2Desk\\Console2Desk\\Properties\\Resources.resx"],"VisibleColumnKeys":["name","neutral-value"]}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -85,36 +85,74 @@ public static void CodeForbuttonMiniConsoleWindow(Form1 form, MessagesBoxImpleme
object shellValue = key.GetValue("Shell");
if (shellValue != null)
{
string shellPath = shellValue.ToString().Split(new[] { ' ' }, 2)[0]; // Usa solo la parte prima del primo spazio
string extractedPath = Path.GetFullPath(shellPath);
string shellCommand = shellValue.ToString();
//messagesBoxImplementation.ShowMessage($"Shell command from registry: {shellCommand}", "Debug", MessageBoxButtons.OK);

//For Debug messagesBoxImplementation.ShowMessage($"Percorso dell'app personalizzata estratto: {extractedPath}", "Info", MessageBoxButtons.OK);
// Logica per estrarre il percorso eseguibile e gli argomenti
string executablePath;
string arguments;

if (shellCommand.StartsWith("\""))
{
int endQuote = shellCommand.IndexOf("\"", 1);
if (endQuote != -1)
{
executablePath = shellCommand.Substring(1, endQuote - 1);
arguments = shellCommand.Substring(endQuote + 1).Trim();
}
else
{
executablePath = shellCommand;
arguments = "";
}
}
else
{
// Se non ci sono virgolette, assumiamo che tutto sia il percorso dell'eseguibile
executablePath = shellCommand;
arguments = "";
}

// messagesBoxImplementation.ShowMessage($"Executable path: {executablePath}\nArguments: {arguments}", "Debug", MessageBoxButtons.OK);

// Verifica se l'applicazione è già in esecuzione
string processName = Path.GetFileNameWithoutExtension(executablePath);
Process[] runningProcesses = Process.GetProcessesByName(processName);

// Check if the application is already running
Process[] runningProcesses = Process.GetProcessesByName(Path.GetFileNameWithoutExtension(extractedPath));
if (runningProcesses.Length == 0)
{
// Start the custom application if it is not running
// Avvia l'applicazione personalizzata se non è in esecuzione
try
{
if (!File.Exists(executablePath))
{
messagesBoxImplementation.ShowMessage($"Executable file not found: {executablePath}", "Error", MessageBoxButtons.OK);
return;
}

ProcessStartInfo startInfo = new ProcessStartInfo
{
FileName = extractedPath,
Arguments = "",
UseShellExecute = false, // Prevents the use of the shell to avoid elevated privileges
Verb = "" // Ensures that 'runas' is not used (administrator mode)
FileName = executablePath,
Arguments = arguments,
UseShellExecute = true,
WorkingDirectory = Path.GetDirectoryName(executablePath),
Verb = "runas" // Prova ad eseguire con privilegi elevati
};

//messagesBoxImplementation.ShowMessage($"Attempting to start process:\nFileName: {startInfo.FileName}\nArguments: {startInfo.Arguments}\nWorking Directory: {startInfo.WorkingDirectory}", "Debug", MessageBoxButtons.OK);

Process.Start(startInfo);
messagesBoxImplementation.ShowMessage($"L'applicazione {extractedPath} è stata avviata.", "Info", MessageBoxButtons.OK);
//messagesBoxImplementation.ShowMessage($"The application {executablePath} has been started.", "Info", MessageBoxButtons.OK);
}
catch (Exception ex)
{
messagesBoxImplementation.ShowMessage($"Errore nell'avvio dell'applicazione: {ex.Message}", "Error", MessageBoxButtons.OK);
messagesBoxImplementation.ShowMessage($"Error starting application: {ex.Message}\nStack Trace: {ex.StackTrace}", "Error", MessageBoxButtons.OK);
}
}
else
{
//For Debug messagesBoxImplementation.ShowMessage("L'applicazione è già in esecuzione.", "Info", MessageBoxButtons.OK);
//For Debug messagesBoxImplementation.ShowMessage("L'applicazione è già in esecuzione.", "Info", MessageBoxButtons.OK);
// L'applicazione è già in esecuzione, gestisci la minimizzazione/massimizzazione
}
}
else
Expand Down Expand Up @@ -156,4 +194,4 @@ public static void CodeForbuttonMiniConsoleWindow(Form1 form, MessagesBoxImpleme
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ internal static class CodeForResetTouchKeyboardCheck
{
private const string RegistryPath = @"Software\Microsoft\TabletTip\1.7";
private const string ValueName = "TipbandDesiredVisibility";
const string valueName2 = "TouchKeyboardTapInvoke";

public static void CheckTouchKeyboardState(PictureBox pictureBoxResetTouchKeyboard, MessagesBoxImplementation messagesBoxImplementation)
{
Expand All @@ -14,12 +15,12 @@ public static void CheckTouchKeyboardState(PictureBox pictureBoxResetTouchKeyboa
using (var key = Registry.CurrentUser.OpenSubKey(RegistryPath))
{
// Se la chiave non esiste o il valore è 2, mostra l'immagine di abilitazione
if (key == null || (int?)key.GetValue(ValueName) == 2)
if (key == null || (int?)key.GetValue(ValueName, valueName2) == 2)
{
pictureBoxResetTouchKeyboard.Image = Properties.Resources.HandTouchKeyboard;
}
// Se il valore è 0, mostra l'immagine di disabilitazione
else if ((int)key.GetValue(ValueName) == 0)
else if ((int)key.GetValue(ValueName, valueName2) == 0)
{
pictureBoxResetTouchKeyboard.Image = Properties.Resources.HandTouchKeyboard_Disabled;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
/*
Console2Desk
Copyright (C) 2023 Special-Niewbie Softwares
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation version 3.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

namespace Console2Desk.BottomWindowButtons
{
Expand All @@ -12,6 +25,7 @@ public static void DisableTouchscreen(PictureBox pictureBoxResetTouchKeyboard)
{
const string registryPath = @"Software\Microsoft\TabletTip\1.7";
const string valueName = "TipbandDesiredVisibility";
const string valueName2 = "TouchKeyboardTapInvoke";

try
{
Expand All @@ -21,15 +35,16 @@ public static void DisableTouchscreen(PictureBox pictureBoxResetTouchKeyboard)
if (key != null)
{
// Controlla il valore corrente
object value = key.GetValue(valueName);
if (value == null || (int)value == 2)
object value = key.GetValue(valueName, valueName2);
if (value == null || (int)value == 2 || (int)value == 1)
{
// Imposta il valore a 0 per disabilitare il touchscreen
key.SetValue(valueName, 0, Microsoft.Win32.RegistryValueKind.DWord);
key.SetValue(valueName2, 0, Microsoft.Win32.RegistryValueKind.DWord);

// Attendere un secondo e verificare il cambiamento
System.Threading.Thread.Sleep(1000);
if ((int)key.GetValue(valueName) == 0)
if ((int)key.GetValue(valueName, valueName2) == 0)
{
pictureBoxResetTouchKeyboard.Image = Properties.Resources.HandTouchKeyboard_Disabled;
}
Expand All @@ -38,10 +53,11 @@ public static void DisableTouchscreen(PictureBox pictureBoxResetTouchKeyboard)
{
// Il touchscreen è già disabilitato, abilitalo di nuovo
key.SetValue(valueName, 2, Microsoft.Win32.RegistryValueKind.DWord);
key.SetValue(valueName2, 2, Microsoft.Win32.RegistryValueKind.DWord);

// Attendere un secondo e verificare il cambiamento
System.Threading.Thread.Sleep(1000);
if ((int)key.GetValue(valueName) == 2)
if ((int)key.GetValue(valueName, valueName2) == 2)
{
pictureBoxResetTouchKeyboard.Image = Properties.Resources.HandTouchKeyboard; // Cambia l'immagine per lo stato abilitato
}
Expand Down
3 changes: 3 additions & 0 deletions Console2Desk/Console2Desk/Console2Desk.csproj.user
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
<Compile Update="FormMessageBox\FormMessageBox.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="FormTP\FormTweakParadise.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="info\FormInfoControllers.cs">
<SubType>Form</SubType>
</Compile>
Expand Down
Loading

0 comments on commit 6921ec6

Please sign in to comment.