Zwischenstand: Am Updater fehlen noch kleinere Features und im BeWoMain sind noch Bugs drinne.
Aber das meiste haben wir hinter uns :)
This commit is contained in:
67
SharedLauncher/DataContract/BeWoProgramFileDC.cs
Normal file
67
SharedLauncher/DataContract/BeWoProgramFileDC.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BS.SharedLauncher.DataContract
|
||||
{
|
||||
[DebuggerDisplay("{FileName} ({FileVersion})")]
|
||||
[DataContract]
|
||||
public class BeWoProgramFileDC
|
||||
{
|
||||
public BeWoProgramFileDC() : this(null, null, null, FileToDo.Nuthing) { }
|
||||
|
||||
public BeWoProgramFileDC(string filename, Version version) : this(filename, version, null, FileToDo.Nuthing) { }
|
||||
|
||||
public BeWoProgramFileDC(string filename, Version version, byte[] data, FileToDo todo)
|
||||
{
|
||||
FileName = filename;
|
||||
FileVersion = version;
|
||||
FileData = data;
|
||||
ToDo = todo;
|
||||
}
|
||||
|
||||
public BeWoProgramFileDC(FileInfo fi)
|
||||
{
|
||||
FileName = fi.Name;
|
||||
FileExtension = fi.Extension;
|
||||
FullPath = fi.FullName;
|
||||
FileVersion = new Version(FileVersionInfo.GetVersionInfo(fi.FullName).FileVersion ?? "0.0.0.0");
|
||||
ToDo = FileToDo.Nuthing;
|
||||
|
||||
using (var md5 = MD5.Create())
|
||||
{
|
||||
using (var stream = File.OpenRead(FullPath))
|
||||
{
|
||||
Checksum = BitConverter.ToString(md5.ComputeHash(stream)).Replace("-", "").ToLowerInvariant();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public string FileName { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public string FileExtension { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public Version FileVersion { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public string FullPath { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public byte[] FileData { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public FileToDo ToDo { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public string Checksum { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user