public ActionResult AddTag(Guid id, string name, string value)
        {
            var apps = new Apps();
            var app = apps.GetApp(id);
            if (app.Tags.ContainsKey(name))
                throw new HttpException(406, "Tag name already exists");

            app.Tags.Add(name, value);
            apps.UpdateApp(app);
            if (Request.IsAjaxRequest())
                return Json(null);
            else
                return RedirectToAction("EditTags", new { id = id });
        }
Beispiel #2
0
        private void btnConfig_Click(object sender, EventArgs e)
        {
            setXml xml = new setXml();

            xml.addCopyFileXML(Common.getConfigFolder(), Common.getConfigTemplateFolder(), ConfigName, "copyPath");

            Apps apps = QuickConfig.Common.setXml.getConfig(ConfigName).Apps;

            if (!checkAppFolder(apps))
            {
                return;
            }

            setConfig       setconfig = new setConfig();
            List <string[]> checkApp  = new List <string[]>();

            foreach (configCheck cc in configcheckList)
            {
                if (cc.Check)
                {
                    string [] configFolder = new string[2];
                    if (cc.AppType == "ServiceApp")
                    {
                        ServiceApp serviceapp = apps.ServiceAppList.Find((ServiceApp sa) => sa.Name == cc.Name);
                        configFolder[0] = serviceapp.ConfigFolder;
                        configFolder[1] = serviceapp.Path;
                    }
                    else if (cc.AppType == "WebApp")
                    {
                        WebApp serviceapp = apps.WebAppList.Find((WebApp sa) => sa.Name == cc.Name);
                        configFolder[0] = serviceapp.ConfigFolder;
                        configFolder[1] = serviceapp.Path;
                    }
                    else if (cc.AppType == "App")
                    {
                        App serviceapp = apps.AppList.Find((App sa) => sa.Name == cc.Name);
                        configFolder[0] = serviceapp.ConfigFolder;
                        configFolder[1] = serviceapp.Path;
                    }
                    checkApp.Add(configFolder);
                }
            }

            setconfig.config(Common.getConfigTemplateFolder(), Common.getConfigTemplateTempFolder(), ConfigName, checkApp);

            setMessage.MessageShow("", "设置完成!", this.btnConfig);
        }
Beispiel #3
0
        /// <summary>
        /// Should be called after a node is created to set parent referneces
        /// and removed ignored interfaces, volumes, etc.
        ///
        /// This allows interfaces, volumes, etc. to poll through the provider
        /// </summary>
        public void AfterInitialize()
        {
            if (Interfaces != null)
            {
                var ignoredInterfaceRegex = GetSetting(s => s.IgnoredInterfaceRegEx);
                if (ignoredInterfaceRegex != null)
                {
                    Interfaces.RemoveAll(i => ignoredInterfaceRegex.IsMatch(i.Id));
                }

                Interfaces.ForEach(i => i.Node = this);
            }

            Volumes?.ForEach(v => v.Node  = this);
            Apps?.ForEach(a => a.Node     = this);
            Services?.ForEach(s => s.Node = this);
        }
Beispiel #4
0
        public UWP(Package package)
        {
            Package    = package;
            Name       = Package.Id.Name;
            FullName   = Package.Id.FullName;
            FamilyName = Package.Id.FamilyName;
            Location   = Package.InstalledLocation.Path;

            InitializeAppDisplayInfo(package);
            InitializeAppInfo();
            Apps = Apps.Where(a =>
            {
                var valid = !string.IsNullOrEmpty(a.UserModelId) &&
                            !string.IsNullOrEmpty(a.DisplayName);
                return(valid);
            }).ToArray();
        }
Beispiel #5
0
        private void OnPICSChangesFullRun(SteamApps.PICSChangesCallback callback, JobID job)
        {
            // Hackiness to prevent processing legit changelists after our request if that ever happens
            if (PreviousChange != 1)
            {
                Log.WriteWarn("Steam", "Got changelist {0}, but ignoring it because we're in a full run", callback.CurrentChangeNumber);

                return;
            }

            PreviousChange = 2;

            Log.WriteInfo("Steam", "Requesting info for {0} apps and {1} packages", callback.AppChanges.Count, callback.PackageChanges.Count);

            Apps.PICSGetProductInfo(Enumerable.Empty <SteamApps.PICSRequest>(), callback.PackageChanges.Keys.Select(package => NewPICSRequest(package)));
            Apps.PICSGetAccessTokens(callback.AppChanges.Keys, Enumerable.Empty <uint>());
        }
        public ActionResult Create(Guid aid, string comment, DateTime timestamp)
        {
            var apps = new Apps();
            var app = apps.GetApp(aid);

            var newVersion = new Version()
            {
                AppKey = aid,
                Comment = comment,
                Timestamp = timestamp,
                VersionNumber = string.Format("{0}.{1}", app.MajorVersion, app.Revision),
            };

            if (string.IsNullOrWhiteSpace(comment)) ModelState.AddModelError("comment", "Comment is required.");

            if (ModelState.IsValid)
            {
                try
                {
                    var versions = new Versions();
                    versions.CreateVersion(newVersion);

                    app.Revision += 1;
                    apps.UpdateApp(app);

                    return RedirectToAction("Details", new { id = newVersion.Key });
                }
                catch (Exception ex)
                {
                    ModelState.AddModelError("Error", ex);
                }
            }

            var groups = new Groups();

            var group = groups.GetGroup(app.GroupKey);

            var model = new VersionDetails()
            {
                Version = newVersion,
                App = app,
                Group = group,
            };

            return View(model);
        }
        protected async Task UpdatePackages(IEnumerable <PICSPackageInfo> packages)
        {
            var allapps     = packages.SelectMany(x => x.Apps).Distinct().ToList();
            var missingapps = allapps.Where(x => !Apps.ContainsKey(x));

            foreach (var package in packages)
            {
                Packages[package.ID] = package;
            }

            if (!missingapps.Any())
            {
                return;
            }

            await UpdateApps(missingapps);
        }
        public void BeforeAll()
        {
            server.Start();
            DesiredCapabilities capabilities = Caps.getIos71Caps(Apps.get("iosWebviewAppLocal"));

            if (Env.isSauce())
            {
                capabilities.SetCapability("username", Env.getEnvVar("SAUCE_USERNAME"));
                capabilities.SetCapability("accessKey", Env.getEnvVar("SAUCE_ACCESS_KEY"));
                capabilities.SetCapability("name", "ios - local server");
                capabilities.SetCapability("tags", new string[] { "sample" });
            }
            Uri serverUri = Env.isSauce() ? AppiumServers.sauceURI : AppiumServers.localURI;

            driver = new IOSDriver(serverUri, capabilities, Env.INIT_TIMEOUT_SEC);
            driver.Manage().Timeouts().ImplicitlyWait(Env.IMPLICIT_TIMEOUT_SEC);
        }
        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++;
        }
