Skip to content

Instantly share code, notes, and snippets.

//List<string> result = new List<string>(
// from x in config.AppSettings.Settings.AllKeys
// where x.ToLower().StartsWith("or") && x.ToLower().EndsWith("connectionstring")
// select config.AppSettings.Settings[x].Value);
this query returns all the values for the keys that start with "or" and end with "connectionstring", this part I understand.
but now I want to do the same thing but for different prefixes so I've done this:
foreach (var Prefix in Prefixes)
{
public ConnectionStringList ConnectionStrings(string Path_Config)
{
var result = new List<string>();
var MyConnectionList = new ConnectionStringList();
MyConnectionList.OrcaReorcaConnectionsList = new List<string>();
MyConnectionList.OrcaConnectionsList = new List<string>();
MyConnectionList.ReorcaConnectionsList = new List<string>();
ExeConfigurationFileMap configOld = new ExeConfigurationFileMap();
configOld.ExeConfigFilename = Path_Config;
Configuration config = ConfigurationManager.OpenMappedExeConfiguration(configOld, ConfigurationUserLevel.None);
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
public partial class Form1 : Form
{
bool VersaoValida = false;
bool cliValido = false;
bool ServiçoValido = false;
public Form1()
{
InitializeComponent();
}
Funcoes Funcoes = new Funcoes();
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
private void buttonContinuar_Click(object sender, EventArgs e)
{
int result = 0;
DialogResult Result = new DialogResult();
DialogResult status2 = new DialogResult();
try
{
if (panel1.Visible == true)
{
if (backToConfig == true)
private void buttonExecScript_Click(object sender, EventArgs e)
{
var ConnectionStrings = new List<string>();
if (buttonExecScript.Text == "Terminar Update")
{
DialogResult Result = new DialogResult();
Result = MessageBox.Show(@"Deseja terminar o assistente de update do Orca ++ ?",
@"Assitente de Update Orca ++", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
if(Result == DialogResult.Yes)
This is my function, it returns a struct with the number of successful commands, the number of the ones with errors and also the total
of both and also the file path from wich they are being exectued.
public void ExecuteCommands(string Directories, CdpsiUpdateSql Updater, CdpsiUpdateSqlparser parser, string Log, IProgress<Result> progress)
{
Result FinalResult = new Result();
int totalWithErrors = 0;
int totalSuccess = 0;
string[] numArray1 = new string[3];
List<string> list = ((IEnumerable<string>)Directory.GetFiles(Directories, "*.sql", SearchOption.TopDirectoryOnly)).Select(f =>
public void ExecuteCommands(string Directoria, CdpsiUpdateSql Updater, CdpsiUpdateSqlparser parser, string Log, IProgress<Result> progress)
{
string[] numArray1 = new string[3];
List<string> list = ((IEnumerable<string>)Directory.GetFiles(Directoria, "*.sql", SearchOption.TopDirectoryOnly)).Select(f =>
{
string[] strArray = Path.GetFileName(f).Split('_');
int result;
if (strArray.Length < 1 || !int.TryParse(strArray[0], out result))
result = -1;
This is my function, I need to return the struct at every foreach iteration.
public void ExecuteCommands(string Directoria, CdpsiUpdateSql Updater, CdpsiUpdateSqlparser parser, string Log, IProgress<Result> progress)
{
string[] numArray1 = new string[3];
List<string> list = ((IEnumerable<string>)Directory.GetFiles(Directoria, "*.sql", SearchOption.TopDirectoryOnly)).Select(f =>
{
string[] strArray = Path.GetFileName(f).Split('_');
int result;