From 61ef84a1eff09eceb8f10e933d738945283e2ea6 Mon Sep 17 00:00:00 2001 From: Jim Norman Date: Thu, 20 Oct 2005 23:57:26 +0000 Subject: [PATCH] Remove Debug Menu from CASAManager. CASAManager.exe -debug enables it --- c_gui/CasaMain.cs | 15 ++++++++++++++- c_gui/Common.cs | 1 + c_micasad/verbs/ObjectSerialization.cs | 25 +++++++++++++++++++------ 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/c_gui/CasaMain.cs b/c_gui/CasaMain.cs index 5966d2e3..f0e19ac0 100644 --- a/c_gui/CasaMain.cs +++ b/c_gui/CasaMain.cs @@ -95,6 +95,7 @@ public class CasaMain public static CasaTray mCasaTray = null; + public static bool m_bShowDebug = false; ///####################################################################### @@ -114,6 +115,10 @@ public class CasaMain if (args.Length > 0) { + + if (Common.IsArgSet(args, Common.ARG_DEBUG)) + m_bShowDebug = true; + if (Common.IsTrayAvailable() && Common.IsArgSet(args, Common.ARG_SHOW_TRAY_ICON)) { mCasaTray = new CasaTray(); @@ -130,6 +135,8 @@ public class CasaMain { new CasaMain(args); } + + Application.Run(); @@ -174,6 +181,12 @@ public class CasaMain gxml = new Glade.XML(Common.GladeFile, "windowMain", null); gxml.Autoconnect(this); + + if (!m_bShowDebug) + mmiDebug.Hide(); + + + windowMain.DeleteEvent += new DeleteEventHandler(OnWindowMainDeleted); /// PLATFORM SPECIFIC GUI CHANGES @@ -1091,7 +1104,7 @@ public class CasaMain #if LINUX // TODO check startup script for the user. - return false; + return true; #endif } diff --git a/c_gui/Common.cs b/c_gui/Common.cs index 930ba48d..4c0446fa 100644 --- a/c_gui/Common.cs +++ b/c_gui/Common.cs @@ -85,6 +85,7 @@ public class Common ///############################################################## /// ARG CONSTANTS public static string ARG_SHOW_TRAY_ICON = "-tray"; + public static string ARG_DEBUG = "-debug"; ///############################################################# ///CasaIcons path diff --git a/c_micasad/verbs/ObjectSerialization.cs b/c_micasad/verbs/ObjectSerialization.cs index f8dd7094..2df2d9c1 100644 --- a/c_micasad/verbs/ObjectSerialization.cs +++ b/c_micasad/verbs/ObjectSerialization.cs @@ -245,9 +245,9 @@ namespace sscs.verbs } else { - secret = keyChain.GetSecret(secretID); - secret.RemoveKeyValue(keyID); - wo.SetError(constants.RetCodes.SUCCESS, null); + secret = keyChain.GetSecret(secretID); + secret.RemoveKeyValue(keyID); + wo.SetError(constants.RetCodes.SUCCESS, null); } } catch (Exception e) @@ -257,6 +257,7 @@ namespace sscs.verbs return wo; } + private WrappedObject DoReadKey(SecretStore ssStore, WrappedObject wo) { try @@ -505,7 +506,7 @@ namespace sscs.verbs ssStore.AddKeyChain(keyChain); } - Secret secret1 = new Secret(GW); + Secret secret1 = GetOrCreateSecret(keyChain, GW); secret1.SetKeyValue("CN", "User1"); secret1.SetKeyValue("Password", "GWPass"); try @@ -515,7 +516,7 @@ namespace sscs.verbs catch (Exception) {} - Secret secret2 = new Secret(IFOLDER); + Secret secret2 = GetOrCreateSecret(keyChain, IFOLDER); secret2.SetKeyValue("CN", "User2"); secret2.SetKeyValue("Password", "IfolderPass"); secret2.SetKeyValue("EmployeeID", "123456"); @@ -526,7 +527,7 @@ namespace sscs.verbs catch (Exception) {} - Secret secret3 = new Secret(GWIM); + Secret secret3 = GetOrCreateSecret(keyChain,GWIM); secret3.SetKeyValue("CN", "User3"); secret3.SetKeyValue("Password", "GwimPass"); try @@ -561,6 +562,18 @@ namespace sscs.verbs return wo; } + + private Secret GetOrCreateSecret(KeyChain kc, string sID) + { + try + { + return kc.GetSecret(sID); + } + catch (Exception) + { + return new Secret(sID); + } + } private WrappedObject DoGetLinkedKeys(SecretStore ssStore, WrappedObject wo)