Exemple #1
0
        public WorldObject(DatabaseID dbID, bool addToWorld)
        {
            mDatabaseID = dbID;
            mAddToWorld = addToWorld;

            WorldID = WorldID.Dynamic(dbID.Type);
        }
Exemple #2
0
 public bool DatabaseEquals(DatabaseID dbid)
 {
     if (dbid == null)
     {
         return(false);
     }
     return(dbid.DatabaseName.Equals(this.DatabaseName));
 }
Exemple #3
0
 public Monster(DatabaseID dbID, bool addToWorld)
     : base(dbID, addToWorld)
 {
     DamageLog    = new MonsterDamageLog();
     SkillDelays  = new List <uint>();
     StatusChange = new WorldObjectStatusChangeList();
     LootItem     = new List <Item>();
     Regen        = new WorldObjectRegenerationData(this);
 }
Exemple #4
0
        public static int GetSchemaHashCode(SchemaID sid)
        {
            if (!sid._hashCode.HasValue)
            {
                sid._hashCode = sid._schemaName.GetHashCode();
            }

            return(DatabaseID.GetDatabaseHashCode(sid) * 17 + sid._hashCode.Value);
        }
		public DatabaseObject this[DatabaseID key] {
			get {
				DatabaseObject obj;
				if (TryGetValue(key, out obj) == false) {
					return null;
				}
				return obj;
			}
		}
Exemple #6
0
        private Issue GetIssue(DatabaseID context)
        {
            var identifierName = String.Empty;
            var dbObject       = String.Empty;
            var issue          = new Issue(this, this.DefaultSeverity.Value);

            issue.Name = "Identifier is a Reserved Word From SQL";
            Table table = null;

            if (context is Schema)
            {
                var sid = context as Schema;
                identifierName = sid.SchemaName;
                dbObject       = "schema";
            }
            else if (context is Table)
            {
                var sid = context as Table;
                identifierName = sid.TableName;
                dbObject       = "table";
            }
            else if (context is Column)
            {
                var sid = context as Column;
                identifierName = sid.ColumnName;
                dbObject       = "column";
                table          = sid.Table;
            }
            else if (context is PrimaryKey)
            {
                var sid = context as PrimaryKey;
                identifierName = sid.PrimaryKeyName;
                dbObject       = "primary-key";
                table          = sid.Table;
            }
            else if (context is ForeignKey)
            {
                var sid = context as ForeignKey;
                identifierName = sid.ForeignKeyName;
                dbObject       = "foreign-key";
            }

            if (table != null)
            {
                issue.Description = new Description("The {0} name '{1}' in table '{2}' is a reserved SQL word.", dbObject, identifierName, table);
            }
            else
            {
                issue.Description = new Description("The {0} name '{1}' is a reserved word in SQL.", dbObject, identifierName);
            }

            issue.ExtendedDescription = new Description("{0}", GetStandardViolation(identifierName));
            issue.Context             = IssueContext.Create(context);
            return(issue);
        }
Exemple #7
0
        public DatabaseConnection(DatabaseID databaseID)
        {
            this.databaseID = databaseID;

            string databaseName = DetermineDatabaseName(databaseID);
            if (!string.IsNullOrEmpty(databaseName)) {
            #if !DEBUG
                database = new MySql(Settings.DatabaseIP, Settings.DatabasePort, databaseName, Settings.DatabaseUser, Settings.DatabasePassword);

            #else
                database = new MySql("localhost", Settings.DatabasePort, databaseName, Settings.DatabaseUser, Settings.DatabasePassword);
            #endif
            }

            database.OpenConnection();
        }
Exemple #8
0
        public Character(DatabaseID dbID, bool addToWorld)
            : base(dbID, addToWorld)
        {
            BaseStatus   = new WorldObjectStatus(this);
            BattleStatus = new WorldObjectStatus(this);
            ViewData     = new WorldObjectViewData();
            StatusChange = new WorldObjectStatusChangeList();

            // TODO: i dont where eAthena initialize them realy..
            //		 they using struct, which cant be null x.x
            Regen   = new WorldObjectRegenerationData(this);
            HPRegen = new StatusVariationData();
            SPRegen = new StatusVariationData();
            SRegen  = new CharacterRegenerationData();
            SSRegen = new CharacterRegenerationData();
        }
        private string DetermineDatabaseName(DatabaseID databaseID)
        {
            switch (databaseID)
            {
            case DatabaseID.Players: {
                return("pmu_players");
            }

            case DatabaseID.Data: {
                return("pmu_data");
            }

            default: {
                return(null);
            }
            }
        }
        public DatabaseConnection(DatabaseID databaseID)
        {
            this.databaseID = databaseID;

            string databaseName = DetermineDatabaseName(databaseID);

            if (!string.IsNullOrEmpty(databaseName))
            {
#if !DEBUG
                database = new MySql(Settings.DatabaseIP /*"pmuniverse.servegame.com"*/, Settings.DatabasePort, databaseName, Settings.DatabaseUser, Settings.DatabasePassword);
#else
                database = new MySql("localhost", Settings.DatabasePort, databaseName, Settings.DatabaseUser, Settings.DatabasePassword);
#endif
            }

            database.OpenConnection();
        }
