Done more work on the world map downloading functionality

zircon^2
gareth 2007-05-20 01:10:29 +00:00
parent 8e18a3ae75
commit 5f393102b1
4 changed files with 37 additions and 2 deletions

View File

@ -1,5 +1,8 @@
using Nwc.XmlRpc; using Nwc.XmlRpc;
using System; using System;
using System.Net;
using System.IO;
using System.Xml;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using libsecondlife; using libsecondlife;
@ -12,6 +15,8 @@ namespace OpenGridServices.Manager
public LLUUID SessionID; public LLUUID SessionID;
public bool connected=false; public bool connected=false;
public RegionBlock[][] WorldMap;
public bool Connect(string GridServerURL, string username, string password) public bool Connect(string GridServerURL, string username, string password)
{ {
try { try {
@ -39,6 +44,29 @@ namespace OpenGridServices.Manager
} }
} }
public void DownloadMap()
{
System.Net.WebClient mapdownloader = new WebClient();
Stream regionliststream = mapdownloader.OpenRead(ServerURL + "/regionlist");
XmlDocument doc = new XmlDocument();
doc.Load(regionliststream);
XmlNode rootnode = doc.FirstChild;
if (rootnode.Name != "regions")
{
// TODO - ERROR!
}
for(int i=0; i<=rootnode.ChildNodes.Count; i++)
{
if(rootnode.ChildNodes.Item(i).Name != "region") {
// TODO - ERROR!
} else {
}
}
}
public bool RestartServer() public bool RestartServer()
{ {
return true; return true;

View File

@ -43,7 +43,8 @@ namespace OpenGridServices.Manager
win.SetStatus("Connected OK with session ID:" + gridserverConn.SessionID); win.SetStatus("Connected OK with session ID:" + gridserverConn.SessionID);
win.SetGridServerConnected(true); win.SetGridServerConnected(true);
Thread.Sleep(3000); Thread.Sleep(3000);
win.SetStatus(""); win.SetStatus("Downloading region maps...");
gridserverConn.DownloadMap();
} else { } else {
win.SetStatus("Could not connect"); win.SetStatus("Could not connect");
} }

View File

@ -17,7 +17,12 @@ namespace OpenGridServices.Manager {
public void DrawGrid(RegionBlock[][] regions) public void DrawGrid(RegionBlock[][] regions)
{ {
for(int x=0; x<=regions.GetUpperBound(0); x++) {
for(int y=0; y<=regions.GetUpperBound(1); y++) {
Gdk.Image themap = new Gdk.Image(Gdk.ImageType.Fastest,Gdk.Visual.System,256,256);
this.drawingarea1.GdkWindow.DrawImage(new Gdk.GC(this.drawingarea1.GdkWindow),themap,0,0,x*256,y*256,256,256);
}
}
} }
public void SetGridServerConnected(bool connected) public void SetGridServerConnected(bool connected)

View File

@ -37,6 +37,7 @@
<ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
<ProjectReference type="Assembly" localcopy="True" refto="../../bin/XMLRPC.dll" /> <ProjectReference type="Assembly" localcopy="True" refto="../../bin/XMLRPC.dll" />
<ProjectReference type="Gac" localcopy="True" refto="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</References> </References>
<GtkDesignInfo partialTypes="True" /> <GtkDesignInfo partialTypes="True" />
</Project> </Project>