Beispiel #10
0
        public void StartingIosAppWithCapabilitiesOnlyTest()
        {
            var app          = Apps.Get("iosTestApp");
            var capabilities =
                Caps.GetIosCaps(app);

            IOSDriver <AppiumWebElement> driver = null;

            try
            {
                driver = new IOSDriver <AppiumWebElement>(capabilities, Env.InitTimeoutSec);
                driver.CloseApp();
            }
            finally
            {
                driver?.Quit();
            }
        }
        public ActionResult ConfirmDelete(Guid id)
        {
            var versions = new Versions();
            var apps = new Apps();
            var groups = new Groups();

            var version = versions.GetVersion(id);
            var app = apps.GetApp(version.AppKey);
            var group = groups.GetGroup(app.GroupKey);

            var model = new VersionDetails()
            {
                Version = version,
                App = app,
                Group = group,
            };
            return View(model);
        }
Beispiel #12
0
        public void BeforeAll()
        {
            AppiumOptions capabilities = Env.isSauce()
                ? Caps.getAndroid501Caps(Apps.get("androidApiDemos"))
                : Caps.getAndroid19Caps(Apps.get("androidApiDemos"));

            if (Env.isSauce())
            {
                capabilities.AddAdditionalCapability("username", Env.getEnvVar("SAUCE_USERNAME"));
                capabilities.AddAdditionalCapability("accessKey", Env.getEnvVar("SAUCE_ACCESS_KEY"));
                capabilities.AddAdditionalCapability("name", "android - simple");
                capabilities.AddAdditionalCapability("tags", new string[] { "sample" });
            }
            Uri serverUri = Env.isSauce() ? AppiumServers.sauceURI : AppiumServers.LocalServiceURIAndroid;

            driver = new AndroidDriver <AndroidElement>(serverUri, capabilities, Env.INIT_TIMEOUT_SEC);
            driver.Manage().Timeouts().ImplicitWait = Env.IMPLICIT_TIMEOUT_SEC;
        }
Beispiel #13
0
        public void BeforeAll()
        {
            DesiredCapabilities capabilities = Env.isSauce() ?
                                               Caps.getAndroid18Caps(Apps.get("androidApiDemos")) :
                                               Caps.getAndroid19Caps(Apps.get("androidApiDemos"));

            if (Env.isSauce())
            {
                capabilities.SetCapability("username", Env.getEnvVar("SAUCE_USERNAME"));
                capabilities.SetCapability("accessKey", Env.getEnvVar("SAUCE_ACCESS_KEY"));
                capabilities.SetCapability("name", "android - complex");
                capabilities.SetCapability("tags", new string[] { "sample" });
            }
            Uri serverUri = Env.isSauce() ? AppiumServers.sauceURI : AppiumServers.localURI;

            driver = new AndroidDriver <AndroidElement>(serverUri, capabilities, Env.INIT_TIMEOUT_SEC);
            driver.Manage().Timeouts().ImplicitlyWait(Env.IMPLICIT_TIMEOUT_SEC);
        }
Beispiel #14
0
        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);
        }
Beispiel #15
0
        public void BeforeAll()
        {
            AppiumOptions capabilities = Env.isSauce()
                ? Caps.getAndroid501Caps(Apps.get("selendroidTestApp"))
                : Caps.getAndroid19Caps(Apps.get("selendroidTestApp"));

            if (Env.isSauce())
            {
                capabilities.AddAdditionalCapability("username", Env.getEnvVar("SAUCE_USERNAME"));
                capabilities.AddAdditionalCapability("accessKey", Env.getEnvVar("SAUCE_ACCESS_KEY"));
                capabilities.AddAdditionalCapability("tags", new string[] { "sample" });
            }
            Uri serverUri = Env.isSauce() ? AppiumServers.sauceURI : AppiumServers.LocalServiceURIAndroid;

            driver     = new AndroidDriver <AppiumWebElement>(serverUri, capabilities, Env.INIT_TIMEOUT_SEC);
            pageObject = new AndroidJavaScriptTestPageObject(driver);
            driver.StartActivity("io.selendroid.testapp", ".WebViewActivity");
        }
