示例#1
0
        public bool TryAddFile(string filename, string face = "")
        {
            if (filename.IsEmpty())
            {
                return(false);
            }

            if (face.IsEmpty())
            {
                face = "Unknown";
            }

            ClsFace FoundFace = new ClsFace(face);

            int fnd = this.Faces.IndexOf(FoundFace);

            if (fnd > -1)
            {
                FoundFace = this.Faces[fnd];
            }
            else
            {
                this.Faces.Add(FoundFace);
            }

            bool added = FoundFace.TryAddFile(filename, out string Outfilename);

            //delete from unknown folder if it was originally from there and it moved
            if (added && filename.Has("\\unknown\\") && !Outfilename.Has("\\unknown\\"))
            {
                Global.SafeFileDelete(filename);
            }

            return(added);
        }
示例#2
0
        public bool TryAddFile(ClsImageQueueItem CurImg, string face = "")
        {
            if (!CurImg.IsValid())
            {
                return(false);
            }

            if (face.IsEmpty())
            {
                face = "Unknown";
            }

            if (face.EqualsIgnoreCase("face"))
            {
                face = "Unknown";
            }

            if (face.EqualsIgnoreCase("unknown"))
            {
                if (!this.SaveUnknownFaces)
                {
                    return(false);
                }
            }
            else
            {
                if (!this.SaveKnownFaces)
                {
                    return(false);
                }
            }

            ClsFace FoundFace = this.TryAddFace(face);

            bool added = FoundFace.TryAddFile(CurImg, out string Outfilename, this.MaxFilesPerFace, this.MaxFileAgeDays);

            //delete from unknown folder if it was originally from there and it moved
            if (added)
            {
                this.NeedsSaving = true;

                if (CurImg.image_path.Has("\\unknown\\") && !Outfilename.Has("\\unknown\\") &&
                    CurImg.image_path.Has("\\face\\") && !Outfilename.Has("\\face\\"))
                {
                    Global.SafeFileDelete(CurImg.image_path);
                }
            }

            return(added);
        }