コード例 #1
0
        public void GetCutList_EmptyTest()
        {
            string  text = "Test B 0001 remains standing while the trainer wipes him down.";
            CutList c    = WeblParser.GetCutList("Test B 0001", text);

            Assert.AreEqual(0, c.Count);
        }
コード例 #2
0
        protected void CutBtn_Click(object sender, EventArgs e)
        {
            var upath = Session["UserPath"] as string;

            foreach (RepeaterItem item in FileRepeater.Items)
            {
                try
                {
                    var cb    = item.Controls[0].Controls[3] as CheckBox;
                    var a     = item.Controls[0].Controls[0] as System.Web.UI.DataBoundLiteralControl;
                    var html  = a.Text;
                    var split = html.Split(new string[] { "title=" }, StringSplitOptions.None);
                    var title = split[1].Replace("'", "").Replace(">\r\n", "").TrimStart(' ').TrimEnd(' ');
                    var ext   = Path.GetExtension(title);
                    if (cb.Checked)
                    {
                        if (!CutList.Contains(new KeyValuePair <string, string>(upath, title)))
                        {
                            CutList.Add(new KeyValuePair <string, string>(upath, title));
                        }
                    }
                }
                catch { }
            }
            UpdateAll();
            //create cut list for pasting
        }
コード例 #3
0
        public void GetCutListTest()
        {
            string text = "Here's a line before it" + Environment.NewLine +
                          "Test B 0001 remains standing while the trainer wipes him down. He has his left eye badly swollen. He has a fractured nose." +
                          Environment.NewLine + "Here's a line after";
            CutList c = WeblParser.GetCutList("Test B 0001", text);

            Assert.AreEqual(2, c.Count);
            Assert.IsTrue(c.Count(d => d.Type == CutType.SwellLeft && d.Level == CutSeverity.Medium) == 1);
            Assert.IsTrue(c.Count(d => d.Type == CutType.InjuredNose && d.Level == CutSeverity.Medium) == 1);
        }
コード例 #4
0
 public VerticalCut GetVerticalCut(int index)
 {
     if (CutList.ContainsKey(index))
     {
         return(CutList[index]);
     }
     else
     {
         return(new VerticalCut());
     }
 }
コード例 #5
0
        private void ReadFONT(FNT FNT)
        {
            Height  = FNT.Header.Glyphs.Size1;
            Width   = FNT.Header.Glyphs.Size2;
            Palette = FNT.Palette.Pallete;
            if (FNT.Header.Glyphs.BitsPerPixel == 4)
            {
                PixelFormat = PixelFormats.Indexed4;
            }
            else if (FNT.Header.Glyphs.BitsPerPixel == 8)
            {
                PixelFormat = PixelFormats.Indexed8;
            }
            else
            {
                throw new Exception("ReadFONT Error: unknown PixelFormat");
            }

            var DecList = FNT.Compressed.GetDecompressedData();

            if (FNT.Header.Glyphs.BitsPerPixel == 4)
            {
                ArrayTool.ReverseByteInList(DecList);
            }

            for (int i = 0; i < DecList.Count; i++)
            {
                var Cut = FNT.WidthTable[i] == null ? new VerticalCut(0, (byte)Width) : FNT.WidthTable[i].Value;

                int index = i + 32;
                if (DataList.ContainsKey(index))
                {
                    DataList[index] = DecList[i];
                }
                else
                {
                    DataList.Add(index, DecList[i]);
                }

                if (CutList.ContainsKey(index))
                {
                    CutList[index] = Cut;
                }
                else
                {
                    CutList.Add(index, Cut);
                }
            }
        }
コード例 #6
0
 private void OpenFont(FNT FNT)
 {
     try
     {
         ReadFONT(FNT);
         if (CutList.ContainsKey(32))
         {
             CutList[32] = new VerticalCut(10, 20);
         }
     }
     catch (Exception e)
     {
         //Logging.Write("PersonaEditorLib", e);
     }
 }
コード例 #7
0
        public Tuple <byte[], VerticalCut> GetGlyph(int index)
        {
            byte[]      data        = null;
            VerticalCut verticalCut = new VerticalCut();

            if (DataList.ContainsKey(index))
            {
                data = DataList[index];
            }
            if (CutList.ContainsKey(index))
            {
                verticalCut = CutList[index];
            }

            return(new Tuple <byte[], VerticalCut>(data, verticalCut));
        }
コード例 #8
0
        public Dictionary <char, int> GetCharWidth(PersonaEncoding encoding)
        {
            Dictionary <char, int> returned = new Dictionary <char, int>();

            foreach (var a in encoding.Dictionary)
            {
                if (CutList.ContainsKey(a.Key))
                {
                    if (!returned.ContainsKey(a.Value))
                    {
                        var temp = CutList[a.Key];
                        returned.Add(a.Value, temp.Right - temp.Left);
                    }
                }
            }

            return(returned);
        }
