internal PackageItem(PackageSource source, string id, string version)
        {
            Id = id;
            Version = version;
            PackageSource = source;

            FastPath = source.MakeFastPath(id, version);
        }
 internal static string MakeFastPath(this PackageSource source, string id, string version)
 {
     return(String.Format(@"${0}\{1}\{2}", source.Serialized, id.ToBase64(), version.ToBase64()));
 }
        /// <summary>
        /// Finds packages given a locally-accessible filename
        /// 
        /// Package information must be returned using <c>request.YieldPackage(...)</c> function.
        /// </summary>
        /// <param name="file">the full path to the file to determine if it is a package</param>
        /// <param name="id">if this is greater than zero (and the number should have been generated using <c>StartFind(...)</c>, the core is calling this multiple times to do a batch search request. The operation can be delayed until <c>CompleteFind(...)</c> is called</param>
        /// <param name="request">An object passed in from the CORE that contains functions that can be used to interact with the CORE and HOST</param>
        public void FindPackageByFile(string file, int id, Request request)
        {
            request.Debug("Calling '{0}::FindPackageByFile' '{1}','{2}'", PackageProviderName, file, id);

            /*List<PackageSource> sources;
            var providerPackageSources = ProviderStorage.GetPackageSources(request);

            if (request.PackageSources != null && request.PackageSources.Any())
            {
                sources = new List<PackageSource>();

                foreach (var userRequestedSource in request.PackageSources)
                {
                    if (providerPackageSources.ContainsKey(userRequestedSource))
                    {
                        sources.Add(providerPackageSources[userRequestedSource]);
                    }
                }
            }
            else
            {
                sources = providerPackageSources.Select(i => i.Value).ToList();
            }

            var source = sources.FirstOrDefault();*/

            var source = new PackageSource("Local Filesystem", file) { Trusted = true };

            request.YieldPackage(new PackageItem(source, file, ""), file);
        }