Summary description for Tagger
Ejemplo n.º 1
0
 /// <summary>
 /// Creates a new TypeNode.
 /// </summary>
 /// <param name="name">The name of the type.</param>
 /// <param name="isPrimitive">Whether the type is a primitive data type.</param>
 /// <param name="splitter">An IdSplitter to split the type name into words.</param>
 /// <param name="tagger">A Tagger to tag the parts-of-speech of each word of the name.</param>
 /// <param name="location">The location of the type.</param>
 public TypeNode(string name, bool isPrimitive, IdSplitter splitter, Tagger tagger, Location location)
     : this(name, isPrimitive, splitter) {
     if(tagger != null) {
         tagger.TagType(this.ParsedName);
     }
     this.SetLocation(location);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates a new VariableDeclarationNode.
 /// </summary>
 /// <param name="name">The name of the variable.</param>
 /// <param name="type">A string giving the type of the variable.</param>
 /// <param name="isPrimitive">Whether the type is a primitive data type.</param>
 /// <param name="splitter">An IdSplitter to split the name into words.</param>
 /// <param name="tagger">A part-of-speech tagger to tag the words in the name.</param>
 /// <param name="location">The program location of the variable declaration.</param>
 /// <param name="position">The position of this variable in the declaration list.</param>
 public VariableDeclarationNode(string name, string type, bool isPrimitive, IdSplitter splitter, Tagger tagger, Location location, int position)
     : this(name, splitter) {
     this.InitType(type, isPrimitive, splitter, tagger);
     //tagger.TagVariableName(this.ParsedName);
     this.SetLocation(location);
     this.Position = position;
 }
Ejemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        dbOps = DBOperations.Instance;
        links = Links.Instance;
        general = General.Instance;
        gui = GUIVariables.Instance;
        categories = Categories.Instance;
        engine = ProcessingEngine.Instance;
        imageEngine = ImageEngine.Instance;
        tagger = Tagger.Instance;
        log = Logger.Instance;

        seperator = gui.Seperator;

        //  QueryString Param Names.
        //  ratingID
        //  value

        string iid = string.Empty;
        string value = string.Empty;

        #region CookieAlreadyExists
        //  START: If a getputsCookie with the Username already exists, do not show the Login Page.

        if (Request.Cookies["getputsCookie"] != null)
        {
            HttpCookie getputsCookie = Request.Cookies["getputsCookie"];
            UID = dbOps.Decrypt(getputsCookie["UID"].ToString().Trim());
        }
        if (string.IsNullOrEmpty(UID))
        {

        }
        else
        {

        }
        //  END: If a getputsCookie with the Username already exists, do not show the Login Page.
        #endregion CookieAlreadyExists

        if (Request.QueryString != null && Request.QueryString.Count > 0)
        {
            //  ratingID is the Item IID.
            if (!string.IsNullOrEmpty(Request.QueryString["ratingID"]))
            {
                iid = Request.QueryString["ratingID"];
            }
            //  Value is the Rating given by the user. Value: [0, 1, 2, 3, 4]. So add +1 so as to convert Value: [1, 2, 3, 4, 5]
            if (!string.IsNullOrEmpty(Request.QueryString["value"]))
            {
                int intValue = -1;
                value = int.TryParse(Request.QueryString["value"], out intValue) ? (intValue + 1).ToString() : "-1";
            }
        }

        if (!string.IsNullOrEmpty(UID) && !string.IsNullOrEmpty(iid) && !string.IsNullOrEmpty(value))
        {
            UpdateRatings(UID, iid, value);
        }
    }
Ejemplo n.º 4
0
        /// <summary>
        /// Executes the command.
        /// </summary>
        /// <param name="tagInfo">
        /// The tag information.
        /// </param>
        public void Execute(ITagInfo tagInfo)
        {
            if (tagInfo == null)
                throw new ArgumentNullException("tagInfo");

            using (var tagger = new Tagger(tagInfo))
            {
                tagger.CreateTag();
            }
        }
Ejemplo n.º 5
0
 public void TaggerSelectChange(object tagger, bool selected) {
     Tagger TaggerObject = (Tagger)tagger;
     if (selected == true) {
         if (CurrentSelected != null) {
             CurrentSelected.DeSelectTagger();
         }
         CurrentSelected = TaggerObject;
         CurrentSelected.Focus();
         CurrentSelected.PreviewKeyDown += new PreviewKeyDownEventHandler(CurrentSelected_PreviewKeyDown);
     }
     if (selected == false) {
         CurrentSelected = null;
     }
 }
 public object ExecuteScalar(Tagger.Engine.DAL.Abstract.Query query)
 {
     return null;
 }
 public IQueryReader ExecuteReader(Tagger.Engine.DAL.Abstract.Query query)
 {
     return new DummyDBReader();
 }
