public Dictionary <string, string> FBListUIDComentFromPost(List <string> Handle, string IDPost) { try { Dictionary <string, string> result = new Dictionary <string, string>(); //ahihi string s = http.Get("https://graph.facebook.com/v3.0/" + KiemTraLink(IDPost) + "?fields=comments&access_token=" + Handle[3]).ToString(); // MessageBox.Show(s); Tag1 tag1 = JsonConvert.DeserializeObject <Tag1>(s); Tag2 tag2 = tag1.comments; List <Tag3> ltag3 = tag2.data.ToList(); for (int i = 0; i < ltag3.Count; i++) { Tag4 tag4 = ltag3[i].from; //result.Add(n3.id, n3.name); if (!result.ContainsKey(tag4.id)) { result.Add(tag4.id, tag4.name); } //MessageBox.Show("Ten = " + tag4.id); } return(result); } catch (Exception ex) { ex.Message.ToString(); return(null); } }
private string ActiveObject(Tag2 active) { string result = null; try { // {=active.fetch.[deep_index].[column_index]} if (active.Child.Name == "counter") { result = this.rowCollectionMenager.ActiveObjectInstance.RowCounter.ToString(); } else { int depth = int.Parse(active.Child.Child.Name); depth--; string objectName = rowCollectionMenager.ActiveObjectInstance[depth]; if (objectName != null) { RowCollection rowCollection = rowCollectionMenager[objectName]; if (active.Child.Name == "fetch") { int columnIndex = int.Parse(active.Child.Child.Child.Name); columnIndex--; RowCollectionRow objectRow = rowCollection.Rows[rowCollection.Rows.Curent]; if (objectRow != null) { result = objectRow[columnIndex].Value; } else { // active object is out of scope result = ""; } } else if (active.Child.Name == "index") { result = (rowCollection.Rows.Curent + 1).ToString();; } else { ModuleLog.Write(new string[] { constError_CommandNotFound, active.InputText }, this, "ActiveObject", ModuleLog.LogType.ERROR); result = constError_SyntaxError; } } else { // active object is out of scope result = ""; } } } catch (Exception ex) { ModuleLog.Write(new string[] { constError_ExecutingBlock, active.InputText }, this, "ActiveObject", ModuleLog.LogType.DEBUG); ModuleLog.Write(ex, this, "ActiveObject", ModuleLog.LogType.ERROR); result = constError_SyntaxError; } return(result); }
/// <summary> /// Get object that matches input tag or ... /// </summary> /// <param name="tag"></param> /// <returns></returns> public TagsStorage GetTagsStorage(Tag2 tag) { TagsStorage result = null; foreach (TagsStorage tagsStorage in this) { if (tagsStorage.name == tag.Name || (tagsStorage.tagType != TagsStorageType.Object)) { if (tag.Child == null) { result = tagsStorage.parent; break; } else { result = tagsStorage.GetTagsStorage(tag.Child); break; } } } if (result == null) { //if (tag.Tags != null) //{ result = this; //} } return(result); }
/// <summary> /// RowCollection object /// </summary> /// <param name="tag"></param> /// <returns></returns> private string DataObjectGetValue(Tag2 tag) { string result = null; int columntID; RowCollection rowCollection = rowCollectionMenager[tag.Name]; try { // {=objectname.row.column} // {=objectname.column} // Column index is zero base, but user need to treat it like non zero base else it is error if (rowCollection != null) { if (tag.Child.Name == "fetch") { columntID = int.Parse(tag.Child.Child.Name); columntID--; result = rowCollection.Rows.FetchColumn(columntID); } else if (tag.Child.Name == "fetchNext") { columntID = int.Parse(tag.Child.Child.Name); columntID--; result = rowCollection.Rows.FetchNextColumn(columntID); } else if (tag.Child.Name == "search") { // {=object.searchRegex.searchOnColumn.returnColumn."<regex>"} columntID = int.Parse(tag.Child.Child.Name); columntID--; int columnID2 = int.Parse(tag.Child.Child.Child.Name); columnID2--; RowCollectionRow row = rowCollection.Rows.SearchRow(tag.Child.Child.Child.Child.Name, columntID); if (row != null) { result = row[columnID2].Value; } else { result = ""; } } } else { ModuleLog.Write(new string[] { constError_CommandNotFound, tag.InputText }, this, "DataObjectGetValue", ModuleLog.LogType.ERROR); result = constError_SyntaxError; } } catch (Exception ex) { ModuleLog.Write(new string[] { constError_ExecutingBlock, tag.InputText }, this, "DataObjectGetValue", ModuleLog.LogType.DEBUG); ModuleLog.Write(ex, this, "DataObjectGetValue", ModuleLog.LogType.ERROR); result = constError_SyntaxError; } return(result); }
private void UpdateHoveringWindowList(string text) { TagsStorage activeTagStorage = null; TreeNode treeNode; if (text.Length > 2) { text = text.Substring(2, text.Length - 2); //Tag2 tag = new Tag2("Root", text); Tag2 tag = new Tag2(text); activeTagStorage = tagsStorage.GetTagsStorage(tag); } else { activeTagStorage = tagsStorage; } if (activeTagStorage != null) { tvList.Nodes.Clear(); foreach (TagsStorage tags in activeTagStorage) { treeNode = new TreeNode(tags.DisplayText); treeNode.ImageKey = tags.Type.ToString(); treeNode.SelectedImageKey = tags.Type.ToString(); //treeNode.Tag = tags.Value; treeNode.Tag = tags; tvList.Nodes.Add(treeNode); } } else { tvList.Nodes.Clear(); control_LostFocus(null, null); } // ovo je tmp rjesenje jer " . " bug, raditi preko tagova orginalno int lastIndexOfDot = text.LastIndexOf('.'); string lastText; if (lastIndexOfDot != -1) { lastText = text.Substring(lastIndexOfDot + 1, (text.Length - lastIndexOfDot) - 1); } else { lastText = text; } // select active node base on user input foreach (TreeNode node in tvList.Nodes) { if (node.Text.StartsWith(lastText)) { tvList.SelectedNode = node; break; } } }
public ArrayObject(Tag2 tag, ArrayList varObjectStructList) { this.tag = tag; this.varObjectStructList = varObjectStructList; //// If varObject is null, first use, create instance //if (varObjectStructList == null) //{ // varObjectStructList = new ArrayList(); //} }
/// <summary> /// Generic method, it will return string value of row object and columnt index /// </summary> /// <param name="row">Row object</param> /// <param name="objectValue">Column index</param> /// <returns></returns> /// private string DataObjectGetValue(RowCollectionRow row, Tag2 tag) { string result = null; int columntID = 0; try { if (tag.Child.Child == null) { columntID = int.Parse(tag.Child.Name); // Column index is zero base, but user need to treat it like non zero base else it is error if (columntID > 0) { // Increment column index to 1, zero index base, user will access it by one base columntID--; result = row[columntID].Value; } else { ModuleLog.Write(new string[] { constError_SyntaxError, tag.InputText }, this, "DataObjectGetValue", ModuleLog.LogType.ERROR); result = constError_SyntaxError; } } else { ModuleLog.Write(new string[] { constError_CommandNotFound, tag.InputText }, this, "DataObjectGetValue", ModuleLog.LogType.ERROR); result = constError_SyntaxError; } } catch (Exception ex) { ModuleLog.Write(new string[] { constError_ExecutingBlock, tag.InputText }, this, "DataObjectGetValue", ModuleLog.LogType.DEBUG); ModuleLog.Write(ex, this, "DataObjectGetValue", ModuleLog.LogType.ERROR); result = constError_SyntaxError; } //if (result == null) //{ // ModuleLog.Write(string.Concat(constError_SyntaxError, " (", objectValue, ")"), this, "DataObjectGetValue", ModuleLog.LogType.ERROR); // result = constError_SyntaxError; //} return(result); }
//private string ArrayObject(Tag2 tag) //{ // string result = null; // try // { // if (tag.Child.Name == "add" || tag.Child.Name == "addOnce") // { // VarObjectStruct varObjectStruct = null; // //{=array.add.[ArrayName].[Value]} // //{=array.addOnce.[ArrayName].[Value]} // // If varObject is null, first use, create instance // if (varObjectList == null) // { // varObjectList = new ArrayList(); // } // // Is object with 'array name' already set ? // foreach (VarObjectStruct isVariable in varObjectList) // { // if (tag.Child.Child.Name == isVariable.Name) // { // varObjectStruct = isVariable; // break; // } // } // if (varObjectStruct == null) // { // // VarObjectStruct entry is object with name and value propertis // varObjectStruct = new VarObjectStruct(tag.Child.Child.Name, VarObjectStruct.Type.Array); // if (tag.Child.Name == "add") // { // varObjectStruct.Add(tag.Child.Child.Child.Name); // } // else // { // varObjectStruct.AddOnce(tag.Child.Child.Child.Name); // } // // Add entry to row collection // varObjectList.Add(varObjectStruct); // result = ""; // varObjectStruct.Name + " set value to " + varObjectStruct.FetchNext(); // } // else // { // if (tag.Child.Name == "add") // { // varObjectStruct.Add(tag.Child.Child.Child.Name); // } // else // { // varObjectStruct.AddOnce(tag.Child.Child.Child.Name); // } // // Remove var object tag and replace with value // result = ""; // varObjectStruct.Name + " update value to " + varObjectStruct.FetchNext(); // } // } // else if (tag.Child.Name == "fetch") // { // // {=array.fetch."[ArrayName]" // foreach (VarObjectStruct varObjectStruct in varObjectList) // { // if (varObjectStruct.Name == tag.Child.Child.Name) // { // result = varObjectStruct.Fetch(); // //ModuleLog.Write("VarObjectName: " + objectEntry.Name + "\r\nVarObjectValue: " + objectEntry.Value, this, "VarObject", ModuleLog.LogType.DEBUG); // break; // } // } // } // else if (tag.Child.Name == "fetchNext") // { // // {=array.fetch."[ArrayName]" // foreach (VarObjectStruct varObjectStruct in varObjectList) // { // if (varObjectStruct.Name == tag.Child.Child.Name) // { // result = varObjectStruct.FetchNext(); // //ModuleLog.Write("VarObjectName: " + objectEntry.Name + "\r\nVarObjectValue: " + objectEntry.Value, this, "VarObject", ModuleLog.LogType.DEBUG); // break; // } // } // } // else // { // ModuleLog.Write(new string[] { constError_CommandNotFound, tag.InputText }, this, "ArrayObject", ModuleLog.LogType.ERROR); // result = constError_SyntaxError; // } // } // catch (Exception ex) // { // ModuleLog.Write(new string[] { constError_ExecutingBlock, tag.InputText }, this, "ArrayObject", ModuleLog.LogType.DEBUG); // ModuleLog.Write(ex, this, "ArrayObject", ModuleLog.LogType.ERROR); // result = constError_SyntaxError; // } // return result; //} private string FormatObject(Tag2 tag) { string result = null; try { if (tag.Child.Name == "removenewline") { //{=format.removerow.text} result = tag.Child.Child.Name.Replace("\r\n", ""); } else if (tag.Child.Name == "escape") { ModuleLog.Write("Tag is on TODO list", this, "FormatObject", ModuleLog.LogType.WARNING); } else if (tag.Child.Name == "unescape") { //{=format.unescape."[text]"} result = tag.Child.Child.Name.Replace(@"\{=", "{=").Replace(@"\}", "}"); } else if (tag.Child.Name == "\\") { //{=format.\.text} result = tag.Child.Child.Name.Replace(".", "<*D*>"); ModuleLog.Write("Tag is deprecated", this, "FormatObject", ModuleLog.LogType.WARNING); } else { ModuleLog.Write(new string[] { constError_CommandNotFound, tag.InputText }, this, "ArrayObject", ModuleLog.LogType.ERROR); result = constError_SyntaxError; } } catch (Exception ex) { ModuleLog.Write(new string[] { constError_ExecutingBlock, tag.InputText }, this, "ArrayObject", ModuleLog.LogType.DEBUG); ModuleLog.Write(ex, this, "ArrayObject", ModuleLog.LogType.ERROR); result = constError_SyntaxError; } return(result); }
private string InputObject(RowCollectionRow row, Tag2 tag) { string result = null; InputBox inputBox; try { if (tag.Child.Name == "repeat") { // // NOTE this need to be like $input.once object // //{=input.repeat.[Value]} inputBox = new InputBox("Write text", tag.Child.Name, "Replace tag with text..."); inputBox.ShowDialog(System.Windows.Forms.Application.OpenForms[0]); result = inputBox.InputTekst; } else if (tag.Child.Name == "once") { result = inputObject.ProcessTag(tag); if (result == null) { result = constError_SyntaxError; } } else { ModuleLog.Write(new string[] { constError_CommandNotFound, tag.InputText }, this, "InputObject", ModuleLog.LogType.ERROR); result = constError_SyntaxError; } } catch (Exception ex) { ModuleLog.Write(new string[] { constError_ExecutingBlock, tag.InputText }, this, "InputObject", ModuleLog.LogType.DEBUG); ModuleLog.Write(ex, this, "InputObject", ModuleLog.LogType.ERROR); result = constError_SyntaxError; } return(result); }
private string StringObject(RowCollectionRow row, Tag2 tag) { string result = null; try { if (tag.Child.Name == "split") { // string.split.[index].[split string].[text] string[] splitList = tag.Child.Child.Child.Child.Name.Split(new string[] { tag.Child.Child.Child.Name }, StringSplitOptions.RemoveEmptyEntries); int index; index = int.Parse(tag.Child.Child.Name); // if index is in range of array if (index < splitList.Length) { result = splitList[index]; } else { // else return empty string and log waring result = ""; ModuleLog.Write("String out of range returning empty string", this, "StringObject", ModuleLog.LogType.WARNING); } } else { ModuleLog.Write(string.Concat(constError_SyntaxError, " (", tag.InputText, ")"), this, "StringObject", ModuleLog.LogType.ERROR); result = constError_SyntaxError; } } catch (Exception ex) { ModuleLog.Write(string.Concat(constError_SyntaxError, " (", tag.InputText, ")"), this, "StringObject", ModuleLog.LogType.DEBUG); ModuleLog.Write(ex, this, "StringObject", ModuleLog.LogType.ERROR); result = constError_SyntaxError; } return(result); }
public string ProcessTag(Tag2 tag) { string result = ""; try { activeIndex++; if (activeIndex < list.Count) { // input object fount so return value and exit result = (string)((NameValueDataStruct)list[activeIndex]).Value; } else { if (tag.Child.Child.Name == "textbox") { // {=input.once.textbox.[Text]} list.Add(new NameValueDataStruct(tag.Child.Child.Child.Name, null)); } else if (tag.Child.Child.Name == "combobox") { // {=input.once.combobox."Caption name".[ArrayObject].[ArrayObject]} NameValueDataStruct nameValueDataStruct = new NameValueDataStruct(tag.Child.Child.Child.Name, null); Array nameArray = null; Array valueArray = null; ArrayList data; // get object from text foreach (VarObjectStruct varObjectStruct in varObjectList.varObjectList) { if (varObjectStruct.Name == tag.Child.Child.Child.Child.Name) { //data.Add(varObjectStruct.ToArray()); nameArray = varObjectStruct.ToArray(); break; } } // get object from text foreach (VarObjectStruct varObjectStruct in varObjectList.varObjectList) { if (varObjectStruct.Name == tag.Child.Child.Child.Child.Child.Name) { valueArray = varObjectStruct.ToArray(); break; } } // if value array is null then make it equals as name array, so user can make empty value array string if (valueArray == null && tag.Child.Child.Child.Child.Child.Name == "") { valueArray = nameArray; } if (nameArray != null && valueArray != null) { data = new ArrayList(nameArray.Length); for (int i = 0; i < nameArray.Length; i++) { data.Add(new NameValueDataStruct(nameArray.GetValue(i).ToString(), valueArray.GetValue(i))); } nameValueDataStruct.Data = data; } else { ModuleLog.Write("Array object not found for " + nameValueDataStruct.Name, this, "ProcessTag", ModuleLog.LogType.ERROR); } list.Add(nameValueDataStruct); } else { ModuleLog.Write(new string[] { TagsReplace.constError_CommandNotFound, tag.InputText }, this, "ProcessTag", ModuleLog.LogType.ERROR); result = TagsReplace.constError_SyntaxError; } // if is last input object then call user to imput data if (activeIndex >= inputTagsCount - 1) { CallUserInput(); } } if (activeIndex >= inputTagsCount - 1) { activeIndex = -1; } } catch (Exception ex) { ModuleLog.Write(new string[] { TagsReplace.constError_ExecutingBlock, tag.InputText }, this, "ProcessTag", ModuleLog.LogType.DEBUG); ModuleLog.Write(ex, this, "ProcessTag", ModuleLog.LogType.ERROR); result = TagsReplace.constError_SyntaxError; } return(result); }
public string ProcessTag(Tag2 tag) { string result = ""; try { activeIndex++; if (activeIndex < list.Count) { // input object fount so return value and exit result = (string)((NameValueDataStruct)list[activeIndex]).Value; } else { if (tag.Child.Child.Name == "textbox") { // {=input.once.textbox.[Text]} list.Add(new NameValueDataStruct(tag.Child.Child.Child.Name, null)); } else if (tag.Child.Child.Name == "combobox") { // {=input.once.combobox."Caption name".[ArrayObject].[ArrayObject]} NameValueDataStruct nameValueDataStruct = new NameValueDataStruct(tag.Child.Child.Child.Name, null); Array nameArray = null; Array valueArray = null; ArrayList data; // get object from text foreach (VarObjectStruct varObjectStruct in varObjectList.varObjectList) { if (varObjectStruct.Name == tag.Child.Child.Child.Child.Name) { //data.Add(varObjectStruct.ToArray()); nameArray = varObjectStruct.ToArray(); break; } } // get object from text foreach (VarObjectStruct varObjectStruct in varObjectList.varObjectList) { if (varObjectStruct.Name == tag.Child.Child.Child.Child.Child.Name) { valueArray = varObjectStruct.ToArray(); break; } } // if value array is null then make it equals as name array, so user can make empty value array string if (valueArray == null && tag.Child.Child.Child.Child.Child.Name == "") { valueArray = nameArray; } if (nameArray != null && valueArray != null) { data = new ArrayList(nameArray.Length); for (int i = 0; i < nameArray.Length; i++) { data.Add(new NameValueDataStruct(nameArray.GetValue(i).ToString(), valueArray.GetValue(i))); } nameValueDataStruct.Data = data; } else { ModuleLog.Write("Array object not found for " + nameValueDataStruct.Name, this, "ProcessTag", ModuleLog.LogType.ERROR); } list.Add(nameValueDataStruct); } else { ModuleLog.Write(new string[] { TagsReplace.constError_CommandNotFound, tag.InputText }, this, "ProcessTag", ModuleLog.LogType.ERROR); result = TagsReplace.constError_SyntaxError; } // if is last input object then call user to imput data if (activeIndex >= inputTagsCount - 1) { CallUserInput(); } } if (activeIndex >= inputTagsCount - 1) { activeIndex = -1; } } catch(Exception ex) { ModuleLog.Write(new string[] { TagsReplace.constError_ExecutingBlock, tag.InputText }, this, "ProcessTag", ModuleLog.LogType.DEBUG); ModuleLog.Write(ex, this, "ProcessTag", ModuleLog.LogType.ERROR); result = TagsReplace.constError_SyntaxError; } return result; }
private string VarObject(Tag2 tag) { string result = null; try { if (tag.Child.Name == "set") { VarObjectStruct varObjectStruct = null; //{=var.set.[VariableName].[Value]} // If varObject is null, first use, create instance if (varObjectList == null) { varObjectList = new ArrayList(); } // Is object alredy set ? foreach (VarObjectStruct isVariable in varObjectList) { if (tag.Child.Child.Name == isVariable.Name) { varObjectStruct = isVariable; break; } } if (varObjectStruct == null) { // varObject entry is object with name and value propertis, tag class will be replacet with one of generic class varObjectStruct = new VarObjectStruct(tag.Child.Child.Name, VarObjectStruct.Type.Single); varObjectStruct.Add(tag.Child.Child.Child.Name); // Add entry to row collection varObjectList.Add(varObjectStruct); result = ""; // varObjectStruct.Name + " set value to " + varObjectStruct.FetchNext(); } else { varObjectStruct.Add(tag.Child.Child.Child.Name); // Remove var object tag and replace with value result = ""; // varObjectStruct.Name + " update value to " + varObjectStruct.FetchNext(); } } else if (tag.Child.Name == "get") { //{=var.get.[VariableName]} foreach (VarObjectStruct varObjectStruct in varObjectList) { if (varObjectStruct.Name == tag.Child.Child.Name) { result = varObjectStruct.Fetch(); break; } } if (result == null) { result = constError_SyntaxError; } } else { ModuleLog.Write(new string[] { constError_CommandNotFound, tag.InputText }, this, "VarObject", ModuleLog.LogType.ERROR); result = constError_SyntaxError; } } catch (Exception ex) { ModuleLog.Write(new string[] { constError_ExecutingBlock, tag.InputText }, this, "VarObject", ModuleLog.LogType.DEBUG); ModuleLog.Write(ex, this, "VarObject", ModuleLog.LogType.ERROR); result = constError_SyntaxError; } return(result); }
public GraphicsObject(Tag2 tag) { this.tag = tag; }
public FileObject(Tag2 tag, ref ArrayList varObjectStructList) { this.tag = tag; this.varObjectStructList = varObjectStructList; }
private string ReplaceSuportedObject(string objectName, string objectValue, RowCollectionRow row) { // // I N F O - ReplaceTagsFromInToOut will not cut this // Tag2 tag = new Tag2("{=" + objectName + "." + objectValue); if (objectName == "date") { // Call to datetime object return(this.DateObject(objectValue)); } else if (objectName == "string") { // Call to main generic method, other method will call it to get object row value and then format it // this one just return pure text value // // Ovo sa split je privremeno ovdje stavito // if (tag.Child.Name.Equals("split")) { return(StringObject(row, tag)); } else { return(StringObject(row, objectValue)); } } else if (objectName == "nth") { // Call to main generic method, other method will call it to get object row value and then format it // this one just return pure text value return(NTHObject(row, objectValue)); } else if (objectName == "number") { // Call to main generic method, other method will call it to get object row value and then format it // this one just return pure text value return(NumberObject(row, objectValue)); } else if (tag.Name == "input") { // Call to InputObject return(InputObject(row, tag)); } else if (tag.Name == "var") { // Call to VarObject return(VarObject(tag)); } else if (tag.Name == "array") { // Call to ArrayObject ArrayObject arrayObject = new ArrayObject(tag, varObjectList); return(arrayObject.ProcessTag()); } else if (tag.Name == "format") { // Call to FormatObject, get and set method return(FormatObject(tag)); } else if (objectName == "xml") { // Call to FormatObject, get and set method return(XMLObject(row, objectValue)); } else if (objectName.StartsWith("random")) { return(RandomObject(objectName, objectValue)); } else if (objectName.StartsWith("md5")) { return(MD5Object(objectName, objectValue)); } else if (tag.Name == "file") { FileObject fileObject = new FileObject(tag, ref varObjectList); return(fileObject.ProcessTag()); } else if (tag.Name == "dir") { DirObject dirObject = new DirObject(tag, ref varObjectList); return(dirObject.ProcessTag()); } else if (tag.Name == "graphics") { GraphicsObject fileObject = new GraphicsObject(tag); return(fileObject.ProcessTag()); } else if (tag.Name == "math") { MathObject mathObject = new MathObject(tag); return(mathObject.ProcessTag()); } else { // objects that dont need be in initialization proccess if (isInitialization == false) { if (tag.Name == "active") { return(ActiveObject(tag)); } else if (tag.Name == "data") { // Call to main generic method, other method will call it to get object row value and then format it // this one just return pure text value return(DataObjectGetValue(row, tag)); } //else if (objectName.StartsWith("data")) //{ // return DataObjectGetValue(objectName, objectValue); //} else { return(DataObjectGetValue(tag)); } } } return(null); }
public MathObject(Tag2 tag) { this.tag = tag; }
public string ReplaceTags(string text, RowCollectionRow row, bool isInitialization) { int indexOfFirst = 0; int indexOfLast = 0; int indexOfLastNoTag = 0; int tagCounter = 0; bool tagSearchActive = false; string result = ""; string processedText = ""; this.isInitialization = isInitialization; for (int i = 0; i < text.Length; i++) { // Find first tag, { if (text[i] == '{') { if (!Tag2.IsExcaped(text, i)) { // if start tag is complete, is like {= if ((text.Length > 2 && i < text.Length - 2) && text[i + 1] == '=') { // increment tag counter tagCounter++; // if this is first tag that is find then save indexOf if (tagSearchActive == false) { indexOfFirst = i; // indicate thats tag search is active, from now if tagCounter is 0 then cut tag and call ReplaceTagsFromInToOut(x, x) tagSearchActive = true; // start tag find next for continue; } } } //} } // Find last tag if (text[i] == '}') { // Check if is not excaped if (!Tag2.IsExcaped(text, i)) { // Decrement tag counter and set indexOfLast tagCounter--; indexOfLast = i; } } // if tagCounter is less then zero then throw error if (tagCounter < 0) { throw new Exception("Template syntax error at end of " + Environment.NewLine + text.Substring(indexOfFirst, indexOfLast - indexOfFirst)); } // Check is tag search is active and tagCounter value is zero, if is zero then call ReplaceTagsFromInToOut(x, x) if (tagSearchActive) { // if tagCounter is zero then call ReplaceTagsFromInToOut(x, x) if (tagCounter == 0) { // call function to parse tags extracted result = ReplaceTagsFromInToOut(text.Substring(indexOfFirst, (indexOfLast - indexOfFirst) + 1), row); // copy no tag text processedText += text.Substring(indexOfLastNoTag, indexOfFirst - indexOfLastNoTag); indexOfLastNoTag = indexOfLast + 1; // replace extracted tags block with result from function with 2 (0, 1) (2 - 1) = 1 <= 1 , 1 + 1 = 2, (2 - 1) - 1 1 //processedText += string.Concat(text.Substring(0, indexOfFirst), result, text.Length - 1 >= indexOfLast ? text.Substring(indexOfLast + 1, (text.Length - 1) - indexOfLast) : ""); processedText += result; // reset varables tagSearchActive = false; } } } // Copy text after last tag if (indexOfLastNoTag < text.Length) { processedText += text.Substring(indexOfLastNoTag, text.Length - indexOfLastNoTag); } // if tagCounter is not zero then throw error if (tagCounter > 0) { throw new Exception("Template syntax error at start of " + Environment.NewLine + text.Substring(indexOfFirst, text.Length - indexOfFirst)); } // Do all unexcape //processedText = processedText.Replace("\\\\", "\\"); processedText = Tag2.UnEscape(processedText); // log if change is made if (text != processedText) { ModuleLog.Write(processedText, this, "ReplaceTags", ModuleLog.LogType.DEBUG); } return(processedText); }
protected void Button2_Click(object sender, EventArgs e) { Tag2.Update(); SEInsert.Insert(); Response.Redirect("~/Admin/Admin.aspx"); }