예제 #1
0
        private void ListAllTypesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var file = new FileInfo(Path.GetTempFileName());

            File.WriteAllText(file.FullName, string.Join(Environment.NewLine, Activator.RepositoryLocator.CatalogueRepository.MEF.GetAllTypes().Select(t => t.FullName)));
            UsefulStuff.GetInstance().ShowFileInWindowsExplorer(file);
        }
 public override void Activate(AllPluginsNode target)
 {
     if (ItemActivator.RepositoryLocator.CatalogueRepository.MEF.DownloadDirectory.Exists)
     {
         UsefulStuff.GetInstance().ShowFolderInWindowsExplorer(ItemActivator.RepositoryLocator.CatalogueRepository.MEF.DownloadDirectory);
     }
 }
        public override void Execute()
        {
            DataTable dt = new DataTable();

            var db     = SelectOne(_loggingServers);
            var server = db.Discover(DataAccessContext.DataLoad).Server;

            if (db != null)
            {
                using (var con = server.GetConnection())
                {
                    con.Open();

                    string sql = String.Format(@"SELECT * FROM (
SELECT [dataLoadRunID]
	  ,eventType
      ,[description]
      ,[source]
      ,[time]
      ,[ID]
  FROM {0}
  {2}
UNION
SELECT [dataLoadRunID]
	  ,'OnError'
      ,[description]
      ,[source]
      ,[time]
      ,[ID]
  FROM {1}
  {2}
 ) as x
order by time ASC", LoggingTables.ProgressLog, LoggingTables.FatalError, _filter.GetWhereSql());

                    DbCommand     cmd = server.GetCommand(sql, con);
                    DbDataAdapter da  = server.GetDataAdapter(cmd);
                    da.Fill(dt);
                    StringBuilder        sb          = new StringBuilder();
                    IEnumerable <string> columnNames = dt.Columns.Cast <DataColumn>().
                                                       Select(column => column.ColumnName);
                    sb.AppendLine(string.Join(",", columnNames));

                    foreach (DataRow row in dt.Rows)
                    {
                        IEnumerable <string> fields = row.ItemArray.Select(field =>
                                                                           string.Concat("\"", field.ToString().Replace("\"", "\"\""), "\""));
                        sb.AppendLine(string.Join(",", fields));
                    }

                    var outputfile = Path.GetTempFileName() + ".csv";

                    File.WriteAllText(outputfile, sb.ToString());
                    UsefulStuff.GetInstance().ShowFileInWindowsExplorer(new FileInfo(outputfile));
                }
            }
        }
예제 #4
0
        private void btnGenerate_Click(object sender, EventArgs e)
        {
            var uis = pDatasets.Controls.OfType <DataGeneratorUI>().Where(ui => ui.Generate).ToArray();

            if (!uis.Any())
            {
                MessageBox.Show("At least one dataset must be selected");
                return;
            }

            try
            {
                if (started)
                {
                    MessageBox.Show("Generation already in progress");
                    return;
                }

                started = true;


                var r = _seed.HasValue ? new Random(_seed.Value):new Random();


                var identifiers = new PersonCollection();
                identifiers.GeneratePeople(populationSize, r);

                if (cbLookups.Checked)
                {
                    DataGenerator.WriteLookups(_extractDirectory);
                }

                //run them at the same time
                if (!_seed.HasValue)
                {
                    foreach (DataGeneratorUI ui in uis)
                    {
                        Executing.Add(ui);
                        ui.BeginGeneration(identifiers, _extractDirectory);
                        DataGeneratorUI ui1 = ui;
                        ui.Completed += () => { Executing.Remove(ui1); AnnounceIfComplete(); };
                    }
                }
                else
                {
                    Queue <DataGeneratorUI> queue = new Queue <DataGeneratorUI>(uis);
                    Execute(identifiers, queue, queue.Dequeue(), r);
                }

                UsefulStuff.GetInstance().ShowFolderInWindowsExplorer(_extractDirectory);
            }
            catch (Exception exception)
            {
                ExceptionViewer.Show(exception);
            }
        }
