Пример #1
0
        private void btnCopySelfConstraints_Click(object sender, EventArgs e)
        {
            clearWorker();

            List <string> tableNames = new List <string>();

            foreach (ListViewItem lvi in lvTablesTo.CheckedItems)
            {
                tableNames.Add(lvi.Text);
            }


            Creator c = Creator.GetInstance(new DataConnectionSpec {
                ConnectionString = txtConnectionStringTo.Text, ProviderName = getToProviderName(), CommandTimeout = COMMAND_TIMEOUT
            });
            string src = txtSourceFolder.Text;

            backgroundWorker1.ProgressChanged += new ProgressChangedEventHandler(backgroundWorker1_ProgressChanged);
            backgroundWorker1.DoWork          += new DoWorkEventHandler(delegate(object sender2, DoWorkEventArgs evt2) {
                _timer                  = new HighPrecisionTimer("timer", true);
                c.OnProgress           += new ProgressEventHandler(c_OnProgress);
                List <TableInfo> tables = c.LoadTableInfo(txtSourceFolder.Text, tableNames);
                c.CreateConstraints(tables, false, true);
            });
            backgroundWorker1.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorker1_RunWorkerCompleted);
            backgroundWorker1.RunWorkerAsync();
        }
Пример #2
0
        private void btnPreviewFrom_Click(object sender, EventArgs e)
        {
            clearWorker();

            List <string> tableNames = new List <string>();

            for (int i = 0; i < lvFromTables.Items.Count; i++)
            {
                ListViewItem lvi = lvFromTables.Items[i];
                if (lvi.Checked)
                {
                    tableNames.Add(lvi.Text);
                }
            }


            string schemaName = txtFromDatabaseOwner.Text;

            backgroundWorker1.ProgressChanged += new ProgressChangedEventHandler(backgroundWorker1_ProgressChanged);
            backgroundWorker1.DoWork          += new DoWorkEventHandler(delegate(object sender2, DoWorkEventArgs evt) {
                _timer    = new HighPrecisionTimer("timer", true);
                Creator c = Creator.GetInstance(new DataConnectionSpec {
                    ConnectionString = cboConnectionStringFrom.Text, ProviderName = getFromProviderName(), CommandTimeout = COMMAND_TIMEOUT
                });
                c.OnProgress += new ProgressEventHandler(c_OnProgress);
                backgroundWorker1.ReportProgress(0, new ProgressEventArgs("Getting list of tables...", 0, 0));
                List <TableInfo> tables = c.LoadTableInfo(schemaName, tableNames, false);
                string schema           = c.ScriptTables(tables);
                backgroundWorker1.ReportProgress(0, new ProgressEventArgs("SCHEMA:" + schema, 0, 0));
            });
            backgroundWorker1.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorker1_RunWorkerCompleted);
            backgroundWorker1.RunWorkerAsync();
        }
        public static unsafe void TestRepositoryDictionnary()
        {
            Dictionary <VOId, IntPtr> rep   = new Dictionary <VOId, IntPtr>();
            HighPrecisionTimer        timer = new HighPrecisionTimer();
            int n = 0;

            Console.WriteLine("Start...");
            ulong      ids = 1;
            MyClasse_B B   = new MyClasse_B();

            B.Name = "Is it ok ?";
            timer.Start();
            do
            {
                ids++;
                B.Id = ids;
                rep.Add(B.Id, (IntPtr)B.Data);
                n++;
                if (timer.Milliseconds > 1000)
                {
                    Console.WriteLine("Iterations : " + n);
                    break;
                }
            } while (true);
            Console.WriteLine("*********************************** !");
            timer.Stop();
        }