コード例 #9
0
ファイル: WeblParser.cs プロジェクト: DougOz/WeBLSimulator
        public static CutList GetCutList(string fighterName, string text)
        {
            string exp = RegexHelpers.GetEnduranceDescriptorRegex(fighterName);


            Match   match = Regex.Match(text, exp, RegexOptions.Multiline);
            CutList ret   = new CutList();
            string  temp  = text.Substring(match.Index);

            temp = temp.GetFirstLine();

            string[] splitted = temp.Split(new string[] { ". " }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 1; i < splitted.Length; i++)
            {
                string cutString = splitted[i];
                Cut    c         = Cut.Parse(cutString);
                ret.Add(c);
            }
            return(ret);
        }
コード例 #10
0
        public void reorderList()
        {
            bool ordinata = false;

            while (!ordinata)
            {
                ordinata = true;
                for (int k = 0; k < CutList.Items.Count - 1; k++)
                {
                    int prev = ((itCut)CutList.Items[k]).layer;
                    int next = ((itCut)CutList.Items[k + 1]).layer;

                    if (prev > next)
                    {
                        ((itCut)CutList.Items[k]).layer     = next;
                        ((itCut)CutList.Items[k + 1]).layer = prev;
                        ordinata = false;
                        CutList.Refresh();
                    }
                }
            }
        }
コード例 #11
0
        private void OpenCache(string path)
        {
            using (BinaryReader reader = new BinaryReader(File.OpenRead(path)))
            {
                Width  = reader.ReadInt32();
                Height = reader.ReadInt32();
                int colorcount = reader.ReadInt32();
                int datacount  = reader.ReadInt32();
                int cutcount   = reader.ReadInt32();

                if (colorcount == 16)
                {
                    PixelFormat = PixelFormats.Indexed4;
                }
                else if (colorcount == 256)
                {
                    PixelFormat = PixelFormats.Indexed8;
                }
                else
                {
                }

                reader.BaseStream.Position += IOTools.Alignment(reader.BaseStream.Position, 0x10);
                Palette = ReadPalette(reader, colorcount).ToArray();

                int glyphsize = (PixelFormat.BitsPerPixel * Width * Height) / 8;
                reader.BaseStream.Position += IOTools.Alignment(reader.BaseStream.Position, 0x10);
                for (int i = 32; i < 32 + datacount; i++)
                {
                    DataList.Add(i, reader.ReadBytes(glyphsize));
                }

                reader.BaseStream.Position += IOTools.Alignment(reader.BaseStream.Position, 0x10);
                for (int i = 32; i < 32 + cutcount; i++)
                {
                    CutList.Add(i, new VerticalCut(reader.ReadBytes(2)));
                }
            }
        }
コード例 #12
0
//SUPER BUTTON*********************************
        protected void SuperButton_Click(object sender, EventArgs e)
        {
            var u       = UserPath = Session["UserPath"] as string;
            var args    = SuperButtonArg.Text.Split(',');
            var command = args[0];
            var target  = args[1].Replace("\r\n", "").TrimStart(' ').TrimEnd(' ');
            var go      = 0;

            switch (command)
            {
            case "cut":
                if (!CutList.Contains(new KeyValuePair <string, string>(Upath, target)))
                {
                    CutList.Add(new KeyValuePair <string, string>(Upath, target));
                }
                CutBtn_Click(this, new EventArgs());
                break;

            case "copy":
                if (!CopyList.Contains(new KeyValuePair <string, string>(Upath, target)))
                {
                    CopyList.Add(new KeyValuePair <string, string>(Upath, target));
                }
                CopyBtn_Click(this, new EventArgs());
                break;

            case "paste":
                PasteContent(target);
                break;

            case "inputaccept":
                InputModal.Style.Clear();
                InputModal.Style.Add("display", "none");
                var name = RenameInputBox.Text;
                //find file and rename it
                target = Session["Rename"] as string;
                if (Path.GetExtension(target) == "")
                {
                    RenameDir(target, name);
                }
                else
                {
                    RenameFile(target, name);
                }

                UpdateAllPanels();
                break;

            case "rename":
                InputModal.Style.Clear();
                InputModal.Style.Add("display", "inline-block");
                Session["Rename"]   = target;
                RenameInputBox.Text = target;
                RenameInputBox.Focus();
                UpdateAllPanels();

                break;

            case "delete":
                if (Path.GetExtension(target) == "")
                {
                    DeleteDir(target);
                }
                else
                {
                    DeleteFile(target);
                }
                DeleteBtn_Click(this, new EventArgs());
                break;

            case "New Folder":
                var newpath = Server.MapPath(UserPath) + "New Folder";
                Directory.CreateDirectory(newpath);
                break;

            default:
                break;
            }
            var aa = Session["UserPath"] as string;

            UpdateFileLists(aa);
            UpdateAllPanels();
        }