Skip to content

Commit

Permalink
🔨 Added the possibility to clear the Arguments, Log and Map fields.
Browse files Browse the repository at this point in the history
  • Loading branch information
BetimBeja committed Dec 24, 2020
1 parent 709344e commit c3b5020
Show file tree
Hide file tree
Showing 8 changed files with 2,911 additions and 4,599 deletions.
18 changes: 18 additions & 0 deletions AlbanianXrm.SolutionPackager.Tool/Properties/Resources.Designer.cs

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

15 changes: 15 additions & 0 deletions AlbanianXrm.SolutionPackager.Tool/Properties/Resources.it.resx
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@
<data name="EXTRACTING_SOLUTION" xml:space="preserve">
<value>Estraendo la solution "{0}"</value>
</data>
<data name="FIELD_CLEAR_MESSAGE" xml:space="preserve">
<value>Vuoi rimuovere il valore del campo?</value>
</data>
<data name="FIELD_CLEAR_TITLE" xml:space="preserve">
<value>Ripulire campo</value>
</data>
<data name="FILTER_SOLUTION" xml:space="preserve">
<value>Solution|*.zip|Tutti i File|*.*</value>
</data>
Expand Down Expand Up @@ -190,6 +196,15 @@
<data name="REFRESHING_SOLUTION_LIST" xml:space="preserve">
<value>Aggiornamento lista solution</value>
</data>
<data name="SETTINGS_FOUND" xml:space="preserve">
<value>Configurazioni caricate correttamente</value>
</data>
<data name="SETTINGS_NOT_FOUND" xml:space="preserve">
<value>Il file delle configurazioni non è stato trovato</value>
</data>
<data name="SETTINGS_SAVING" xml:space="preserve">
<value>Salvando il file delle configurazioni</value>
</data>
<data name="SOLUTIONPACKAGER_MISSING" xml:space="preserve">
<value>Manca SolutionPackager.exe!</value>
</data>
Expand Down
6 changes: 6 additions & 0 deletions AlbanianXrm.SolutionPackager.Tool/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@
<data name="EXTRACTING_SOLUTION" xml:space="preserve">
<value>Extracting solution "{0}"</value>
</data>
<data name="FIELD_CLEAR_MESSAGE" xml:space="preserve">
<value>Do you want to clear the field value?</value>
</data>
<data name="FIELD_CLEAR_TITLE" xml:space="preserve">
<value>Clear Field</value>
</data>
<data name="FILTER_SOLUTION" xml:space="preserve">
<value>Solution|*.zip|All Files|*.*</value>
</data>
Expand Down
127 changes: 81 additions & 46 deletions AlbanianXrm.SolutionPackager.Tool/SolutionPackagerControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ public SolutionPackagerControl(Type pluginType)

cmbLanguage.Items.AddRange(new object[] { CultureInfo.GetCultureInfo("en"), CultureInfo.GetCultureInfo("it") });
cmbLanguage.SelectedIndex = 0;
cmbPackageType.SelectedIndex = 0;
cmbExtractSourceLocale.SelectedIndex = 0;
cmbErrorLevel.SelectedIndex = 0;
cmbPackPackageType.SelectedIndex = 0;
cmbPackErrorLevel.SelectedIndex = 0;
cmbPackageTypeExtract.SelectedIndex = 0;
cmbSourceLocaleExtract.SelectedIndex = 0;
cmbErrorLevelExtract.SelectedIndex = 0;
cmbPackageTypePack.SelectedIndex = 0;
cmbErrorLevelPack.SelectedIndex = 0;
}

private void PluginViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e)
Expand Down Expand Up @@ -144,7 +144,7 @@ private void BtnOpenZip_Click(object sender, EventArgs e)
var result = selectFolder.ShowDialog();
if (result == DialogResult.OK)
{
txtZipPath.Text = selectFolder.SelectedPath;
txtInputExtract.Text = selectFolder.SelectedPath;
}
}
else
Expand All @@ -153,7 +153,7 @@ private void BtnOpenZip_Click(object sender, EventArgs e)
var result = openFile.ShowDialog();
if (result == DialogResult.OK)
{
txtZipPath.Text = openFile.FileName;
txtInputExtract.Text = openFile.FileName;
}
}
}
Expand All @@ -163,7 +163,7 @@ private void BtnOutputFolder_Click(object sender, EventArgs e)
var result = selectFolder.ShowDialog();
if (result == DialogResult.OK)
{
txtOutputFolder.Text = selectFolder.SelectedPath;
txtOutputExtract.Text = selectFolder.SelectedPath;
}
}

