Esempio n. 1
0
        /// <summary>
        /// Launches the application given its name (matching it on the "app/config/launch-config.xml" configuration file).
        /// </summary>
        /// <param name="appName">App name for the application to be launched.</param>
        /// <param name="query">Query string in the format: "relative_url?param1=value1&param2=value2". Set it to null for not sending extra launch data.</param>
        public void LaunchApplication(string appName, string query)
        {
            App app = this.GetApplication(appName);

            if (app != null)
            {
                this.LaunchApplication(app, query);
            }
            else
            {
                // TODO - check if an alert notification is required
                SystemLogger.Log(SystemLogger.Module.CORE, "Application with name [" + appName + "] couldn't be found in the configuration file");
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Load launch config file
 /// </summary>
 protected void LoadLaunchConfig()
 {
     try {               // FileStream to read the XML document.
         byte[] configFileRawData = GetConfigFileBinaryData();
         if (configFileRawData != null)
         {
             XmlSerializer serializer = new XmlSerializer(typeof(LaunchConfig));
             launchConfig = (LaunchConfig)serializer.Deserialize(new MemoryStream(configFileRawData));
         }
     } catch (Exception e) {
         SystemLogger.Log(SystemLogger.Module.CORE, "Error when loading launch configuration", e);
         launchConfig = new LaunchConfig();                 // reset launch config mapping when the services could not be loaded for any reason
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Default method, to be overrided by platform implementation.
        /// </summary>
        /// <returns>
        /// A <see cref="Stream"/>
        /// </returns>
        public virtual byte[] GetConfigFileBinaryData()
        {
            SystemLogger.Log(SystemLogger.Module.CORE, "# Loading Launch Apps Configuration from file: " + LaunchConfigFile);

            Stream fs = new FileStream(LaunchConfigFile, FileMode.Open);

            if (fs != null)
            {
                return(((MemoryStream)fs).GetBuffer());
            }
            else
            {
                return(null);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Returns the available memory uses from MemoryUse enumeration.
        /// </summary>
        /// <returns>Array of available memory uses, or empty array if error or no memory uses available.</returns>
        public MemoryUse[] GetMemoryUses()
        {
            List <MemoryUse> memUsesList = new List <MemoryUse> ();

            try {
                Type enumType = typeof(MemoryUse);
                IEnumerator <MemoryUse> enumerator = (Enum.GetValues(enumType) as IEnumerable <MemoryUse>).GetEnumerator();
                while (enumerator.MoveNext())
                {
                    memUsesList.Add(enumerator.Current);
                }
            } catch (Exception e) {
                SystemLogger.Log(SystemLogger.Module.CORE, "Exception getting available memory uses", e);
            }

            return(memUsesList.ToArray());
        }