[Help]source 5101 coemu[Help}

02/14/2010 18:54 renetjuuh#1
hello everyone,

im using 5101 source. but i got an problem. my hamchi ip change all the time in to my own ip :s
i try to change it but fail.:(
all what i want is that it just stays by the ip that i filled in
Code:
	public static void StartServer()
		{
            //Console.WriteLine("Starting Server");
            try
            {
                MyWan = System.Text.Encoding.ASCII.GetString((Cl.DownloadData("http://whatismyip.com/automation/n09230945.asp")));
            }
            catch { }
            CheckWan(MyWan);
Code:
  private static void CheckWan(string MyWan)
        {
            if (MyWan.Length > 5)
            {
                Ini Wan = new Ini("C:\\AppServ\\www\\Co\\Patches\\version.ini");
                string LastIp = Wan.ReadValue("Data", "ip");
                if (MyWan != LastIp)
                {
                    Wan.WriteString("Data", "ip", MyWan);
                    string[] OldLines = new string[100]; byte CurL = 0;
                    //string[] UpDateServer = File.ReadAllLines("C:\\AppServ\\www\\Co\\Patches\\Server.dat");
                    FileStream ServerDat = new FileStream("C:\\AppServ\\www\\Co\\Patches\\server.dat", FileMode.Open, FileAccess.Read);
                    StreamReader srFile = new StreamReader(ServerDat);
                    while (!srFile.EndOfStream)
                    {
                        string CurLine = srFile.ReadLine();
                        if (CurLine.Contains(LastIp))
                        {
                            CurLine=CurLine.Replace(LastIp, MyWan);
                        }
                        OldLines[CurL] = CurLine; CurL++;
                    }
                    srFile.Close();
                    ServerDat.Close(); ServerDat.Dispose();
                    FileStream NewServer = new FileStream("C:\\AppServ\\www\\Co\\Patches\\server.dat", FileMode.Open, FileAccess.Write);
                    StreamWriter ToWrite = new StreamWriter(NewServer);
                    for (byte x = 0; x < CurL; x++)
                    {
                        ToWrite.WriteLine(OldLines[x]);
                    }
                    ToWrite.Close(); NewServer.Close();
                }
                
            }
        }
everyting is i nano.cs

chears: rene
02/14/2010 22:39 sawickas#2
Yuo need recode all system,and yuo using quiq co source its a lot of bugs hawe.
02/15/2010 18:54 renetjuuh#3
na i dont think you neet to recode the whole systeem, and is has much bugs but i dont care i learn from that