Ejemplo n.º 8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //dbOps = DBOperations.Instance;
        //links = Links.Instance;
        //general = General.Instance;
        //gui = GUIVariables.Instance;
        //categories = Categories.Instance;
        //engine = ProcessingEngine.Instance;
        //imageEngine = ImageEngine.Instance;
        //tagger =Tagger.Instance;

        dbOps = DBOperations.Instance;
        links = Links.Instance;
        general = General.Instance;
        gui = GUIVariables.Instance;
        categories = Categories.Instance;
        engine = ProcessingEngine.Instance;
        imageEngine = ImageEngine.Instance;
        tagger = Tagger.Instance;
        itemDisplayer = ItemDisplayer.Instance;

        seperator = gui.Seperator;
        //  seperator = gui.BlueFontStart + " | " + gui.BlueFontEnd;

        if (!string.IsNullOrEmpty(Request.QueryString["startItem"]))
        {
            bool isStartItemInt = int.TryParse(Request.QueryString["startItem"].Trim(), out startItem);
            if (!isStartItemInt)
            {
                startItem = 0;
            }

            if (startItem < 0)
            {
                startItem = 0;
            }
        }
        else
        {
            startItem = 0;
        }

        if (!string.IsNullOrEmpty(Request.QueryString["sort"]))
        {
            string sortStr = Convert.ToString(Request.QueryString["sort"]);
            sort = engine.GetSortType(sortStr);
        }

        //if (!string.IsNullOrEmpty(Request.QueryString["layout"]))
        //{
        //    string layoutStr = Convert.ToString(Request.QueryString["layout"]);
        //    itemLayoutOptions = itemDisplayer.GetItemLayoutOptionsType(layoutStr);
        //}

        if (Request.Cookies["getputsLayoutCookie"] != null)
        {
            HttpCookie getputsLayoutCookie = Request.Cookies["getputsLayoutCookie"];
            itemLayoutOptions = itemDisplayer.GetItemLayoutOptionsType(dbOps.Decrypt(getputsLayoutCookie["layout"].ToString().Trim()));
        }

        #region CookieAlreadyExists
        //  START: If a getputsCookie with the Username already exists, do not show the Login Page.

        if (Request.Cookies["getputsCookie"] != null)
        {
            HttpCookie getputsCookie = Request.Cookies["getputsCookie"];
            UID = dbOps.Decrypt(getputsCookie["UID"].ToString().Trim());
        }
        if (string.IsNullOrEmpty(UID))
        {

        }
        else
        {

        }
        //  END: If a getputsCookie with the Username already exists, do not show the Login Page.
        #endregion CookieAlreadyExists

        List<Item> itemList = engine.LoadItemDB(sort);
        //  Using ASP.NET Controls.
        //  LoadItemTable(itemList);

        //  Using HTML
        ItemDisplayer.ShowItemsOptions itemOptions = ItemDisplayer.ShowItemsOptions.ShowUIDLink
            | ItemDisplayer.ShowItemsOptions.ShowTime
            | ItemDisplayer.ShowItemsOptions.ShowCategoryLink
            | ItemDisplayer.ShowItemsOptions.ShowSaveLink
            | ItemDisplayer.ShowItemsOptions.ShowEMailLink
            | ItemDisplayer.ShowItemsOptions.ShowCommentsLink
            | ItemDisplayer.ShowItemsOptions.ShowImage
            | ItemDisplayer.ShowItemsOptions.ShowRatings
            | ItemDisplayer.ShowItemsOptions.ShowTags
            | ItemDisplayer.ShowItemsOptions.CountClicks
            | ItemDisplayer.ShowItemsOptions.ShowPreviousNextLinks;

        string itemTable = itemDisplayer.LoadItemTable(itemList, itemOptions, itemLayoutOptions, startItem, UID, sort, links.FrontPageLink.Replace("~\\", ""));
        ItemDiv.InnerHtml = itemTable;

        //  Master Page ItemImage and ItemContent Carousels are invisble. Make them visible only for this page.
        Control MasterPageCarouselDiv = this.Master.FindControl("CarouselDiv");
        MasterPageCarouselDiv.Visible = true;
        Control MasterPageTopAboutTable = this.Master.FindControl("TopAboutTable");
        MasterPageTopAboutTable.Visible = true;

        //  List<Item> itemList = engine.LoadItemDB(ProcessingEngine.Sort.New);
        if (itemList != null && itemList.Count > 0)
        {
            LoadItemImageCarousel(itemList);
            LoadItemNewsCarousel(itemList);
        }

        //  Load Item Content Carousel JavaScript START
        //if (itemList != null && itemList.Count > 0)
        //{
        //    LoadItemNewsCarousel(itemList);
        //}
        //  Load Item Content Carousel JavaScript END
    }
Ejemplo n.º 9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        dbOps = DBOperations.Instance;
        links = Links.Instance;
        general = General.Instance;
        gui = GUIVariables.Instance;
        engine = ProcessingEngine.Instance;
        imageEngine = ImageEngine.Instance;
        categories = Categories.Instance;
        tagger = new Tagger();

        seperator = gui.Seperator;

        #region CookieAlreadyExists
        //  START: If a getputsCookie with the Username already exists, do not show the Login Page.

        if (Request.Cookies["getputsCookie"] != null)
        {
            HttpCookie getputsCookie = Request.Cookies["getputsCookie"];
            user = dbOps.Decrypt(getputsCookie["UID"].ToString().Trim());
        }
        if (string.IsNullOrEmpty(user))
        {
            //  Response.Redirect(links.LoginLink, false);
            MessageLabel.Text = gui.RedFontStart + "Please login to enter a comment." + gui.RedFontEnd;
        }
        else
        {

        }
        //  END: If a getputsCookie with the Username already exists, do not show the Login Page.
        #endregion CookieAlreadyExists

        if (string.IsNullOrEmpty(Request.QueryString["uid"]) || string.IsNullOrEmpty(Request.QueryString["iid"]) || string.IsNullOrEmpty(Request.QueryString["cid"]))
        {
            Response.Redirect(links.FrontPageLink, true);
        }
        else
        {
            uid = Request.QueryString["uid"].Trim();
            iid = Request.QueryString["iid"].Trim();
            cid = Request.QueryString["cid"].Trim();
        }

        if (!general.IsValidInt(iid) || !general.IsValidInt(cid) || !uid.Equals(user))
        {
            Response.Redirect(links.FrontPageLink, true);
        }
        else
        {
            string comment = LoadComment(uid, iid, cid);

            if (string.IsNullOrEmpty(comment))
            {
                Response.Redirect(links.FrontPageLink, true);
            }
            else
            {
                MessageLabel.Text = gui.GreenFontStart + "Your comment cannot be edited."
                    + gui.LineBreak + "However, you can append more details to your previous comment." + gui.GreenFontEnd;

                CurrentCommentLabel.Text = gui.GreenFontStart + "Your comment: " + gui.GreenFontEnd + gui.LineBreak + comment;
            }
        }
    }
