Ejemplo n.º 1
0
        /// <summary>
        /// CTOR
        /// </summary>
        internal MgProperties(String propertiesFileName)
        {
            byte[] propertiesContentBytes = HandleFiles.readToByteArray(propertiesFileName, "");
            var    propertiesContentXML   = Encoding.UTF8.GetString(propertiesContentBytes, 0, propertiesContentBytes.Length);

            loadFromXML(propertiesContentXML, Encoding.UTF8);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// get content from the cache
        /// </summary>
        /// <param name="url">URL to a cached file, excluding the server-side time stamp, e.g. /MG1VAI3T_MP_0$$$_$_$_N02400$$$$G8FM01_.xml.</param>
        public byte[] GetFile(String url)
        {
            lock (this)
            {
                byte[] content = null;

                String localFilename = URLToLocalFileName(url);
                if (HandleFiles.isExists(localFilename))
                {
                    content = HandleFiles.readToByteArray(localFilename, "");
                }

                return(content);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// get content from the cache; if the cached content's loading time differs from 'remoteTime', return null.
        /// </summary>
        /// <param name="url">URL to a cached file, excluding the server-side time stamp, e.g. /MG1VAI3T_MP_0$$$_$_$_N02400$$$$G8FM01_.xml.</param>
        /// <param name="remoteTime"></param>
        public byte[] GetFile(String url, String remoteTime)
        {
            lock (this)
            {
                byte[] content       = null;
                String localFilename = URLToLocalFileName(url);

                String localTime = HandleFiles.getFileTime(localFilename);

                if (HandleFiles.equals(localTime, remoteTime))
                {
                    content = HandleFiles.readToByteArray(localFilename, "");
                }

                return(content);
            }
        }