Exemple #1
0
        //----------------------------------//

        /// <summary>
        /// Initialize a web resource.
        /// </summary>
        public WebResource(HttpSite site, string path, string mime = null)
        {
            _lock = new LockShared();

            // persist the local path
            Path = path;

            // does the path indicate a web resource?
            if (Fs.IsWebPath(Path))
            {
                // persist the path
                FullPath = Path;
            }
            else
            {
                // persist the path
                FullPath = Fs.Combine(site.Path, Path);
            }

            _compression = System.Net.DecompressionMethods.None;

            // get the web resource extension if set
            MimeType = mime ?? Mime.GetType(Fs.GetExtension(FullPath));

            // the resource must be loaded to begin with
            _reset = true;
        }
Exemple #2
0
        //-------------------------------------------//

        static ManagerResources()
        {
            ProgramPath = AppDomain.CurrentDomain.BaseDirectory;
            ProgramName = AppDomain.CurrentDomain.FriendlyName;

            ResourcePath = Fs.Combine(ProgramPath, ResourcePath);

            _configurations = new Dictionary <string, WeakReferencer <Configuration> >();
            _lock           = new LockShared();
        }
Exemple #3
0
        //-------------------------------------------//

        /// <summary>
        /// Initializes a new threadsafe value.
        /// </summary>
        public Pocket(Func <A> toGet)
        {
            _toGet = toGet;
            _lock  = new LockShared();
        }
Exemple #4
0
        //-------------------------------------------//

        /// <summary>
        /// Manager of connections to external resources.
        /// </summary>
        public ManagerConnections()
        {
            _sources = new Dictionary <Type, ArrayRig <IConnection> >();
            _lock    = new LockShared();
        }