Beispiel #16
0
        public void BeforeAll()
        {
            var capabilities = Env.isSauce()
                ? Caps.getAndroid501Caps(Apps.get("selendroidTestApp"))
                : Caps.getAndroid19Caps(Apps.get("selendroidTestApp"));

            if (Env.isSauce())
            {
                capabilities.SetCapability("username", Env.getEnvVar("SAUCE_USERNAME"));
                capabilities.SetCapability("accessKey", Env.getEnvVar("SAUCE_ACCESS_KEY"));
                capabilities.SetCapability("name", "android - complex");
                capabilities.SetCapability("tags", new[] { "sample" });
            }
            Uri serverUri = Env.isSauce() ? AppiumServers.sauceURI : AppiumServers.LocalServiceURIAndroid;

            driver = new AndroidDriver <IWebElement>(serverUri, capabilities, Env.INIT_TIMEOUT_SEC);
            driver.Manage().Timeouts().ImplicitWait = Env.IMPLICIT_TIMEOUT_SEC;
        }
Beispiel #17
0
        /// <summary>
        /// Deals with populating apps in the My-Apps section.
        /// </summary>
        /// <param name="sender">Object Sender is a parameter called Sender that contains a reference to the control/object that raised the event.</param>
        /// <param name="args">ContainerContentChangingEventArgs args is a parameter called e that contains the event data, see the ContainerContentChangingEventArgs MSDN page for more information.</param>
        private void GridFeaturedApps_ContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args)
        {
            args.Handled = true;
            if (args.Phase != 0)
            {
                throw new Exception("Not in phase 0.");
            }
            Apps       app          = (Apps)args.Item;
            StackPanel templateRoot = (StackPanel)args.ItemContainer.ContentTemplateRoot;
            TextBlock  appName      = (TextBlock)templateRoot.FindName("appName");
            TextBlock  appAuthor    = (TextBlock)templateRoot.FindName("appAuthor");
            Image      appIcon      = (Image)templateRoot.FindName("appIcon");

            appName.Text   = app.Name;
            appAuthor.Text = app.Author;
            appIcon.Source = new BitmapImage(new Uri("ms-appx:///Assets/notavailable.png"));
            args.RegisterUpdateCallback(ShowImage);
        }
Beispiel #18
0
        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();
        }
        /// <summary>
        /// Unpin a process
        /// </summary>
        public PinnedApp Unpin(Process process)
        {
            var pa = GetPinned(process);

            if (pa != null)
            {
                Apps.Remove(pa);

                var name     = System.Diagnostics.FileVersionInfo.GetVersionInfo(process.MainModule.FileName).FileDescription;
                var shortcut = FormatShortcutName(name);
                if (File.Exists(shortcut))
                {
                    File.Delete(shortcut);
                }
            }

            return(pa);
        }
Beispiel #20
0
        /// <summary>
        /// Executed when the app is long tapped. Context menu appears now.
        /// </summary>
        /// <param name="sender">Object Sender is a parameter called Sender that contains a reference to the control/object that raised the event.</param>
        /// <param name="e">RoutedEventArgs e is a parameter called e that contains the event data, see the RoutedEventArgs MSDN page for more information.</param>
        private void StackPanel_Holding(object sender, HoldingRoutedEventArgs e)
        {
            FrameworkElement senderElement = sender as FrameworkElement;
            StackPanel       stackPanel    = sender as StackPanel;
            TextBlock        txt           = (TextBlock)stackPanel.Children.ElementAt(1);

            foreach (Apps app in AppList.getAppList().appList)
            {
                if (app.Name.Equals(txt.Text))
                {
                    appHolding = app; break;
                }
            }
            //var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            FlyoutBase flyoutBase = FlyoutBase.GetAttachedFlyout(senderElement);

            flyoutBase.ShowAt(senderElement);
        }
Beispiel #21
0
        private void AddSession(IAudioDeviceSession session)
        {
            var newSession = new AppItemViewModel(session);

            foreach (var a in Apps)
            {
                if (a.DoesGroupWith(newSession))
                {
                    // Remove the fake app entry after copying any changes the user did.
                    newSession.Volume  = a.Volume;
                    newSession.IsMuted = a.IsMuted;
                    Apps.Remove(a);
                    break;
                }
            }

            Apps.AddSorted(newSession, AppItemViewModel.CompareByExeName);
        }
Beispiel #22
0
        public void StartingAndroidAppWithCapabilitiesOnlyTest()
        {
            var app          = Apps.Get("androidApiDemos");
            var capabilities =
                Caps.GetAndroidUIAutomatorCaps(app);

            AndroidDriver <AppiumWebElement> driver = null;

            try
            {
                driver = new AndroidDriver <AppiumWebElement>(capabilities);
                driver.CloseApp();
            }
            finally
            {
                driver?.Quit();
            }
        }
