예제 #1
0
        public GEDCOMMultimediaLink SetPrimaryMultimediaLink(GEDCOMMultimediaRecord mediaRec)
        {
            if (mediaRec == null)
            {
                return(null);
            }
            GEDCOMMultimediaLink mmLink = null;

            int num = MultimediaLinks.Count;

            for (int i = 0; i < num; i++)
            {
                GEDCOMMultimediaLink lnk = MultimediaLinks[i];

                if (lnk.Value == mediaRec)
                {
                    mmLink = lnk;
                    break;
                }
            }

            if (mmLink == null)
            {
                mmLink = AddMultimedia(mediaRec);
            }

            mmLink.IsPrimary = true;
            return(mmLink);
        }
예제 #2
0
        public string GetUID()
        {
            string result = null;

            try
            {
                if (Value != null)
                {
                    ExtRect cutoutArea;
                    if (IsPrimaryCutout)
                    {
                        cutoutArea = CutoutPosition.Value;
                    }
                    else
                    {
                        cutoutArea = ExtRect.CreateEmpty();
                    }

                    GEDCOMMultimediaRecord mmRec = (GEDCOMMultimediaRecord)Value;
                    result = mmRec.UID + "-" + GKUtils.GetRectUID(cutoutArea.Left, cutoutArea.Top, cutoutArea.Right, cutoutArea.Bottom);
                }
            }
            catch (Exception ex)
            {
                Logger.LogWrite("GEDCOMMultimediaLink.GetUID(): " + ex.Message);
                result = null;
            }
            return(result);
        }
예제 #3
0
        public GEDCOMMultimediaRecord CreateMultimedia()
        {
            GEDCOMMultimediaRecord result = new GEDCOMMultimediaRecord(this, this, "", "");

            result.InitNew();
            result.ChangeDate.ChangeDateTime = DateTime.Now;

            AddRecord(result);
            return(result);
        }
예제 #4
0
        public GEDCOMMultimediaLink AddMultimedia(GEDCOMMultimediaRecord mediaRec)
        {
            GEDCOMMultimediaLink mmLink = null;

            if (mediaRec != null)
            {
                mmLink       = new GEDCOMMultimediaLink(Owner, this, "", "");
                mmLink.Value = mediaRec;
                MultimediaLinks.Add(mmLink);
            }

            return(mmLink);
        }
예제 #5
0
        public GEDCOMMultimediaLink AddMultimedia(GEDCOMMultimediaRecord mediaRec)
        {
            GEDCOMMultimediaLink result = null;

            if (mediaRec != null)
            {
                result       = new GEDCOMMultimediaLink(Owner, this, "", "");
                result.Value = mediaRec;
                MultimediaLinks.Add(result);
            }

            return(result);
        }
예제 #6
0
        public bool DeleteMediaRecord(GEDCOMMultimediaRecord mRec)
        {
            if (mRec == null)
            {
                return(false);
            }

            int num = fRecords.Count;

            for (int i = 0; i < num; i++)
            {
                GEDCOMRecord rec = this[i];
                for (int j = rec.MultimediaLinks.Count - 1; j >= 0; j--)
                {
                    if (rec.MultimediaLinks[j].Value == mRec)
                    {
                        rec.MultimediaLinks.DeleteAt(j);
                    }
                }
            }

            DeleteRecord(mRec);
            return(true);
        }