protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         Clear();
         fConversations.Dispose();
     }
     base.Dispose(disposing);
 }
예제 #2
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         fList.Dispose();
         fList = null;
     }
     base.Dispose(disposing);
 }
예제 #3
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         Clear();
         fList.Dispose();
     }
     base.Dispose(disposing);
 }
예제 #4
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         ClearPoints();
         fMapPoints.Dispose();
     }
     base.Dispose(disposing);
 }
예제 #5
0
        private void InternalGenerate()
        {
            bool includeGens = fOptions.PedigreeOptions.IncludeGenerations;

            fWriter.addParagraph(fTitle, fTitleFont, CustomWriter.TextAlignment.taCenter);

            fPersonList = new ExtList <PedigreePerson>(true);
            fSourceList = new StringList();
            try
            {
                GenStep(null, fRoot, 1, 1);
                ReIndex();

                int curLevel = 0;
                int num      = fPersonList.Count;
                for (int i = 0; i < num; i++)
                {
                    PedigreePerson person = fPersonList[i];

                    if (includeGens && curLevel != person.Level)
                    {
                        curLevel = person.Level;
                        string genTitle = LangMan.LS(LSID.LSID_Generation) + " " + SysUtils.GetRome(curLevel);

                        fWriter.beginParagraph(CustomWriter.TextAlignment.taLeft, 12f, 6f);
                        fWriter.addParagraphChunk(genTitle, fChapFont);
                        fWriter.endParagraph();
                    }

                    WritePerson(person);
                }

                if (fSourceList.Count > 0)
                {
                    fWriter.beginParagraph(CustomWriter.TextAlignment.taCenter, 12f, 6f);
                    fWriter.addParagraphChunk(LangMan.LS(LSID.LSID_RPSources), fChapFont);
                    fWriter.endParagraph();

                    int num2 = fSourceList.Count;
                    for (int j = 0; j < num2; j++)
                    {
                        string sn   = (j + 1).ToString();
                        string sst  = sn + ". " + fSourceList[j];
                        string sanc = "src_" + sn;

                        fWriter.addParagraphAnchor(sst, fTextFont, sanc);
                    }
                }
            }
            finally
            {
                fSourceList.Dispose();
                fPersonList.Dispose();
            }
        }
예제 #6
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         OnChange   = null;
         OnChanging = null;
         Clear();
         fList.Dispose();
     }
     base.Dispose(disposing);
 }
예제 #7
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (fOwner != null)
         {
             fOwner.fControls.Extract(this);
             fOwner.fControls.Pack();
         }
         fControls.Dispose();
     }
     base.Dispose(disposing);
 }
예제 #8
0
        public void GenTree(StreamWriter writer, GEDCOMIndividualRecord iRec)
        {
            try {
                var tableRows = new ExtList <ExtList <TreeCell> >(true);
                try {
                    Step(tableRows, 0, 0, null, iRec, 1);

                    writer.WriteLine("<table border=\"0\" cellspacing=\"0\">");

                    int num = tableRows.Count;
                    for (int r = 0; r < num; r++)
                    {
                        var row = tableRows[r];
                        writer.WriteLine("<tr>");

                        int num2 = row.Count;
                        for (int c = 0; c < num2; c++)
                        {
                            TreeCell cell = row[c];
                            string   nm   = "&nbsp;";
                            string   st   = "";
                            if (cell.Kind != CellKind.ckSpace)
                            {
                                if (cell.Kind == CellKind.ckPerson && cell.Name != "")
                                {
                                    nm = "<a href=\"#" + cell.Rec.XRef + "\">" + cell.Name + "</a>";
                                }
                                st = " bgcolor=\"silver\"";
                            }
                            writer.WriteLine("<td" + st + ">" + nm + "</td>");
                        }
                        writer.WriteLine("</tr>");
                    }
                    writer.WriteLine("</tr></table>");
                } finally {
                    tableRows.Dispose();
                }
            } catch (Exception ex) {
                writer.WriteLine(ex.Message);
            }
        }