Ejemplo n.º 10
0
 private void Number_Click(object sender, EventArgs e) {
     Tagger VarNum = new Tagger(new TaggerOnSelectChange(TaggerSelectChange), new TaggerOnCrossClick(TaggerCrossClick), 1);
     VarNum.Text = "Digit";
     VarNum.Font = new Font(new FontFamily("Segoe UI"), 8);
     VarNum.CrossSizeCorrection = -5;
     VarNum.CrossOffset = new Point(-2, 0);
     VarNum.Padding = new Padding(3, 4, 3, 3);
     StringCollection.Controls.Add(VarNum);
     count++;
     TagGroupList.Add(new Tuple<int, string>(VarNum.ID, VarNum.Text));
 }
            /// <summary>
            /// Do work on the data
            /// </summary>
            /// <param name="table">The datatable to read and edit</param>
            /// <param name="nav">XPathNavigator for column info</param>
            /// <returns>true if the edit was successful</returns>
            public Boolean EditShowInfo( ref DataTable table, XPathNavigator nav )
            {
                Int32 updatedRowCount = 0;
                Boolean DEBUG = false;

                // List to save the Series names and ID
                List<string> seriesNameList = new List<string>();
                List<string> formalNameList = new List<string>();
                List<string> seriesIDList = new List<string>();

                XmlTextReader reader;
                XmlDocument doc;
                string URLString;
                Boolean isTagged;

                progressForm = new Form();
                progressForm.Size = new System.Drawing.Size(400, 100);
                progressForm.Text = "TheTVDb.com Tagger";
                progressForm.StartPosition = FormStartPosition.CenterScreen;
                Label progressLabel = new Label();
                progressLabel.Size = new System.Drawing.Size(300, 50);
                progressForm.Controls.Add(progressLabel);
                progressForm.Show();

                int count = 0;
                foreach ( DataRow row in table.Rows ) {
                    count++;
                    Thread.Sleep(500);

                    // Parse filename to get Series name
                    Tagger tagger = new Tagger();

                    // Set variables
                    string seriesID;
                    string formalName;
                    bool isBTVshow = false;

                    if (DEBUG)
                        MessageBox.Show("Tagging: " + row["Name"].ToString());

                    // See if it is a native BTV Recording
                    double num;
                    bool isNum = double.TryParse(row["Channel"].ToString().Trim(), out num);
                    if (isNum)
                    {
                        if (DEBUG)
                            MessageBox.Show("BTV Native Recording");
                        isBTVshow = true;
                        tagger.seriesName = row["Title"].ToString();
                        tagger.originalAirDate = row["OriginalAirDate"].ToString().Insert(6, "-").Insert(4, "-");
                        tagger.seasonNumber = "0";
                        tagger.episodeNumber = "0";
                        isTagged = true;
                    }
                    else
                    {
                        if (DEBUG)
                            MessageBox.Show("Not a BTV Native Recording");
                        // Parse the filename
                        isTagged = tagger.tagFilename(row["Name"].ToString());
                    }

                    // Check if the tagging worked, otherwise, continue to the next item
                    if (!isTagged)
                    {
                        // Could not parse filename
                        // Ask user if they want to manually enter the show info
                        DialogResult retval = MessageBox.Show("Could not parse " + row["Name"].ToString() + "\nManually enter show info?", row["Name"].ToString(), MessageBoxButtons.YesNo);
                        if (retval == DialogResult.Yes)
                        {
                            // Get the info manually
                            tagger.seriesName = Interaction.InputBox("Enter Series Name", row["Name"].ToString(), null, 0, 0);
                            tagger.seasonNumber = Interaction.InputBox("Enter Season Number", row["Name"].ToString(), null, 0, 0);
                            tagger.episodeNumber = Interaction.InputBox("Enter Episode Number", row["Name"].ToString(), null, 0, 0);

                            // Check if the cancel button was hit or if it was empty
                            if (tagger.seriesName.Length == 0 || tagger.seasonNumber.Length == 0 || tagger.episodeNumber.Length == 0)
                                continue;
                        }
                        else
                        {
                            continue;
                        }
                    }

                    progressLabel.Text = "Tagging " + count + "/" + table.Rows.Count + ": " + row["Name"].ToString();

                    if (DEBUG)
                    {
                        MessageBox.Show("Title: " + tagger.seriesName);
                        MessageBox.Show("Season: " + tagger.seasonNumber);
                        MessageBox.Show("Episode: " + tagger.episodeNumber);
                    }

                    // Check array first
                    int indexOfShowInArray = seriesNameList.IndexOf(tagger.seriesName);
                    if (indexOfShowInArray != -1)
                    {
                        if (DEBUG)
                            MessageBox.Show(tagger.seriesName + " exists in memory");
                        formalName = formalNameList[indexOfShowInArray];
                        seriesID = seriesIDList[indexOfShowInArray];
                    }
                    else
                    {
                        // Search theTVDB.com API for the series ID
                        URLString = "http://www.thetvdb.com/api/GetSeries.php?seriesname=" + tagger.seriesName + "&language=en";
                        reader = new XmlTextReader(URLString);
                        doc = new XmlDocument();
                        try
                        {
                            doc.Load(reader);
                        }
                        catch (Exception e)
                        {
                            MessageBox.Show("Bad URL: " + URLString + "\nSkipping.", row["Name"].ToString());
                            continue;
                        }
                        reader.Close();

                        // Get the series name and the index in the XML if there are multiple
                        XmlNodeList seriesNamesList = doc.GetElementsByTagName("SeriesName");
                        int seriesCount = seriesNamesList.Count;
                        int seriesIndex = 0;
                        // Check if any items were found
                        if (seriesCount == 0)
                        {
                            formalName = "";
                            // Nothing found
                            // Ask user if they want to manually search for show name or skip
                            DialogResult retval = MessageBox.Show("Nothing found.  Search for show manually?", row["Name"].ToString(), MessageBoxButtons.YesNo);
                            if (retval == DialogResult.Yes)
                            {
                                Boolean searchError = false;
                                Boolean tryAgain = true;
                                // While the user wants to try, keep searching
                                while (tryAgain)
                                {
                                    // Get the new series name and save
                                    string newSeriesName = Interaction.InputBox("Enter Series Name", row["Name"].ToString(), null, 0, 0);

                                    // Search theTVDB.com API for the series ID
                                    URLString = "http://www.thetvdb.com/api/GetSeries.php?seriesname=" + newSeriesName + "&language=en";
                                    reader = new XmlTextReader(URLString);
                                    doc = new XmlDocument();
                                    try
                                    {
                                        doc.Load(reader);
                                    }
                                    catch (Exception e)
                                    {
                                        MessageBox.Show("Bad URL: " + URLString + "\nSkipping.", row["Name"].ToString());
                                        searchError = true;
                                        break;
                                    }
                                    reader.Close();

                                    // Get the series name and the index in the XML if there are multiple
                                    seriesNamesList = doc.GetElementsByTagName("SeriesName");
                                    seriesCount = seriesNamesList.Count;
                                    seriesIndex = 0;

                                    // Check if any items were found this time
                                    if (seriesCount == 0)
                                    {
                                        // Nothing found, try again?
                                        retval = MessageBox.Show("Nothing found.  Try again?", row["Name"].ToString(), MessageBoxButtons.YesNo);
                                        if (retval == DialogResult.No)
                                        {
                                            searchError = true;
                                            break;
                                        }
                                    }
                                    else if (seriesCount == 1)
                                    {
                                        // Only one show found, so assume this is it
                                        if (DEBUG)
                                            MessageBox.Show("Found: " + seriesNamesList.Item(0).InnerText);
                                        formalName = seriesNamesList.Item(0).InnerText;
                                        tryAgain = false;
                                    }
                                    else
                                    {
                                        // Found multiple shows, ask the user which one it is
                                        if (DEBUG)
                                            MessageBox.Show("Found multiple results");

                                        // Show a form with a combo box with the series available
                                        ComboBox comboBox = new ComboBox();
                                        comboBox.Location = new System.Drawing.Point(10, 40);
                                        comboBox.Size = new System.Drawing.Size(180, 150);
                                        for (int i = 0; i < seriesNamesList.Count; i++)
                                        {
                                            //Console.WriteLine((i + 1).ToString() + " :" + seriesNamesList.Item(i).InnerText);
                                            comboBox.Items.Add(seriesNamesList.Item(i).InnerText);
                                        }
                                        comboBox.SelectedIndex = 0;
                                        multipleListingsForm = new Form();
                                        multipleListingsForm.Text = "Select Series Name";
                                        multipleListingsForm.Size = new System.Drawing.Size(200, 140);
                                        multipleListingsForm.Controls.Add(comboBox);
                                        Button selectButton = new Button();
                                        Button skipButton = new Button();
                                        selectButton.Text = "Select";
                                        selectButton.Click += new System.EventHandler(this.selectButton_Click);
                                        selectButton.Location = new System.Drawing.Point(10, 70);
                                        selectButton.Size = new System.Drawing.Size(80, 30);
                                        skipButton.Text = "Skip";
                                        skipButton.Click += new System.EventHandler(this.skipButton_Click);
                                        skipButton.Location = new System.Drawing.Point(80, 70);
                                        skipButton.Size = new System.Drawing.Size(80, 30);
                                        Label label = new Label();
                                        label.Text = row["Name"].ToString();
                                        label.Location = new System.Drawing.Point(10, 10);
                                        label.Size = new System.Drawing.Size(180, 30);
                                        multipleListingsForm.Controls.Add(label);
                                        multipleListingsForm.Controls.Add(selectButton);
                                        multipleListingsForm.Controls.Add(skipButton);
                                        multipleListingsForm.StartPosition = FormStartPosition.CenterScreen;
                                        multipleListingsForm.ShowDialog();
                                        multipleListingsForm.Dispose();
                                        // Check if a series was selected or skipped
                                        seriesIndex = comboBox.SelectedIndex;
                                        if (!isSkip)
                                        {
                                            // Set the series name to the selected item
                                            formalName = seriesNamesList.Item(seriesIndex).InnerText;
                                            tryAgain = false;
                                        }
                                        else
                                            // Skip search
                                            searchError = true;
                                            break;
                                    }
                                }

                                // If there was an error in the manual search, skip
                                if (searchError)
                                    continue;
                            }
                            else
                            {
                                continue;
                            }
                        }
                        else if (seriesCount == 1)
                        {
                            // Only one show found, so assume this is it
                            if (DEBUG)
                                MessageBox.Show("Found: " + seriesNamesList.Item(0).InnerText);
                            formalName = seriesNamesList.Item(0).InnerText;
                        }
                        else
                        {
                            // Found multiple shows, ask the user which one it is
                            if (DEBUG)
                                MessageBox.Show("Found multiple results");

                            // Show a form with a combo box with the series available
                            ComboBox comboBox = new ComboBox();
                            comboBox.Location = new System.Drawing.Point(10, 40);
                            comboBox.Size = new System.Drawing.Size(180, 150);
                            for (int i = 0; i < seriesNamesList.Count; i++)
                            {
                                //Console.WriteLine((i + 1).ToString() + " :" + seriesNamesList.Item(i).InnerText);
                                comboBox.Items.Add(seriesNamesList.Item(i).InnerText);
                            }
                            comboBox.SelectedIndex = 0;
                            multipleListingsForm = new Form();
                            multipleListingsForm.Text = "Select Series Name";
                            multipleListingsForm.Size = new System.Drawing.Size(200, 140);
                            multipleListingsForm.Controls.Add(comboBox);
                            Button selectButton = new Button();
                            Button skipButton = new Button();
                            selectButton.Text = "Select";
                            selectButton.Click += new System.EventHandler(this.selectButton_Click);
                            selectButton.Location = new System.Drawing.Point(10, 70);
                            selectButton.Size = new System.Drawing.Size(80, 30);
                            skipButton.Text = "Skip";
                            skipButton.Click += new System.EventHandler(this.skipButton_Click);
                            skipButton.Location = new System.Drawing.Point(80, 70);
                            skipButton.Size = new System.Drawing.Size(80, 30);
                            Label label = new Label();
                            label.Text = row["Name"].ToString();
                            label.Location = new System.Drawing.Point(10, 10);
                            label.Size = new System.Drawing.Size(180, 30);
                            multipleListingsForm.Controls.Add(label);
                            multipleListingsForm.Controls.Add(selectButton);
                            multipleListingsForm.Controls.Add(skipButton);
                            multipleListingsForm.StartPosition = FormStartPosition.CenterScreen;
                            multipleListingsForm.ShowDialog();
                            multipleListingsForm.Dispose();
                            // Check if a series was selected or skipped
                            seriesIndex = comboBox.SelectedIndex;
                            if (!isSkip)
                            {
                                // Set the series name to the selected item
                                formalName = seriesNamesList.Item(seriesIndex).InnerText;
                            }
                            else
                                // Skip search
                                continue;
                        }

                        // Get series ID from the XML
                        XmlNodeList seriesIDXMLList = doc.GetElementsByTagName("seriesid");
                        seriesID = seriesIDXMLList.Item(seriesIndex).InnerText;
                        if (DEBUG)
                            MessageBox.Show("Using " + tagger.seriesName + " with TVDB_ID: " + seriesID);

                        // Store tagged name and series ID
                        seriesNameList.Add(tagger.seriesName);
                        formalNameList.Add(formalName);
                        seriesIDList.Add(seriesID);
                    }

                    // Should have the Series name at this point //

                    // First check if BTV Recorded Show and get the details
                    if (isBTVshow)
                    {
                        URLString = "http://www.thetvdb.com/api/8DB53EF83E7E8308/series/" +
                                     seriesID + "/all/en.xml";
                        if (DEBUG)
                            MessageBox.Show("URL: " + URLString);
                        reader = new XmlTextReader(URLString);
                        doc = new XmlDocument();
                        try
                        {
                            doc.Load(reader);
                        }
                        catch (Exception e)
                        {
                            MessageBox.Show("Bad URL: " + URLString + "\nSkipping.", row["Name"].ToString());
                            continue;
                        }
                        reader.Close();

                        // Get the episode list
                        XmlNodeList episodeList = doc.GetElementsByTagName("Episode");
                        int episodeCount = episodeList.Count;
                        if (DEBUG)
                            MessageBox.Show("Found " + episodeCount.ToString() + " episode(s)");
                        // Go through each episode and find if the original air date exists
                        string[] seasonSearch = new string[10];
                        string[] episodeSearch = new string[10];
                        string[] episodeNameSearch = new string[10];
                        int dateMatches = 0;
                        for (int i = 0; i < episodeCount; i++)
                        {
                            string dateSearch = episodeList.Item(i).SelectSingleNode("FirstAired").InnerText.ToString();
                            if (dateSearch == tagger.originalAirDate)
                            {
                                seasonSearch[dateMatches] = episodeList.Item(i).SelectSingleNode("SeasonNumber").InnerText.ToString();
                                episodeSearch[dateMatches] = episodeList.Item(i).SelectSingleNode("EpisodeNumber").InnerText.ToString();
                                episodeNameSearch[dateMatches] = episodeList.Item(i).SelectSingleNode("EpisodeName").InnerText.ToString();
                                if (DEBUG)
                                {
                                    MessageBox.Show("Found match to original air date: " + episodeNameSearch[dateMatches] + " S" + seasonSearch[dateMatches] + "E" + episodeSearch[dateMatches]);
                                }
                                dateMatches++;
                            }
                        }
                        if (DEBUG)
                            MessageBox.Show("Found " + dateMatches.ToString() + " matches");
                        // Found no matches
                        if (dateMatches <= 0)
                        {
                            DialogResult retval = MessageBox.Show("No match found for " + row["Name"].ToString() + " on " + tagger.originalAirDate + "\nManually enter show season and episode info?", row["Name"].ToString(), MessageBoxButtons.YesNo);
                            if (retval == DialogResult.Yes)
                            {
                                // Get the info manually
                                tagger.seasonNumber = Interaction.InputBox("Enter Season Number", row["Name"].ToString(), null, 0, 0);
                                tagger.episodeNumber = Interaction.InputBox("Enter Episode Number", row["Name"].ToString(), null, 0, 0);

                                // Check if the cancel button was hit or if it was empty
                                if (tagger.seasonNumber.Length == 0 || tagger.episodeNumber.Length == 0)
                                    continue;
                            }
                            else
                            {
                                continue;
                            }
                        }
                        // Found one match
                        else if (dateMatches == 1)
                        {
                            tagger.seasonNumber = seasonSearch[0];
                            tagger.episodeNumber = episodeSearch[0];
                        }
                        // Found multiple matches, ask user
                        else
                        {
                            // Show a form with a combo box with the episodes available
                            ComboBox comboBox = new ComboBox();
                            comboBox.Location = new System.Drawing.Point(10, 40);
                            comboBox.Size = new System.Drawing.Size(180, 150);
                            for (int i = 0; i < dateMatches; i++)
                            {
                                comboBox.Items.Add("Season: " + seasonSearch[i] + ", Episode: " + episodeSearch[i] + ", " + episodeNameSearch[i]);
                            }
                            comboBox.SelectedIndex = 0;
                            multipleListingsForm = new Form();
                            multipleListingsForm.Text = "Select Episode";
                            multipleListingsForm.Size = new System.Drawing.Size(200, 140);
                            multipleListingsForm.Controls.Add(comboBox);
                            Button selectButton = new Button();
                            Button skipButton = new Button();
                            selectButton.Text = "Select";
                            selectButton.Click += new System.EventHandler(this.selectButton_Click);
                            selectButton.Location = new System.Drawing.Point(10, 70);
                            selectButton.Size = new System.Drawing.Size(80, 30);
                            skipButton.Text = "Skip";
                            skipButton.Click += new System.EventHandler(this.skipButton_Click);
                            skipButton.Location = new System.Drawing.Point(80, 70);
                            skipButton.Size = new System.Drawing.Size(80, 30);
                            Label label = new Label();
                            label.Text = row["Name"].ToString();
                            label.Location = new System.Drawing.Point(10, 10);
                            label.Size = new System.Drawing.Size(180, 30);
                            multipleListingsForm.Controls.Add(label);
                            multipleListingsForm.Controls.Add(selectButton);
                            multipleListingsForm.Controls.Add(skipButton);
                            multipleListingsForm.StartPosition = FormStartPosition.CenterScreen;
                            multipleListingsForm.ShowDialog();
                            multipleListingsForm.Dispose();
                            // Check if a series was selected or skipped
                            int episodeIndex = comboBox.SelectedIndex;
                            if (!isSkip)
                            {
                                // Set the series name to the selected item
                                tagger.seasonNumber = seasonSearch[episodeIndex];
                                tagger.episodeNumber = episodeSearch[episodeIndex];
                            }
                            else
                                // Skip search
                                continue;
                        }
                    }

                    // Get episode info from TheTVDB.com API
                    URLString = "http://www.thetvdb.com/api/8DB53EF83E7E8308/series/" +
                                seriesID + "/default/" + tagger.seasonNumber + "/" + tagger.episodeNumber + "/en.xml";
                    if (DEBUG)
                        MessageBox.Show("URL: " + URLString);
                    reader = new XmlTextReader(URLString);
                    doc = new XmlDocument();
                    try
                    {
                        doc.Load(reader);
                    }
                    catch (Exception e)
                    {
                        MessageBox.Show("Bad URL: " + URLString + "\nSkipping.", row["Name"].ToString());
                        continue;
                    }
                    reader.Close();

                    // Set series name
                    row["Title"] = formalName;

                    // Set Episode Name
                    string episodeName = doc.GetElementsByTagName("EpisodeName").Item(0).InnerText;
                    row["EpisodeTitle"] = episodeName;
                    if (DEBUG)
                        MessageBox.Show("Episode Name: " + episodeName);

                    // Set Episode Date
                    string firstAired = doc.GetElementsByTagName("FirstAired").Item(0).InnerText;
                    row["ActualStart"] = firstAired;
                    row["OriginalAirDate"] = firstAired.Replace("-", "");
                    if (DEBUG)
                        MessageBox.Show("Episode Aired: " + firstAired);

                    // Set Episode Overview
                    string overview = doc.GetElementsByTagName("Overview").Item(0).InnerText;
                    if (DEBUG)
                        MessageBox.Show("Overview: " + overview);
                    // Append Series and Episode number to the beginning
                    if (tagger.seasonNumber.Length == 1 && tagger.episodeNumber.Length == 1)
                        overview = "S0" + tagger.seasonNumber + "E0" + tagger.episodeNumber + " - " + overview;
                    else if (tagger.seasonNumber.Length == 1 && tagger.episodeNumber.Length == 2)
                        overview = "S0" + tagger.seasonNumber + "E" + tagger.episodeNumber + " - " + overview;
                    else if (tagger.seasonNumber.Length == 2 && tagger.episodeNumber.Length == 1)
                        overview = "S" + tagger.seasonNumber + "E0" + tagger.episodeNumber + " - " + overview;
                    else
                        overview = "S" + tagger.seasonNumber + "E" + tagger.episodeNumber + " - " + overview;
                    row["EpisodeDescription"] = overview;

                    updatedRowCount++;
                    Thread.Sleep(500);
                    progressForm.Update();
                }
                progressForm.Close();

                return ( updatedRowCount > 0 );
            }
