/// <summary> /// /// </summary> /// <param name="obj">filename , datafile</param> public void Start(Object obj) { WorkArgs args = (WorkArgs)obj; dbpath = (string)(args.KeyPairArgs["filename"]); sitefile = (string)(args.KeyPairArgs["Sitefile"]); offerfile = (string)(args.KeyPairArgs["Offerfile"]); LegacyDatabaseDef db = new LegacyDatabaseDef(dbpath); SyncDB sync = new SyncDB(db, log); try { sync.ImportSites(new string[] { sitefile }, new VTable_Site(db.ReadChangesFrom())); sync.ImportSiteOffers(new string[] { offerfile }, new VTable_Offer_Details(db.ReadChangesFrom())); } catch (Exception ex) { log.Add(ex); } finally { if (OnLogGenerated != null) { OnLogGenerated(this, new LogEventArgs(log.ToArray())); } if (OnRptGenerated != null) { OnRptGenerated(this, new RptEventArgs("Database Import Complete")); } } }
/// <summary> /// Creates a SyncPkt on the serverside. /// </summary> /// <param name="syncDB">SyncDB to sync from.</param> /// <param name="syncBases">The ID's of the SyncBases to sync.</param> /// <param name="checksummedSyncBases"></param> /// <param name="checksums"></param> /// <param name="syncPacketID">ID of the sync packet itself.</param> public SyncPkt(SyncDB syncDB, int[] syncBases, int[] checksummedSyncBases, int[] checksums, int syncPacketID, double timestamp) { SyncPacketID = syncPacketID; SyncDB = syncDB; SyncedSyncBases = syncBases; ChecksummedSyncBases = checksummedSyncBases; Checksums = checksums; Timestamp = timestamp; }
private void importFrom1C() { var clock = new Stopwatch(); var toDatabase = new SqlConnection(_sqlConnectionString).Database; var isSuccessfull = false; string syncType; var syncLog = new SyncLog() { ID = Guid.NewGuid(), From = _pathDB, To = toDatabase }; adaptor1C = new comClient1Cv77Adatpor(_userName, _password, _pathDB); if (adaptor1C.Login()) { syncLog.Timestamp = DateTime.Now; clock.Start(); if (Config.SyncDatabases.lastDays.HasValue) { syncType = "Particular"; ParticularImportDataFrom1Cv77 data = new ParticularImportDataFrom1Cv77(adaptor1C, adaptorSql); if (data.Sync()) { isSuccessfull = true; Logger.logger.Info(string.Format("Particular Sync OK 1C to MSSQL {0} ", _pathDB)); } } else { syncType = "Full"; ImportSchemaFrom1Cv77 schema = new ImportSchemaFrom1Cv77(adaptor1C, adaptorSql); if (schema.Sync()) { ImportDataFrom1Cv77 data = new ImportDataFrom1Cv77(adaptor1C, adaptorSql); if (data.Sync()) { isSuccessfull = true; Logger.logger.Info(string.Format("Full Sync OK 1C to MSSQL {0} ", _pathDB)); } } } clock.Stop(); syncLog.Description = string.Format("{0} Sync from 1C ({1}) to MSSQL(Database={2})", syncType, _pathDB, toDatabase); syncLog.IsSuccessfull = isSuccessfull; syncLog.DurationInSec = clock.ElapsedMilliseconds / 1000; SyncDB.InsertSyncLog(syncLog); } }
public void Pull() { if (m_playerMobile == null || m_playerMobile.NetState == null) { return; } if (!(SyncDB.PullEmail(((Account)m_playerMobile.Account).Username))) { m_playerMobile.CloseGump(typeof(emailgump)); m_playerMobile.SendGump(new emailgump()); } EmailSystem.RemoveEmailCommunicator(this); }
public void Push() { if (m_playerMobile == null || m_playerMobile.NetState == null) { return; } if (SyncDB.PushEmail(((Account)m_playerMobile.Account).Username, m_email)) { m_playerMobile.SendMessage("Your email address has been successfully set."); } else { m_playerMobile.SendMessage("There has been a problem setting your email address."); } EmailSystem.RemoveEmailCommunicator(this); }
public void Start(Object obj) { WorkArgs args = (WorkArgs)obj; filename = (string)(args.KeyPairArgs["filename"]); exportto = (string)(args.KeyPairArgs["dest"]); LegacyDatabaseDef db = new LegacyDatabaseDef(filename); SyncDB sync = new SyncDB(db, log); try { sync.ExportLandDB(exportto); } catch (Exception ex) { log.Add(ex); } finally { if (OnLogGenerated != null) { OnLogGenerated(this, new LogEventArgs(log.ToArray())); } if (OnRptGenerated != null) { OnRptGenerated(this, new RptEventArgs("Database Export Complete")); } } }
/// <summary> /// Creates the SyncHandler with SyncDB. /// </summary> /// <param name="syncDB"></param> public SyncHandler(SyncDB syncDB) { SyncDB = syncDB; }
/// <summary> /// Creates SyncPkt for deserializing. /// </summary> /// <param name="syncDB">SyncBase to sync to.</param> public SyncPkt(SyncDB syncDB) { SyncDB = syncDB; ChecksummedSyncBases = new int[0]; Checksums = new int[0]; }
private void Start() { Database = GetComponent <SyncDB>(); }
public static void EventSink_GameLogin(GameLoginEventArgs e) { if (!IPLimiter.SocketBlock && !IPLimiter.Verify(e.State.Address)) { e.Accepted = false; Console.WriteLine("Login: {0}: Past IP limit threshold", e.State); using (StreamWriter op = new StreamWriter("ipLimits.log", true)) op.WriteLine("{0}\tPast IP limit threshold\t{1}", e.State, DateTime.Now); return; } string un = e.Username; string pw = e.Password; //Account acct = Accounts.GetAccount( un ) as Account; /*** BEGIN ADDED CODE ***/ SyncDB.PullAccount(un); Account acct = Accounts.GetAccount(un) as Account; /* * if (acct == null) { * Console.WriteLine("pulling {0}", un); * System.Reflection.Assembly[] assemblies = System.AppDomain.CurrentDomain.GetAssemblies(); * foreach (System.Reflection.Assembly assembly in assemblies) { * try { * Type syncdb = assembly.GetType("Server.Accounting.SyncDB"); * if (syncdb != null) { * Console.WriteLine("found type SyncDB {0} in {1}", syncdb, assembly); * syncdb.InvokeMember("PullAccount", * System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public, * null, * null, * new Object[]{ un }); * Console.WriteLine("after PullAccount"); * break; * } * } catch (Exception ex) { * Console.WriteLine("during PullAccount: {0}", ex); * } * } * * acct = Accounts.GetAccount( un ) as Account; * } */ /*** END ADDED CODE ***/ if (acct == null) { e.Accepted = false; } else if (!acct.HasAccess(e.State)) { Console.WriteLine("Login: {0}: Access denied for '{1}'", e.State, un); e.Accepted = false; } else if (!acct.CheckPassword(pw)) { Console.WriteLine("Login: {0}: Invalid password for '{1}'", e.State, un); e.Accepted = false; } else if (acct.Banned) { Console.WriteLine("Login: {0}: Banned account '{1}'", e.State, un); e.Accepted = false; } else { acct.LogAccess(e.State); Console.WriteLine("Login: {0}: Account '{1}' at character list", e.State, un); e.State.Account = acct; e.Accepted = true; e.CityInfo = StartingCities; } if (!e.Accepted) { AccountAttackLimiter.RegisterInvalidAccess(e.State); } }