Quantcast
Channel: RaGEZONE - MMO Development Forums
Viewing all articles
Browse latest Browse all 29478

[Release] C# MySQL Row Property Generator

$
0
0
Hey guys. I don't really knew a good title haha.

I just started a little tool. It's written in C#. I release it here since it could be useful.

What it does? You connect the tool to MySQL (first box is hostname, second is username, third is password, fourth is database) and then you use the bar next to hostname box to select a table (MAKE SURE!! you DON'T type in something. I took this from DotNetBar ONLY for the style), then you check items you want a property for, and you click the button for generating the code. Copy it to your emulator and you can develop some more. Also, it'll generate a constructor. Just change CLASSNAME in the name of your class and it should work. Don't forget to import System.Data in your class.

I don't include DotNetBar and it uses DotNetBar so you either download it or you just change the style. If there are any problems, just put it here. This helps a lot in emulator development as you don't have to make every property (good thing with over 20 rows you want to include or if you're just laze) yourself. all the properties are public and have the right datatype but I don't know if there are any bugs.

A screen for proof:





It's written from scratch :-)

Snippets:

PHP Code:

 private void btnGenerate_Click(object senderEventArgs e)
        {
            List<
Tuple<stringstringstring>> data = new List<Tuple<stringstringstring>>();

            foreach (
string selectedItem in chkLstBoxFields.CheckedItems)
            {
                
string name selectedItem;
                
string[] parts name.Split('_');

                
string propName "";

                for (
int i 0parts.Lengthi++)
                {
                    
propName += (parts[i].Replace(parts[i][0], char.ToUpper(parts[i][0])));
                }

                
string prop = @"public " types[name] + " " propName + @"
{
    get;
    set;
}"
;
                
txtCode.Text += prop Environment.NewLine Environment.NewLine;

                
data.Add(new Tuple<stringstringstring>(namepropNametypes[name]));
            }

            
string ctor = @"public CLASSNAME(DataRow dRow)
{
"
;
            foreach (
Tuple<stringstringstringtriple in data)
            {
                
ctor += (char)triple.Item2 " = (" triple.Item3 ")dRow[\"" triple.Item1 "\"];" Environment.NewLine;
            }

            
ctor += "}";

            
txtCode.Text += ctor;
        } 

Credits:

- Me: Making the program

Download:

https://mega.co.nz/#!pNkzxBRK!Rn3_pD...ytxkZ5eFzzcfSs
http://www.mediafire.com/download/ln...yGenerator.rar

It is very bad coded, the only reason I made it since I needed the concept and it works, so I won't make the code better only if there are any bugs.

Viewing all articles
Browse latest Browse all 29478

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>