Пример #4
0
        public void Stop()
        {
            try
            {
                if (_stopped)
                {
                    return;
                }

                _stopped = true;

                //Log.Info("Shutting down...");
                Session?.Close();

                var timer = _tickerHighPrecisionTimer;
                _tickerHighPrecisionTimer = null;
                timer?.Dispose();

                var listener = _listener;
                if (listener == null)
                {
                    return;
                }

                _listener = null;
                listener.Close();
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }
Пример #5
0
        protected override void OnEnable()
        {
            Context.PluginManager.LoadCommands(new MiscCommands());
            Context.PluginManager.LoadCommands(new SelectionCommands());
            Context.PluginManager.LoadCommands(new RegionCommands());
            Context.PluginManager.LoadCommands(new HistoryCommands());
            Context.PluginManager.LoadCommands(new ClipboardCommands());
            Context.PluginManager.LoadCommands(new BrushCommands());
            Context.PluginManager.LoadCommands(new SchematicsCommands());

            ItemFactory.CustomItemFactory = new BuilderBaseItemFactory();

            var server = Context.Server;

            server.LevelManager.LevelCreated += (sender, args) =>
            {
                Level level = args.Level;

                //level.BlockBreak += LevelOnBlockBreak;
                //level.BlockPlace += LevelOnBlockPlace;
            };

            server.PlayerFactory.PlayerCreated += (sender, args) =>
            {
                Player player = args.Player;
                player.PlayerJoin  += OnPlayerJoin;
                player.PlayerLeave += OnPlayerLeave;
            };


            var tickTimer = new HighPrecisionTimer(50, LevelTick);
        }
Пример #6
0
        /// <summary>
        /// Reads all nodes at the current depth, and their children, from the input stream
        /// </summary>
        /// <param name="xtr">Input stream to read from</param>
        /// <returns>True always</returns>
        public override bool Deserialize(XmlTextReader xtr)
        {
#if TRACK_TIME
            using (HighPrecisionTimer tmr = new HighPrecisionTimer("Nodes.Deserialize", true)){
#endif
            // spin until we hit a begin element or end element
            // move to next node
            while (xtr.NodeType != XmlNodeType.Element && xtr.NodeType != XmlNodeType.EndElement)
            {
                xtr.Read();
            }

            int depth = xtr.Depth;
            // if we're on an element, spin until we're out of elements at this same depth
            while (depth == xtr.Depth && xtr.NodeType == XmlNodeType.Element)
            {
                Node gn = new Node();
                gn.Deserialize(xtr);
                Add(gn);

                // ignore any whitespace
                while (xtr.NodeType == XmlNodeType.Whitespace)
                {
                    xtr.Read();
                }
            }
            return(true);

#if TRACK_TIME
        }
#endif
        }
Пример #7
0
        public string CopyDataFromFiles(string inputDirectory, List <TableInfo> allTables, bool dryRun, bool onlyRequiredData)
        {
            using (HighPrecisionTimer hptImport = new HighPrecisionTimer("import", true)) {
                if (onlyRequiredData)
                {
                    var tn = this.TableName.ToLower();
                    // %CABEXE% n %GG%\gringlobal.database.setup\system_data.cab %RAWDATA%\sys_*.* + %RAWDATA%\cooperator*.* + %RAWDATA%\app_*.* + %RAWDATA%\web_user.* + %RAWDATA%\web_user_preference.* + %RAWDATA%\web_cooperator.* + %RAWDATA%\site.* + %RAWDATA%\region*.* + %RAWDATA%\geo*.* + %RAWDATA%\code*.*

                    if (tn.StartsWith("sys_") ||
                        tn.StartsWith("cooperator") ||
                        tn == "app_resource" ||
                        tn == "app_setting" ||
                        tn == "web_user" ||
                        tn == "web_user_preference" ||
                        tn.StartsWith("web_cooperator") ||
                        tn == "site" ||
                        tn.StartsWith("region") ||
                        tn.StartsWith("geo") ||
                        tn.StartsWith("code"))
                    {
                        // this is a system-required table, ok to include
                    }
                    else
                    {
                        // not required, exclude.
                        return("");
                    }
                }

                var output = bulkLoad(inputDirectory, allTables, dryRun);
                showProgress(getDisplayMember("CopyDataFromFiles{total}", "Total import time for {0}: {1}", TableName, Toolkit.FormatTimeElapsed(((int)hptImport.Stop()) / 1000)), 0, 0);
                return(output);
            }
        }
Пример #8
0
        public void Initialize()
        {
            //IsWorldTimeStarted = false;
            _worldProvider.Initialize();

            SpawnPoint       = SpawnPoint ?? new PlayerLocation(_worldProvider.GetSpawnPoint());
            CurrentWorldTime = _worldProvider.GetTime();

            if (_worldProvider.IsCaching)
            {
                Stopwatch chunkLoading = new Stopwatch();
                chunkLoading.Start();
                // Pre-cache chunks for spawn coordinates
                int i = 0;
                foreach (var chunk in GenerateChunks(new ChunkCoordinates(SpawnPoint), new Dictionary <Tuple <int, int>, McpeBatch>(), ViewDistance))
                {
                    if (chunk != null)
                    {
                        i++;
                    }
                }
                Log.InfoFormat("World pre-cache {0} chunks completed in {1}ms", i, chunkLoading.ElapsedMilliseconds);
            }

            if (Config.GetProperty("CheckForSafeSpawn", false))
            {
                var chunk = _worldProvider.GenerateChunkColumn(new ChunkCoordinates(SpawnPoint));
                chunk.RecalcHeight();

                var height = GetHeight((BlockCoordinates)SpawnPoint);
                if (height > SpawnPoint.Y)
                {
                    SpawnPoint.Y = height + 2;
                }
                Log.Debug("Checking for safe spawn");
            }

            StartTimeInTicks = DateTime.UtcNow.Ticks;

            _tickTimer = new Stopwatch();
            _tickTimer.Restart();
            //_levelTicker = new Timer(WorldTick, null, 50, _worldTickTime); // MC worlds tick-time


            //_tickerThread = new Thread(RunWorldTick);
            //_tickerThread.Priority = ThreadPriority.Highest;
            //_tickerThread.IsBackground = true;
            //_tickerThread.Start();
            //_tickerThreadTimer.Start();

            _tickerHighPrecisionTimer = new HighPrecisionTimer(50, WorldTick);
            //_mmTickTimer = new MultiMediaTimer();
            //_mmTickTimer.Mode = TimerMode.Periodic;
            //_mmTickTimer.Period = 50;
            //_mmTickTimer.Resolution = 1;
            //_mmTickTimer.SynchronizingObject = null;
            //_mmTickTimer.Tick += WorldTick;
            //_mmTickTimer.Start();
        }
Пример #9
0
        private void btnGo_Click(object sender, EventArgs e)
        {
            // perform the search on each of the checked indexes

            try {
                this.Cursor = Cursors.WaitCursor;

                List <string> indexNames = new List <string>();
                foreach (string name in clbIndexes.CheckedItems)
                {
                    indexNames.Add(name);
                }

                StringBuilder sb    = new StringBuilder();
                int           count = 0;
                using (HighPrecisionTimer timer = new HighPrecisionTimer("timer", true)) {
                    foreach (int accessionID in performSearch(txtSearch.Text, chkIgnoreCase.Checked, chkMatchAll.Checked, indexNames, "Accessions"))
                    {
                        sb.AppendLine(accessionID.ToString());
                        count++;
                    }
                    timer.Stop();
                    txtAccessions.Text     = sb.ToString();
                    lblAccessions.Text     = "Accessions - " + count.ToString("G");
                    lblAccessionsTime.Text = "Search Time: " + timer.ElapsedMilliseconds.ToString("##,###.000") + " ms";
                }

                sb    = new StringBuilder();
                count = 0;
                using (HighPrecisionTimer timer = new HighPrecisionTimer("timer", true)) {
                    foreach (int inventoryID in performSearch(txtSearch.Text, chkIgnoreCase.Checked, chkMatchAll.Checked, indexNames, "Inventory"))
                    {
                        sb.AppendLine(inventoryID.ToString());
                        count++;
                    }
                    timer.Stop();
                    txtInventory.Text     = sb.ToString();
                    lblInventory.Text     = "Inventory - " + count.ToString("G");
                    lblInventoryTime.Text = "Search Time: " + timer.ElapsedMilliseconds.ToString("##,###.000") + " ms";
                }

                sb    = new StringBuilder();
                count = 0;
                using (HighPrecisionTimer timer = new HighPrecisionTimer("timer", true)) {
                    foreach (int orderID in performSearch(txtSearch.Text, chkIgnoreCase.Checked, chkMatchAll.Checked, indexNames, "Orders"))
                    {
                        sb.AppendLine(orderID.ToString());
                        count++;
                    }
                    txtOrders.Text     = sb.ToString();
                    lblOrders.Text     = "Orders - " + count.ToString("G");
                    lblOrdersTime.Text = "Search Time: " + timer.ElapsedMilliseconds.ToString("##,###.000") + " ms";
                }
            } catch (Exception ex) {
                MessageBox.Show(ex.Message);
            } finally {
                this.Cursor = Cursors.Default;
            }
        }
Пример #10
0
 protected GameEntry(OpenLevelManager levelManager, Type type)
 {
     LevelManager = levelManager;
     GameType     = type;
     Instances    = new ConcurrentDictionary <string, Game>();
     Ticker       = new HighPrecisionTimer(50, Tick);
     Rnd          = new FastRandom();
 }
Пример #11
0
        protected override void Initiate()
        {
            _initiated   = true;
            Client.World = World;
            World.Player.SetInventory(new BedrockInventory(46));

            CustomConnectedPong.CanPing = true;
            _gameTickTimer = new HighPrecisionTimer(50, GameTick);            // new System.Threading.Timer(GameTick, null, 50, 50);
        }
Пример #12
0
        public HighPrecisionTimerTests()
        {
            var sw    = Stopwatch.StartNew();
            var timer = new HighPrecisionTimer();

            timer.Block(ExpectedTicks);
            sw.Stop();
            _ticks = sw.ElapsedTicks;
        }
Пример #13
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="input"></param>
        public virtual void LoadXml(Stream input)
        {
#if TRACK_TIME
            using (HighPrecisionTimer tmr = new HighPrecisionTimer("Document.LoadXml(Stream input)", true)){
#endif
            load(new XmlTextReader(input));
#if TRACK_TIME
        }
#endif
        }
Пример #14
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="xml"></param>
        public virtual void LoadXml(string xml)
        {
#if TRACK_TIME
            using (HighPrecisionTimer tmr = new HighPrecisionTimer("Document.LoadXml(String xml)", true)){
#endif
            load(new XmlTextReader(new StringReader(xml)));
#if TRACK_TIME
        }
#endif
        }
Пример #15
0
        /// <summary>
        /// Writes the node to the output stream
        /// </summary>
        /// <param name="xtw">Output stream to write to</param>
        public virtual void Serialize(XmlTextWriter xtw, bool preserveWhiteSpace)
        {
#if TRACK_TIME
            using (HighPrecisionTimer tmr = new HighPrecisionTimer("Node.Serialize", true)){
#endif
            writeStartNode(xtw);
            writeEndNode(xtw, preserveWhiteSpace);
#if TRACK_TIME
        }
#endif
        }
        public static void BenchVirtualObjects()
        {
            HighPrecisionTimer timer = new HighPrecisionTimer();
            int n = 0;

            Console.WriteLine("Start...");
            ulong ids = 1;

            timer.Start();
            do
            {
                MyClasse_B B = new MyClasse_B();
                B.Id   = ids++;
                B.Name = "Gabriel is in the floers and the camps !";
                B.Name = "Veronique had a small car !";
                if (B.Name == "Ok")
                {
                    n = n * 2 / 2;
                }
                B.A = 65;
                n++;
                if (timer.Milliseconds > 1000)
                {
                    Console.WriteLine("Iterations : " + n);
                    break;
                }
            } while (true);
            Console.WriteLine("*********************************** !");
            timer.Stop();

            n = 0;
            timer.Reset(true);
            do
            {
                MyClasse_B B2 = new MyClasse_B();
                B2.Id   = ids++;
                B2.Name = "Le monde est jolie ! Le monde il est beau ! Tout le monde s'aime !";
                B2.A    = 65;
                //Repository<ulong>.Add(B2);
                n++;
                if (timer.Milliseconds > 1000)
                {
                    Console.WriteLine("Iterations : " + n);
                    break;
                }
            } while (true);
            timer.Stop();

            Console.WriteLine("Block Count : " + MemoryAllocator.BlockCount);
            Console.WriteLine("Efficiency Ratio : " + MemoryAllocator.EfficiencyRatio);
            Console.WriteLine("Segment Count : " + MemoryAllocator.SegmentCount);
            Console.WriteLine("Total Allocated Memory : " + MemoryAllocator.TotalAllocatedMemory);
        }
Пример #17
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="url"></param>
        public virtual void Load(string url)
        {
#if TRACK_TIME
            using (HighPrecisionTimer tmr = new HighPrecisionTimer("Document.Load(String url)", true)){
#endif
            FileStream fs = new FileStream(url, FileMode.OpenOrCreate);
            load(new XmlTextReader(new StreamReader(fs)));
            fs.Close();
#if TRACK_TIME
        }
#endif
        }
Пример #18
0
        public PlayerNetworkSession(MiNetServer server, Player player, IPEndPoint endPoint, short mtuSize)
        {
            State = ConnectionState.Unconnected;

            Server         = server;
            MessageHandler = player;
            EndPoint       = endPoint;
            MtuSize        = mtuSize;

            _cancellationToken        = new CancellationTokenSource();
            _tickerHighPrecisionTimer = new HighPrecisionTimer(10, SendTick, true);
        }
Пример #19
0
        /// <summary>
        /// Writes this Node to the ouput stream
        /// </summary>
        /// <param name="xtw">stream to write to</param>
        public override void Serialize(XmlTextWriter xtw, bool preserveWhiteSpace)
        {
#if TRACK_TIME
            using (HighPrecisionTimer tmr = new HighPrecisionTimer("Nodes.Serialize", true)){
#endif
            foreach (Node gn in this)
            {
                gn.Serialize(xtw, preserveWhiteSpace);
            }
#if TRACK_TIME
        }
#endif
        }
Пример #20
0
 private void background(BackgroundCallback callback)
 {
     statusText.Text      = "-";
     statusProgress.Value = 0;
     _worker = new BackgroundWorker();
     _worker.WorkerReportsProgress = true;
     _worker.DoWork             += new DoWorkEventHandler(callback);
     _worker.ProgressChanged    += new ProgressChangedEventHandler(backgroundProgress);
     _worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundDone);
     _worker.RunWorkerAsync();
     _timer = new HighPrecisionTimer("backgroundWorker", true);
     Cursor = Cursors.WaitCursor;
 }
