/// <summary>
        /// Tests the sync logic with custom <see cref="AppList"/>s.
        /// </summary>
        /// <param name="resetMode">The <see cref="SyncResetMode"/> to pass to <see cref="SyncIntegrationManager.Sync"/>.</param>
        /// <param name="appListLocal">The current local <see cref="AppList"/>.</param>
        /// <param name="appListLast">The state of the <see cref="AppList"/> after the last successful sync.</param>
        /// <param name="appListServer">The current server-side <see cref="AppList"/>.</param>
        private void TestSync(SyncResetMode resetMode, AppList appListLocal, AppList appListLast, AppList appListServer)
        {
            appListLocal.SaveXml(_appListPath);
            if (appListLast != null) appListLast.SaveXml(_appListPath + SyncIntegrationManager.AppListLastSyncSuffix);

            using (var stream = File.Create(_appListPath + ".zip"))
                appListServer.SaveXmlZip(stream);

            using (var appListServerFile = File.OpenRead(_appListPath + ".zip"))
            using (var syncServer = new MicroServer("app-list", appListServerFile))
            {
                using (var integrationManager = new SyncIntegrationManager(_appListPath, new SyncServer {Uri = syncServer.ServerUri, Username = "******", Password = "******"}, interfaceId => new Feed(), new SilentTaskHandler()))
                    integrationManager.Sync(resetMode);

                appListServer = AppList.LoadXmlZip(syncServer.FileContent);
            }

            appListLocal = XmlStorage.LoadXml<AppList>(_appListPath);
            appListLast = XmlStorage.LoadXml<AppList>(_appListPath + SyncIntegrationManager.AppListLastSyncSuffix);
            Assert.AreEqual(appListLocal, appListServer, "Server and local data should be equal after sync");
            Assert.AreEqual(appListLocal, appListLast, "Last sync snapshot and local data should be equal after sync");
        }
Example #2
0
        private async Task RefreshLoadProcesses()
        {
            var apps = await AppList.GetRunningApplications();

            if (apps == null)
            {
                return;
            }
            foreach (var p in apps)
            {
                if (p == null)
                {
                    continue;
                }
                if (this._allAppWithPorts.All(x => x.InstancePid != p.InstancePid))
                {
                    var dispatcher = this.Dispatcher;
                    if (dispatcher != null)
                    {
                        await dispatcher.BeginInvoke(new ThreadStart(delegate
                        {
                            p.Icon = AppIcon.GetIcon(p.FullName, false);
                            this._allAppWithPorts.Add(p);
                        }));
                    }
                }
            }
        }
Example #3
0
        private static FeedUri?TryResolveAlias(string uri)
        {
#if NETCOREAPP
            return(null);
#else
            var appList = AppList.LoadSafe();

            const string aliasPrefix = "alias:";
            if (uri.StartsWith(aliasPrefix))
            {
                string aliasName = uri.Substring(aliasPrefix.Length);
                var    result    = appList.ResolveAlias(aliasName);

                if (result == null)
                {
                    throw new UriFormatException(string.Format(Resources.AliasNotFound, aliasName));
                }
                return(result);
            }
            else
            {
                string aliasName = uri;
                var    result    = appList.ResolveAlias(aliasName);

                if (result != null)
                {
                    Log.Info(string.Format(Resources.ResolvedUsingAlias, aliasName, result));
                }
                return(result);
            }
#endif
        }
Example #4
0
        public void ReloadApps()
        {
            AppList.Clear();
            var Apps = new SystemRemoteApps().GetAll();

            foreach (RemoteAppLib.New.RemoteApp App in Apps)
            {
                SmallIcons.Images.RemoveByKey(App.Name);
                Image TheBitmap = RemoteAppFunction.GetAppBitmap(App.Name);
                var   AppItem   = new ListViewItem(App.Name)
                {
                    ToolTipText = App.FullName,
                    ImageIndex  = 0
                };
                SmallIcons.Images.Add(App.Name, TheBitmap);
                AppItem.ImageKey = App.Name;
                AppList.Items.Add(AppItem);
            }

            NoAppsLabel.Visible = Apps.Count == 0;

            EditButton.Enabled             = false;
            DeleteButton.Enabled           = false;
            CreateClientConnection.Enabled = false;
        }
Example #5
0
 public cAppBot this[string pCode]
 {
     get
     {
         return(AppList.FirstOrDefault(x => x.Code == pCode));
     }
 }
Example #6
0
 /// <summary>
 /// This method loads all the contents of the store. Meanwhile, the splash screen is in view.
 /// </summary>
 private void ExtendSplashScreen()
 {
     AppList.getAppList().appList.Clear();
     AppList.getMyAppList().myappList.Clear();
     try
     {
         XmlDocument xmldoc = new XmlDocument();
         xmldoc.LoadXml(XDocument.Load("Assets/BuildmLearnStore.xml").ToString());
         foreach (var item in xmldoc.GetElementsByTagName("app"))
         {
             try
             {
                 string[] ar = item.InnerText.Split('\n');
                 AppList.getAppList().appList.Add(new Apps(ar[1], ar[2], ar[10], ar[11], ar[3], new string[] { ar[5], ar[6] }, ar[9], ar[8]));
                 var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
                 if (localSettings.Values.ContainsKey(ar[1].Trim()))
                 {
                     if ((bool)localSettings.Values[ar[1].Trim()])
                     {
                         AppList.getMyAppList().myappList.Add(new Apps(ar[1], ar[2], ar[10], ar[11], ar[3], new string[] { ar[5], ar[6] }, ar[9], ar[8]));
                     }
                 }
                 else
                 {
                     localSettings.Values.Add(ar[1].Trim(), false);
                 }
             }
             catch (Exception) { }
         }
     }
     catch (Exception) { }
 }
Example #7
0
        /// <summary>
        /// 添加当前活动窗口
        /// </summary>
        /// <param name="process"></param>
        public void AddViewItem(IWindow window)
        {
            AppSmallIconList.Images.Add(window.AppIcon);
            AppList.BeginUpdate();
            ListViewItem item = new ListViewItem(window.WindowTitle);

            item.Tag        = window;
            item.ImageIndex = AppSmallIconList.Images.Count - 1;
            item.SubItems.Add("");
            item.SubItems.Add(window.ForegroundTimeSpen.ToString(@"hh\:mm\:ss"));
            AppList.Items.Add(item);

            // 添加进度条
            Rectangle rectangle = default(Rectangle);

            rectangle = item.SubItems[1].Bounds;
            IProgressBar progressBar = new IProgressBar(rectangle)
            {
                Value   = 0,
                Visible = true,
                Maximum = 100
            };

            item.SubItems[1].Tag = progressBar;
            progressBar.Parent   = AppList;
            AppList.EndUpdate();
        }
