Example #1
0
        /// <summary>
        /// Returns the Ripple dictionary from the Ripple XML File path provided.
        /// </summary>
        /// <returns>RippleDictionary.Ripple</returns>
        /// <exception cref="System.NullReferenceException
        ///     System.ArgumentNullException
        ///     RippleDictionary.TypeNotKnownException
        ///     System.FormatException
        ///     System.OverflowException
        ///     RippleDictionary.UnparseableXMLException
        ///     RippleDictionary.UndefinedUnlockException
        ///     RippleDictionary.TileTypeNotKnownException
        ///     RippleDictionary.InvalidStyleException
        ///     RippleDictionary.InvalidCoordinateException
        ///     RippleDictionary.ActionNotKnownException
        ///     RippleDictionary.TypeNotKnownException" />
        public static Ripple GetRippleDictionaryFromFile(string rippleFile = null)
        {
            StreamReader file = new StreamReader(rippleFile == null ? XMLElementsAndAttributes.RippleXMLFile : rippleFile);

            string xml = file.ReadToEnd();

            Floor  floor  = GetFloorFromXML(xml);
            Screen screen = GetScreenFromXML(xml);

            Ripple ripple = new Ripple(screen, floor);

            return(ripple);
        }
Example #2
0
        public static Ripple GetRipple(String filePath)
        {
            StreamReader file = new StreamReader(filePath + "\\..\\" + XMLElementsAndAttributes.RippleXMLFile);

            string xml = file.ReadToEnd();

            Floor  floor  = GetFloorFromXML(xml);
            Screen screen = GetScreenFromXML(xml);

            Ripple ripple = new Ripple(screen, floor);

            return(ripple);
        }
 /// <summary>
 /// Method that loads the configured data for the Screen, right now the Source is XML
 /// </summary>
 private void LoadData()
 {
     try
     {
         //Loads the local dictionary data from the configuration XML
         rippleData = RippleDictionary.Dictionary.GetRipple(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location));
     }
     catch (Exception ex)
     {
         RippleCommonUtilities.LoggingHelper.LogTrace(1, "Went wrong in Load Data for Screen {0}", ex.Message);
         throw;
     }
 }
Example #4
0
        public static Ripple GetRipple(String filePath)
        {
            StreamReader file = new StreamReader(filePath + "\\..\\" + XMLElementsAndAttributes.RippleXMLFile);

            string xml = file.ReadToEnd();

            Floor floor = GetFloorFromXML(xml);
            Screen screen = GetScreenFromXML(xml);

            Ripple ripple = new Ripple(screen, floor);

            return ripple;
        }
Example #5
0
        /// <summary>
        /// Returns the Ripple dictionary from the Ripple XML File path provided.
        /// </summary>
        /// <returns>RippleDictionary.Ripple</returns>
        /// <exception cref="System.NullReferenceException
        ///     System.ArgumentNullException
        ///     RippleDictionary.TypeNotKnownException
        ///     System.FormatException
        ///     System.OverflowException
        ///     RippleDictionary.UnparseableXMLException
        ///     RippleDictionary.UndefinedUnlockException
        ///     RippleDictionary.TileTypeNotKnownException
        ///     RippleDictionary.InvalidStyleException
        ///     RippleDictionary.InvalidCoordinateException
        ///     RippleDictionary.ActionNotKnownException
        ///     RippleDictionary.TypeNotKnownException" />
        public static Ripple GetRippleDictionaryFromFile(string rippleFile = null)
        {
            StreamReader file = new StreamReader(rippleFile == null ? XMLElementsAndAttributes.RippleXMLFile : rippleFile);

            string xml = file.ReadToEnd();

            Floor floor = GetFloorFromXML(xml);
            Screen screen = GetScreenFromXML(xml);

            Ripple ripple = new Ripple(screen, floor);

            return ripple;
        }
        /// <summary>
        /// Writes the ripple object onto an XML file as out.xml and returns true if successful.
        /// </summary>
        /// <param name="ripple">RippleDictionary.Ripple</param>
        /// <returns>System.bool</returns>
        public static bool TryWriteToXML(Ripple ripple, string filePath)
        {
            XDocument document = new XDocument();

            try
            {
                XElement eFloor  = GetXElementFloor(ripple.Floor);
                XElement eScreen = GetXElementScreen(ripple.Screen);

                document.Add(new XComment(string.Format("Ripple XML generated on {0}", DateTime.Now)));
                document.Add(new XElement(XMLElementsAndAttributes.Ripple, eFloor, eScreen));

                document.Save(filePath);

                return(true);
            }
            catch (Exception ex)
            {
                System.Diagnostics.EventLog.WriteEntry("RippleDictionary", "Could not write to the RippleXML file.\n" + ex.Message, System.Diagnostics.EventLogEntryType.Error);
                return(false);
            }
        }
        /// <summary>
        /// Writes the ripple object onto an XML file as out.xml and returns true if successful.
        /// </summary>
        /// <param name="ripple">RippleDictionary.Ripple</param>
        /// <returns>System.bool</returns>
        public static bool TryWriteToXML(Ripple ripple, string filePath)
        {
            XDocument document = new XDocument();

            try
            {
                XElement eFloor = GetXElementFloor(ripple.Floor);
                XElement eScreen = GetXElementScreen(ripple.Screen);

                document.Add(new XComment(string.Format("Ripple XML generated on {0}", DateTime.Now)));
                document.Add(new XElement(XMLElementsAndAttributes.Ripple, eFloor, eScreen));

                document.Save(filePath);

                return true;
            }
            catch (Exception ex)
            {
                System.Diagnostics.EventLog.WriteEntry("RippleDictionary", "Could not write to the RippleXML file.\n" + ex.Message, System.Diagnostics.EventLogEntryType.Error);
                return false;
            }
        }
 /// <summary>
 /// Method that loads the configured data for the Screen, right now the Source is XML
 /// </summary>
 private void LoadData()
 {
     try
     {
         //Loads the local dictionary data from the configuration XML
         rippleData = RippleDictionary.Dictionary.GetRipple(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location));
     }
     catch (Exception ex)
     {
         RippleCommonUtilities.LoggingHelper.LogTrace(1, "Went wrong in Load Data for Screen {0}", ex.Message);
         throw;
     }
 }