Пример #21
0
        public void HighPrecTimerSignalingLoadTest()
        {
            List <Thread> threads = new List <Thread>();

            for (int i = 0; i < 1000; i++)
            {
                threads.Add(new Thread(Runner));
            }

            threads.ForEach(t => t.Start());

            var timer = new HighPrecisionTimer(TIME / 2, Interrupt, false);
        }
Пример #22
0
        //

        protected GameLevel(SkyCoreAPI plugin, string gameType, string gameId, String levelPath, GameLevelInfo gameLevelInfo, bool modifiable = false)
            : base(plugin.Server.LevelManager, gameId,
                   AnvilProviderFactory.GetLevelProvider(plugin.Server.LevelManager, levelPath, !modifiable, true, !modifiable),
                   plugin.Server.LevelManager.EntityManager, GameMode.Creative)
        {
            string levelName;

            {
                string[] split = levelPath.Split('\\');
                levelName = split[split.Length - 1];
            }

            LevelName = levelName;

            Plugin        = plugin;
            GameId        = gameId;
            GameType      = gameType;
            GameLevelInfo = gameLevelInfo;

            EnableBlockTicking = false;
            EnableChunkTicking = false;

            //SkyUtil.log($"Initializing world {gameId}");
            Initialize();

            SpawnPoint = GameLevelInfo.LobbyLocation;

            SetupWorldTime();

            if (!plugin.Server.LevelManager.Levels.Contains(this))
            {
                plugin.Server.LevelManager.Levels.Add(this);
            }

            InitializeTeamMap();

            CurrentState = GetInitialState();
            CurrentState.EnterState(this);

            GameLevelTickThread = new Thread(() =>
            {
                Thread.CurrentThread.IsBackground = true;

                GameLevelTick = new HighPrecisionTimer(500, PreGameTick, true);
            });
            GameLevelTickThread.Start();

            BlockBreak += HandleBlockBreak;
            BlockPlace += HandleBlockPlace;
        }