Beispiel #23
0
        const string aadTenantId       = "8c8dbccd-c171-4937-a134-e3c5a5dd0470"; // customer's tenant id

        static async Task Main(string[] args)
        {
            // Get an access token that we can use for making calls to the Business Central Admin Center APIs
            string accessToken = await Authenticate.GetAccessTokenAsync(aadAppId, aadAppRedirectUri, aadTenantId);

            // Manage environments
            await Environments.ListEnvironmentsAsync(accessToken);

            await Environments.CreateNewEnvironmentAsync(accessToken, "MyNewSandbox2", "Sandbox", "DK");

            await Environments.CopyProductionEnvironmentToSandboxEnvironmentAsync(accessToken, "MyProd", "MyNewSandboxAsACopy", "DK");

            await Environments.SetAppInsightsKeyAsync(accessToken, "MyProd", new Guid("0da21b54-841e-4a64-a117-6092784245f9"));

            await Environments.GetDatabaseSizeAsync(accessToken, "MyProd");

            await Environments.GetSupportSettingsAsync(accessToken, "MyProd");

            // Manage support settings
            await NotificationRecipients.GetNotificationRecipientsAsync(accessToken);

            await NotificationRecipients.AddNotificationRecipientAsync(accessToken, "*****@*****.**", "Partner Notifications Mail Group");

            // Manage apps
            await Apps.GetInstalledAppsAsync(accessToken, "MyProd");

            await Apps.GetAvailableAppUpdatesAsync(accessToken, "MyProd");

            await Apps.UpdateAppAsync(accessToken, "MyProd", "334ef79e-547e-4631-8ba1-7a7f18e14de6", "16.0.11240.12188");

            await Apps.GetAppOperationsAsync(accessToken, "MyProd", "334ef79e-547e-4631-8ba1-7a7f18e14de6");

            // Manage active sessions
            await Sessions.GetActiveSessionsAsync(accessToken, "MyProd");

            await Sessions.CancelSessionAsync(accessToken, "MyProd", 12202);

            // Manage update settings
            await UpdateSettings.GetUpdateWindowAsync(accessToken, "MyProd");

            await UpdateSettings.SetUpdateWindowAsync(accessToken, "MyProd", new DateTime(2020, 06, 01, 4, 0, 0), new DateTime(2020, 06, 01, 11, 0, 0));

            await UpdateSettings.GetScheduledUpdatesAsync(accessToken, "MyProd");
        }
        private void Startup()
        {
            if (NativeHelpers.Services_GetSteamLoadStatus() == LoadStatus.NotLoaded)
            {
                // Only startup the native parts if they are not loaded yet
                if (!NativeMethods.Services_Startup(Constants.VersionInfo.InterfaceID))
                {
                    // Setup failed!
                    Instance = null;
                    ErrorCodes error = NativeHelpers.Services_GetErrorCode();
                    if (error == ErrorCodes.InvalidInterfaceVersion)
                    {
                        Error.ThrowError(ErrorCodes.InvalidInterfaceVersion,
                                         NativeMethods.Services_GetInterfaceVersion(), Constants.VersionInfo.InterfaceID);
                    }
                    else
                    {
                        Error.ThrowError(error);
                    }
                }
            }

            AppID = new SteamTypes.AppID(NativeMethods.Services_GetAppID());

            serviceJobs = new JobManager();
            serviceJobs.AddJob(new DelegateJob(() => RegisterManagedCallback(), () => RemoveManagedCallback()));
            serviceJobs.AddJob(new DelegateJob(() => cloud              = new Cloud(), () => cloud.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => stats              = new Stats(), () => stats.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => user               = new User(), () => user.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => friends            = new Friends(), () => friends.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => matchmaking        = new MatchMaking(), () => matchmaking.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => matchmakingServers = new MatchmakingServers(), () => matchmakingServers.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => networking         = new Networking(), () => networking.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => utils              = new Utils(), () => utils.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => apps               = new Apps(), () => apps.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => http               = new HTTP(), () => http.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => screenshots        = new Screenshots(), () => screenshots.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => ugc             = new UGC(), () => ugc.ReleaseManagedResources()));
            serviceJobs.AddJob(new DelegateJob(() => steamcontroller = new SteamController(), () => steamcontroller.ReleaseManagedResources()));

            hmd = new Hmd();

            serviceJobs.RunCreateJobs();
        }
 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();
 }
Beispiel #26
0
        private void OnPICSTokens(SteamApps.PICSTokensCallback callback, JobID jobID)
        {
            Log.WriteDebug("Steam", "Tokens granted: {0} - Tokens denied: {1}", callback.AppTokens.Count, callback.AppTokensDenied.Count);

            var apps = callback.AppTokensDenied
                       .Select(app => NewPICSRequest(app))
                       .Concat(callback.AppTokens.Select(app => NewPICSRequest(app.Key, app.Value)));

            var request = SteamProxy.Instance.IRCRequests.Find(r => r.JobID == jobID);

            if (request != null)
            {
                request.JobID = Apps.PICSGetProductInfo(apps, Enumerable.Empty <SteamApps.PICSRequest>());

                return;
            }

            Apps.PICSGetProductInfo(apps, Enumerable.Empty <SteamApps.PICSRequest>());
        }
Beispiel #27
0
 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);
     }
 }
Beispiel #28
0
        public void Init()
        {
            var settingsManager = ServiceRegistration.Get <ISettingsManager>();

            _apps   = settingsManager.Load <Apps>();
            _groups = new List <string>();

            items.Clear();

            foreach (var a in _apps.AppsList.Where(a => !_groups.Contains(a.Group) & a.Group != ""))
            {
                _groups.Add(a.Group);
                var item = new ListItem();
                item.AdditionalProperties[GROUP] = a.Group;
                item.SetLabel("Name", a.Group);
                items.Add(item);
            }
            items.FireChange();
        }
