Beispiel #1
0
        public static void foo(string index, List <DataRecord> RecordsList)
        {
            if (!FileBasedCache.Exists(index))
            {
                FileBasedCache.Insert <List <DataRecord> >(index, RecordsList);
                return;
            }

            try
            {
                List <DataRecord> cachedRecords = FileBasedCache.Get <List <DataRecord> >(index);

                for (int i = 0; i < Math.Min(cachedRecords.Count, RecordsList.Count); i++)
                {
                    if (RecordsList[i] == cachedRecords[i])
                    {
                        Logger.Log("Record " + i + " is equal!");
                    }
                    else
                    {
                        Logger.Log("Record " + i + " is NOT equal!");
                        tfunctflag = true;

                        // Decide which one is more up to data OR has more records
                        RecordsList.Clear();
                        RecordsList.AddRange(cachedRecords);
                    }
                }
            }
            catch (Exception e)
            {
                Logger.Log(e.Message);
            }
        }
Beispiel #2
0
        static void PrintDataRecords(List <DataRecord> Records)
        {
            List <DataRecord> RecordsList = new List <DataRecord>();

            foreach (var i in Records)
            {
                Console.WriteLine("NAME: " + i.name);
                RecordsList.Add(i);

                List <DataRecord> temp = new List <DataRecord>();
                temp.Add(i);
                vwc.GetMetaData(PrintMetaData, temp);
            }

            // ================================================
            // TEST FOR DOWNLOAD VS CACHED DATA_RECORD EQUALITY
            // ================================================
            try
            {
                List <DataRecord> cachedRecords = FileBasedCache.Get <List <DataRecord> >("RECORD");

                for (int i = 0; i < Math.Min(cachedRecords.Count, RecordsList.Count); i++)
                {
                    if (RecordsList[i] == cachedRecords[i])
                    {
                        Logger.Log("Record " + i + " is equal!");
                    }
                    else
                    {
                        Logger.Log("Record " + i + " is NOT equal!");
                    }
                }
                FileBasedCache.Clear();
                Console.WriteLine("CACHE CLEARED");
            }
            catch (Exception e)
            {
                Logger.Log(e.Message);
            }

            // if all is well this should work
            foreach (var i in RecordsList)
            {
                vwc.getMap(GetMap, i, type: DownloadType.File, OutputPath: "./", OutputName: i.name);
                vwc.getCoverage(GetCoverage, i);
                vwc.getFeatures(GetFeature, i);
            }

            FileBasedCache.Insert <List <DataRecord> >("RECORD", RecordsList);
            Console.WriteLine("RECORDS LOADED TO CACHE");

            // ================================================
            // END OF TEST
            // ================================================
        }