Пример #23
0
        public void Start()
        {
            if (_listener != null)
            {
                return;
            }

            _readingThread = new Thread(ReceiveCallback);

            _listener = CreateListener(_endpoint);
            _readingThread.Start();

            _tickerHighPrecisionTimer = new HighPrecisionTimer(10, SendTick, true);
        }
Пример #24
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public virtual Nodes Clone()
        {
#if TRACK_TIME
            using (HighPrecisionTimer tmr = new HighPrecisionTimer("Nodes.Clone", true)){
#endif
            Nodes gns = new Nodes();
            foreach (Node gn in this)
            {
                gns.Add(gn.Clone());
            }
            return(gns);

#if TRACK_TIME
        }
#endif
        }
Пример #25
0
	    protected GameController(SkyCoreAPI plugin, string gameName, string neatName, List<string> levelNames)
        {
            Plugin = plugin;
            
            GameName = neatName;
            RawName = gameName;
            
            foreach(var levelName in levelNames)
            {
                string fullLevelPath = $@"C:\Users\Administrator\Desktop\worlds\{gameName}\{levelName}";
	            if (!Directory.Exists(fullLevelPath))
	            {
					SkyUtil.log($"Unable to find world at ({fullLevelPath})");
				}
	            else
	            {
					LevelNames.Add(fullLevelPath);

		            SkyUtil.log($"Added world at ({fullLevelPath})");

					//Pre-load GameLevelInfo
		            GetGameLevelInfo(levelName);

					//Pre-cache the WorldProvider
		            AnvilProviderFactory.GetLevelProvider(plugin.Server.LevelManager, fullLevelPath);
	            }
            }

			if (LevelNames.Count == 0)
			{
				SkyUtil.log($"No Levels configured for {gameName}");
				return;
			}

			RedisGameIdKey = $"next_game_id_{GameName}";

	        ExternalGameHandler.RegisterInternalGame(RawName);

			GameTickThread = new Thread(() =>
	        {
		        Thread.CurrentThread.IsBackground = true;

		        GameTick = new HighPrecisionTimer(50, _CoreGameTick, true);
	        });
	        GameTickThread.Start();
		}
        public static unsafe void TestRepository()
        {
            VirtualObjectRepository <VOId> rep   = new VirtualObjectRepository <VOId>();
            HighPrecisionTimer             timer = new HighPrecisionTimer();
            int n = 0;

            Console.WriteLine("Start...");
            ulong ids = 0;
            int   cnt = 0;

            timer.Start();
            do
            {
                MyClasse_B B = new MyClasse_B();
                B.City = "Lyon : one of the beutufillest city of France !";
                B.Id   = ids++;
                rep.Add(B);
                n++;
                if (timer.Milliseconds > 10000)
                {
                    Console.WriteLine("Iterations : " + n);
                    cnt = n;
                    break;
                }
            } while (true);

            n = 0;
            Random r = new Random();

            timer.Reset(true);
            do
            {
                ids = (ulong)r.Next(cnt - 1);
                var obj = rep.Get(new VOId(ids));
                n++;
                if (timer.Milliseconds > 10000)
                {
                    Console.WriteLine("Iterations : " + n);
                    break;
                }
            } while (true);

            Console.WriteLine("*********************************** !");
            timer.Stop();
        }
