KlassenDLL im Main integriert
This commit is contained in:
13
SanSystem/SanShared/BerichtWorker.cs
Normal file
13
SanSystem/SanShared/BerichtWorker.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SanShared
|
||||
{
|
||||
public class BerichtWorker
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
27
SanSystem/SanShared/BilderObject.cs
Normal file
27
SanSystem/SanShared/BilderObject.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SanShared
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class BilderObject
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Kommentar { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Path { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int ImgID { get; set; }
|
||||
}
|
||||
}
|
||||
170
SanSystem/SanShared/Dongle.cs
Normal file
170
SanSystem/SanShared/Dongle.cs
Normal file
@@ -0,0 +1,170 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CodeMeter;
|
||||
|
||||
namespace SanShared
|
||||
{
|
||||
//4e 6a 41 77 4e 6a 51 7a 51 44 4d 78 4d 7a 6b 79 5a 54 4d 30 4d 6d 55 7a 4d 47 35 4c 61 32 55 7a 51 31 46 30 52 33 64 46 5a 45 68 35 56 57 74 47 61 7a 5a 30 61 48 70 55 57 69 39 58 64 6b 78 4a 54 32 78 43 62 6b 74 58 52 58 46 57 63 30 5a 73 64 7a 41 39
|
||||
public class Dongle : IDisposable
|
||||
{
|
||||
uint FirmCode;
|
||||
uint ProductCode;
|
||||
public string SyncfusionKey = "";
|
||||
|
||||
Api cmApi;
|
||||
CmCredential cmCred;
|
||||
CmAccess2 cmAcc;
|
||||
HCMSysEntry hcmse;
|
||||
CmBoxInfo cmBoxInfo;
|
||||
CmBoxEntry2 BoxContent;
|
||||
|
||||
public Dongle(uint ProductCode)
|
||||
{
|
||||
#if !DEBUG
|
||||
this.FirmCode = 103086;
|
||||
this.ProductCode = ProductCode;
|
||||
#else
|
||||
return;
|
||||
this.FirmCode = 10;
|
||||
this.ProductCode = 1;
|
||||
#endif
|
||||
|
||||
|
||||
cmApi = new Api();
|
||||
cmCred = new CmCredential();
|
||||
cmAcc = new CmAccess2();
|
||||
|
||||
cmAcc.Credential = cmCred;
|
||||
|
||||
cmAcc.Ctrl |= CmAccess.Option.UserLimit;
|
||||
cmAcc.FirmCode = this.FirmCode;
|
||||
cmAcc.ProductCode = this.ProductCode;
|
||||
|
||||
|
||||
hcmse = cmApi.CmAccess2(CmAccessOption.Local, cmAcc);
|
||||
if (hcmse == null)
|
||||
{
|
||||
ErrorCodes2 code = cmApi.CmGetLastErrorCode2();
|
||||
string output = string.Format("{0}", code);
|
||||
|
||||
}
|
||||
|
||||
if (!CheckDongleVorhanden())
|
||||
throw new Exception("Dongle not connected");
|
||||
|
||||
cmBoxInfo = new CmBoxInfo();
|
||||
|
||||
CmGetBoxContentsOption boxOptions = new CmGetBoxContentsOption();
|
||||
boxOptions = CmGetBoxContentsOption.AllEntries;
|
||||
|
||||
CmBoxEntry2[] tmpBoxContent;
|
||||
|
||||
tmpBoxContent = cmApi.CmGetBoxContents2(hcmse, boxOptions, this.FirmCode, cmBoxInfo);
|
||||
|
||||
CmEntryData[] pCmBoxEntry = (CmEntryData[])cmApi.CmGetInfo(hcmse, CmGetInfoOption.EntryData);
|
||||
|
||||
for (int i = 0; i < pCmBoxEntry.Length; i++)
|
||||
{
|
||||
switch (pCmBoxEntry[i].Ctrl & 0x0ffff)
|
||||
{
|
||||
case (uint)CodeMeter.GlobalEntryOption.ProtectedData:
|
||||
// Transfer to transformed byte
|
||||
uint length = pCmBoxEntry[i].DataLen;
|
||||
byte[] datas = new byte[length];
|
||||
for(uint f = 0; f < length; f++)
|
||||
{
|
||||
datas[f] = pCmBoxEntry[i].Data[f];
|
||||
}
|
||||
|
||||
|
||||
SyncfusionKey = Encoding.ASCII.GetString(datas);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (CmBoxEntry2 boxes in tmpBoxContent)
|
||||
{
|
||||
if (boxes.ProductCode == this.ProductCode)
|
||||
{
|
||||
this.BoxContent = boxes;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
~Dongle()
|
||||
{
|
||||
CleanDongle();
|
||||
}
|
||||
|
||||
public void CleanDongle()
|
||||
{
|
||||
#if DEBUG
|
||||
return;
|
||||
#endif
|
||||
cmApi.CmRelease(hcmse);
|
||||
}
|
||||
|
||||
public bool CheckDongleVorhanden()
|
||||
{
|
||||
#if LAPTOP
|
||||
return true;
|
||||
#else
|
||||
if (hcmse == null)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
public string GetDongleSerial()
|
||||
{
|
||||
|
||||
CmBoxInfo res = (CmBoxInfo)cmApi.CmGetInfo(hcmse, CmGetInfoOption.BoxInfo);
|
||||
if (null != res)
|
||||
{
|
||||
return res.SerialNumber.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Fehler beim aufrufen der Seriennummer");
|
||||
}
|
||||
}
|
||||
|
||||
public uint GetFeatureMap()
|
||||
{
|
||||
return BoxContent.FeatureMap;
|
||||
}
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
public bool IsLicensed(byte neededMask)
|
||||
{
|
||||
#if DEBUG
|
||||
return true;
|
||||
#else
|
||||
uint DongleFeature = GetFeatureMap();
|
||||
|
||||
//Trace.WriteLine("DongleFeature: " + DongleFeature);
|
||||
|
||||
byte DongleFeatureB = (byte)DongleFeature;
|
||||
|
||||
if ((DongleFeatureB & neededMask) == neededMask)
|
||||
return true;
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
CleanDongle();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
28
SanSystem/SanShared/Exceptions/CSVImportException.cs
Normal file
28
SanSystem/SanShared/Exceptions/CSVImportException.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SanShared.Exceptions
|
||||
{
|
||||
public class CSVImportException : Exception
|
||||
{
|
||||
public CSVImportException()
|
||||
{
|
||||
}
|
||||
|
||||
public CSVImportException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
public CSVImportException(string message, Exception innerException) : base(message, innerException)
|
||||
{
|
||||
}
|
||||
|
||||
protected CSVImportException(SerializationInfo info, StreamingContext context) : base(info, context)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SanShared.Exceptions
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class DataBaseVersionMismatchException : Exception
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public DataBaseVersionMismatchException()
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
public DataBaseVersionMismatchException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="innerException"></param>
|
||||
public DataBaseVersionMismatchException(string message, Exception innerException) : base(message, innerException)
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="info"></param>
|
||||
/// <param name="context"></param>
|
||||
protected DataBaseVersionMismatchException(SerializationInfo info, StreamingContext context) : base(info, context)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
45
SanSystem/SanShared/Exceptions/LangNotFoundException.cs
Normal file
45
SanSystem/SanShared/Exceptions/LangNotFoundException.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SanShared.Exceptions
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class LangNotFoundException : Exception
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public LangNotFoundException()
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
public LangNotFoundException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="innerException"></param>
|
||||
public LangNotFoundException(string message, Exception innerException) : base(message, innerException)
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="info"></param>
|
||||
/// <param name="context"></param>
|
||||
protected LangNotFoundException(SerializationInfo info, StreamingContext context) : base(info, context)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
25
SanSystem/SanShared/IAuftraggeber.cs
Normal file
25
SanSystem/SanShared/IAuftraggeber.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
namespace SanShared
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public interface IAuftraggeber
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
string Name { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
string Strasse { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
string Ort { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
string Ansprechpartner { get; set; }
|
||||
}
|
||||
}
|
||||
28
SanSystem/SanShared/IImportedObjekte.cs
Normal file
28
SanSystem/SanShared/IImportedObjekte.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SanShared
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface zur Import von Daten
|
||||
/// </summary>
|
||||
public interface IImportedObjekte
|
||||
{
|
||||
/// <summary>
|
||||
/// Angaben zur XMLDatei die importiert werden soll
|
||||
/// </summary>
|
||||
string XMLFile { get; set; }
|
||||
/// <summary>
|
||||
/// Angaben zur Projektnummern die eingetragen werden soll in die Objekte
|
||||
/// </summary>
|
||||
string Projektnummer { get; set; }
|
||||
/// <summary>
|
||||
/// Funktion der die Inspektionsobjekte übergibt
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
List<IInspektionsobjekt> GetInspektionsobjekte();
|
||||
}
|
||||
}
|
||||
12
SanSystem/SanShared/IInspektionsobjekt.cs
Normal file
12
SanSystem/SanShared/IInspektionsobjekt.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SanShared
|
||||
{
|
||||
public interface IInspektionsobjekt
|
||||
{
|
||||
}
|
||||
}
|
||||
23
SanSystem/SanShared/IMakeProtokol.cs
Normal file
23
SanSystem/SanShared/IMakeProtokol.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SanShared
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public interface IMakeProtokol
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="destinationPath"></param>
|
||||
/// <param name="projekt">Projekt</param>
|
||||
/// <returns></returns>
|
||||
Hashtable MakeProtokoll(string destinationPath, IProjekt projekt, DateTime offset);
|
||||
}
|
||||
}
|
||||
9
SanSystem/SanShared/IProjekt.cs
Normal file
9
SanSystem/SanShared/IProjekt.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace SanShared
|
||||
{
|
||||
public interface IProjekt
|
||||
{
|
||||
IAuftraggeber Auftraggeber { get; set; }
|
||||
string SanierungsIDPrefix { get; set; }
|
||||
string SanierungsIDSuffix { get; set; }
|
||||
}
|
||||
}
|
||||
24
SanSystem/SanShared/IReadCSVData.cs
Normal file
24
SanSystem/SanShared/IReadCSVData.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SanShared
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public interface IReadCSVData
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
List<UVcsvStrukture> ReadCSVStrukture();
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
string[] Input { get; }
|
||||
}
|
||||
}
|
||||
21
SanSystem/SanShared/ITemperature.cs
Normal file
21
SanSystem/SanShared/ITemperature.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SanShared
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public interface ITemperature
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <returns></returns>
|
||||
double GetTemperatur(out string message);
|
||||
}
|
||||
}
|
||||
35
SanSystem/SanShared/UVcsvStrukture.cs
Normal file
35
SanSystem/SanShared/UVcsvStrukture.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SanShared
|
||||
{
|
||||
/// <summary>
|
||||
/// CSV Dateistruktur
|
||||
/// </summary>
|
||||
public class UVcsvStrukture
|
||||
{
|
||||
DateTime zeitstempel;
|
||||
double temperatur;
|
||||
int druck;
|
||||
double geschwindigkeit;
|
||||
/// <summary>
|
||||
/// Zeitstempel vom Eintrag
|
||||
/// </summary>
|
||||
public DateTime Zeitstempel { get => zeitstempel; set => zeitstempel = value; }
|
||||
/// <summary>
|
||||
/// Temperatur anzeige vom Eintrag
|
||||
/// </summary>
|
||||
public double Temperatur { get => temperatur; set => temperatur = value; }
|
||||
/// <summary>
|
||||
/// Druckanzeige vom Eintrag
|
||||
/// </summary>
|
||||
public int Druck { get => druck; set => druck = value; }
|
||||
/// <summary>
|
||||
/// Geschwindigkeit vom Eintrag
|
||||
/// </summary>
|
||||
public double Geschwindigkeit { get => geschwindigkeit; set => geschwindigkeit = value; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user