Skip to content

Commit

Permalink
#201 SImulator: block next button for small time when player presses …
Browse files Browse the repository at this point in the history
…the button
  • Loading branch information
VladimirKhil committed Feb 4, 2024
1 parent 1bb5e37 commit 0c09811
Show file tree
Hide file tree
Showing 25 changed files with 453 additions and 119 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Company>Khil-soft</Company>
<SIGameVersion>7.11.3</SIGameVersion>
<SIQuesterVersion>6.0.0</SIQuesterVersion>
<SImulatorVersion>2.14.0</SImulatorVersion>
<SImulatorVersion>2.15.0</SImulatorVersion>
</PropertyGroup>

<PropertyGroup>
Expand Down
58 changes: 34 additions & 24 deletions assets/siq_5.xsd
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="siq" targetNamespace="https://github.com/VladimirKhil/SI/blob/master/assets/siq_5.xsd" elementFormDefault="qualified" xmlns="https://github.com/VladimirKhil/SI/blob/master/assets/siq_5.xsd" xmlns:mstns="http://vladimirkhil.com/siq_5.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:schema id="siq" targetNamespace="https://github.com/VladimirKhil/SI/blob/master/assets/siq_5.xsd" elementFormDefault="qualified" xmlns="https://github.com/VladimirKhil/SI/blob/master/assets/siq_5.xsd" xmlns:mstns="https://github.com/VladimirKhil/SI/blob/master/assets/siq_5.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="package">
<xs:annotation>
<xs:documentation>SIGame question package (version 5)</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:all>
<xs:element name="tags" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
Expand All @@ -27,10 +27,10 @@
<xs:documentation>Global package info</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:all>
<xs:element name="Authors" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:all>
<xs:element name="Name" type="xs:string" minOccurs="1" maxOccurs="1">
<xs:annotation>
<xs:documentation>Author's name</xs:documentation>
Expand All @@ -56,7 +56,7 @@
<xs:documentation>Author's city</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:all>
<xs:attribute name="id" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>Unique author identifier</xs:documentation>
Expand All @@ -66,7 +66,7 @@
</xs:element>
<xs:element name="Sources" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:all>
<xs:element name="Author" type="xs:string" minOccurs="1" maxOccurs="1">
<xs:annotation>
<xs:documentation>Source's authos</xs:documentation>
Expand All @@ -92,18 +92,18 @@
<xs:documentation>Source's publish city</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:all>
<xs:attribute name="id" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>Unique source identifier</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="rounds" minOccurs="1" maxOccurs="1">
<xs:element name="rounds" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>Rounds</xs:documentation>
</xs:annotation>
Expand All @@ -114,13 +114,13 @@
<xs:documentation>Round</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:all>
<xs:element name="info" type="infoType" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>Round info</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="themes" minOccurs="1" maxOccurs="1">
<xs:element name="themes" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>Themes</xs:documentation>
</xs:annotation>
Expand All @@ -131,13 +131,13 @@
<xs:documentation>Theme</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:all>
<xs:element name="info" type="infoType" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>Theme info</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="questions" minOccurs="1" maxOccurs="1">
<xs:element name="questions" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>Questions</xs:documentation>
</xs:annotation>
Expand All @@ -148,7 +148,7 @@
<xs:documentation>Question</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:all>
<xs:element name="info" type="infoType" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>Question info</xs:documentation>
Expand Down Expand Up @@ -275,7 +275,7 @@
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="answer" type="xs:string" minOccurs="1" maxOccurs="unbounded">
<xs:element name="answer" type="xs:string" minOccurs="0" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>Answer</xs:documentation>
</xs:annotation>
Expand All @@ -297,7 +297,7 @@
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:all>
<xs:attribute name="price" type="xs:int" use="required">
<xs:annotation>
<xs:documentation>Question price</xs:documentation>
Expand All @@ -313,7 +313,7 @@
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:all>
<xs:attribute name="name" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>Theme name</xs:documentation>
Expand All @@ -324,7 +324,7 @@
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:all>
<xs:attribute name="name" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>Round name</xs:documentation>
Expand All @@ -340,7 +340,7 @@
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:all>
<xs:attribute name="id" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>Unique package identifier</xs:documentation>
Expand Down Expand Up @@ -388,6 +388,11 @@
<xs:documentation>Package language</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="generator" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>The tool package was created with</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="contactUri" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>Author contact URI</xs:documentation>
Expand All @@ -409,7 +414,7 @@
<xs:documentation>Content item type</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="isRef" type="xs:boolean" use="optional">
<xs:attribute name="isRef" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>Content item reference to resource marker</xs:documentation>
</xs:annotation>
Expand All @@ -419,12 +424,17 @@
<xs:documentation>Content item placement</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="duration" type="xs:duration" use="optional">
<xs:attribute name="duration" use="optional">
<xs:annotation>
<xs:documentation>Content item duration</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="\d{2}:\d{2}:\d{2}"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="waitForFinish" type="xs:boolean" use="optional">
<xs:attribute name="waitForFinish" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>Content item wait for finish marker</xs:documentation>
</xs:annotation>
Expand Down Expand Up @@ -486,7 +496,7 @@
</xs:sequence>
</xs:complexType>
<xs:complexType name="infoType">
<xs:sequence>
<xs:all>
<xs:element name="authors" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>Authors</xs:documentation>
Expand Down Expand Up @@ -530,6 +540,6 @@
<xs:documentation>Item information extension</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:all>
</xs:complexType>
</xs:schema>
2 changes: 1 addition & 1 deletion src/Common/SIEngine/SIEngine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Description>SIGame engine</Description>
<Company>Khil-soft</Company>
<Version>7.6.0</Version>
<Copyright>Copyright © Khil-soft 2007 - 2023</Copyright>
<Copyright>Copyright © Khil-soft 2007 - 2024</Copyright>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand Down
13 changes: 7 additions & 6 deletions src/Common/SIPackages/Containers/FolderSIPackageContainer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using SIPackages.Core;
using ZipUtils;