예제 #5
0
        private void lvDatasets_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            var item = (OLVListItem)tlvDatasets.HitTest(e.Location).Item;


            if (item == null)
            {
                return;
            }

            var doc = item.RowObject as SupportingDocument;

            if (doc != null)
            {
                try
                {
                    UsefulStuff.GetInstance().ShowFileInWindowsExplorer(doc.GetFileName());
                }
                catch (Exception ex)
                {
                    ExceptionViewer.Show(ex);
                }
            }

            var sql = item.RowObject as SupportingSQLTable;

            if (sql != null)
            {
                try
                {
                    if (sql.ExternalDatabaseServer_ID == null)
                    {
                        throw new NotSupportedException("There is no known server for SupportingSql " + sql);
                    }

                    var server            = sql.ExternalDatabaseServer;
                    DataTableViewerUI dtv = new DataTableViewerUI(server, sql.SQL, sql.Name);
                    dtv.Show();
                }
                catch (Exception ex)
                {
                    ExceptionViewer.Show(ex);
                }
            }


            //User double clicks a lookup table
            var lookup = item.RowObject as BundledLookupTable;

            if (lookup != null)
            {
                ViewSQLAndResultsWithDataGridUI f = new ViewSQLAndResultsWithDataGridUI();
                f.SetCollection(null, new ViewTableInfoExtractUICollection(lookup.TableInfo, ViewType.TOP_100));
                f.Show();
            }
        }
예제 #6
0
 private void openExeDirectoryToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         UsefulStuff.GetInstance().ShowFolderInWindowsExplorer(UsefulStuff.GetExecutableDirectory());
     }
     catch (Exception exception)
     {
         ExceptionViewer.Show(exception);
     }
 }
예제 #7
0
 private void openExeDirectoryToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         UsefulStuff.GetInstance().ShowFolderInWindowsExplorer(new DirectoryInfo(Environment.CurrentDirectory));
     }
     catch (Exception exception)
     {
         ExceptionViewer.Show(exception);
     }
 }
 private void btnShowDirectory_Click(object sender, EventArgs e)
 {
     try
     {
         UsefulStuff.GetInstance().ShowFileInWindowsExplorer(new FileInfo(tbCertificate.Text));
     }
     catch (Exception exception)
     {
         ExceptionViewer.Show(exception);
     }
 }
예제 #9
0
        private void btnShowDirectory_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(tbExtractionDirectory.Text))
            {
                return;
            }

            DirectoryInfo d = new DirectoryInfo(tbExtractionDirectory.Text);

            UsefulStuff.GetInstance().ShowFolderInWindowsExplorer(d);
        }
예제 #10
0
 private void btnOpenContainingFolder_Click(object sender, EventArgs e)
 {
     try
     {
         UsefulStuff.GetInstance().ShowFileInWindowsExplorer(new FileInfo(tbPath.Text));
     }
     catch (Exception exception)
     {
         ExceptionViewer.Show(exception);
     }
 }
예제 #11
0
        public override void Execute()
        {
            base.Execute();

            if (_file != null)
            {
                UsefulStuff.GetInstance().ShowFileInWindowsExplorer(_file);
            }

            if (_dir != null)
            {
                UsefulStuff.GetInstance().ShowFolderInWindowsExplorer(_dir);
            }
        }
예제 #12
0
 private void btnShowExtractionDirectory_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(tbExtractionDirectory.Text))
     {
         try
         {
             UsefulStuff.GetInstance().ShowFolderInWindowsExplorer(new DirectoryInfo(tbExtractionDirectory.Text));
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
 }
예제 #13
0
 private void btnOpen_Click(object sender, EventArgs e)
 {
     if (_supportingDocument != null)
     {
         try
         {
             UsefulStuff.GetInstance().ShowFileInWindowsExplorer(_supportingDocument.GetFileName());
         }
         catch (Exception ex)
         {
             MessageBox.Show("unable to open file:" + ex.Message);
         }
     }
 }
        private void lbPastedColumns_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.V && e.Control)
            {
                lbPastedColumns.Items.AddRange(
                    UsefulStuff.GetInstance().GetArrayOfColumnNamesFromStringPastedInByUser(Clipboard.GetText()).ToArray());

                UpdateFilter();
            }

            if (e.KeyCode == Keys.Delete && lbPastedColumns.SelectedItem != null)
            {
                lbPastedColumns.Items.Remove(lbPastedColumns.SelectedItem);
                UpdateFilter();
            }
        }
