Пример #1
0
        private static ExtList <TreeCell> AddRow(ExtList <ExtList <TreeCell> > table, int rowIndex, int spaces)
        {
            ExtList <TreeCell> result = new ExtList <TreeCell>(true);

            table.Insert(rowIndex, result);
            return(result);
        }
Пример #2
0
        public static ExtList <PatriarchObj> GetPatriarchsLinks(IBaseContext context,
                                                                int gensMin, bool datesCheck,
                                                                bool loneSuppress)
        {
            ExtList <PatriarchObj> patList = GetPatriarchsList(context, gensMin, datesCheck);

            IProgressController progress = AppHost.Progress;

            progress.ProgressInit(LangMan.LS(LSID.LSID_LinksSearch), patList.Count);
            try
            {
                int num2 = patList.Count;
                for (int i = 0; i < num2; i++)
                {
                    PatriarchObj patr = patList[i];

                    for (int j = i + 1; j < num2; j++)
                    {
                        PatriarchObj patr2 = patList[j];

                        GEDCOMIndividualRecord cross = TreeTools.PL_SearchDesc(patr.IRec, patr2.IRec);
                        if (cross != null)
                        {
                            patr.HasLinks  = true;
                            patr2.HasLinks = true;

                            if (cross.Sex == GEDCOMSex.svFemale)
                            {
                                patr.Links.Add(patr2);
                            }
                            else
                            {
                                patr2.Links.Add(patr);
                            }
                        }
                    }

                    progress.ProgressStep();
                }
            }
            finally
            {
                progress.ProgressDone();
            }

            if (loneSuppress)
            {
                for (int i = patList.Count - 1; i >= 0; i--)
                {
                    PatriarchObj patr = patList[i];
                    if (!patr.HasLinks)
                    {
                        patList.Delete(i);
                    }
                }
                patList.Pack();
            }

            return(patList);
        }
Пример #3
0
        public bool BuildFile(CheckedListBox.CheckedItemCollection checkedItems)
        {
            ExtList list = new ExtList();

            _projectOptions.Extensions = list;

            foreach (Ext fileExt in checkedItems)
            {
                list.Add(fileExt);
            }

            if ((_projectFile == null) || "".Equals(_projectTitle) ||
                "".Equals(_basedir) || list.Count == 0)
            {
                return(false);
            }

            _projectOptions.SaveOptions();
            BuildProjectFile();

            FileInfo legacy = ProjectBuildFile;

            if (legacy != null && legacy.Exists)
            {
                legacy.Delete();
            }

            return(true);
        }
Пример #4
0
 public LBItemList(ListBox owner, LBItem parentItem)
 {
     fList       = new ExtList <LBItem>();
     fOwner      = owner;
     fParentItem = parentItem;
     fSorted     = false;
 }
Пример #5
0
 public GKMapBrowser()
 {
     fMapPoints   = new ExtList <GeoPoint>(true);
     fUpdateCount = 0;
     fShowPoints  = true;
     fShowLines   = true;
 }
Пример #6
0
        private void btnPatSearch_Click(object sender, EventArgs e)
        {
            ListPatriarchs.BeginUpdate();
            ExtList <PatriarchObj> lst = null;

            try
            {
                ListPatriarchs.ClearItems();
                lst = PatriarchsMan.GetPatriarchsList(fBase.Context,
                                                      (int)edMinGens.Value, !chkWithoutDates.Checked.GetValueOrDefault());
                lst.QuickSort(PatriarchsCompare);

                int num = lst.Count;
                for (int i = 0; i < num; i++)
                {
                    PatriarchObj pObj  = lst[i];
                    string       pSign = ((pObj.IRec.Patriarch) ? "[*] " : "");

                    ListPatriarchs.AddItem(pObj.IRec, new object[] { pSign + GKUtils.GetNameString(pObj.IRec, true, false),
                                                                     pObj.BirthYear,
                                                                     pObj.DescendantsCount,
                                                                     pObj.DescGenerations });
                }
            }
            finally
            {
                if (lst != null)
                {
                    lst.Dispose();
                }
                ListPatriarchs.EndUpdate();
            }
        }
