Exemple #1
0
        public static int ToChusIndex(this CavityType socketType)
        {
            switch (socketType)
            {
            case CavityType.Cavity1:
                return(0);

            case CavityType.Cavity2:
                return(1);
            }

            return(-1);
        }
        public static DateTime SerializeImagesWith2D3DMatched(List <HImage> images2d, List <HImage> images3d, bool shouldSerialize2d, bool shouldSerialize3d, CavityType cavityType, bool saveNgImagesOnly, ProductLevel productLevel)
        {
            var currentTime     = DateTime.Now;
            var currentTimeText = currentTime.ToString(NameConstants.DateTimeFormat);
            var dirName         = cavityType.ToString();

            try
            {
                if ((saveNgImagesOnly && productLevel != ProductLevel.OK) || !saveNgImagesOnly)
                {
                    if (shouldSerialize2d)
                    {
                        var imageDir2d = Path.Combine(DirectoryConstants.ImageDir2D, dirName);
                        SerializeImages(images2d, imageDir2d, currentTimeText);
                    }

                    if (shouldSerialize3d)
                    {
                        var imageDir3d = Path.Combine(DirectoryConstants.ImageDir3D, dirName);
                        SerializeImages(images3d, imageDir3d, currentTimeText, "tiff");
                    }
                }
            }
            catch (HOperatorException e)
            {
                if (e.Message.Contains("#5566"))
                {
                    Logger.LogHighLevelWarningNormal("磁盘已满, 请立即清理磁盘");
                }
                else
                {
                    throw;
                }
            }

            return(currentTime);
        }