Esempio n. 1
0
        //--------------------------------------------------------------------------------------------
        //  Control Acces to asked configuration
        //--------------------------------------------------------------------------------------------
        public static string ControlAccessConfig(string configname, int GetID)
        {
            if (configname.Length == 0)
            return "";

              using (var xmlConfig = new XmlSettings(Config.GetFile(Config.Dir.Config, "MyFilms.xml")))
              {
            string Dwp = xmlConfig.ReadXmlConfig("MyFilms", configname, "Dwp", string.Empty);
            if (Dwp.Length == 0)
            {
              return configname;
            }
            var keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);
            if (null == keyboard)
            {
              return string.Empty;
            }
            keyboard.Reset();
            keyboard.SetLabelAsInitialText(false); // set to false, otherwise our intial text is cleared
            keyboard.Text = string.Empty;
            keyboard.Password = true;
            keyboard.DoModal(GetID);
            if ((keyboard.IsConfirmed) && (keyboard.Text.Length > 0))
            {
              var crypto = new Crypto();
              if (crypto.Decrypter(Dwp) == keyboard.Text) return configname;
            }
            return string.Empty;
              }
        }