public override void Execute(List <DataCompareItem> addItems, List <DataCompareItem> updateItems, List <DataCompareItem> deleteItems, IDataSourceReader reader, IDataSynchronizationStatus status) { DataSourceReader = reader as WinSCPDatasourceReader; if (DataSourceReader != null) { using (Session = DataSourceReader.GetSession()) { Mapping = new DataSchemaMapping(SchemaMap, DataCompare); //Process the Changed Items if (addItems != null && status.ContinueProcessing) { AddItems(addItems, status); } if (updateItems != null && status.ContinueProcessing) { UpdateItems(updateItems, status); } if (deleteItems != null && status.ContinueProcessing) { DeleteItems(deleteItems, status); } } } }
private IEnumerable <ELFProgramSegment> ReadSegments() { Header.IsProgramHeaderCountReasonable.CheckThrowing(); IsHeaderProgramHeaderOffsetValid.CheckThrowing(); IsHeaderProgramHeaderEntrySizeValid.CheckThrowing(); // Calculate the loadBias. It is usually just the base address except for some executable modules. ulong loadBias = _position; if (loadBias > 0) { for (uint i = 0; i < Header.ProgramHeaderCount; i++) { ulong programHeaderOffset = _position + Header.ProgramHeaderOffset + i * Header.ProgramHeaderEntrySize; ELFProgramHeader header = DataSourceReader.Read <ELFProgramHeader>(programHeaderOffset); if (header.Type == ELFProgramHeaderType.Load && header.FileOffset == 0) { loadBias -= header.VirtualAddress; } } } // Build the program segments List <ELFProgramSegment> segments = new List <ELFProgramSegment>(); for (uint i = 0; i < Header.ProgramHeaderCount; i++) { ulong programHeaderOffset = _position + Header.ProgramHeaderOffset + i * Header.ProgramHeaderEntrySize; segments.Add(new ELFProgramSegment(DataSourceReader, loadBias, programHeaderOffset, _isDataSourceVirtualAddressSpace)); } return(segments); }
public override void Execute(List <DataCompareItem> addItems, List <DataCompareItem> updateItems, List <DataCompareItem> deleteItems, IDataSourceReader reader, IDataSynchronizationStatus status) { DataSourceReader = reader as PipedriveDatasourceReader; if (DataSourceReader != null) { Mapping = new DataSchemaMapping(SchemaMap, DataCompare); WebRequestHelper = DataSourceReader.GetWebRequestHelper(); DatasourceInfo = DataSourceReader.GetDatasourceInfo(); DataSchema = DatasourceInfo.GetPipedriveDataSchema(WebRequestHelper); //Process the Changed Items if (addItems != null && status.ContinueProcessing) { AddItems(addItems, status); } if (updateItems != null && status.ContinueProcessing) { UpdateItems(updateItems, status); } if (deleteItems != null && status.ContinueProcessing) { DeleteItems(deleteItems, status); } } }
public override void Execute(List <DataCompareItem> addItems, List <DataCompareItem> updateItems, List <DataCompareItem> deleteItems, IDataSourceReader reader, IDataSynchronizationStatus status) { DataSourceReader = reader as MailChimpMemberDatasourceReader; if (DataSourceReader != null) { Mapping = new DataSchemaMapping(SchemaMap, DataCompare); MailChimpDataSchema = MailChimp.MailChimpDataSchema.MailChimpMemberSchema(); WebRequestHelper = DataSourceReader.GetWebRequestHelper(); ListServiceUrl = DataSourceReader.GetUriHelper().ListServiceUrl; //Process the Changed Items if (addItems != null && status.ContinueProcessing) { AddItems(addItems, status); } if (updateItems != null && status.ContinueProcessing) { UpdateItems(updateItems, status); } if (deleteItems != null && status.ContinueProcessing) { DeleteItems(deleteItems, status); } } }
private byte[] ReadUuid() { IsAtLeastOneUuidLoadCommand.CheckThrowing(); IsAtMostOneUuidLoadCommand.CheckThrowing(); Tuple <MachLoadCommand, ulong> cmdAndPos = _loadCommands.Value.Where(c => c.Item1.Command == LoadCommandType.Uuid).First(); MachUuidLoadCommand uuidCmd = DataSourceReader.Read <MachUuidLoadCommand>(cmdAndPos.Item2); uuidCmd.IsCommandSizeValid.CheckThrowing(); return(uuidCmd.Uuid); }
private Reader CreateVirtualAddressReader() { if (_isDataSourceVirtualAddressSpace) { return(DataSourceReader); } else { return(DataSourceReader.WithAddressSpace(new ELFVirtualAddressSpace(Segments))); } }
private Reader CreatePhysicalReader() { if (!_dataSourceIsVirtualAddressSpace) { return(DataSourceReader); } else { return(DataSourceReader.WithAddressSpace(new MachPhysicalAddressSpace(_reader.DataSource, PreferredVMBaseAddress, Segments))); } }
private Reader CreateVirtualReader() { if (_dataSourceIsVirtualAddressSpace) { return(DataSourceReader); } else { return(DataSourceReader.WithAddressSpace(new MachVirtualAddressSpace(Segments))); } }
public ELFFile(IAddressSpace dataSource, ulong position = 0, bool isDataSourceVirtualAddressSpace = false) { _dataSource = dataSource; _position = position; _isDataSourceVirtualAddressSpace = isDataSourceVirtualAddressSpace; _ident = new Lazy <ELFHeaderIdent>(() => new Reader(_dataSource).Read <ELFHeaderIdent>(_position)); _dataSourceReader = new Lazy <Reader>(() => new Reader(_dataSource, new LayoutManager().AddELFTypes(IsBigEndian, Is64Bit))); _header = new Lazy <ELFHeader>(() => DataSourceReader.Read <ELFHeader>(_position)); _segments = new Lazy <IEnumerable <ELFSegment> >(ReadSegments); _virtualAddressReader = new Lazy <Reader>(CreateVirtualAddressReader); _buildId = new Lazy <byte[]>(ReadBuildID); }
public MachOFile(IAddressSpace dataSource, ulong position = 0, bool dataSourceIsVirtualAddressSpace = false) { _position = position; _dataSourceIsVirtualAddressSpace = dataSourceIsVirtualAddressSpace; _reader = new Reader(dataSource); _headerMagic = new Lazy <MachHeaderMagic>(() => _reader.Read <MachHeaderMagic>(_position)); _dataSourceReader = new Lazy <Reader>(CreateDataSourceReader); _header = new Lazy <MachHeader>(() => DataSourceReader.Read <MachHeader>(_position)); _loadCommands = new Lazy <Tuple <MachLoadCommand, ulong>[]>(ReadLoadCommands); _segments = new Lazy <MachSegment[]>(ReadSegments); _sections = new Lazy <MachSection[]>(() => Segments.SelectMany(seg => seg.Sections).ToArray()); _virtualAddressReader = new Lazy <Reader>(CreateVirtualReader); _physicalAddressReader = new Lazy <Reader>(CreatePhysicalReader); _uuid = new Lazy <byte[]>(ReadUuid); _symtab = new Lazy <MachSymtab>(ReadSymtab); }
private Tuple <MachLoadCommand, ulong>[] ReadLoadCommands() { Header.IsNumberCommandsReasonable.CheckThrowing(); ulong position = _position + DataSourceReader.SizeOf <MachHeader>(); //TODO: do this more cleanly if (Is64Bit) { position += 4; // the 64 bit version has an extra padding field to align at an // 8 byte boundary } List <Tuple <MachLoadCommand, ulong> > cmds = new List <Tuple <MachLoadCommand, ulong> >(); for (uint i = 0; i < Header.NumberCommands; i++) { MachLoadCommand cmd = DataSourceReader.Read <MachLoadCommand>(position); cmd.IsCmdSizeReasonable.CheckThrowing(); cmds.Add(new Tuple <MachLoadCommand, ulong>(cmd, position)); position += cmd.CommandSize; } return(cmds.ToArray()); }
/// <summary> /// Завантаження інформації товарів /// </summary> /// <param name="localLoadedTempFiles">Шляхи до файлів</param> /// <param name="onlyUpdate">Якщо ture то завантажувати інформацію лише з нових файлів в іншому випадку завантажувати з всіх</param> /// <returns>Завантажена інформація</returns> public static object[] LoadData(string[] localLoadedTempFiles, bool onlyUpdate, object profile, int startupIndex) { //Com_WinApi.OutputDebugString("--- LoadData_begin"); FileStream fs = null; DataTable[] dTables = new DataTable[3]; bool exchangeFldUsed = false; IntPtr hFile = IntPtr.Zero; DataSourceReader[] rdFunc = new DataSourceReader[3]; rdFunc[0] = ReadProduct; rdFunc[1] = ReadAlternative; rdFunc[2] = ReadCard; DataTableCreateMethod[] crFunc = new DataTableCreateMethod[3]; crFunc[0] = CreateDataTableForProduct; crFunc[1] = CreateDataTableForAlternative; crFunc[2] = CreateDataTableForCard; if (!Directory.Exists(driver.Config.ConfigManager.Instance.CommonConfiguration.Path_Articles)) Directory.CreateDirectory(driver.Config.ConfigManager.Instance.CommonConfiguration.Path_Articles); string[] artFiles = new string[3]; if (driver.Config.ConfigManager.Instance.CommonConfiguration.PROFILES_UseProfiles) { artFiles[0] = driver.Config.ConfigManager.Instance.CommonConfiguration.Path_Articles + "\\" + string.Format("Art_{1:D2}{0:D2}.xml", driver.Config.ConfigManager.Instance.CommonConfiguration.APP_SubUnit, int.Parse(profile.ToString())); artFiles[1] = driver.Config.ConfigManager.Instance.CommonConfiguration.Path_Articles + "\\" + string.Format("Alt_{1:D2}{0:D2}.xml", driver.Config.ConfigManager.Instance.CommonConfiguration.APP_SubUnit, int.Parse(profile.ToString())); artFiles[2] = driver.Config.ConfigManager.Instance.CommonConfiguration.Path_Articles + "\\" + string.Format("Cli_{0:D2}.xml", int.Parse(profile.ToString())); } else { artFiles[0] = driver.Config.ConfigManager.Instance.CommonConfiguration.Path_Articles + "\\" + string.Format("Art_{0:D2}.xml", driver.Config.ConfigManager.Instance.CommonConfiguration.APP_SubUnit); artFiles[1] = driver.Config.ConfigManager.Instance.CommonConfiguration.Path_Articles + "\\" + string.Format("Alt_{0:D2}.xml", driver.Config.ConfigManager.Instance.CommonConfiguration.APP_SubUnit); artFiles[2] = driver.Config.ConfigManager.Instance.CommonConfiguration.Path_Articles + "\\" + string.Format("Cli.xml"); } for (int i = 0; i < artFiles.Length; i++) if (localLoadedTempFiles != null && localLoadedTempFiles[i] != string.Empty) { //Com_WinApi.OutputDebugString("EXCHAGE LoadingFromNewSource_begin"); dTables[i] = crFunc[i].Invoke(); rdFunc[i].Invoke(localLoadedTempFiles[i], ref dTables[i], startupIndex); fs = new FileStream(artFiles[i], FileMode.Create); binF.Serialize(fs, dTables[i]); //dTables[i].TableName = Path.GetFileNameWithoutExtension(localLoadedTempFiles[i]); //dTables[i].WriteXml(fs); fs.Close(); fs.Dispose(); exchangeFldUsed = true; if (!driver.Config.ConfigManager.Instance.CommonConfiguration.Content_Articles_KeepDataAfterImport) Microsoft.VisualBasic.FileIO.FileSystem.DeleteFile(localLoadedTempFiles[i], UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin); //Com_WinApi.OutputDebugString("EXCHAGE LoadingFromNewSource_end"); } else { if (!onlyUpdate && Com_WinApi.PathFileExists(artFiles[i])) { //Com_WinApi.OutputDebugString("LOCAL LoadingFromLocalCopy_begin"); fs = new FileStream(artFiles[i], FileMode.Open, FileAccess.Read); //dTables[i].ReadXml(fs); dTables[i] = (DataTable)binF.Deserialize(fs); if (!new Com_SecureRuntime().FullLoader()) { DataTable tDt = dTables[i].Clone(); for (int jp = 0; jp < 10; jp++) { if (dTables[i].Rows.Count <= jp) break; tDt.Rows.Add(dTables[i].Rows[jp].ItemArray); } dTables[i] = tDt.Copy(); } fs.Close(); fs.Dispose(); //Com_WinApi.OutputDebugString("LOCAL LoadingFromLocalCopy_end"); } } if (fs != null) fs.Dispose(); object[] rez = new object[] { dTables, exchangeFldUsed }; //Com_WinApi.OutputDebugString("--- LoadData_end"); return rez; }