Example #8
0
    public void NoConflicts()
    {
        var accessPointA = new MockAccessPoint {
            ID = "a"
        };
        var appEntry1 = new AppEntry
        {
            Name         = "App1",
            InterfaceUri = FeedTest.Test1Uri,
            AccessPoints = new AccessPointList {
                Entries = { accessPointA }
            }
        };
        var accessPointB = new MockAccessPoint {
            ID = "b"
        };
        var appEntry2 = new AppEntry {
            Name = "App2", InterfaceUri = FeedTest.Test2Uri
        };

        var appList = new AppList {
            Entries = { appEntry1 }
        };

        appList.CheckForConflicts(new[] { accessPointB }, appEntry2);
    }
Example #9
0
        public async Task <AppList> GetListAsync()
        {
            using (var Sqlconn = new SqlConnection(conn))
            {
                await Sqlconn.OpenAsync();

                //Multiple return set
                var Result = Sqlconn.QueryResults <PayorList, CompNameList, BenefitContList, BenefitNameList, ClientList>("doNewCustomers", Parameters.Empty); //,
                                                                                                                                                               //Query.Returns(Some<AppList>.Records)
                                                                                                                                                               //            .Then(Some<PayorList>.Records)
                                                                                                                                                               //                .Then(Some<CompNameList>.Records)
                                                                                                                                                               //                .Then(Some<BenefitContList>.Records)
                                                                                                                                                               //                .Then(Some<BenefitNameList>.Records)

                //Return Multiple Recordsets
                AppList mResults = new AppList
                {
                    PList         = Result.Set1,
                    CmpNameList   = Result.Set2,
                    BenefContList = Result.Set3,
                    BenefNameList = Result.Set4,
                    CliList       = Result.Set5
                };


                return(mResults);
            }
        }
 private AppList LoadAppListSafe()
 {
     try
     {
         return(XmlStorage.LoadXml <AppList>(AppList.GetDefaultPath(_machineWide)));
     }
     #region Error handling
     catch (FileNotFoundException)
     {
         return(new AppList());
     }
     catch (IOException ex)
     {
         Log.Warn(Resources.UnableToLoadAppList);
         Log.Warn(ex);
         return(new AppList());
     }
     catch (UnauthorizedAccessException ex)
     {
         Log.Warn(Resources.UnableToLoadAppList);
         Log.Warn(ex);
         return(new AppList());
     }
     catch (InvalidDataException ex)
     {
         Log.Warn(Resources.UnableToLoadAppList);
         Log.Warn(ex);
         return(new AppList());
     }
     #endregion
 }
Example #11
0
    /// <inheritdoc/>
    public override ExitCode Execute()
    {
        var apps = AppList.LoadSafe(MachineWide);

        if (AdditionalArgs.Count > 0)
        {
            if (Uri.TryCreate(AdditionalArgs[0], UriKind.Absolute, out var uri))
            {
                var feedUri = new FeedUri(uri);
                apps.Entries.RemoveAll(x => x.InterfaceUri != feedUri);
            }
            else
            {
                apps.Entries.RemoveAll(x => !x.Name.ContainsIgnoreCase(AdditionalArgs[0]));
            }
        }

        if (_xmlOutput)
        {
            Handler.Output(Resources.MyApps, apps.ToXmlString());
        }
        else
        {
            Handler.Output(Resources.MyApps, apps.Entries);
        }
        return(ExitCode.OK);
    }
Example #12
0
        public AppListViewModel()
        {
            AppLaunchCommand = new RelayCommand <string>(AppLaunch);

            AppNavigateCommand = new RelayCommand <string>(AppNavigate);

            CreateAppList();

            AppList.Take(5).ToArray();
            AppList.Skip(5).ToArray();

            int PivotSize = 12;

            int j = 0;

            while (j <= AppList.Count)
            {
                var SplitAppList = new ObservableCollection <CmxApp>(AppList.Skip(j).Take(PivotSize));

                PivotAppListItems.Add(new CmxAppPivot
                {
                    Title        = "pivot " + j,
                    PivotAppList = SplitAppList
                });

                j = (j == 0) ? PivotSize : (j * PivotSize);
            }
        }
Example #13
0
        private void MarkSelectedApps()
        {
            foreach (var p in AppList)
            {
                p.Selected = false;
            }

            if (lbApplications.SelectedItems.Count == 1 && (string)lbApplications.SelectedItem == "All Listed Applications")
            {
                // if all apps selected, mark none selected
                // the report will not generate a where clause
                // for the applications
                foreach (var item in AppList)
                {
                    item.Selected = true;
                }
                return;
            }
            else if (lbApplications.SelectedItems.Count == 1 && (string)lbApplications.SelectedItem == "All Applications")
            {
                return;
            }

            for (int i = 0; i < lbApplications.SelectedItems.Count; i++)
            {
                var app = AppList.Find(x => x.AppFriendlyName == lvProjects.SelectedItems[i].ToString());
                if (app != null)
                {
                    app.Selected = true;
                }
            }
        }
        //public AppList GetAppListById(int groupID, int listID)
        //{

        //    SqlConnection con = null;

        //    try
        //    {
        //        con = connect(true);

        //        string str = $"select * from AppList where groupID = {groupID} and listID = {listID}";

        //        SqlCommand cmd = new SqlCommand(str, con);

        //        SqlDataReader sdr = cmd.ExecuteReader();

        //        AppList al = new AppList();

        //        while (sdr.Read())
        //        {
        //            al.ListID = (int)sdr["listID"];
        //            al.GroupID = (int)sdr["groupID"];
        //            al.ListName = Convert.ToString(sdr["listName"]);
        //            al.ListEstimatedPrice = Convert.ToDouble(sdr["listEstimatedPrice"]);
        //            al.CityName = Convert.ToString(sdr["cityName"]);
        //            if (al.CityName == null)
        //            {
        //                al.CityName = "הזן עיר לחיפוש";
        //            }
        //            al.CityID = (int)sdr["cityID"];
        //            al.LimitPrice = (int)sdr["limitPrice"];
        //            al.TypeLocation = (string)sdr["typeLocation"];
        //            al.Latitude = Convert.ToString("latitude");
        //            al.Longitude = Convert.ToString("Longitude");
        //            al.KM_radius = (int)sdr["km_radius"];
        //            if (Convert.IsDBNull(sdr["badge"]))
        //            {
        //                al.Badge = 0;
        //            }
        //            else al.Badge = (int)sdr["badge"];
        //        }
        //        return al;
        //    }
        //    catch (Exception exp)
        //    {
        //        throw (exp);
        //    }
        //    finally
        //    {
        //        con.Close();
        //    }
        //}
        public AppList PostAppList(AppList appList)
        {
            SqlConnection con = null;
            SqlCommand    cmd;



            try
            {
                con = connect(false);
                string str = "DECLARE @LastListID int;" +
                             $"insert into AppList (groupID,listName) values({appList.GroupID},'{appList.ListName}')" +
                             "select @LastListID = SCOPE_IDENTITY();" +
                             "insert into UserInList (userID,listID,groupID) values(" +
                             $"{appList.UserID},@LastListID,{appList.GroupID})" +
                             "select @LastListID as ListID";
                //select userid FROM AppUser WHERE UserName='******'

                cmd            = new SqlCommand(str, con);
                appList.ListID = Convert.ToInt32(cmd.ExecuteScalar());

                return(appList);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                if (con != null)
                {
                    con.Close();
                }
            }
        }
    public void AppVista(string userId, string Name)//enviar datos del una vez se descargen aplicaciones
    {
        AppList app  = new AppList(Name, userId);
        string  json = JsonUtility.ToJson(app);

        reference.Child("aplicacion").Child(Name).SetRawJsonValueAsync(json);
    }
