View Full Version : I is noob! Help me! (C#)
R0b0t1
09-01-2007, 04:25 PM
Yeah, with sharpdevelop, this won't compile. I really don't know what other info yo uneed, except the files...
'Oh yeah, its a console application.
Light
09-06-2007, 01:43 AM
hmm does it give an error message? I'm used to using Visual Studio .NET so I can try to help but no guarantees :)
Edit:
I'll keep adding stuff as I notice it.
Starting with the RS2World.cs file
#1: public class RS2World() : RS2WorldMain{
no () in class definitions.
change to: public class RS2World() : RS2WorldMain{
#2:
public Hashtable WorldPref = new Hashtable(144, 1.0);
public Hashtable WorldType = new Hashtable(144, 1.0);
No public data types in methods.What are they public for??? Not allowed.
change to:
private Hashtable WorldPref = new Hashtable(144, 1.0);
private Hashtable WorldType = new Hashtable(144, 1.0);
#3
if(Table == "Prefix") || (Table == "prefix"){
WorldPref[Entry] = NewVal;
} else if(Table == "Type") || (Table == "type"){
WorldType[Entry] = NewVal;
} else {
break;
}
watch your parenthesis and you can't just put else if. Also, no reason for break.
Should look something like this:
if((Table == "Prefix") || (Table == "prefix"))
{
WorldPref[Entry] = NewVal;
}
else
{
if ((Table == "Type") || (Table == "type"))
{
WorldType[Entry] = NewVal;
}
}
Another option would be to do something like if(Table.ToLower() == "prefix") to make it not case sensitive.
#4
More convention than an error
Explicitly put all accessors, C# should automatically put all methods as public and data as private... but you should put the accessor anyway.
#5
More convention than an error
Classes should each get there own file.
#6
string GetWorldURL(string WorldNumS, int JavaT, DetailT)
you have to put what type DetailT is, you're getting confused with delphi :P
string GetWorldURL(string WorldNumS, int JavaT, int DetailT)
#7
add following line next to using System; (Will add HashTable so you can use it)
using System.Collections;
#8
Hashtable WorldPref = new Hashtable(144, 1.0);
Hashtable WorldType = new Hashtable(144, 1.0);
change to: (specifies that second value is floating point, auto is that it is a double)
Hashtable WorldPref = new Hashtable(144, 1.0F);
Hashtable WorldType = new Hashtable(144, 1.0F);
#9
So WorldPref and WorldType exist outside of that function, declare them inside the class scope and initialize them inside the function.
Hashtable WorldPref;
Hashtable WorldType;
void ContructTables(){
WorldPref = new Hashtable(144, 1.0F);
WorldType = new Hashtable(144, 1.0F);
}
Moving to the program
#10
public RS2World RWorld = new RS2World();
public WorldLoader Loader = new WorldLoader();
no public data types
RS2World RWorld = new RS2World();
WorldLoader Loader = new WorldLoader();
#11
Console.Write{"Press any key to continue . . . ")'
just a typo
Console.Write("Press any key to continue . . . ");
#12
public string WNM = Console.WriteLine("World (1-144): {0}", Console.ReadLine());
no public data types
string WNM = Console.WriteLine("World (1-144): {0}", Console.ReadLine());
There's more, it still needs some work before it'll compile. Start with that and re-upload and I'll continue a little later.
R0b0t1
09-08-2007, 12:45 AM
I keep my own standards :\, so things about the placing of the brakcets don't count... But thanks for the information, though I already had it half fixed. (Check dates!).
Light
09-08-2007, 03:30 AM
Sounds good, you'll figure it out.
Let me know if you need anymore help.
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.