public ExternalProcedure ResolveProcedure(string moduleName, string importName, IPlatform platform) { foreach (var program in project.Programs) { ModuleDescriptor mod; if (!program.Metadata.Modules.TryGetValue(moduleName, out mod)) continue; SystemService svc; if (mod.ServicesByName.TryGetValue(importName, out svc)) { return new ExternalProcedure(svc.Name, svc.Signature, svc.Characteristics); } } foreach (var program in project.Programs) { ProcedureSignature sig; if (program.Metadata.Signatures.TryGetValue(importName, out sig)) { return new ExternalProcedure(importName, sig); } } return platform.LookupProcedureByName(moduleName, importName); }
public DataTypeBuilder(TypeFactory factory, ITypeStore store, IPlatform platform) { this.store = store; this.factory = factory; this.unifier = new DataTypeBuilderUnifier(factory, store); this.platform = platform; }
public PlatformKernel(IPlatform platform) { var runtimeModule = GetRuntimeModule(platform); Load(runtimeModule); AddBindingResolver<IDisplay>(DisplayBindingResolver); }
public void Setup() { this.mr = new MockRepository(); this.mockFactory = new MockFactory(mr); this.platform = mockFactory.CreatePlatform(); this.program = mockFactory.CreateProgram(); }
private static Task<MobileServiceUser> LoginFacebookAsync(IPlatform mobileClient) { // use server flow if the service URL has been customized return Settings.IsDefaultServiceUrl() ? mobileClient.LoginFacebookAsync() : mobileClient.LoginAsync(MobileServiceAuthenticationProvider.Facebook); }
public void ProcessDeclaration(Decl declaration, IPlatform platform, TypeLibraryDeserializer tldser, SymbolTable symbolTable) { var types = symbolTable.AddDeclaration(declaration); var type = types[0]; int? vectorOffset = GetVectorOffset(declaration); if (vectorOffset.HasValue) { var ntde = new NamedDataTypeExtractor(platform, declaration.decl_specs, symbolTable); foreach (var declarator in declaration.init_declarator_list) { var nt = ntde.GetNameAndType(declarator.Declarator); var ssig = (SerializedSignature)nt.DataType; if (ssig.ReturnValue != null) { ssig.ReturnValue.Kind = ntde.GetArgumentKindFromAttributes( "returns", declaration.attribute_list); } var sser = platform.CreateProcedureSerializer(tldser, platform.DefaultCallingConvention); var sig = sser.Deserialize(ssig, platform.Architecture.CreateFrame()); SystemServices.Add( vectorOffset.Value, new SystemService { Name = nt.Name, SyscallInfo = new SyscallInfo { Vector = vectorOffset.Value, }, Signature = sig, }); } } }
public SystemService Build(IPlatform platform, TypeLibrary library) { SystemService svc = new SystemService(); svc.Name = Name; svc.SyscallInfo = new SyscallInfo(); svc.SyscallInfo.Vector = SyscallInfo != null ? Convert.ToInt32(SyscallInfo.Vector, 16) : this.Ordinal; if (SyscallInfo != null) { if (SyscallInfo.RegisterValues != null) { svc.SyscallInfo.RegisterValues = new RegValue[SyscallInfo.RegisterValues.Length]; for (int i = 0; i < SyscallInfo.RegisterValues.Length; ++i) { svc.SyscallInfo.RegisterValues[i] = new RegValue { Register = platform.Architecture.GetRegister(SyscallInfo.RegisterValues[i].Register), Value = Convert.ToInt32(SyscallInfo.RegisterValues[i].Value, 16), }; } } } if (svc.SyscallInfo.RegisterValues == null) { svc.SyscallInfo.RegisterValues = new RegValue[0]; } TypeLibraryDeserializer loader = new TypeLibraryDeserializer(platform, true, library); var sser = platform.CreateProcedureSerializer(loader, "stdapi"); svc.Signature = sser.Deserialize(Signature, platform.Architecture.CreateFrame()); svc.Characteristics = Characteristics != null ? Characteristics : DefaultProcedureCharacteristics.Instance; return svc; }
private void Given_Platform(IPlatform platform) { this.oe = mr.Stub<OperatingEnvironment>(); this.platform = platform; this.cfgSvc.Stub(c => c.GetEnvironment("testOS")).Return(oe); oe.Stub(e => e.Load(sc, null)).IgnoreArguments().Return(platform); }
public XmlConverter(TextReader rdr, XmlWriter writer, IPlatform platform) { this.rdr = rdr; this.writer = writer; this.platform = platform; this.parserState = new ParserState(); }
public IPlatform CreatePlatform() { if (platform != null) return platform; platform = mr.Stub<IPlatform>(); platform.Stub(p => p.Name).Return("TestPlatform"); platform.Stub(p => p.PointerType).Return(PrimitiveType.Pointer32); platform.Stub(p => p.GetByteSizeFromCBasicType(CBasicType.Char)).Return(1); platform.Stub(p => p.GetByteSizeFromCBasicType(CBasicType.Short)).Return(2); platform.Stub(p => p.GetByteSizeFromCBasicType(CBasicType.Int)).Return(4); platform.Stub(p => p.GetByteSizeFromCBasicType(CBasicType.Long)).Return(4); platform.Stub(p => p.GetByteSizeFromCBasicType(CBasicType.LongLong)).Return(8); platform.Stub(p => p.GetByteSizeFromCBasicType(CBasicType.Float)).Return(4); platform.Stub(p => p.GetByteSizeFromCBasicType(CBasicType.Double)).Return(8); platform.Stub(p => p.GetByteSizeFromCBasicType(CBasicType.LongDouble)).Return(8); platform.Stub(p => p.GetByteSizeFromCBasicType(CBasicType.Int64)).Return(8); platform.Stub(p => p.CreateMetadata()).Do(new Func<TypeLibrary>(() => this.platformMetadata.Clone())); var arch = new X86ArchitectureFlat32(); platform.Stub(p => p.Architecture).Return(arch); platform.Stub(p => p.DefaultCallingConvention).Return("__cdecl"); platform.Stub(s => s.CreateProcedureSerializer(null, null)).IgnoreArguments().Do( new Func<ISerializedTypeVisitor<DataType>, string, ProcedureSerializer>((tlDeser, dc) => new X86ProcedureSerializer(arch, tlDeser, dc) ) ); platform.Stub(p => p.SaveUserOptions()).Return(null); platform.Replay(); return platform; }
public ConditionCodeEliminator(SsaState ssa, IPlatform arch) { this.ssa=ssa; this.ssaIds = ssa.Identifiers; this.platform = arch; this.m = new ExpressionEmitter(); }
public Sound(IPlatform platform, SoundSettings soundSettings) { soundEngine = platform.CreateSound(soundSettings.Device); if (soundSettings.Mute) MuteAudio(); }
public Program(SegmentMap segmentMap, IProcessorArchitecture arch, IPlatform platform) : this() { this.SegmentMap = segmentMap; this.ImageMap = segmentMap.CreateImageMap(); this.Architecture = arch; this.Platform = platform; }
private void BuildTest(Address addrBase, IPlatform platform , Action<X86Assembler> asmProg) { var sc = new ServiceContainer(); sc.AddService<DecompilerEventListener>(new FakeDecompilerEventListener()); sc.AddService<DecompilerHost>(new FakeDecompilerHost()); sc.AddService<IFileSystemService>(new FileSystemServiceImpl()); var entryPoints = new List<EntryPoint>(); var asm = new X86Assembler(sc, platform, addrBase, entryPoints); asmProg(asm); var lr = asm.GetImage(); program = new Program( lr.Image, lr.ImageMap, arch, platform); var project = new Project { Programs = { program } }; scanner = new Scanner( program, new Dictionary<Address, ProcedureSignature>(), new ImportResolver(project), sc); scanner.EnqueueEntryPoint(new EntryPoint(addrBase, arch.CreateProcessorState())); scanner.ScanImage(); }
public ExternalProcedure ResolveProcedure(string moduleName, string importName, IPlatform platform) { if (!string.IsNullOrEmpty(moduleName)) { foreach (var program in project.Programs) { ModuleDescriptor mod; if (!program.EnvironmentMetadata.Modules.TryGetValue(moduleName, out mod)) continue; SystemService svc; if (mod.ServicesByName.TryGetValue(importName, out svc)) { return new ExternalProcedure(svc.Name, svc.Signature, svc.Characteristics); } } } foreach (var program in project.Programs) { FunctionType sig; if (program.EnvironmentMetadata.Signatures.TryGetValue(importName, out sig)) { var chr = platform.LookupCharacteristicsByName(importName); if (chr != null) return new ExternalProcedure(importName, sig, chr); else return new ExternalProcedure(importName, sig); } } return platform.LookupProcedureByName(moduleName, importName); }
public Program(LoadedImage image, ImageMap imageMap, IProcessorArchitecture arch, IPlatform platform) : this() { this.Image = image; this.ImageMap = imageMap; this.Architecture = arch; this.Platform = platform; }
public TypeLibrary Load(IPlatform platform, string module, TypeLibrary dstLib) { this.platform = platform; this.tlLoader = new TypeLibraryDeserializer(platform, true, dstLib); this.moduleName = module; tlLoader.SetModuleName(module); for (;;) { var tok = Peek(); if (tok.Type == TokenType.EOF) break; if (PeekAndDiscard(TokenType.NL)) continue; var line = ParseLine(); if (line != null) { if (line.Item1.HasValue) { tlLoader.LoadService(line.Item1.Value, line.Item2); } else { tlLoader.LoadService(line.Item2.Name, line.Item2); } } } return dstLib; }
public void Setup() { var sc = new ServiceContainer(); sc.AddService<IFileSystemService>(new FileSystemServiceImpl()); var arch = new IntelArchitecture(ProcessorMode.Real); this.platform = new MsdosPlatform(sc, arch); }
public ExePackLoader(IServiceProvider services, string filename, byte[] imgRaw) : base(services, filename, imgRaw) { var cfgSvc = services.RequireService<IConfigurationService>(); arch = cfgSvc.GetArchitecture("x86-real-16"); platform =cfgSvc.GetEnvironment("ms-dos") .Load(Services, arch); var exe = new ExeImageLoader(services, filename, imgRaw); this.exeHdrSize = (uint)(exe.e_cparHeader * 0x10U); this.hdrOffset = (uint)(exe.e_cparHeader + exe.e_cs) * 0x10U; ImageReader rdr = new LeImageReader(RawImage, hdrOffset); this.ip = rdr.ReadLeUInt16(); this.cs = rdr.ReadLeUInt16(); rdr.ReadLeUInt16(); this.cbExepackHeader = rdr.ReadLeUInt16(); this.sp = rdr.ReadLeUInt16(); this.ss = rdr.ReadLeUInt16(); this.cpUncompressed = rdr.ReadLeUInt16(); int offset = ExePackHeaderOffset(exe); if (MemoryArea.CompareArrays(imgRaw, offset, signature, signature.Length)) { relocationsOffset = 0x012D; } else if (MemoryArea.CompareArrays(imgRaw, offset, signature2, signature2.Length)) { relocationsOffset = 0x0125; } else throw new ApplicationException("Not a recognized EXEPACK image."); }
public void Setup() { var sc = new ServiceContainer(); sc.AddService<IFileSystemService>(new FileSystemServiceImpl()); var arch = new X86ArchitectureReal(); this.platform = new MsdosPlatform(sc, arch); }
// ctor /// <summary> /// Initializes a new instance of the <see cref="DataManager"/> class. /// </summary> /// <param name="platform">The platform.</param> public DataManager(IPlatform platform) { _platform = platform; AppService = new AppService(); _current = this; }
public LzExeUnpacker(IServiceProvider services, ExeImageLoader exe, string filename, byte [] rawImg) : base(services, filename, rawImg) { this.arch = new IntelArchitecture(ProcessorMode.Real); this.platform = services.RequireService<IConfigurationService>() .GetEnvironment("ms-dos") .Load(services, arch); Validate(exe); }
public override Identifier ResolveImportedGlobal( IImportResolver resolver, IPlatform platform, AddressContext ctx) { var global = resolver.ResolveGlobal(ModuleName, ImportName, platform); return global; }
public MsdosImageLoader(IServiceProvider services, string filename, ExeImageLoader exe) : base(services, filename, exe.RawImage) { this.exe = exe; var cfgSvc = services.RequireService<IConfigurationService>(); this.arch = cfgSvc.GetArchitecture("x86-real-16"); this.platform = cfgSvc.GetEnvironment("ms-dos") .Load(services, arch); }
private void Given_TestOS() { this.oe = mr.Stub<OperatingEnvironment>(); this.platform = mr.Stub<IPlatform>(); this.cfgSvc.Stub(c => c.GetEnvironment("testOS")).Return(oe); oe.Stub(e => e.Load(sc, null)).IgnoreArguments().Return(platform); this.platform.Stub(p => p.CreateMetadata()).Return(new TypeLibrary()); }
public override TypeLibrary Load(IPlatform platform, TypeLibrary dstLib) { var ser = SerializedLibrary.CreateSerializer(); var slib = (SerializedLibrary) ser.Deserialize(stream); var tldser = new TypeLibraryDeserializer(platform, true, dstLib); var tlib = tldser.Load(slib); return tlib; }
public override Program LinkObject(IPlatform platform, Address addrLoad, byte[] rawImage) { var segments = ComputeSegmentSizes(); var imageMap = CreateSegments(addrLoad, segments); var program = new Program(imageMap, platform.Architecture, platform); LoadExternalProcedures(program.InterceptedCalls);; return program; }
public UserAgentBuilder(IPlatform platformInfo, ISdk sdkInfo, ISourceLanguage language) { this.platform = platformInfo; this.sdk = sdkInfo; this.language = language; this.userAgentValue = new Lazy<string>(() => this.Generate()); }
public static void Initialize(IPlatform platform) { if( null != Kernel ) { throw new ArgumentException("Kernel has already been initialized"); } Kernel = new PlatformKernel(platform); }
public MsdosImageLoader(IServiceProvider services, string filename, ExeImageLoader exe) : base(services, filename, exe.RawImage) { this.exe = exe; this.arch = new IntelArchitecture(ProcessorMode.Real); this.platform = this.platform = services.RequireService<IConfigurationService>() .GetEnvironment("ms-dos") .Load(services, arch); }
public void SetupPlatform(IPlatform platform) { m_Platform = platform; m_CurrentActivity = GetCurrentAndroidActivity(); m_UnityAds = new AndroidJavaClass("com.unity3d.ads.UnityAds"); }
public ServiceBroker(IPlatform platform) { client.DefaultRequestHeaders.Clear(); _global = platform; }
public abstract Program LinkObject(IPlatform platform, Address addrLoad, byte[] rawImage);
/// <summary> /// Otvara dijalog i ceka dok se uspesno ne zatvori /// </summary> /// <param name="platform"></param> /// <param name="horizontal"></param> /// <param name="vertical"></param> /// <returns></returns> public inputResultCollection open(IPlatform platform, dialogFormatSettings format) { var output = openSequence(platform, format); return(output); }
public CreateViewModel(INavigationService navigationService, IHttpTransferManager httpTransfers, IDialogs dialogs, IPlatform platform, IAppSettings appSettings) { this.platform = platform; this.Url = appSettings.LastTransferUrl; this.WhenAnyValue(x => x.IsUpload) .Subscribe(upload => { if (!upload && this.FileName.IsEmpty()) { this.FileName = Guid.NewGuid().ToString(); } this.Title = upload ? "New Upload" : "New Download"; }); this.ManageUploads = navigationService.NavigateCommand("ManageUploads"); this.ResetUrl = ReactiveCommand.Create(() => { appSettings.LastTransferUrl = null; this.Url = appSettings.LastTransferUrl; }); this.SelectUpload = ReactiveCommand.CreateFromTask(async() => { var files = platform.AppData.GetFiles("upload.*", SearchOption.TopDirectoryOnly); if (!files.Any()) { await dialogs.Alert("There are not files to upload. Use 'Manage Uploads' below to create them"); } else { var cfg = new Dictionary <string, Action>(); foreach (var file in files) { cfg.Add(file.Name, () => this.FileName = file.Name); } await dialogs.ActionSheet("Actions", cfg); } }); this.Save = ReactiveCommand.CreateFromTask( async() => { var path = Path.Combine(this.platform.AppData.FullName, this.FileName); var request = new HttpTransferRequest(this.Url, path, this.IsUpload) { UseMeteredConnection = this.UseMeteredConnection }; await httpTransfers.Enqueue(request); appSettings.LastTransferUrl = this.Url; await navigationService.GoBackAsync(); }, this.WhenAny ( x => x.IsUpload, x => x.Url, x => x.FileName, (up, url, fn) => { this.ErrorMessage = String.Empty; if (!Uri.TryCreate(url.GetValue(), UriKind.Absolute, out _)) { this.ErrorMessage = "Invalid URL"; } else if (up.GetValue() && fn.GetValue().IsEmpty()) { this.ErrorMessage = "You must select or enter a filename"; } return(this.ErrorMessage.IsEmpty()); } ) ); }
static Advertisement() { s_UnityEngineApplication = new UnityEngineApplication(); s_Platform = Creator.CreatePlatform(); }
/// <summary> /// Loads an image map from a file containing the XML description of the /// segments inside. /// <param name="svc"></param> /// <param name="mmapFileName"></param> /// <param name="platform"></param> /// <returns></returns> public static MemoryMap_v1 LoadMemoryMapFromFile(IServiceProvider svc, string mmapFileName, IPlatform platform) { var cfgSvc = svc.RequireService <IConfigurationService>(); var fsSvc = svc.RequireService <IFileSystemService>(); var diagSvc = svc.RequireService <IDiagnosticsService>(); try { var filePath = cfgSvc.GetInstallationRelativePath(mmapFileName); var ser = SerializedLibrary.CreateSerializer( typeof(MemoryMap_v1), SerializedLibrary.Namespace_v4); using (var stm = fsSvc.CreateFileStream(filePath, FileMode.Open, FileAccess.Read)) { var mmap = (MemoryMap_v1)ser.Deserialize(stm); return(mmap); } } catch (Exception ex) { diagSvc.Error(ex, string.Format("Unable to open memory map file '{0}.", mmapFileName)); return(null); } }
public ExpressionTypeAscenderBase(Program program, TypeFactory factory) { this.platform = program.Platform; this.globalFields = program.GlobalFields; this.factory = factory; }
public abstract ExternalProcedure ResolveImportedProcedure(IImportResolver importResolver, IPlatform platform, AddressContext ctx);
public abstract Expression ResolveImport(IImportResolver importResolver, IPlatform platform, AddressContext ctx);
public CallRewriter(IPlatform platform, ProgramDataFlow mpprocflow, DecompilerEventListener listener) { this.platform = platform; this.mpprocflow = mpprocflow; this.listener = listener; }
public DataViewBuilder(IPlatform platform) { this.Platform = platform; }
public VGUI(IPlatform platform, Controller controller) { this.controller = controller; this.platform = platform; vg = platform.VG; footswitchMapping = FootSwitchScene(controller); selectedComponent = null; needFrame = new AutoResetEvent(false); frameReady = new AutoResetEvent(false); vg.ClearColor = new float[] { 0.0f, 0.0f, 0.2f, 1.0f }; platform.InputEvent += Platform_InputEvent; Debug.WriteLine("Set rendering quality and pixel layout"); //vg.Seti(ParamType.VG_PIXEL_LAYOUT, (int)PixelLayout.VG_PIXEL_LAYOUT_RGB_HORIZONTAL); //vg.Seti(ParamType.VG_RENDERING_QUALITY, (int)RenderingQuality.VG_RENDERING_QUALITY_BETTER); vg.Seti(ParamType.VG_RENDERING_QUALITY, (int)RenderingQuality.VG_RENDERING_QUALITY_FASTER); //vg.Seti(ParamType.VG_RENDERING_QUALITY, (int)RenderingQuality.VG_RENDERING_QUALITY_NONANTIALIASED); //vg.Seti(ParamType.VG_IMAGE_QUALITY, (int)ImageQuality.VG_IMAGE_QUALITY_BETTER); vg.Seti(ParamType.VG_IMAGE_QUALITY, (int)ImageQuality.VG_IMAGE_QUALITY_FASTER); vg.Seti(ParamType.VG_BLEND_MODE, (int)BlendMode.VG_BLEND_SRC_OVER); // Load TTF font: Debug.WriteLine("Load Vera.ttf"); var fontConverter = new VGFontConverter(vg); //vera = fontConverter.FromTTF("Vera.ttf"); //vera = fontConverter.FromTTF("DroidSans.ttf"); vera = fontConverter.FromODX("Verdana.json"); this.disposalContainer = new DisposalContainer( white = new PaintColor(vg, new float[] { 1.0f, 1.0f, 1.0f, 1.0f }), // For the touch point: pointColor = new PaintColor(vg, new float[] { 0.0f, 1.0f, 0.0f, 0.5f }), point = new Ellipse(vg, 24, 24), clrBtnOutline = new PaintColor(vg, new float[] { 0.6f, 0.6f, 0.6f, 1.0f }), clrBtnBg = new PaintColor(vg, new float[] { 0.3f, 0.3f, 0.3f, 1.0f }), clrBtnBgSelected = new PaintColor(vg, new float[] { 0.3f, 0.3f, 0.6f, 1.0f }), clrBtnOutlineSelected = new PaintColor(vg, new float[] { 1.0f, 1.0f, 0.0f, 1.0f }) ); // Root of component tree: this.root = new Panel(platform) { Children = { new VerticalStack(platform) { Children = { new HorizontalStack(platform) { Dock = Dock.Top, Height = 32, Children = { // MIDI button: new Button(platform) { Dock = Dock.Left, Width = 60, Stroke = clrBtnOutline, Fill = clrBtnBg, StrokePressed = clrBtnBg, FillPressed = clrBtnOutline, OnRelease = (cmp, p) => { controller.MidiResend(); return(true); }, Children = { new Label(platform) { TextFont = vera, TextColor = white, TextHAlign = HAlign.Center, TextVAlign = VAlign.Middle, Text = () => "MIDI" } } }, // Song display: new Button(platform) { Stroke = clrBtnOutline, Fill = clrBtnBg, StrokeLineWidth = 3.0f, OnPress = (cmp, p) => { var btn = (Button)cmp; // Footswitch controls song prev/next. footswitchMapping = FootSwitchSong(controller); if (selectedComponent is Button selectedBtn) { selectedBtn.Stroke = clrBtnOutline; selectedBtn.Fill = clrBtnBg; } btn.Stroke = clrBtnOutlineSelected; btn.Fill = clrBtnBgSelected; selectedComponent = cmp; return(true); }, Children = { new Label(platform) { TextFont = vera, TextColor = white, Text = () => $"SONG: {controller.CurrentSongName}" } } },
public SymbolTable(IPlatform platform) { this.platform = platform; this.declarations = new Dictionary <string, Declaration>(StringComparer.OrdinalIgnoreCase); }
public override void ConfigureLogging(ILoggingBuilder builder, IPlatform platform) { //https://github.com/yorchideas/Xunit.Extensions.Logging }
public override Program Load(Address addrLoad, IProcessorArchitecture arch, IPlatform platform) { BeImageReader rdr = new BeImageReader(this.RawImage, 0); DolStructure? str = new StructureReader <DolStructure>(rdr).Read(); if (!str.HasValue) { throw new BadImageFormatException("Invalid DOL header."); } this.hdr = new DolHeader(str.Value); var segments = new List <ImageSegment>(); // Create code segments for (uint i = 0, snum = 1; i < 7; i++, snum++) { if (hdr.addressText[i] == Address32.NULL) { continue; } var bytes = new byte[hdr.sizeText[i]]; Array.Copy(RawImage, hdr.offsetText[i], bytes, 0, bytes.Length); var mem = new MemoryArea(hdr.addressText[i], bytes); segments.Add(new ImageSegment( string.Format("Text{0}", snum), mem, AccessMode.ReadExecute)); } // Create all data segments for (uint i = 0, snum = 1; i < 11; i++, snum++) { if (hdr.addressData[i] == Address32.NULL || hdr.sizeData[i] == 0) { continue; } var bytes = new byte[hdr.sizeData[i]]; Array.Copy(RawImage, hdr.offsetData[i], bytes, 0, bytes.Length); var mem = new MemoryArea(hdr.addressText[i], bytes); segments.Add(new ImageSegment( string.Format("Data{0}", snum), mem, AccessMode.ReadWrite)); } if (hdr.addressBSS != Address32.NULL) { segments.Add(new ImageSegment( ".bss", new MemoryArea(hdr.addressBSS, new byte[hdr.sizeBSS]), AccessMode.ReadWrite)); } var segmentMap = new SegmentMap(addrLoad, segments.ToArray()); var entryPoint = ImageSymbol.Procedure(arch, this.hdr.entrypoint); var program = new Program( segmentMap, arch, platform) { ImageSymbols = { { this.hdr.entrypoint, entryPoint } }, EntryPoints = { { this.hdr.entrypoint, entryPoint } } }; return(program); }
protected void Given_Platform(IPlatform platform) { this.platform = platform; }
public void SendBackupDirectory(string directory, string remoteDirectory, DbOperations db, int devicePlanId, IPlatform platform, BackupLog bc) { string[] deviceInfo = Common.SecurityKey().Split('|'); BackupJobModel model = new BackupJobModel(); var result = Common.ApiAndSecretKey(); model.apiAccessKey = result.Key; model.apiSecretKey = result.Value; model.cpuId = deviceInfo[0]; model.diskVolume = deviceInfo[1]; model.macAddress = deviceInfo[2]; bc.apiAccessKey = model.apiAccessKey; bc.apiSecretKey = model.apiSecretKey; bc.cpuId = model.cpuId; bc.diskVolume = model.diskVolume; bc.macAddress = model.macAddress; List <CloudFile> cfList = db.GetFileList(devicePlanId, directory); DirectoryInfo d = new DirectoryInfo(directory); //Assuming Test is your Folder FileInfo[] Files = d.GetFiles(); //Getting Text files string str = ""; foreach (FileInfo file in Files) { CloudFile currentFile = cfList.Where(f => f.FullName == file.FullName && f.ResultStatus == Enum.ResultStatus.Success).FirstOrDefault(); if (currentFile != null) { if (file.LastWriteTime > currentFile.ProccessDate.Value && !String.IsNullOrEmpty(currentFile.CloudId)) { if (platform.CheckAccessTokenExpire()) { TokenResponse resp = ResetGoogleToken(devicePlanId); platform.UpdateAccessToken(resp.AccessToken, DateTime.Now.AddSeconds(resp.ExpiresInSeconds.Value)); } string fileId = platform.UpdateFile(file.Name, file.FullName, file.GetType().ToString(), remoteDirectory, currentFile.CloudId);// UpdateFile(file.Name, file.FullName, file.GetType().ToString(), accessToken, s, remoteDirectory, currentFile.CloudId); if (!String.IsNullOrEmpty(fileId) && !fileId.StartsWith("error-")) { currentFile.CloudId = fileId; bc.ProccessCount++; bc.UpdatedCount++; bc.TotalSize += GetFileSize(file); } if (!String.IsNullOrEmpty(fileId) && fileId.StartsWith("error-")) { currentFile.ErrorMessage = fileId.Replace("error-", ""); bc.FailedCount++; bc.ProccessCount++; } currentFile.Length = GetFileSize(file); currentFile.ProccessDate = DateTime.Now; if (!String.IsNullOrEmpty(fileId) && !fileId.StartsWith("error-")) { currentFile.ResultStatus = Enum.ResultStatus.Success; } else { currentFile.ResultStatus = Enum.ResultStatus.Error; } db.UpdateData(currentFile); } } else { if (platform.CheckAccessTokenExpire()) { TokenResponse resp = ResetGoogleToken(devicePlanId); platform.UpdateAccessToken(resp.AccessToken, DateTime.Now.AddSeconds(resp.ExpiresInSeconds.Value)); bc.ProccessCount++; } string fileId = platform.UploadFile(file.Name, file.FullName, file.GetType().ToString(), remoteDirectory); CloudFile ff = new CloudFile(); if (!String.IsNullOrEmpty(fileId) && !fileId.StartsWith("error-")) { ff.CloudId = fileId; } ff.DevicePlanId = devicePlanId; if (!String.IsNullOrEmpty(fileId) && fileId.StartsWith("error-")) { ff.ErrorMessage = fileId.Replace("error-", ""); } ff.Length = GetFileSize(file); ff.FullName = file.FullName; ff.ProccessDate = DateTime.Now; if (!String.IsNullOrEmpty(fileId) && !fileId.StartsWith("error-")) { ff.ResultStatus = Enum.ResultStatus.Success; bc.ProccessCount++; bc.CreateFileCount++; bc.TotalSize += GetFileSize(file); } else { ff.ResultStatus = Enum.ResultStatus.Error; bc.FailedCount++; bc.ProccessCount++; } ff.SubDirectory = file.DirectoryName; ff.Type = Enum.FileType.File; db.InsertData(ff); } } List <string> fileFullPaths = Files.Select(f => f.FullName).ToList(); foreach (var deleteFile in cfList.Where(f => !fileFullPaths.Contains(f.FullName) && f.Type == Enum.FileType.File && f.ResultStatus == Enum.ResultStatus.Success)) { if (!String.IsNullOrEmpty(deleteFile.CloudId)) { if (platform.CheckAccessTokenExpire()) { bc.ProccessCount++; TokenResponse resp = ResetGoogleToken(devicePlanId); platform.UpdateAccessToken(resp.AccessToken, DateTime.Now.AddSeconds(resp.ExpiresInSeconds.Value)); } platform.DeleteFile(deleteFile.CloudId); bc.ProccessCount++; bc.DeletedCount++; deleteFile.ProccessDate = DateTime.Now; db.DeleteData(deleteFile); } } foreach (var item in Directory.GetDirectories(directory)) { CloudFile currentFile = cfList.Where(f => f.SubDirectory + @"\" + f.FullName == item && f.ResultStatus == Enum.ResultStatus.Success).FirstOrDefault(); if (currentFile != null && currentFile.SubDirectory + @"\" + currentFile.FullName == item) { SendBackupDirectory(item, currentFile.CloudId, db, devicePlanId, platform, bc); } else { if (platform.CheckAccessTokenExpire()) { TokenResponse resp = ResetGoogleToken(devicePlanId); platform.UpdateAccessToken(resp.AccessToken, DateTime.Now.AddSeconds(resp.ExpiresInSeconds.Value)); bc.ProccessCount++; } DirectoryInfo df = new DirectoryInfo(item); string directoryId = platform.CreateDirectory(df.Name, remoteDirectory); CloudFile ff = new CloudFile(); if (!String.IsNullOrEmpty(directoryId) && !directoryId.StartsWith("error-")) { ff.CloudId = directoryId; } ff.DevicePlanId = devicePlanId; if (!String.IsNullOrEmpty(directoryId) && directoryId.StartsWith("error-")) { ff.ErrorMessage = directoryId.Replace("error-", ""); } ff.FullName = df.Name; ff.ProccessDate = DateTime.Now; if (!String.IsNullOrEmpty(directoryId) && !directoryId.StartsWith("error-")) { ff.ResultStatus = Enum.ResultStatus.Success; bc.CreateDirectoryCount++; bc.ProccessCount++; } else { ff.ResultStatus = Enum.ResultStatus.Error; bc.FailedCount++; bc.ProccessCount++; } ff.SubDirectory = directory; ff.Type = Enum.FileType.Directory; db.InsertData(ff); SendBackupDirectory(item, directoryId, db, devicePlanId, platform, bc); } } }
protected DocumentNode ProvideCurrentTemplate(SceneElement targetElement, PropertyReference targetPropertyReference, out IList <DocumentCompositeNode> auxillaryResources) { IPlatform platform = this.SceneViewModel.ProjectContext.Platform; FrameworkTemplateElement frameworkTemplateElement1 = (FrameworkTemplateElement)null; auxillaryResources = (IList <DocumentCompositeNode>)null; if (targetElement.IsSet(targetPropertyReference) == PropertyState.Set) { FrameworkTemplateElement frameworkTemplateElement2 = targetElement.GetLocalValueAsSceneNode(targetPropertyReference) as FrameworkTemplateElement; if (frameworkTemplateElement2 != null) { frameworkTemplateElement1 = targetElement.ClonePropertyValueAsSceneNode(targetPropertyReference) as FrameworkTemplateElement; if (frameworkTemplateElement1 != null) { auxillaryResources = Microsoft.Expression.DesignSurface.Utility.ResourceHelper.FindReferencedResources(frameworkTemplateElement2.DocumentNode); } } } if (frameworkTemplateElement1 == null) { object computedValue = targetElement.GetComputedValue(targetPropertyReference); DocumentNode root = computedValue == null ? (DocumentNode)null : this.SceneView.GetCorrespondingDocumentNode(platform.ViewObjectFactory.Instantiate(computedValue), true); IPropertyId targetProperty = (IPropertyId)targetElement.Platform.Metadata.ResolveProperty(BaseFrameworkElement.StyleProperty); DocumentCompositeNode documentCompositeNode1 = targetElement.DocumentNode as DocumentCompositeNode; if (!targetElement.ProjectContext.IsCapabilitySet(PlatformCapability.IsWpf) && documentCompositeNode1 != null && (root == null && targetPropertyReference.ReferenceSteps.Count == 1)) { ITypeId styleTargetType = (ITypeId)targetElement.Type; DocumentNode currentStyle = (DocumentNode)null; ReferenceStep referenceStep = targetPropertyReference.ReferenceSteps[0]; object defaultStyleKey = this.GetDefaultStyleKey(targetElement, styleTargetType, targetProperty); if (defaultStyleKey != null) { bool isThemeStyle; IList <DocumentCompositeNode> auxillaryResources1; this.ResolveDefaultStyle(targetElement, defaultStyleKey, true, out currentStyle, out isThemeStyle, out auxillaryResources1); } DocumentCompositeNode documentCompositeNode2 = currentStyle as DocumentCompositeNode; if (documentCompositeNode2 != null) { DocumentCompositeNode documentCompositeNode3 = documentCompositeNode2.Properties[StyleNode.SettersProperty] as DocumentCompositeNode; if (documentCompositeNode3 != null) { foreach (DocumentNode documentNode1 in (IEnumerable <DocumentNode>)documentCompositeNode3.Children) { DocumentCompositeNode documentCompositeNode4 = documentNode1 as DocumentCompositeNode; if (documentCompositeNode4 != null) { IMemberId memberId = (IMemberId)DocumentPrimitiveNode.GetValueAsMember(documentCompositeNode4.Properties[SetterSceneNode.PropertyProperty]); DocumentNode documentNode2 = documentCompositeNode4.Properties[SetterSceneNode.ValueProperty]; if (memberId != null && documentNode2 != null && referenceStep.Equals((object)memberId)) { root = documentNode2; break; } } } } } } if (root != null) { frameworkTemplateElement1 = this.SceneViewModel.GetSceneNode(root.Clone(this.SceneViewModel.Document.DocumentContext)) as FrameworkTemplateElement; auxillaryResources = Microsoft.Expression.DesignSurface.Utility.ResourceHelper.FindReferencedResources(root); } else { frameworkTemplateElement1 = this.SceneViewModel.CreateSceneNode(computedValue) as FrameworkTemplateElement; } } if (frameworkTemplateElement1 == null) { return((DocumentNode)null); } return(frameworkTemplateElement1.DocumentNode); }
public override Program LinkObject(IPlatform platform, Address addrLoad, byte[] rawImage) { throw new NotImplementedException(); }
public void OnSelectionChanged(FilterType filterType, string filterValue, IPlatform platform, IPlatformCategory category, IPlaylist playlist, IGame game) { _platform = platform; _playlist = playlist; }
protected dialogScreenBase(IPlatform platform) : base(platform, " ") { }
public void SendFile(string model) { BackupLog bc = new BackupLog(); string localDirectory = ""; string remoteDirectory = ""; string devicePlanId = ""; dynamic platformDetail = JObject.Parse(model); localDirectory = platformDetail.localDirectory; remoteDirectory = platformDetail.remoteDirectory; devicePlanId = platformDetail.devicePlanId; bc.DevicePlanId = Convert.ToInt32(devicePlanId); bc.CreateDirectoryCount = 0; bc.CreateFileCount = 0; bc.FailedCount = 0; bc.ProccessCount = 0; bc.TotalSize = 0; bc.DeletedCount = 0; bc.UpdatedCount = 0; DbOperations db = new DbOperations(); IPlatform platf = null; if (platformDetail.planType.ToString() == "1") { DriveService s = new Google.Apis.Drive.v3.DriveService(); var services = new DriveService(new BaseClientService.Initializer() { ApiKey = platformDetail.googleApiCode, // from https://console.developers.google.com (Public API access) ApplicationName = "ECloud Backup", }); platf = new PlatformGoogle(s, platformDetail.googleAccessToken.ToString(), platformDetail.googleApiCode.ToString(), Common.ConvertDatabaseDateTime(platformDetail.googleTokenExpired.ToString())); } else if (platformDetail.planType.ToString() == "2") { platf = new AmazonS3(platformDetail.apiAccessKey.ToString(), platformDetail.apiSecretKey.ToString(), platformDetail.region.ToString()); } DateTime dtStartBackup = DateTime.Now; SendBackupDirectory(localDirectory, remoteDirectory, db, Convert.ToInt32(devicePlanId), platf, bc); var list = db.GetErrorFileList(Convert.ToInt32(devicePlanId), dtStartBackup); List <string> errorList = new List <string>(); foreach (var k in list) { errorList.Add(k.FullName + " - " + k.ErrorMessage); } LogDeviceModel mdl = new LogDeviceModel { apiAccessKey = bc.apiAccessKey, apiSecretKey = bc.apiSecretKey, cpuId = bc.cpuId, deviceId = bc.deviceId, devicePlanId = Convert.ToInt32(devicePlanId), diskVolume = bc.diskVolume, errorList = errorList, macAddress = bc.macAddress }; IRestRequest request = new RestRequest("api/device/deviceplanid/{deviceplanid}/finish", Method.POST); request.RequestFormat = RestSharp.DataFormat.Json; request.AddParameter("deviceplanid", devicePlanId, ParameterType.UrlSegment); request.AddBody(bc); TaskCompletionSource <IRestResponse> taskCompletion = new TaskCompletionSource <IRestResponse>(); RestRequestAsyncHandle handle = client.ExecuteAsync(request, r => { taskCompletion.SetResult(r); }); IRestResponse response = taskCompletion.Task.Result; IRestRequest request1 = new RestRequest("api/device/log", Method.POST); request1.RequestFormat = RestSharp.DataFormat.Json; request1.AddBody(mdl); TaskCompletionSource <IRestResponse> taskCompletion1 = new TaskCompletionSource <IRestResponse>(); RestRequestAsyncHandle handle1 = client.ExecuteAsync(request1, r => { taskCompletion1.SetResult(r); }); IRestResponse response1 = taskCompletion1.Task.Result; }
public Expression ResolveImport(string moduleName, int ordinal, IPlatform platform) { throw new NotImplementedException(); }
public Expression ResolveImport(string moduleName, string globalName, IPlatform platform) { throw new NotImplementedException(); }
public ExternalProcedure ResolveProcedure(string moduleName, int ordinal, IPlatform platform) { throw new NotImplementedException(); }
public AndroidShowListener(IPlatform platform, IUnityAdsShowListener showListener) : base("com.unity3d.ads.IUnityAdsShowListener") { m_Platform = platform; m_ManagedListener = showListener; }
public ExternalProcedure ResolveProcedure(string moduleName, string importName, IPlatform platform) { FunctionType sig; if (signatures.TryGetValue(importName, out sig)) { return(new ExternalProcedure(importName, sig)); } else { return(null); } }
public override ExternalProcedure ResolveImportedProcedure(IImportResolver resolver, IPlatform platform, AddressContext ctx) { var ep = resolver.ResolveProcedure(ModuleName, Ordinal, platform); if (ep != null) { return(ep); } ctx.Warn("Unable to resolve imported reference {0}.", this); return(new ExternalProcedure(this.ToString(), null)); }
/// <summary> /// 2 Očitava ulaz /// </summary> //public abstract inputResultCollection read(inputResultCollection __results); /// <summary> /// Primena procitanog unosa /// </summary> /// <param name="platform"></param> /// <param name="__currentOutput"></param> /// <returns></returns> public abstract textInputResult applyReading(IPlatform platform, textInputResult __currentOutput);