Beispiel #29
0
        static void Main()
        {
            // Create a token credential, which enables us to authenticate to the Business Central Admin Center APIs.
            //   Note 1: This will open the AAD login page in a browser window.
            //   Note 2: You can also skip passing in options altogether if you want to log into your own Business Central admin center, i.e., not a delegated admin scenario
            var interactiveBrowserCredentialOptions = new InteractiveBrowserCredentialOptions
            {
                ClientId    = "a19cb26a-2e4c-408b-82e1-6311742ecc50", // partner's AAD app id
                RedirectUri = new Uri("http://localhost"),            // partner's AAD app redirect URI
                TenantId    = "f5b6b245-5dd2-4bf5-94d4-35ef04d73c6d", // customer's tenant id
            };
            var tokenCredential = new InteractiveBrowserCredential(interactiveBrowserCredentialOptions);

            // Create the Admin Center client
            var adminCenterClient = new AdminCenterClient(tokenCredential);

            // Manage environments
            Environments.ListEnvironments(adminCenterClient);
            Environments.CreateNewEnvironment(adminCenterClient, "MySandbox", "Sandbox", "DK");
            Environments.CopyProductionEnvironmentToSandboxEnvironment(adminCenterClient, "MyProd", "MySandboxAsACopy");
            Environments.SetAppInsightsKey(adminCenterClient, "MyProd", new Guid("0da21b54-841e-4a64-a117-6092784245f9"));
            Environments.GetDatabaseSize(adminCenterClient, "MyProd");
            Environments.GetSupportSettings(adminCenterClient, "MyProd");

            // Manage support settings
            NotificationRecipients.GetNotificationRecipients(adminCenterClient);
            NotificationRecipients.AddNotificationRecipient(adminCenterClient, "*****@*****.**", "Partner Notifications Mail Group");

            // Manage apps
            Apps.GetInstalledApps(adminCenterClient, "MyProd");
            Apps.GetAvailableAppUpdates(adminCenterClient, "MyProd");
            Apps.UpdateApp(adminCenterClient, "MyProd", new Guid("334ef79e-547e-4631-8ba1-7a7f18e14de6"), "16.0.11240.12188");
            Apps.GetAppOperations(adminCenterClient, "MyProd", new Guid("334ef79e-547e-4631-8ba1-7a7f18e14de6"));

            // Manage active sessions
            Sessions.GetActiveSessions(adminCenterClient, "MyProd");
            Sessions.CancelSession(adminCenterClient, "MyProd", 196719);

            // Manage update settings
            UpdateSettings.GetUpdateWindow(adminCenterClient, "MyProd");
            UpdateSettings.SetUpdateWindow(adminCenterClient, "MyProd", new DateTime(2020, 06, 01, 4, 15, 0), new DateTime(2020, 06, 01, 11, 30, 0));
            UpdateSettings.GetScheduledUpdates(adminCenterClient, "MyProd");
        }
 public JsonResult Autocomplete(Guid gid, string query, int offset = 0, int count = 10)
 {
     var apps = new Apps();
     AppList appList;
     if (DefaultApp != null && DefaultApp.Name.ToLower().Contains(query.ToLower().Trim()))
     {
         appList = apps.SearchGroupApps(gid, query, offset, (offset > 0) ? count : count - 1);
         var appendedApps = appList.Apps.ToList();
         appendedApps.Insert(0, new AppListItem() { Key = DefaultApp.Key, Name = DefaultApp.Name });
         appList.Apps = appendedApps;
         appList.TotalCount += 1;
         if (offset == 0) appList.PageSize += 1;
     }
     else
     {
         appList = apps.SearchGroupApps(gid, query, offset, count);
     }
     return Json(appList);
 }
Beispiel #31
0
        public void BeforeAll()
        {
            DesiredCapabilities capabilities = Caps.getIos92Caps(Apps.get("iosTestApp"));

            if (Env.isSauce())
            {
                capabilities.SetCapability("username", Env.getEnvVar("SAUCE_USERNAME"));
                capabilities.SetCapability("accessKey", Env.getEnvVar("SAUCE_ACCESS_KEY"));
                capabilities.SetCapability("name", "ios - actions");
                capabilities.SetCapability("tags", new string[] { "sample" });
            }
            Uri serverUri = Env.isSauce() ? AppiumServers.sauceURI : AppiumServers.LocalServiceURIForIOS;

            driver = new IOSDriver <AppiumWebElement>(serverUri, capabilities, Env.INIT_TIMEOUT_SEC);
            TimeOutDuration timeSpan = new TimeOutDuration(new TimeSpan(0, 0, 0, 5, 0));

            pageObject = new IOSPageObjectChecksAttributesForNativeIOSApp();
            PageFactory.InitElements(driver, pageObject, new AppiumPageObjectMemberDecorator(timeSpan));
        }
 /// <summary>
 /// Initializes client properties.
 /// </summary>
 private void Initialize()
 {
     Features              = new Features(this);
     Examples              = new Examples(this);
     Model                 = new Model(this);
     Apps                  = new Apps(this);
     Versions              = new Versions(this);
     Train                 = new Train(this);
     User                  = new User(this);
     Permissions           = new Permissions(this);
     BaseUri               = "https://{AzureRegion}.api.cognitive.microsoft.com/luis/api/v2.0";
     SerializationSettings = new JsonSerializerSettings
     {
         Formatting            = Newtonsoft.Json.Formatting.Indented,
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new  List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     DeserializationSettings = new JsonSerializerSettings
     {
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <ModelInfo>("readableType"));
     DeserializationSettings.Converters.Add(new  PolymorphicDeserializeJsonConverter <ModelInfo>("readableType"));
     SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <ModelInfoResponse>("readableType"));
     DeserializationSettings.Converters.Add(new  PolymorphicDeserializeJsonConverter <ModelInfoResponse>("readableType"));
     CustomInitialize();
 }
        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;
            }
        }
        public void Import(JsonGestureIntentStore from, bool replace = false)
        {
            if (from == null)
            {
                return;
            }

            if (replace)
            {
                GlobalApp.GestureIntents.Clear();
                GlobalApp.IsGesturingEnabled = from.GlobalApp.IsGesturingEnabled;
                Apps.Clear();
                HotCornerCommands = from.HotCornerCommands;
            }
            else
            {
                for (var i = 0; i < from.HotCornerCommands.Length; i++)
                {
                    if (from.HotCornerCommands[i] != null)
                    {
                        HotCornerCommands[i] = from.HotCornerCommands[i];
                    }
                }
            }

            GlobalApp.ImportGestures(from.GlobalApp);

            foreach (var kv in from.Apps)
            {
                ExeApp appInSelf;
                //如果应用程序已经在列表中,则合并手势
                if (TryGetExeApp(kv.Key.ToLower(), out appInSelf))
                {
                    appInSelf.ImportGestures(kv.Value);
                    appInSelf.IsGesturingEnabled = appInSelf.IsGesturingEnabled && kv.Value.IsGesturingEnabled;
                }
                else//否则将app添加到列表中
                {
                    Add(kv.Value);
                }
            }
        }
