Exemple #1
0
        /// <summary>
        /// Creates the aimp object.
        /// </summary>
        /// <typeparam name="TAimpObject">The type of the t aimp object.</typeparam>
        /// <param name="core">The core.</param>
        /// <returns>AimpActionResult&lt;TAimpObject&gt;.</returns>
        public static AimpActionResult <TAimpObject> CreateAimpObject <TAimpObject>(this IAimpCore core)
            where TAimpObject : class, IAimpObject
        {
            var result = core.CreateObject <TAimpObject>();

            if (result.ResultType != ActionResultType.OK)
            {
                return(new AimpActionResult <TAimpObject>(result.ResultType, default));
            }

            return(new AimpActionResult <TAimpObject>(result.ResultType, result.Result as TAimpObject));
        }
        /// <inheritdoc />
        public AimpTraceListener(IAimpCore core)
        {
            var dirAppData = Path.Combine(core.GetPath(AimpCorePathType.AIMP_CORE_PATH_PROFILE), YandexMusicPlugin.PluginFileName);

            Directory.CreateDirectory(dirAppData);
            var logFile = Path.Combine(dirAppData, YandexMusicPlugin.PluginFileName + ".log");

            _stream = new StreamWriter(logFile, false)
            {
                AutoFlush = true
            };
        }
Exemple #3
0
        public FrmTestPreimage(IAimpServicePlaylistManager manager, IAimpCore core)
            : this()
        {
            _manager   = manager;
            _core      = core;
            _playlists = new List <string>();

            _factory = new TestPreimageFactory();
            _core.RegisterExtension(this);
            _core.RegisterExtension(_factory);

            for (int i = 0; i < _manager.GetLoadedPlaylistCount(); i++)
            {
                IAimpPlaylist pl;
                var           result = _manager.GetLoadedPlaylist(i);

                if (result.ResultType == ActionResultType.OK)
                {
                    PlAdded(result.Result);
                }
            }
        }