Ejemplo n.º 12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        dbOps = DBOperations.Instance;
        links = Links.Instance;
        general = General.Instance;
        gui = GUIVariables.Instance;
        engine = ProcessingEngine.Instance;
        categories = Categories.Instance;
        tokenizer = Tokenizer.Instance;
        tagger =Tagger.Instance;
        imageEngine = ImageEngine.Instance;
        log = Logger.Instance;

        spamDetection = (SpamDetection)Application["spamDetection"];

        #region CookieAlreadyExists
        //  START: If a getputsCookie with the Username already exists, do not show the Login Page.

        if (Request.Cookies["getputsCookie"] != null)
        {
            HttpCookie getputsCookie = Request.Cookies["getputsCookie"];
            UID = dbOps.Decrypt(getputsCookie["UID"].ToString().Trim());
        }
        if (string.IsNullOrEmpty(UID))
        {
            Response.Redirect(links.LoginLink, false);
        }
        //  END: If a getputsCookie with the Username already exists, do not show the Login Page.
        #endregion CookieAlreadyExists

        StringBuilder explanationSB = new StringBuilder();

        explanationSB.Append(gui.GreenFontStart);
        explanationSB.Append(gui.BoldFontStart);

        explanationSB.Append("Posting News has never been this easy!");
        explanationSB.Append(gui.LineBreak);

        explanationSB.Append(gui.HTMLTab + "(1) Copy and Paste the Link of the news/webpage you want to Post.");
        explanationSB.Append(gui.LineBreak);
        explanationSB.Append(gui.HTMLTab + "(2) Click on the \"Get Title\" Button to automatically get the Title,");
        explanationSB.Append(gui.LineBreak);
        explanationSB.Append(gui.HTMLTab + "OR, Write a Descriptive Title.");
        explanationSB.Append(gui.LineBreak);
        explanationSB.Append(gui.HTMLTab + "(3) Select an appropriate Category.");
        explanationSB.Append(gui.LineBreak);
        explanationSB.Append("And you are done!");
        explanationSB.Append(gui.LineBreak);

        explanationSB.Append(gui.BoldFontEnd);
        explanationSB.Append(gui.GreenFontEnd);

        explanationSB.Append(gui.LineBreak);
        explanationSB.Append(gui.LineBreak);

        explanationSB.Append("If submitting a link, keep the text section empty.");
        explanationSB.Append(gui.LineBreak);
        explanationSB.Append("If submitting text, keep the link section empty.");
        explanationSB.Append(gui.LineBreak);
        explanationSB.Append("If there is a link, the text section will be ignored.");

        ExplanationLabel.Text = explanationSB.ToString();

        AddTags();

        //  For the Bookmarklet.
        //  Check the Tools.aspx page for matching the Title/Link parameters.
        if (!string.IsNullOrEmpty(Request.QueryString["title"]) && !string.IsNullOrEmpty(Request.QueryString["url"]))
        {
            TitleTB.Text = Request.QueryString["title"].Trim();
            LinkTB.Text = Request.QueryString["url"];
        }

        //  If not using ReCaptcha Project, but using the Captcha Library.
        //if (!IsPostBack)
        //{
        //    HttpContext.Current.Session["CaptchaImageText"] = general.GenerateRandomCode();
        //    //  log.Log("Inside !IsPostBack : " + HttpContext.Current.Session["CaptchaImageText"].ToString());
        //}
    }