예제 #9
0
        public static void TreeSync(GDMTree mainTree, string fileName, TextBox logText)
        {
            logText.Clear();

            GDMTree              extTree  = new GDMTree();
            GDMXRefReplacer      repMap   = new GDMXRefReplacer();
            ExtList <SyncRecord> syncList = new ExtList <SyncRecord>(true);

            try {
                var gedcomProvider = new GEDCOMProvider(extTree);
                gedcomProvider.LoadFromFile(fileName);

                extTree.Header.Clear();

                for (int i = 0, num = extTree.RecordsCount; i < num; i++)
                {
                    GDMRecord rec = extTree[i];
                    syncList.Add(new SyncRecord {
                        MasterRecord  = null,
                        UpdateRecord  = rec,
                        State         = SyncState.ssUndefined,
                        UpdateOldXRef = "",
                        UpdateNewXRef = ""
                    });
                }

                for (int i = 0, num = syncList.Count; i < num; i++)
                {
                    SyncRecord syncRec = syncList[i];

                    GDMRecord rec = mainTree.FindUID(syncRec.UpdateRecord.UID);

                    if (rec != null)
                    {
                        syncRec.MasterRecord = rec;
                        syncRec.State        = SyncState.ssHasMaster;
                    }
                    else
                    {
                        syncRec.State = SyncState.ssNoMaster;
                        rec           = extTree.Extract(extTree.IndexOf(syncRec.UpdateRecord));
                        string newXRef = mainTree.XRefIndex_NewXRef(rec);
                        repMap.AddXRef(rec, rec.XRef, newXRef);
                        rec.XRef = newXRef;
                        rec.ResetOwner(mainTree);
                        mainTree.AddRecord(rec);
                    }
                }

                for (int i = 0, num = repMap.Count; i < num; i++)
                {
                    GDMRecord rec = repMap[i].Rec;
                    rec.ReplaceXRefs(repMap);
                }

                for (int i = 0, num = extTree.RecordsCount; i < num; i++)
                {
                    GDMRecord rec = extTree[i];
                    rec.ReplaceXRefs(repMap);
                }

                for (int i = 0, num = syncList.Count; i < num; i++)
                {
                    SyncRecord syncRec = syncList[i];
                    if (syncRec.State == SyncState.ssHasMaster)
                    {
                        GDMRecord rec = extTree.Extract(extTree.IndexOf(syncRec.UpdateRecord));
                        rec.XRef = mainTree.XRefIndex_NewXRef(rec);
                        rec.ResetOwner(mainTree);
                        mainTree.AddRecord(rec);
                        string backUID = syncRec.MasterRecord.UID;
                        syncRec.UpdateRecord.MoveTo(syncRec.MasterRecord, true);
                        syncRec.MasterRecord.UID = backUID;
                        mainTree.DeleteRecord(rec);
                    }
                }

                logText.AppendText("Sync finished\r\n");
            } finally {
                syncList.Dispose();
                repMap.Dispose();
                extTree.Dispose();
            }
        }
