예제 #1
0
    private void SendScriptToTextDiff(bool isSource)
    {
      DataRowView row = _bs.Current as DataRowView;
      if (row == null)
      {
        return;
      }

      string script = row["ObjectScript"] as string;
      string caption = String.Format("{0} ({1} | {2})"
          , row["ObjectName"] as string
          , row["CreatedOn"]
          , row["CreatedBy"] as string);

      frmTextDiff diffForm = frmTextDiff.ActiveTextDiff;
      if (diffForm == null)
      {
        diffForm = TextDiffFactory.CreateDiff();
      }

      if (isSource)
      {
        diffForm.diffControl.SourceText = script;
        diffForm.diffControl.SourceHeaderText = caption;
      }
      else
      {
        diffForm.diffControl.DestText = script;
        diffForm.diffControl.DestHeaderText = caption;
      }
      diffForm.Show();
      diffForm.BringToFront();
    }
예제 #2
0
        private void TextDiffScript(bool isSource)
        {
            string script = ActiveTextArea.SelectionManager.HasSomethingSelected ? ActiveTextArea.SelectionManager.SelectedText : _textEditor.Text;


            frmTextDiff diffForm = frmTextDiff.ActiveTextDiff;

            if (diffForm == null)
            {
                diffForm = TextDiffFactory.CreateDiff();
            }

            if (isSource)
            {
                diffForm.diffControl.SourceText       = script;
                diffForm.diffControl.SourceHeaderText = Caption;
            }
            else
            {
                diffForm.diffControl.DestText       = script;
                diffForm.diffControl.DestHeaderText = Caption;
            }
            diffForm.Show();
            diffForm.BringToFront();
        }
예제 #3
0
    private void SendCurrentObjectToTextDiff(bool isSource)
    {
      if (_bs.Current == null)
      {
        return;
      }

      DataRowView rw = _bs.Current as DataRowView;
      if (rw == null)
        return;

      int objId = (int)rw.Row.ItemArray[0];
      string objType = (string)rw.Row.ItemArray[3];
      string objName = (string)rw.Row.ItemArray[2];
      
      if (DBConstants.DoesObjectTypeHasScript(objType))
      {
        int type = DBConstants.GetDBObjectType(objType);
        string script = ScriptingHelper.GetAlterScript(_connParams, _connParams.Database, objId, type);

        frmTextDiff diffForm = frmTextDiff.ActiveTextDiff;
        if (diffForm == null)
        {
          diffForm = TextDiffFactory.CreateDiff();
        }

        if (isSource)
        {
          diffForm.diffControl.SourceText = script;
          diffForm.diffControl.SourceHeaderText = objName;
        }
        else
        {
          diffForm.diffControl.DestText = script;
          diffForm.diffControl.DestHeaderText = objName;
        }
        diffForm.Show();
        diffForm.BringToFront();
      }
    }
예제 #4
0
    private void SendSelectedObjectToTextDiffEx(bool isSource)
    {
      if (grd.SelectedRows.Count == 0)
      {
        return;
      }

      int objId = -1;
      string objType = String.Empty;
      string objName = String.Empty;
      IList<frmScriptEditor> editors = new List<frmScriptEditor>();

      foreach (DataGridViewRow row in grd.SelectedRows)
      {
        DataGridViewCell cellObjid = row.Cells[0];
        DataGridViewCell cellName = row.Cells[2];
        DataGridViewCell cellType = row.Cells[3];

        if (cellName.ValueType != typeof(string) || cellName.Value == null)
        {
          continue;
        }

        if (cellType.ValueType != typeof(string) || cellType.Value == null)
        {
          continue;
        }

        if (cellObjid.ValueType != typeof(int) || cellObjid.Value == null)
        {
          continue;
        }

        objId = (int)cellObjid.Value;
        objType = (string)cellType.Value;
        objName = (string)cellName.Value;

        if (DBConstants.DoesObjectTypeHasScript(objType))
        {
          int type = DBConstants.GetDBObjectType(objType);
          string script = ScriptingHelper.GetAlterScript(_connParams, _connParams.Database, objId, type);

          frmTextDiff diffForm = frmTextDiff.ActiveTextDiff;
          if (diffForm == null)
          {
            diffForm = TextDiffFactory.CreateDiff();
          }

          if (isSource)
          {
            diffForm.diffControl.SourceText = script;
            diffForm.diffControl.SourceHeaderText = objName;
          }
          else
          {
            diffForm.diffControl.DestText = script;
            diffForm.diffControl.DestHeaderText = objName;
          }
          diffForm.Show();
          diffForm.BringToFront();
          break;
        }
      }
    }
예제 #5
0
        public void DiffFile(string caption, string sourceFileName, string destinationFileName)
        {
            frmTextDiff frm = TextDiffFactory.CreateDiffFromFile(caption, sourceFileName, destinationFileName);

            frm.Show();
        }
예제 #6
0
        public void DiffText(string caption, string source, string destination)
        {
            frmTextDiff frm = TextDiffFactory.CreateDiffFromText(caption, source, destination);

            frm.Show();
        }