Пример #27
0
        private void btnFromCsvPreviewSchema_Click(object sender, EventArgs e)
        {
            clearWorker();

            List <string> tableNames = new List <string>();

            for (int i = 0; i < lvFromCsvTableList.Items.Count; i++)
            {
                ListViewItem lvi = lvFromCsvTableList.Items[i];
                if (lvi.Checked)
                {
                    tableNames.Add(lvi.Text);
                }
            }

            string  fileName = txtCSVFromFile.Text;
            Creator c        = Creator.GetInstance(new DataConnectionSpec {
                ConnectionString = cboConnectionStringFrom.Text, ProviderName = getFromProviderName(), CommandTimeout = COMMAND_TIMEOUT
            });

            bool createMapTables = chkFromCSVCreateMapTables.Checked;

            backgroundWorker1.ProgressChanged += new ProgressChangedEventHandler(backgroundWorker1_ProgressChanged);
            backgroundWorker1.DoWork          += new DoWorkEventHandler(delegate(object sender2, DoWorkEventArgs evt) {
                _timer        = new HighPrecisionTimer("timer", true);
                c.OnProgress += new ProgressEventHandler(c_OnProgress);
                backgroundWorker1.ReportProgress(0, new ProgressEventArgs("Getting list of tables...", 0, 0));
                List <TableInfo> tables = c.LoadTableInfo(fileName, true);
                foreach (TableInfo ti in tables)
                {
                    if (tableNames.Contains(ti.TableName))
                    {
                        ti.IsSelected = true;
                    }
                }
                string schema = c.ScriptTables(tables);
                if (createMapTables)
                {
                    schema += c.ScriptMigrationTables(tables);
                }
                backgroundWorker1.ReportProgress(0, new ProgressEventArgs("SCHEMA:" + schema, 0, 0));
            });
            backgroundWorker1.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorker1_RunWorkerCompleted);
            backgroundWorker1.RunWorkerAsync();
        }