Пример #7
0
        public static void CopyPoints(IMapBrowser browser, ExtList <GeoPoint> gmapPoints, bool byPerson)
        {
            if (gmapPoints == null)
            {
                throw new ArgumentNullException("gmapPoints");
            }

            browser.BeginUpdate();
            try {
                browser.ClearPoints();

                int num = gmapPoints.Count;
                for (int i = 0; i < num; i++)
                {
                    GeoPoint pt     = gmapPoints[i];
                    string   stHint = pt.Hint;
                    if (byPerson)
                    {
                        stHint = stHint + " [" + pt.Date.ToString() + "]";
                    }

                    browser.AddPoint(pt.Latitude, pt.Longitude, stHint);
                }

                browser.ZoomToBounds();
            } finally {
                browser.EndUpdate();
            }
        }
Пример #8
0
        //Присылается, когда изменился список фигур
        public void RefShapes(int index, ref ExtList <Shape> shapelist)
        {
            lvShapes.Items.Clear();

            for (int i = 0; i < shapelist.Count; i++)
            {
                ListViewItem lvNItem = new ListViewItem(shapelist[i].description);

                if (shapelist[i] is sCross)
                {
                    lvNItem.ImageIndex = 0;
                }
                if (shapelist[i] is sLine)
                {
                    lvNItem.ImageIndex = 1;
                }
                if (shapelist[i] is sCircle)
                {
                    lvNItem.ImageIndex = 2;
                }
                if (shapelist[i] is sRect)
                {
                    lvNItem.ImageIndex = 3;
                }

                lvShapes.Items.Add(lvNItem);
            }
        }
Пример #9
0
        public void Search()
        {
            fView.PatriarchsList.BeginUpdate();
            ExtList <PatriarchObj> lst = null;

            try {
                fView.PatriarchsList.ClearItems();
                lst = PatriarchsMan.GetPatriarchsList(fBase.Context, (int)fView.MinGensNum.Value, !fView.WithoutDatesCheck.Checked);
                lst.QuickSort(PatriarchsCompare);

                int num = lst.Count;
                for (int i = 0; i < num; i++)
                {
                    PatriarchObj pObj  = lst[i];
                    string       pSign = ((pObj.IRec.Patriarch) ? "[*] " : "");

                    fView.PatriarchsList.AddItem(pObj.IRec, new object[] { pSign + GKUtils.GetNameString(pObj.IRec, true, false),
                                                                           pObj.BirthYear, pObj.DescendantsCount, pObj.DescGenerations });
                }
            } finally {
                if (lst != null)
                {
                    lst.Dispose();
                }
                fView.PatriarchsList.EndUpdate();
            }
        }
Пример #10
0
        public void Test_GetPointsFrame()
        {
            CoordsRect coordsRect = PlacesLoader.GetPointsFrame(null);

            Assert.AreEqual(0.0d, coordsRect.MinLon);
            Assert.AreEqual(0.0d, coordsRect.MinLat);
            Assert.AreEqual(0.0d, coordsRect.MaxLon);
            Assert.AreEqual(0.0d, coordsRect.MaxLat);

            ExtList <GeoPoint> mapPoints = new ExtList <GeoPoint>();

            mapPoints.Add(new GeoPoint(11, 13, "pt1"));
            mapPoints.Add(new GeoPoint(22, 25, "pt1"));
            coordsRect = PlacesLoader.GetPointsFrame(mapPoints);
            Assert.AreEqual(13.0d, coordsRect.MinLon);
            Assert.AreEqual(11.0d, coordsRect.MinLat);
            Assert.AreEqual(25.0d, coordsRect.MaxLon);
            Assert.AreEqual(22.0d, coordsRect.MaxLat);

            mapPoints.Clear();
            mapPoints.Add(new GeoPoint(21, 21, "pt1"));
            coordsRect = PlacesLoader.GetPointsFrame(mapPoints);
            Assert.AreEqual(1.0d, coordsRect.MinLon);
            Assert.AreEqual(1.0d, coordsRect.MinLat);
            Assert.AreEqual(41.0d, coordsRect.MaxLon);
            Assert.AreEqual(41.0d, coordsRect.MaxLat);
        }
