Skip to content

Commit

Permalink
Try to merge the freem and SandonV forks
Browse files Browse the repository at this point in the history
  • Loading branch information
Moutix committed May 10, 2015
1 parent 4c60054 commit 19ffccf
Show file tree
Hide file tree
Showing 19 changed files with 4,408 additions and 2,229 deletions.
130 changes: 130 additions & 0 deletions init_db.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
DROP TABLE IF EXISTS `bans`;
CREATE TABLE `bans` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`IP` text COLLATE utf8_unicode_ci NOT NULL,
`From` int(11) NOT NULL,
`Date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


DROP TABLE IF EXISTS `connectionlog`;
CREATE TABLE `connectionlog` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`userid` int(11) NOT NULL,
`username` text COLLATE utf8_unicode_ci NOT NULL,
`password` text COLLATE utf8_unicode_ci NOT NULL,
`ip` text COLLATE utf8_unicode_ci NOT NULL,
`result` enum('suceeded','failed') COLLATE utf8_unicode_ci NOT NULL,
`clientversion` text COLLATE utf8_unicode_ci NOT NULL,
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


DROP TABLE IF EXISTS `fixedrooms`;
CREATE TABLE `fixedrooms` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`Name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`Description` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`Password` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`Free` int(11) NOT NULL,
`MOTD` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`Operators` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


DROP TABLE IF EXISTS `news`;
CREATE TABLE `news` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`Author` int(11) NOT NULL,
`Title` text COLLATE utf8_unicode_ci NOT NULL,
`Content` text COLLATE utf8_unicode_ci NOT NULL,
`TimeStamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


DROP TABLE IF EXISTS `rooms`;
CREATE TABLE `rooms` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`Name` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL,
`Description` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL,
`Owner` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
`Created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


DROP TABLE IF EXISTS `settings`;
CREATE TABLE `settings` (
`Key` text COLLATE utf8_unicode_ci NOT NULL,
`Value` text COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


DROP TABLE IF EXISTS `songs`;
CREATE TABLE `songs` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`Name` text COLLATE utf8_unicode_ci NOT NULL,
`Artist` text COLLATE utf8_unicode_ci NOT NULL,
`SubTitle` text COLLATE utf8_unicode_ci NOT NULL,
`Played` int(11) NOT NULL,
`Time` int(11) NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


DROP TABLE IF EXISTS `stats`;
CREATE TABLE `stats` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`User` int(11) NOT NULL,
`PlayerSettings` text COLLATE utf8_unicode_ci NOT NULL,
`Song` int(11) NOT NULL,
`Room` int(11) NOT NULL,
`Feet` int(11) NOT NULL,
`Difficulty` int(11) NOT NULL,
`Grade` int(11) NOT NULL,
`Score` int(11) NOT NULL,
`MaxCombo` int(11) NOT NULL,
`Note_0` int(11) NOT NULL,
`Note_1` int(11) NOT NULL,
`Note_Mine` int(11) NOT NULL,
`Note_Miss` int(11) NOT NULL,
`Note_Barely` int(11) NOT NULL,
`Note_Good` int(11) NOT NULL,
`Note_Great` int(11) NOT NULL,
`Note_Perfect` int(11) NOT NULL,
`Note_Flawless` int(11) NOT NULL,
`Note_NG` int(11) NOT NULL,
`Note_Held` int(11) NOT NULL,
`rate` int(11) NOT NULL,
`Toasty` int(6) NOT NULL,
`timing` int(8) NOT NULL,
`TimeStamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`Username` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
`Password` text COLLATE utf8_unicode_ci NOT NULL,
`Email` text COLLATE utf8_unicode_ci NOT NULL,
`Rank` int(11) NOT NULL,
`XP` int(11) NOT NULL,
`Joined` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`ID`),
KEY `Username` (`Username`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

DROP TABLE IF EXISTS `friends`;
CREATE TABLE `friends` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`user` int(11) NOT NULL,
`friend` int(11) NOT NULL,
`Created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
4 changes: 2 additions & 2 deletions src/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Reflection;
using System.Runtime.CompilerServices;

// Information about this assembly is defined by the following attributes.
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.

[assembly: AssemblyTitle("OpenSMO")]
Expand All @@ -19,7 +19,7 @@

[assembly: AssemblyVersion("1.0.*")]

// The following attributes are used to specify the signing key for the assembly,
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.

//[assembly: AssemblyDelaySign(false)]
Expand Down
74 changes: 40 additions & 34 deletions src/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,44 @@
using System.Collections;
using System.IO;

namespace OpenSMO {
public class Config {
public string Filename;
public Hashtable Data;

public Config(string Filename) {
this.Filename = Filename;

Data = new Hashtable();
string[] lines = File.ReadAllLines(Filename);
foreach (string line in lines) {
if (line.Trim().StartsWith("//") || line.Trim() == "")
continue;

string[] parse = line.Trim().Split(new char[] { '=' }, 2);

if (parse.Length != 2)
continue;

Data[parse[0].Trim()] = parse[1].Trim();
}
}

public bool Contains(string Key) {
return Data.ContainsKey(Key);
}

public string Get(string Key) {
if (Contains(Key))
return (string)Data[Key];
else
return "";
}
}
namespace OpenSMO
{
public class Config
{
public string Filename;
public Hashtable Data;

public Config(string Filename)
{
this.Filename = Filename;

Data = new Hashtable();
string[] lines = File.ReadAllLines(Filename);
foreach (string line in lines)
{
if (line.Trim().StartsWith("//") || line.Trim() == "")
continue;

string[] parse = line.Trim().Split(new char[] { '=' }, 2);

if (parse.Length != 2)
continue;

Data[parse[0].Trim()] = parse[1].Trim();
}
}

public bool Contains(string Key)
{
return Data.ContainsKey(Key);
}

public string Get(string Key)
{
if (Contains(Key))
return (string)Data[Key];
else
return "";
}
}
}
Loading

0 comments on commit 19ffccf

Please sign in to comment.