namespace SIPackages.Containers;

Expand All @@ -8,12 +9,12 @@ namespace SIPackages.Containers;
internal sealed class FolderSIPackageContainer : ISIPackageContainer
{
private readonly string _folder;
private readonly IReadOnlyDictionary<string, string> _fileNameMap;
private readonly IReadOnlyDictionary<string, ExtractedFileInfo> _fileNameMap;
private readonly bool _deleteOnClose;

public FolderSIPackageContainer(
string folder,
IReadOnlyDictionary<string, string> fileNameMap,
IReadOnlyDictionary<string, ExtractedFileInfo> fileNameMap,
bool deleteOnClose = true)
{
_folder = folder;
Expand All @@ -23,10 +24,10 @@ public FolderSIPackageContainer(

public ISIPackageContainer CopyTo(Stream stream, bool close, out bool isNew) => throw new NotImplementedException();

internal static ISIPackageContainer Open(string folder, IReadOnlyDictionary<string, string> fileNameMap) =>
internal static ISIPackageContainer Open(string folder, IReadOnlyDictionary<string, ExtractedFileInfo> fileNameMap) =>
new FolderSIPackageContainer(folder, fileNameMap);

internal static ISIPackageContainer Create(string folder) => new FolderSIPackageContainer(folder, new Dictionary<string, string>(), false);
internal static ISIPackageContainer Create(string folder) => new FolderSIPackageContainer(folder, new Dictionary<string, ExtractedFileInfo>(), false);

public void CreateStream(string name, string contentType)
{
Expand Down Expand Up @@ -128,9 +129,9 @@ private string GetName(string name)
{
if (!_fileNameMap.TryGetValue(name, out var mappedName))
{
mappedName = name;
return name;
}

return mappedName;
return mappedName.Name;
}
}
6 changes: 4 additions & 2 deletions src/Common/SIPackages/Containers/PackageContainerFactory.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace SIPackages.Containers;
using ZipUtils;

namespace SIPackages.Containers;

/// <summary>
/// Provides methods for creating package containers.
Expand All @@ -24,7 +26,7 @@ public static ISIPackageContainer CreatePackageContainer(Stream stream, bool lea
/// </summary>
/// <param name="folder">Container folder.</param>
/// <param name="fileNameMap">File name map.</param>
public static ISIPackageContainer GetPackageContainer(string folder, IReadOnlyDictionary<string, string> fileNameMap) =>
public static ISIPackageContainer GetPackageContainer(string folder, IReadOnlyDictionary<string, ExtractedFileInfo> fileNameMap) =>
FolderSIPackageContainer.Open(folder, fileNameMap);

/// <summary>
Expand Down
3 changes: 2 additions & 1 deletion src/Common/SIPackages/SIDocument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using SIPackages.Properties;
using System.Diagnostics;
using System.Xml;
using ZipUtils;

namespace SIPackages;

Expand Down Expand Up @@ -192,7 +193,7 @@ public static SIDocument Load(Stream stream, bool read = true, PackageLimits? li
/// <param name="read">Should the document be read-only.</param>
[Obsolete("Use ExtractToFolderAndLoadAsync")]
public static SIDocument Load(string folder, bool read = true) =>
Load(PackageContainerFactory.GetPackageContainer(folder, new Dictionary<string, string>()));
Load(PackageContainerFactory.GetPackageContainer(folder, new Dictionary<string, ExtractedFileInfo>()));

/// <summary>
/// Extracts document to folder and load from it.
Expand Down
2 changes: 1 addition & 1 deletion src/Common/SIPackages/SIPackages.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<ItemGroup>
<PackageReference Include="Ensure.That" Version="10.1.0" />
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.0" />
<PackageReference Include="VKhil.ZipUtils" Version="1.0.5" />
<PackageReference Include="VKhil.ZipUtils" Version="1.1.0" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
Expand Down
2 changes: 1 addition & 1 deletion src/Common/SIPackages/ZipExtractorExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ internal static class PackageExtractor
/// <param name="maxAllowedDataLength">Maximum allowed length of extracted data in archive.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>Map of archive file names to extracted file names.</returns>
internal static Task<IReadOnlyDictionary<string, string>> ExtractPackageToFolderAsync(
internal static Task<IReadOnlyDictionary<string, ExtractedFileInfo>> ExtractPackageToFolderAsync(
string sourceArchiveFilePath,
string destinationFolderPath,
long maxAllowedDataLength = long.MaxValue,
Expand Down
2 changes: 1 addition & 1 deletion src/Common/SIUI.Model/SIUI.Model.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Company>Khil-soft</Company>
<Description>Game table model</Description>
<Version>7.6.0</Version>
<Copyright>Copyright © Khil-soft 2010 - 2023</Copyright>
<Copyright>Copyright © Khil-soft 2010 - 2024</Copyright>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Common/SIUI.ViewModel/SIUI.ViewModel.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Company>Khil-soft</Company>
<Version>7.6.0</Version>
<Description>Game table view model</Description>
<Copyright>Copyright © Khil-soft 2012 - 2023</Copyright>
<Copyright>Copyright © Khil-soft 2012 - 2024</Copyright>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Common/SIUI/SIUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Company>Khil-soft</Company>
<Product>SIUI</Product>
<Description>SIGame table ui</Description>
<Copyright>Copyright © Khil-soft 2010 - 2023</Copyright>
<Copyright>Copyright © Khil-soft 2010 - 2024</Copyright>
<Version>7.7.3</Version>
<OutputPath>bin\$(Configuration)\</OutputPath>
<UseWPF>true</UseWPF>
Expand Down Expand Up @@ -33,7 +33,7 @@
<Resource Include="Fonts\Clefs.ttf" />
<Resource Include="Fonts\DINCondensedC.ttf" />
<None Include="key.snk" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2088.41" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2210.55" />
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Product>SImulator.ViewModel</Product>
<Description>SImulator view model</Description>
<Version>$(SImulatorVersion)</Version>
<Copyright>Copyright © Khil-soft 2010 - 2023</Copyright>
<Copyright>Copyright © Khil-soft 2010 - 2024</Copyright>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand Down
Loading

0 comments on commit 0c09811

Please sign in to comment.