Пример #11
0
        public static ExtList <PatriarchObj> GetPatriarchsList(IBaseContext context,
                                                               int gensMin, bool datesCheck)
        {
            ExtList <PatriarchObj> patList = new ExtList <PatriarchObj>(true);

            IProgressController progress = AppHost.Progress;

            progress.ProgressInit(LangMan.LS(LSID.LSID_PatSearch), context.Tree.RecordsCount);

            GKUtils.InitExtCounts(context.Tree, -1);
            try
            {
                int num = context.Tree.RecordsCount;
                for (int i = 0; i < num; i++)
                {
                    GEDCOMRecord rec = context.Tree[i];

                    if (rec is GEDCOMIndividualRecord)
                    {
                        GEDCOMIndividualRecord iRec = rec as GEDCOMIndividualRecord;

                        var parts = GKUtils.GetNameParts(iRec);

                        int birthDate = context.FindBirthYear(iRec);
                        int descGens  = GKUtils.GetDescGenerations(iRec);

                        bool res = (iRec.ChildToFamilyLinks.Count == 0);
                        res = (res && iRec.Sex == GEDCOMSex.svMale);
                        res = (res && /*nf != "" && nf != "?" &&*/ parts.Name != "" && parts.Name != "?");
                        res = (res && descGens >= gensMin);

                        if (datesCheck)
                        {
                            res = (res && birthDate != 0);
                        }

                        if (res)
                        {
                            PatriarchObj pObj = new PatriarchObj();
                            pObj.IRec             = iRec;
                            pObj.BirthYear        = birthDate;
                            pObj.DescendantsCount = GKUtils.GetDescendantsCount(iRec) - 1;
                            pObj.DescGenerations  = descGens;
                            patList.Add(pObj);
                        }
                    }

                    progress.ProgressStep();
                }
            }
            finally
            {
                progress.ProgressDone();
            }

            return(patList);
        }
Пример #12
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         fList.Dispose();
         fList = null;
     }
     base.Dispose(disposing);
 }
Пример #13
0
        public GKMapBrowser()
        {
            BrowserContextMenuEnabled = false;

            fMapPoints   = new ExtList <GeoPoint>(true);
            fUpdateCount = 0;
            fShowPoints  = true;
            fShowLines   = true;
        }
Пример #14
0
        public void Test_AddPoint()
        {
            var gmapPoints = new ExtList <GeoPoint>();

            PlacesLoader.AddPoint(gmapPoints, new GeoPoint(0, 0, "test"), new PlaceRef(null, null));
            Assert.AreEqual(1, gmapPoints.Count);

            PlacesLoader.AddPoint(gmapPoints, new GeoPoint(0, 0, "test"), new PlaceRef(null, null));
            Assert.AreEqual(1, gmapPoints.Count); // duplicate will be excluded
        }
Пример #15
0
        public bool IsStickPlatform(string layer)
        {
            int isForbidden = ExtList.ContainSubStringInArray(stickPlatform, layer);

            if (isForbidden != -1)
            {
                return(true);
            }
            return(false);
        }
Пример #16
0
        public bool IsFastForwardLayer(int layer)
        {
            int isFastForward = ExtList.ContainSubStringInArray(fastForwardPlatform, LayerMask.LayerToName(layer));

            if (isFastForward != -1)
            {
                return(true);
            }
            return(false);
        }
Пример #17
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();
            }
        }
