/// <summary> /// Callback for the GenPropsData command /// </summary> /// <param name="e"></param> private static void OnPropsData( CommandEventArgs e ) { DateTime start = DateTime.Now; DateTime end; TimeSpan duration; World.Broadcast( BoxConfig.MessageHue, false, "Pandora's Box is collecting property data. Please wait..." ); PropsData p = new PropsData(); p.CreateMasterTable(); p.CreateStructure(); p.Save(); end = DateTime.Now; duration = end - start; World.Broadcast( BoxConfig.MessageHue, false, "Generation complete. The process took {0} seconds.", duration.TotalSeconds ); }
/// <summary> /// Callback for the GenPropsData command /// </summary> /// <param name="e"></param> private static void OnPropsData(CommandEventArgs e) { DateTime start = DateTime.Now; DateTime end; TimeSpan duration; World.Broadcast(BoxConfig.MessageHue, false, "Pandora's Box is collecting property data. Please wait..."); PropsData p = new PropsData(); p.CreateMasterTable(); p.CreateStructure(); p.Save(); end = DateTime.Now; duration = end - start; World.Broadcast(BoxConfig.MessageHue, false, "Generation complete. The process took {0} seconds.", duration.TotalSeconds); }
/// <summary> /// Loads the PropsData from the default file location /// </summary> /// <returns>The loaded PropsData object, or an empty PropsData if none was found</returns> public static PropsData Load() { PropsData pd = null; try { string file = Path.Combine(Pandora.Profile.BaseFolder, "PropsData.xml"); FileStream stream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); XmlSerializer serializer = new XmlSerializer(typeof(PropsData)); pd = serializer.Deserialize(stream) as PropsData; return(pd); } catch (Exception err) { Pandora.Log.WriteError(err, "Couldn't load PropsData."); return(new PropsData()); } }