示例#1
0
        static void DeleteMap(MapID mapId, DeleteMapQuery deleteMapQuery)
        {
            try
            {
                // Delete file
                string filePathDev = MapBase.GetMapFilePath(ContentPaths.Dev, mapId);
                if (File.Exists(filePathDev))
                {
                    File.Delete(filePathDev);
                }

                try
                {
                    string filePathBuild = MapBase.GetMapFilePath(ContentPaths.Build, mapId);
                    if (File.Exists(filePathBuild))
                    {
                        File.Delete(filePathBuild);
                    }
                }
                catch
                {
                }

                // Delete from db
                deleteMapQuery.Execute(mapId);
            }
            catch (Exception ex)
            {
                const string errmsg = "Failed to delete mapId `{0}`. Exception: {1}";
                if (log.IsErrorEnabled)
                {
                    log.ErrorFormat(errmsg, mapId, ex);
                }
                Debug.Fail(string.Format(errmsg, mapId, ex));

                throw;
            }
        }
示例#2
0
        static void DeleteMap(MapID mapId, DeleteMapQuery deleteMapQuery)
        {
            try
            {
                // Delete file
                string filePathDev = MapBase.GetMapFilePath(ContentPaths.Dev, mapId);
                if (File.Exists(filePathDev))
                    File.Delete(filePathDev);
            
                try
                {
                    string filePathBuild = MapBase.GetMapFilePath(ContentPaths.Build, mapId);
                    if (File.Exists(filePathBuild))
                        File.Delete(filePathBuild);
                }
                catch   
                {
                }

                // Delete from db
                deleteMapQuery.Execute(mapId);
            }
            catch (Exception ex)
            {
                const string errmsg = "Failed to delete mapId `{0}`. Exception: {1}";
                if (log.IsErrorEnabled)
                    log.ErrorFormat(errmsg, mapId, ex);
                Debug.Fail(string.Format(errmsg, mapId, ex));

                throw;
            }
        }