Example #16
0
    /// <summary>
    /// Checks new <see cref="AccessPoint"/> candidates for conflicts with existing ones.
    /// </summary>
    /// <param name="appList">The <see cref="AppList"/> containing the existing <see cref="AccessPoint"/>s.</param>
    /// <param name="accessPoints">The set of <see cref="AccessPoint"/>s candidates to check.</param>
    /// <param name="appEntry">The <see cref="AppEntry"/> the <paramref name="accessPoints"/> are intended for.</param>
    /// <exception cref="KeyNotFoundException">An <see cref="AccessPoint"/> reference to a <see cref="Capability"/> is invalid.</exception>
    /// <exception cref="ConflictException">One or more of the <paramref name="accessPoints"/> would cause a conflict with the existing <see cref="AccessPoint"/>s in <see cref="AppList"/>.</exception>
    public static void CheckForConflicts(this AppList appList, [InstantHandle] IEnumerable <AccessPoint> accessPoints, AppEntry appEntry)
    {
        #region Sanity checks
        if (appList == null)
        {
            throw new ArgumentNullException(nameof(appList));
        }
        if (accessPoints == null)
        {
            throw new ArgumentNullException(nameof(accessPoints));
        }
        if (appEntry == null)
        {
            throw new ArgumentNullException(nameof(appEntry));
        }
        #endregion

        var newConflictData      = accessPoints.GetConflictData(appEntry);
        var existingConflictData = appList.Entries.GetConflictData();

        foreach ((string conflictId, var newEntry) in newConflictData)
        {
            if (existingConflictData.TryGetValue(conflictId, out var existingEntry))
            {
                // Ignore conflicts that are actually just re-applications of existing access points
                if (existingEntry != newEntry)
                {
                    throw ConflictException.NewConflict(existingEntry, newEntry);
                }
            }
        }
    }
Example #17
0
        private void CheckCryptoKey()
        {
            var appListUri = new Uri(_config.SyncServer, new Uri("app-list", UriKind.Relative));

            using var webClient = new WebClientTimeout
                  {
                      Credentials = new NetworkCredential(_config.SyncServerUsername, _config.SyncServerPassword),
                      CachePolicy = new RequestCachePolicy(RequestCacheLevel.NoCacheNoStore)
                  };
            try
            {
                AppList.LoadXmlZip(new MemoryStream(webClient.DownloadData(appListUri)), _config.SyncCryptoKey);
            }
            #region Error handling
            catch (WebException ex)
                when(ex.Status == WebExceptionStatus.ProtocolError && (ex.Response as HttpWebResponse)?.StatusCode == HttpStatusCode.Unauthorized)
                {
                    // Wrap exception to add context information
                    throw new WebException(Resources.SyncCredentialsInvalid, ex, ex.Status, ex.Response);
                }
            catch (ZipException ex)
            {
                // Wrap exception to add context information
                if (ex.Message == "Invalid password for AES")
                {
                    throw new InvalidDataException(Resources.SyncCryptoKeyInvalid);
                }
                else
                {
                    throw new InvalidDataException(Resources.SyncServerDataDamaged, ex);
                }
            }
            #endregion
        }
