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 }
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); } } }
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); }
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))); } } }
//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(); }