public ArsReportDesign() { InitializeComponent(); SQLText.Options.Search.RegExResultMaxGuaranteedLength = 500; SQLText.ReplaceService <ISyntaxHighlightService>(new CustomSyntaxHighlightService(SQLText.Document)); }
private static void WriteText(string text, string myFileName) { BinaryWriter writer = BCPTests.CreateBinaryFile(myFileName); SQLText.Write(writer, text); writer.Close(); }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { AttList.Items.Clear(); UniqueList.Items.Clear(); IField pFielf; //找到和combox中一致的图层 for (int i = 0; i < currentMap.LayerCount; i++) { //如果图层是图层组类型 if (currentMap.get_Layer(i) is GroupLayer) { ICompositeLayer pCompositeLayer = currentMap.get_Layer(i) as ICompositeLayer; for (int j = 0; j < pCompositeLayer.Count; j++) { if (pCompositeLayer.get_Layer(j).Name == comboBox1.Text) { currentFeatureLayer = pCompositeLayer.get_Layer(i) as IFeatureLayer; break; } } } //一般图层的情况 else { if (currentMap.get_Layer(i).Name == comboBox1.Text) { currentFeatureLayer = currentMap.get_Layer(i) as IFeatureLayer; break; } } } //遍历属性,填充attList for (int i = 0; i < currentFeatureLayer.FeatureClass.Fields.FieldCount; i++) { pFielf = currentFeatureLayer.FeatureClass.Fields.get_Field(i); if (pFielf.Name.ToUpper() != "SHAPE") { //写sql语句时需要将属性加上"",转义就写成:"\"" AttList.Items.Add("\"" + pFielf.Name + "\""); } } label3.Text = "STELCT * FROM " + currentFeatureLayer.Name + " WHERE:"; SQLText.Clear(); }
private void button14_Click(object sender, EventArgs e) { SQLText.AppendText("Is "); }
private void button3_Click(object sender, EventArgs e) { SQLText.AppendText("Like "); }
private void AttList_DoubleClick(object sender, EventArgs e) { SQLText.AppendText(AttList.SelectedItem.ToString() + " "); }
private void UniqueList_DoubleClick(object sender, EventArgs e) { SQLText.AppendText(UniqueList.SelectedItem.ToString()); }
public void GetSQL(String ConnectionString) { SQLiteConnection Connection = new SQLiteConnection(ConnectionString); Connection.Open(); ScriptData.Clear(); TextAmount = 0; UnreferencedText = new List <KeyValuePair <int, string> >(); using (SQLiteTransaction Transaction = Connection.BeginTransaction()) using (SQLiteCommand Command = new SQLiteCommand(Connection)) { Command.CommandText = "SELECT english, PointerRef, IdentifyPointerRef FROM Text ORDER BY id"; SQLiteDataReader r = Command.ExecuteReader(); while (r.Read()) { String SQLText; try { SQLText = r.GetString(0).Replace("''", "'"); } catch (System.InvalidCastException) { SQLText = ""; } int PointerRef = r.GetInt32(1); int IdentPtrRef = r.GetInt32(2); if (PointerRef == 1) { // game code while (true) { int commandstart = SQLText.IndexOf('<'); int commandend = SQLText.IndexOf('>'); if (commandstart == -1) { break; } string cmd = SQLText.Substring(commandstart + 1, (commandend - commandstart) - 1); SQLText = SQLText.Substring(commandend + 1); ScriptEntry e = new ScriptEntry(); if (cmd.Contains(':')) { // command with args string[] bytestrs = cmd.Split(singleSpaceInArray, StringSplitOptions.RemoveEmptyEntries); string typestr = bytestrs[0].Replace(":", ""); switch (typestr) { case "FMV": e.Type = 0x05; break; case "Voice": e.Type = 0x08; break; case "Music": e.Type = 0x09; break; case "Sound": e.Type = 0x0A; break; case "LoadScript": e.Type = 0x19; break; case "Sprite": e.Type = 0x1E; break; case "Speaker": e.Type = 0x21; break; case "WaitPlayerInput": e.Type = 0x3A; break; case "WaitFrame": e.Type = 0x3B; break; case "SDR2-WaitPlayerInput": e.Type = 0x4B; break; case "SDR2-WaitFrame": e.Type = 0x4C; break; default: e.Type = HexUtils.ParseDecOrHexToByte(typestr); break; } byte[] args = new byte[bytestrs.Length - 1]; for (int i = 1; i < bytestrs.Length; ++i) { if (bytestrs[i].Contains('[') && bytestrs[i].Contains(']')) { args[i - 1] = (DanganUtil.NameToCharacterId(bytestrs[i].Replace("[", "").Replace("]", ""))); } else { args[i - 1] = (HexUtils.ParseDecOrHexToByte(bytestrs[i])); } } e.Arguments = args; } else { // command without args if (cmd == "__END__") { break; } // ending command processing for this entry switch (cmd) { case "WaitPlayerInput": e.Type = 0x3A; break; case "WaitFrame": e.Type = 0x3B; break; case "SDR2-WaitPlayerInput": e.Type = 0x4B; break; case "SDR2-WaitFrame": e.Type = 0x4C; break; default: e.Type = HexUtils.ParseDecOrHexToByte(cmd); break; } e.Arguments = new byte[0]; } ScriptData.Add(e); } } else if (PointerRef == 2) { // normal text if (SQLText.StartsWith("<REMOVE>")) { // remove this entry by simply not inserting it into the data // also find previous <WaitForPlayerInput> if it exists and remove it // ...also remove <WaitFrame>s although I'm not 100% on this if it's actually smart, // but we'll see this during testing I guess! // search through script data in reverse order until we find either the beginning // or the previous Text entry for (int i = ScriptData.Count - 1; i >= 0; --i) { if (ScriptData[i].Type == 0x02) // text entry { break; // we're done } // DR1: 0x3A -> WaitPlayerInput; 0x3B -> WaitFrame // SDR2: 0x4C -> WaitFrame; 0x4B -> WaitPlayerInput switch (DanganUtil.GameVersion) { case 1: if (ScriptData[i].Type == 0x3A || ScriptData[i].Type == 0x3B) { ScriptData.RemoveAt(i); } break; default: if (ScriptData[i].Type == 0x4C || ScriptData[i].Type == 0x4B) { ScriptData.RemoveAt(i); } break; } } } else { bool first = true; foreach (string s in SQLText.Split('\f')) { if (!first) { ScriptEntry wait = new ScriptEntry(); switch (DanganUtil.GameVersion) { case 1: wait.Type = 0x3A; break; default: wait.Type = 0x4B; break; } wait.Arguments = new byte[0]; ScriptData.Add(wait); } ScriptEntry e = new ScriptEntry(); e.Type = 0x02; e.Arguments = new byte[2]; //e.Arguments[0] = 0xFF; // will be fixed later in CreateFile() //e.Arguments[1] = 0xFF; e.Text = s; ScriptData.Add(e); first = false; } } } else if (PointerRef == 3) { // unreferenced text UnreferencedText.Add(new KeyValuePair <int, string>(IdentPtrRef, SQLText)); } else { throw new Exception("Unrecognized PointerRef type!"); } } Transaction.Rollback(); } return; }