| 687 | |
| 688 | |
| 689 | bool CServerList::SaveServerMet() |
| 690 | { |
| 691 | CPath curservermet = CPath(thePrefs::GetConfigDir() + "server.met"); |
| 692 | |
| 693 | CFile servermet(curservermet, CFile::write_safe); |
| 694 | if (!servermet.IsOpened()) { |
| 695 | AddLogLineN(_("Failed to save server.met!")); |
| 696 | return false; |
| 697 | } |
| 698 | |
| 699 | try { |
| 700 | servermet.WriteUInt8(0xE0); |
| 701 | servermet.WriteUInt32( m_servers.size() ); |
| 702 | |
| 703 | for ( CInternalList::const_iterator it = m_servers.begin(); it != m_servers.end(); ++it) { |
| 704 | const CServer* const server = *it; |
| 705 | |
| 706 | uint16 tagcount = 12; |
| 707 | if (!server->GetListName().IsEmpty()) { |
| 708 | ++tagcount; |
| 709 | } |
| 710 | if (!server->GetDynIP().IsEmpty()) { |
| 711 | ++tagcount; |
| 712 | } |
| 713 | if (!server->GetDescription().IsEmpty()) { |
| 714 | ++tagcount; |
| 715 | } |
| 716 | if (server->GetConnPort() != server->GetPort()) { |
| 717 | ++tagcount; |
| 718 | } |
| 719 | |
| 720 | // For unicoded name, description, and dynip |
| 721 | if ( !server->GetListName().IsEmpty() ) { |
| 722 | ++tagcount; |
| 723 | } |
| 724 | if ( !server->GetDynIP().IsEmpty() ) { |
| 725 | ++tagcount; |
| 726 | } |
| 727 | if ( !server->GetDescription().IsEmpty() ) { |
| 728 | ++tagcount; |
| 729 | } |
| 730 | if (!server->GetVersion().IsEmpty()) { |
| 731 | ++tagcount; |
| 732 | } |
| 733 | |
| 734 | if (server->GetServerKeyUDP(true)) { |
| 735 | ++tagcount; |
| 736 | } |
| 737 | |
| 738 | if (server->GetServerKeyUDPIP()) { |
| 739 | ++tagcount; |
| 740 | } |
| 741 | |
| 742 | if (server->GetObfuscationPortTCP()) { |
| 743 | ++tagcount; |
| 744 | } |
| 745 | |
| 746 | if (server->GetObfuscationPortUDP()) { |
no test coverage detected