Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/hakchi2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2017-02-16 04:47:20 +0300
committerAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2017-02-16 04:47:20 +0300
commit05c48013ef1dd208eab51d8bb592b7cd22cc1ab3 (patch)
treea61523105ae6104cb697d674b0eedbae11003069 /NesMenuFolder.cs
parentb259fe4222817ccc0ae2f552f879e22d2c3c8681 (diff)
Fixes
Diffstat (limited to 'NesMenuFolder.cs')
-rw-r--r--NesMenuFolder.cs27
1 files changed, 11 insertions, 16 deletions
diff --git a/NesMenuFolder.cs b/NesMenuFolder.cs
index a5db2d33..42c562a9 100644
--- a/NesMenuFolder.cs
+++ b/NesMenuFolder.cs
@@ -17,7 +17,14 @@ namespace com.clusterrr.hakchi_gui
static ResourceManager rm = Resources.ResourceManager;
public static readonly string FolderImagesDirectory = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "folder_images");
- private string code = null;
+ private int childIndex = 0;
+
+ public int ChildIndex
+ {
+ get { return childIndex; }
+ set { childIndex = value; }
+ }
+
public enum Priority
{
Leftmost = 0,
@@ -30,8 +37,7 @@ namespace com.clusterrr.hakchi_gui
public string Code
{
- get { return code; }
- set { code = value; }
+ get { return string.Format("CLV-S-{0:D5}", childIndex); }
}
private string name = null;
@@ -122,7 +128,6 @@ namespace com.clusterrr.hakchi_gui
public NesMenuFolder(string name = "Folder", string imageId = "folder")
{
- Code = GenerateCode((uint)rnd.Next());
Name = name;
Position = Priority.Right;
ImageId = imageId;
@@ -203,7 +208,7 @@ namespace com.clusterrr.hakchi_gui
}
}
- public void Save(string path, int index)
+ public void Save(string path)
{
Directory.CreateDirectory(path);
var ConfigPath = Path.Combine(path, Code + ".desktop");
@@ -247,7 +252,7 @@ namespace com.clusterrr.hakchi_gui
"SortRawTitle={5}\n" +
"SortRawPublisher={6}\n" +
"Copyright=hakchi2 ©2017 Alexey 'Cluster' Avdyukhin\n",
- Code, index, Name ?? Code, Players, ReleaseDate,
+ Code, ChildIndex, Name ?? Code, Players, ReleaseDate,
prefix + (Name ?? Code).ToLower(), (Publisher ?? "").ToUpper(),
Simultaneous, Initial)
);
@@ -255,16 +260,6 @@ namespace com.clusterrr.hakchi_gui
ImageThumbnail.Save(ThumnnailIconPath, ImageFormat.Png);
}
- private static string GenerateCode(uint crc32)
- {
- return string.Format("CLV-S-{0}{1}{2}{3}{4}",
- (char)('A' + (crc32 % 26)),
- (char)('A' + (crc32 >> 5) % 26),
- (char)('A' + ((crc32 >> 10) % 26)),
- (char)('A' + ((crc32 >> 15) % 26)),
- (char)('A' + ((crc32 >> 20) % 26)));
- }
-
public override string ToString()
{
return Name ?? Code;