Ejemplo n.º 1
0
        public static string GetFormattedString(ResourceID name, params object[] args)
        {
            Exception exception = null;

            try
            {
                string format = staticResourceManager.GetString(name.ToString(), CultureInfo.CurrentUICulture);
                return((format != null) ? string.Format(CultureInfo.CurrentUICulture, format, args) : name.ToString());
            }
            catch (InvalidOperationException exception2)
            {
                exception = exception2;
            }
            catch (MissingManifestResourceException exception3)
            {
                exception = exception3;
            }
            catch (FormatException exception4)
            {
                exception = exception4;
            }
            if (exception == null)
            {
                return(name.ToString());
            }
            StringBuilder builder = new StringBuilder();

            builder.Append(name.ToString());
            foreach (object obj2 in ArrayList.Adapter(args))
            {
                builder.Append(" ");
                builder.Append(obj2.ToString());
            }
            return(builder.ToString());
        }
Ejemplo n.º 2
0
        public void Process(ResourceID id)
        {
            reader = Burntime.Platform.IO.FileSystem.GetFile(id.File).GetSubFile(0, -1);

            charInfo = new Dictionary <char, CharInfo>();

            chars = new CharInfo[98];
            for (int i = 0; i < 98; i++)
            {
                chars[i].pos   = reader.ReadUShort();
                chars[i].width = reader.ReadUShort();

                charInfo.Add((char)(' ' + i), chars[i]);
            }

            for (int i = 0; i < 98; i++)
            {
                reader.Seek(chars[i].pos, Burntime.Platform.IO.SeekPosition.Begin);

                int unknown1 = reader.ReadUShort();
                int unknown2 = reader.ReadUShort();

                chars[i].imgWidth  = 4 * (unknown1 + 1);
                chars[i].imgHeight = unknown2;
            }
        }
Ejemplo n.º 3
0
 public RawImageResource(PsdBinaryReader reader, string signature, ResourceID resourceId,
                         string name, int numBytes) : base(name)
 {
     this.Signature = signature;
     this.id        = resourceId;
     Data           = reader.ReadBytes(numBytes);
 }
Ejemplo n.º 4
0
    public static ResourceID Make(params object[] parts)
    {
        string     idStr = StringUtils.ConnectToStringWithSeparator(SEPARATOR, parts);
        ResourceID resID = _cachedResID[idStr];

        if (resID == null)
        {
            resID       = new ResourceID();
            resID.parts = new List <object>();
            resID.IDStr = idStr;
            string[] splits = resID.IDStr.Split('/');
            for (int i = 0; i < splits.Length; i++)
            {
                int id;
                if (int.TryParse(splits[i], out id))
                {
                    resID.parts.Add(id);
                }
                else
                {
                    resID.parts.Add(splits[i]);
                }
            }
            _cachedResID[idStr] = resID;
        }
        return(resID);
    }
Ejemplo n.º 5
0
        public void Process(ResourceID ID)
        {
            if (ID.EndIndex == -1)
            {
                frameCount = 1;
            }
            else
            {
                frameCount = ID.EndIndex - ID.Index + 1;
            }

            frameOffset = ID.Index;
            progressive = ID.Custom == "p";

            File file = FileSystem.GetFile(ID.File);

            raw = new RawImageFileReader(file);
            raw.ReadHeader();

            if (!ID.IndexProvided)
            {
                frameCount = raw.ImageCount;
            }

            size = new Vector2();

            lastFrame = null;
        }
Ejemplo n.º 6
0
            public string[] ToArray(string statsBasedOn)
            {
                List <string> list = new List <string>
                {
                    ResourceID.ToString(),
                              ProcessTechID.ToString(),
                              LabID.ToString(),
                              ResourceName,
                              ProcessTechName
                };

                switch (statsBasedOn)
                {
                case "charged":
                    list.AddRange(Activities.Select(x => x.ChargeDuration.ToString("#0.000")).ToArray());
                    break;

                case "scheduled":
                    list.AddRange(Activities.Select(x => x.SchedDuration.ToString("#0.000")).ToArray());
                    break;

                case "actual":
                    list.AddRange(Activities.Select(x => x.ActDuration.ToString("#0.000")).ToArray());
                    break;
                }

                list.Add(GetTotal(statsBasedOn).ToString("#0.000"));

                return(list.ToArray());
            }
