73 lines
2.1 KiB
C#
73 lines
2.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using System.IO;
|
|
|
|
namespace GamerServices
|
|
{
|
|
public partial class FormChecksum : Form
|
|
{
|
|
public int GameID = 0;
|
|
|
|
public FormChecksum()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void buttonView_Click(object sender, EventArgs e)
|
|
{
|
|
comboBox1.Items.Clear();
|
|
adddir("");
|
|
}
|
|
|
|
private void FormChecksum_Load(object sender, EventArgs e)
|
|
{
|
|
adddir("");
|
|
}
|
|
|
|
private void comboBox1_SelectedValueChanged(object sender, EventArgs e) {
|
|
String Filename = "Games/" + this.GameID.ToString() + "/" + this.comboBox1.Text;
|
|
|
|
if (File.Exists(Filename))
|
|
{
|
|
MrAG.Checksum.FileInfo Checksum = MrAG.Checksum.GetInfo(Filename);
|
|
|
|
this.textFileSize.Text = Checksum.Size + " bytes";
|
|
this.textFileHash.Text = Checksum.Hash;
|
|
|
|
this.textCreationTime.Text = Checksum.DateCreated;
|
|
this.textLastAccessTime.Text = Checksum.LastAccessed;
|
|
this.textLastWriteTime.Text = Checksum.LastWritten;
|
|
}
|
|
}
|
|
|
|
private void adddir(string addpath) {
|
|
string startdir = Directory.GetCurrentDirectory() + "/Games/" + GameID + addpath;
|
|
string reppath = Directory.GetCurrentDirectory() + "/Games/" + GameID;
|
|
int startpos = reppath.Length;
|
|
|
|
|
|
foreach (string file in Directory.GetFiles(startdir)) {
|
|
string f = file.Substring(startpos + 1);
|
|
|
|
if (f != "version.txt")
|
|
comboBox1.Items.Add(f);
|
|
}
|
|
|
|
|
|
foreach (string dir in Directory.GetDirectories(startdir)) {
|
|
adddir(dir.Substring(startpos));
|
|
}
|
|
|
|
if (comboBox1.Text == "") {
|
|
comboBox1.SelectedIndex = 0;
|
|
}
|
|
}
|
|
}
|
|
}
|