Skip to content

Commit

Permalink
Migrate to .NET 8
Browse files Browse the repository at this point in the history
  • Loading branch information
milchchan committed Dec 11, 2023
1 parent 5dbacc8 commit d1e5057
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 40 deletions.
40 changes: 20 additions & 20 deletions Apricot/Agent.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public Agent(string name)
{
agent.scale = (double)menuItem.Tag;

foreach (Character character in from character in Script.Instance.Characters where character.Name.Equals(agent.characterName) select character)
foreach (Character character in from character in Script.Instance.Characters where character.Name!.Equals(agent.characterName) select character)
{
Storyboard storyboard = new Storyboard();
DoubleAnimation doubleAnimation1 = new DoubleAnimation(agent.ZoomScaleTransform.ScaleX, agent.scale, TimeSpan.FromMilliseconds(500));
Expand Down Expand Up @@ -274,7 +274,7 @@ public Agent(string name)
agent.ZoomScaleTransform.ScaleX = agent.scale;
agent.ZoomScaleTransform.ScaleY = agent.scale;

foreach (Character c in from c in Script.Instance.Characters where c.Name.Equals(agent.characterName) select c)
foreach (Character c in from c in Script.Instance.Characters where c.Name!.Equals(agent.characterName) select c)
{
agent.LayoutRoot.Width = c.Size.Width * agent.scale;
agent.LayoutRoot.Height = c.Size.Height * agent.scale;
Expand Down Expand Up @@ -1021,7 +1021,7 @@ public Agent(string name)

if (tag != null)
{
foreach (Character c in from c in Script.Instance.Characters where c.Name.Equals(tag) select c)
foreach (Character c in from c in Script.Instance.Characters where c.Name!.Equals(tag) select c)
{
foreach (Window window in Application.Current.Windows)
{
Expand Down Expand Up @@ -1064,12 +1064,12 @@ public Agent(string name)

if (motion != null)
{
List<string>? typeList = null;
List<string?>? typeList = null;
bool isVisible;

if (motion.Type == null)
{
typeList = new List<string>();
typeList = new List<string?>();
a.cachedMotionList!.ForEach(delegate (Motion m)
{
if (m.ZIndex == motion.ZIndex)
Expand All @@ -1083,10 +1083,10 @@ public Agent(string name)
{
if (c.HasTypes)
{
typeList = new List<string>();
typeList = new List<string?>();
a.cachedMotionList!.ForEach(delegate (Motion m)
{
if (m.ZIndex == motion.ZIndex && c.Types.Contains(m.Type))
if (m.Type != null && m.ZIndex == motion.ZIndex && c.Types.Contains(m.Type))
{
typeList.Add(m.Type);
}
Expand All @@ -1100,9 +1100,9 @@ public Agent(string name)
}
else if (c.HasTypes)
{
isVisible = !typeList.Exists(delegate (string t)
isVisible = !typeList.Exists(delegate (string? t)
{
return c.Types.Contains(t);
return t == null ? false : c.Types.Contains(t);
});
}
else
Expand Down Expand Up @@ -1252,7 +1252,7 @@ public Agent(string name)
{
this.baseDateTime = DateTime.UtcNow;

foreach (Character character in from character in Script.Instance.Characters where character.Name.Equals(this.characterName) select character)
foreach (Character character in from character in Script.Instance.Characters where character.Name!.Equals(this.characterName) select character)
{
System.Configuration.Configuration? config1 = null;
string directory = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), System.Reflection.Assembly.GetExecutingAssembly().GetName().Name!);
Expand Down Expand Up @@ -1464,7 +1464,7 @@ public Agent(string name)

character.Likes += 1;

Script.Instance.TryEnqueue(Script.Instance.Prepare(from sequence in Script.Instance.Sequences where sequence.Name.Equals("Like") && sequence.Owner.Equals(this.characterName) select sequence, character.Likes.ToString(System.Globalization.CultureInfo.InvariantCulture)));
Script.Instance.TryEnqueue(Script.Instance.Prepare(from sequence in Script.Instance.Sequences where sequence.Name!.Equals("Like") && sequence.Owner!.Equals(this.characterName) select sequence, character.Likes.ToString(System.Globalization.CultureInfo.InvariantCulture)));

backgroundBrush = new SolidColorBrush(Color.FromArgb((byte)(backgroundColor.A * 75 / 100), backgroundColor.R, backgroundColor.G, backgroundColor.B));

Expand Down Expand Up @@ -1752,7 +1752,7 @@ public Agent(string name)
MenuItem removeMenuItem = new MenuItem();

sourceMenuItem = new MenuItem();
sourceMenuItem.Header = String.IsNullOrEmpty(source.Name) ? source.Location.ToString() : source.Name;
sourceMenuItem.Header = String.IsNullOrEmpty(source.Name) ? source.Location!.ToString() : source.Name;
sourceMenuItem.Tag = source;

removeMenuItem.Header = Apricot.Resources.Remove;
Expand All @@ -1770,7 +1770,7 @@ public Agent(string name)
}
else
{
sourceMenuItem.Header = String.IsNullOrEmpty(source.Name) ? source.Location.ToString() : source.Name;
sourceMenuItem.Header = String.IsNullOrEmpty(source.Name) ? source.Location!.ToString() : source.Name;
sourceMenuItemList.Remove(sourceMenuItem);
}

Expand Down Expand Up @@ -2101,7 +2101,7 @@ public Agent(string name)
this.balloon.Title = this.Title;
this.balloon.SizeChanged += new SizeChangedEventHandler(delegate (object s, SizeChangedEventArgs e)
{
foreach (Character character in from character in Script.Instance.Characters where character.Name.Equals(this.characterName) select character)
foreach (Character character in from character in Script.Instance.Characters where character.Name!.Equals(this.characterName) select character)
{
this.balloon.Left = this.Left + (this.Width - e.NewSize.Width) / 2;
this.balloon.Top = this.Top - e.NewSize.Height + character.Origin.Y * this.ZoomScaleTransform.ScaleY;
Expand Down Expand Up @@ -2484,7 +2484,7 @@ public void Switch(IEnumerable<Character> characters)
Nullable<Point> point = null;
string directory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)!;

foreach (Nullable<Point> p in from character in Script.Instance.Characters where character.Name.Equals(agent.characterName) select new Nullable<Point>(new Point(agent.Left - character.Location.X - character.BaseLocation.X, agent.Top - character.Location.Y - character.BaseLocation.Y)))
foreach (Nullable<Point> p in from character in Script.Instance.Characters where character.Name!.Equals(agent.characterName) select new Nullable<Point>(new Point(agent.Left - character.Location.X - character.BaseLocation.X, agent.Top - character.Location.Y - character.BaseLocation.Y)))
{
point = p;
}
Expand Down Expand Up @@ -5554,7 +5554,7 @@ private void Run()

if (this.IsVisible && !String.IsNullOrEmpty(sound.Path!) && !this.isMute)
{
foreach (var v in from character in Script.Instance.Characters where character.Name.Equals(this.characterName) select new { character.Script, sound.Path })
foreach (var v in from character in Script.Instance.Characters where character.Name!.Equals(this.characterName) select new { character.Script, sound.Path })
{
if (Path.GetExtension(v.Script).Equals(".zip", StringComparison.OrdinalIgnoreCase))
{
Expand Down Expand Up @@ -5662,7 +5662,7 @@ private void Run()
}
} while (q.Count > 0);

foreach (Character character in from character in Script.Instance.Characters where character.Name.Equals(this.characterName) select character)
foreach (Character character in from character in Script.Instance.Characters where character.Name!.Equals(this.characterName) select character)
{
Dictionary<string, Tuple<string, MemoryStream>> dictionary = new Dictionary<string, Tuple<string, MemoryStream>>();

Expand Down Expand Up @@ -5937,7 +5937,7 @@ private void Run()
List<Tuple<string, Dictionary<string, Tuple<string, MemoryStream>>>> contentList = new List<Tuple<string, Dictionary<string, Tuple<string, MemoryStream>>>>();
HashSet<string> keyHashSet = new HashSet<string>();

foreach (Character character in from character in Script.Instance.Characters where character.Name.Equals(this.characterName) select character)
foreach (Character character in from character in Script.Instance.Characters where character.Name!.Equals(this.characterName) select character)
{
Dictionary<string, Tuple<string, MemoryStream>> dictionary = new Dictionary<string, Tuple<string, MemoryStream>>();

Expand Down Expand Up @@ -6081,15 +6081,15 @@ private void Run()
}
});

foreach (Character character in from character in Script.Instance.Characters where character.Name.Equals(this.characterName) select character)
foreach (Character character in from character in Script.Instance.Characters where character.Name!.Equals(this.characterName) select character)
{
this.cachedMotionList.ForEach(delegate (Motion motion)
{
if (zIndexHashSet.Contains(motion.ZIndex))
{
if (character.HasTypes)
{
if (!character.Types.Contains(motion.Type))
if (motion.Type == null || !character.Types.Contains(motion.Type))
{
return;
}
Expand Down
10 changes: 5 additions & 5 deletions Apricot/Apricot.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows10.0.17763.0</TargetFramework>
<TargetFramework>net8.0-windows10.0.17763.0</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<ApplicationIcon>Apricot.ico</ApplicationIcon>
Expand All @@ -14,10 +14,10 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.4.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
<PackageReference Include="System.Composition" Version="7.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.8.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageReference Include="System.Composition" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit d1e5057

Please sign in to comment.