Ejemplo n.º 7
0
        public DataObject Process(ResourceID id, ResourceManager resourceManager)
        {
            ConfigFile file = new ConfigFile();

            file.Open(id.File);
            return(new Constructions(file));
        }
Ejemplo n.º 8
0
 internal Sprite(ResourceManager ResMan, String ID, SpriteFrame Frame)
 {
     id                = ID;
     internalFrames    = new SpriteFrame[1];
     internalFrames[0] = Frame;
     resMan            = ResMan;
 }
Ejemplo n.º 9
0
        public DataObject Process(ResourceID ID, ResourceManager ResourceManager)
        {
            File file = FileSystem.GetFile(ID.File);

            file.Seek(ID.Index * (16 + 32 * 32), SeekPosition.Begin);
            Tile tile = new Tile(file, 0);

            TileMaskData data = new TileMaskData();
            data.Mask = new bool[16];
            data.DataName = ID;

            bool mask = false;
            bool nomask = false;

            int value = tile.Mask;
            for (int i = 0; i < 16; i++, value >>= 1)
            {
                data.Mask[15 - i] = (value & 1) == 0;
                mask |= data.Mask[15 - i];
                nomask |= !data.Mask[15 - i];
            }

            if (mask && nomask)
                data.Type = TileMaskType.Complex;
            else
            {
                data.Type = mask ? TileMaskType.Simple : TileMaskType.None;
            }

            return data;
        }
Ejemplo n.º 10
0
 internal Sprite(ResourceManager resMan, String id, SpriteFrame[] frames, SpriteAnimation animation)
 {
     this.id        = id;
     internalFrames = frames;
     this.resMan    = resMan;
     ani            = animation;
 }
Ejemplo n.º 11
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(ResourceID.GetHashCode() * 397);
     }
 }
Ejemplo n.º 12
0
        public DataObject Process(ResourceID id, ResourceManager resourceManager)
        {
            Danger danger;

            int value = 0;

            if (!int.TryParse(id.Custom, out value))
            {
                Burntime.Platform.Log.Warning("DangerProcessor: custom parameter is not an integer.");
            }

            switch (id.File)
            {
            case "radiation":
                danger = new Danger(id.File, value, resourceManager.GetString("burn?408"), resourceManager.GetImage("inf.ani?3"));
                break;

            case "gas":
                danger = new Danger(id.File, value, resourceManager.GetString("burn?413"), resourceManager.GetImage("inf.ani?7"));
                break;

            default:
                throw new Burntime.Framework.BurntimeLogicException();
            }

            return(danger);
        }
Ejemplo n.º 13
0
        public DataObject Process(ResourceID ID, ResourceManager ResourceManager)
        {
            IDataProcessor processor = ResourceManager.GetDataProcessor("burngfxmap");
            MapData        data      = processor.Process(ID, ResourceManager) as MapData;

            return(data);
        }
Ejemplo n.º 14
0
            public DataObject Process(ResourceID id, ResourceManager resourceManager)
            {
                ConfigFile file = new ConfigFile();

                file.Open(id.File);

                return(new ItemTypesData(file, resourceManager));
            }
Ejemplo n.º 15
0
 /// <summary>
 /// Checks if the object is using the same resource id,
 /// if true set it to no ressource selected.
 /// This is used to update ImageObjects when deleting a resource file.
 /// </summary>
 /// <param name="resID">The resource id to check for.</param>
 public void CheckResource(string resID)
 {
     if (ResourceID.Equals(resID))
     {
         ResourceID = Resources.resourceList[0];
         RenderObject();
     }
 }
 public RawImageResource(PsdBinaryReader reader, string signature, 
   ResourceID resourceId, string name, int numBytes)
   : base(name)
 {
   this.Signature = signature;
   this.id = resourceId;
   Data = reader.ReadBytes(numBytes);
 }
Ejemplo n.º 17
0
 public static int ResourceIDToImageIndex(ResourceID id)
 {
     switch (id)
     {
     case ResourceID.FOLDER:
         return(1);
     }
     return(0);
 }
        public override int WriteTo(byte[] Buffer, int StartIndex = 0)
        {
            int cursor = StartIndex;

            cursor += base.WriteTo(Buffer, cursor);
            cursor += ResourceID.WriteTo(Buffer, cursor);

            return(cursor - StartIndex);
        }
