Example #1
0
        public string[] GetActivityReferenceSummary(IYZDbProvider provider, IDbConnection cn, string propertyName)
        {
            List <string> names        = new List <string>();
            PropertyInfo  propertyInfo = typeof(SpriteProperty).GetProperty(propertyName);

            foreach (Sprite sprite in this)
            {
                ReferenceCollection refs = propertyInfo.GetValue(sprite.Property, null) as ReferenceCollection;
                if (refs == null)
                {
                    continue;
                }

                foreach (Reference @ref in refs)
                {
                    @ref.RefreshName(provider, cn);

                    string name = @ref.SpriteName;
                    if (!names.Contains(name))
                    {
                        names.Add(name);
                    }
                }
            }

            return(names.ToArray());
        }
Example #2
0
        public ReferenceCollection Intersect(SpriteCollection sprites)
        {
            ReferenceCollection rv = new ReferenceCollection();

            foreach (Reference @ref in this)
            {
                if (sprites.Contains(@ref.FileID, @ref.SpriteID))
                {
                    rv.Add(@ref);
                }
            }
            return(rv);
        }
Example #3
0
        public DataTable GetActivityReferenceDetailTable(IYZDbProvider provider, IDbConnection cn, string propertyName, string outputTableName)
        {
            PropertyInfo propertyInfo = typeof(SpriteProperty).GetProperty(propertyName);
            DataTable    table        = new DataTable(outputTableName);

            table.Columns.Add("ProcessID", typeof(string));
            table.Columns.Add("ProcessName", typeof(string));
            table.Columns.Add("ActivityID", typeof(string));
            table.Columns.Add("ActivityName", typeof(string));
            table.Columns.Add("FileID", typeof(string));
            table.Columns.Add("FileName", typeof(string));
            table.Columns.Add("SpriteID", typeof(string));
            table.Columns.Add("SpriteName", typeof(string));
            table.Columns.Add(propertyName, typeof(string));
            table.Columns.Add("Desc", typeof(string));
            table.Columns.Add("DescExt", typeof(string));

            foreach (Sprite sprite in this)
            {
                ReferenceCollection refs = propertyInfo.GetValue(sprite.Property, null) as ReferenceCollection;
                if (refs == null)
                {
                    continue;
                }

                foreach (Reference @ref in refs)
                {
                    if (SpriteCollection.TableContains(table, sprite, @ref))
                    {
                        continue;
                    }

                    File file = File.TryLoad(provider, cn, @ref.FileID);
                    if (file == null)
                    {
                        continue;
                    }

                    Sprite linkedSprite = file.Sprites[@ref.SpriteID];
                    if (linkedSprite == null)
                    {
                        continue;
                    }


                    DataRow row = table.NewRow();
                    table.Rows.Add(row);

                    row["ProcessID"]    = sprite.File.FileID;
                    row["ProcessName"]  = sprite.File.FileName;
                    row["ActivityID"]   = sprite.Id;
                    row["ActivityName"] = sprite.Name;
                    row["FileID"]       = linkedSprite.File.FileID;
                    row["FileName"]     = linkedSprite.File.FileName;
                    row["SpriteID"]     = linkedSprite.Id;
                    row["SpriteName"]   = linkedSprite.Name;
                    row[propertyName]   = linkedSprite.Property.Description;
                    row["Desc"]         = linkedSprite.Property.Description;
                    row["DescExt"]      = String.Format("{0}>{1}:\n{2}",
                                                        linkedSprite.File.FileName,
                                                        linkedSprite.Name,
                                                        linkedSprite.Property.Description
                                                        );
                }
            }

            return(table);
        }