Example #18
0
    private static FeedUri?TryResolveAlias(string uri)
    {
        var appList = AppList.LoadSafe();

        const string aliasPrefix = "alias:";

        if (uri.StartsWith(aliasPrefix, out string?aliasName))
        {
            var result = appList.ResolveAlias(aliasName);

            if (result == null)
            {
                throw new UriFormatException(string.Format(Resources.AliasNotFound, aliasName));
            }
            return(result);
        }
        else
        {
            aliasName = uri;
            var result = appList.ResolveAlias(aliasName);

            if (result != null)
            {
                Log.Info(string.Format(Resources.ResolvedUsingAlias, aliasName, result));
            }
            return(result);
        }
    }
        public int UpdateListName(AppList appList)
        {
            SqlConnection con = null;
            SqlCommand    cmd;

            try
            {
                con = connect(false);
                string str = "update AppList " +
                             $"set listName = '{appList.ListName}' " +
                             $"where listId = {appList.ListID}";

                cmd = new SqlCommand(str, con);
                return(cmd.ExecuteNonQuery());
            }
            catch (Exception ex)
            {
                return(0);

                throw (ex);
            }
            finally
            {
                if (con != null)
                {
                    con.Close();
                }
            }
        }
        public int UpdateLocation(AppList appList)
        {
            SqlConnection con = null;
            SqlCommand    cmd;

            try
            {
                con = connect(false);
                string str = $"exec [dbo].[spAppList_UpdateListCoords] @typeLocation = '{appList.TypeLocation}', @listID = {appList.ListID}, @lat = '{appList.Latitude}', @long = '{appList.Longitude}', ";
                str += $"@cityName = '{appList.CityName}', @cityID = {appList.CityID}, @km_radius = {appList.KM_radius} ";
                cmd  = new SqlCommand(str, con);
                return(cmd.ExecuteNonQuery());
            }
            catch (Exception ex)
            {
                return(0);

                throw (ex);
            }
            finally
            {
                if (con != null)
                {
                    con.Close();
                }
            }
        }
        public async Task <IActionResult> Edit(int id, [Bind("AppID,AppName,AppNotes,POC,POCEmail,Telephone,AssignedBA,AssignedDev")] AppList appList)
        {
            if (id != appList.AppID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(appList);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AppListExists(appList.AppID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AssignedBA"]  = new SelectList(_context.Analysts, "BAID", "BAFullname", appList.AssignedBA);
            ViewData["AssignedDev"] = new SelectList(_context.Developers, "DevID", "DevFullname", appList.AssignedDev);
            return(View(appList));
        }
Example #22
0
        internal static AppAlias GetAppAlias([NotNull] AppList appList, [NotNull] string aliasName, out AppEntry foundAppEntry)
        {
            #region Sanity checks
            if (appList == null)
            {
                throw new ArgumentNullException("appList");
            }
            if (string.IsNullOrEmpty(aliasName))
            {
                throw new ArgumentNullException("aliasName");
            }
            #endregion

            var results =
                from entry in appList.Entries
                where entry.AccessPoints != null
                from alias in entry.AccessPoints.Entries.OfType <AppAlias>()
                where alias.Name == aliasName
                select new { entry, alias };

            var result = results.FirstOrDefault();
            if (result == null)
            {
                foundAppEntry = null;
                return(null);
            }
            else
            {
                foundAppEntry = result.entry;
                return(result.alias);
            }
        }
        public async Task RunSearch()
        {
            if (string.IsNullOrWhiteSpace(_searchQueryText))
            {
                return;
            }

            IsSearching = true;

            var searchResults = await _dataSource.SearchAppsAsync(_searchQueryText);

            if (searchResults != null)
            {
                AppList = new List <AppInfo>(searchResults);
            }
            else
            {
                AppList.Clear();
            }

            LastSearchQuery = string.Format("Results for \"{0}\"", _searchQueryText);

            string resultFormat = AppList.Count == 1 ? "{0} app" : "{0} apps";

            ResultCount = string.Format(resultFormat, AppList.Count);

            IsSearching = false;
        }
Example #24
0
        public IEnumerable <VeracodeApp> GetAllApps()
        {
            var     xml  = _wrapper.GetAppList();
            AppList list = XmlParseHelper.Parse <AppList>(xml);

            return(list.Apps);
        }
Example #25
0
    /// <summary>
    /// Synchronize the <see cref="AppList"/> with the sync server and (un)apply <see cref="AccessPoint"/>s accordingly.
    /// </summary>
    /// <param name="resetMode">Controls how synchronization data is reset.</param>
    /// <exception cref="OperationCanceledException">The user canceled the task.</exception>
    /// <exception cref="InvalidDataException">A problem occurred while deserializing the XML data or the specified crypto key was wrong.</exception>
    /// <exception cref="KeyNotFoundException">An <see cref="AccessPoint"/> reference to a <see cref="Capability"/> is invalid.</exception>
    /// <exception cref="ConflictException">One or more new <see cref="AccessPoint"/> would cause a conflict with the existing <see cref="AccessPoint"/>s in <see cref="AppList"/>.</exception>
    /// <exception cref="WebException">A problem occurred while communicating with the sync server or while downloading additional data (such as icons).</exception>
    /// <exception cref="IOException">A problem occurs while writing to the filesystem or registry.</exception>
    /// <exception cref="UnauthorizedAccessException">Write access to the filesystem or registry is not permitted.</exception>
    public void Sync(SyncResetMode resetMode = SyncResetMode.None)
    {
        using var webClient = new WebClientTimeout
        {
            Credentials = new NetworkCredential(Config.SyncServerUsername, Config.SyncServerPassword),
            CachePolicy = new RequestCachePolicy(RequestCacheLevel.NoCacheNoStore)
        };
        var uri = new Uri(_syncServer, new Uri(MachineWide ? "app-list-machine" : "app-list", UriKind.Relative));

        ExceptionUtils.Retry<SyncRaceException>(delegate
        {
            Handler.CancellationToken.ThrowIfCancellationRequested();

            // ReSharper disable AccessToDisposedClosure
            var data = DownloadAppList(webClient, uri, resetMode);
            HandleDownloadedAppList(data, resetMode);
            UploadAppList(webClient, uri, resetMode);
            // ReSharper restore AccessToDisposedClosure
        }, maxRetries: 3);

        // Save reference point for future syncs
        AppList.SaveXml(AppListPath + AppListLastSyncSuffix);

        Handler.CancellationToken.ThrowIfCancellationRequested();
    }
Example #26
0
    public void RemovedLocal()
    {
        using var apApplied    = new TemporaryFlagFile("ap-applied");
        using var apNotApplied = new TemporaryFlagFile("ap-not-applied");
        var appListServer = new AppList
        {
            Entries =
            {
                new AppEntry
                {
                    InterfaceUri = FeedTest.Test1Uri,
                    AccessPoints = new AccessPointList{
                        Entries ={ new MockAccessPoint                   {
                      ApplyFlagPath = apApplied, UnapplyFlagPath = apNotApplied
                  } }
                    }
                }
            }
        };

        TestSync(SyncResetMode.None, new AppList(), appListServer.Clone(), appListServer);

        apApplied.Set.Should().BeFalse(because: "Locally removed access point should not be reapplied");
        apNotApplied.Set.Should().BeFalse(because: "Locally removed access point should not be not-applied again");
    }
Example #27
0
    /// <summary>
    /// Tests the sync logic with custom <see cref="AppList"/>s.
    /// </summary>
    /// <param name="resetMode">The <see cref="SyncResetMode"/> to pass to <see cref="SyncIntegrationManager.Sync"/>.</param>
    /// <param name="appListLocal">The current local <see cref="AppList"/>.</param>
    /// <param name="appListLast">The state of the <see cref="AppList"/> after the last successful sync.</param>
    /// <param name="appListServer">The current server-side <see cref="AppList"/>.</param>
    private static void TestSync(SyncResetMode resetMode, AppList appListLocal, AppList?appListLast, AppList appListServer)
    {
        string appListLocalPath = AppList.GetDefaultPath();

        appListLocal.SaveXml(appListLocalPath);
        appListLast?.SaveXml(appListLocalPath + SyncIntegrationManager.AppListLastSyncSuffix);

        using var appListServerPath = new TemporaryFile("0install-test-applist");
        {
            using (var stream = File.Create(appListServerPath))
                appListServer.SaveXmlZip(stream, CryptoKey);

            using (var appListServerFile = File.OpenRead(appListServerPath))
            {
                using var syncServer = new MicroServer("app-list", appListServerFile);
                var config = new Config
                {
                    SyncServer         = new(syncServer.ServerUri),
                    SyncServerUsername = "******",
                    SyncServerPassword = "******",
                    SyncCryptoKey      = CryptoKey
                };
                using (var integrationManager = new SyncIntegrationManager(config, _ => new Feed(), new SilentTaskHandler()))
                    integrationManager.Sync(resetMode);

                appListServer = AppList.LoadXmlZip(syncServer.FileContent, CryptoKey);
            }
        }

        appListLocal = XmlStorage.LoadXml <AppList>(appListLocalPath);
        appListLast  = XmlStorage.LoadXml <AppList>(appListLocalPath + SyncIntegrationManager.AppListLastSyncSuffix);
        appListServer.Should().Be(appListLocal, because: "Server and local data should be equal after sync");
        appListLast.Should().Be(appListLocal, because: "Last sync snapshot and local data should be equal after sync");
    }
Example #28
0
    public void AddedRemote()
    {
        using var apApplied    = new TemporaryFlagFile("ap-applied");
        using var apNotApplied = new TemporaryFlagFile("ap-not-applied");
        var appListRemote = new AppList
        {
            Entries =
            {
                new AppEntry
                {
                    InterfaceUri = FeedTest.Test1Uri,
                    AccessPoints = new AccessPointList{
                        Entries ={ new MockAccessPoint                   {
                      ApplyFlagPath = apApplied, UnapplyFlagPath = apNotApplied
                  }, new MockAccessPoint() }
                    }
                }
            }
        };

        TestSync(SyncResetMode.None, new AppList(), new AppList(), appListRemote);

        apApplied.Set.Should().BeTrue(because: "New access point should be applied");
        apNotApplied.Set.Should().BeFalse(because: "New access point should not be not-applied");
    }
Example #29
0
        private void GetFiles(string path)
        {
            AppList.Clear();

            var files = Directory.GetFiles(@Environment.GetFolderPath(Environment.SpecialFolder.Desktop)).ToList();

            files.AddRange(Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.CommonDesktopDirectory)));
            if (!String.IsNullOrEmpty(path))
            {
                files.AddRange(Directory.GetFiles(path));
            }
            foreach (var file in files)
            {
                string name = Path.GetFileNameWithoutExtension(file);
                if (File.GetAttributes(file).HasFlag(FileAttributes.Hidden) || String.IsNullOrEmpty(name))
                {
                    continue;
                }
                AppList.Add(new AppItem()
                {
                    FilePath = file,
                });
            }
            InputText = String.Empty; //force filter
            InputBox.Focus();
        }
        /// <summary>
        /// The methods provided in this section are simply used to allow
        /// NavigationHelper to respond to the page's navigation methods.
        /// <para>
        /// Page specific logic should be placed in event handlers for the
        /// <see cref="NavigationHelper.LoadState"/>
        /// and <see cref="NavigationHelper.SaveState"/>.
        /// The navigation parameter is available in the LoadState method
        /// in addition to page state preserved during an earlier session.
        /// </para>
        /// </summary>
        /// <param name="e">Provides data for navigation methods and event
        /// handlers that cannot cancel the navigation request.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (AppList.getMyAppList().myappList.Count > 0)
            {
                btnMyApps.Visibility = Visibility.Visible;
            }
            else
            {
                btnMyApps.Visibility = Visibility.Collapsed;
            }
            app = AppInstance.app;
            var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

            if (localSettings.Values.ContainsKey(app.Name))
            {
                appInstalled = (bool)(localSettings.Values[app.Name]);
            }
            if (appInstalled)
            {
                btnAppInstall.Content = "LAUNCH";
            }
            else
            {
                btnAppInstall.Content = "INSTALL";
            }

            webAppReviews.NavigateToString(getHtmlComment());


            txtAppName.Text   = app.Name;
            txtAppAuthor.Text = app.Author;
            if (app.Description.Length > 50)
            {
                txtShowMore             = false;
                txtAppDetails.Text      = app.Description.Substring(0, 50) + "...";
                detailsShowMore.Content = "more";
            }
            else
            {
                txtAppDetails.Text         = app.Description;
                detailsShowMore.Visibility = Visibility.Collapsed;
            }
            txtAddInfo1.Text = ("Author: \nAuthor Email: \nCategory: \nType: ");
            txtAddInfo2.Text = (app.Author + "\n" + app.AuthorEmail + "\n" + app.Category + "\n" + app.Type);

            List <Image> images = new List <Image>();

            foreach (string screenshot in app.Screenshots)
            {
                Image image = new Image();
                image.Source = new BitmapImage(new Uri(screenshot));
                images.Add(image);
            }
            FullScreenshots.ItemsSource = images;
            imgAppIcon.Source           = new BitmapImage(new Uri(app.AppIcon));
            GridScreenshots.ItemsSource = app.Screenshots;
            this.navigationHelper.OnNavigatedTo(e);
        }
        /// <summary>
        /// Loads the current <see cref="AppList"/> from the disk and updates the "My Apps" <see cref="IAppTileList"/>.
        /// </summary>
        /// <returns>A list of <see cref="IAppTile"/>s that need to be injected with <see cref="Feed"/> data.</returns>
        public IEnumerable <IAppTile> UpdateMyApps()
        {
            var newAppList = AppList.LoadSafe(_machineWide);
            var tiles      = new List <IAppTile>();

            // Update the displayed AppList based on changes detected between the current and the new AppList
            Merge.TwoWay(
                theirs: newAppList.Entries, mine: AppList.Entries,
                added: entry =>
            {
                if (entry.InterfaceUri == null || entry.Name == null)
                {
                    return;
                }
                try
                {
                    var status = (entry.AccessPoints == null) ? AppStatus.Added : AppStatus.Integrated;
                    var tile   = _tileListMyApps.QueueNewTile(entry.InterfaceUri, entry.Name, status, _iconStore, _machineWide);
                    tiles.Add(tile);

                    // Update "added" status of tile in catalog list
                    var catalogTile = _tileListCatalog.GetTile(entry.InterfaceUri);
                    if (catalogTile != null)
                    {
                        catalogTile.Status = tile.Status;
                    }
                }
                #region Error handling
                catch (KeyNotFoundException)
                {
                    Log.Warn(string.Format(Resources.UnableToLoadFeedForApp, entry.InterfaceUri));
                }
                catch (InvalidOperationException)
                {
                    Log.Warn(string.Format(Resources.IgnoringDuplicateAppListEntry, entry.InterfaceUri));
                }
                #endregion
            },
                removed: entry =>
            {
                if (entry.InterfaceUri == null)
                {
                    return;
                }
                _tileListMyApps.RemoveTile(entry.InterfaceUri);

                // Update "added" status of tile in catalog list
                var catalogTile = _tileListCatalog.GetTile(entry.InterfaceUri);
                if (catalogTile != null)
                {
                    catalogTile.Status = AppStatus.Candidate;
                }
            });
            _tileListMyApps.AddQueuedTiles();
            AppList = newAppList;

            return(tiles);
        }
        public void ReApply()
        {
            var accessPointA = new MockAccessPoint {ID = "a"};
            var appEntry1 = new AppEntry
            {
                Name = "App1", InterfaceUri = FeedTest.Test1Uri,
                AccessPoints = new AccessPointList {Entries = {accessPointA}}
            };

            var appList = new AppList {Entries = {appEntry1}};
            appList.CheckForConflicts(new[] {accessPointA}, appEntry1);
        }
        public void Conflict()
        {
            var accessPointA = new MockAccessPoint {ID = "a"};
            var appEntry1 = new AppEntry
            {
                Name = "App1",
                InterfaceUri = FeedTest.Test1Uri,
                AccessPoints = new AccessPointList {Entries = {accessPointA}}
            };
            var appEntry2 = new AppEntry {Name = "App2", InterfaceUri = FeedTest.Test2Uri};

            var appList = new AppList {Entries = {appEntry1}};
            Assert.Throws<ConflictException>(() => appList.CheckForConflicts(new[] {accessPointA}, appEntry2));
        }
        public void Conflict()
        {
            var accessPointA = new MockAccessPoint {ID = "a"};
            var appEntry1 = new AppEntry
            {
                Name = "App1",
                InterfaceUri = FeedTest.Test1Uri,
                AccessPoints = new AccessPointList {Entries = {accessPointA}}
            };
            var appEntry2 = new AppEntry {Name = "App2", InterfaceUri = FeedTest.Test2Uri};

            var appList = new AppList {Entries = {appEntry1}};
            appList.Invoking(x => x.CheckForConflicts(new[] {accessPointA}, appEntry2))
                .ShouldThrow<ConflictException>();
        }
        public void TestAddedLocal()
        {
            using (var apApplied = new TemporaryFlagFile("ap-applied"))
            using (var apUnapplied = new TemporaryFlagFile("ap-unapplied"))
            {
                var appListLocal = new AppList
                {
                    Entries =
                    {
                        new AppEntry
                        {
                            InterfaceUri = FeedTest.Test1Uri,
                            AccessPoints = new AccessPointList {Entries = {new MockAccessPoint {ApplyFlagPath = apApplied, UnapplyFlagPath = apUnapplied}}}
                        }
                    }
                };

                TestSync(SyncResetMode.None, appListLocal, new AppList(), new AppList());

                Assert.IsFalse(apApplied.Set, "Locally existing access point should not be reapplied");
                Assert.IsFalse(apUnapplied.Set, "Locally existing access point should not be removed");
            }
        }
        /// <summary>
        /// Creates a new integration manager using the default <see cref="DesktopIntegration.AppList"/> (creating a new one if missing). Performs Mutex-based locking!
        /// </summary>
        /// <param name="handler">A callback object used when the the user is to be informed about the progress of long-running operations such as downloads.</param>
        /// <param name="machineWide">Apply operations machine-wide instead of just for the current user.</param>
        /// <exception cref="IOException">A problem occurs while accessing the <see cref="AppList"/> file.</exception>
        /// <exception cref="UnauthorizedAccessException">Read or write access to the <see cref="AppList"/> file is not permitted or another desktop integration class is currently active.</exception>
        /// <exception cref="InvalidDataException">A problem occurs while deserializing the XML data.</exception>
        public IntegrationManager([NotNull] ITaskHandler handler, bool machineWide = false)
            : base(handler, machineWide)
        {
            #region Sanity checks
            if (handler == null) throw new ArgumentNullException(nameof(handler));
            #endregion

            try
            {
                AquireMutex();
            }
                #region Error handling
            catch (UnauthorizedAccessException)
            {
                // Replace exception to add more context
                throw new UnauthorizedAccessException(Resources.IntegrationMutex);
            }
            #endregion

            try
            {
                AppListPath = AppList.GetDefaultPath(machineWide);
                if (File.Exists(AppListPath))
                {
                    Log.Debug("Loading AppList for IntegrationManager from: " + AppListPath);
                    AppList = XmlStorage.LoadXml<AppList>(AppListPath);
                }
                else
                {
                    Log.Debug("Creating new AppList for IntegrationManager: " + AppListPath);
                    AppList = new AppList();
                    AppList.SaveXml(AppListPath);
                }
            }
                #region Error handling
            catch
            {
                // Avoid abandoned mutexes
                Dispose();
                throw;
            }
            #endregion
        }
        /// <summary>
        /// Creates a new sync manager for a custom <see cref="AppList"/> file. Used for testing. Uses no mutex!
        /// </summary>
        /// <param name="appListPath">The storage location of the <see cref="AppList"/> file.</param>
        /// <param name="server">Access information for the sync server.</param>
        /// <param name="feedRetriever">Callback method used to retrieve additional <see cref="Feed"/>s on demand.</param>
        /// <param name="handler">A callback object used when the the user is to be informed about the progress of long-running operations such as downloads.</param>
        /// <param name="machineWide">Apply operations machine-wide instead of just for the current user.</param>
        /// <exception cref="IOException">A problem occurs while accessing the <see cref="AppList"/> file.</exception>
        /// <exception cref="UnauthorizedAccessException">Read or write access to the <see cref="AppList"/> file is not permitted or another desktop integration class is currently active.</exception>
        /// <exception cref="InvalidDataException">A problem occurs while deserializing the XML data.</exception>
        public SyncIntegrationManager([NotNull] string appListPath, SyncServer server, [NotNull] Converter<FeedUri, Feed> feedRetriever, [NotNull] ITaskHandler handler, bool machineWide = false)
            : base(appListPath, handler, machineWide)
        {
            #region Sanity checks
            if (server.Uri == null) throw new ArgumentNullException(nameof(server));
            if (feedRetriever == null) throw new ArgumentNullException(nameof(feedRetriever));
            #endregion

            _server = server;
            _feedRetriever = feedRetriever;

            if (File.Exists(AppListPath + AppListLastSyncSuffix)) _appListLastSync = XmlStorage.LoadXml<AppList>(AppListPath + AppListLastSyncSuffix);
            else
            {
                _appListLastSync = new AppList();
                _appListLastSync.SaveXml(AppListPath + AppListLastSyncSuffix);
            }
        }