Пример #18
0
 private void WideTable(ExtList <ExtList <TreeCell> > table, int cols)
 {
     for (int i = 0; i < table.Count; i++)
     {
         var row = table[i];
         while (row.Count < cols)
         {
             AddCell(row, null, CellKind.ckSpace);
         }
     }
 }
Пример #19
0
        public void Test_CopyPoints()
        {
            var mapBrowser = Substitute.For <IMapBrowser>();

            Assert.Throws(typeof(ArgumentNullException), () => { PlacesLoader.CopyPoints(mapBrowser, null, true); });

            var gmapPoints = new ExtList <GeoPoint>();

            gmapPoints.Add(new GeoPoint(0, 0, "test"));
            PlacesLoader.CopyPoints(mapBrowser, gmapPoints, true);
        }
Пример #20
0
        public bool IsForbidenLayerSwitch(string layer)
        {
            int isForbidden = ExtList.ContainSubStringInArray(walkForbiddenForwardUp, layer);

            if (isForbidden != -1)
            {
                //here we are in front of a forbidden wall !!
                return(true);
            }
            return(false);
        }
Пример #21
0
 private void OnTriggerExit(Collider other)
 {
     if (ExtList.ListContain <GameData.Tags>(tagList, other.tag))
     {
         TriggerController entityNoGravity = other.gameObject.GetComponent <TriggerController>();
         if (entityNoGravity)
         {
             entityNoGravity.entityTriggerManager.entityNoGravity.LeanInZone(this);
         }
     }
 }
Пример #22
0
        public static CoordsRect GetPointsFrame(ExtList <GeoPoint> mapPoints)
        {
            CoordsRect result = new CoordsRect();

            if (mapPoints == null || mapPoints.Count <= 0)
            {
                return(result);
            }

            GeoPoint pt = mapPoints[0];

            result.MinLon = pt.Longitude;
            result.MaxLon = pt.Longitude;
            result.MinLat = pt.Latitude;
            result.MaxLat = pt.Latitude;

            if (mapPoints.Count == 1)
            {
                result.MinLon = (result.MinLon - 20.0);
                result.MaxLon = (result.MaxLon + 20.0);
                result.MinLat = (result.MinLat - 20.0);
                result.MaxLat = (result.MaxLat + 20.0);
            }
            else
            {
                int num = mapPoints.Count;
                for (int i = 0; i < num; i++)
                {
                    pt = mapPoints[i];

                    if (result.MinLon > pt.Longitude)
                    {
                        result.MinLon = pt.Longitude;
                    }
                    else if (result.MaxLon < pt.Longitude)
                    {
                        result.MaxLon = pt.Longitude;
                    }

                    if (result.MinLat > pt.Latitude)
                    {
                        result.MinLat = pt.Latitude;
                    }
                    else if (result.MaxLat < pt.Latitude)
                    {
                        result.MaxLat = pt.Latitude;
                    }
                }
            }

            return(result);
        }
Пример #23
0
 /// <summary>
 /// Append all Transform found in this scene into _gameObjectsList list
 /// </summary>
 /// <param name="scene"></param>
 public void AppendAllTransformInSceneToList(Scene scene)
 {
     if (!scene.IsValid())
     {
         return;
     }
     GameObject[] roots = scene.GetRootGameObjects();
     for (int i = 0; i < roots.Length; i++)
     {
         Transform[] allChilds = roots[i].GetComponentsInChildren <Transform>(true);
         ExtList.Append <Transform>(_gameObjectsList, allChilds.ToList());
     }
 }
Пример #24
0
        public LeaderBrain(NWCreature owner) : base(owner)
        {
            fDir      = Directions.DtNone;
            fList     = new ExtList <NWCreature>();
            Formation = PartyFormation.pfWedge;
            AddMember(owner);

            fOffsets = new PMPos[PartyMax + 1];
            for (int i = 0; i <= PartyMax; i++)
            {
                fOffsets[i] = new PMPos();
            }
        }