Exemple #11
0
        public DatabaseConnection(DatabaseID databaseID, bool openConnection)
        {
            this.databaseID = databaseID;

            string databaseName = DetermineDatabaseName(databaseID);

            if (!string.IsNullOrEmpty(databaseName))
            {
#if !DEBUG
                database = new PMDCP.DatabaseConnector.MySql.MySql(Settings.DatabaseIP, Settings.DatabasePort, databaseName, Settings.DatabaseUser, Settings.DatabasePassword);
#else
                database = new PMDCP.DatabaseConnector.MySql.MySql("localhost", Settings.DatabasePort, databaseName, Settings.DatabaseUser, Settings.DatabasePassword);
#endif
            }

            if (openConnection)
            {
                database.OpenConnection();
            }
        }
Exemple #12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string NewServerID = "";

        if (!IsPostBack)
        {
            ServerID.Text = "";
        }
        if (Request.Form.Get("ctl00$main$Servers1$ServerID") == null)
        {
            NewServerID = "0";
        }
        else
        {
            NewServerID = Request.Form.Get("ctl00$main$Servers1$ServerID");
        }

        //Security length
        if (NewServerID.Length > 3)
        {
            NewServerID = NewServerID.Substring(1, 3);
        }

        if (ServerID.Text != NewServerID)
        {
            ServerID.Text       = NewServerID;
            ds.ConnectionString = WebConfigurationManager.ConnectionStrings["mainConnectionString"].ConnectionString;
            ds.SelectCommand    = "SELECT ID,Name FROM dbo.nipm_get_databases(" + ServerID.Text + ",null)";
            DatabaseID.DataBind();
            DatabaseID.ToolTip = "ServerID=" + ServerID.Text + ",DatabaseID=" + DatabaseID.SelectedValue.ToString();

            //Request.Form.Set("ctl00$main$Databases$DatabaseID", DatabaseID.SelectedValue);
            //Request.Form.S

            //DatabaseID.ID.ToString()-НЕ ПОЙДЕТ
            //DatabaseID.NamingContainer.ToString() -?
            //DatabaseID.Page.ToString()
            //DatabaseID.UniqueID.ToString()-полезняха
            //DatabaseID.ClientID.ToString()-полезняха
        }
    }
Exemple #13
0
        private static IServiceProvider CreateServices(DatabaseID databaseID)
        {
            string tag;

            switch (databaseID)
            {
            case DatabaseID.Players:
                tag = "players";
                break;

            case DatabaseID.Data:
                tag = "data";
                break;

            default:
                throw new NotSupportedException();
            }

            var databaseConnection = new DatabaseConnection(databaseID, false);

            return(new ServiceCollection()
                   // Add common FluentMigrator services
                   .AddFluentMigratorCore()
                   .ConfigureRunner(rb => rb
                                    // Add SQLite support to FluentMigrator
                                    .AddMySql5()
                                    .WithGlobalCommandTimeout(TimeSpan.Zero)
                                    // Set the connection string
                                    .WithGlobalConnectionString(databaseConnection.Database.ConnectionString)
                                    // Define the assembly containing the migrations
                                    .ScanIn(typeof(MigrationRunner).Assembly).For.Migrations())
                   .Configure <RunnerOptions>(opt =>
            {
                opt.Tags = new string[] { tag };
            })
                   // Enable logging to console in the FluentMigrator way
                   .AddLogging(lb => lb.AddFluentMigratorConsole())
                   // Build the service provider
                   .BuildServiceProvider(false));
        }
Exemple #14
0
 public static IssueContext Create(DatabaseID context)
 {
     if (context is ColumnID)
     {
         return(new ColumnContext((ColumnID)context));
     }
     else if (context is TableID)
     {
         return(new TableContext((TableID)context));
     }
     else if (context is SchemaID)
     {
         return(new SchemaContext((SchemaID)context));
     }
     if (context is DatabaseID)
     {
         return(new DatabaseContext((DatabaseID)context));
     }
     else
     {
         throw new Exception(String.Format("{0} cannot be used as an issue context", context.ToString()));
     }
 }
Exemple #15
0
 public WorldObject(DatabaseID dbID)
     : this(dbID, false)
 {
 }
Exemple #16
0
		public Monster(DatabaseID dbID)
			: this(dbID, false) {
		}
