コード例 #1
0
ファイル: FluidClient.cs プロジェクト: AustinJGreen/Fluid
        /// <summary>
        /// Loads a world from the database; the world will be the last time
        /// the user saved his/her world
        /// </summary>
        /// <param name="worldIdOrUrl">World Id or Url</param>
        public World LoadWorld(string worldIdOrUrl)
        {
            string worldId = null;

            if (m_Parser.Parse(worldIdOrUrl, out worldId))
            {
                if (m_Client != null)
                {
                    DatabaseObject worldObject = m_Toolbelt.RunSafe <DatabaseObject>(() => m_Client.BigDB.Load("worlds", worldId));

                    if (worldObject != null)
                    {
                        return(new World(this, worldObject));
                    }
                }
            }

            return(null);
        }
コード例 #2
0
 public static bool TryParse(this FluidParser parser, string template, out IFluidTemplate result, out string error)
 {
     try
     {
         error  = null;
         result = parser.Parse(template);
         return(true);
     }
     catch (ParseException e)
     {
         error  = e.Message;
         result = null;
         return(false);
     }
     catch (Exception e)
     {
         error  = e.Message;
         result = null;
         return(false);
     }
 }