Пример #25
0
        private void PreparePatriarchs()
        {
            using (ExtList <PatriarchObj> lst = PatriarchsMan.GetPatriarchsList(fBase.Context, 2, false))
            {
                lst.QuickSort(PatriarchsCompare);

                int num = lst.Count;
                for (int i = 0; i < num; i++)
                {
                    PatriarchObj pObj = lst[i];
                    fPatList.AddObject(GKUtils.GetNameString(pObj.IRec, true, false), pObj.IRec);
                }
            }
        }
Пример #26
0
        private static TreeCell AddCell(ExtList <TreeCell> row, GEDCOMIndividualRecord iRec, CellKind cellKind)
        {
            TreeCell result = new TreeCell();

            result.ColIndex = row.Add(result);
            result.Kind     = cellKind;
            result.Rec      = iRec;
            result.Row      = row;
            if (iRec != null)
            {
                result.Name = iRec.GetPrimaryFullName();
            }
            return(result);
        }
Пример #27
0
        //констуктор
        public Editor(int x, int y, ref PictureBox canvas, int index)
        {
            real_w = x;
            real_h = y;

            cnv = canvas;
            RedefineXY(x, y);

            shapelist = new ExtList <Shape>();
            shapelist.BeforeChanged += new ChangedEventHandler(shapelist_BeforeChanged);
            shapelist.AfterChanged  += new ChangedEventHandler(shapelist_AfterChanged);

            shapelist_modificated_private = false;
            cur_fname      = "";
            internal_index = index;
        }
        private static ContextListerAsset GenerateContextReferencer()
        {
            ContextListerAsset globalContextLister = ExtScriptableObject.CreateAsset <ContextListerAsset>("Assets/Context Lister.asset");
            SceneContextAsset  context             = ExtScriptableObject.CreateAsset <SceneContextAsset>("Assets/Context 1.asset");

            context.NameContext = "Demo Scene List";
            SceneReference[] sceneItems = SceneReference.GetAllActiveScene();
            ExtList.Append(context.SceneToLoad, sceneItems.ToList());
            globalContextLister.AddContext(context);

            globalContextLister.Save();
            context.Save();
            AssetDatabase.Refresh();

            return(globalContextLister);
        }
Пример #29
0
        //констуктор
        public Editor(int x, int y, ref PictureBox canvas, int index)
        {
            real_w = x;
            real_h = y;

            cnv = canvas;
            RedefineXY(x, y);

            shapelist = new ExtList<Shape>();
            shapelist.BeforeChanged += new ChangedEventHandler(shapelist_BeforeChanged);
            shapelist.AfterChanged += new ChangedEventHandler(shapelist_AfterChanged);

            shapelist_modificated_private = false;
            cur_fname = "";
            internal_index = index;
        }
Пример #30
0
        public void CreateArborGraph(IBaseWindow baseWin, int minGens, bool loneSuppress)
        {
            fBase = baseWin;

            try
            {
                fSys = new ArborSystem(1000, 1000, 0.1, null); //(10000, 1000, 0.1, this);
                fSys.setScreenSize(50, 50);
                fSys.OnStop += OnArborStop;

                using (ExtList <PatriarchObj> patList = PatriarchsMan.GetPatriarchsLinks(
                           baseWin.Context, minGens, false, loneSuppress))
                {
                    int num = patList.Count;
                    for (int i = 0; i < num; i++)
                    {
                        PatriarchObj pObj = patList[i];

                        if (!loneSuppress || pObj.HasLinks)
                        {
                            ArborNode node = fSys.addNode(pObj.IRec.XRef);
                            node.Data = pObj;
                        }
                    }

                    for (int i = 0; i < num; i++)
                    {
                        PatriarchObj pat1 = patList[i];

                        foreach (PatriarchObj pat2 in pat1.Links)
                        {
                            fSys.addEdge(pat1.IRec.XRef, pat2.IRec.XRef);
                        }
                    }
                }

                z = -50;

                fSys.start();
            }
            catch (Exception ex)
            {
                Logger.LogWrite("TreeVizControl.CreateArborGraph(): " + ex.Message);
            }
        }