Beispiel #35
0
        public static void Run(string[] args)
        {
            string comment;
            string directoryPath;
            Guid appKey;
            ControllerConfiguration context;

            ParseArguments(args, out comment, out directoryPath, out appKey, out context);

            var versionsController = new Versions(context);
            var appsController = new Apps(context);
            var revision = appsController.PushAppRevision(appKey);
            var newVersion = new Version()
            {
                VersionNumber = revision,
                Comment = comment,
                AppKey = appKey,
            };
            versionsController.PushVersion(new DirectoryInfo(directoryPath), newVersion.Key);
            versionsController.CreateVersion(newVersion);
        }
        public ActionResult Version(Guid tid, Guid aid)
        {
            var targetAppVersions = new TargetAppVersions();
            var versions = new Versions();
            var apps = new Apps();
            var targets = new Targets();
            var groups = new Groups();

            Version version;
            var versionKey = targetAppVersions.GetTargetAppVersion(tid, aid);
            if (versionKey.HasValue)
            {
                try
                {
                    version = versions.GetVersion(versionKey.Value);
                }
                catch (Exception)
                {
                    version = null;
                }
            }
            else
            {
                version = null;
            }

            var app = apps.GetApp(aid);
            var target = targets.GetTarget(tid);
            var group = groups.GetGroup(target.GroupKey);

            var model = new TargetAppVersionDetails()
            {
                Version = version,
                App = app,
                Target = target,
                Group = group,
            };
            return View(model);
        }
        public ActionResult Create(Guid aid)
        {
            var apps = new Apps();
            var groups = new Groups();

            var app = apps.GetApp(aid);
            var group = groups.GetGroup(app.GroupKey);
            var version = new Version()
            {
                AppKey = aid,
                GroupKey = group.Key,
                VersionNumber = string.Format("{0}.{1}", app.MajorVersion, app.Revision)
            };

            var model = new VersionDetails()
            {
                Version = version,
                App = app,
                Group = group,
            };

            return View(model);
        }
        public ActionResult Edit(Guid id, string comment)
        {
            Version version = null;
            try
            {
                var versions = new Versions();
                version = versions.GetVersion(id);
                version.Comment = comment;
                versions.UpdateVersion(version);
                return RedirectToAction("Details", new { id = version.Key });
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("Error", ex);
            }

            var groups = new Groups();
            var apps = new Apps();
            Group group = null;
            App app = null;
            if (version != null)
            {
                group = groups.GetGroup(version.GroupKey);
                app = apps.GetApp(version.AppKey);
            }

            var model = new VersionDetails()
            {
                Version = version,
                App = app,
                Group = group,
            };

            return View(model);
        }
        //
        // GET: /Versions/
        public ActionResult Index(Guid aid, string q = null, DateTime? f = null, DateTime? t = null, int o = 0, int c = 50)
        {
            if (o < 0) o = 0;
            if (c < 1) o = 1;
            if (c > 100) o = 100;

            var versions = new Versions();
            var apps = new Apps();
            var groups = new Groups();

            var versionList = versions.SearchAppVersions(aid, f, t, q, o, c);
            var app = apps.GetApp(aid);
            var group = groups.GetGroup(app.GroupKey);

            var model = new VersionIndex()
            {
                VersionList = versionList,
                App = app,
                Group = group,
            };
            return View(model);
        }
Beispiel #40
0
        public void PullApp(Guid appKey)
        {
            var appsController = new Apps(config);
            var versionsController = new Versions(config);
            var localAppVersions = GetLocalAppVersionsIndex();

            var app = appsController.GetApp(appKey);
            var latestVersion = versionsController.SearchAppVersions(appKey, pageSize: 1);
            if (latestVersion.TotalCount < 1 && !latestVersion.Versions.Any()) throw new VersionNotFoundException("No versions available for installation.");
            Guid versionKey = latestVersion.Versions.First().Key;

            if (localAppVersions.ContainsKey(appKey))
            {
                if (localAppVersions[appKey] != versionKey)
                {
                    RunUpdate(appKey, versionKey);
                }
            }
            else
            {
                Install(appKey, versionKey);
            }
        }
