public bool Write(UInt64 val) { DTPMaster.CheckConnAndVal(); if (ph.File_Append(BitConverter.GetBytes(val))) { cacheLength += _Ui64; CursorPos += _Ui64; return(true); } return(false); }
internal SecurityManager(DTPMaster dTPMaster) { ParentMaster = dTPMaster; IsValidationRequired = ParentMaster.ph.Security_IsValidationRequired(); try { _validated = ParentMaster.ph.Device_DataTest(new byte[] { 1, 2 }); } catch (SecurityException) { _validated = false; } }
public bool Write(byte val) { DTPMaster.CheckConnAndVal(); if (ph.File_Append(new byte[1] { val })) { cacheLength += _Ui8; CursorPos += _Ui8; return(true); } return(false); }
public bool Validate(SecurityKey Key) { if (IsValidated) { return(true); } DTPMaster.CheckConnAndVal(true); if (ParentMaster.ph.Security_Validate(Key.key)) { _validKey = Key; return(true); } return(false); }
public SecurityForm(DTPMaster master) { InitializeComponent(); Master = master; radioButton1.Checked = !master.SecurityManager.IsValidationRequired; // radioButton2.Checked = master.SecurityManager.IsValidationRequired; if (master.SecurityManager.IsValidationRequired) { radioButton2.Checked = true; } button2.Enabled = !radioButton1.Checked; button3.Enabled = !radioButton1.Checked; }
public void Close() { DTPMaster.CheckConnAndVal(); if (!IsOpen) { throw new FileHandlerException("Файл закрыт"); } var res = Master.ph.File_Close(); if (!res) { throw new FailOperationException("Не удалось закрыть файл"); } IsOpen = false; IsGlobalOpenedFiles = false; }
public SdCardBinnaryFileReadResult <byte[]> ReadByteArray(UInt32 length) { DTPMaster.CheckConnAndVal(); if (CursorPos + length > cacheLength) { throw new ArgumentOutOfRangeException(); } var res = ph.File_Read(CursorPos, length); if (res.Status == GeneralPacketHandler.WriteReadFileHandleResult.OK) { CursorPos += length; return(new SdCardBinnaryFileReadResult <byte[]>(res.Result, true)); } return(new SdCardBinnaryFileReadResult <byte[]>(new byte[0], false)); }
private SdCardBinnaryFileReadResult <object> ReadDouble() { DTPMaster.CheckConnAndVal(); if (CursorPos + _D > cacheLength) { throw new ArgumentOutOfRangeException(); } var res = ph.File_Read(CursorPos, _D); if (res.Status == GeneralPacketHandler.WriteReadFileHandleResult.OK) { CursorPos += _D; return(new SdCardBinnaryFileReadResult <object>(BitConverter.ToDouble(res.Result, 0), true)); } return(new SdCardBinnaryFileReadResult <object>(0, false)); }
private SdCardBinnaryFileReadResult <object> ReadBool() { DTPMaster.CheckConnAndVal(); if (CursorPos + _Ui8 > cacheLength) { throw new ArgumentOutOfRangeException(); } var res = ph.File_Read(CursorPos, _Ui8); if (res.Status == GeneralPacketHandler.WriteReadFileHandleResult.OK) { CursorPos += _Ui8; return(new SdCardBinnaryFileReadResult <object>(res.Result[0] == 1, true)); } return(new SdCardBinnaryFileReadResult <object>(0, false)); }
public void Delete(bool DeleteSubItems) { DTPMaster.CheckConnAndVal(); if (DirectoryPath == "/") { throw new FileHandlerException("Невозможно удалить корень -_-"); } if (!IsExists) { throw new FileHandlerException("Папка не существует"); } var res = master.ph.Dir_Delete(DirectoryPath, DeleteSubItems); if (res != GeneralPacketHandler.FileDirHandleResult.OK) { throw new FailOperationException(res); } }
public SdCardDirectory Create(bool CreateNecessary) { DTPMaster.CheckConnAndVal(); if (DirectoryPath == "/") { throw new FileHandlerException("Невозможно создать корень -_-"); } if (IsExists) { throw new FileHandlerException("Папка уже существует"); } var res = master.ph.Dir_Create(DirectoryPath, CreateNecessary); if (res != GeneralPacketHandler.FileDirHandleResult.OK) { throw new FailOperationException("Не удалось создать папку", res); } return(this); }
public void ClearAllBytes() { DTPMaster.CheckConnAndVal(); if (IsOpen) { if (!Master.ph.File_Close()) { throw new FailOperationException("Не удалось закрыть файл"); } } var res = Master.ph.File_Open(FilePath, true); if (res != GeneralPacketHandler.WriteReadFileHandleResult.OK) { throw new FailOperationException("Не удалось открыть файл", res); } if (!IsOpen) { if (!Master.ph.File_Close()) { throw new FailOperationException("Не удалось закрыть файл"); } } }
internal SdCardDirectory(string path, DTPMaster ph) { DirectoryPath = path; master = ph; }
internal SdCardFile(string path, DTPMaster master) { FilePath = path; Master = master; }