From caeba062451c24239773142ee60eb6ed6ce2323a Mon Sep 17 00:00:00 2001 From: morkt Date: Thu, 9 Mar 2017 10:52:39 +0400 Subject: [PATCH] (AGS): static members made non-static. --- ArcFormats/AnimeGameSystem/ArcDAT.cs | 25 ++++++++++---------- ArcFormats/AnimeGameSystem/WidgetAGS.xaml.cs | 7 +++--- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/ArcFormats/AnimeGameSystem/ArcDAT.cs b/ArcFormats/AnimeGameSystem/ArcDAT.cs index 75eae8c0..a57ebb30 100644 --- a/ArcFormats/AnimeGameSystem/ArcDAT.cs +++ b/ArcFormats/AnimeGameSystem/ArcDAT.cs @@ -2,7 +2,7 @@ //! \date Thu Nov 05 04:40:35 2015 //! \brief AnimeGameSystem resource archive. // -// Copyright (C) 2015-2016 by morkt +// Copyright (C) 2015-2017 by morkt // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to @@ -106,10 +106,10 @@ namespace GameRes.Formats.Ags public override object GetAccessWidget () { - return new GUI.WidgetAGS(); + return new GUI.WidgetAGS (KnownSchemes.Keys); } - public static EncryptionScheme GetScheme (string title) + public EncryptionScheme GetScheme (string title) { EncryptionScheme scheme; if (string.IsNullOrEmpty (title) || !KnownSchemes.TryGetValue (title, out scheme)) @@ -117,18 +117,19 @@ namespace GameRes.Formats.Ags return scheme; } - public static Dictionary KnownSchemes = new Dictionary(); - static HashSet EncryptedArchives = new HashSet(); + AgsScheme m_scheme = new AgsScheme + { + KnownSchemes = new Dictionary(), + EncryptedArchives = new HashSet() + }; + + Dictionary KnownSchemes { get { return m_scheme.KnownSchemes; } } + HashSet EncryptedArchives { get { return m_scheme.EncryptedArchives; } } public override ResourceScheme Scheme { - get { return new AgsScheme { KnownSchemes = KnownSchemes, EncryptedArchives = EncryptedArchives }; } - set - { - var ags = (AgsScheme)value; - KnownSchemes = ags.KnownSchemes; - EncryptedArchives = ags.EncryptedArchives; - } + get { return m_scheme; } + set { m_scheme = (AgsScheme)value; } } } diff --git a/ArcFormats/AnimeGameSystem/WidgetAGS.xaml.cs b/ArcFormats/AnimeGameSystem/WidgetAGS.xaml.cs index b01aecc9..a6ef6dbb 100644 --- a/ArcFormats/AnimeGameSystem/WidgetAGS.xaml.cs +++ b/ArcFormats/AnimeGameSystem/WidgetAGS.xaml.cs @@ -1,4 +1,5 @@ -using System.Linq; +using System.Collections.Generic; +using System.Linq; using System.Windows.Controls; using GameRes.Formats.Ags; using GameRes.Formats.Strings; @@ -10,11 +11,11 @@ namespace GameRes.Formats.GUI /// public partial class WidgetAGS : StackPanel { - public WidgetAGS() + public WidgetAGS (IEnumerable known_titles) { InitializeComponent(); var keys = new string[] { arcStrings.ArcNoEncryption }; - Scheme.ItemsSource = keys.Concat (DatOpener.KnownSchemes.Keys.OrderBy (x => x)); + Scheme.ItemsSource = keys.Concat (known_titles.OrderBy (x => x)); if (-1 == Scheme.SelectedIndex) Scheme.SelectedIndex = 0; }