Expand All @@ -173,7 +173,11 @@ private void BtnExtractMapFile_Click(object sender, EventArgs e)
var result = openFile.ShowDialog();
if (result == DialogResult.OK)
{
txtExtractMap.Text = openFile.FileName;
txtMapExtract.Text = openFile.FileName;
}
else if (txtMapExtract.Text != "" && FieldClearDialog() == DialogResult.Yes)
{
txtMapExtract.Text = "";
}
}

Expand All @@ -183,7 +187,11 @@ private void BtnExtractLog_Click(object sender, EventArgs e)
var result = saveFile.ShowDialog();
if (result == DialogResult.OK)
{
txtExtractLog.Text = openFile.FileName;
txtLogExtract.Text = openFile.FileName;
}
else if (txtLogExtract.Text != "" && FieldClearDialog() == DialogResult.Yes)
{
txtLogExtract.Text = "";
}
}

Expand All @@ -193,16 +201,20 @@ private void BtnExtractArguments_Click(object sender, EventArgs e)
var result = openFile.ShowDialog();
if (result == DialogResult.OK)
{
txtExtractArguments.Text = openFile.FileName;
txtArgumentsExtract.Text = openFile.FileName;
}
else if (txtArgumentsExtract.Text != "" && FieldClearDialog() == DialogResult.Yes)
{
txtArgumentsExtract.Text = "";
}
}

private void BtnExtract_Click(object sender, EventArgs e)
{
int nrErrors = 0;
if (txtOutputFolder.Text.Length == 0)
if (txtOutputExtract.Text.Length == 0)
{
errorProvider.SetError(txtOutputFolder, Resources.OUTPUT_FOLDER_NOT_SPECIFIED);
errorProvider.SetError(txtOutputExtract, Resources.OUTPUT_FOLDER_NOT_SPECIFIED);
nrErrors += 1;
}
if (CoreToolsDownloader.GetSolutionPackagerVersion() == null)
Expand All @@ -220,9 +232,9 @@ private void BtnExtract_Click(object sender, EventArgs e)
}
else
{
if (!File.Exists(txtZipPath.Text))
if (!File.Exists(txtInputExtract.Text))
{
errorProvider.SetError(txtZipPath, Resources.ZIP_FILE_DOES_NOT_EXIST);
errorProvider.SetError(txtInputExtract, Resources.ZIP_FILE_DOES_NOT_EXIST);
nrErrors += 1;
}
}
Expand All @@ -235,28 +247,28 @@ private void BtnExtract_Click(object sender, EventArgs e)
var parameters = new SolutionPackagerCaller.Parameters()
{
Action = "Extract",
ZipFile = txtZipPath.Text,
OutputFolder = txtOutputFolder.Text,
PackageType = packageTypes[cmbPackageType.SelectedIndex],
AllowWrite = chkAllowWrite.Checked,
ZipFile = txtInputExtract.Text,
OutputFolder = txtOutputExtract.Text,
PackageType = packageTypes[cmbPackageTypeExtract.SelectedIndex],
AllowWrite = chkAllowWriteExtract.Checked,
AllowDelete = radAllowDeleteYes.Checked ? true : (radAllowDeleteNo.Checked ? false : default(bool?)),
Clobber = chkClobber.Checked,
ErrorLevel = errorLevels[cmbErrorLevel.SelectedIndex],
MapFile = txtExtractMap.Text,
NoLogo = chkExtractNoLogo.Checked,
LogFile = txtExtractLog.Text,
Arguments = txtExtractArguments.Text,
SourceLocale = languageCodes[cmbExtractSourceLocale.SelectedIndex],
Localize = chkLocalize.Checked,
FormatXml = chkFormatDocument.Checked
Clobber = chkClobberExtract.Checked,
ErrorLevel = errorLevels[cmbErrorLevelExtract.SelectedIndex],
MapFile = txtMapExtract.Text,
NoLogo = chkNoLogoExtract.Checked,
LogFile = txtLogExtract.Text,
Arguments = txtArgumentsExtract.Text,
SourceLocale = languageCodes[cmbSourceLocaleExtract.SelectedIndex],
Localize = chkLocalizeExtract.Checked,
FormatXml = chkFormatDocumentExtract.Checked
};