예제 #15
0
        protected override void OnClick(EventArgs e)
        {
            base.OnClick(e);

            if (!string.IsNullOrWhiteSpace(Text))
            {
                try
                {
                    UsefulStuff.GetInstance().ShowFolderInWindowsExplorer(new DirectoryInfo(Text));
                }
                catch (Exception exception)
                {
                    ExceptionViewer.Show(exception);
                }
            }
        }
예제 #16
0
        protected DirectoryInfo GetUniqueDirectoryFrom(List <DirectoryInfo> directoryInfos)
        {
            if (!directoryInfos.Any())
            {
                return(null);
            }

            DirectoryInfo first = directoryInfos.First();

            foreach (DirectoryInfo directoryInfo in directoryInfos)
            {
                ConfirmValidityOfGlobalsOrCustomDataDirectory(directoryInfo);                         //check there are no polution in globals directories
                UsefulStuff.GetInstance().ConfirmContentsOfDirectoryAreTheSame(first, directoryInfo); //this checks first against first then first against second, then first against third etc
            }

            return(first);
        }
예제 #17
0
        private void PasteClipboardAsNewCatalogueItems(Catalogue c)
        {
            string[] toImport = UsefulStuff.GetInstance().GetArrayOfColumnNamesFromStringPastedInByUser(Clipboard.GetText()).ToArray();

            if (toImport.Any())
            {
                if (MessageBox.Show("Add " + toImport.Length + " new CatalogueItems into Catalogue " + c.Name + "?", "Paste In New Columns?", MessageBoxButtons.OKCancel) == DialogResult.OK)
                {
                    foreach (string name in toImport)
                    {
                        new CatalogueItem(RepositoryLocator.CatalogueRepository, c, name);
                    }

                    Publish(c);
                }
            }
        }
예제 #18
0
        private void ClipboardClick(object sender, EventArgs e)
        {
            if (sender == miClipboardWord)
            {
                string s = UsefulStuff.GetInstance().DataTableToHtmlDataTable(_dt);

                var formatted = UsefulStuff.GetInstance().GetClipboardFormatedHtmlStringFromHtmlString(s);

                Clipboard.SetText(formatted, TextDataFormat.Html);
            }

            if (sender == miClipboardCsv)
            {
                string s = UsefulStuff.GetInstance().DataTableToCsv(_dt);
                Clipboard.SetText(s);
            }
        }
        public override void Execute()
        {
            base.Execute();

            if (_cmd.IsSingleObject)
            {
                //Extract a single object (to file)
                if (_cmd.TargetFileInfo == null)
                {
                    var sfd = new SaveFileDialog();
                    sfd.Filter   = "Share Definition|*.sd";
                    sfd.FileName = _toExport.Single() + ".sd";
                    if (sfd.ShowDialog() == DialogResult.OK)
                    {
                        _cmd.TargetFileInfo = new FileInfo(sfd.FileName);
                    }
                    else
                    {
                        return;
                    }
                }
            }
            else
            {
                if (_cmd.TargetDirectoryInfo == null)
                {
                    var fb = new FolderBrowserDialog();
                    if (fb.ShowDialog() == DialogResult.OK)
                    {
                        _cmd.TargetDirectoryInfo = new DirectoryInfo(fb.SelectedPath);
                    }
                    else
                    {
                        return;
                    }
                }
            }

            _cmd.Execute();

            if (ShowInExplorer && _cmd.TargetDirectoryInfo != null)
            {
                UsefulStuff.GetInstance().ShowFolderInWindowsExplorer(_cmd.TargetDirectoryInfo);
            }
        }
예제 #20
0
        private void MiSaveImagesClick(object sender, EventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog();

            sfd.FileName = "Chart.jpg";
            sfd.Filter   = "Jpeg|*.jpg";
            if (sfd.ShowDialog() == DialogResult.OK)
            {
                chart1.SaveImage(sfd.FileName, ChartImageFormat.Jpeg);

                if (heatmapUI.HasDataTable())
                {
                    var    directory   = Path.GetDirectoryName(sfd.FileName);
                    var    filename    = Path.GetFileNameWithoutExtension(sfd.FileName) + "_HeatMap.jpg";
                    string heatmapPath = Path.Combine(directory, filename);

                    heatmapUI.SaveImage(heatmapPath, ImageFormat.Jpeg);
                }

                UsefulStuff.GetInstance().ShowFileInWindowsExplorer(new FileInfo(sfd.FileName));
            }
        }