예제 #10
0
        private void WriteExcessFmt(PedigreePerson person)
        {
            fWriter.addParagraph(LangMan.LS(LSID.LSID_Sex) + ": " + GKUtils.SexStr(person.IRec.Sex), fTextFont);

            string st = GKUtils.GetLifeExpectancyStr(person.IRec);

            if (st != "?" && st != "")
            {
                fWriter.addParagraph(LangMan.LS(LSID.LSID_LifeExpectancy) + ": " + st, fTextFont);
            }

            GEDCOMIndividualRecord father, mother;
            GEDCOMFamilyRecord     fam = person.IRec.GetParentsFamily();

            if (fam == null)
            {
                father = null;
                mother = null;
            }
            else
            {
                father = fam.GetHusband();
                mother = fam.GetWife();
            }

            if (father != null)
            {
                fWriter.addParagraphLink(LangMan.LS(LSID.LSID_Father) + ": " + GKUtils.GetNameString(father, true, false) + " ", fTextFont, idLink(father), fLinkFont);
            }
            if (mother != null)
            {
                fWriter.addParagraphLink(LangMan.LS(LSID.LSID_Mother) + ": " + GKUtils.GetNameString(mother, true, false) + " ", fTextFont, idLink(mother), fLinkFont);
            }

            ExtList <PedigreeEvent> evList = new ExtList <PedigreeEvent>(true);

            try
            {
                int i;
                if (person.IRec.Events.Count > 0)
                {
                    fWriter.addParagraph(LangMan.LS(LSID.LSID_Events) + ":", fTextFont);

                    int num = person.IRec.Events.Count;
                    for (i = 0; i < num; i++)
                    {
                        GEDCOMCustomEvent evt = person.IRec.Events[i];
                        if (!(evt is GEDCOMIndividualAttribute) || fOptions.PedigreeOptions.IncludeAttributes)
                        {
                            evList.Add(new PedigreeEvent(person.IRec, evt));
                        }
                    }
                    WriteEventList(person, evList);
                }

                int num2 = person.IRec.SpouseToFamilyLinks.Count;
                for (i = 0; i < num2; i++)
                {
                    GEDCOMFamilyRecord family = person.IRec.SpouseToFamilyLinks[i].Family;
                    if (!fBase.Context.IsRecordAccess(family.Restriction))
                    {
                        continue;
                    }

                    GEDCOMPointer sp;
                    string        unk;
                    if (person.IRec.Sex == GEDCOMSex.svMale)
                    {
                        sp  = family.Wife;
                        st  = LangMan.LS(LSID.LSID_Wife) + ": ";
                        unk = LangMan.LS(LSID.LSID_UnkFemale);
                    }
                    else
                    {
                        sp  = family.Husband;
                        st  = LangMan.LS(LSID.LSID_Husband) + ": ";
                        unk = LangMan.LS(LSID.LSID_UnkMale);
                    }

                    GEDCOMIndividualRecord irec = sp.Value as GEDCOMIndividualRecord;
                    string sps;
                    if (irec != null)
                    {
                        sps = st + GKUtils.GetNameString(irec, true, false) + GKUtils.GetPedigreeLifeStr(irec, fOptions.PedigreeOptions.Format) /* + this.idLink(this.FindPerson(irec))*/;
                    }
                    else
                    {
                        sps = st + unk;
                    }

                    fWriter.addParagraph(sps, fTextFont);

                    evList.Clear();
                    int childrenCount = family.Children.Count;
                    for (int j = 0; j < childrenCount; j++)
                    {
                        irec = (GEDCOMIndividualRecord)family.Children[j].Value;
                        evList.Add(new PedigreeEvent(irec, irec.FindEvent("BIRT")));
                    }
                    WriteEventList(person, evList);
                }
            }
            finally
            {
                evList.Dispose();
            }

            if (fOptions.PedigreeOptions.IncludeNotes && person.IRec.Notes.Count != 0)
            {
                fWriter.addParagraph(LangMan.LS(LSID.LSID_RPNotes) + ":", fTextFont);

                fWriter.beginList();

                int notesCount = person.IRec.Notes.Count;
                for (int i = 0; i < notesCount; i++)
                {
                    GEDCOMNotes note = person.IRec.Notes[i];
                    fWriter.addListItem(" " + GKUtils.MergeStrings(note.Notes), fTextFont);
                }

                fWriter.endList();
            }
        }
