public void SaveAndRetrieveByExample() { Environment saved = DataFactory.CreateEnvironmentRequest(); Guid environmentId = (new EnvironmentRepository()).Save(saved); ApplicationInfo applicationInfo = new ApplicationInfo { ApplicationKey = "UnitTesting", }; Environment example = new Environment { ApplicationInfo = applicationInfo, InstanceId = "ThisInstance01", SessionToken = "2e5dd3ca282fc8ddb3d08dcacc407e8a", SolutionId = "auTestSolution", UserToken = "UserToken01" }; IEnumerable<Environment> environments = (new EnvironmentRepository()).Retrieve(example); foreach (Environment retrieved in environments) { Assert.AreEqual(saved.ApplicationInfo.ApplicationKey, retrieved.ApplicationInfo.ApplicationKey); Assert.AreEqual(saved.InstanceId, retrieved.InstanceId); Assert.AreEqual(saved.SessionToken, retrieved.SessionToken); Assert.AreEqual(saved.Id, retrieved.Id); Assert.AreEqual(saved.SolutionId, retrieved.SolutionId); Assert.AreEqual(saved.UserToken, retrieved.UserToken); } }
public void VerifyApplicationDataSettingsPath() { var info = new ApplicationInfo("EyeSoft", "Test"); new DataSettingsConfiguration(new ApplicationData(info, DataScope.CurrentUser, new[] { "General", "Mail" }), true, "MyData") .Path.Should().EndWith(@"EyeSoft\Test\General\Mail\MyData.xml.secure"); }
public void VerifyApplicationDataSettingsSubFolderCannotBeEmpty() { var info = new ApplicationInfo("EyeSoft", "Test"); var subFolders = new[] { "General", string.Empty }; Executing .This(() => new DataSettingsConfiguration(new ApplicationData(info, DataScope.CurrentUser, subFolders), true, "MyData")) .Should().Throw<ArgumentException>(); }
public override void read(BinaryReader reader) { reader.BaseStream.Seek(0, SeekOrigin.Begin); header = new Header(); header.read(reader); screenshot = new Screenshot(header.screenshotWidth, header.screenshotHeight); screenshot.read(reader); applicationInfo = new ApplicationInfo(); applicationInfo.read(reader); index = new Index(); index.read(reader); idBlocks = new Dictionary<uint, IdBlock>(); reader.BaseStream.Seek(index.offset3, SeekOrigin.Begin); for(var i = 0; i < index.blockCount1; i++) { var idBlock = new IdBlock(); idBlock.read(reader); idBlocks.Add(idBlock.id, idBlock); } reader.BaseStream.Seek(index.offset4, SeekOrigin.Begin); for (var i = 0; i < index.blockCount2; i++) { var idBlock = new IdBlock(); idBlock.read(reader); idBlocks.Add(idBlock.id, idBlock); } reader.BaseStream.Seek(index.offset6, SeekOrigin.Begin); for (var i = 0; i < index.blockCount3; i++) { var idBlock = new IdBlock(); idBlock.read(reader); idBlocks.Add(idBlock.id, idBlock); } formBlocks = new Dictionary<uint, FormBlock>(); reader.BaseStream.Seek(index.offset5, SeekOrigin.Begin); for(var i = 0; i < index.blockCount4; i++) { var formBlock = new FormBlock(); formBlock.read(reader); formBlocks.Add(formBlock.id, formBlock); } }
public DeviceSummary(DeviceInfo deviceInfo, ApplicationInfo applicationInfo) : base(deviceInfo, applicationInfo) { this.Locales = new List<Aggregate<string>>(); this.Carriers = new List<Aggregate<string>>(); this.ManufacturerModels = new List<ManufacturerModelAggregate>(); this.OperatingSystems = new List<Aggregate<string>>(); this.Resolutions = new List<Resolution>(); this.Locales.Add(new Aggregate<string>(deviceInfo.Locale)); this.Carriers.Add(new Aggregate<string>(deviceInfo.Carrier)); this.ManufacturerModels.Add(new ManufacturerModelAggregate(deviceInfo.Manufactorer, deviceInfo.Model)); this.OperatingSystems.Add(new Aggregate<string>(deviceInfo.OperatingSystem)); this.Resolutions.Add(new Resolution(deviceInfo.ResolutionWidth, deviceInfo.ResolutionHeight)); }
static GenFuTagHelper() { //TODO: Review with James. This stuff used to be wired up via DI but is not anymore. // It was also very slow so I had to put it in a static constructor. Doing this for every tag helper instance was too slow. var projectContext = ProjectContext.CreateContextForEachFramework(Directory.GetCurrentDirectory(), null, new[] { PlatformServices.Default.Application.RuntimeFramework.FullName }).First(); ApplicationInfo appInfo = new ApplicationInfo("TagHelperSamples.GenFu", PlatformServices.Default.Application.ApplicationBasePath); ILibraryExporter exporter = new LibraryExporter(projectContext, appInfo); _references = new List<MetadataReference>(); var exports = exporter.GetAllExports(); var metaDataRefs = exports.SelectMany(x => x.GetMetadataReferences()).ToList(); foreach (var reference in metaDataRefs) { _references.Add(reference); } }
internal Badging(FileInfo source, string dump) { this.source = source; this.package = new PackageInfo(); this.application = new ApplicationInfo(); this.activity = new LaunchableActivity(); this.sdkVersion = ""; this.targetSdkVersion = ""; this.usesPermission = new List<string>(); this.densities = new List<int>(); ProcessDump(dump); }
public MainViewModel(IApplicationRegistrationService applicationRegistrationService, IFileAssociationService fileAssociationService) { Argument.IsNotNull(() => applicationRegistrationService); Argument.IsNotNull(() => fileAssociationService); _applicationRegistrationService = applicationRegistrationService; _fileAssociationService = fileAssociationService; var entryAssembly = AssemblyHelper.GetEntryAssembly(); Title = entryAssembly.Title(); ApplicationInfo = new ApplicationInfo(entryAssembly); FileAssociations = "abc;xyz;txt"; RegisterApplication = new Command(OnRegisterApplicationExecute, OnRegisterApplicationCanExecute); UnregisterApplication = new Command(OnUnregisterApplicationExecute, OnUnregisterApplicationCanExecute); AssociateFiles = new Command(OnAssociateFilesExecute, OnAssociateFilesCanExecute); }
public void CreateApplicationInfo() { uint applicationID = 10; byte[] data = { 10, 20, 30, 40, 45 }; FileHelper.GetNewFile(origFile, newFile); using (FlacFile flac = new FlacFile(newFile)) { // Adding some bits of padding ApplicationInfo appInfoBlock = new ApplicationInfo(); appInfoBlock.ApplicationID = 10; appInfoBlock.ApplicationData = data; flac.Metadata.Add(appInfoBlock); flac.Save(); } using (FlacFile flac = new FlacFile(newFile)) { ApplicationInfo appInfoBlock = flac.ApplicationInfo; Assert.IsNotNull(appInfoBlock); Assert.AreEqual<uint>(applicationID, appInfoBlock.ApplicationID); bool dataIsSame = true; for (int i = 0; i < data.Length; i++) { if (data[i] != appInfoBlock.ApplicationData[i]) { dataIsSame = false; break; } } Assert.IsTrue(dataIsSame); } }
/// <summary> /// Prints the /// </summary> /// <param name="appInfo">Metadata on the calling application.</param> public static void PrintShortArgumentHelp(ApplicationInfo appInfo) { // Step 1: Build the calling convention line var exeName = Portable.Utilities.ReflectionUtil.GetAssemblyTitle(appInfo.AssemblyInfo) + ".exe "; var callingBuilder = new StringBuilder(exeName); var shortSampleBuilder = new StringBuilder(exeName); var sampleBuilder = new StringBuilder(exeName); appInfo.CommandlineArgumentInfos.OrderByDescending(arg => arg.IsMandatory).ThenBy(arg => arg.OrderPosition).ToList().ForEach( arg => { callingBuilder.AppendFormat("{0}{1}{2}{3} ", arg.IsMandatory ? string.Empty : "[", appInfo.ParameterPraefix, arg.ArgumentName, arg.IsMandatory ? string.Empty : "]"); if (arg.IsFlag) { sampleBuilder.AppendFormat("{0}{1} ", appInfo.ParameterPraefix, arg.ArgumentName); } else { sampleBuilder.AppendFormat("{0}{1}{2}{3} ", appInfo.ParameterPraefix, arg.ArgumentName, appInfo.ParameterDelimiter, arg.SampleValue); } if (arg.IsMandatory) { shortSampleBuilder.AppendFormat("{0} ", arg.SampleValue); } }); Console.WriteLine("Usage:\n {0}", callingBuilder); Console.WriteLine("Short Sample call:\n {0}", shortSampleBuilder); Console.WriteLine("Full Sample call:\n {0}", sampleBuilder); }
private List<ApplicationInfo> generateAppListRecursing(DirectoryInfo directory) { _logger.Debug("Scanning directory {0}", directory.FullName); List<ApplicationInfo> rval = new List<ApplicationInfo>(); foreach (DirectoryInfo subfolder in directory.GetDirectories()) { rval.AddRange(generateAppListRecursing(subfolder)); } foreach (FileInfo file in directory.GetFiles()) { _logger.Debug("Interrogating file {0}", file.FullName); ApplicationInfo ai = new ApplicationInfo(); String ext = Path.GetExtension(file.FullName); if (executableExtensions.Contains(ext, StringComparer.OrdinalIgnoreCase)) { try { ai.Name = Path.GetFileNameWithoutExtension(file.FullName); ai.Path = file.FullName; string target = string.Empty; if (file.Extension.Equals(".lnk", StringComparison.OrdinalIgnoreCase)) { _logger.Debug("Attempting to interrogate shortcut to application: {0}", file.FullName); Interop.Shell.Link link = new Interop.Shell.Link(file.FullName); target = link.Target; } else { target = file.FullName; } if (!executableExtensions.Contains(Path.GetExtension(target), StringComparer.OrdinalIgnoreCase)) { System.Diagnostics.Debug.WriteLine(file.Name + ": " + target); continue; } _logger.Debug("Attempting to get associated icon for {0}", file.FullName); ai.Icon = ai.GetAssociatedIcon(); rval.Add(ai); } catch (Exception ex) { //Output the reason to the debugger _logger.Debug("Error creating ApplicationInfo object in appgrabber. Details: {0}\n{1}", ex.Message, ex.StackTrace); } } } return rval; }
private void ListenerAdapter_ApplicationCreated(object sender, ApplicationCreatedEventArgs e) { EnqueueApplicationAction(apps => { var app = new ApplicationInfo(e.ApplicationKey, e.ApplicationVirtualPath, e.SiteId, e.ApplicationPoolName, _appPools[e.ApplicationPoolName].State, e.RequestsBlockedState, _messagePublicationNotificationServiceUri, GenerateListenerChannelId); apps.Add(e.ApplicationVirtualPath, app); TraceInformation($"Created application [{app.ApplicationKey}:{app.ApplicationPath}].", GetType()); OpenNewListenerChannelInstance(app, NewListenerChannelInstanceConstraints.HasPendingMessages); }); }
private void OpenNewListenerChannelInstance(ApplicationInfo app, NewListenerChannelInstanceConstraints constraints) { if (_isDisposed) { return; } if (!app.CanOpenNewListenerChannelInstance) { TraceInformation($"Skipping the creation of a listener channel for application [{app.ApplicationPoolName}:{app.ApplicationPath}] because [{nameof(app.CanOpenNewListenerChannelInstance)}] returned false.", GetType()); return; } if (constraints.HasFlag(NewListenerChannelInstanceConstraints.HasPendingMessages) && !_queueMon.ApplicationHasPendingMessages(app.ApplicationPath)) { TraceInformation($"Skipping the creation of listener channel for application [{app.ApplicationPoolName}:{app.ApplicationPath}] because of the constraint [{nameof(NewListenerChannelInstanceConstraints.HasPendingMessages)}].", GetType()); return; } TraceInformation($"Opening a new listener channel for application [{app.ApplicationPoolName}:{app.ApplicationPath}] with listener channel id [{app.ListenerChannelId}].", GetType()); _listenerAdapter.OpenListenerChannelInstance(app.ApplicationPoolName, app.ListenerChannelId.Value, app.ListenerChannelSetup.ToBytes()); app.CanOpenNewListenerChannelInstance = false; }
private void Initialize() { AppDomain.CurrentDomain.AssemblyResolve += SbmqmDomain_AssemblyResolve; _monitorState = new SbmqmMonitorState(); Config = SystemConfig.Load(); Config.StartCount += 1; Config.Save(); // Check if we still have the ServiceBus Adapter available var availMgrs = ServiceBusFactory.AvailableServiceBusManagers(); if( !availMgrs.Any(mgr => mgr.Name == Config.ServiceBus && mgr.Version == Config.ServiceBusVersion && mgr.QueueType == Config.ServiceBusQueueType) ) { // Check if we have any other versions available var m = availMgrs.FirstOrDefault(mgr => mgr.Name == Config.ServiceBus && mgr.QueueType == Config.ServiceBusQueueType); if( m != null ) Config.CurrentServer.ServiceBusVersion = m.Version; else { // Check if we have this ServiceBus Type m = availMgrs.FirstOrDefault(mgr => mgr.Name == Config.ServiceBus); if( m != null ) { Config.CurrentServer.ServiceBusQueueType = m.QueueType; Config.CurrentServer.ServiceBusVersion = m.Version; } else throw new NotSupportedException("Not Supported Service Bus type '{0}', Please re-install Service Bus MQ Manager.".With(Config.ServiceBus)); } } CreateServiceBusManager(Config.ServiceBus, Config.ServiceBusVersion, Config.ServiceBusQueueType); _history = new CommandHistoryManager(Config); AppInfo = new ApplicationInfo(Config.Id, Assembly.GetEntryAssembly()); }
public void OpenFlacFileAndCreateMultipleApplicationInfo() { int appInfoCount = 0; string origFile = @"Data\testfile3.flac"; string newFile = @"Data\testfile3_temp.flac"; FileHelper.GetNewFile(origFile, newFile); try { using (FlacFile flac = new FlacFile(newFile)) { if (flac.ApplicationInfo != null) { appInfoCount = 1; } ApplicationInfo appInfo = new ApplicationInfo(); appInfo.ApplicationID = 10; appInfo.ApplicationData = new byte[] { 10, 20, 30 }; flac.Metadata.Add(appInfo); appInfo = new ApplicationInfo(); appInfo.ApplicationID = 20; appInfo.ApplicationData = new byte[] { 40, 50, 60 }; flac.Metadata.Add(appInfo); appInfoCount += 2; flac.Save(); } using (FlacFile flac = new FlacFile(newFile)) { IEnumerable<ApplicationInfo> appInfo = flac.GetAllApplicationInfo(); Assert.AreEqual<int>(appInfoCount, appInfo.Count()); Assert.AreEqual<uint>(10, appInfo.ElementAt(appInfoCount - 2).ApplicationID); Assert.AreEqual<uint>(20, appInfo.ElementAt(appInfoCount - 1).ApplicationID); } } finally { if (File.Exists(newFile)) { File.Delete(newFile); } } }
public ErrorReport(ApplicationInfo appData, string errorMsg, string[] managerState) { _error = new Error(errorMsg); _appData = appData; _managerState = managerState; }
/// <summary> /// Updates the application's configuration in HealthVault. /// </summary> /// /// <param name="connection"> /// The connection to use to make the update. /// </param> /// /// <param name="applicationInfo"> /// The <see cref="ApplicationInfo"/> to update. /// </param> /// /// <remarks> /// This method makes a remote call to the HealthVault service. /// The calling application in the <paramref name="connection"/> must be the same as /// the application specified by this ApplicationInfo instance or its master application. /// Note, this update will replace all configuration elements for the application. It is /// advised that <see cref="ApplicationProvisioning.Provisioner.GetApplication"/> is /// called to retrieve the existing application configuration before changing values and /// calling Update. /// </remarks> /// /// <exception cref="ArgumentNullException"> /// If <paramref name="connection"/> is <b>null</b>. /// </exception> /// /// <exception cref="HealthServiceException"> /// The HealthVault service returns an error. /// </exception> /// public virtual void UpdateChildApplication( ApplicationConnection connection, ApplicationInfo applicationInfo) { Validator.ThrowIfArgumentNull(connection, "connection", "ProvisionerNullConnection"); Validator.ThrowInvalidIf(applicationInfo.Id == Guid.Empty, "ProvisionerEmptyAppId"); HealthServiceRequest request = new HealthServiceRequest(connection, "UpdateApplication", 2); request.Parameters = applicationInfo.GetRequestParameters(applicationInfo.Id); request.Execute(); }
public unsafe GraphicsAdapterFactoryInstance(bool enableValidation) { var applicationInfo = new ApplicationInfo { StructureType = StructureType.ApplicationInfo, ApiVersion = new SharpVulkan.Version(1, 0, 0), EngineName = Marshal.StringToHGlobalAnsi("Xenko"), //EngineVersion = new SharpVulkan.Version() }; var desiredLayerNames = new[] { //"VK_LAYER_LUNARG_standard_validation", "VK_LAYER_GOOGLE_threading", "VK_LAYER_LUNARG_parameter_validation", "VK_LAYER_LUNARG_device_limits", "VK_LAYER_LUNARG_object_tracker", "VK_LAYER_LUNARG_image", "VK_LAYER_LUNARG_core_validation", "VK_LAYER_LUNARG_swapchain", "VK_LAYER_GOOGLE_unique_objects", //"VK_LAYER_LUNARG_api_dump", //"VK_LAYER_LUNARG_vktrace" }; IntPtr[] enabledLayerNames = new IntPtr[0]; if (enableValidation) { var layers = Vulkan.InstanceLayerProperties; var availableLayerNames = new HashSet<string>(); for (int index = 0; index < layers.Length; index++) { var properties = layers[index]; var namePointer = new IntPtr(Interop.Fixed(ref properties.LayerName)); var name = Marshal.PtrToStringAnsi(namePointer); availableLayerNames.Add(name); } enabledLayerNames = desiredLayerNames .Where(x => availableLayerNames.Contains(x)) .Select(Marshal.StringToHGlobalAnsi).ToArray(); } var extensionProperties = Vulkan.GetInstanceExtensionProperties(); var availableExtensionNames = new List<string>(); var desiredExtensionNames = new List<string>(); for (int index = 0; index < extensionProperties.Length; index++) { var namePointer = new IntPtr(Interop.Fixed(ref extensionProperties[index].ExtensionName)); var name = Marshal.PtrToStringAnsi(namePointer); availableExtensionNames.Add(name); } desiredExtensionNames.Add("VK_KHR_surface"); if (!availableExtensionNames.Contains("VK_KHR_surface")) throw new InvalidOperationException("Required extension VK_KHR_surface is not available"); #if SILICONSTUDIO_PLATFORM_WINDOWS_DESKTOP desiredExtensionNames.Add("VK_KHR_win32_surface"); if (!availableExtensionNames.Contains("VK_KHR_win32_surface")) throw new InvalidOperationException("Required extension VK_KHR_win32_surface is not available"); #elif SILICONSTUDIO_PLATFORM_ANDROID desiredExtensionNames.Add("VK_KHR_android_surface"); if (!availableExtensionNames.Contains("VK_KHR_android_surface")) throw new InvalidOperationException("Required extension VK_KHR_android_surface is not available"); #elif SILICONSTUDIO_PLATFORM_LINUX if (availableExtensionNames.Contains("VK_KHR_xlib_surface")) { desiredExtensionNames.Add("VK_KHR_xlib_surface"); HasXlibSurfaceSupport = true; } else if (availableExtensionNames.Contains("VK_KHR_xcb_surface")) { desiredExtensionNames.Add("VK_KHR_xcb_surface"); } else { throw new InvalidOperationException("None of the supported surface extensions VK_KHR_xcb_surface or VK_KHR_xlib_surface is available"); } #endif bool enableDebugReport = enableValidation && availableExtensionNames.Contains("VK_EXT_debug_report"); if (enableDebugReport) desiredExtensionNames.Add("VK_EXT_debug_report"); var enabledExtensionNames = desiredExtensionNames.Select(Marshal.StringToHGlobalAnsi).ToArray(); var createDebugReportCallbackName = Marshal.StringToHGlobalAnsi("vkCreateDebugReportCallbackEXT"); try { fixed (void* enabledExtensionNamesPointer = &enabledExtensionNames[0]) { var instanceCreateInfo = new InstanceCreateInfo { StructureType = StructureType.InstanceCreateInfo, ApplicationInfo = new IntPtr(&applicationInfo), EnabledLayerCount = enabledLayerNames != null ? (uint)enabledLayerNames.Length : 0, EnabledLayerNames = enabledLayerNames?.Length > 0 ? new IntPtr(Interop.Fixed(enabledLayerNames)) : IntPtr.Zero, EnabledExtensionCount = (uint)enabledExtensionNames.Length, EnabledExtensionNames = new IntPtr(enabledExtensionNamesPointer) }; NativeInstance = Vulkan.CreateInstance(ref instanceCreateInfo); } if (enableDebugReport) { var createDebugReportCallback = (CreateDebugReportCallbackDelegate)Marshal.GetDelegateForFunctionPointer(NativeInstance.GetProcAddress((byte*)createDebugReportCallbackName), typeof(CreateDebugReportCallbackDelegate)); debugReport = DebugReport; var createInfo = new DebugReportCallbackCreateInfo { StructureType = StructureType.DebugReportCallbackCreateInfo, Flags = (uint)(DebugReportFlags.Error | DebugReportFlags.Warning /* | DebugReportFlags.PerformanceWarning | DebugReportFlags.Information | DebugReportFlags.Debug*/), Callback = Marshal.GetFunctionPointerForDelegate(debugReport) }; createDebugReportCallback(NativeInstance, ref createInfo, null, out debugReportCallback); } if (availableExtensionNames.Contains("VK_EXT_debug_marker")) { var beginDebugMarkerName = System.Text.Encoding.ASCII.GetBytes("vkCmdDebugMarkerBeginEXT"); var ptr = NativeInstance.GetProcAddress((byte*)Interop.Fixed(beginDebugMarkerName)); if (ptr != IntPtr.Zero) BeginDebugMarker = (BeginDebugMarkerDelegate)Marshal.GetDelegateForFunctionPointer(ptr, typeof(BeginDebugMarkerDelegate)); var endDebugMarkerName = System.Text.Encoding.ASCII.GetBytes("vkCmdDebugMarkerEndEXT"); ptr = NativeInstance.GetProcAddress((byte*)Interop.Fixed(endDebugMarkerName)); if (ptr != IntPtr.Zero) EndDebugMarker = (EndDebugMarkerDelegate)Marshal.GetDelegateForFunctionPointer(ptr, typeof(EndDebugMarkerDelegate)); } } finally { foreach (var enabledExtensionName in enabledExtensionNames) { Marshal.FreeHGlobal(enabledExtensionName); } foreach (var enabledLayerName in enabledLayerNames) { Marshal.FreeHGlobal(enabledLayerName); } Marshal.FreeHGlobal(applicationInfo.EngineName); Marshal.FreeHGlobal(createDebugReportCallbackName); } }
/// <summary> /// Is used to inform the caller on error and give him help. /// </summary> /// <param name="errorMessage">The message to display to the user.</param> /// <param name="appInfo">Metadata on the calling application.</param> public static void PrintArgumentError(ApplicationInfo appInfo, string errorMessage) { WriteLine(errorMessage, ConsoleColor.Red); Console.WriteLine(); PrintShortArgumentHelp(appInfo); }
private void ProcessDump(string dump) { using (StringReader r = new StringReader(dump)) { string line; while (r.Peek() != -1) { line = r.ReadLine(); if (line.StartsWith(PACKAGE)) { //find name int nameStart = line.IndexOf(PACKAGE_NAME) + PACKAGE_NAME.Length; int nameLength = line.IndexOf(APOSTROPHE, nameStart) - nameStart; string name = line.Substring(nameStart, nameLength); //find versionCode int versionCodeStart = line.IndexOf(PACKAGE_VERSION_CODE) + PACKAGE_VERSION_CODE.Length; int versionCodeLength = line.IndexOf(APOSTROPHE, versionCodeStart) - versionCodeStart; string versionCode = line.Substring(versionCodeStart, versionCodeLength); //find versionName int versionNameStart = line.IndexOf(PACKAGE_VERSION_NAME) + PACKAGE_VERSION_NAME.Length; int versionNameLength = line.IndexOf(APOSTROPHE, versionNameStart) - versionNameStart; string versionName = line.Substring(versionNameStart, versionNameLength); this.package = new PackageInfo(name, versionCode, versionName); } else if (line.StartsWith(APPLICATION)) { //find label int labelStart = line.IndexOf(APPLICATION_LABEL) + APPLICATION_LABEL.Length; int labelLength = line.IndexOf(APOSTROPHE, labelStart) - labelStart; string label = line.Substring(labelStart, labelLength); //find icon int iconStart = line.IndexOf(APPLICATION_ICON) + APPLICATION_ICON.Length; int iconLength = line.IndexOf(APOSTROPHE, iconStart) - iconStart; string icon = line.Substring(iconStart, iconLength); this.application = new ApplicationInfo(label, icon); } else if (line.StartsWith(ACTIVITY)) { //find name int nameStart = line.IndexOf(ACTIVITY_NAME) + ACTIVITY_NAME.Length; int nameLength = line.IndexOf(APOSTROPHE, nameStart) - nameStart; string name = line.Substring(nameStart, nameLength); //find label int labelStart = line.IndexOf(ACTIVITY_LABEL) + ACTIVITY_LABEL.Length; int labelLength = line.IndexOf(APOSTROPHE, labelStart) - labelStart; string label = line.Substring(labelStart, labelLength); //find icon int iconStart = line.IndexOf(ACTIVITY_ICON) + ACTIVITY_ICON.Length; int iconLength = line.IndexOf(APOSTROPHE, iconStart) - iconStart; string icon = line.Substring(iconStart, iconLength); this.activity = new LaunchableActivity(name, label, icon); } else if (line.StartsWith(SDK_VERSION)) { this.sdkVersion = line.Substring(SDK_VERSION.Length).Replace(APOSTROPHE, ""); } else if (line.StartsWith(SDK_TARGET)) { this.targetSdkVersion = line.Substring(SDK_TARGET.Length).Replace(APOSTROPHE, ""); } else if (line.StartsWith(USES_PERMISSION)) { this.usesPermission.Add(line.Substring(USES_PERMISSION.Length).Replace(APOSTROPHE, "")); } else if (line.StartsWith(DENSITIES)) { string[] densities = line.Substring(DENSITIES.Length + 2).Split(new char[] { '\'', ' ' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < densities.Length; i++) this.densities.Add(int.Parse(densities[i])); } } } }
/*private List<ApplicationInfo> generateAppListRecursing(DirectoryInfo directory) { List<ApplicationInfo> rval = new List<ApplicationInfo>(); foreach (DirectoryInfo subfolder in directory.GetDirectories()) { rval.AddRange(generateAppListRecursing(subfolder)); } foreach (FileInfo file in directory.GetFiles()) { ApplicationInfo ai = new ApplicationInfo(); String ext = Path.GetExtension(file.FullName); if (executableExtensions.Contains(ext, StringComparer.OrdinalIgnoreCase)) { try { ai.Name = Path.GetFileNameWithoutExtension(file.FullName); ai.Path = file.FullName; string target = string.Empty; if (file.Extension.Equals(".lnk", StringComparison.OrdinalIgnoreCase)) { Interop.Shell.Link link = new Interop.Shell.Link(file.FullName); target = link.Target; } else { target = file.FullName; } // remove items that we can't execute. also remove uninstallers if (!executableExtensions.Contains(Path.GetExtension(target), StringComparer.OrdinalIgnoreCase) || ai.Name == "Uninstall" || ai.Name.StartsWith("Uninstall ")) { System.Diagnostics.Debug.WriteLine("Not an app: " + file.Name + ": " + target); continue; } ai.Icon = ai.GetAssociatedIcon(); rval.Add(ai); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("Error creating ApplicationInfo object in appgrabber. " + ex.Message); } } } return rval; }*/ private List<ApplicationInfo> generateAppList(string directory) { List<ApplicationInfo> rval = new List<ApplicationInfo>(); foreach (string file in Directory.EnumerateFiles(directory, "*", SearchOption.AllDirectories)) { ApplicationInfo ai = new ApplicationInfo(); String ext = Path.GetExtension(file); if (executableExtensions.Contains(ext, StringComparer.OrdinalIgnoreCase)) { try { ai.Name = Path.GetFileNameWithoutExtension(file); ai.Path = file; string target = string.Empty; string fileExt = Path.GetExtension(file); if (fileExt.Equals(".lnk", StringComparison.OrdinalIgnoreCase)) { Interop.Shell.Link link = new Interop.Shell.Link(file); target = link.Target; } else { target = file; } // remove items that we can't execute. also remove uninstallers if (!executableExtensions.Contains(Path.GetExtension(target), StringComparer.OrdinalIgnoreCase) || ai.Name == "Uninstall" || ai.Name.StartsWith("Uninstall ")) { System.Diagnostics.Debug.WriteLine("Not an app: " + file + ": " + target); continue; } ai.Icon = ai.GetAssociatedIcon(); rval.Add(ai); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("Error creating ApplicationInfo object in appgrabber. " + ex.Message); } } } return rval; }
public ErrorReport(ApplicationInfo appData, Error error, string[] managerState) { _error = error; _appData = appData; _managerState = RemoveSensibleData(managerState); }
protected virtual void CreateInstance() { var applicationInfo = new ApplicationInfo { StructureType = StructureType.ApplicationInfo, EngineVersion = 0, ApiVersion = Vulkan.ApiVersion }; var enabledLayerNames = new [] { Marshal.StringToHGlobalAnsi("VK_LAYER_LUNARG_standard_validation"), }; var enabledExtensionNames = new [] { Marshal.StringToHGlobalAnsi("VK_KHR_surface"), Marshal.StringToHGlobalAnsi("VK_KHR_win32_surface"), Marshal.StringToHGlobalAnsi("VK_EXT_debug_report"), }; try { fixed (void* enabledLayerNamesPointer = &enabledLayerNames[0]) fixed (void* enabledExtensionNamesPointer = &enabledExtensionNames[0]) { var instanceCreateInfo = new InstanceCreateInfo { StructureType = StructureType.InstanceCreateInfo, ApplicationInfo = new IntPtr(&applicationInfo), EnabledExtensionCount = (uint)enabledExtensionNames.Length, EnabledExtensionNames = new IntPtr(enabledExtensionNamesPointer), }; if (validate) { instanceCreateInfo.EnabledLayerCount = (uint)enabledLayerNames.Length; instanceCreateInfo.EnabledLayerNames = new IntPtr(enabledLayerNamesPointer); } instance = Vulkan.CreateInstance(ref instanceCreateInfo); } if (validate) { var createDebugReportCallbackName = Encoding.ASCII.GetBytes("vkCreateDebugReportCallbackEXT"); fixed (byte* createDebugReportCallbackNamePointer = &createDebugReportCallbackName[0]) { var createDebugReportCallback = Marshal.GetDelegateForFunctionPointer<CreateDebugReportCallbackDelegate>(instance.GetProcAddress(createDebugReportCallbackNamePointer)); debugReport = DebugReport; var createInfo = new DebugReportCallbackCreateInfo { StructureType = StructureType.DebugReportCallbackCreateInfo, Flags = (uint)(DebugReportFlags.Error | DebugReportFlags.Warning | DebugReportFlags.PerformanceWarning), Callback = Marshal.GetFunctionPointerForDelegate(debugReport) }; createDebugReportCallback(instance, ref createInfo, null, out debugReportCallback); } } } finally { foreach (var enabledExtensionName in enabledExtensionNames) Marshal.FreeHGlobal(enabledExtensionName); foreach (var enabledLayerName in enabledLayerNames) Marshal.FreeHGlobal(enabledLayerName); } physicalDevice = instance.PhysicalDevices[0]; var props = physicalDevice.QueueFamilyProperties; }
public void LoadFrom(Uri manifestLocation) { ArgumentUtility.CheckNotNull ("manifestLocation", manifestLocation); var configuration = DesktopGapConfigurationProvider.Create (String.Empty, manifestLocation.ToString()).GetConfiguration(); Application = new ApplicationInfo { Name = configuration.Application.Name, BaseUri = configuration.Application.GetBaseUri(), IconUri = configuration.Application.GetIconUri(), ManifestUri = manifestLocation, AllowCloseHomeTab = configuration.Application.AllowCloseHomeTab, AlwaysShowUrl = configuration.Application.AlwaysShowUrl, AlwaysOpenHomeUrl = configuration.Application.AlwaysOpenHomeUrl, HomeUri = configuration.Application.GetHomeUri() }; var thirdPartyUrlRules = configuration.Security.NonApplicationUrlRules; var applicationUrlRules = configuration.Security.ApplicationUrlRules; var startUpUrlRules = configuration.Security.StartupUrlRules; var resourceUrls = thirdPartyUrlRules.Union (applicationUrlRules); var addInRules = configuration.Security.AddInRules; ResourceFilter = new UrlFilter (resourceUrls); NonApplicationUrlFilter = new UrlFilter (thirdPartyUrlRules); AddInAllowedFilter = new UrlFilter (applicationUrlRules); StartUpFilter = new UrlFilter (startUpUrlRules); AddInFilter = new AddInFilter (addInRules); HomeTabColorCode = configuration.Application.TabColors.Home; NonApplicationTabColorCode = configuration.Application.TabColors.NonApplication; ApplicationTabColorCode = configuration.Application.TabColors.Application; EnableResourceFilter = configuration.Security.EnableResourceFilter; }
public void Install(IWindsorContainer container, IConfigurationStore store) { container.Register(Component.For<IWindsorContainer>().Instance(container)); container.AddFacility<TypedFactoryFacility>(); container.Register(Component.For<ITypedFactoryComponentSelector>().ImplementedBy<CustomTypeFactoryComponentSelector>()); //Configure logging ILoggingConfiguration loggingConfiguration = new LoggingConfiguration(); log4net.GlobalContext.Properties["LogFile"] = Path.Combine(loggingConfiguration.LogDirectoryPath, loggingConfiguration.LogFileName); log4net.Config.XmlConfigurator.ConfigureAndWatch(new FileInfo(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile)); var applicationRootNameSpace = typeof (Program).Namespace; container.Kernel.Register(Component.For<ILog>().Instance(LogManager.GetLogger(applicationRootNameSpace))); //Default logger container.Kernel.Resolver.AddSubResolver(new LoggerSubDependencyResolver()); //Enable injection of class specific loggers //Manual registrations container.Register(Component.For<MainWindow>().Activator<StrictComponentActivator>()); container.Register(Component.For<MainView>().Activator<StrictComponentActivator>()); container.Register(Component.For<MainViewModel>().Activator<StrictComponentActivator>()); //Factory registrations example: //container.Register(Component.For<ITeamProviderFactory>().AsFactory()); //container.Register( // Component.For<ITeamProvider>() // .ImplementedBy<CsvTeamProvider>() // .Named("CsvTeamProvider") // .LifeStyle.Transient); //container.Register( // Component.For<ITeamProvider>() // .ImplementedBy<SqlTeamProvider>() // .Named("SqlTeamProvider") // .LifeStyle.Transient); container.Register(Component.For<IInvocationLogStringBuilder>().ImplementedBy<InvocationLogStringBuilder>().LifestyleSingleton()); container.Register(Component.For<ILogFactory>().ImplementedBy<LogFactory>().LifestyleSingleton()); /////////////////////////////////////////////////////////////////// //Automatic registrations /////////////////////////////////////////////////////////////////// // // Register all interceptors // container.Register(Classes.FromAssemblyInThisApplication() .Pick().If(type => type.Name.EndsWith("Aspect")).LifestyleSingleton()); // // Register all command providers and attach logging interceptor // const string libraryRootNameSpace = "AdTools.Library"; container.Register(Classes.FromAssemblyContaining<CommandProvider>() .InNamespace(libraryRootNameSpace, true) .If(type => type.Is<CommandProvider>()) .Configure(registration => registration.Interceptors(new[] { typeof(InfoLogAspect) })) .WithService.DefaultInterfaces().LifestyleTransient() ); // // Register all command definitions // container.Register( Classes.FromAssemblyInThisApplication() .BasedOn<CommandDefinition>() .WithServiceBase() ); // // Register all singletons found in the library // container.Register(Classes.FromAssemblyContaining<CommandDefinition>() .InNamespace(libraryRootNameSpace, true) .If(type => Attribute.IsDefined(type, typeof(SingletonAttribute))) .WithService.DefaultInterfaces().LifestyleSingleton()); // // Register all transients found in the library // container.Register(Classes.FromAssemblyContaining<CommandDefinition>() .InNamespace(libraryRootNameSpace, true) .WithService.DefaultInterfaces().LifestyleTransient()); IApplicationInfo applicationInfo = new ApplicationInfo(); container.Register(Component.For<IApplicationInfo>().Instance(applicationInfo).LifestyleSingleton()); }
private void Initialize() { AppDomain.CurrentDomain.AssemblyResolve += SbmqmDomain_AssemblyResolve; _monitorState = new SbmqmMonitorState(); Config = SystemConfig.Load(); Config.StartCount += 1; _mgr = ServiceBusFactory.CreateManager(Config.MessageBus, Config.MessageBusQueueType); _mgr.ErrorOccured += System_ErrorOccured; _mgr.WarningOccured += System_WarningOccured; _mgr.ItemsChanged += System_ItemsChanged; _mgr.Initialize(Config.MonitorServer, Config.MonitorQueues.Select(mq => new Queue(mq.Name, mq.Type, mq.Color)).ToArray(), _monitorState); CanSendCommand = ( _mgr as ISendCommand ) != null; CanViewSubscriptions = ( _mgr as IViewSubscriptions ) != null; _history = new CommandHistoryManager(Config); AppInfo = new ApplicationInfo(Config.Id, Assembly.GetEntryAssembly()); }
private void Initialize() { AppDomain.CurrentDomain.AssemblyResolve += SbmqmDomain_AssemblyResolve; _monitorState = new SbmqmMonitorState(); Config = SystemConfig.Load(); Config.StartCount += 1; Config.Save(); CreateServiceBusManager(Config.ServiceBus, Config.ServiceBusVersion, Config.ServiceBusQueueType); _history = new CommandHistoryManager(Config); AppInfo = new ApplicationInfo(Config.Id, Assembly.GetEntryAssembly()); }
/// <summary> /// Adds a HealthVault application instance for a "child" application of the calling /// application. /// </summary> /// /// <param name="connection"> /// The connection to use to add the application. /// </param> /// /// <param name="applicationConfigurationInformation"> /// Configuration information about the application being provisioned. /// </param> /// /// <returns> /// The new application identifier for the new application provided by HealthVault. /// </returns> /// /// <exception cref="ArgumentNullException"> /// If <paramref name="connection"/> or <paramref name="applicationConfigurationInformation"/> /// is <b>null</b>. /// </exception> /// /// <exception cref="ArgumentException"> /// If <see cref="ApplicationInfo.Name"/>, <see cref="ApplicationInfo.PublicKeys"/>, /// <see cref="ApplicationInfo.OfflineBaseAuthorizations"/>, <see cref="ApplicationInfo.Description"/>, /// <see cref="ApplicationInfo.AuthorizationReason"/>, or <see cref="ApplicationInfo.LargeLogo"/> /// is not specified. /// </exception> /// /// <exception cref="HealthServiceException"> /// If there is an error when the HealthVault service is called. /// </exception> /// public virtual Guid AddChildApplication( OfflineWebApplicationConnection connection, ApplicationInfo applicationConfigurationInformation) { Validator.ThrowIfArgumentNull(connection, "connection", "ProvisionerNullConnection"); Validator.ThrowIfArgumentNull( applicationConfigurationInformation, "applicationConfigurationInformation", "ProvisionerNullApplicationInfo"); Validator.ThrowIfStringNullOrEmpty(applicationConfigurationInformation.Name, "applicationConfigurationInformation"); Validator.ThrowArgumentExceptionIf( applicationConfigurationInformation.PublicKeys.Count < 1, "applicationConfigurationInformation", "AddApplicationPublicKeysMandatory"); Validator.ThrowArgumentExceptionIf( applicationConfigurationInformation.OfflineBaseAuthorizations.Count < 1, "applicationConfigurationInformation", "AddApplicationOfflineBaseAuthorizationsMandatory"); Validator.ThrowIfStringNullOrEmpty( applicationConfigurationInformation.Description, "applicationConfigurationInformation.Description"); Validator.ThrowIfStringNullOrEmpty( applicationConfigurationInformation.AuthorizationReason, "applicationConfigurationInformation.AuthorizationReason"); Validator.ThrowIfArgumentNull( applicationConfigurationInformation.LargeLogo, "applicationConfigurationInformation.LargeLogo", "AddApplicationLargeLogoMandatory"); HealthServiceRequest request = new HealthServiceRequest(connection, "AddApplication", 2); request.Parameters = applicationConfigurationInformation.GetRequestParameters(Guid.Empty); request.Execute(); XPathExpression infoPath = SDKHelper.GetInfoXPathExpressionForMethod( request.Response.InfoNavigator, "AddApplication"); XPathNavigator infoNav = request.Response.InfoNavigator.SelectSingleNode(infoPath); return new Guid(infoNav.SelectSingleNode("id").Value); }