mirror of
https://github.com/JDM170/SteamAchievementManager
synced 2025-12-10 05:37:18 +07:00
Initial code.
This commit is contained in:
35
SAM.Game/Stats/AchievementDefinition.cs
Normal file
35
SAM.Game/Stats/AchievementDefinition.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
/* Copyright (c) 2017 Rick (rick 'at' gibbed 'dot' us)
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would
|
||||
* be appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and must not
|
||||
* be misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
*/
|
||||
|
||||
namespace SAM.Game.Stats
|
||||
{
|
||||
internal class AchievementDefinition
|
||||
{
|
||||
public string Id;
|
||||
public string Name;
|
||||
public string Description;
|
||||
public string IconNormal;
|
||||
public string IconLocked;
|
||||
public bool IsHidden;
|
||||
public int Permission;
|
||||
}
|
||||
}
|
||||
47
SAM.Game/Stats/AchievementInfo.cs
Normal file
47
SAM.Game/Stats/AchievementInfo.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
/* Copyright (c) 2017 Rick (rick 'at' gibbed 'dot' us)
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would
|
||||
* be appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and must not
|
||||
* be misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
*/
|
||||
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace SAM.Game.Stats
|
||||
{
|
||||
internal class AchievementInfo
|
||||
{
|
||||
public string Id;
|
||||
public bool IsAchieved;
|
||||
public int Permission;
|
||||
public string IconNormal;
|
||||
public string IconLocked;
|
||||
public string Name;
|
||||
public string Description;
|
||||
public ListViewItem Item;
|
||||
|
||||
#region public int ImageIndex;
|
||||
public int ImageIndex
|
||||
{
|
||||
get { return this.Item.ImageIndex; }
|
||||
|
||||
set { this.Item.ImageIndex = value; }
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
33
SAM.Game/Stats/FloatStatDefinition.cs
Normal file
33
SAM.Game/Stats/FloatStatDefinition.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
/* Copyright (c) 2017 Rick (rick 'at' gibbed 'dot' us)
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would
|
||||
* be appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and must not
|
||||
* be misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
*/
|
||||
|
||||
namespace SAM.Game.Stats
|
||||
{
|
||||
internal class FloatStatDefinition : StatDefinition
|
||||
{
|
||||
public float MinValue;
|
||||
public float MaxValue;
|
||||
public float MaxChange;
|
||||
public bool IncrementOnly;
|
||||
public float DefaultValue;
|
||||
}
|
||||
}
|
||||
52
SAM.Game/Stats/FloatStatInfo.cs
Normal file
52
SAM.Game/Stats/FloatStatInfo.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
/* Copyright (c) 2017 Rick (rick 'at' gibbed 'dot' us)
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would
|
||||
* be appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and must not
|
||||
* be misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
*/
|
||||
|
||||
namespace SAM.Game.Stats
|
||||
{
|
||||
internal class FloatStatInfo : StatInfo
|
||||
{
|
||||
public float OriginalValue;
|
||||
public float FloatValue;
|
||||
|
||||
public override object Value
|
||||
{
|
||||
get { return this.FloatValue; }
|
||||
set
|
||||
{
|
||||
var f = float.Parse((string)value);
|
||||
|
||||
if ((this.Permission & 2) != 0 &&
|
||||
this.FloatValue.Equals(f) == false)
|
||||
{
|
||||
throw new StatIsProtectedException();
|
||||
}
|
||||
|
||||
this.FloatValue = f;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsModified
|
||||
{
|
||||
get { return this.FloatValue.Equals(this.OriginalValue) == false; }
|
||||
}
|
||||
}
|
||||
}
|
||||
52
SAM.Game/Stats/IntStatInfo.cs
Normal file
52
SAM.Game/Stats/IntStatInfo.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
/* Copyright (c) 2017 Rick (rick 'at' gibbed 'dot' us)
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would
|
||||
* be appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and must not
|
||||
* be misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
*/
|
||||
|
||||
namespace SAM.Game.Stats
|
||||
{
|
||||
internal class IntStatInfo : StatInfo
|
||||
{
|
||||
public int OriginalValue;
|
||||
public int IntValue;
|
||||
|
||||
public override object Value
|
||||
{
|
||||
get { return this.IntValue; }
|
||||
set
|
||||
{
|
||||
var i = int.Parse((string)value);
|
||||
|
||||
if ((this.Permission & 2) != 0 &&
|
||||
this.IntValue != i)
|
||||
{
|
||||
throw new StatIsProtectedException();
|
||||
}
|
||||
|
||||
this.IntValue = i;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsModified
|
||||
{
|
||||
get { return this.IntValue != this.OriginalValue; }
|
||||
}
|
||||
}
|
||||
}
|
||||
33
SAM.Game/Stats/IntegerStatDefinition.cs
Normal file
33
SAM.Game/Stats/IntegerStatDefinition.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
/* Copyright (c) 2017 Rick (rick 'at' gibbed 'dot' us)
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would
|
||||
* be appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and must not
|
||||
* be misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
*/
|
||||
|
||||
namespace SAM.Game.Stats
|
||||
{
|
||||
internal class IntegerStatDefinition : StatDefinition
|
||||
{
|
||||
public int MinValue;
|
||||
public int MaxValue;
|
||||
public int MaxChange;
|
||||
public bool IncrementOnly;
|
||||
public int DefaultValue;
|
||||
}
|
||||
}
|
||||
31
SAM.Game/Stats/StatDefinition.cs
Normal file
31
SAM.Game/Stats/StatDefinition.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
/* Copyright (c) 2017 Rick (rick 'at' gibbed 'dot' us)
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would
|
||||
* be appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and must not
|
||||
* be misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
*/
|
||||
|
||||
namespace SAM.Game.Stats
|
||||
{
|
||||
internal abstract class StatDefinition
|
||||
{
|
||||
public string Id;
|
||||
public string DisplayName;
|
||||
public int Permission;
|
||||
}
|
||||
}
|
||||
35
SAM.Game/Stats/StatFlags.cs
Normal file
35
SAM.Game/Stats/StatFlags.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
/* Copyright (c) 2017 Rick (rick 'at' gibbed 'dot' us)
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would
|
||||
* be appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and must not
|
||||
* be misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
*/
|
||||
|
||||
using System;
|
||||
|
||||
namespace SAM.Game.Stats
|
||||
{
|
||||
[Flags]
|
||||
internal enum StatFlags
|
||||
{
|
||||
None = 0,
|
||||
IncrementOnly = 1 << 0,
|
||||
Protected = 1 << 1,
|
||||
UnknownPermission = 1 << 2,
|
||||
}
|
||||
}
|
||||
46
SAM.Game/Stats/StatInfo.cs
Normal file
46
SAM.Game/Stats/StatInfo.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
/* Copyright (c) 2017 Rick (rick 'at' gibbed 'dot' us)
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would
|
||||
* be appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and must not
|
||||
* be misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
*/
|
||||
|
||||
namespace SAM.Game.Stats
|
||||
{
|
||||
internal abstract class StatInfo
|
||||
{
|
||||
public abstract bool IsModified { get; }
|
||||
public string Id { get; set; }
|
||||
public string DisplayName { get; set; }
|
||||
public abstract object Value { get; set; }
|
||||
public bool IsIncrementOnly { get; set; }
|
||||
public int Permission { get; set; }
|
||||
|
||||
public string Extra
|
||||
{
|
||||
get
|
||||
{
|
||||
var flags = StatFlags.None;
|
||||
flags |= this.IsIncrementOnly == false ? 0 : StatFlags.IncrementOnly;
|
||||
flags |= ((this.Permission & 2) != 0) == false ? 0 : StatFlags.Protected;
|
||||
flags |= ((this.Permission & ~2) != 0) == false ? 0 : StatFlags.UnknownPermission;
|
||||
return flags.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
30
SAM.Game/Stats/StatIsProtectedException.cs
Normal file
30
SAM.Game/Stats/StatIsProtectedException.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
/* Copyright (c) 2017 Rick (rick 'at' gibbed 'dot' us)
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would
|
||||
* be appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and must not
|
||||
* be misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
*/
|
||||
|
||||
using System;
|
||||
|
||||
namespace SAM.Game.Stats
|
||||
{
|
||||
internal class StatIsProtectedException : Exception
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user