Skip to content

Commit

Permalink
- more fixes, display versions, correct namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
fbergmann committed Dec 8, 2014
1 parent 36244bd commit f1b9f1e
Show file tree
Hide file tree
Showing 12 changed files with 1,236 additions and 1,091 deletions.
15 changes: 8 additions & 7 deletions FormsCombineArchive/AboutBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
Expand All @@ -14,11 +15,11 @@ partial class AboutBox : Form
public AboutBox()
{
InitializeComponent();
this.Text = String.Format("About {0}", AssemblyTitle);
this.labelProductName.Text = AssemblyProduct;
this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion);
this.labelCopyright.Text = AssemblyCopyright;
this.textBoxDescription.Text = AssemblyDescription;
Text = String.Format("About {0}", AssemblyTitle);
labelProductName.Text = AssemblyProduct;
labelVersion.Text = String.Format("Version {0}", AssemblyVersion);
labelCopyright.Text = AssemblyCopyright;
textBoxDescription.Text = AssemblyDescription;
}

#region Assembly Attribute Accessors
Expand All @@ -36,11 +37,11 @@ public string AssemblyTitle
return titleAttribute.Title;
}
}
return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
return Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
}
}

public string AssemblyVersion
public static string AssemblyVersion
{
get
{
Expand Down
13 changes: 7 additions & 6 deletions FormsCombineArchive/ControlSBWAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@
using System.Windows.Forms;
using LibCombine;
using SBW;
using SBW.Utils;

namespace FormsCombineArchive
{
public partial class ControlSBWAnalyzer : UserControl
{
private SortedList<string,ServiceDescriptor> _Analyzers;
SBW.Utils.SBWFavorites favs;
SBWFavorites favs;
public bool IsAvailable { get; private set; }
public Entry Current { get; set; }

Expand All @@ -39,10 +40,10 @@ private void OnGoClicked(object sender, EventArgs e)
{
try
{
var isConnected = SBW.SBWLowLevel.isConnected();
if (!isConnected) SBW.SBWLowLevel.connect();
var isConnected = SBWLowLevel.isConnected();
if (!isConnected) SBWLowLevel.connect();
var current = _Analyzers[(string)cmbAnalyzer.SelectedItem];
SBW.HighLevel.Send(current.ModuleName, current.Name, "void doAnalysis(string)", SBML);
HighLevel.Send(current.ModuleName, current.Name, "void doAnalysis(string)", SBML);
if (!isConnected) SBWLowLevel.disconnect();
}
catch
Expand Down Expand Up @@ -75,7 +76,7 @@ private void ControlSBWAnalyzer_Load(object sender, EventArgs e)
{
try
{
_Analyzers = SBW.Utils.SBWMenu.GetSortedAnalyzers();
_Analyzers = SBWMenu.GetSortedAnalyzers();
}
catch
{
Expand All @@ -94,7 +95,7 @@ private void ControlSBWAnalyzer_Load(object sender, EventArgs e)
IsAvailable = true;
cmbAnalyzer.Items.AddRange(_Analyzers.Keys.ToArray<string>());
cmbAnalyzer.SelectedItem = cmbAnalyzer.Items[0];
favs = new SBW.Utils.SBWFavorites(() => SBML);
favs = new SBWFavorites(() => SBML);
}
}
}
Expand Down
1,245 changes: 642 additions & 603 deletions FormsCombineArchive/MainForm.Designer.cs

Large diffs are not rendered by default.

67 changes: 56 additions & 11 deletions FormsCombineArchive/MainForm.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using FormsCombineArchive.Properties;
using LibCombine;

namespace FormsCombineArchive
Expand Down Expand Up @@ -44,6 +47,9 @@ public MainForm()
SetupGroups();

NewArchive();

lblMessage.Text = "Version: " + AboutBox.AssemblyVersion;

}

private ListViewGroup GetGroupForFormat(string format)
Expand Down Expand Up @@ -106,7 +112,7 @@ private void UpdateUI()
pictureBox1.Visible = true;
textPanel.Visible = false;
pictureBox1.Visible = true;
pictureBox1.Image = Properties.Resources.COMBINE_ARCHIVE;
pictureBox1.Image = Resources.COMBINE_ARCHIVE;

}

Expand All @@ -127,7 +133,7 @@ private void OnOpenClicked(object sender, EventArgs e)
{
using (var dialog = new OpenFileDialog { Filter = "OMEX files|*.omex;*.sedx;*.sbex;*.cmex;*.phex;*.neux;*.sbox|All files|*.*" })
{
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
if (dialog.ShowDialog() == DialogResult.OK)
{
OpenFile(dialog.FileName);
}
Expand Down Expand Up @@ -162,7 +168,7 @@ private void OnSaveClicked(object sender, EventArgs e)
{
using (var dialog = new SaveFileDialog { Filter = "OMEX files|*.omex;*.sedx;*.sbex;*.cmex;*.phex;*.neux;*.sbox|All files|*.*" })
{
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
if (dialog.ShowDialog() == DialogResult.OK)
{
SaveFile(dialog.FileName);
}
Expand Down Expand Up @@ -238,7 +244,7 @@ private void OnSelectionChanged(object sender, EventArgs e)
pictureBox1.Visible = true;
textPanel.Visible = false;
pictureBox1.Visible = true;
pictureBox1.Image = Properties.Resources.COMBINE_ARCHIVE;
pictureBox1.Image = Resources.COMBINE_ARCHIVE;
return;
}
var item = lstEntries.SelectedItems[0];
Expand Down Expand Up @@ -296,7 +302,7 @@ private void OnSelectionChanged(object sender, EventArgs e)
public void AddFile(string filename = "")
{
var dialog = new FormAddFile { FileName = filename };
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
if (dialog.ShowDialog() == DialogResult.OK)
{
var entry = Archive.AddEntry(
dialog.FileName,
Expand Down Expand Up @@ -362,7 +368,7 @@ private void OnRemoveEntry(object sender, EventArgs e)
var entry = GetCurrenEntry(out item);
if (entry == null) return;

if (MessageBox.Show(string.Format("Do you really want to delete '{0}'?", item.Text), "Delete Entry", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
if (MessageBox.Show(string.Format("Do you really want to delete '{0}'?", item.Text), "Delete Entry", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
lstEntries.Items.Remove(item);
Archive.Entries.Remove(entry);
Expand All @@ -388,7 +394,7 @@ private void OnSaveItem(object sender, EventArgs e)
{
using (var dialog = new SaveFileDialog { Filter = "*" + ext })
{
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK
if (dialog.ShowDialog() == DialogResult.OK
)
File.Copy(local, dialog.FileName);
}
Expand All @@ -399,15 +405,15 @@ private void OnSaveItem(object sender, EventArgs e)
}
}

private void DisplayMetaData(object sender, EventArgs e)
private void OnDisplayMetaDataClick(object sender, EventArgs e)
{
ListViewItem item; ;
var entry = GetCurrenEntry(out item);
if (entry == null) return;

OmexDescription desc = entry.Description;
var dialog = new FormDisplayData { FileName = entry.Location, Format = entry.Format, Description = desc };
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
if (dialog.ShowDialog() == DialogResult.OK)
{
entry.Location = dialog.FileName;
entry.Format = dialog.Format;
Expand All @@ -426,7 +432,7 @@ private void OnCopyItemToClipboard(object sender, EventArgs e)
if (local == null) return;
try
{
System.Collections.Specialized.StringCollection col = new System.Collections.Specialized.StringCollection();
StringCollection col = new StringCollection();
col.Add(local);
Clipboard.SetFileDropList(col);
}
Expand Down Expand Up @@ -462,13 +468,52 @@ private void OnSubmitBugClicked(object sender, EventArgs e)

try
{
System.Diagnostics.Process.Start("http://github.com/fbergmann/CombineArchive/issues");
Process.Start("http://github.com/fbergmann/CombineArchive/issues");
}
catch
{

}

}

private void OnValidateClick(object sender, EventArgs e)
{
var errors = Archive.Validate();
if (errors.Count == 0)
{
MessageBox.Show("No issues found.", "Archive is valid", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}

var sb = new StringBuilder();
foreach (var item in errors)
sb.AppendFormat("{0}: {1}{2}", item.Item1, item.Item2, Environment.NewLine);

if (errors.FirstOrDefault( t => t.Item1 == "error") != null)
{
MessageBox.Show(this, string.Format("Errors found: {0}{0}{1}", Environment.NewLine, sb.ToString()), "Archive is invalid", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}

MessageBox.Show(this, string.Format("Issues found: {0}{0}{1}", Environment.NewLine, sb.ToString()), "Archive has issues", MessageBoxButtons.OK, MessageBoxIcon.Warning);

}

private void OnEditArchivePropertiesClick(object sender, EventArgs e)
{
OmexDescription desc = Archive.Descriptions.FirstOrDefault(d => d.About == ".");
if (desc == null)
{
desc = new OmexDescription {About = ".", Created = DateTime.Now};
Archive.Descriptions.Add(desc);
}
var dialog = new FormDisplayData { FileName = ".", Format = Entry.KnownFormats["omex"], Description = desc };
if (dialog.ShowDialog() == DialogResult.OK)
{
Archive.Descriptions.Remove(desc);
Archive.Descriptions.Add(dialog.Description);
}
}
}
}
5 changes: 4 additions & 1 deletion FormsCombineArchive/MainForm.resx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAU
GwAAAk1TRnQBSQFMAgEBBAEAAcABAQHAAQEBGAEAARgBAAT/ARkBAAj/AUIBTQE2BwABNgMAASgDAAFg
GwAAAk1TRnQBSQFMAgEBBAEAAQgBAgEIAQIBGAEAARgBAAT/ARkBAAj/AUIBTQE2BwABNgMAASgDAAFg
AwABMAMAAQEBAAEYBgABNv8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A
/wD/AP8A/wD/AC0AA/5F/wMABuU55APjA/YDAAHUAdABywHcAdQBzQHYAdQByQHWAdEBywHWAdMBywHb
AdIBzgHXAdIBzwHeAdUBxwHXAdEBzQHaAdIBywHaAdIBywHaAdIBywHaAdIBzAHYAdEBzgHYAdEBzgHa
Expand Down Expand Up @@ -1595,6 +1595,9 @@
E9ew//AVxE8OItv/9O/Cf0ck8gud2vKswuxNZgAAAABJRU5ErkJggg==
</value>
</data>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>37</value>
</metadata>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAgAMDAAAAEACACoDgAAhgAAACAgAAABAAgAqAgAAC4PAAAQEAAAAQAIAGgFAADWFwAAAAAAAAEA
Expand Down
13 changes: 7 additions & 6 deletions FormsCombineArchive/PreviewHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Design;
using STATSTG = System.Runtime.InteropServices.ComTypes.STATSTG;

public class PreviewHandlerHost : Control
{
Expand All @@ -34,7 +35,7 @@ private string ErrorMessage
/// Gets or sets the background colour of this PreviewHandlerHost.
/// </summary>
[DefaultValue("White")]
public override System.Drawing.Color BackColor
public override Color BackColor
{
get
{
Expand Down Expand Up @@ -359,13 +360,13 @@ internal interface IInitializeWithStream
internal class StreamWrapper : IStream
{

private System.IO.Stream mInner;
private Stream mInner;

/// <summary>
/// Initialises a new instance of the StreamWrapper class, using the specified System.IO.Stream.
/// </summary>
/// <param name="inner"></param>
public StreamWrapper(System.IO.Stream inner)
public StreamWrapper(Stream inner)
{
mInner = inner;
}
Expand Down Expand Up @@ -439,7 +440,7 @@ public void Revert()
/// <param name="plibNewPosition"></param>
public void Seek(long dlibMove, int dwOrigin, IntPtr plibNewPosition)
{
long pos = mInner.Seek(dlibMove, (System.IO.SeekOrigin)dwOrigin);
long pos = mInner.Seek(dlibMove, (SeekOrigin)dwOrigin);
if (plibNewPosition != IntPtr.Zero) Marshal.WriteInt64(plibNewPosition, pos);
}

Expand All @@ -457,9 +458,9 @@ public void SetSize(long libNewSize)
/// </summary>
/// <param name="pstatstg"></param>
/// <param name="grfStatFlag"></param>
public void Stat(out System.Runtime.InteropServices.ComTypes.STATSTG pstatstg, int grfStatFlag)
public void Stat(out STATSTG pstatstg, int grfStatFlag)
{
pstatstg = new System.Runtime.InteropServices.ComTypes.STATSTG();
pstatstg = new STATSTG();
pstatstg.cbSize = mInner.Length;
pstatstg.type = 2; // stream type
pstatstg.pwcsName = (mInner is FileStream) ? ((FileStream)mInner).Name : String.Empty;
Expand Down
4 changes: 2 additions & 2 deletions FormsCombineArchive/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.5.0.0")]
[assembly: AssemblyFileVersion("1.5.0.0")]
[assembly: AssemblyVersion("1.8.0.0")]
[assembly: AssemblyFileVersion("1.8.0.0")]
Loading

0 comments on commit f1b9f1e

Please sign in to comment.