public static object getItem(string key)
        {
            // read the session json file
            string sessionFile = FileManager.getSoftwareSessionFile();

            lock (sessionFileLock)
            {
                try
                {
                    if (File.Exists(sessionFile))
                    {
                        string content = File.ReadAllText(sessionFile, System.Text.Encoding.UTF8);

                        if (content != null)
                        {
                            object jsonVal = SimpleJson.GetValue(content, key);
                            if (jsonVal != null)
                            {
                                return(jsonVal);
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    //
                }
            }
            return(null);
        }
Beispiel #2
0
        public static object getItem(string key)
        {
            sessionMap.TryGetValue(key, out string valObject);
            string val = (valObject == null) ? null : valObject;

            if (val != null)
            {
                return(val);
            }

            // read the session json file
            string sessionFile = getSoftwareSessionFile();

            if (File.Exists(sessionFile))
            {
                string content = File.ReadAllText(sessionFile);
                if (content != null)
                {
                    object jsonVal = SimpleJson.GetValue(content, key);
                    if (jsonVal != null)
                    {
                        return(jsonVal);
                    }
                }
            }
            return(null);
        }