Ejemplo n.º 1
0
        public static bool TestProjectFolder(string strFolder, ref ProjectFileStructure pFileStructure, ref string errMsg)
        {
            if (!System.IO.Directory.Exists(strFolder))
            {
                return(false);
            }

            ProjectFileStructure pTemp = new ProjectFileStructure();

            pTemp.RootFolder = strFolder;

            pTemp.ProjectExcel = Path.Combine(strFolder, ProjectExcel);
            if (!File.Exists(pTemp.ProjectExcel))
            {
                errMsg = "项目信息文件(Project.xls)不存在";
                return(false);
            }

            pTemp.FlyFile = Path.Combine(strFolder, FlyFile);
            if (!File.Exists(pTemp.FlyFile))
            {
                errMsg = "项目Fly文件不存在";
                return(false);
            }

            pTemp.ImageFile = Path.Combine(strFolder, ImageFile);
            //if (!File.Exists(pTemp.ImageFile))
            //{
            //    errMsg = "项目影像文件不存在";
            //    return false;
            //}

            pTemp.DemFile = Path.Combine(strFolder, ImageFile);
            //if (!File.Exists(pTemp.DemFile))
            //{
            //    errMsg = "项目高程文件不存在";
            //    return false;
            //}

            string[] schemaFolders = Directory.GetDirectories(strFolder);
            if (strFolder == null || strFolder.Length == 0)
            {
                errMsg = "没有方案";
                return(false);
            }

            List <SchemaFileStructure> sListTemp = new List <SchemaFileStructure>();

            foreach (string schemaFolder in schemaFolders)
            {
                SchemaFileStructure sTemp = new SchemaFileStructure();
                sTemp.SchemaFolder = schemaFolder;
                sTemp.SchemaExcel  = Path.Combine(schemaFolder, SchemaExcel);
                if (!File.Exists(sTemp.SchemaExcel))
                {
                    continue;
                }

                sTemp.LocationExcel = Path.Combine(schemaFolder, LocationExcel);
                if (!File.Exists(sTemp.LocationExcel))
                {
                    continue;
                }

                sTemp.ModelFolder = Path.Combine(schemaFolder, ModelFolder);
                if (!Directory.Exists(sTemp.ModelFolder))
                {
                    continue;
                }

                sListTemp.Add(sTemp);
            }

            if (sListTemp.Count == 0)
            {
                errMsg = "当前文件夹下没有方案";
                return(false);
            }

            pTemp.SchemaStruactures = sListTemp;

            pFileStructure = pTemp;
            return(true);
        }
Ejemplo n.º 2
0
        public static bool TestProjectFolder(string strFolder, ref ProjectFileStructure pFileStructure, ref string errMsg)
        {
            if (!System.IO.Directory.Exists(strFolder))
                return false;

            ProjectFileStructure pTemp = new ProjectFileStructure();
            pTemp.RootFolder = strFolder;

            pTemp.ProjectExcel = Path.Combine(strFolder, ProjectExcel);
            if (!File.Exists(pTemp.ProjectExcel))
            {
                errMsg = "项目信息文件(Project.xls)不存在";
                return false;
            }

            pTemp.FlyFile = Path.Combine(strFolder, FlyFile);
            if (!File.Exists(pTemp.FlyFile))
            {
                errMsg = "项目Fly文件不存在";
                return false;
            }

            pTemp.ImageFile = Path.Combine(strFolder, ImageFile);
            //if (!File.Exists(pTemp.ImageFile))
            //{
            //    errMsg = "项目影像文件不存在";
            //    return false;
            //}

            pTemp.DemFile = Path.Combine(strFolder, ImageFile);
            //if (!File.Exists(pTemp.DemFile))
            //{
            //    errMsg = "项目高程文件不存在";
            //    return false;
            //}

            string[] schemaFolders = Directory.GetDirectories(strFolder);
            if (strFolder == null || strFolder.Length == 0)
            {
                errMsg = "没有方案";
                return false;
            }

            List<SchemaFileStructure> sListTemp = new List<SchemaFileStructure>();
            foreach (string schemaFolder in schemaFolders)
            {
                SchemaFileStructure sTemp = new SchemaFileStructure();
                sTemp.SchemaFolder = schemaFolder;
                sTemp.SchemaExcel = Path.Combine(schemaFolder, SchemaExcel);
                if (!File.Exists(sTemp.SchemaExcel))
                    continue;

                sTemp.LocationExcel = Path.Combine(schemaFolder, LocationExcel);
                if (!File.Exists(sTemp.LocationExcel))
                    continue;

                sTemp.ModelFolder = Path.Combine(schemaFolder, ModelFolder);
                if (!Directory.Exists(sTemp.ModelFolder))
                    continue;

                sListTemp.Add(sTemp);
            }

            if (sListTemp.Count == 0)
            {
                errMsg = "当前文件夹下没有方案";
                return false;
            }

            pTemp.SchemaStruactures = sListTemp;

            pFileStructure = pTemp;
            return true;
        }