Ejemplo n.º 19
0
 //[MenuItem("AssetBundle/LuaPathIDGenerate", false, 0)]
 public static void LuaPathIDGenerate()
 {
     if (!Directory.Exists(ResourceID.holderAssetPath))
     {
         Directory.CreateDirectory(ResourceID.holderAssetPath);
     }
     ResourceID.MakeAndReadFromResource();
     AssetDatabase.Refresh();
 }
Ejemplo n.º 20
0
    /// <summary>
    /// 获取资源
    /// </summary>
    /// <param name="resName">资源ID</param>
    /// <returns></returns>
    public Object GetAsset(ResourceID resName)
    {
        var assetInfo = GetAssetInfo(resName);

        if (assetInfo != null)
        {
            return(assetInfo.asset);
        }
        return(null);
    }
        public DataObject Process(ResourceID id, ResourceManager resourceManager)
        {
            int value = 0;

            if (!int.TryParse(id.Custom, out value))
            {
                Burntime.Platform.Log.Warning("DangerProtectionProcessor: custom parameter is not an integer.");
            }

            return(new DangerProtection(id.File.ToLower(), value * 0.01f));
        }
Ejemplo n.º 22
0
 /// <summary>
 /// Serves as a hash function for a particular type.
 /// </summary>
 /// <returns>
 /// A hash code for the current <see cref="T:System.Object"/>.
 /// </returns>
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (int)WorkSurfaceContext;
         hashCode = (hashCode * 397) ^ ServerID.GetHashCode();
         hashCode = (hashCode * 397) ^ ResourceID.GetHashCode();
         hashCode = (hashCode * 397) ^ EnvironmentID.GetHashCode();
         return(hashCode);
     }
 }
Ejemplo n.º 23
0
 /// <summary>
 /// GetHashCode
 /// </summary>
 /// <returns></returns>
 public override int GetHashCode()
 {
     unchecked
     {
         int result = 17;
         result = result * 23 + ResourceID.GetHashCode();
         result = result * 23 + ((Value != null) ? Value.GetHashCode() : 0);
         result = result * 23 + ((Name != null) ? Name.GetHashCode() : 0);
         return(result);
     }
 }
Ejemplo n.º 24
0
 /// <summary>
 /// Indicates whether the current object is equal to another object of the same type.
 /// </summary>
 /// <returns>
 /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
 /// </returns>
 /// <param name="other">An object to compare with this object.</param>
 public bool Equals(IResource other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(ResourceID.Equals(other.ResourceID)); //&& Version.Equals(other.Version);
 }
Ejemplo n.º 25
0
 public void CopyTo(Sprite Sprite)
 {
     Sprite.resMan         = resMan;
     Sprite.id             = id;
     Sprite.internalFrames = internalFrames;
     Sprite.LoadType       = LoadType;
     if (ani != null)
     {
         Sprite.ani = new SpriteAnimation(ani.FrameCount);
     }
     Sprite.Resolution = Resolution;
 }
Ejemplo n.º 26
0
 public bool Equals(IResource other)
 {
     if (other is null)
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(ResourceID.Equals(other.ResourceID));
 }
Ejemplo n.º 27
0
 /// <summary>
 /// 获取资源信息
 /// </summary>
 /// <param name="resName">资源ID</param>
 /// <returns></returns>
 private AssetInfo GetAssetInfo(ResourceID resName)
 {
     for (int i = 0; i < _cachedAssets.Count; i++)
     {
         var assetInfo = _cachedAssets[i];
         if (assetInfo.resName == resName)
         {
             return(assetInfo);
         }
     }
     return(null);
 }
Ejemplo n.º 28
0
 /// <summary>
 /// 移除指定资源
 /// </summary>
 /// <param name="resName">资源ID</param>
 public void Remove(ResourceID resName)
 {
     for (int i = 0; i < _cachedAssets.Count; i++)
     {
         var assetInfo = _cachedAssets[i];
         if (assetInfo.resName == resName)
         {
             _cachedAssets.RemoveAt(i);
             break;
         }
     }
 }
