示例#1
0
        private static WorkspaceInfo GetWorkspaceInfo(string file)
        {
            var           strWorkspaceInfo = UIO.ReadFile(file);
            WorkspaceInfo workspaceInfo    = UXmlConvert.GetObject <WorkspaceInfo>(strWorkspaceInfo);

            DateTime cdt = workspaceInfo.SaveTime;

            var dir = Path.GetDirectoryName(file);

            string[]      files    = Directory.GetFiles(dir, "*", SearchOption.AllDirectories);
            List <string> newFiles = new List <string>();

            foreach (string f in files)
            {
                if (f == file)
                {
                    continue;
                }
                DateTime dt = File.GetCreationTime(f);
                if (dt > cdt)
                {
                    newFiles.Add(f);
                }
            }
            if (newFiles.Count != 0)
            {
                CreateWorkspaceInfo(file, newFiles, workspaceInfo);
            }
            return(workspaceInfo);
        }
示例#2
0
        public static StrategyFilter StrategyFilter(WorkspaceDef wksdef)
        {
            string filename = GetStrategyXmlName(wksdef);

            StrategyFilter strategyFilter;

            if (!File.Exists(filename))
            {
                strategyFilter         = new StrategyFilter();
                strategyFilter.Days    = 1;
                strategyFilter.Sensors = new string[] { "AVHRR", "MERSI", "MODIS", "VISSR", "VIRR" };
                var str = UXmlConvert.GetString(strategyFilter);
                UIO.SaveFile(str, filename);
            }
            else
            {
                var str = UIO.ReadFile(filename);
                strategyFilter = UXmlConvert.GetObject <StrategyFilter>(str);
            }
            return(strategyFilter);
        }
示例#3
0
        private static void SaveWorkspace(string filename, WorkspaceInfo workspaceInfo)
        {
            var str = UXmlConvert.GetString(workspaceInfo);

            UIO.SaveFile(str, filename);
        }