Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
gugabguerra committed Sep 19, 2020
0 parents commit fb38443
Show file tree
Hide file tree
Showing 46 changed files with 3,732 additions and 0 deletions.
Binary file added .vs/WSMerge/v16/.suo
Binary file not shown.
Empty file.
Binary file added .vs/WSMerge/v16/Server/sqlite3/storage.ide
Binary file not shown.
25 changes: 25 additions & 0 deletions WSMerge.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28922.388
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WSMerge", "WSMerge\WSMerge.csproj", "{A1ABFEEF-FE5C-467B-9962-E10DD2D7B17D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A1ABFEEF-FE5C-467B-9962-E10DD2D7B17D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A1ABFEEF-FE5C-467B-9962-E10DD2D7B17D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A1ABFEEF-FE5C-467B-9962-E10DD2D7B17D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A1ABFEEF-FE5C-467B-9962-E10DD2D7B17D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {336B56C9-A9E2-40F1-B9FD-5CC3E2CEDD87}
EndGlobalSection
EndGlobal
187 changes: 187 additions & 0 deletions WSMerge/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

114 changes: 114 additions & 0 deletions WSMerge/Form1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;

namespace WSMerge
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
txtBxMergecap.Text = Properties.Settings.Default.wspath;
if (!File.Exists(txtBxMergecap.Text))
{
MessageBox.Show("Programa \"mergecap.exe\" não encontrado", "Erro");
if (openFileDialFindWS.ShowDialog() == DialogResult.OK)
{
txtBxMergecap.Text = openFileDialFindWS.FileName;
Properties.Settings.Default.wspath = openFileDialFindWS.FileName;
Properties.Settings.Default.Save();
}
}
}

private void Button1_Click(object sender, EventArgs e)
{
if (openFileDlgSource.ShowDialog() == DialogResult.OK)
{
foreach(string fname in openFileDlgSource.FileNames)
{
listViewSourceFiles.Items.Add(fname);
}
}
}

private void Btn_clear_Click(object sender, EventArgs e)
{
listViewSourceFiles.Items.Clear();
}

private void OpenFileDlgSource_FileOk(object sender, CancelEventArgs e)
{

}

private void BtnMerge_Click(object sender, EventArgs e)
{
if(listViewSourceFiles.Items.Count < 1)
{
MessageBox.Show("Nenhum arquivo selecionado","Erro");
return;
}
else if(listViewSourceFiles.Items.Count == 1)
{
MessageBox.Show("Por favor, selecione mais de um arquivo para merge", "Selecione mais de um arquivo");
return;
}

if(!File.Exists(txtBxMergecap.Text))
{
MessageBox.Show("Programa \"mergecap.exe\" não encontrado", "Erro");
return;
}

if (saveFileDialMerged.ShowDialog() == DialogResult.OK)
{
string fileout = saveFileDialMerged.FileName;
string filein = "";
for (int i = 0; i < listViewSourceFiles.Items.Count; i++)
{
filein += "\"" + listViewSourceFiles.Items[i].Text + "\" ";
}
Process p = new Process();
p.StartInfo.FileName = txtBxMergecap.Text;
p.StartInfo.Arguments = "-v -w " + fileout + " " + filein;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.Start();

string output = p.StandardOutput.ReadToEnd();
p.WaitForExit();
MessageBox.Show("Merge concluído", "Concluído");
if (File.Exists(fileout))
{
Process.Start("explorer.exe", "/select, " + fileout);
}

//Console.WriteLine(filein);
}
}

private void BrnSelMergecap_Click(object sender, EventArgs e)
{
if (openFileDialFindWS.ShowDialog() == DialogResult.OK)
{
txtBxMergecap.Text = openFileDialFindWS.FileName;
Properties.Settings.Default.wspath = openFileDialFindWS.FileName;
Properties.Settings.Default.Save();
}
}

private void Form1_Load(object sender, EventArgs e)
{

}
}
}
Loading

0 comments on commit fb38443

Please sign in to comment.