예제 #1
0
        /// <summary>
        /// Appends, and creates if neccesary, a catalog file for a given image URL.
        ///
        /// Used when initially acquiring images from the storage account.
        /// </summary>
        public void RecordStorageImage(string container, string url)
        {
            if (String.IsNullOrEmpty(container) || string.IsNullOrEmpty(url))
            {
                throw new ArgumentException();
            }

            if (!this.LabelMap.ContainsKey(container))
            {
                this.LabelMap.Add(container, String.Format("{0}.csv", Guid.NewGuid().ToString("N")));
                this.Record(new string[] { container, this.LabelMap[container] });
            }

            GenericCsvLogger labelLogger = new GenericCsvLogger(
                this.Configuration.RecordLocation,
                this.LabelMap[container],
                new string[] { "Url" });

            labelLogger.Record(url);
        }
예제 #2
0
        /// <summary>
        /// Gets the parsed list of items that are stored in a local catalog file for a particular container.
        /// </summary>
        public List <ScoringImage> LoadContainerData(string container)
        {
            List <ScoringImage> returnValue = new List <ScoringImage>();

            if (!String.IsNullOrEmpty(container))
            {
                if (this.LabelMap.ContainsKey(container))
                {
                    GenericCsvLogger labelLogger = new GenericCsvLogger(
                        this.Configuration.RecordLocation,
                        this.LabelMap[container],
                        new string[] { "Url" });

                    foreach (string[] entry in labelLogger.GetEntries())
                    {
                        if (entry.Length == 1)
                        {
                            returnValue.Add(ScoringImage.ParseRecord(entry[0]));
                        }
                    }
                }
            }
            return(returnValue);
        }