Ejemplo n.º 1
0
 public static void LoadIPTable()
 {
     if (!File.Exists(g_sServerIPConfFileNmae))
     {
         g_ServerIPList.Add("127.0.0.1");
         try
         {
             g_ServerIPList.SaveToFile(g_sServerIPConfFileNmae);
         }
         catch
         {
         }
     }
     else
     {
         g_ServerIPList.Clear();
         try
         {
             g_ServerIPList.LoadFromFile(g_sServerIPConfFileNmae);
         }
         catch
         {
             MainOutMessage("加载IP列表文件 " + g_sServerIPConfFileNmae + " 出错!!!");
         }
     }
 }
Ejemplo n.º 2
0
        public static void LoadGateID()
        {
            int I;

            GameFramework.TStringList LoadList;
            string sLineText;
            string sID     = string.Empty;
            string sIPaddr = string.Empty;
            int    nID;

            g_GateIDList.Clear();
            if (File.Exists(g_sGateIDConfFileName))
            {
                LoadList = new GameFramework.TStringList();
                LoadList.LoadFromFile(g_sGateIDConfFileName);
                for (I = 0; I < LoadList.Count; I++)
                {
                    sLineText = LoadList[I];
                    if ((sLineText == "") || (sLineText[1] == ';'))
                    {
                        continue;
                    }
                    sLineText = GameFramework.HUtil32.GetValidStr3(sLineText, ref sID, new string[] { " ", "\09" });
                    sLineText = GameFramework.HUtil32.GetValidStr3(sLineText, ref sIPaddr, new string[] { " ", "\09" });
                    nID       = GameFramework.HUtil32.Str_ToInt(sID, -1);
                    if (nID < 0)
                    {
                        continue;
                    }
                    g_GateIDList.Add(sIPaddr, ((nID) as Object));
                }
            }
        }
Ejemplo n.º 3
0
        public static bool LoadAICharNameList(string sFileName)
        {
            bool result;
            int  I;

            result = false;
            if (File.Exists(sFileName))
            {
                g_AICharNameList.Clear();
                g_AICharNameList.LoadFromFile(sFileName);
                I = 0;
                while (true)
                {
                    if (g_AICharNameList.Count <= I)
                    {
                        break;
                    }
                    if (g_AICharNameList[I].Trim() == "")
                    {
                        g_AICharNameList.RemoveAt(I);
                        continue;
                    }
                    I++;
                }
                result = true;
            }
            return(result);
        }
Ejemplo n.º 4
0
        public static bool LoadClearMakeIndexList(string sFileName)
        {
            bool   result;
            int    I;
            int    nIndex;
            string sLineText;

            result = false;
            if (File.Exists(sFileName))
            {
                //@ Unsupported property or method(A): 'LoadFromFile'
                g_ClearMakeIndex.LoadFromFile(sFileName);
                I = 0;
                while (true)
                {
                    if (g_ClearMakeIndex.Count <= I)
                    {
                        break;
                    }
                    sLineText = g_ClearMakeIndex[I];

                    //@ Undeclared identifier(3): 'Str_ToInt'
                    nIndex = GameFramework.HUtil32.Str_ToInt(sLineText, -1);
                    if (nIndex < 0)
                    {
                        g_ClearMakeIndex.RemoveAt(I);
                        continue;
                    }

                    //@ Unsupported property or method(A): 'Values'
                    g_ClearMakeIndex[I] = Convert.ToString(nIndex);
                    I++;
                }
                result = true;
            }
            return(result);
        }
Ejemplo n.º 5
0
        public static void LoadServerInfo()
        {
            int I;

            GameFramework.TStringList LoadList;
            int    nRouteIdx;
            int    nGateIdx;
            int    nServerIndex;
            string sLineText;
            string sSelGateIPaddr  = string.Empty;
            string sGameGateIPaddr = string.Empty;
            string sGameGate;
            string sGameGatePort = string.Empty;
            string sMapName      = string.Empty;
            string sMapInfo;
            string sServerIndex;

            if (!File.Exists(g_sGateConfFileName))//如果文件不存在 则生成!serverinfo.txt
            {
                LoadList = new GameFramework.TStringList();
                LoadList.Add("127.0.0.1 127.0.0.1 7200");
                try
                {
                    LoadList.SaveToFile(g_sGateConfFileName);
                }
                catch
                {
                }
            }
            if (File.Exists(g_sGateConfFileName))//如果文件存在
            {
                LoadList = new GameFramework.TStringList();
                try
                {
                    LoadList.LoadFromFile(g_sGateConfFileName);
                }
                catch
                {
                }
                nRouteIdx = 0;
                nGateIdx  = 0;
                for (I = 0; I < LoadList.Count; I++)
                {
                    sLineText = LoadList[I].Trim();
                    if ((sLineText != "") && (sLineText[1] != ';'))
                    {
                        sGameGate = GameFramework.HUtil32.GetValidStr3(sLineText, ref sSelGateIPaddr, new string[] { " ", "\09" });
                        if ((sGameGate == "") || (sSelGateIPaddr == ""))//如果为空继续
                        {
                            continue;
                        }
                        g_RouteInfo[nRouteIdx].sSelGateIP = sSelGateIPaddr.Trim();//第一个IP 选择网关IP
                        g_RouteInfo[nRouteIdx].nGateCount = 0;
                        nGateIdx = 0;
                        while ((sGameGate != ""))//如果剩下的字符串不为空  如果一直不为空
                        {
                            sGameGate = GameFramework.HUtil32.GetValidStr3(sGameGate, ref sGameGateIPaddr, new string[] { " ", "\09" });
                            sGameGate = GameFramework.HUtil32.GetValidStr3(sGameGate, ref sGameGatePort, new string[] { " ", "\09" });
                            g_RouteInfo[nRouteIdx].sGameGateIP.Add(sGameGateIPaddr.Trim());//游戏网关IP
                            g_RouteInfo[nRouteIdx].nGameGatePort.Add(GameFramework.HUtil32.Str_ToInt(sGameGatePort, 0));
                            nGateIdx++;
                        }
                        g_RouteInfo[nRouteIdx].nGateCount = nGateIdx;
                        nRouteIdx++;
                    }
                }
                LoadList.Dispose();
            }
            GameFramework.IniFile Conf = new GameFramework.IniFile(g_sConfFileName);//Dbsrc.ini
            g_sMapFile = Conf.ReadString("Setup", "MapFile", g_sMapFile);
            g_MapList.Clear();
            if (File.Exists(g_sMapFile))
            {
                LoadList = new GameFramework.TStringList();
                try
                {
                    LoadList.LoadFromFile(g_sMapFile);
                }
                catch
                {
                }
                for (I = 0; I < LoadList.Count; I++)
                {
                    sLineText = LoadList[I];
                    if ((sLineText != "") && (sLineText[0] == '['))
                    {
                        sLineText    = GameFramework.HUtil32.ArrestStringEx(sLineText, "[", "]", ref sMapName);
                        sMapInfo     = GameFramework.HUtil32.GetValidStr3(sMapName, ref sMapName, new string[] { " ", "\09" });
                        sServerIndex = GameFramework.HUtil32.GetValidStr3(sMapInfo, ref sMapInfo, new string[] { " ", "\09" }).Trim();
                        nServerIndex = GameFramework.HUtil32.Str_ToInt(sServerIndex, 0);
                        g_MapList.Add(sMapName, ((nServerIndex) as Object));
                    }
                }
            }
        }