Ejemplo n.º 29
0
        public Thumbnail(PsdBinaryReader psdReader, ResourceID id, string name, int numBytes)
            : base(psdReader, "8BIM", id, name, numBytes)
        {
            using (var memoryStream = new MemoryStream(Data))
            {
                using (var reader = new PsdBinaryReader(memoryStream, psdReader))
                {
                    const int HEADER_LENGTH  = 28;
                    var       format         = reader.ReadUInt32();
                    var       width          = reader.ReadUInt32();
                    var       height         = reader.ReadUInt32();
                    var       widthBytes     = reader.ReadUInt32();
                    var       size           = reader.ReadUInt32();
                    var       compressedSize = reader.ReadUInt32();
                    var       bitPerPixel    = reader.ReadUInt16();
                    var       planes         = reader.ReadUInt16();

                    // Raw RGB bitmal
                    if (format == 0)
                    {
                        Image = new Bitmap((int)width, (int)height, PixelFormat.Format24bppRgb);
                    }
                    // JPEG bitmap
                    else if (format == 1)
                    {
                        byte[] imgData = reader.ReadBytes(numBytes - HEADER_LENGTH);
                        using (MemoryStream stream = new MemoryStream(imgData))
                        {
                            var bitmap = new Bitmap(stream);
                            Image = (Bitmap)bitmap.Clone();
                        }

                        // Reverse BGR pixels from old thumbnail format
                        if (id == ResourceID.ThumbnailBgr)
                        {
                            //for(int y=0;y<m_thumbnailImage.Height;y++)
                            //  for (int x = 0; x < m_thumbnailImage.Width; x++)
                            //  {
                            //    Color c=m_thumbnailImage.GetPixel(x,y);
                            //    Color c2=Color.FromArgb(c.B, c.G, c.R);
                            //    m_thumbnailImage.SetPixel(x, y, c);
                            //  }
                        }
                    }
                    else
                    {
                        throw new PsdInvalidException("Unknown thumbnail format.");
                    }
                }
            }
        }
        public override unsafe void ReadFrom(ref byte *Buffer)
        {
            base.ReadFrom(ref Buffer);

            byte len = Buffer[0];

            Buffer++;

            ResourceIDs = new ResourceID[len];
            for (int i = 0; i < len; i++)
            {
                ResourceIDs[i] = new ResourceID(ref Buffer);
            }
        }
Ejemplo n.º 31
0
        public void Process(ResourceID ID)
        {
            file = FileSystem.GetFile(ID.File);
            pos  = ID.Index;

            if (ID.Custom != null)
            {
                map = int.Parse(ID.Custom);
            }
            else
            {
                map = 0;
            }
        }
Ejemplo n.º 32
0
        public Thumbnail(PsdBinaryReader psdReader, ResourceID id, string name, int numBytes)
            : base(psdReader, "8BIM", id, name, numBytes)
        {
            using (var memoryStream = new MemoryStream(Data))
            using (var reader = new PsdBinaryReader(memoryStream, psdReader))
            {
                const int HEADER_LENGTH = 28;
                var format = reader.ReadUInt32();
                var width = reader.ReadUInt32();
                var height = reader.ReadUInt32();
                var widthBytes = reader.ReadUInt32();
                var size = reader.ReadUInt32();
                var compressedSize = reader.ReadUInt32();
                var bitPerPixel = reader.ReadUInt16();
                var planes = reader.ReadUInt16();

                // Raw RGB bitmap
                if (format == 0)
                {
                    Image = new Bitmap((int)width, (int)height, PixelFormat.Format24bppRgb);
                }
                // JPEG bitmap
                else if (format == 1)
                {
                    byte[] imgData = reader.ReadBytes(numBytes - HEADER_LENGTH);
                    using (MemoryStream stream = new MemoryStream(imgData))
                    {
                        var bitmap = new Bitmap(stream);
                        Image = (Bitmap)bitmap.Clone();
                    }

                    // Reverse BGR pixels from old thumbnail format
                    if (id == ResourceID.ThumbnailBgr)
                    {
                        //for(int y=0;y<m_thumbnailImage.Height;y++)
                        //  for (int x = 0; x < m_thumbnailImage.Width; x++)
                        //  {
                        //    Color c=m_thumbnailImage.GetPixel(x,y);
                        //    Color c2=Color.FromArgb(c.B, c.G, c.R);
                        //    m_thumbnailImage.SetPixel(x, y, c);
                        //  }
                    }
                }
                else
                {
                    throw new PsdInvalidException("Unknown thumbnail format.");
                }
            }
        }