Exemple #17
0
 public virtual void UpdateDatabaseID(uint id, EDatabaseType type)
 {
     mDatabaseID   = new DatabaseID(id, type);
     mDatabaseData = null;
 }
Exemple #18
0
 public static int GetDatabaseHashCode(DatabaseID dbid)
 {
     return(dbid.DatabaseName.GetHashCode());
 }
Exemple #19
0
		public Character(DatabaseID dbID)
			: this(dbID, false) {
		}
Exemple #20
0
 private string DetermineDatabaseName(DatabaseID databaseID)
 {
     switch (databaseID) {
         case DatabaseID.Players: {
                 return "mdx_players";
             }
         case DatabaseID.Data: {
                 return "mdx_data";
             }
         default: {
                 return null;
             }
     }
 }
Exemple #21
0
 public Character(DatabaseID dbID)
     : this(dbID, false)
 {
 }
Exemple #22
0
		public Item(DatabaseID dbID)
			: base(dbID) {
		}
Exemple #23
0
 public Guild(DatabaseID id)
     : base(id)
 {
     Member = new List <GuildMember>();
 }
Exemple #24
0
		public WorldObjectUnit(DatabaseID dbID, bool addToWorld)
			: base(dbID, addToWorld) {
		}
Exemple #25
0
		public Item(DatabaseID dbID, bool addToWorld)
			: base(dbID, addToWorld) {
		}
		public bool TryGetValue(DatabaseID key, out DatabaseObject obj) {
			switch (key.Type) {
				case EDatabaseType.Account:
					return mAccount.TryGetValue(key, out obj);
				case EDatabaseType.Char:
					return mCharacter.TryGetValue(key, out obj);
				case EDatabaseType.Guild:
					return mGuild.TryGetValue(key, out obj);
				case EDatabaseType.Homunculus:
					return mHomonculus.TryGetValue(key, out obj);
				case EDatabaseType.Item:
					return mItem.TryGetValue(key, out obj);
				case EDatabaseType.Mob:
					return mMonster.TryGetValue(key, out obj);
				case EDatabaseType.Npc:
					return mNpc.TryGetValue(key, out obj);
				case EDatabaseType.Party:
					return mParty.TryGetValue(key, out obj);
				case EDatabaseType.Pet:
					return mPet.TryGetValue(key, out obj);
			}

			obj = null;
			return false;
		}
		public bool Remove(DatabaseID key) {
			switch (key.Type) {
				case EDatabaseType.Account:
					return mAccount.Remove(key);
				case EDatabaseType.Char:
					return mCharacter.Remove(key);
				case EDatabaseType.Guild:
					return mGuild.Remove(key);
				case EDatabaseType.Homunculus:
					return mHomonculus.Remove(key);
				case EDatabaseType.Item:
					return mItem.Remove(key);
				case EDatabaseType.Mob:
					return mMonster.Remove(key);
				case EDatabaseType.Npc:
					return mNpc.Remove(key);
				case EDatabaseType.Party:
					return mParty.Remove(key);
				case EDatabaseType.Pet:
					return mPet.Remove(key);
			}

			return false;
		}
		public void Add(DatabaseID key, DatabaseObject obj) {
			switch (key.Type) {
				case EDatabaseType.Account:
					mAccount.Add(key, obj);
					break;
				case EDatabaseType.Char:
					mCharacter.Add(key, obj);
					break;
				case EDatabaseType.Guild:
					mGuild.Add(key, obj);
					break;
				case EDatabaseType.Homunculus:
					mHomonculus.Add(key, obj);
					break;
				case EDatabaseType.Item:
					mItem.Add(key, obj);
					break;
				case EDatabaseType.Mob:
					mMonster.Add(key, obj);
					break;
				case EDatabaseType.Npc:
					mNpc.Add(key, obj);
					break;
				case EDatabaseType.Party:
					mParty.Add(key, obj);
					break;
				case EDatabaseType.Pet:
					mPet.Add(key, obj);
					break;
			}
		}
Exemple #29
0
		public Skill(DatabaseID dbID)
			: base(dbID) {
		}
Exemple #30
0
 public NpcWarpScript(DatabaseID id, NpcWarpData warpData)
     : base(id)
 {
     WarpData = warpData;
 }
Exemple #31
0
 public GuildCastle(DatabaseID id)
     : base(id)
 {
 }
Exemple #32
0
 public DatabaseConnection(DatabaseID databaseID) : this(databaseID, true)
 {
 }
Exemple #33
0
		public GuildCastle(DatabaseID id)
			: base(id) {
		}
Exemple #34
0
 public DatabaseContext(DatabaseID db, IEnumerable <SchemaID> schemas) : this(db)
 {
     this.Schemas = schemas.Select(s => new SchemaID(s));
 }
