Skip to content

Commit

Permalink
Updating to vs 2019 with c#8.0 and .net 5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kfsone committed Jun 23, 2021
1 parent c0568bb commit 530748f
Show file tree
Hide file tree
Showing 12 changed files with 140 additions and 145 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,14 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.101
dotnet-version: 5.0.x

- name: Install dependencies
run: dotnet restore

- name: Build the binaries
run: |
dotnet publish `
-p:PublishProfile=Properties/PublishProfiles/FolderProfile.pubxml `
--configuration=Release
dotnet publish --configuration=Release --output Publish
- name: Create release.zip
id: release
Expand Down
17 changes: 7 additions & 10 deletions About.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Reflection;
using System.Windows.Forms;

Expand All @@ -17,7 +14,7 @@ public About()

#region Assembly Attribute Accessors

public string AssemblyTitle
public static string AssemblyTitle
{
get
{
Expand All @@ -30,19 +27,19 @@ public string AssemblyTitle
return titleAttribute.Title;
}
}
return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().Location);
}
}

public string AssemblyVersion
public static string AssemblyVersion
{
get
{
return Assembly.GetExecutingAssembly().GetName().Version.ToString();
}
}

public string AssemblyDescription
public static string AssemblyDescription
{
get
{
Expand All @@ -55,7 +52,7 @@ public string AssemblyDescription
}
}

public string AssemblyProduct
public static string AssemblyProduct
{
get
{
Expand All @@ -68,7 +65,7 @@ public string AssemblyProduct
}
}

public string AssemblyCopyright
public static string AssemblyCopyright
{
get
{
Expand All @@ -81,7 +78,7 @@ public string AssemblyCopyright
}
}