if (localOrCrm.Checked)
{
crmSolutionManager.DownloadSolution(
new CrmSolutionManager.DownloadSolutionParams(
cmbCrmSolutions.SelectedItem as Models.Solution,
zipDirectory: txtZipPath.Text,
zipDirectory: txtInputExtract.Text,
solutionPackagerParameters: parameters,
managed: parameters.PackageType == "Both" ? new bool[] { true, false } : new bool[] { radManaged.Checked },
exportAutoNumberingSettings: chkExportAutoNumbering.Checked,
Expand Down Expand Up @@ -284,7 +296,7 @@ private void BtnInputFolder_Click(object sender, EventArgs e)
var result = selectFolder.ShowDialog();
if (result == DialogResult.OK)
{
txtPackFolder.Text = selectFolder.SelectedPath;
txtInputPack.Text = selectFolder.SelectedPath;
}
}

Expand All @@ -294,7 +306,7 @@ private void BtnOutputZip_Click(object sender, EventArgs e)
var result = saveFile.ShowDialog();
if (result == DialogResult.OK)
{
txtPackZip.Text = saveFile.FileName;
txtOutputPack.Text = saveFile.FileName;
}
}

Expand All @@ -304,7 +316,11 @@ private void BtnPackMap_Click(object sender, EventArgs e)
var result = openFile.ShowDialog();
if (result == DialogResult.OK)
{
txtPackMap.Text = openFile.FileName;
txtMapPack.Text = openFile.FileName;
}
else if (txtMapPack.Text != "" && FieldClearDialog() == DialogResult.Yes)
{
txtMapPack.Text = "";
}
}

Expand All @@ -314,7 +330,11 @@ private void BtnLogPack_Click(object sender, EventArgs e)
var result = saveFile.ShowDialog();
if (result == DialogResult.OK)
{
txtPackLog.Text = saveFile.FileName;
txtLogPack.Text = saveFile.FileName;
}
else if (txtLogPack.Text != "" && FieldClearDialog() == DialogResult.Yes)
{
txtLogPack.Text = "";
}
}

Expand All @@ -324,26 +344,30 @@ private void BtnArgumentsPack_Click(object sender, EventArgs e)
var result = openFile.ShowDialog();
if (result == DialogResult.OK)
{
txtPackArguments.Text = openFile.FileName;
txtArgumentsPack.Text = openFile.FileName;
}
else if (txtArgumentsPack.Text != "" && FieldClearDialog() == DialogResult.Yes)
{
txtArgumentsPack.Text = "";
}
}

private void btnPack_Click(object sender, EventArgs e)
{
int nrErrors = 0;
if (txtPackFolder.Text.Length == 0)
if (txtInputPack.Text.Length == 0)
{
errorProvider.SetError(txtPackFolder, Resources.INPUT_FOLDER_NOT_SPECIFIED);
errorProvider.SetError(txtInputPack, Resources.INPUT_FOLDER_NOT_SPECIFIED);
nrErrors += 1;
}
if (CoreToolsDownloader.GetSolutionPackagerVersion() == null)
{
errorProvider.SetError(localOrCrm, Resources.SOLUTIONPACKAGER_MISSING);
nrErrors += 1;
}
if (txtPackZip.Text.Length == 0)
if (txtOutputPack.Text.Length == 0)
{
errorProvider.SetError(txtPackZip, Resources.ZIP_FILE_NOT_SPECIFIED);
errorProvider.SetError(txtOutputPack, Resources.ZIP_FILE_NOT_SPECIFIED);
nrErrors += 1;
}

Expand All @@ -356,14 +380,14 @@ private void btnPack_Click(object sender, EventArgs e)
var parameters = new SolutionPackagerCaller.Parameters()
{
Action = "Pack",
ZipFile = txtPackZip.Text,
OutputFolder = txtPackFolder.Text,
PackageType = packageTypes[cmbPackPackageType.SelectedIndex],
ErrorLevel = errorLevels[cmbPackErrorLevel.SelectedIndex],
MapFile = txtPackMap.Text,
NoLogo = chkPackNoLogo.Checked,
LogFile = txtPackLog.Text,
Arguments = txtPackArguments.Text
ZipFile = txtOutputPack.Text,
OutputFolder = txtInputPack.Text,
PackageType = packageTypes[cmbPackageTypePack.SelectedIndex],
ErrorLevel = errorLevels[cmbErrorLevelPack.SelectedIndex],
MapFile = txtMapPack.Text,
NoLogo = chkNoLogoPack.Checked,
LogFile = txtLogPack.Text,
Arguments = txtArgumentsPack.Text
};


Expand Down Expand Up @@ -413,5 +437,16 @@ private void TabsExtractOrPack_Selected(object sender, TabControlEventArgs e)
pluginViewModel.SolutionPackagerVersion = CoreToolsDownloader.GetSolutionPackagerVersion()?.ToString();
}
}

private DialogResult FieldClearDialog()
{
using (var dialog = new SolutionPackagerDialog(Resources.FIELD_CLEAR_MESSAGE,
Resources.FIELD_CLEAR_TITLE,
new SolutionPackagerDialog.ButtonProperties() { Text=Resources.BTN_NO, Result = DialogResult.No },
new SolutionPackagerDialog.ButtonProperties() { Text=Resources.BTN_YES, Result = DialogResult.Yes }))
{
return dialog.ShowDialog(this);
}
}
}
}
Loading

0 comments on commit c3b5020

Please sign in to comment.