mirror of
https://github.com/JogmansonReal/Radicade.git
synced 2026-10-25 15:09:26 -07:00
190 lines
12 KiB
Bash
190 lines
12 KiB
Bash
#!/usr/bin/env bash
|
|
# Groups the server into feature folders. Run with --plan to print, --apply to move.
|
|
#
|
|
# Only files move. Namespaces stay exactly as they are, because a namespace rewrite would touch
|
|
# every using in the repo for no functional gain - C# does not require a file's folder to match
|
|
# its namespace - and this way the whole change is a rename that `git log --follow` tracks.
|
|
# The project is SDK-style (globbed), so moved sources compile without editing Server.csproj,
|
|
# except for the two JSON resources the csproj names by path (starter avatar items, webhooks).
|
|
set -u
|
|
|
|
mode="${1:---plan}"
|
|
root="$(cd "$(dirname "$0")/.." && pwd)"
|
|
cd "$root"
|
|
|
|
moved=0
|
|
skipped=0
|
|
|
|
move_file() {
|
|
local src="$1" dest="$2"
|
|
[ -e "$src" ] || { return 0; }
|
|
local name; name="$(basename "$src")"
|
|
if [ -e "$dest/$name" ]; then
|
|
echo "SKIP (exists): $src -> $dest/$name"
|
|
skipped=$((skipped + 1))
|
|
return 0
|
|
fi
|
|
echo "$src -> $dest/$name"
|
|
moved=$((moved + 1))
|
|
if [ "$mode" = "--apply" ]; then
|
|
mkdir -p "$dest"
|
|
git mv "$src" "$dest/$name"
|
|
fi
|
|
}
|
|
|
|
# Every *.cs under a directory moves to a feature folder.
|
|
move_dir() {
|
|
local src="$1" dest="$2"
|
|
[ -d "$src" ] || { return 0; }
|
|
while IFS= read -r file; do
|
|
move_file "$file" "$dest"
|
|
done < <(find "$src" -name '*.cs' -not -path '*/obj/*' -not -path '*/bin/*' | sort)
|
|
}
|
|
|
|
move_glob() {
|
|
local pattern="$1" dest="$2"
|
|
for file in $pattern; do
|
|
[ -e "$file" ] || continue
|
|
move_file "$file" "$dest"
|
|
done
|
|
}
|
|
|
|
# ---------------------------------------------------------------- players, accounts, auth
|
|
move_dir "Server/API/Accounts" "Server/Players"
|
|
move_dir "Server/API/Players" "Server/Players"
|
|
move_dir "Server/API/Link" "Server/Players"
|
|
move_glob "Server/API/Public/PublicPlayerAPI.cs" "Server/Players"
|
|
move_dir "Server/RecNet/Accounts" "Server/Players"
|
|
move_glob "Server/Utils/PlayerUtils.cs Server/Utils/UsernameRules.cs Server/Utils/RegistrationGuard.cs Server/Utils/AuthSecurityMonitor.cs Server/Utils/FirstTimeUtils.cs" "Server/Players"
|
|
move_dir "Server/Auth" "Server/Auth"
|
|
move_dir "Server/RecNet/Auth" "Server/Auth"
|
|
move_glob "Server/Utils/Attributes/RecAuth.cs" "Server/Auth"
|
|
|
|
# ---------------------------------------------------------------- avatars, custom items, locker
|
|
move_glob "Server/API/Avatars/CustomAvatarItemsAPI.cs" "Server/CustomAvatarItems"
|
|
move_glob "Server/RecNet/Avatar/CustomAvatarItemDB.cs" "Server/CustomAvatarItems"
|
|
move_dir "Server/API/Avatars" "Server/Avatars"
|
|
move_glob "Server/RecNet/Avatar/*.cs" "Server/Avatars"
|
|
move_glob "Server/RecNet/Avatar/*.json" "Server/Avatars"
|
|
|
|
# ---------------------------------------------------------------- gifts and reward boxes
|
|
move_glob "Server/RecNet/Avatar/Gift.cs Server/RecNet/CardBoxWord.cs" "Server/Gift"
|
|
move_glob "Server/Utils/FriendotronService.cs Server/Utils/GameRewardRedemption.cs Server/Utils/RroRewardPools.cs Server/Utils/RoomJoinGiftUtils.cs Server/Utils/QuestRewardDelivery.cs" "Server/Gift"
|
|
move_dir "Server/Radicade/Gifts" "Server/Gift"
|
|
|
|
# ---------------------------------------------------------------- images
|
|
move_glob "Server/API/ImagesAPI.cs Server/API/Public/PublicPhotosAPI.cs" "Server/Images"
|
|
move_dir "Server/Images" "Server/Images"
|
|
move_dir "Server/RecNet/Images" "Server/Images"
|
|
move_glob "Server/Radicade/Public/PublicPhotoData.cs" "Server/Images"
|
|
|
|
# ---------------------------------------------------------------- moderation family
|
|
move_glob "Server/API/Moderation/AppealAPI.cs" "Server/BanAppeal"
|
|
move_glob "Server/API/Moderation/PlayerReportingAPI.cs Server/API/Moderation/ContentReportAPI.cs Server/API/Moderation/HileAPI.cs" "Server/PlayerReporting"
|
|
move_glob "Server/RecNet/Moderation/Hile.cs Server/RecNet/Moderation/BlockDetails.cs Server/RecNet/Moderation/SanitizeStringRequest.cs Server/RecNet/Moderation/IsPureResponse.cs" "Server/PlayerReporting"
|
|
move_glob "Server/API/Moderation/ReputationAPI.cs Server/RecNet/Moderation/Reputation.cs" "Server/PlayerReputation"
|
|
move_glob "Server/RecNet/Moderation/CheerPlayerRequest.cs" "Server/PlayerCheer"
|
|
move_glob "Server/RecNet/Moderation/PlayerWarning.cs" "Server/PlayerWarnings"
|
|
move_glob "Server/RecNet/Moderation/ModerationDB.cs Server/RecNet/Moderation/IpBan.cs Server/RecNet/Moderation/HardwareBan.cs Server/RecNet/Moderation/DeviceId.cs Server/RecNet/Moderation/GameBlock.cs Server/RecNet/Moderation/VoteKickLog.cs Server/RecNet/Moderation/VoteKickReason.cs Server/RecNet/Moderation/AccountCreationBlock.cs" "Server/PlayersBanned"
|
|
move_glob "Server/Utils/AccountLock.cs Server/Utils/BanStatusMonitor.cs Server/Utils/GameBlockMonitor.cs Server/Utils/TokenRevocation.cs" "Server/PlayersBanned"
|
|
move_glob "Server/RecNet/Moderation/VoiceChatRestriction.cs Server/Utils/ModerationPolicy.cs Server/API/SanitizeAPI.cs" "Server/Moderation"
|
|
move_glob "Server/RecNet/Moderation/OkResponse.cs" "Server/Moderation"
|
|
|
|
# ---------------------------------------------------------------- events, challenges, progression
|
|
move_dir "Server/API/Events" "Server/PlayerEvents"
|
|
move_dir "Server/RecNet/Events" "Server/PlayerEvents"
|
|
move_dir "Server/Utils/Objectives" "Server/PlayerEvents"
|
|
move_dir "Server/API/Progression" "Server/ProgressionEvents"
|
|
move_dir "Server/API/GameRewards" "Server/ProgressionEvents"
|
|
move_dir "Server/RecNet/Progression" "Server/ProgressionEvents"
|
|
move_dir "Server/RecNet/Enums/Challenges" "Server/ProgressionEvents/Enums"
|
|
move_glob "Server/Utils/LevelRewardTable.cs Server/Utils/LevelUpGiftService.cs Server/Utils/LevelUpRewardPool.cs Server/Utils/ProgressionAwardService.cs Server/Utils/RewardDay.cs Server/Utils/RewardTrace.cs Server/Utils/WeeklyChallenges.cs" "Server/ProgressionEvents"
|
|
|
|
# ---------------------------------------------------------------- chat, clubs, relationships
|
|
move_glob "Server/Chat/Thread.cs Server/Chat/ChatPhotoMessages.cs Server/Chat/RecentImageReferences.cs" "Server/Chat"
|
|
move_dir "Server/API/Messages" "Server/Messages"
|
|
move_dir "Server/RecNet/Messages" "Server/Messages"
|
|
move_dir "Server/Clubs" "Server/Clubs"
|
|
move_dir "Server/API/Relationships" "Server/Relationships"
|
|
move_dir "Server/RecNet/Relationships" "Server/Relationships"
|
|
move_glob "Server/API/AnnouncementAPI.cs" "Server/Clubs/Announcements"
|
|
|
|
# ---------------------------------------------------------------- economy
|
|
move_dir "Server/API/CampusCard" "Server/Commerce"
|
|
move_dir "Server/RecNet/Store/CampusCard" "Server/Commerce"
|
|
move_glob "Server/Commerce/CommercePlaceholderAPI.cs" "Server/Commerce"
|
|
move_dir "Server/API/Storefront" "Server/Storefront"
|
|
move_dir "Server/RecNet/Storefront" "Server/Storefront"
|
|
move_glob "Server/RecNet/Store/*.cs" "Server/Storefront"
|
|
move_dir "Server/API/IncentivizedReferrals" "Server/Promotions"
|
|
move_dir "Server/API/InfluencerPartnerProgram" "Server/Promotions"
|
|
move_dir "Server/RecNet/Store/Referrals" "Server/Promotions"
|
|
move_dir "Server/API/Wishlists" "Server/Storefront"
|
|
|
|
# ---------------------------------------------------------------- rooms and play
|
|
move_dir "Server/API/Rooms" "Server/Rooms"
|
|
move_dir "Server/RoomServer" "Server/Rooms"
|
|
move_dir "Server/RecNet/Rooms" "Server/Rooms"
|
|
move_glob "Server/Utils/RoomUtils.cs Server/Utils/RoomProgressionService.cs Server/Utils/DefaultRooms.cs" "Server/Rooms"
|
|
move_glob "Server/CDN/RoomsCDN.cs" "Server/Rooms"
|
|
move_glob "Server/Radicade/Public/PublicRoomData.cs" "Server/Rooms"
|
|
move_dir "Server/Lists" "Server/Rooms/Lists"
|
|
move_dir "Server/API/Matchmaking" "Server/Matchmaking"
|
|
move_dir "Server/RecNet/Matchmaking" "Server/Matchmaking"
|
|
move_glob "Server/Utils/MatchmakingUtils.cs Server/Utils/MatchmakingRuntimeState.cs" "Server/Matchmaking"
|
|
move_dir "Server/API/Activities" "Server/Activities"
|
|
move_dir "Server/API/Royale" "Server/Royale"
|
|
move_dir "Server/RecNet/Royale" "Server/Royale"
|
|
move_dir "Server/API/Board" "Server/Board"
|
|
move_dir "Server/RecNet/Board" "Server/Board"
|
|
move_dir "Server/RecNet/Enums/Board" "Server/Board/Enums"
|
|
move_dir "Server/API/Keepsakes" "Server/Keepsakes"
|
|
move_dir "Server/RecNet/Keepsakes" "Server/Keepsakes"
|
|
move_dir "Server/API/Inventions" "Server/Inventions"
|
|
move_dir "Server/RecNet/Inventions" "Server/Inventions"
|
|
move_dir "Server/RecNet/Enums/Inventions" "Server/Inventions/Enums"
|
|
move_glob "Server/CDN/InventionCDN.cs" "Server/Inventions"
|
|
|
|
# ---------------------------------------------------------------- platform, tooling, publishing
|
|
move_dir "Server/API/Notify" "Server/Notifications"
|
|
move_dir "Server/API/Notifications" "Server/Notifications"
|
|
move_dir "Server/RecNet/Notifications" "Server/Notifications"
|
|
move_dir "Server/Leaderboard" "Server/Leaderboards"
|
|
move_dir "Server/RecNet/Leaderboards" "Server/Leaderboards"
|
|
move_glob "Server/CDN/*.cs" "Server/CDN"
|
|
move_dir "Server/RecNet/CDN" "Server/CDN"
|
|
move_dir "Server/Storage/StudioAssetStorage.cs" "Server/Studio"
|
|
move_glob "Server/Storage/StorageAPI.cs" "Server/Storage"
|
|
move_dir "Server/API/Studio" "Server/Studio"
|
|
move_glob "Server/CDN/StudioAssetsCDN.cs" "Server/Studio"
|
|
move_dir "Server/API/Launcher" "Server/Launcher"
|
|
move_glob "Server/API/VersionCheckAPI.cs" "Server/Launcher"
|
|
move_dir "Server/RecNet/VersionCheck" "Server/Launcher"
|
|
move_glob "Server/API/ServiceRootHealthAPI.cs" "Server/Health"
|
|
move_dir "Server/NS" "Server/NameServer"
|
|
move_glob "Server/RecNet/NameServerResponse.cs" "Server/NameServer"
|
|
move_dir "Server/API/Analytics" "Server/Analytics"
|
|
move_dir "Server/API/Logs" "Server/Analytics"
|
|
move_dir "Server/RecNet/GameSight" "Server/Analytics"
|
|
move_dir "Server/API/Config" "Server/Config"
|
|
move_dir "Server/RecNet/Config" "Server/Config"
|
|
move_glob "Server/Utils/GameConfigSeeder.cs" "Server/Config"
|
|
move_dir "Server/API/BugReporting" "Server/BugReporting"
|
|
move_dir "Server/Admin" "Server/Admin"
|
|
move_glob "Server/Utils/AdminRuntime.cs Server/Utils/AdminUtils.cs" "Server/Admin"
|
|
move_dir "Server/Discord" "Server/Discord"
|
|
move_dir "Server/Radicade/Discord" "Server/Discord"
|
|
move_glob "Server/Radicade/Mail/*.cs" "Server/Mail"
|
|
move_glob "Server/Utils/LoadingScreenImages.cs Server/RecNet/LoadingScreenTip.cs" "Server/LoadingScreens"
|
|
move_glob "Server/API/TestCaseManagement/*.cs" "Server/Tooling"
|
|
move_glob "Server/Debug/*.cs" "Server/Tooling"
|
|
move_dir "Server/Custom" "Server/Tooling/Custom"
|
|
move_dir "Server/Web" "Server/Web"
|
|
move_glob "Server/Utils/StringTools.cs Server/Utils/BuildInfo.cs" "Server/Utils"
|
|
|
|
echo
|
|
echo "planned: $moved file(s), skipped: $skipped (mode $mode)"
|
|
if [ "$mode" != "--apply" ]; then
|
|
echo "re-run with --apply to move them"
|
|
fi
|