예제 #11
0
        protected override void InternalGenerate()
        {
            bool isRtf = false;

#if !NETSTANDARD
            isRtf = (fWriter is RTFWriter);
#endif

            IColor clrBlack = AppHost.GfxProvider.CreateColor(0x000000);
            IColor clrBlue  = AppHost.GfxProvider.CreateColor(0x0000FF);

            fTitleFont  = fWriter.CreateFont("", 16f /*20f*/, true, false, clrBlack);
            fChapFont   = fWriter.CreateFont("", 14f /*16f*/, true, false, clrBlack);
            fPersonFont = fWriter.CreateFont("", 12f /*10f*/, true, false, clrBlack);
            fLinkFont   = fWriter.CreateFont("", 10f /*8f*/, false, true, clrBlue);
            fTextFont   = fWriter.CreateFont("", 10f /*8f*/, false, false, clrBlack);
            fSupText    = fWriter.CreateFont("", (isRtf ? 12f : 5f) /*5f*/, false, false, clrBlue);

            fFormat = fOptions.PedigreeOptions.Format;

            bool includeGens = fOptions.PedigreeOptions.IncludeGenerations;

            fWriter.AddParagraph(fTitle, fTitleFont, TextAlignment.taCenter);

            fPersonList = new ExtList <PedigreePerson>(true);
            fSourceList = new StringList();
            try {
                GenStep(null, fRoot, 1, 1);
                ReIndex();

                int curLevel = 0;
                int num      = fPersonList.Count;
                for (int i = 0; i < num; i++)
                {
                    PedigreePerson person = fPersonList[i];

                    if (includeGens && curLevel != person.Level)
                    {
                        curLevel = person.Level;
                        string genTitle = LangMan.LS(LSID.LSID_Generation) + " " + ConvertHelper.GetRome(curLevel);

                        fWriter.BeginParagraph(TextAlignment.taLeft, 12f, 6f);
                        fWriter.AddParagraphChunk(genTitle, fChapFont);
                        fWriter.EndParagraph();
                    }

                    WritePerson(person);
                }

                if (fSourceList.Count > 0)
                {
                    fWriter.BeginParagraph(TextAlignment.taCenter, 12f, 6f);
                    fWriter.AddParagraphChunk(LangMan.LS(LSID.LSID_RPSources), fChapFont);
                    fWriter.EndParagraph();

                    int num2 = fSourceList.Count;
                    for (int j = 0; j < num2; j++)
                    {
                        string sn   = (j + 1).ToString();
                        string sst  = sn + ". " + fSourceList[j];
                        string sanc = "src_" + sn;

                        fWriter.AddParagraphAnchor(sst, fTextFont, sanc);
                    }
                }
            } finally {
                fSourceList.Dispose();
                fPersonList.Dispose();
            }
        }