Пример #31
0
        public static void AddPoint(ExtList <GeoPoint> mapPoints, GeoPoint gmPt, PlaceRef placeRef)
        {
            GeoPoint pt;
            int      num = mapPoints.Count;

            for (int i = 0; i < num; i++)
            {
                pt = mapPoints[i];
                if (pt.Hint == gmPt.Hint)
                {
                    return;
                }
            }

            pt      = new GeoPoint(gmPt.Latitude, gmPt.Longitude, gmPt.Hint);
            pt.Date = placeRef.Date;
            mapPoints.Add(pt);
        }
Пример #32
0
		/// <summary>
		/// Create the specified store.
		/// </summary>
		/// <param name="store">The store.</param>
		/// <returns></returns>
		public new static DictWrapper _( ExtList< Item > store ) {
			var temp = new DictWrapper { DictStore = store };
			return temp;
		}
Пример #33
0
		public static void Initializate( ExtList< Item > list ) {
			var xs = new XmlSerializer( typeof ( ExtList< Item > ) );

			var path = Path.Combine( DefaultApplicationPath , DefaultRepositoryFileName );

			TextWriter writer = new StreamWriter( path );

			using ( var scope = new TransactionScope() ) {
				xs.Serialize( writer , list );

				scope.Complete();
			}
		}
Пример #34
0
 public ExtSection(string name, ExtList<ExtEntry> entries)
 {
     Name = name;
     Entries = entries;
 }
Пример #35
0
		/// <summary>
		/// Create a instance with the specified store.
		/// </summary>
		/// <param name="store">The store.</param>
		/// <returns></returns>
		public static Maintenance _( ExtList< Item > store ) {
			var instance = new Maintenance { DictStore = store };

			return instance;
		}
Пример #36
0
		/// <summary>
		/// Persistents the specified list.
		/// </summary>
		/// <param name="list">The list.</param>
		public void Persistent( ExtList< Item > list ) {
			Persistent( list , Path.Combine( DefaultApplicationPath , DefaultRepositoryFileName ) );
		}
Пример #37
0
        //Присылается, когда изменился список фигур
        public void RefShapes(int index, ref ExtList<Shape> shapelist)
        {
            lvShapes.Items.Clear();

            for(int i =0; i < shapelist.Count; i++)
            {
                ListViewItem lvNItem = new ListViewItem(shapelist[i].description);

                if (shapelist[i] is sCross) lvNItem.ImageIndex = 0;
                if (shapelist[i] is sLine) lvNItem.ImageIndex = 1;
                if (shapelist[i] is sCircle) lvNItem.ImageIndex = 2;
                if (shapelist[i] is sRect) lvNItem.ImageIndex = 3;

                lvShapes.Items.Add(lvNItem);
            }
        }
Пример #38
0
 public App(ExtList<ExtSection> sections, string[] args)
     : base(sections)
 {
     this.args = args;
 }
Пример #39
0
		/// <summary>
		/// Persistents the specified list.
		/// </summary>
		/// <param name="list">The list.</param>
		/// <param name="filePath">The file path.</param>
		public void Persistent( ExtList< Item > list , String filePath ) {
			if ( String.IsNullOrEmpty( filePath ) )
				filePath = Path.Combine( DefaultApplicationPath , DefaultRepositoryFileName );

			var xs = new XmlSerializer( typeof ( ExtList< Item > ) );

			using ( var scope = new TransactionScope() )
			using ( TextWriter writer = new StreamWriter( filePath ) ) {
				xs.Serialize( writer , list );

				scope.Complete();
			}

			Reload();
		}