コード例 #1
0
        internal void SaveImages(List <string> imagePathList)
        {
            foreach (string imagePath in imagePathList)
            {
                if (blpRB.Checked)
                {
                    DHMpqFile image = DHRC.GetImageFile(imagePath);
                    if (!image.IsNull)
                    {
                        image.ToFile(GetProperPath(imagePath));
                    }
                }
                else
                {
                    Bitmap image = DHRC.GetImage(imagePath);

                    if (image != null)
                    {
                        image.Save(GetProperPath(Path.ChangeExtension(imagePath, ".png")));
                    }
                }
            }
        }
コード例 #2
0
        internal void PrepareCreepsList()
        {
            DHMpqFile    jScript = DHRC.GetFile(MpqPath.Script.Custom);
            MemoryStream ms      = jScript.GetStream();

            byte[] buffer = ms.GetBuffer();
            string script;

            unsafe
            {
                fixed(byte *ptr = buffer)
                {
                    script = new string((sbyte *)ptr);
                }
            }

            List <HabProperties> list = new List <HabProperties>();

            foreach (HabProperties hpsUnit in hpcData)
            {
                HabProperties hpsBalance = hpcBalance[hpsUnit.name];
                if (hpsBalance.GetStringValue("Primary").Length > 1)
                {
                    continue;
                }

                HabProperties hpsProfile = hpcProfile[hpsUnit.name];
                if (hpsProfile == null)
                {
                    continue;
                }

                if (hpsUnit.GetStringValue("targType") != "ground")
                {
                    continue;
                }

                HabProperties hpsWeapons = hpcWeapons[hpsUnit.name];
                if (hpsWeapons == null)
                {
                    continue;
                }

                if (hpsWeapons.GetStringValue("weapTp1") == "_")
                {
                    continue;
                }

                HabProperties hpsUI = hpcUI[hpsUnit.name];
                if (hpsUI == null)
                {
                    continue;
                }

                if (!hpsUI.GetStringValue("file").StartsWith("units", StringComparison.InvariantCultureIgnoreCase))
                {
                    continue;
                }

                if (!hpsWeapons.ContainsKey("mindmg1"))
                {
                    continue;
                }

                if (!script.Contains("'" + hpsUnit.name + "'") && !script.Contains(DHJassInt.id2int(hpsUnit.name) + ""))
                {
                    continue;
                }

                list.Add(hpsProfile);
            }

            creepsCmbB.DataSource = list;
        }