コード例 #1
0
ファイル: Form1.cs プロジェクト: carriercomm/ED-IBE
        private static ObjectDirectory PurgeEddnFromDirectory(ObjectDirectory directory)
        {
            ObjectDirectory newDirectory;

            if(directory.GetType() == typeof(StationDirectory))
                newDirectory = new StationDirectory();
            else
                newDirectory = new CommodityDirectory();

            foreach (var x in directory)
            {
                var newList = new List<CsvRow>();
                foreach (var y in x.Value)
                    if (y.SourceFileName != "<From EDDN>")
                        newList.Add(y);

                if(newList.Count > 0)
                    newDirectory.Add(x.Key, newList);
            }
            return newDirectory;
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: GettroLadalle/RegulatedNoise
        private static ObjectDirectory PurgeOldDataFromDirectory(ObjectDirectory directory, DateTime deadline)
        {
            ObjectDirectory newDirectory;
            
            if(directory.GetType() == typeof(StationDirectory))
                newDirectory = new StationDirectory();
            else
                newDirectory = new CommodityDirectory();

            foreach (var x in directory)
            {
                var newList = new List<CsvRow>();
                foreach (var y in x.Value)
                    if (y.SampleDate >= deadline)
                        newList.Add(y);

                if(newList.Count > 0)
                    newDirectory.Add(x.Key, newList);
            }
            return newDirectory;
        }