예제 #21
0
        protected virtual DirectoryInfo PrepareSourceGlobalFolder()
        {
            var globalDirectoriesFound = new List <DirectoryInfo>();

            foreach (KeyValuePair <IExtractionConfiguration, List <ReleasePotential> > releasePotentials in _releaseData.ConfigurationsForRelease)
            {
                globalDirectoriesFound.AddRange(GetAllGlobalFolders(releasePotentials));
            }

            if (globalDirectoriesFound.Any())
            {
                var firstGlobal = globalDirectoriesFound.First();

                foreach (var directoryInfo in globalDirectoriesFound.Distinct(new DirectoryInfoComparer()))
                {
                    UsefulStuff.GetInstance().ConfirmContentsOfDirectoryAreTheSame(firstGlobal, directoryInfo);
                }

                return(firstGlobal);
            }

            return(null);
        }
예제 #22
0
        private void lbDesiredOrder_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Delete)
            {
                lock (oDrawLock)
                {
                    if (lbDesiredOrder.SelectedItem != null)
                    {
                        lbDesiredOrder.Items.Remove(lbDesiredOrder.SelectedItem);
                    }

                    RecomputeOrderAndHighlight();
                }
            }
            else
            if (e.KeyCode == Keys.V && e.Control)
            {
                lock (oDrawLock)
                {
                    lbDesiredOrder.Items.AddRange(UsefulStuff.GetInstance().GetArrayOfColumnNamesFromStringPastedInByUser(Clipboard.GetText()).ToArray());
                    RecomputeOrderAndHighlight();
                }
            }
        }
예제 #23
0
        public override void Execute()
        {
            base.Execute();

            if (IsSingleObject)
            {
                //Extract a single object (to file)
                if (TargetFileInfo == null && BasicActivator.IsInteractive)
                {
                    TargetFileInfo = BasicActivator.SelectFile("Path to output share definition to", "Share Definition", "*.sd");

                    if (TargetFileInfo == null)
                    {
                        return;
                    }
                }
            }
            else
            {
                if (TargetDirectoryInfo == null && BasicActivator.IsInteractive)
                {
                    TargetDirectoryInfo = BasicActivator.SelectDirectory("Output Directory");

                    if (TargetDirectoryInfo == null)
                    {
                        return;
                    }
                }
            }

            if (TargetFileInfo != null && IsSingleObject)
            {
                var d = _gatherer.GatherDependencies(_toExport[0]);

                var    shareDefinitions = d.ToShareDefinitionWithChildren(_shareManager);
                string serial           = JsonConvertExtensions.SerializeObject(shareDefinitions, _repositoryLocator);
                File.WriteAllText(TargetFileInfo.FullName, serial);

                return;
            }

            if (TargetDirectoryInfo == null)
            {
                throw new Exception("No output directory set");
            }

            foreach (var o in _toExport)
            {
                var d        = _gatherer.GatherDependencies(o);
                var filename = QuerySyntaxHelper.MakeHeaderNameSensible(o.ToString()) + ".sd";

                var    shareDefinitions = d.ToShareDefinitionWithChildren(_shareManager);
                string serial           = JsonConvertExtensions.SerializeObject(shareDefinitions, _repositoryLocator);
                var    f = Path.Combine(TargetDirectoryInfo.FullName, filename);
                File.WriteAllText(f, serial);
            }


            if (ShowInExplorer && TargetDirectoryInfo != null)
            {
                UsefulStuff.GetInstance().ShowFolderInWindowsExplorer(TargetDirectoryInfo);
            }
        }
예제 #24
0
 /// <summary>
 /// Opens windows explorer to show the file
 /// </summary>
 /// <param name="fileInfo"></param>
 protected void ShowFile(FileInfo fileInfo)
 {
     UsefulStuff.GetInstance().ShowFileInWindowsExplorer(fileInfo);
 }