public void InitAllApps() { // 获得本机所有应用 List <string> packageNames = DependencyService.Get <IOpenAppService>().GetApps(); Task.Run(() => { packageNames.ForEach(g => { Apps.Add(new AppModel { PackageName = g, AppName = DependencyService.Get <IOpenAppService>().GetAppName(g), AppIcon = DependencyService.Get <IOpenAppService>().GetAppIcon(g), IsInWhiteList = false }); Console.WriteLine("添加了一个应用!!!!"); }); }); // 获取该用户的白名单应用包名字符串 /*string whiteAppString = await GetAppsAsync(App.StaticUser.UserId); * List<string> whiteAppStrings = new List<string>(whiteAppString.Split(';')); * whiteAppStrings.ForEach(g => * { * var app = Apps.Find(x => x.PackageName.Equals(g)); * if (app != null) * { * Console.WriteLine("应用的名字:" + app.AppName); * app.IsInWhiteList = true; * WhiteList.Add(g); * } * });*/ }
private static void fsw_Changed(object sender, FileSystemEventArgs e) { string json = null; try { // This is necessary because sometimes the file is still accessed by steam, so let's wait for 10 ms and try again. // Maximum 5 times int counter = 1; do { try { json = AcfToJson(File.ReadAllLines(e.FullPath).ToList()); break; } catch (IOException) { System.Threading.Thread.Sleep(50); } }while (counter++ <= 5); } catch { return; } // Shouldn't happen, but might occur if Steam holds the acf file too long if (json == null) { return; } dynamic newJson = JsonConvert.DeserializeObject(json); int newID = JsonToAppInfo(newJson).ID; // Search for changed app, if null it's a new app AppInfo info = Apps.FirstOrDefault(x => x.ID == newID); AppInfoChangedEventArgs eventArgs; if (info != null) // Download state changed { eventArgs = new AppInfoChangedEventArgs(info, info.State); // Only update existing AppInfo info.State = int.Parse(newJson.StateFlags.ToString()); } else // New download started { // Add new AppInfo info = JsonToAppInfo(newJson); Apps.Add(info); eventArgs = new AppInfoChangedEventArgs(info, -1); } OnAppInfoChanged(eventArgs); }
private async Task Init() { var list = await database.GetAll(); foreach (var item in list) { Apps.Add(item); } App.AppAdded += App_AppAdded; }
private async void App_AppAdded(object sender, EventArgs e) { await CoreApplication.MainView.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() => { Apps.Clear(); var list = await database.GetAll(); foreach (var item in list) { Apps.Add(item); } }); }
/// <summary> /// Pin a process /// </summary> public PinnedApp Pin(Process process) { var pa = GetPinned(process); if (pa == null) { pa = BuildPinnedApp(process); Apps.Add(pa); } return(pa); }
/// <summary> /// Pin a program by executable filename /// </summary> public PinnedApp Pin(ProcessFullPath pfp) { var pa = GetPinned(pfp.FileName); if (pa == null) { pa = BuildPinnedApp(pfp.FileName, pfp.Arguments); Apps.Add(pa); } return(pa); }
private void UpdateAppListData(RzAppListDataProvider app) { Apps.Clear(); Pids.Clear(); CurrentApp = app.CurrentAppExecutable; for (int i = 0; i < app.AppCount; i++) { Apps.Add(app.GetExecutableName(i)); Pids.Add(app.GetPid(i)); } AppListUpdated?.Invoke(this, EventArgs.Empty); }
private async Task LoadAppsAsync() { var appBankContents = await Pebble.GetAppbankContentsAsync(); Apps.Clear(); if (appBankContents != null && appBankContents.AppBank != null && appBankContents.AppBank.Apps != null) { foreach (var app in appBankContents.AppBank.Apps) { Apps.Add(app); } } }
public async void ShowAddDialog() { var dialog = new AddApplicationDialog(); var dataContext = new AddApplicationViewModel(o => { _coordinator.HideMetroDialogAsync(this, dialog); }, (model, application) => { _coordinator.HideMetroDialogAsync(this, dialog); Apps.Add(application); }); dialog.DataContext = dataContext; await _coordinator.ShowMetroDialogAsync(this, dialog); }
public void AddProcess(Application app, bool IsBackGroundProcess = false) { app.AppProcess = new Process(_pidcounter); if (!mManager.Allocate(app)) { System.Windows.MessageBox.Show($"Could not allocate enough memory for that.\nAlloation Scheme: {mManager.AllocationMode.ToString()}", "OUT OF MEMORY", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error); return; } app.AppWindowLogic.AppData = app; Apps.Add(app); if (IsBackGroundProcess) { app.IsSystemApp = true; } OnProcessStarted?.Invoke(app); _pidcounter++; }
public void EvalApplication(string name, IEnumerable <Job> tasks, int threshold, bool inorder, bool ca) { Application tc = new Application(name, threshold, inorder, ca); HashSet <string> uniqueTaskNames = new HashSet <string>(); foreach (Job task in tasks) { tc.AddTask(task); if (!eventMap.ContainsKey(task.Name)) { eventMap.Add(task.Name, new List <IMeasurement>()); } uniqueTaskNames.Add(task.Name); } uniqueTaskNames.ForEach(tName => eventMap[tName].Add(tc)); Apps.Add(tc); }
public static void MyClassInitialize(TestContext testContext) { DockerComposeFileName = "docker-compose452AppOn471.yml"; AppNameBeingTested = TestConstants.WebAppName; if (!Apps.ContainsKey(AppNameBeingTested)) { Apps.Add(AppNameBeingTested, new DeployedApp { ikey = TestConstants.WebAppInstrumentationKey, containerName = TestConstants.WebAppContainerName, imageName = TestConstants.WebAppImageName, healthCheckPath = TestConstants.WebAppHealthCheckPath, flushPath = TestConstants.WebAppFlushPath }); } MyClassInitializeBase(); }
private void GetAllProcesses() { try { Process[] processes = Process.GetProcesses(); foreach (Process instance in processes) { var info = new ProcessInfo(); info.ProcessName = instance.ProcessName; info.ProcessId = instance.Id; info.IsSelected = false; Apps.Add(info); } } catch (Exception ex) { LogHelper.WriteLog(ex.Message); } }
public static void MyClassInitialize(TestContext testContext) { DockerComposeFileName = "docker-composeNet20AppOn20.yml"; VersionPrefix = "rdddsc"; VersionPrefixSql = "rdddsc"; AppNameBeingTested = TestConstants.WebAppCore20Name; if (!Apps.ContainsKey(AppNameBeingTested)) { Apps.Add(AppNameBeingTested, new DeployedApp { ikey = TestConstants.WebAppCore20NameInstrumentationKey, containerName = TestConstants.WebAppCore20ContainerName, imageName = TestConstants.WebAppCore20ImageName, healthCheckPath = TestConstants.WebAppCore20HealthCheckPath, flushPath = TestConstants.WebAppCore20FlushPath }); } MyClassInitializeBase(); }
async void RefreshAppList() { try { Refreshing = true; await Task.Run(() => { var apps = AppInfoFactory.GetVisibleAppsInfo(); var expandedApps = apps.Select(a => new ExpandedAppInfo(a)).ToList(); var urls = new List <ExpandedAppInfo>(); foreach (var app in expandedApps) { if (!string.IsNullOrWhiteSpace(app.AppInfo.Domain)) { urls.Add(new ExpandedAppInfo(app.AppInfo.Copy())); app.AppInfo.Domain = string.Empty; } } var uniqueApps = expandedApps.GroupBy(x => x.AppInfo.Description).Select(a => a.First()).ToList(); uniqueApps.AddRange(urls); App.Current.Dispatcher.Invoke(() => { Apps.Clear(); foreach (var app in uniqueApps) { Apps.Add(app); } }); }); } finally { Refreshing = false; } }
/// <summary> /// Fill the collection with phone apps /// </summary> public async Task <bool> GetAppsFromPhone() { try { IReadOnlyDictionary <String, AppNotificationInfo> apps = AccessoryManager.GetApps(); List <vmApp> _temp = new List <vmApp>(); foreach (String key in apps.Keys) { String id = apps[key].Id; String name = apps[key].Name; vmApp _newApp = new vmApp() { ID = id, Name = name /*, AppIconStream = AccessoryManager.GetAppIcon(id)*/ }; _temp.Add(_newApp); // _newApp.PopulateImageData(); } var _sortedapps = from app in _temp orderby app.Selected descending, app.Name select app; foreach (vmApp item in _sortedapps) { Apps.Add(item); } // await Apps.SaveItems(); return(true); } catch (Exception) { } return(false); }
public static void MyClassInitialize(TestContext testContext) { DockerComposeFileName = "docker-compose452AppOn462StatusMonitor.yml"; AppNameBeingTested = TestConstants.WebAppName; VersionPrefix = "rddp"; VersionPrefixSql = "rddp"; if (!Apps.ContainsKey(AppNameBeingTested)) { Apps.Add(AppNameBeingTested, new DeployedApp { ikey = TestConstants.WebAppInstrumentationKey, containerName = TestConstants.WebAppContainerName, imageName = TestConstants.WebAppImageName, healthCheckPath = TestConstants.WebAppHealthCheckPath, flushPath = TestConstants.WebAppFlushPath }); } // Forcefully remove the image to ensure SM gets installed properly. DockerUtils.RemoveDockerImage(Apps[AppNameBeingTested].imageName, true); DockerUtils.RemoveDockerContainer(Apps[AppNameBeingTested].containerName, true); MyClassInitializeBase(); }
public void Load() { if (!Directory.Exists(_userDataPath)) { return; } FileInfo[] files = new DirectoryInfo(_userDataPath).GetFiles("*.lnk"); if (files.Length == 0) { return; } foreach (var file in files) { Apps.Add(CreateShortCutAndBuildApp(file.FullName)); } // sort pinned apps (shortcuts) based on previously saved order Apps.Sort((x, y) => { int xPos = TaskbarPropertiesManager.Instance.Properties.PinnedPrograms.IndexOf(x.Shortcut); int yPos = TaskbarPropertiesManager.Instance.Properties.PinnedPrograms.IndexOf(y.Shortcut); if (xPos < 0) { xPos = int.MaxValue; } if (yPos < 0) { yPos = int.MaxValue; } return(xPos.CompareTo(yPos)); }); }
public Phone() { Apps.Add(new PhoneBook()); Apps.Add(new Calculator()); Apps.Add(new Calendar()); }
internal async Task OnNodeUpdate(NodeInfo ninfo, List <SSDPPCInfo> ssdpinfo) { bool updated = false; bool deleted = false; lock (CachedNodes) { var ssdpin = ssdpinfo.FirstOrDefault(x => x.Id == Id); if (ssdpin != null) { var name = DecryptName(ssdpin.EN); if (name == null) { logger.LogError($"Invalid node from {ninfo.Url}"); return; } NodeInfoForPC info = CachedNodes.FirstOrDefault(x => x.NodeGuid == ninfo.NodeGuid); if (info != null) { if (info.PCTimeStamp < ssdpin.TimeStamp) { CachedNodes.Remove(info); } else { return; } } var newinf = new NodeInfoForPC { NodeGuid = ninfo.NodeGuid, PCVersion = ninfo.PCVersion, PCTimeStamp = ssdpin.TimeStamp, Url = ninfo.Url, Name = name }; CachedNodes.Add(newinf); OnCachedNodesChange(); updated = true; } else { int nremoved = 0; if (CachedNodes.FirstOrDefault(x => x.NodeGuid == ninfo.NodeGuid) != null) { nremoved = CachedNodes.RemoveAll(x => x.NodeGuid == ninfo.NodeGuid); } if (nremoved > 0) { OnCachedNodesChange(); deleted = true; } } } if (updated || deleted) { if (!deleted) { var pci = await GetPeerPCInfo(this, ninfo).ConfigureAwait(false); if ((pci != null) && (pci.StorageProviders != null)) { bool needResync = false; foreach (var sp in pci.StorageProviders) { if (sp.Visibility != StorageProviderVisibility.Public) { continue; } if (sp.Type == StorageProviderInstance.TypeAliYun) { lock (StorageProviderInstances) { if (!StorageProviderInstances.Any(x => sp.Id.Equals(x.RuntimeId))) { var instance = new StorageProviderInstance_AliyunOSS(new StorageProviderInfo { Id = sp.Id, Type = StorageProviderInstance.TypeAliYun, Name = sp.Name, Visibility = sp.Visibility, Settings = sp.Settings }); StorageProviderInstances.Add(instance); needResync = true; } } } if (sp.Type == StorageProviderInstance.TypeAzure) { lock (StorageProviderInstances) { if (!StorageProviderInstances.Any(x => sp.Id.Equals(x.RuntimeId))) { var instance = new StorageProviderInstance_AzureBlob(new StorageProviderInfo { Id = sp.Id, Type = StorageProviderInstance.TypeAzure, Name = sp.Name, Visibility = sp.Visibility, Settings = sp.Settings }); StorageProviderInstances.Add(instance); needResync = true; } } } } if (needResync) { ResyncClientListToStorageProviderInstances(); } } if ((pci != null) && (pci.Apps != null)) { foreach (var ai in pci.Apps) { NodeInfoForPC n = null; lock (CachedNodes) { n = CachedNodes.FirstOrDefault(x => x.NodeGuid == ai.NodeId); } if (n == null) { return; } var a = Apps.FirstOrDefault(x => (x.NodeId == ai.NodeId) && (x.AppId == ai.AppId) && (x.Name == ai.Name)); if (a == null) { lock (Apps) { Apps.Add(ai); } } } } } _ = Task.Run(() => { try { OnNodeChangedEvent?.Invoke(this, EventArgs.Empty); } catch { } }); } }
public void Add(ExeApp app) { app.ExecutablePath = app.ExecutablePath.ToLower(); Apps.Add(app.ExecutablePath, app); }
private void BtnGen_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(txtApp.Text) || string.IsNullOrEmpty(txtUser.Text)) { return; } try { btnGen.IsEnabled = false; var random = new Random(); if (!Apps.ContainsKey(txtApp.Text)) { if (txtApp.Text == "CopyTool") { Apps.Add(txtApp.Text, new KeyByteSet[] { new KeyByteSet(1, 177, 99, 0), new KeyByteSet(2, 186, 153, 17), new KeyByteSet(3, 7, 113, 200), //new KeyByteSet(4, 73, 102, 49), //new KeyByteSet(5, 61, 173, 33), }); } else { var newKeySet = new KeyByteSet[KeyLength]; for (int j = 0; j < KeyLength; j++) { newKeySet[j] = new KeyByteSet(j + 1, (byte)random.Next(0, 256), (byte)random.Next(0, 256), (byte)random.Next(0, 256)); } Apps.Add(txtApp.Text, newKeySet); } AppUserMap.Add(txtApp.Text, new Dictionary <string, int>()); } if (!AppUserMap[txtApp.Text].ContainsKey(txtUser.Text)) { AppUserMap[txtApp.Text].Add(txtUser.Text, AppUserMap[txtApp.Text].Count); } var pkvLicenceKey = new PkvLicenceKeyGenerator(); int seed = AppUserMap[txtApp.Text][txtUser.Text]; // Generate the key string key = pkvLicenceKey.MakeKey(seed, Apps[txtApp.Text]); var kbs1 = Apps[txtApp.Text][new Random().Next(0, KeyLength - 1)]; var kbs2 = Apps[txtApp.Text][new Random().Next(0, KeyLength - 1)]; // The check project also uses a class called KeyByteSet, but with // separate name spacing to achieve single self contained dll var keyByteSet1 = new KeyByteSet(kbs1.KeyByteNo, kbs1.KeyByteA, kbs1.KeyByteB, kbs1.KeyByteC); // Change no to test others var keyByteSet2 = new KeyByteSet(kbs2.KeyByteNo, kbs2.KeyByteA, kbs2.KeyByteB, kbs2.KeyByteC); txtLicense.Text = key; var partialKeys = new[] { keyByteSet1, keyByteSet2 }; CheckKey(key, KeyLength, partialKeys); } catch (Exception ex) { MessageBox.Show("Sorry! cannot generate license key!"); } finally { btnGen.IsEnabled = true; } }
public async void Init(int cinemaId, int cdmId, string day, string date, string cinemaName) { CinemaId = cinemaId; CdmId = cdmId; Day = day; Date = date; CinemaName = cinemaName; Title = CinemaName + ", " + date + ", " + day; var cdm = await _cdmApi.GetById <Model.CinemaDayMovie>(CdmId); var movie = await _moviesApi.GetById <Model.Movie>(cdm.MovieId); Movie = movie; var apps = await _appApi.Get <List <Model.Appointments> >(null); apps.RemoveAll(app => app.CinemaDayMovieId != CdmId); foreach (var app in apps) { var hall = await _hallsApi.GetById <Model.Hall>(app.HallId); Model.ObservableLists.AppointmentItem newItem = new Model.ObservableLists.AppointmentItem() { HallId = hall.HallId, AppId = app.AppointmentId, HallName = hall.HallName, HallNumber = hall.HallNumber, Price = app.Price, SoldSeats = app.SoldSeats, StartsAt = app.StartsAt, Display = app.StartsAt + "h / Price: " + app.Price + " / ", HallNumberOfSeats = hall.NumberOfseats }; if (hall.NumberOfseats == app.SoldSeats) { newItem.Full = true; } else { newItem.Full = false; } if (newItem.Full) { newItem.Display += "No more seats left"; } else { newItem.Display += "Sets: "; newItem.Display += (hall.NumberOfseats - app.SoldSeats).ToString(); } Apps.Add(newItem); } var products = await _cinemasApi.CustomGet <List <Model.Product> >("getProducts", CinemaId); foreach (var product in products) { Model.ObservableLists.ProductItem newItem = new Model.ObservableLists.ProductItem() { Product = product, Display = product.Name + " / Price: " + product.Price }; Products.Add(newItem); } }
public Guid AddOrUpdate(Drug d, Application app) { var drugKey = new ImporterCacheKeyDrug { Ingredient = d.Ingredient, DosageForm = d.DosageForm, DrugType = d.DrugType, Route = d.RouteOfAdmin }; Drug dMemory; Guid drugId; if (Drugs.TryGetValue(drugKey, out dMemory)) { dMemory.PharmaClassesText = dMemory.PharmaClassesText.Concat(d.PharmaClassesText).Distinct().ToList(); dMemory.PharmaClasses = dMemory.PharmaClasses.Concat( PharmaClasses.Where(x => d.PharmaClassesText.Any(y => y == x.Key)).Select(x => x.Value.Id).ToList() ).Distinct().ToList(); dMemory.Strengths = dMemory.Strengths.Concat(d.Strengths).Distinct().ToList(); dMemory.TradeNames = dMemory.TradeNames.Concat(d.TradeNames).Distinct().ToList(); if (dMemory.Schedule == null) { dMemory.Schedule = d.Schedule; } if (dMemory.StartMarketingDate != null && d.StartMarketingDate.HasValue && d.StartMarketingDate < dMemory.StartMarketingDate) { dMemory.StartMarketingDate = d.StartMarketingDate; } else { dMemory.StartMarketingDate = d.StartMarketingDate; } drugId = dMemory.Id; } else { d.Id = Guid.NewGuid(); drugId = d.Id; d.PharmaClasses = PharmaClasses.Where(x => d.PharmaClassesText.Any(y => y == x.Key)).Select(x => x.Value.Id).ToList(); Drugs.Add(drugKey, d); } if (app != null) { app.DrugId = drugId; ImporterCacheKeyApplication appKey = new ImporterCacheKeyApplication { AppNo = app.ApplicationNumber, ProductNo = app.ProductNumber }; if (!AppToDrug.ContainsKey(appKey)) { app.Id = Guid.NewGuid(); AppToDrug.Add(appKey, drugId); AppToApp.Add(appKey, app.Id); Apps.Add(app); } } return(drugId); }
public override async void UpdateAppListAsync() { try { Apps.Clear(); if (!Directory.Exists(FullPath)) { return; } var appIds = new List <KeyValuePair <string, string> >(); if (Directory.Exists(Directories.Origin.LocalContentDirectoy)) { //foreach (var originApp in Directory.EnumerateFiles(Directories.Origin.LocalContentDirectoy, "*.mfst", SearchOption.AllDirectories)) await Directory.EnumerateFiles(Directories.Origin.LocalContentDirectoy, "*.mfst", SearchOption.AllDirectories).ParallelForEachAsync( async originApp => { var appId = Path.GetFileNameWithoutExtension(originApp); if (!appId.StartsWith("Origin")) { // Get game id by fixing file via adding : before integer part of the name // for example OFB-EAST52017 converts to OFB-EAST:52017 var match = System.Text.RegularExpressions.Regex.Match(appId, @"^(.*?)(\d+)$"); if (!match.Success) { return; } appId = match.Groups[1].Value + ":" + match.Groups[2].Value; } appIds.Add(new KeyValuePair <string, string>(new FileInfo(originApp).Directory.Name, appId)); }); } await Directory.EnumerateFiles(FullPath, "installerdata.xml", SearchOption.AllDirectories) .ParallelForEachAsync( async originApp => { if (new FileInfo(originApp).Directory.Parent.Parent.Name != new DirectoryInfo(FullPath).Name) { return; } var installerLog = Path.Combine(Directory.GetParent(originApp).FullName, "InstallLog.txt"); var installedLocale = "en_US"; if (File.Exists(installerLog)) { foreach (var line in File.ReadAllLines(installerLog)) { if (!line.Contains("Install Locale:")) { continue; } installedLocale = line.Split(new string[] { "Install Locale:" }, StringSplitOptions.None)[1]; break; } installedLocale = installedLocale.Replace(" ", ""); } var xml = XDocument.Load(originApp); var manifestVersion = new Version((xml.Root.Name.LocalName == "game") ? xml.Root.Attribute("manifestVersion").Value : ((xml.Root.Name.LocalName == "DiPManifest") ? xml.Root.Attribute("version").Value : "1.0")); OriginAppInfo originAppInfo = null; if (manifestVersion == new Version("4.0")) { originAppInfo = new OriginAppInfo(Library, xml.Root.Element("gameTitles")?.Elements("gameTitle") ?.First(x => x.Attribute("locale").Value == "en_US")?.Value, Convert.ToInt32(xml.Root.Element("contentIDs")?.Elements() .FirstOrDefault(x => int.TryParse(x.Value, out int appId))?.Value), new FileInfo(originApp).Directory.Parent, new Version(xml.Root.Element("buildMetaData")?.Element("gameVersion") ?.Attribute("version")?.Value), xml.Root.Element("installMetaData")?.Element("locales")?.Value.Split(','), installedLocale, xml.Root.Element("touchup")?.Element("filePath")?.Value, xml.Root.Element("touchup")?.Element("parameters")?.Value, xml.Root.Element("touchup")?.Element("updateParameters")?.Value, xml.Root.Element("touchup")?.Element("repairParameters")?.Value); } else if (manifestVersion >= new Version("1.1") && manifestVersion <= new Version("3.0")) { var locales = new List <string>(); foreach (var locale in xml.Root.Element("metadata")?.Elements("localeInfo") ?.Attributes()?.Where(x => x.Name == "locale")) { locales.Add(locale.Value); } originAppInfo = new OriginAppInfo(Library, xml.Root.Element("metadata")?.Elements("localeInfo") ?.First(x => x.Attribute("locale").Value == "en_US")?.Element("title").Value, Convert.ToInt32(xml.Root.Element("contentIDs")?.Element("contentID")?.Value .Replace("EAX", "")), new FileInfo(originApp).Directory.Parent, new Version(xml.Root.Attribute("gameVersion").Value), locales.ToArray(), installedLocale, xml.Root.Element("executable")?.Element("filePath")?.Value, xml.Root.Element("executable")?.Element("parameters")?.Value); } else { MessageBox.Show(Framework.StringFormat.Format( Functions.SLM.Translate(nameof(Properties.Resources.OriginUnknownManifestFile)), new { ManifestVersion = manifestVersion, OriginApp = originApp })); return; } if (appIds.Count(x => x.Key == originAppInfo.InstallationDirectory.Name) > 0) { var appId = appIds.First(x => x.Key == originAppInfo.InstallationDirectory.Name); var appLocalData = GetGameLocalData(appId.Value); if (appLocalData != null) { originAppInfo.GameHeaderImage = string.Concat( appLocalData["customAttributes"]["imageServer"], appLocalData["localizableAttributes"]["packArtLarge"]); } } Apps.Add(originAppInfo); }); if (SLM.CurrentSelectedLibrary != null && SLM.CurrentSelectedLibrary == Library) { Functions.App.UpdateAppPanel(Library); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }