public SqlGenerator(string fileName, EQStreamProcessor streamProcessor, SqlGeneratorConfiguration config, Action <string> logAction, Action <string> statusAction)
 {
     if (fileName == null)
     {
         throw new ArgumentNullException("fileName");
     }
     if (streamProcessor == null)
     {
         throw new ArgumentNullException("streamProcessor");
     }
     if (logAction == null)
     {
         throw new ArgumentNullException("logAction");
     }
     if (statusAction == null)
     {
         throw new ArgumentNullException("statusAction");
     }
     Log              = logAction;
     SetStatus        = statusAction;
     _fileName        = fileName;
     _streamProcessor = streamProcessor;
     _config          = config;
     SqlStream        = new StreamWriter(_fileName);
 }
Esempio n. 2
0
 public SqlGenerator(string fileName, EQStreamProcessor streamProcessor, SqlGeneratorConfiguration config,Action<string> logAction, Action<string> statusAction)
 {
     if (fileName == null) throw new ArgumentNullException("fileName");
     if (streamProcessor == null) throw new ArgumentNullException("streamProcessor");
     if (logAction == null) throw new ArgumentNullException("logAction");
     if (statusAction == null) throw new ArgumentNullException("statusAction");
     Log = logAction;
     SetStatus = statusAction;
     _fileName = fileName;
     _streamProcessor = streamProcessor;
     _config = config;
     SqlStream = new StreamWriter(_fileName);
 }
Esempio n. 3
0
        private void menuGenerateSQL_Click(object sender, EventArgs e)
        {
            if (_sqlForm.ShowDialog() != DialogResult.OK)
                return;
            try
            {
                var config = new SqlGeneratorConfiguration
                {
                    SpawnDBID = Convert.ToUInt32(_sqlForm.NPCTypesTextBox.Text),
                    SpawnGroupID = Convert.ToUInt32(_sqlForm.SpawnGroupTextBox.Text),
                    SpawnEntryID = Convert.ToUInt32(_sqlForm.SpawnEntryTextBox.Text),
                    Spawn2ID = Convert.ToUInt32(_sqlForm.Spawn2TextBox.Text),
                    GridDBID = Convert.ToUInt32(_sqlForm.GridTextBox.Text),
                    MerchantDBID = Convert.ToUInt32(_sqlForm.MerchantTextBox.Text),
                    DoorDBID = Convert.ToInt32(_sqlForm.DoorsTextBox.Text),
                    GroundSpawnDBID = Convert.ToUInt32(_sqlForm.GroundSpawnTextBox.Text),
                    ObjectDBID = Convert.ToUInt32(_sqlForm.ObjectTextBox.Text),
                    ZoneID = Convert.ToUInt32(_sqlForm.ZoneIDTextBox.Text),
                    SpawnNameFilter = _sqlForm.SpawnNameFilter.Text,
                    CoalesceWaypoints = _sqlForm.CoalesceWaypoints.Checked,
                    GenerateZone = _sqlForm.ZoneCheckBox.Checked,
                    GenerateZonePoint = _sqlForm.ZonePointCheckBox.Checked,
                    ZoneName = _zoneName,
                    SpawnVersion = (UInt32)_sqlForm.VersionSelector.Value,
                    GenerateDoors = _sqlForm.DoorCheckBox.Checked,
                    GenerateSpawns = _sqlForm.SpawnCheckBox.Checked,
                    GenerateGrids = _sqlForm.GridCheckBox.Checked,
                    GenerateMerchants = _sqlForm.MerchantCheckBox.Checked,
                    UpdateExistingNPCTypes = _sqlForm.UpdateExistingNPCTypesCheckbox.Checked,
                    UseNPCTypesTint = _sqlForm.NPCTypesTintCheckBox.Checked,
                    GenerateInvisibleMen = _sqlForm.InvisibleMenCheckBox.Checked,
                    GenerateGroundSpawns = _sqlForm.GroundSpawnCheckBox.Checked,
                    GenerateObjects = _sqlForm.ObjectCheckBox.Checked
                };

                var sqlgenerator = new SqlGenerator(_sqlForm.FileName, _processor.StreamProcessor,config,Log,SetStatus);
                sqlgenerator.GenerateSql();
            }
            catch (IOException)
            {
                Log("Unable to open file " + _sqlForm.FileName + " for writing.");
                StatusBar.Text = "Unable to open file " + _sqlForm.FileName + " for writing.";
            }
        }