예제 #12
0
        private void WriteExcessFmt(PedigreePerson person)
        {
            fWriter.AddParagraph(LangMan.LS(LSID.LSID_Sex) + ": " + GKUtils.SexStr(person.IRec.Sex), fTextFont);

            string st = GKUtils.GetLifeExpectancyStr(person.IRec);

            if (st != "?" && st != "")
            {
                fWriter.AddParagraph(LangMan.LS(LSID.LSID_LifeExpectancy) + ": " + st, fTextFont);
            }

            GDMIndividualRecord father, mother;

            fTree.GetParents(person.IRec, out father, out mother);

            if (father != null)
            {
                fWriter.AddParagraphLink(LangMan.LS(LSID.LSID_Father) + ": " + GKUtils.GetNameString(father, true, false) + " ", fTextFont, idLink(father), fLinkFont);
            }

            if (mother != null)
            {
                fWriter.AddParagraphLink(LangMan.LS(LSID.LSID_Mother) + ": " + GKUtils.GetNameString(mother, true, false) + " ", fTextFont, idLink(mother), fLinkFont);
            }

            var evList = new ExtList <PedigreeEvent>(true);

            try {
                int i;
                if (person.IRec.Events.Count > 0)
                {
                    fWriter.AddParagraph(LangMan.LS(LSID.LSID_Events) + ":", fTextFont);

                    int num = person.IRec.Events.Count;
                    for (i = 0; i < num; i++)
                    {
                        GDMCustomEvent evt = person.IRec.Events[i];
                        if (!(evt is GDMIndividualAttribute) || fOptions.PedigreeOptions.IncludeAttributes)
                        {
                            evList.Add(new PedigreeEvent(person.IRec, evt));
                        }
                    }
                    WriteEventList(person, evList);
                }

                int num2 = person.IRec.SpouseToFamilyLinks.Count;
                for (i = 0; i < num2; i++)
                {
                    GDMFamilyRecord family = fTree.GetPtrValue(person.IRec.SpouseToFamilyLinks[i]);
                    if (!fBase.Context.IsRecordAccess(family.Restriction))
                    {
                        continue;
                    }

                    GDMIndividualRecord spRec;
                    string unk;
                    if (person.IRec.Sex == GDMSex.svMale)
                    {
                        spRec = fTree.GetPtrValue(family.Wife);
                        st    = LangMan.LS(LSID.LSID_Wife) + ": ";
                        unk   = LangMan.LS(LSID.LSID_UnkFemale);
                    }
                    else
                    {
                        spRec = fTree.GetPtrValue(family.Husband);
                        st    = LangMan.LS(LSID.LSID_Husband) + ": ";
                        unk   = LangMan.LS(LSID.LSID_UnkMale);
                    }

                    string sps;
                    if (spRec != null)
                    {
                        sps = st + GKUtils.GetNameString(spRec, true, false) + GKUtils.GetPedigreeLifeStr(spRec, fOptions.PedigreeOptions.Format) /* + this.idLink(this.FindPerson(irec))*/;
                    }
                    else
                    {
                        sps = st + unk;
                    }

                    fWriter.AddParagraph(sps, fTextFont);

                    evList.Clear();
                    int childrenCount = family.Children.Count;
                    for (int j = 0; j < childrenCount; j++)
                    {
                        GDMIndividualRecord child = fTree.GetPtrValue(family.Children[j]);
                        evList.Add(new PedigreeEvent(child, child.FindEvent(GEDCOMTagType.BIRT)));
                    }
                    WriteEventList(person, evList);
                }
            } finally {
                evList.Dispose();
            }

            if (fOptions.PedigreeOptions.IncludeNotes && person.IRec.Notes.Count != 0)
            {
                fWriter.AddParagraph(LangMan.LS(LSID.LSID_RPNotes) + ":", fTextFont);

                fWriter.BeginList();

                int notesCount = person.IRec.Notes.Count;
                for (int i = 0; i < notesCount; i++)
                {
                    GDMLines noteLines = fTree.GetNoteLines(person.IRec.Notes[i]);
                    fWriter.AddListItem(" " + GKUtils.MergeStrings(noteLines), fTextFont);
                }

                fWriter.EndList();
            }
        }