Exemple #35
0
 public Monster(DatabaseID dbID)
     : this(dbID, false)
 {
 }
Exemple #36
0
		public NpcScript(DatabaseID id)
			: base(id) {
			OnTouchArea = Point2D.Zero;
		}
Exemple #37
0
        private Issue GetIssue(DatabaseID context, Match match)
        {
            var   identifierName = String.Empty;
            var   dbObject       = String.Empty;
            Table table          = null;

            if (context is Schema)
            {
                var sid = context as Schema;
                identifierName = sid.SchemaName;
                dbObject       = "schema";
            }
            else if (context is Table)
            {
                var sid = context as Table;
                identifierName = sid.TableName;
                dbObject       = "table";
            }
            else if (context is Column)
            {
                var sid = context as Column;
                identifierName = sid.ColumnName;
                dbObject       = "column";
                table          = sid.Table;
            }
            else if (context is PrimaryKey)
            {
                var sid = context as PrimaryKey;
                identifierName = sid.PrimaryKeyName;
                dbObject       = "primary-key";
                table          = sid.Table;
            }
            else if (context is ForeignKey)
            {
                var sid = context as ForeignKey;
                identifierName = sid.ForeignKeyName;
                dbObject       = "foreign-key";
            }
            else if (context is Index)
            {
                var sid = context as Index;
                identifierName = sid.IndexName;
                dbObject       = "index";
                table          = sid.Table;
            }
            var issue = new Issue(this, this.DefaultSeverity.Value);

            issue.Context = IssueContext.Create(context);
            issue.Name    = "Use of Special Character in Identifier";

            if (table != null)
            {
                issue.Description = new Description("The special character '{0}' is used in the {2} name: '{3}' in table in table '{1}'", match.Value, table, dbObject, identifierName);
            }
            else
            {
                issue.Description = new Description("The special character '{0}' is used in the {1} name: '{2}'", match.Value, dbObject, identifierName);
            }

            return(issue);
        }
Exemple #38
0
 public GuildCastleGuardian(DatabaseID id)
     : base(id)
 {
 }
Exemple #39
0
		public Monster(DatabaseID dbID, bool addToWorld)
			: base(dbID, addToWorld) {
			DamageLog = new MonsterDamageLog();
			SkillDelays = new List<uint>();
			StatusChange = new WorldObjectStatusChangeList();
			LootItem = new List<Item>();
			Regen = new WorldObjectRegenerationData(this);
		}
Exemple #40
0
		public NpcWarpScript(DatabaseID id, NpcWarpData warpData)
			: base(id) {
			WarpData = warpData;
		}
Exemple #41
0
 public Character this[DatabaseID Key] {
     get { return(mChars[Key]); }
     internal set { mChars[Key] = value; }
 }
Exemple #42
0
		public NpcWarpScript(DatabaseID id, Point2D point, Location loc)
			: this(id, new NpcWarpData(point, loc)) {
		}
Exemple #43
0
		public Character(DatabaseID dbID, bool addToWorld)
			: base(dbID, addToWorld) {
			BaseStatus = new WorldObjectStatus(this);
			BattleStatus = new WorldObjectStatus(this);
			ViewData = new WorldObjectViewData();
			StatusChange = new WorldObjectStatusChangeList();

			// TODO: i dont where eAthena initialize them realy..
			//		 they using struct, which cant be null x.x
			Regen = new WorldObjectRegenerationData(this);
			HPRegen = new StatusVariationData();
			SPRegen = new StatusVariationData();
			SRegen = new CharacterRegenerationData();
			SSRegen = new CharacterRegenerationData();
		}
 public WorldObjectUnit(DatabaseID dbID, bool addToWorld)
     : base(dbID, addToWorld)
 {
 }
Exemple #45
0
		public Skill(DatabaseID dbID, bool addToWorld)
			: base(dbID, addToWorld) {
		}
		public GuildCastleGuardian(DatabaseID id)
			: base(id) {
		}
Exemple #47
0
 public NpcWarpScript(DatabaseID id, Point2D point, Location loc)
     : this(id, new NpcWarpData(point, loc))
 {
 }
Exemple #48
0
		public WorldObjectUnit(DatabaseID dbID)
			: this(dbID, false) {
		}
Exemple #49
0
 public DatabaseContext(DatabaseID db)
 {
     this.Location = ContextLocation.Database;
     this.Database = db;
 }
Exemple #50
0
 public Skill(DatabaseID dbID, bool addToWorld)
     : base(dbID, addToWorld)
 {
 }
Exemple #51
0
 public Skill(DatabaseID dbID)
     : base(dbID)
 {
 }
Exemple #52
0
		public Character this[DatabaseID Key] {
			get { return mChars[Key]; }
			internal set { mChars[Key] = value; }
		}