Beispiel #41
0
        private void RunUpdate(Guid appKey, Guid newVersionKey)
        {
            WriteLog(string.Format("Updating app {0} to version {1} ...", appKey, newVersionKey));
            try
            {
                var apps = new Apps(config);
                var versions = new Versions(config);
                var app = apps.GetApp(appKey);
                var version = versions.GetVersion(newVersionKey);
                string workingDirectory = String.Format("{0}\\{1}", config.DeploymentDirectory, app.DeploymentDirectory);
                var directory = new DirectoryInfo(workingDirectory);

                if (app.Tags.ContainsKey("hook-update"))
                {
                    // Run hook-install
                    WriteLog("Running app update hook.");
                    RunHook(app.Tags["hook-update"], workingDirectory);
                }
                if (version.Tags.ContainsKey("hook-update"))
                {
                    // Run hook-install
                    WriteLog("Running version update hook.");
                    RunHook(version.Tags["hook-update"], workingDirectory);
                }
                foreach (var hookFile in directory.EnumerateFiles("hook-update.*"))
                {
                    try
                    {
                        RunCommand(hookFile.FullName);
                    }
                    catch (Exception ex)
                    {
                        ElevateStatusTo(LogStatus.Warning);
                        WriteLog(string.Format("Failed running update hook: {0}", ex.ToString()));
                    }
                }

                PullFolders(appKey, newVersionKey);
                PutAppVersionIndexEntry(appKey, newVersionKey);

                directory.Refresh();

                if (File.Exists(Path.Combine(workingDirectory, Plywood.IISDeployApi.IISDeployer.PLYWOOD_IIS_DEPLOYMENT_CONFIG_FILENAME)))
                    Plywood.IISDeployApi.IISDeployer.Deploy(workingDirectory);

                if (version.Tags.ContainsKey("hook-updated"))
                {
                    // Run hook-install
                    WriteLog("Running version updated hook.");
                    RunHook(version.Tags["hook-updated"], workingDirectory);
                }
                if (app.Tags.ContainsKey("hook-updated"))
                {
                    // Run hook-install
                    WriteLog("Running app updated hook.");
                    RunHook(app.Tags["hook-updated"], workingDirectory);
                }
                foreach (var hookFile in directory.EnumerateFiles("hook-updated.*"))
                {
                    try
                    {
                        RunCommand(hookFile.FullName);
                    }
                    catch (Exception ex)
                    {
                        ElevateStatusTo(LogStatus.Warning);
                        WriteLog(string.Format("Failed running updated hook: {0}", ex.ToString()));
                    }
                }
                WriteLog(string.Format("Completed update of app {0} to version {1} ...", appKey, newVersionKey));
            }
            catch (Exception ex)
            {
                string errorMessage = string.Format("Failed update of app {0} to version {1} : {2}", appKey, newVersionKey, ex.ToString());
                WriteLog(errorMessage);
                System.Diagnostics.EventLog.WriteEntry("Plywood", errorMessage, System.Diagnostics.EventLogEntryType.Error, 3005);
            }
        }
