これは私が持っているリンクで、次の形式のデータの大きなリストが含まれています。
" X = マップ番号 : Y = マップ名 "
例
「10000:きのこ公園」。
vc++ .net では、そのリンクに接続し、データ内の数字 (10000 としましょう) を検索し、数字の横にある名前 (マッシュルーム パーク) を取得し、その名前を文字列。
以下のコードは私が既に持っているもので、すべてのデータが .txt ファイル内にある場合に機能しますが、このコードを上記のリンクに接続して最終的により効率的にするように変換したいと思います。
ありがとう。
String^ GrabMapNameById(String^ CurrentStr)//Current Map String{
if(CurrentMapIDRead.ToString() != CurrentMapID.ToString()) //If map has chnaged
{
try //Try streaming text
{
String^ Maps = "Strife.Maps";//map File Name
StreamReader^ MapDin = File::OpenText("Strife.Maps");//Stream Declar
String^ str;
string s;
int count = 0;
while ((str = MapDin->ReadLine()) != nullptr) //Loop for every line
{
if(str->Contains(CurrentMapID.ToString())) //Untill Map id found
{
CurrentMapIDRead = CurrentMapID; //Set Current Map Name
CurrentStr = str->Replace(CurrentMapIDRead.ToString() , "" );//Replace map id with null characters
CurrentStr = CurrentStr->Replace(" =" , "" ); //Take out = characters
break;// kill while
}
}
}
catch (Exception^ e)
{
}
}return CurrentStr;}