(AGS): static members made non-static.

This commit is contained in:
morkt 2017-03-09 10:52:39 +04:00
parent 1942af2774
commit caeba06245
2 changed files with 17 additions and 15 deletions

View File

@ -2,7 +2,7 @@
//! \date Thu Nov 05 04:40:35 2015 //! \date Thu Nov 05 04:40:35 2015
//! \brief AnimeGameSystem resource archive. //! \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 // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to // of this software and associated documentation files (the "Software"), to
@ -106,10 +106,10 @@ namespace GameRes.Formats.Ags
public override object GetAccessWidget () 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; EncryptionScheme scheme;
if (string.IsNullOrEmpty (title) || !KnownSchemes.TryGetValue (title, out scheme)) if (string.IsNullOrEmpty (title) || !KnownSchemes.TryGetValue (title, out scheme))
@ -117,18 +117,19 @@ namespace GameRes.Formats.Ags
return scheme; return scheme;
} }
public static Dictionary<string, EncryptionScheme> KnownSchemes = new Dictionary<string, EncryptionScheme>(); AgsScheme m_scheme = new AgsScheme
static HashSet<string> EncryptedArchives = new HashSet<string>(); {
KnownSchemes = new Dictionary<string, EncryptionScheme>(),
EncryptedArchives = new HashSet<string>()
};
Dictionary<string, EncryptionScheme> KnownSchemes { get { return m_scheme.KnownSchemes; } }
HashSet<string> EncryptedArchives { get { return m_scheme.EncryptedArchives; } }
public override ResourceScheme Scheme public override ResourceScheme Scheme
{ {
get { return new AgsScheme { KnownSchemes = KnownSchemes, EncryptedArchives = EncryptedArchives }; } get { return m_scheme; }
set set { m_scheme = (AgsScheme)value; }
{
var ags = (AgsScheme)value;
KnownSchemes = ags.KnownSchemes;
EncryptedArchives = ags.EncryptedArchives;
}
} }
} }

View File

@ -1,4 +1,5 @@
using System.Linq; using System.Collections.Generic;
using System.Linq;
using System.Windows.Controls; using System.Windows.Controls;
using GameRes.Formats.Ags; using GameRes.Formats.Ags;
using GameRes.Formats.Strings; using GameRes.Formats.Strings;
@ -10,11 +11,11 @@ namespace GameRes.Formats.GUI
/// </summary> /// </summary>
public partial class WidgetAGS : StackPanel public partial class WidgetAGS : StackPanel
{ {
public WidgetAGS() public WidgetAGS (IEnumerable<string> known_titles)
{ {
InitializeComponent(); InitializeComponent();
var keys = new string[] { arcStrings.ArcNoEncryption }; 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) if (-1 == Scheme.SelectedIndex)
Scheme.SelectedIndex = 0; Scheme.SelectedIndex = 0;
} }