Beispiel #42
0
 private void PullFolders(Guid appKey, Guid newVersionKey, bool create = false, bool clean = true)
 {
     var appsController = new Apps(config);
     var app = appsController.GetApp(appKey);
     var targetDirectory = new DirectoryInfo(config.DeploymentDirectory + "\\" + app.DeploymentDirectory);
     if (!targetDirectory.Exists)
     {
         if (create)
         {
             targetDirectory.Create();
             targetDirectory.Refresh();
         }
         else
         {
             throw new AppDeploymentException(string.Format("Failed pulling version \"{0}\" for app \"{1}\".", newVersionKey, appKey));
         }
     }
     var folderContent = targetDirectory.EnumerateFileSystemInfos();
     if (folderContent.Count() > 0)
     {
         foreach (var item in folderContent)
         {
             if (item.GetType() == typeof(DirectoryInfo))
             {
                 (item as DirectoryInfo).Delete(true);
             }
             else
             {
                 item.Delete();
             }
         }
     }
     var versionsController = new Versions(config);
     versionsController.PullVersion(newVersionKey, targetDirectory);
 }
 /// <summary>
 /// Create a new Apps object.
 /// </summary>
 /// <param name="appID">Initial value of AppID.</param>
 public static Apps CreateApps(int appID)
 {
     Apps apps = new Apps();
     apps.AppID = appID;
     return apps;
 }
        public ActionResult ConfirmDelete(Guid id)
        {
            var apps = new Apps();
            var groups = new Groups();

            var app = apps.GetApp(id);
            var group = groups.GetGroup(app.GroupKey);

            var model = new AppDetails()
            {
                App = app,
                Group = group,
            };

            return View(model);
        }
        public ActionResult Delete(Guid id)
        {
            var apps = new Apps();
            var app = apps.GetApp(id);
            try
            {
                apps.DeleteApp(id);
                return RedirectToAction("Index", new { gid = app.GroupKey });
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("Error", ex.Message);

                var groups = new Groups();
                var group = groups.GetGroup(app.GroupKey);

                var model = new AppDetails()
                {
                    App = app,
                    Group = group,
                };

                return View("ConfirmDelete", model);
            }
        }
        public ActionResult Create(Guid gid, string name, string deploymentDirectory, string majorVersion, int revision)
        {
            var newApp = new App()
            {
                GroupKey = gid,
                Name = name,
                DeploymentDirectory = deploymentDirectory,
                MajorVersion = majorVersion,
                Revision = revision,
            };

            if (string.IsNullOrWhiteSpace(name)) ModelState.AddModelError("name", "Name is required.");
            if (string.IsNullOrWhiteSpace(deploymentDirectory)) ModelState.AddModelError("deploymentDirectory", "Deployment Directory is required.");
            if (string.IsNullOrWhiteSpace(majorVersion)) ModelState.AddModelError("majorVersion", "Major version is required.");
            if (!Plywood.Utils.Validation.IsMajorVersionValid(majorVersion)) ModelState.AddModelError("majorVersion", "Major version is not valid.");
            if (revision < 0) ModelState.AddModelError("revision", "Revision must be a positive number.");

            try
            {
                if (ModelState.IsValid)
                {
                    var apps = new Apps();
                    apps.CreateApp(newApp);
                    return RedirectToAction("Details", new { id = newApp.Key });
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("Error", ex);
            }

            var groups = new Groups();
            var group = groups.GetGroup(gid);

            var model = new AppDetails()
            {
                App = newApp,
                Group = group,
            };

            return View(model);
        }
        public ActionResult Edit(Guid id, string name, string deploymentDirectory, string majorVersion, string revision)
        {
            var apps = new Apps();
            var app = apps.GetApp(id);
            int revisionNum;
            bool revisionValid = int.TryParse(revision, out revisionNum);

            app.Name = name;
            app.DeploymentDirectory = deploymentDirectory;
            app.MajorVersion = majorVersion;
            if (revisionValid)
                app.Revision = revisionNum;

            if (string.IsNullOrWhiteSpace(name)) ModelState.AddModelError("name", "Name is required.");
            if (string.IsNullOrWhiteSpace(deploymentDirectory)) ModelState.AddModelError("deploymentDirectory", "Deployment Directory is required.");
            if (string.IsNullOrWhiteSpace(majorVersion)) ModelState.AddModelError("majorVersion", "Major version is required.");
            if (!Plywood.Utils.Validation.IsMajorVersionValid(majorVersion)) ModelState.AddModelError("majorVersion", "Major version is not valid.");
            if (!revisionValid) ModelState.AddModelError("revision", "Revision must be a positive number.");
            if (revisionNum < 0) ModelState.AddModelError("revision", "Revision must be a positive number.");

            if (ModelState.IsValid)
            {
                try
                {
                    apps.UpdateApp(app);
                    return RedirectToAction("Details", new { id = app.Key });
                }
                catch (Exception ex)
                {
                    ModelState.AddModelError("Error", ex);
                }
            }

            var groups = new Groups();
            var group = groups.GetGroup(app.GroupKey);

            var model = new AppDetails()
            {
                App = app,
                Group = group,
            };

            return View(model);
        }
        //
        // GET: /App/
        public ActionResult Index(Guid gid, string q = null, int o = 0, int c = 50)
        {
            if (o < 0) o = 0;
            if (c < 1) o = 1;
            if (c > 100) o = 100;

            var apps = new Apps();
            var groups = new Groups();

            var appList = apps.SearchGroupApps(gid, q, o, c);
            var group = groups.GetGroup(gid);

            var model = new AppIndex()
            {
                AppList = appList,
                Group = group,
            };

            return View(model);
        }
        public JsonResult RemoveTag(Guid id, string name)
        {
            var apps = new Apps();
            var app = apps.GetApp(id);
            if (!app.Tags.ContainsKey(name))
                throw new HttpException(404, "Tag not found");

            app.Tags.Remove(name);
            apps.UpdateApp(app);
            return Json(null);
        }
        public ActionResult Delete(Guid id)
        {
            var versions = new Versions();
            var version = versions.GetVersion(id);

            try
            {
                versions.DeleteVersion(id);
                return RedirectToAction("Index", new { aid = version.AppKey });
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("Error", ex.Message);

                var apps = new Apps();
                var app = apps.GetApp(version.AppKey);

                var groups = new Groups();
                var group = groups.GetGroup(version.GroupKey);

                var model = new VersionDetails()
                {
                    Version = version,
                    App = app,
                    Group = group,
                };

                return View("ConfirmDelete", model);
            }
        }
Beispiel #51
0
        public void Install(Guid appKey, Guid versionKey)
        {
            var apps = new Apps(config);
            var app = apps.GetApp(appKey);
            string workingDirectory = String.Format("{0}\\{1}", config.DeploymentDirectory, app.DeploymentDirectory);

            if (app.Tags.ContainsKey("hook-install"))
            {
                // Run hook-install
                logWriter.Write("Running install hook.");
                RunHook(app.Tags["hook-install"], config.DeploymentDirectory);
            }

            PullFolders(appKey, versionKey, true, true);
            PutAppVersionIndexEntry(appKey, versionKey);

            var directory = new DirectoryInfo(workingDirectory);

            if (File.Exists(Path.Combine(workingDirectory, Plywood.IISDeployApi.IISDeployer.PLYWOOD_IIS_DEPLOYMENT_CONFIG_FILENAME)))
                Plywood.IISDeployApi.IISDeployer.Deploy(workingDirectory);

            if (app.Tags.ContainsKey("hook-installed"))
            {
                // Run hook-installed
                logWriter.Write("Running installed hook.");
                RunHook(app.Tags["hook-installed"], workingDirectory);
            }
            foreach (var hookFile in directory.EnumerateFiles("hook-installed.*"))
            {
                try
                {
                    RunCommand(hookFile.FullName);
                }
                catch (Exception ex)
                {
                    ElevateStatusTo(LogStatus.Warning);
                    WriteLog(string.Format("Failed running installed hook: {0}", ex.ToString()));
                }
            }
        }
 /// <summary>
 /// There are no comments for Apps in the schema.
 /// </summary>
 public void AddToApps(Apps apps)
 {
     base.AddObject("Apps", apps);
 }
        public JsonResult UpdateTag(Guid id, string oldName, string name, string value)
        {
            var apps = new Apps();
            var app = apps.GetApp(id);
            if (!app.Tags.ContainsKey(oldName))
                throw new HttpException(404, "Tag not found");

            if (oldName == name)
            {
                app.Tags[name] = value;
            }
            else if (app.Tags.ContainsKey(name))
            {
                throw new HttpException(406, "Tag name already exists");
            }
            else
            {
                app.Tags.Remove(oldName);
                app.Tags.Add(name, value);
            }
            apps.UpdateApp(app);
            return Json(null);
        }