예제 #13
0
        private void UpdateEquipmentLists()
        {
            try {
                fPackList.Items.Clear();
                fEquipList.Items.Clear();
                fOutList.Items.Clear();

                bool    onlyIcons = GlobalVars.nwrWin.InventoryOnlyIcons;
                Player  player    = GlobalVars.nwrGame.Player;
                NWField fld       = player.CurrentField;
                bool    blindness = player.Blindness;

                int debt = 0;
                fMode = IWMODE_GROUND;
                if (Collocutor != null)
                {
                    debt = player.GetDebt(Collocutor.Name);
                    if (Collocutor.IsTrader)
                    {
                        Building house = (Building)Collocutor.FindHouse();

                        if (house.Area.Contains(player.PosX, player.PosY))
                        {
                            fMode = IWMODE_INSHOP;
                        }
                        else
                        {
                            fMode = IWMODE_TRADER;
                        }
                    }
                    else
                    {
                        if (Collocutor.Mercenary)
                        {
                            fMode = IWMODE_MERCENARY;
                        }
                    }
                }

                fPayBtn.Enabled = (fMode != IWMODE_GROUND && debt != 0);

                switch (fMode)
                {
                case IWMODE_GROUND:
                {
                    EntityList items = player.Items;

                    int num5 = items.Count;
                    for (int i = 0; i < num5; i++)
                    {
                        Item item = (Item)items.GetItem(i);
                        if (!item.Identified && player.Memory.Find(item.Entry.Sign) != null)
                        {
                            item.Identified = true;
                        }

                        if (item.Equipment && item.InUse && fContainer == null)
                        {
                            AddListItem(fEquipList, item.GetName(blindness), item, onlyIcons);
                        }
                        else
                        {
                            AddListItem(fPackList, item.GetName(blindness), item, onlyIcons);
                        }
                    }

                    ExtList <LocatedEntity> groundItems = fld.Items.SearchListByPos(player.PosX, player.PosY);

                    int num6 = groundItems.Count;
                    for (int i = 0; i < num6; i++)
                    {
                        Item item = (Item)groundItems[i];
                        if (!item.Identified && player.Memory.Find(item.Entry.Sign) != null)
                        {
                            item.Identified = true;
                        }
                        AddListItem(fOutList, item.GetName(blindness), item, onlyIcons);
                    }
                    groundItems.Dispose();
                }
                break;

                case IWMODE_TRADER:
                case IWMODE_INSHOP:
                {
                    EntityList items = player.Items;

                    int num3 = items.Count;
                    for (int i = 0; i < num3; i++)
                    {
                        Item item = (Item)items.GetItem(i);
                        if (!item.Identified && player.Memory.Find(item.Entry.Sign) != null)
                        {
                            item.Identified = true;
                        }

                        if (item.Equipment && item.InUse && fContainer == null)
                        {
                            AddListItem(fEquipList, item.GetName(blindness), item, onlyIcons);
                        }
                        else
                        {
                            if (item.Ware)
                            {
                                AddListItem(fPackList, item.GetName(blindness) + " (" + Convert.ToString((int)item.GetTradePrice(Collocutor, player)) + "$)", item, onlyIcons);
                            }
                            else
                            {
                                AddListItem(fPackList, item.GetName(blindness), item, onlyIcons);
                            }
                        }
                    }

                    Building house = fld.FindBuilding(player.PosX, player.PosY);
                    if (house != null)
                    {
                        if (debt > 0)
                        {
                            house.SwitchDoors(DoorState.Closed);
                        }
                        else
                        {
                            house.SwitchDoors(DoorState.Opened);
                        }
                        ExtList <LocatedEntity> groundItems = fld.Items.SearchListByArea(house.Area);

                        int num4 = groundItems.Count;
                        for (int i = 0; i < num4; i++)
                        {
                            Item item = (Item)groundItems[i];
                            item.Identified = true;
                            AddListItem(fOutList, item.GetName(blindness) + " (" + Convert.ToString((int)item.GetTradePrice(player, Collocutor)) + "$)", item, onlyIcons);
                        }

                        groundItems.Dispose();
                    }
                }
                break;

                case IWMODE_MERCENARY:
                {
                    EntityList items = player.Items;

                    int num = items.Count;
                    for (int i = 0; i < num; i++)
                    {
                        Item item = (Item)items.GetItem(i);
                        if (!item.Identified && player.Memory.Find(item.Entry.Sign) != null)
                        {
                            item.Identified = true;
                        }
                        if (item.Equipment && item.InUse && fContainer == null)
                        {
                            AddListItem(fEquipList, item.GetName(blindness), item, onlyIcons);
                        }
                        else
                        {
                            if (item.Ware)
                            {
                                AddListItem(fPackList, item.GetName(blindness) + " (" + Convert.ToString(item.Price) + "$)", item, onlyIcons);
                            }
                            else
                            {
                                AddListItem(fPackList, item.GetName(blindness), item, onlyIcons);
                            }
                        }
                    }
                    items = Collocutor.Items;

                    int num2 = items.Count;
                    for (int i = 0; i < num2; i++)
                    {
                        Item item = (Item)items.GetItem(i);
                        AddListItem(fOutList, item.GetName(blindness) + " (" + Convert.ToString(item.Price) + "$)", item, onlyIcons);
                    }
                }
                break;
                }

                if (fContainer != null)
                {
                    EntityList items = fContainer.Contents;

                    int num7 = items.Count;
                    for (int i = 0; i < num7; i++)
                    {
                        Item item = (Item)items.GetItem(i);
                        if (!item.Identified && player.Memory.Find(item.Entry.Sign) != null)
                        {
                            item.Identified = true;
                        }
                        AddListItem(fEquipList, item.GetName(blindness), item, onlyIcons);
                    }
                }
            } catch (Exception ex) {
                Logger.Write("InventoryWindow.updateEquipmentLists(): " + ex.Message);
                throw ex;
            }
        }