public string AssemblyCompany
public static string AssemblyCompany
{
get
{
Expand Down
60 changes: 30 additions & 30 deletions Domain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ public class Domain
public Domain(string named)
{
Contract.Requires(named != null);
name = named;
domains = new List<Domain>();
properties = new List<Property>();
loadOrder = new List<OrderingEntry>();
Name = named;
Domains = new List<Domain>();
Properties = new List<Property>();
LoadOrder = new List<OrderingEntry>();
}

/// <summary>
Expand All @@ -27,11 +27,11 @@ public Domain(string named)
/// <returns></returns>
public string GetFullName()
{
var fullName = name;
if (itemNo >= 0)
fullName += $" #{itemNo}";
foreach (var child in properties.Where(child => child.key == "name" && child.pending.Length > 0))
return fullName + ": " + child.pending;
var fullName = Name;
if (ItemNo >= 0)
fullName += $" #{ItemNo}";
foreach (var child in Properties.Where(child => child.Key == "name" && child.Pending.Length > 0))
return fullName + ": " + child.Pending;
return fullName;
}

Expand All @@ -43,18 +43,18 @@ public string GetFullName()
/// <returns>Text representation of this domain and its children.</returns>
public string AsText(bool saving, string indentation = "")
{
var text = $"{indentation}{name}\n{indentation}{{\n";
var text = $"{indentation}{Name}\n{indentation}{{\n";
var innerIndent = indentation + "\t";
foreach (var entry in loadOrder)
if (entry.subDomain != null)
foreach (var entry in LoadOrder)
if (entry.SubDomain != null)
{
text += entry.subDomain.AsText(saving, innerIndent);
text += entry.SubDomain.AsText(saving, innerIndent);
}
else
{
text += $"{innerIndent}{entry.property.key} = {entry.property.pending}\n";
if (saving && entry.property.isChanged)
entry.property.Synchronize();
text += $"{innerIndent}{entry.Property.Key} = {entry.Property.Pending}\n";
if (saving && entry.Property.IsChanged)
entry.Property.Synchronize();
}

text += indentation + "}\n";
Expand All @@ -72,12 +72,12 @@ public void ListProperties(ListView listView)
listView.View = View.List;

listView.BeginUpdate();
foreach (var property in properties)
foreach (var property in Properties)
{
var value = new ListViewItem(new[] { property.key, property.pending })
var value = new ListViewItem(new[] { property.Key, property.Pending })
{
Tag = property,
ForeColor = property.isChanged ? Color.Red : Control.DefaultForeColor
ForeColor = property.IsChanged ? Color.Red : Control.DefaultForeColor
};
listView.Items.Add(value);
}
Expand All @@ -95,31 +95,31 @@ public void ListProperties(ListView listView)
public void ListDomains(TreeNodeCollection insertAt)
{
Contract.Requires(insertAt != null);
var treeNodes = new TreeNode[domains.Count];
for (var i = 0; i < domains.Count; ++i)
treeNodes[i] = new TreeNode(domains[i].GetFullName())
var treeNodes = new TreeNode[Domains.Count];
for (var i = 0; i < Domains.Count; ++i)
treeNodes[i] = new TreeNode(Domains[i].GetFullName())
{
Name = domains[i].name,
Tag = domains[i]
Name = Domains[i].Name,
Tag = Domains[i]
};

insertAt.AddRange(treeNodes);

for (var i = 0; i < domains.Count; ++i) domains[i].ListDomains(treeNodes[i].Nodes);
for (var i = 0; i < Domains.Count; ++i) Domains[i].ListDomains(treeNodes[i].Nodes);
}

#region Members

public string name { get; }
public List<Domain> domains { get; }
public List<Property> properties { get; }
public List<OrderingEntry> loadOrder { get; }
public string Name { get; }
public List<Domain> Domains { get; }
public List<Property> Properties { get; }
public List<OrderingEntry> LoadOrder { get; }

/// <summary>
/// itemNo is used by for some Domains that repeat multiple times in a parent,
/// as PART is repeated multiple times within VESSEL.
/// </summary>
public int itemNo { get; set; } = -1;
public int ItemNo { get; set; } = -1;

#endregion Members
}
Expand Down
8 changes: 4 additions & 4 deletions OrderingEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
/// </summary>
public class OrderingEntry
{
public OrderingEntry(Domain subDomain) => this.subDomain = subDomain;
public OrderingEntry(Property property) => this.property = property;
public OrderingEntry(Domain subDomain) => this.SubDomain = subDomain;
public OrderingEntry(Property property) => this.Property = property;

#region Members
public Domain subDomain { get; private set; } = null;
public Property property { get; private set; } = null;
public Domain SubDomain { get; private set; } = null;
public Property Property { get; private set; } = null;
#endregion
};

Expand Down
14 changes: 0 additions & 14 deletions Properties/PublishProfiles/FolderProfile.pubxml

This file was deleted.

Binary file added Properties/sfsed-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 10 additions & 10 deletions Property.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,40 @@ public class Property
//! Constructor.
public Property(string key, string value)
{
this.key = key;
this.source = value;
this.Key = key;
this.Source = value;
this._current = null;
this._pending = null;
}

public void Render(ListViewItem into)
{
into.SubItems[1].Text = pending;
into.ForeColor = pending != current ? Color.DarkRed : Form.DefaultForeColor;
into.SubItems[1].Text = Pending;
into.ForeColor = Pending != Current ? Color.DarkRed : Form.DefaultForeColor;
}

public void Synchronize()
{
if (_pending != null)
{
_current = (_pending != source) ? _pending : null;
_current = (_pending != Source) ? _pending : null;
_pending = null;
}
}

#region Members
//! key is the label or name of this field.
public string key { get; }
public string Key { get; }
//! value we saw on load.
public string source { get; }
public string Source { get; }
//! Last value we saved, or null if unchanged
private string _current = null;
public string current { get => _current ?? source; }
public string Current { get => _current ?? Source; }
//! Value we need to write to disk or null
private string _pending = null;
public string pending { get => _pending ?? current; set => _pending = (value != current) ? value : null; }
public string Pending { get => _pending ?? Current; set => _pending = (value != Current) ? value : null; }
//! value we originally loaded from disk
public bool isChanged => _pending != null;
public bool IsChanged => _pending != null;
#endregion
};
}
14 changes: 6 additions & 8 deletions PropertyEdit.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Windows.Forms;

namespace SFSEd
{
Expand All @@ -10,11 +8,11 @@ public PropertyEdit(Property property)
{
InitializeComponent();

Text = $"Edit {property.key}";
originalText.Text = property.source;
currentText.Text = property.current;
changedText.Text = property.pending;
changedText.Tag = property.pending;
Text = $"Edit {property.Key}";
originalText.Text = property.Source;
currentText.Text = property.Current;
changedText.Text = property.Pending;
changedText.Tag = property.Pending;
}

#region Members
Expand Down
Loading

0 comments on commit 530748f

Please sign in to comment.