Ejemplo n.º 13
0
 /// <summary>
 /// Creates a new TypeNode.
 /// </summary>
 /// <param name="name">The name of the type.</param>
 /// <param name="isPrimitive">Whether the type is a primitive data type.</param>
 /// <param name="splitter">An IdSplitter to split the type name into words.</param>
 /// <param name="tagger">A Tagger to tag the parts-of-speech of each word of the name.</param>
 public TypeNode(string name, bool isPrimitive, IdSplitter splitter, Tagger tagger)
     : this(name, isPrimitive, splitter, tagger, Location.None) { }
Ejemplo n.º 14
0
 /// <summary>
 /// Creates a TypeNode from a string version of the type, and set it to the Type property.
 /// </summary>
 /// <param name="typeName">A string version of the variable's type.</param>
 /// <param name="isPrimitive">Whether the type is a primitive data type.</param>
 /// <param name="splitter">An IdSplitter to split the type into words.</param>
 /// <param name="tagger">A Tagger to tag the parts-of-speech of the type words.</param>
 protected virtual void InitType(string typeName, bool isPrimitive, IdSplitter splitter, Tagger tagger) {
     this.Type = new TypeNode(typeName, isPrimitive, splitter, tagger);
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Creates a new VariableDeclarationNode.
 /// </summary>
 /// <param name="name">The name of the variable.</param>
 /// <param name="type">A string giving the type of the variable.</param>
 /// <param name="isPrimitive">Whether the type is a primitive data type.</param>
 /// <param name="splitter">An IdSplitter to split the name into words.</param>
 /// <param name="tagger">A part-of-speech tagger to tag the words in the name.</param>
 /// <param name="location">The program location of the variable declaration.</param>
 public VariableDeclarationNode(string name, string type, bool isPrimitive, IdSplitter splitter, Tagger tagger, Location location)
     : this(name, type, isPrimitive, splitter, tagger, location, 0) { }
Ejemplo n.º 16
0
    //  ItemDisplayer.ItemLayoutOptions itemLayoutOptions = ItemDisplayer.ItemLayoutOptions.Columns;
    //  ItemDisplayer.ItemLayoutOptions itemLayoutOptions = ItemDisplayer.ItemLayoutOptions.Categorized;
    protected void Page_Load(object sender, EventArgs e)
    {
        dbOps = DBOperations.Instance;
        links = Links.Instance;
        general = General.Instance;
        gui = GUIVariables.Instance;
        categories = Categories.Instance;
        engine = ProcessingEngine.Instance;
        imageEngine = ImageEngine.Instance;
        tagger = Tagger.Instance;
        itemDisplayer = ItemDisplayer.Instance;

        seperator = gui.Seperator;

        if (!string.IsNullOrEmpty(Request.QueryString["tag"]))
        {
            tag = Request.QueryString["tag"].Trim();
        }
        else
        {
            Response.Redirect(links.FrontPageLink, true);
        }

        if (!string.IsNullOrEmpty(Request.QueryString["startItem"]))
        {
            bool isStartItemInt = int.TryParse(Request.QueryString["startItem"].Trim(), out startItem);
            if (!isStartItemInt)
            {
                startItem = 0;
            }

            if (startItem < 0)
            {
                startItem = 0;
            }
        }
        else
        {
            startItem = 0;
        }

        if (!string.IsNullOrEmpty(Request.QueryString["sort"]))
        {
            string sortStr = Convert.ToString(Request.QueryString["sort"]);
            sort = engine.GetSortType(sortStr);
        }

        if (Request.Cookies["getputsLayoutCookie"] != null)
        {
            HttpCookie getputsLayoutCookie = Request.Cookies["getputsLayoutCookie"];
            itemLayoutOptions = itemDisplayer.GetItemLayoutOptionsType(dbOps.Decrypt(getputsLayoutCookie["layout"].ToString().Trim()));
        }

        #region CookieAlreadyExists
        //  START: If a getputsCookie with the Username already exists, do not show the Login Page.

        if (Request.Cookies["getputsCookie"] != null)
        {
            HttpCookie getputsCookie = Request.Cookies["getputsCookie"];
            UID = dbOps.Decrypt(getputsCookie["UID"].ToString().Trim());
        }
        if (string.IsNullOrEmpty(UID))
        {

        }
        else
        {

        }
        //  END: If a getputsCookie with the Username already exists, do not show the Login Page.
        #endregion CookieAlreadyExists

        List<Item> itemList = GetSimilarlyTaggedItems(tag);
        if (itemList != null && itemList.Count > 0)
        {
            //  LoadItemTable(itemList);

            ItemDisplayer.ShowItemsOptions itemOptions = ItemDisplayer.ShowItemsOptions.ShowUIDLink
            | ItemDisplayer.ShowItemsOptions.ShowTime
            | ItemDisplayer.ShowItemsOptions.ShowCategoryLink
            | ItemDisplayer.ShowItemsOptions.ShowSaveLink
            | ItemDisplayer.ShowItemsOptions.ShowEMailLink
            | ItemDisplayer.ShowItemsOptions.ShowCommentsLink
            | ItemDisplayer.ShowItemsOptions.ShowImage
            | ItemDisplayer.ShowItemsOptions.ShowRatings
            | ItemDisplayer.ShowItemsOptions.ShowTags
            | ItemDisplayer.ShowItemsOptions.CountClicks
            | ItemDisplayer.ShowItemsOptions.ShowPreviousNextLinks;

            string itemTable = itemDisplayer.LoadItemTable(itemList, itemOptions, itemLayoutOptions, startItem, UID, sort, links.AutoTagPageLink.Replace("~\\", "") + "?tag=" + tag);
            ItemDiv.InnerHtml = itemTable;

            MessageLabel.Text = gui.GreenFontStart + "Items automatically tagged with the tag: " + gui.GreenFontEnd + tag;
        }
        else
        {
            MessageLabel.Text = gui.GreenFontStart + "No items carry the tag: " + gui.GreenFontEnd + tag;
        }
    }
Ejemplo n.º 17
0
 /// <summary>
 /// Assigns the attributes of this field related to its structure within the program.
 /// </summary>
 /// <param name="splitter">An IdSplitter to split the words of identifiers.</param>
 /// <param name="tagger">A part-of-speech tagger</param>
 public void AssignStructuralInformation(IdSplitter splitter, Tagger tagger) {
     this.Type = new TypeNode(Context.IdType, Context.IdTypeIsPrimitive, splitter, tagger);
     this.DeclaringClass = new TypeNode(Context.DeclaringClass, false, splitter, tagger);
 }
Ejemplo n.º 18
0
 private void UserInputName_Click(object sender, EventArgs e) {
     Tagger NameSelected = new Tagger(new TaggerOnSelectChange(TaggerSelectChange), new TaggerOnCrossClick(TaggerCrossClick), 1);
     UserStringPopUp NameString = new UserStringPopUp();
     NameString.ShowDialog();
     if (NameString.UserString == null || NameString.UserString.Length == 0) {
         return;
     }
     NameSelected.Text = NameString.UserString;
     count++;
     NameSelected.Font = new Font(new FontFamily("Segoe UI"), 8);
     NameSelected.CrossSizeCorrection = -5;
     NameSelected.CrossOffset = new Point(-2, 0);
     NameSelected.Padding = new Padding(3, 4, 3, 3);
     NameFinalPanel.Controls.Add(NameSelected);
     FinalString.Add(new Tuple<int, int, string>(0, 1, NameSelected.Text));
     NameString.Close();
 }
Ejemplo n.º 19
0
 private void NotAlphabet_Click(object sender, EventArgs e) {
     Tagger NotAlphabet = new Tagger(new TaggerOnSelectChange(TaggerSelectChange), new TaggerOnCrossClick(TaggerCrossClick), 4);
     NotAlphabet.Text = "Not Alphabet";
     NotAlphabet.Font = new Font(new FontFamily("Segoe UI"), 8);
     NotAlphabet.CrossSizeCorrection = -5;
     NotAlphabet.CrossOffset = new Point(-2, 0);
     NotAlphabet.Padding = new Padding(3, 4, 3, 3);
     StringCollection.Controls.Add(NotAlphabet);
     count++;
     TagGroupList.Add(new Tuple<int, string>(NotAlphabet.ID, NotAlphabet.Text));
 }
Ejemplo n.º 20
0
 private void OKButton_Click(object sender, EventArgs e) {
     Tagger AddSelected = new Tagger(new TaggerOnSelectChange(TaggerSelectChange), new TaggerOnCrossClick(TaggerCrossClick), 1);
     AddSelected.Text = "|" + AttributeDropDown.SelectedItem.ToString() + "|";
     count++;
     AddSelected.Font = new Font(new FontFamily("Segoe UI"), 8);
     AddSelected.CrossSizeCorrection = -5;
     AddSelected.CrossOffset = new Point(-2, 0);
     AddSelected.Padding = new Padding(3, 4, 3, 3);
     NameFinalPanel.Controls.Add(AddSelected);
     FinalString.Add(new Tuple<int, int, string>(0, 1, AddSelected.Text));
 }
Ejemplo n.º 21
0
 private void String_Click(object sender, EventArgs e) {
     StringPopUp stringform = new StringPopUp();
     stringform.ShowDialog();
     if (stringform.UserInputString == null) {
         return;
     }
     Tagger UserInput = new Tagger(new TaggerOnSelectChange(TaggerSelectChange), new TaggerOnCrossClick(TaggerCrossClick), 0);
     UserInput.Text = stringform.UserInputString;
     UserInput.Font = new Font(new FontFamily("Segoe UI"), 8);
     UserInput.CrossSizeCorrection = -5;
     UserInput.CrossOffset = new Point(-2, 0);
     UserInput.Padding = new Padding(3, 4, 3, 3);
     StringCollection.Controls.Add(UserInput);
     count++;
     TagGroupList.Add(new Tuple<int, string>(UserInput.ID, UserInput.Text));
     stringform.Close();
 }
Ejemplo n.º 22
0
 private void NameButton_Click(object sender, EventArgs e) {
     Tagger NameSelected = new Tagger(new TaggerOnSelectChange(TaggerSelectChange), new TaggerOnCrossClick(TaggerCrossClick), 0);
     Button temp = (Button)sender;
     NameSelected.Text = temp.Text;
     count++;
     NameSelected.Font = new Font(new FontFamily("Segoe UI"), 8);
     NameSelected.CrossSizeCorrection = -5;
     NameSelected.CrossOffset = new Point(-2, 0);
     NameSelected.Padding = new Padding(3, 4, 3, 3);
     NameFinalPanel.Controls.Add(NameSelected);
     int index = GroupNumberedString.FindIndex(t => t.Item3 == NameSelected.Text);
     FinalString.Add(new Tuple<int, int, string>(GroupNumberedString[index].Item1, GroupNumberedString[index].Item2, GroupNumberedString[index].Item3));
 }
Ejemplo n.º 23
0
        //TODO: should this be a separate function, or integrated into the constructor? This occurs in other nodes as well
        /// <summary>
        /// Initializes the fields containing structural information about the method. This includes the location, return type and parameters.
        /// </summary>
        /// <param name="splitter">An IdSplitter to split the method name into words.</param>
        /// <param name="tagger">A Tagger to tag the parts-of-speech of the name.</param>
        /// <exception cref="System.ArgumentNullException">splitter is null.</exception>
        /// <exception cref="System.ArgumentNullException">tagger is null.</exception>
        /// <exception cref="System.InvalidOperationException">Context property is not set.</exception>
        public void AssignStructuralInformation(IdSplitter splitter, Tagger tagger) {
            if(splitter == null) { throw new ArgumentNullException("splitter"); }
            if(tagger == null) { throw new ArgumentNullException("tagger"); }
            if(this.Context == null) { throw new InvalidOperationException("Context property must be set prior to calling AssignStructuralInformation"); }

            this.ParsedName.SetLocation(Location.Name);
            if(!string.IsNullOrEmpty(Context.IdType)) {
                this.ReturnType = new TypeNode(Context.IdType, Context.IdTypeIsPrimitive, splitter, tagger, Location.Return);
            }
            if(!string.IsNullOrEmpty(Context.DeclaringClass)) {
                this.DeclaringClass = new TypeNode(Context.DeclaringClass, false, splitter, tagger, Location.OnClass);
            }

            this.FormalParameters = new List<VariableDeclarationNode>();
            if(Context.FormalParameters.Count > 0) {
                int pos = 0;
                foreach(FormalParameterRecord paramRecord in Context.FormalParameters) {
                    this.FormalParameters.Add(new VariableDeclarationNode(paramRecord.Name, paramRecord.ParameterType, paramRecord.IsPrimitiveType, splitter, tagger, Location.Formal, pos));
                    pos++;
                }
            }
        }
Ejemplo n.º 24
0
    //  ItemDisplayer.ItemLayoutOptions itemLayoutOptions = ItemDisplayer.ItemLayoutOptions.Columns;
    //  ItemDisplayer.ItemLayoutOptions itemLayoutOptions = ItemDisplayer.ItemLayoutOptions.Categorized;
    protected void Page_Load(object sender, EventArgs e)
    {
        DirectContactButton.Visible = false;

        dbOps = DBOperations.Instance;
        links = Links.Instance;
        general = General.Instance;
        gui = GUIVariables.Instance;
        engine = ProcessingEngine.Instance;
        imageEngine = ImageEngine.Instance;
        categories = Categories.Instance;
        tagger = Tagger.Instance;
        itemDisplayer = ItemDisplayer.Instance;

        seperator = gui.Seperator;

        #region CookieAlreadyExists
        //  START: If a getputsCookie with the Username already exists, do not show the Login Page.

        if (Request.Cookies["getputsCookie"] != null)
        {
            HttpCookie getputsCookie = Request.Cookies["getputsCookie"];
            user = dbOps.Decrypt(getputsCookie["UID"].ToString().Trim());
        }
        if (string.IsNullOrEmpty(user))
        {
            //  Response.Redirect(links.LoginLink, false);
            MessageLabel.Text = gui.RedFontStart + "Please login to enter a comment." + gui.RedFontEnd;
        }
        else
        {

        }
        //  END: If a getputsCookie with the Username already exists, do not show the Login Page.
        #endregion CookieAlreadyExists

        if (string.IsNullOrEmpty(Request.QueryString["IID"]))
        {
            Response.Redirect(links.FrontPageLink, false);
        }
        else
        {
            iid = Request.QueryString["IID"].Trim().ToLower();
        }

        if (!general.IsValidInt(iid))
        {

        }
        else
        {
            LoadItemDetails(iid);
            LoadComments(iid);
        }
    }
 public int ExecuteCommand(Tagger.Engine.DAL.Abstract.Query query)
 {
     return 0;
 }
Ejemplo n.º 26
0
        private void HandleTreeViewSelectedItemChangedV3(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            try
            {
                if (Tagger == null)
                {
                    return;
                }

                if (Tokens4 != null || e.NewValue is Antlr4.Runtime.Tree.IParseTree)
                {
                    return;
                }

                using (Tagger.Update())
                {
                    Tagger.RemoveTagSpans(tagSpan => true);

                    if (Snapshot == null)
                    {
                        return;
                    }

                    CommonTree selected = e.NewValue as CommonTree;

                    IList <IToken> tokens = Tokens3;
                    if (tokens != null && selected != null)
                    {
                        if (selected.TokenStartIndex >= 0 && selected.TokenStopIndex >= 0)
                        {
                            IToken startToken = tokens[selected.TokenStartIndex];
                            IToken stopToken  = tokens[selected.TokenStopIndex];
                            Span   span       = new Span(startToken.StartIndex, stopToken.StopIndex - startToken.StartIndex + 1);
                            Span   sourceSpan = new Span(0, Snapshot.Length);
                            if (sourceSpan.Contains(span))
                            {
                                ITrackingSpan trackingSpan = Snapshot.CreateTrackingSpan(span, SpanTrackingMode.EdgeExclusive);
                                Tagger.CreateTagSpan(trackingSpan, PredefinedTextMarkerTags.Vivid);
                                var activeView = ActiveViewTrackerService.ActiveView;
                                if (activeView != null && activeView.TextBuffer == Snapshot.TextBuffer)
                                {
                                    activeView.ViewScroller.EnsureSpanVisible(new SnapshotSpan(Snapshot, span), EnsureSpanVisibleOptions.ShowStart);
                                }
                            }
                        }
                    }
                    else if (selected != null && selected.Token != null)
                    {
                        if (selected.Token.StartIndex >= 0 && selected.Token.StopIndex >= 0)
                        {
                            IToken token      = selected.Token;
                            Span   span       = new Span(token.StartIndex, token.StopIndex - token.StartIndex + 1);
                            Span   sourceSpan = new Span(0, Snapshot.Length);
                            if (sourceSpan.Contains(span))
                            {
                                ITrackingSpan trackingSpan = Snapshot.CreateTrackingSpan(span, SpanTrackingMode.EdgeExclusive);
                                Tagger.CreateTagSpan(trackingSpan, PredefinedTextMarkerTags.Vivid);
                                var activeView = ActiveViewTrackerService.ActiveView;
                                if (activeView != null && activeView.TextBuffer == Snapshot.TextBuffer)
                                {
                                    activeView.ViewScroller.EnsureSpanVisible(new SnapshotSpan(Snapshot, span), EnsureSpanVisibleOptions.ShowStart);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                if (ErrorHandler.IsCriticalException(ex))
                {
                    throw;
                }
            }
        }