Пример #28
0
        private void btnGetTableListFrom_Click(object sender, EventArgs e)
        {
            clearWorker();
            backgroundWorker1.ProgressChanged += new ProgressChangedEventHandler(backgroundWorker1_ProgressChanged);
            Creator c = Creator.GetInstance(new DataConnectionSpec {
                ConnectionString = cboConnectionStringFrom.Text, ProviderName = getFromProviderName(), CommandTimeout = COMMAND_TIMEOUT
            });
            string schemaName = txtFromDatabaseOwner.Text;

            backgroundWorker1.DoWork += new DoWorkEventHandler(delegate(object sender2, DoWorkEventArgs evt) {
                _timer        = new HighPrecisionTimer("timer", true);
                c.OnProgress += new ProgressEventHandler(c_OnProgress);
                _tableNames   = c.ListTableNames(schemaName);
            });

            backgroundWorker1.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorker1_RunWorkerCompleted);
            backgroundWorker1.RunWorkerAsync();
        }
Пример #29
0
        /// <summary>
        /// Initializes a new instance of the <see cref="InstructionTimer"/> class.
        /// </summary>
        /// <param name="platformConfig">The platform configuration.</param>
        /// <exception cref="System.ArgumentOutOfRangeException"></exception>
        public InstructionTimer(IPlatformConfig platformConfig)
        {
            switch (platformConfig.InstructionTimingSyncMode)
            {
            case InstructionTimingSyncMode.Null:
                // Run ASAP
                _ticksPerCycle = 0;
                break;

            case InstructionTimingSyncMode.MachineCycles:
                _ticksPerCycle = 1 / platformConfig.MachineCycleFrequencyMhz * 10 / 3;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            _timer = new HighPrecisionTimer();
        }
Пример #30
0
        private void btnCopyDataFrom_Click(object sender, EventArgs e)
        {
            clearWorker();

            List <string> tableNames = new List <string>();

            for (int i = 0; i < lvFromTables.Items.Count; i++)
            {
                ListViewItem lvi = lvFromTables.Items[i];
                if (lvi.Checked)
                {
                    tableNames.Add(lvi.Text);
                }
            }

            DataConnectionSpec dcs = new DataConnectionSpec {
                ConnectionString = cboConnectionStringFrom.Text, ProviderName = getFromProviderName(), CommandTimeout = COMMAND_TIMEOUT
            };

            if (dcs.ConnectionString.Contains("Driver="))
            {
                // assume odbc
                dcs.ProviderName = "ODBC";
            }

            Creator c          = Creator.GetInstance(dcs);
            string  schemaName = txtFromDatabaseOwner.Text;
            string  dest       = txtDestinationFolder.Text;

            backgroundWorker1.ProgressChanged += new ProgressChangedEventHandler(backgroundWorker1_ProgressChanged);
            backgroundWorker1.DoWork          += new DoWorkEventHandler(delegate(object sender2, DoWorkEventArgs evt2) {
                _timer        = new HighPrecisionTimer("timer", true);
                c.OnProgress += new ProgressEventHandler(c_OnProgress);

                backgroundWorker1.ReportProgress(0, new ProgressEventArgs("Gathering schema information from database...", 0, 0));

                List <TableInfo> tables = c.LoadTableInfo(schemaName, tableNames, false);

                c.CopyDataFromDatabase(dest, schemaName, tables);
            });
            backgroundWorker1.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorker1_RunWorkerCompleted);
            backgroundWorker1.RunWorkerAsync();
        }