Example #38
0
        private static void TestClone(AppList appList)
        {
            var appList2 = appList.Clone();

            // Ensure data stayed the same
            appList2.Should().Be(appList, because: "Cloned objects should be equal.");
            appList2.GetHashCode().Should().Be(appList.GetHashCode(), because: "Cloned objects' hashes should be equal.");
            appList2.Should().NotBeSameAs(appList, because: "Cloning should not return the same reference.");
        }
        public void TestModifiedRemote()
        {
            using (var apLocalApplied = new TemporaryFlagFile("ap-local-applied"))
            using (var apLocalUnapplied = new TemporaryFlagFile("ap-local-unapplied"))
            using (var apRemoteApplied = new TemporaryFlagFile("ap-remote-applied"))
            using (var apRemoteUnapplied = new TemporaryFlagFile("ap-remote-unapplied"))
            {
                var appListLocal = new AppList
                {
                    Entries =
                    {
                        new AppEntry
                        {
                            InterfaceUri = FeedTest.Test1Uri, AutoUpdate = true, Timestamp = new DateTime(2000, 1, 1),
                            AccessPoints = new AccessPointList {Entries = {new MockAccessPoint {ApplyFlagPath = apLocalApplied, UnapplyFlagPath = apLocalUnapplied}}}
                        }
                    }
                };

                var appListServer = new AppList
                {
                    Entries =
                    {
                        new AppEntry
                        {
                            InterfaceUri = FeedTest.Test1Uri, AutoUpdate = false, Timestamp = new DateTime(2001, 1, 1),
                            AccessPoints = new AccessPointList {Entries = {new MockAccessPoint {ApplyFlagPath = apRemoteApplied, UnapplyFlagPath = apRemoteUnapplied}}}
                        }
                    }
                };

                TestSync(SyncResetMode.None, appListLocal, null, appListServer);

                Assert.IsFalse(apLocalApplied.Set, "Outdated access point should not be reapplied");
                Assert.IsTrue(apLocalUnapplied.Set, "Outdated access point should be removed");
                Assert.IsTrue(apRemoteApplied.Set, "New access point should be applied");
                Assert.IsFalse(apRemoteUnapplied.Set, "New access point should not be unapplied");
            }
        }
        public IEnumerable<IAppTile> UpdateMyApps()
        {
            var newAppList = AppList.LoadSafe(_machineWide);
            var tiles = new List<IAppTile>();

            // Update the displayed AppList based on changes detected between the current and the new AppList
            Merge.TwoWay(
                theirs: newAppList.Entries, mine: AppList.Entries,
                added: entry =>
                {
                    if (entry.InterfaceUri == null || entry.Name == null) return;
                    try
                    {
                        var status = (entry.AccessPoints == null) ? AppStatus.Added : AppStatus.Integrated;
                        var tile = _tileListMyApps.QueueNewTile(entry.InterfaceUri, entry.Name, status, _iconCache, _machineWide);
                        tiles.Add(tile);

                        // Update "added" status of tile in catalog list
                        var catalogTile = _tileListCatalog.GetTile(entry.InterfaceUri);
                        if (catalogTile != null) catalogTile.Status = tile.Status;
                    }
                        #region Error handling
                    catch (KeyNotFoundException)
                    {
                        Log.Warn(string.Format(Resources.UnableToLoadFeedForApp, entry.InterfaceUri));
                    }
                    catch (InvalidOperationException)
                    {
                        Log.Warn(string.Format(Resources.IgnoringDuplicateAppListEntry, entry.InterfaceUri));
                    }
                    #endregion
                },
                removed: entry =>
                {
                    if (entry.InterfaceUri == null) return;
                    _tileListMyApps.RemoveTile(entry.InterfaceUri);

                    // Update "added" status of tile in catalog list
                    var catalogTile = _tileListCatalog.GetTile(entry.InterfaceUri);
                    if (catalogTile != null) catalogTile.Status = AppStatus.Candidate;
                });
            _tileListMyApps.AddQueuedTiles();
            AppList = newAppList;

            return tiles;
        }
        public void TestAddedRemote()
        {
            using (var apApplied = new TemporaryFlagFile("ap-applied"))
            using (var apUnapplied = new TemporaryFlagFile("ap-unapplied"))
            {
                var appListRemote = new AppList
                {
                    Entries =
                    {
                        new AppEntry
                        {
                            InterfaceUri = FeedTest.Test1Uri,
                            AccessPoints = new AccessPointList {Entries = {new MockAccessPoint {ApplyFlagPath = apApplied, UnapplyFlagPath = apUnapplied}, new MockAccessPoint()}}
                        }
                    }
                };

                TestSync(SyncResetMode.None, new AppList(), new AppList(), appListRemote);

                Assert.IsTrue(apApplied.Set, "New access point should be applied");
                Assert.IsFalse(apUnapplied.Set, "New access point should not be unapplied");
            }
        }
        /// <summary>
        /// Tests the sync logic with pre-defined <see cref="AppList"/>s.
        /// local add: appEntry1, local remove: appEntry2, remote add: appEntry3, remote remove: appEntry4
        /// </summary>
        /// <param name="resetMode">The <see cref="SyncResetMode"/> to pass to <see cref="SyncIntegrationManager.Sync"/>.</param>
        /// <param name="ap1Applied">The flag file used to indicate that <see cref="MockAccessPoint.Apply"/> was called for appEntry1.</param>
        /// <param name="ap1Unapplied">The flag file used to indicate that <see cref="MockAccessPoint.Unapply"/> was called for appEntry1.</param>
        /// <param name="ap2Applied">The flag file used to indicate that <see cref="MockAccessPoint.Apply"/> was called for appEntry2.</param>
        /// <param name="ap2Unapplied">The flag file used to indicate that <see cref="MockAccessPoint.Unapply"/> was called for appEntry2.</param>
        /// <param name="ap3Applied">The flag file used to indicate that <see cref="MockAccessPoint.Apply"/> was called for appEntry3.</param>
        /// <param name="ap3Unapplied">The flag file used to indicate that <see cref="MockAccessPoint.Unapply"/> was called for appEntry3.</param>
        /// <param name="ap4Applied">The flag file used to indicate that <see cref="MockAccessPoint.Apply"/> was called for appEntry4.</param>
        /// <param name="ap4Unapplied">The flag file used to indicate that <see cref="MockAccessPoint.Unapply"/> was called for appEntry4.</param>
        private void TestSync(SyncResetMode resetMode,
            TemporaryFlagFile ap1Applied, TemporaryFlagFile ap1Unapplied,
            TemporaryFlagFile ap2Applied, TemporaryFlagFile ap2Unapplied,
            TemporaryFlagFile ap3Applied, TemporaryFlagFile ap3Unapplied,
            TemporaryFlagFile ap4Applied, TemporaryFlagFile ap4Unapplied)
        {
            var appEntry1 = new AppEntry
            {
                InterfaceUri = FeedTest.Test1Uri,
                AccessPoints = new AccessPointList {Entries = {new MockAccessPoint {ApplyFlagPath = ap1Applied, UnapplyFlagPath = ap1Unapplied}}}
            };
            var appEntry2 = new AppEntry
            {
                InterfaceUri = FeedTest.Test2Uri,
                AccessPoints = new AccessPointList {Entries = {new MockAccessPoint {ApplyFlagPath = ap2Applied, UnapplyFlagPath = ap2Unapplied}}}
            };
            var appEntry3 = new AppEntry
            {
                InterfaceUri = FeedTest.Test3Uri,
                AccessPoints = new AccessPointList {Entries = {new MockAccessPoint {ApplyFlagPath = ap3Applied, UnapplyFlagPath = ap3Unapplied}}}
            };
            var appEntry4 = new AppEntry
            {
                InterfaceUri = new FeedUri("http://0install.de/feeds/test/test4.xml"),
                AccessPoints = new AccessPointList {Entries = {new MockAccessPoint {ApplyFlagPath = ap4Applied, UnapplyFlagPath = ap4Unapplied}}}
            };
            var appListLocal = new AppList {Entries = {appEntry1, appEntry4}};
            var appListLast = new AppList {Entries = {appEntry2, appEntry4}};
            var appListServer = new AppList {Entries = {appEntry2, appEntry3}};

            TestSync(resetMode, appListLocal, appListLast, appListServer);
        }