Ejemplo n.º 33
0
        /// <summary>
        /// Strong Construction
        /// </summary>
        /// <param name="myGameUI"></param>
        /// <param name="myDepth"></param>
        /// <param name="PositionAbs"></param>
        /// <param name="resImage">Resource of the UI button image</param>
        /// <param name="ClickCommand">Command string passed back in the click event</param>
        public NodeUIButton(GameUI myGameUI, int myDepth, VectorInt PositionAbs, ResourceID resImage, string ClickCommand)
            : base(myGameUI, myDepth)
        {
            imageNormal = myGameUI.ResourceFactory[resImage].DataAsImage;
            imageBack = myGameUI.ResourceFactory[ResourceID.GameButtonBackGround].DataAsImage;
            Size = new SizeInt(imageBack.Size);
            CurrentAbsolute = PositionAbs;
            clickCommand = ClickCommand;

            mouseOverBrush = myGameUI.ResourceFactory[ResourceID.GameButtonMouseOverBrush].DataAsBrush;
            maskEffect = null;
            toolTip = null;

            if (GameUI.Cursor != null)
            {
                GameUI.Cursor.OnClick += new EventHandler<NodeCursorEventArgs>(cursor_OnClick);
            }
        }
Ejemplo n.º 34
0
        public override int ReadFrom(byte[] Buffer, int StartIndex = 0)
        {
            int cursor = StartIndex;

            cursor += base.ReadFrom(Buffer, cursor);

            byte len = Buffer[cursor];
            cursor++;

            ResourceIDs = new ResourceID[len];
            for (int i = 0; i < len; i++)
            {
                ResourceIDs[i] = new ResourceID(Buffer, cursor);
                cursor += ResourceIDs[i].ByteLength;
            }

            return cursor - StartIndex;
        }
Ejemplo n.º 35
0
	void OnResourceGained(ResourceID resource)
	{
		CollectedResources.AddResource(resource, 1);
		UpdateCollectedResourcesGUI();
	}
Ejemplo n.º 36
0
 public Thumbnail(ResourceID id, string name)
     : base(id, name) {
 }
Ejemplo n.º 37
0
 public override void Reset() {
     _resourceID = default(ResourceID);
 }
 public RawImageResource(ResourceID resourceId, string name)
   : base(name)
 {
   this.id = resourceId;
 }
Ejemplo n.º 39
0
 /// <summary>
 /// Strong Contructor. 
 /// Enforce the use of resource for images
 /// </summary>
 /// <param name="myGameUI"></param>
 /// <param name="myDepth"></param>
 /// <param name="resourceImage"></param>
 public NodeEffectImage(GameUI myGameUI, int myDepth, ResourceID resourceImage)
     : base(myGameUI, myDepth)
 {
     this.image = myGameUI.ResourceFactory[resourceImage].DataAsImage;
     this.Size = new SizeInt(image.Width, image.Height);
 }
Ejemplo n.º 40
0
 public static int ResourceIDToImageIndex(ResourceID id)
 {
     switch (id)
     {
         case ResourceID.FOLDER:
             return 1;
     }
     return 0;
 }
Ejemplo n.º 41
0
        public override unsafe void ReadFrom(ref byte* Buffer)
        {
            base.ReadFrom(ref Buffer);

            byte len = Buffer[0];
            Buffer++;

            ResourceIDs = new ResourceID[len];
            for (int i = 0; i < len; i++)
                ResourceIDs[i] = new ResourceID(ref Buffer);
            
        }
Ejemplo n.º 42
0
	public int GetResource(ResourceID resource)
	{
		return resources[(int)resource];
	}
Ejemplo n.º 43
0
 public ResourceHudFormContent(ResourceID resourceID)
     : base(HudFormID.Resource) {
     ResourceID = resourceID;
 }
Ejemplo n.º 44
0
	public void AddResource(ResourceID resource, int addAmount)
	{
		resources[(int)resource] += addAmount;
	}
Ejemplo n.º 45
0
 public StatGroupsMessage(ResourceID[] ResourceIDs) 
     : base(MessageTypeGameMode.StatGroups)
 {
     this.ResourceIDs = ResourceIDs;
 }
Ejemplo n.º 46
0
	public void SetResource(ResourceID resource, int amount)
	{
		resources[(int)resource] = amount;
	}