Example #43
0
        private static void TestSaveLoad(AppList appList)
        {
            Assert.That(appList, Is.XmlSerializable);

            AppList appList2;
            using (var tempFile = new TemporaryFile("0install-unit-tests"))
            {
                // Write and read file
                appList.SaveXml(tempFile);
                appList2 = XmlStorage.LoadXml<AppList>(tempFile);
            }

            // Ensure data stayed the same
            appList2.Should().Be(appList, because: "Serialized objects should be equal.");
            appList2.GetHashCode().Should().Be(appList.GetHashCode(), because: "Serialized objects' hashes should be equal.");
            appList2.Should().NotBeSameAs(appList, because: "Serialized objects should not return the same reference.");
        }
Example #44
0
        public void TestSearch()
        {
            var appA = new AppEntry {InterfaceUri = FeedTest.Test1Uri, Name = "AppA"};
            var appB = new AppEntry {InterfaceUri = FeedTest.Test2Uri, Name = "AppB"};
            var lib = new AppEntry {InterfaceUri = FeedTest.Test3Uri, Name = "Lib"};
            var appList = new AppList {Entries = {appA, appB, lib}};

            appList.Search("").Should().Equal(appA, appB, lib);
            appList.Search("App").Should().Equal(appA, appB);
            appList.Search("AppA").Should().Equal(appA);
            appList.Search("AppB").Should().Equal(appB);
        }
        /// <summary>
        /// Creates a new integration manager using the default <see cref="DesktopIntegration.AppList"/> (creating a new one if missing). Performs Mutex-based locking.
        /// </summary>
        /// <param name="handler">A callback object used when the the user is to be informed about the progress of long-running operations such as downloads.</param>
        /// <param name="machineWide">Apply operations machine-wide instead of just for the current user.</param>
        /// <exception cref="IOException">A problem occurs while accessing the <see cref="AppList"/> file.</exception>
        /// <exception cref="UnauthorizedAccessException">Read or write access to the <see cref="AppList"/> file is not permitted or if another desktop integration class is currently active.</exception>
        /// <exception cref="InvalidDataException">A problem occurs while deserializing the XML data.</exception>
        public IntegrationManager([NotNull] ITaskHandler handler, bool machineWide = false)
            : base(handler)
        {
            #region Sanity checks
            if (handler == null) throw new ArgumentNullException("handler");
            #endregion

            MachineWide = machineWide;
            _mutex = AquireMutex();

            try
            {
                AppListPath = AppList.GetDefaultPath(machineWide);
                if (File.Exists(AppListPath))
                {
                    Log.Debug("Loading AppList for IntegrationManager from: " + AppListPath);
                    AppList = XmlStorage.LoadXml<AppList>(AppListPath);
                }
                else
                {
                    Log.Debug("Creating new AppList for IntegrationManager: " + AppListPath);
                    AppList = new AppList();
                    AppList.SaveXml(AppListPath);
                }
            }
                #region Error handling
            catch
            {
                // Avoid abandoned mutexes
                _mutex.ReleaseMutex();
                _mutex.Close();
                throw;
            }
            #endregion
        }
        public void TestRemovedLocal()
        {
            using (var apApplied = new TemporaryFlagFile("ap-applied"))
            using (var apUnapplied = new TemporaryFlagFile("ap-unapplied"))
            {
                var appListServer = new AppList
                {
                    Entries =
                    {
                        new AppEntry
                        {
                            InterfaceUri = FeedTest.Test1Uri,
                            AccessPoints = new AccessPointList {Entries = {new MockAccessPoint {ApplyFlagPath = apApplied, UnapplyFlagPath = apUnapplied}}}
                        }
                    }
                };

                TestSync(SyncResetMode.None, new AppList(), appListServer.Clone(), appListServer);

                apApplied.Set.Should().BeFalse(because: "Locally removed access point should not be reapplied");
                apUnapplied.Set.Should().BeFalse(because: "Locally removed access point should not be unapplied again");
            }
        }