Summary description for ImageEngine
Exemplo n.º 1
0
        private void CategoryDetailForm_Load(object sender, EventArgs e)
        {
            try
            {
                LocalizedCategoryNameTableAdapter localizedCategoryNameAdapter = new LocalizedCategoryNameTableAdapter();
                localizedCategoryNameAdapter.Fill(this.categoryDetailDataSet.LocalizedCategoryName, categoryId, cultureName);

                if (categoryId > 0)
                {
                    CategoryTableAdapter categoryAdapter = new CategoryTableAdapter();
                    categoryAdapter.Fill(this.categoryDetailDataSet.Category, categoryId);
                }

                byte[] image = this.categoryDetailDataSet.Category.Rows[0]["Image"] as byte[];
                if (image != null)
                {
                    this.pictureBoxImage.Image = ImageEngine.Resize(ImageEngine.FromArray(image), this.pictureBoxImage.Size);
                }

                EnableButtons();
            }
            catch (Exception ex)
            {
                ReportError(ex.Message.ToString());
                this.DialogResult = DialogResult.Abort;
                this.Close();
            }
        }
Exemplo n.º 2
0
        private void TextDetailForm_Load(object sender, EventArgs e)
        {
            if (_textRow != null)
            {
                if (!_textRow.IsSymbolIdNull())
                {
                    if (!_textRow.SymbolRow.IsImageNull())
                    {
                        Image image = ImageEngine.FromArray(_textRow.SymbolRow.Image);

                        if (image.Width <= pictureBox1.Width && image.Height <= pictureBox1.Height)
                        {
                            pictureBox1.Image = image;
                        }
                        else
                        {
                            ResizeImage(image);
                        }
                    }

                    if (!_textRow.SymbolRow.IsSoundNull())
                    {
                        menuItemPlaySound.Enabled = true;
                    }
                }

                this.Text = _textRow.Name;

                labelDescription.Text = _textRow.Descripton;

                menuItemSpeak.Enabled = (_textRow.Descripton.Length > 0);
            }
        }
Exemplo n.º 3
0
        public void ShouldGetAPersonList()
        {
            //Arrange
            //Todo: How to fix person dependency in order to get random profile images and lorem ipsum text of names ?
            PersonEngine     personEngine = new PersonEngine();
            ImageEngine      imageEngine  = new ImageEngine(new LoremPixelProvider());
            LoremIpsumEngine textEngine   = new LoremIpsumEngine(new PersonNamesProvider());

            string[] text = textEngine.Create(1).AsParagraph().Split(' ');


            //Act
            List <Person> personList = personEngine.Create(1);

            //Assert

            List <Person> testList = new List <Person> {
                new Person {
                    FirstName = text[0], LastName = text[1], Image = imageEngine.Create()
                }
            };


            Assert.AreEqual(testList, personList);
        }
Exemplo n.º 4
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);
        }
    }
Exemplo n.º 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        links = Links.Instance;
        gui = GUIVariables.Instance;
        dbOps = DBOperations.Instance;
        categories = Categories.Instance;
        log = Logger.Instance;
        engine = ProcessingEngine.Instance;
        general = General.Instance;
        imageEngine = ImageEngine.Instance;

        seperator = gui.Seperator;

        if (string.IsNullOrEmpty(Request.QueryString["UID"]))
        {

        }
        else
        {
            queryStringUID = Request.QueryString["UID"].Trim().ToLower();
        }

        if (string.IsNullOrEmpty(queryStringUID))
        {

        }
        else
        {
            LoadComments(queryStringUID);
        }
    }
Exemplo n.º 6
0
        public static MemoryStream OverlayAndPickDetailed(MemoryStream sourceStream, int width = 128, int height = 128)
        {
            WriteableBitmap source = new WriteableBitmap(UsefulThings.WPF.Images.CreateWPFBitmap(sourceStream));
            WriteableBitmap dest   = new WriteableBitmap(source.PixelWidth, source.PixelHeight, source.DpiX, source.DpiY, System.Windows.Media.PixelFormats.Bgra32, source.Palette);

            // KFreon: Write onto black
            var overlayed = Overlay(dest, source);


            // KFreon: Choose the most detailed image between one with alpha merged and one without.
            JpegBitmapEncoder enc = new JpegBitmapEncoder();

            enc.QualityLevel = 90;
            enc.Frames.Add(BitmapFrame.Create(overlayed));

            MemoryStream mstest = new MemoryStream();
            {
                enc.Save(mstest);

                MemoryStream jpg = ImageEngine.GenerateThumbnailToStream(sourceStream, width, height, false);
                {
                    enc = new JpegBitmapEncoder();
                    enc.Frames.Add(BitmapFrame.Create(new WriteableBitmap(UsefulThings.WPF.Images.CreateWPFBitmap(jpg))));
                    enc.Save(jpg);

                    MemoryStream largest = jpg.Length > mstest.Length ? jpg : mstest;
                    return(largest);
                }
            }
        }
Exemplo n.º 7
0
        private void ActivityDetailForm_Load(object sender, EventArgs e)
        {
            DataRowView view = this.BindingContext[adaScheduleDataSet1, ACTIVITY_TABLE].Current as DataRowView;

            ADAScheduleDataSet.ActivityRow activityRow = view.Row as ADAScheduleDataSet.ActivityRow;

            if (!activityRow.IsSymbolIdNull())
            {
                if (!activityRow.SymbolRow.IsImageNull())
                {
                    byte[] image = activityRow.SymbolRow.Image;
                    this.pictureBoxImage.Image = ImageEngine.Resize(ImageEngine.FromArray(image), this.pictureBoxImage.Size);
                }
            }

            ADAScheduleDataSet.Activity_ReminderRow[] activityReminderRows = activityRow.GetActivity_ReminderRows();

            foreach (ADAScheduleDataSet.Activity_ReminderRow activityReminderRow in activityReminderRows)
            {
                if (!activityReminderRow.IsTimeNull() &&
                    activityReminderRow.ReminderId == ADADataAccess.Constants.ALARM_REMINDER_ID)
                {
                    this.dateTimePickerAlarm.Value = activityReminderRow.Time;
                    _alarmTimeSpan = activityReminderRow.Time - activityRow.EndTime;
                }
            }

            buttonPlaySound.Enabled = (!activityRow.IsSymbolIdNull() && !activityRow.SymbolRow.IsSoundNull());
        }
Exemplo n.º 8
0
        public static string GenerateThumbnail(string filename, int WhichGame, int expID, string pathBIOGame, string savepath, string execpath)
        {
            ITexture2D tex2D = CreateTexture2D(filename, expID, WhichGame, pathBIOGame);

            using (MemoryStream ms = new MemoryStream(tex2D.GetImageData()))
                ImageEngine.GenerateThumbnailToFile(ms, savepath, 128);
            return(savepath);
        }
Exemplo n.º 9
0
        private void ShowScenarios()
        {
            ADAMobileDataSet.ScenarioRow lastScenarioRow = null;

            if (_scenarioRow != null)
            {
                lastScenarioRow = _scenarioRow;
                _scenarioRow    = null;
            }

            symbolListView1.Items.Clear();

            DataRow[] dataRows = adaScenarioDataSet1.Scenario.Select("", "Name ASC");
            int       count    = dataRows.Length;

            int selectedScenario = (count > 0 ? 0 : -1);

            for (int i = 0; i < count; i++)
            {
                ADAMobileDataSet.ScenarioRow  row  = dataRows[i] as ADAMobileDataSet.ScenarioRow;
                SymbolListView.SymbolListItem item = new SymbolListView.SymbolListItem();

                if (!row.IsSymbolIdNull())
                {
                    if (!row.SymbolRow.IsImageNull())
                    {
                        item.Image = ImageEngine.FromArray(row.SymbolRow.Image);
                    }

                    if (!row.SymbolRow.IsSoundNull())
                    {
                        item.Sound = row.SymbolRow.Sound;
                    }
                }

                item.Text = row.Name;

                symbolListView1.Items.Add(item);

                if (lastScenarioRow == row)
                {
                    selectedScenario = i;
                }
            }

            if (selectedScenario >= 0)
            {
                symbolListView1.SelectedIndex = selectedScenario;
            }

            menuItemSelect.Text = "Select";

            this.Text = "Select Scenario";
            symbolListView1.Invalidate();
            symbolListView1.Focus();

            EnablePrevNextPageMenuItems();
        }
Exemplo n.º 10
0
        private void ShowWorkSystem(ADAMobileDataSet.ScheduleRow scheduleRow)
        {
            int scheduleId = scheduleRow.ScheduleId;

            _scheduleRow = scheduleRow;

            symbolListView1.Items.Clear();

            DataRow[] dataRows        = adaScheduleDataSet1.Activity.Select("ScheduleId=" + scheduleId, "Sequence ASC");
            int       count           = dataRows.Length;
            int       currentActivity = -1;

            for (int i = 0; i < count; i++)
            {
                ADAMobileDataSet.ActivityRow  activityRow = dataRows[i] as ADAMobileDataSet.ActivityRow;
                SymbolListView.SymbolListItem item        = new SymbolListView.SymbolListItem();

                bool isExecuted = (!activityRow.IsExecutionStartNull() && !activityRow.IsExecutionEndNull());

                item.Checked = isExecuted;

                if (currentActivity < 0)
                {
                    if (!isExecuted)
                    {
                        currentActivity = i;
                    }
                }

                if (!activityRow.IsSymbolIdNull())
                {
                    if (activityRow.SymbolRow != null && !activityRow.SymbolRow.IsImageNull())
                    {
                        item.Image = ImageEngine.FromArray(activityRow.SymbolRow.Image);
                    }

                    if (activityRow.SymbolRow != null && !activityRow.SymbolRow.IsSoundNull())
                    {
                        item.Sound = activityRow.SymbolRow.Sound;
                    }
                }

                item.Text = string.Format("{0}:{1}", activityRow.Sequence, activityRow.Name);

                symbolListView1.Items.Add(item);
            }

            symbolListView1.SelectedIndex = currentActivity;
            symbolListView1.Invalidate();
            menuItemCurrent.Enabled = (currentActivity >= 0);

            menuItemCurrent.Text = "Current";

            this.Text = scheduleRow.Name;

            EnablePrevNextPageMenuItems();
        }
Exemplo n.º 11
0
 private void buttonCopyImage_Click(object sender, EventArgs e)
 {
     if (this.pictureBoxImage.Image != null)
     {
         DataRowView view  = this.BindingContext[categoryDetailDataSet, CATEGORY].Current as DataRowView;
         byte[]      image = view.Row["Image"] as byte[];
         Clipboard.SetImage(ImageEngine.FromArray(image));
     }
 }
Exemplo n.º 12
0
        private void ActivityDetailForm_Load(object sender, EventArgs e)
        {
            if (_activityRow != null)
            {
                if (!_activityRow.IsSymbolIdNull())
                {
                    if (!_activityRow.SymbolRow.IsImageNull())
                    {
                        Image image = ImageEngine.FromArray(_activityRow.SymbolRow.Image);

                        if (image.Width <= pictureBox1.Width && image.Height <= pictureBox1.Height)
                        {
                            pictureBox1.Image = image;
                        }
                        else
                        {
                            ResizeImage(image);
                        }
                    }

                    if (!_activityRow.SymbolRow.IsSoundNull())
                    {
                        menuItemPlaySound.Enabled = true;
                    }
                }

                this.Text = _activityRow.Name;

                StringBuilder sb = new StringBuilder();

                if (_activityRow.IsExecutionStartNull())
                {
                    sb.Append("Not Started");
                }
                else if (_activityRow.IsExecutionEndNull())
                {
                    sb.Append("Started");
                }
                else
                {
                    sb.Append("Finished");
                }

                labelDescription.Text = sb.ToString();

                if (_isCurrentActivity)
                {
                    menuItemStart.Enabled = true;

                    if (!_activityRow.IsExecutionStartNull())
                    {
                        menuItemStart.Text = AdaWorkSystemPpc.Properties.Resources.MenuStop;
                    }
                }
            }
        }
Exemplo n.º 13
0
        public void StartService()
        {
            Log.Message(LogLevel.Info, "[OnStart] - Starting service...");
            _cancellationTokenSource = new CancellationTokenSource();
            var outputPath = ConfigurationManager.AppSettings["OutputPath"];

            _imageEngine = new ImageEngine(_cancellationTokenSource.Token, outputPath);
            _imageEngine.Start();
            Log.Message(LogLevel.Info, "[OnStart] - Started service.");
        }
Exemplo n.º 14
0
        private void buttonChangeSymbol_Click(object sender, EventArgs e)
        {
            DataRowView view = this.BindingContext[adaCommunicatorDataSet1, TEXT_TABLE].Current as DataRowView;

            ADACommunicatorDataSet.TextRow textRow = view.Row as ADACommunicatorDataSet.TextRow;

            SymbolPicker picker = new SymbolPicker();

            SymbolDataSet.LocalizedSymbolRow symbolRow = picker.PickSymbol(this,
                                                                           textRow.IsSymbolIdNull() ? -1 : textRow.SymbolId);

            if (symbolRow != null)
            {
                if (adaCommunicatorDataSet1.Symbol.FindBySymbolId(symbolRow.SymbolId) == null)
                {
                    ADACommunicatorDataSet.SymbolRow newRow = adaCommunicatorDataSet1.Symbol.NewSymbolRow();
                    newRow.SymbolId = symbolRow.SymbolId;

                    if (!symbolRow.IsSoundNull())
                    {
                        newRow.Sound = symbolRow.Sound;
                    }

                    if (!symbolRow.IsImageNull())
                    {
                        newRow.Image = symbolRow.Image;
                    }

                    adaCommunicatorDataSet1.Symbol.AddSymbolRow(newRow);
                    adaCommunicatorDataSet1.Symbol.AcceptChanges();
                }

                byte[] image = symbolRow.Image;
                if (image != null)
                {
                    this.pictureBoxImage.Image = ImageEngine.Resize(ImageEngine.FromArray(image), this.pictureBoxImage.Size);
                }

                buttonPlaySound.Enabled = !symbolRow.IsSoundNull();

                this.BindingContext[adaCommunicatorDataSet1, TEXT_TABLE].EndCurrentEdit();

                view.BeginEdit();
                if (textRow.IsNameNull() || textRow.Name.Length == 0)
                {
                    textRow.Name = symbolRow.Name;
                }
                if (textRow.IsDescriptonNull() || textRow.Descripton.Length == 0)
                {
                    textRow.Descripton = textRow.Name;
                }
                textRow.SymbolId = symbolRow.SymbolId;
                view.EndEdit();
            }
        }
Exemplo n.º 15
0
        private Image CreatePicture(Image image)
        {
            Image orginalImage = ImageEngine.Resize(image, image.Size);

            DataRowView view = this.BindingContext[categoryDetailDataSet, CATEGORY].Current as DataRowView;

            view.BeginEdit();
            view.Row["Image"] = ImageEngine.ToArray(orginalImage);
            view.EndEdit();

            return(ImageEngine.Resize(image, this.pictureBoxImage.Size));
        }
Exemplo n.º 16
0
        /// <summary>
        /// Ensures all Mipmaps are generated in MipMaps.
        /// </summary>
        /// <param name="MipMaps">MipMaps to check.</param>
        /// <returns>Number of mipmaps present in MipMaps.</returns>
        internal static int BuildMipMaps(List <MipMap> MipMaps)
        {
            if (MipMaps?.Count == 0)
            {
                return(0);
            }

            MipMap currentMip = MipMaps[0];

            // KFreon: Check if mips required
            int estimatedMips = DDSGeneral.EstimateNumMipMaps(currentMip.Width, currentMip.Height);

            if (MipMaps.Count > 1)
            {
                return(estimatedMips);
            }

            // KFreon: Half dimensions until one == 1.
            MipMap[] newmips = new MipMap[estimatedMips];

            // TODO: Component size - pixels
            //var baseBMP = UsefulThings.WPF.Images.CreateWriteableBitmap(currentMip.Pixels, currentMip.Width, currentMip.Height);
            //baseBMP.Freeze();

            Action <int> action = new Action <int>(item =>
            {
                int index = item;
                MipMap newmip;
                var scale = 1d / (2 << (index - 1));  // Shifting is 2^index - Math.Pow seems extraordinarly slow.
                //newmip = ImageEngine.Resize(baseBMP, scale, scale, currentMip.Width, currentMip.Height, currentMip.LoadedFormatDetails);
                newmip             = ImageEngine.Resize(currentMip, scale, scale);
                newmips[index - 1] = newmip;
            });

            // Start at 1 to skip top mip
            if (ImageEngine.EnableThreading)
            {
                Parallel.For(1, estimatedMips + 1, new ParallelOptions {
                    MaxDegreeOfParallelism = ImageEngine.NumThreads
                }, action);
            }
            else
            {
                for (int item = 1; item < estimatedMips + 1; item++)
                {
                    action(item);
                }
            }

            MipMaps.AddRange(newmips);
            return(MipMaps.Count);
        }
Exemplo n.º 17
0
        private void ShowTextButtons(ADAMobileDataSet.ScenarioRow scenarioRow)
        {
            int scenarioId = scenarioRow.ScenarioId;

            _scenarioRow = scenarioRow;

            symbolListView1.Items.Clear();

            DataRow[] dataRows = adaScenarioDataSet1.Text.Select("ScenarioId=" + scenarioId, "Name ASC");
            int       count    = dataRows.Length;

            for (int i = 0; i < count; i++)
            {
                ADAMobileDataSet.TextRow      textRow = dataRows[i] as ADAMobileDataSet.TextRow;
                SymbolListView.SymbolListItem item    = new SymbolListView.SymbolListItem();

                if (!textRow.IsSymbolIdNull())
                {
                    if (!textRow.SymbolRow.IsImageNull())
                    {
                        item.Image = ImageEngine.FromArray(textRow.SymbolRow.Image);
                    }

                    if (!textRow.SymbolRow.IsSoundNull())
                    {
                        item.Sound = textRow.SymbolRow.Sound;
                    }
                }

                item.Text = textRow.Name;

                symbolListView1.Items.Add(item);
            }

            if (count > 0)
            {
                symbolListView1.SelectedIndex = 0;
            }

            symbolListView1.Invalidate();
            symbolListView1.Focus();

            menuItemSelect.Text = "Detail";

            this.Text = scenarioRow.Name;

            EnablePrevNextPageMenuItems();
        }
Exemplo n.º 18
0
        private void buttonChangeSymbol_Click(object sender, EventArgs e)
        {
            DataRowView view = this.BindingContext[adaScheduleDataSet1, ACTIVITY_TABLE].Current as DataRowView;

            ADAScheduleDataSet.ActivityRow activityRow = view.Row as ADAScheduleDataSet.ActivityRow;

            SymbolPicker picker = new SymbolPicker();

            SymbolDataSet.LocalizedSymbolRow symbolRow = picker.PickSymbol(this,
                                                                           activityRow.IsSymbolIdNull() ? -1 : activityRow.SymbolId);

            if (symbolRow != null)
            {
                if (adaScheduleDataSet1.Symbol.FindBySymbolId(symbolRow.SymbolId) == null)
                {
                    ADAScheduleDataSet.SymbolRow newRow = adaScheduleDataSet1.Symbol.NewSymbolRow();
                    newRow.SymbolId = symbolRow.SymbolId;

                    if (!symbolRow.IsSoundNull())
                    {
                        newRow.Sound = symbolRow.Sound;
                    }

                    if (!symbolRow.IsImageNull())
                    {
                        newRow.Image = symbolRow.Image;
                    }

                    adaScheduleDataSet1.Symbol.AddSymbolRow(newRow);
                }

                byte[] image = symbolRow.Image;
                if (image != null)
                {
                    this.pictureBoxImage.Image = ImageEngine.Resize(ImageEngine.FromArray(image), this.pictureBoxImage.Size);
                }

                buttonPlaySound.Enabled = !symbolRow.IsSoundNull();

                this.BindingContext[adaScheduleDataSet1, ACTIVITY_TABLE].EndCurrentEdit();

                view.BeginEdit();
                activityRow.Name     = symbolRow.Name;
                activityRow.SymbolId = symbolRow.SymbolId;
                activityRow.Image    = image;
                view.EndEdit();
            }
        }
Exemplo n.º 19
0
        public static string GenerateThumbnail(Stream sourceStream, string savePath, int maxWidth, int maxHeight)
        {
            using (MemoryStream stream = ImageEngine.GenerateThumbnailToStream(sourceStream, maxWidth, maxHeight, false, true))
            {
                if (stream == null)
                {
                    return(null);
                }

                using (MemoryStream largest = OverlayAndPickDetailed(stream, maxWidth, maxHeight))
                    using (FileStream fs = new FileStream(savePath, FileMode.Create))
                        largest.WriteTo(fs);

                return(savePath);
            }
        }
Exemplo n.º 20
0
        private void ActivityDetailForm_Load(object sender, EventArgs e)
        {
            DataRowView view = this.BindingContext[adaWorkSystemDataSet1, ACTIVITY_TABLE].Current as DataRowView;

            ADAWorkSystemDataSet.ActivityRow activityRow = view.Row as ADAWorkSystemDataSet.ActivityRow;

            if (!activityRow.IsSymbolIdNull())
            {
                if (!activityRow.SymbolRow.IsImageNull())
                {
                    byte[] image = activityRow.SymbolRow.Image;
                    this.pictureBoxImage.Image = ImageEngine.Resize(ImageEngine.FromArray(image), this.pictureBoxImage.Size);
                }
            }

            buttonPlaySound.Enabled = (!activityRow.IsSymbolIdNull() && !activityRow.SymbolRow.IsSoundNull());
        }
Exemplo n.º 21
0
        private void WorkSystemDetail_Load(object sender, EventArgs e)
        {
            DataRowView view = this.BindingContext[adaWorkSystemDataSet1, SCHEDULE_TABLE].Current as DataRowView;

            ADAWorkSystemDataSet.ScheduleRow scheduleRow = view.Row as ADAWorkSystemDataSet.ScheduleRow;

            if (!scheduleRow.IsSymbolIdNull())
            {
                if (!scheduleRow.SymbolRow.IsImageNull())
                {
                    byte[] image = scheduleRow.SymbolRow.Image;
                    this.pictureBoxImage.Image = ImageEngine.Resize(ImageEngine.FromArray(image), this.pictureBoxImage.Size);
                }
            }

            buttonPlaySound.Enabled = (!scheduleRow.IsSymbolIdNull() && !scheduleRow.SymbolRow.IsSoundNull());
        }
Exemplo n.º 22
0
        private void ScenarioDetailForm_Load(object sender, EventArgs e)
        {
            DataRowView view = this.BindingContext[adaCommunicatorDataSet1, SCENARIO_TABLE].Current as DataRowView;

            ADACommunicatorDataSet.ScenarioRow scenarioRow = view.Row as ADACommunicatorDataSet.ScenarioRow;

            if (!scenarioRow.IsSymbolIdNull())
            {
                if (!scenarioRow.SymbolRow.IsImageNull())
                {
                    byte[] image = scenarioRow.SymbolRow.Image;
                    this.pictureBoxImage.Image = ImageEngine.Resize(ImageEngine.FromArray(image), this.pictureBoxImage.Size);
                }
            }

            buttonPlaySound.Enabled = (!scenarioRow.IsSymbolIdNull() && !scenarioRow.SymbolRow.IsSoundNull());
        }
Exemplo n.º 23
0
        private void ShowModels()
        {
            _scheduleRow = null;
            symbolListView1.Items.Clear();

            DataRow[] dataRows = adaScheduleDataSet1.Schedule.Select("Type = " + (int)ScheduleType.WorkSystemModel, "Name ASC");
            int       count    = dataRows.Length;

            for (int i = 0; i < count; i++)
            {
                ADAMobileDataSet.ScheduleRow  row  = dataRows[i] as ADAMobileDataSet.ScheduleRow;
                SymbolListView.SymbolListItem item = new SymbolListView.SymbolListItem();

                if (!row.IsSymbolIdNull())
                {
                    if (!row.SymbolRow.IsImageNull())
                    {
                        item.Image = ImageEngine.FromArray(row.SymbolRow.Image);
                    }

                    if (!row.SymbolRow.IsSoundNull())
                    {
                        item.Sound = row.SymbolRow.Sound;
                    }
                }

                item.Text = row.Name;

                symbolListView1.Items.Add(item);
            }

            if (count > 0)
            {
                symbolListView1.SelectedIndex = 0;
            }

            menuItemCurrent.Enabled = (count > 0);
            menuItemCurrent.Text    = "View";

            this.Text = "Select Work System";
            symbolListView1.Invalidate();

            EnablePrevNextPageMenuItems();
        }
Exemplo n.º 24
0
        private void ResizeImage(Image image)
        {
            int    width, height;
            double widthRatio  = (double)image.Width / pictureBox1.Width;
            double heightRatio = (double)image.Height / pictureBox1.Height;

            if (widthRatio > heightRatio)
            {
                width  = pictureBox1.Width;
                height = (int)(image.Height / widthRatio);
            }
            else
            {
                width  = (int)(image.Width / heightRatio);
                height = pictureBox1.Height;
            }

            pictureBox1.Image = ImageEngine.Resize(image, new Size(width, height));
        }
Exemplo n.º 25
0
        /// <summary>
        /// Constructor for tree texture object.
        /// </summary>
        /// <param name="temppcc">PCC to get info from.</param>
        /// <param name="ExpID">ExpID of texture.</param>
        /// <param name="WhichGame">Game target.</param>
        /// <param name="pathBIOGame">BIOGame path to game targeted.</param>
        /// <param name="ExecPath">Path to ME3Explorer \exec\ folder.</param>
        /// <param name="allfiles">List of all PCC's containing texture.</param>
        /// <param name="Success">OUT: True if sucessfully created.</param>
        public TreeTexInfo(IPCCObject temppcc, int ExpID, int WhichGame, string pathBIOGame, string ExecPath, out bool Success)
        {
            Success = false;
            CRC32      crcgen    = new CRC32();
            string     ArcPath   = pathBIOGame;
            ITexture2D temptex2D = null;

            if (temppcc.Exports[ExpID].ValidTextureClass())
            {
                try { temptex2D = temppcc.CreateTexture2D(ExpID, pathBIOGame); }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    return;
                }

                // KFreon:  If no images, ignore
                if (temptex2D.imgList.Count == 0)
                {
                    return;
                }


                string texname = temptex2D.texName;

                IImageInfo tempImg = temptex2D.GenerateImageInfo();
                uint       hash    = 0;



                /*if (WhichGame != 1 && temptex2D.arcName != "None")
                 *  ValidFirstPCC = true;*/



                // KFreon: Add pcc name to list in tex2D if necessary

                /*if (temptex2D.allFiles == null || temptex2D.allFiles.Count == 0)
                 * {
                 *  temptex2D.allFiles = new List<string>();
                 *  temptex2D.allFiles.Add(temppcc.pccFileName);
                 * }
                 * else if (!temptex2D.allFiles.Contains(temppcc.pccFileName))
                 *  temptex2D.allFiles.Add(temppcc.pccFileName);*/

                // KFreon: Get texture hash
                if (tempImg.CompareStorage("pccSto"))
                {
                    if (temptex2D.texFormat != "PF_NormalMap_HQ")
                    {
                        hash = ~crcgen.BlockChecksum(temptex2D.DumpImg(tempImg.imgSize, ArcPath));
                    }
                    else
                    {
                        hash = ~crcgen.BlockChecksum(temptex2D.DumpImg(tempImg.imgSize, pathBIOGame), 0, tempImg.uncSize / 2);
                    }
                }
                else
                {
                    byte[] buffer = temptex2D.DumpImg(tempImg.imgSize, ArcPath);
                    if (buffer == null)
                    {
                        hash = 0;
                    }
                    else
                    {
                        if (temptex2D.texFormat != "PF_NormalMap_HQ")
                        {
                            hash = ~crcgen.BlockChecksum(buffer);
                        }
                        else
                        {
                            hash = ~crcgen.BlockChecksum(buffer, 0, tempImg.uncSize / 2);
                        }
                    }
                }

                // KFreon: Get image thumbnail
                string thumbnailPath = ExecPath + "placeholder.ico";
                string tempthumbpath = ExecPath + "ThumbnailCaches\\" + "ME" + WhichGame + "ThumbnailCache\\" + texname + "_" + hash + ".jpg";
                bool   exists        = File.Exists(tempthumbpath);
                if (!exists)
                {
                    try
                    {
                        using (MemoryStream ms = new MemoryStream(temptex2D.GetImageData()))
                            if (ImageEngine.GenerateThumbnailToFile(ms, tempthumbpath, 128))
                            {
                                thumbnailPath = tempthumbpath;
                            }
                    }
                    catch { }  // KFreon: Don't really care about failures
                }
                // KFreon: Initialise things
                ValidFirstPCC = WhichGame == 2 && (!String.IsNullOrEmpty(temptex2D.arcName) && temptex2D.arcName != "None");
                InfoInitialise(temptex2D, ExpID, hash, WhichGame, temppcc, tempImg.offset, thumbnailPath, pathBIOGame);
                Success = true;
            }
        }
Exemplo n.º 26
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;

        seperator = gui.Seperator;

        if (string.IsNullOrEmpty(Request.QueryString["IID"]))
        {
            EMailDiv.Visible = false;
            ItemTitleLabel.Text = "No such item found.";
        }
        else
        {
            iid = Request.QueryString["IID"].Trim().ToLower();
        }

        if (!general.IsValidInt(iid))
        {
            EMailDiv.Visible = false;
        }
        else
        {
            item = new Item();

            string queryString = "SELECT Title, Link, Text, Date, UID, NComments, Category FROM item WHERE IID=" + iid + ";";
            MySqlDataReader retList;

            retList = dbOps.ExecuteReader(queryString);

            if (retList != null && retList.HasRows)
            {
                while (retList.Read())
                {
                    item.IID = Convert.ToInt32(iid);
                    item.UID = Convert.ToString(retList["UID"]);
                    item.Title = Convert.ToString(retList["Title"]);
                    item.Link = Convert.ToString(retList["Link"]);
                    item.Text = Convert.ToString(retList["Text"]);
                    item.Date = Convert.ToString(retList["Date"]);
                    item.NComments = Convert.ToInt32(retList["NComments"]);
                    item.Category = Convert.ToString(retList["Category"]);

                    if (!string.IsNullOrEmpty(item.Link))
                    {
                        item.Text = string.Empty;
                    }
                }
                retList.Close();
            }
            ItemTitleLabel.Text = "Title: " + gui.GrayFontStart + item.Title + gui.GrayFontEnd;
        }

        #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))
        {

        }
        else
        {

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

        //  If the user has logged in, populate the 'EMail From' TextBox.
        //  The variable 'user' = Logged in User.

        EMailOutputMessageLabel.Text = string.Empty;
        if (!string.IsNullOrEmpty(user))
        {
            string queryString = "SELECT EMail FROM user WHERE UID='" + user + "';";
            MySqlDataReader retList = dbOps.ExecuteReader(queryString);
            if (retList != null && retList.HasRows)
            {
                while (retList.Read())
                {
                    FromTB.Text = Convert.ToString(retList["EMail"]);
                }
                retList.Close();
            }
        }

        //  If not using ReCaptcha Project, but using the Captcha Library.
        //if (!IsPostBack)
        //{
        //    HttpContext.Current.Session["CaptchaImageText"] = general.GenerateRandomCode();
        //}
    }
Exemplo n.º 27
0
 public void Setup()
 {
     _loremIpsumImageProvider = new LoremPixelProvider();
     _imageGalleryEngine      = new ImageEngine(_loremIpsumImageProvider);
 }
Exemplo n.º 28
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;
        itemDisplayer = ItemDisplayer.Instance;

        seperator = gui.Seperator;

        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))
        {
            Response.Redirect(links.LoginLink, false);
        }
        else
        {
            MessageLabel.Text = gui.GreenFontStart + UID + "'s Saved Items" + gui.GreenFontEnd;
        }
        //  END: If a getputsCookie with the Username already exists, do not show the Login Page.
        #endregion CookieAlreadyExists

        LoadItemDB(sort);
    }
Exemplo n.º 29
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());
        //}
    }
Exemplo n.º 30
0
    protected override void OnInit(EventArgs e)
    {
        try
        {
            links = Links.Instance;
            gui = GUIVariables.Instance;
            dbOps = DBOperations.Instance;
            categories = Categories.Instance;
            log = Logger.Instance;
            engine = ProcessingEngine.Instance;
            general = General.Instance;
            imageEngine = ImageEngine.Instance;
            gui = GUIVariables.Instance;
            itemDisplayer = ItemDisplayer.Instance;

            if (Request != null)
            {
                if (!string.IsNullOrEmpty(Request.QueryString["category"]))
                {
                    requestedTag = Request.QueryString["category"].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());
            }

            //TopAboutLabel.Text = "getputs is a utility for discovering, sharing and recommending user generated content."
            //    + gui.LineBreak
            //    + "Read/Post the latest/hottest news and classified submissions, ask queries, discuss your views!";

            TopAboutLabel.Text = gui.GrayFontStart
                + "getputs is a utility for discovering, sharing, and recommending news."
                + gui.GrayFontEnd;

            if (string.IsNullOrEmpty(UID))
            {
                TopAboutTable.Visible = true;

                //  If the Page is SLogin.aspx, then the LoginTable will not be visible.
                //  Else it is going to be visible in anycase.
                //  LoginTable.Visible = true;

                UsernameTB.Focus();
                Page.Form.DefaultButton = LoginButton.ID;

                //LoginHL.Visible = true;
                //RegisterHL.Visible = true;

                //  SubmitHL.Visible = false;
                SubmitHL.Visible = true;
                SavedHL.Visible = false;
                UserAccountHL.Visible = false;
                MyNewsHL.Visible = false;

                LogoutHL.Visible = false;

                UserWelcomeLabel.Text = "";

                PostItDiv.Visible = true;

            }
            else
            {
                TopAboutTable.Visible = false;

                LoginTable.Visible = false;

                //LoginHL.Visible = false;
                //RegisterHL.Visible = false;

                SubmitHL.Visible = true;
                SavedHL.Visible = true;
                UserAccountHL.Visible = true;
                MyNewsHL.Visible = true;

                LogoutHL.Visible = true;
                UserAccountHL.NavigateUrl = links.UserDetailsPageLink + "?UID=" + UID;

                //  UserWelcomeLabel.Text = gui.GrayFontStart + "Welcome " + UID + gui.GrayFontEnd;
                UserWelcomeLabel.Text = gui.BoldFontStart + gui.GreenFontStart + "Welcome " + UID + gui.GreenFontEnd + gui.BoldFontEnd;

                PostItDiv.Visible = false;

                //  Vatsal Shah | 2009-08-08 | LogVisitor() Throws a lot of errors. Thus commented for now.
                //  LogVisitor(UID);
            }

            //  PopularCategoriesLabel.Visible = false;
            //  CategoryDiv.Visible = false;
            //  MoreHL.Visible = false;

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

            RandomNewsHL.Text = gui.BlueFontStart + "Bored? " + gui.BlueFontEnd
                //  + gui.LineBreak
                + gui.GreenFontStart + "Read random stuff" + gui.GreenFontEnd;

            CopyrightLabel.Text = gui.SmallFontStart + gui.GrayFontStart
                + copyrightText
                + gui.GrayFontEnd + gui.SmallFontEnd;

            #region RandomQuoteFact
            Random randomQuoteFact = new Random();
            int randomQuoteFactInt = randomQuoteFact.Next(0, 100);

            if (randomQuoteFactInt % 2 == 0)    //  Serve Facts
            {
                gp.Files.FileLoader.FilePath = HttpRuntime.AppDomainAppPath + ConfigurationManager.AppSettings["FilesPath"];
                string randomFact = gp.Files.FactDB.Instance.GetRandomFact();
                if (!string.IsNullOrEmpty(randomFact))
                {
                    QuoteFactLiteral.Text = gui.BoldFontStart + gui.GreenFontStart + "getputs Fact: " + gui.GreenFontEnd + gui.BoldFontEnd + gui.LineBreak
                        + gui.GrayFontStart + randomFact + gui.GrayFontEnd;
                }
            }
            else    //  Serve Quotes
            {
                gp.Files.FileLoader.FilePath = HttpRuntime.AppDomainAppPath + ConfigurationManager.AppSettings["FilesPath"];
                string randomQuote = gp.Files.QuoteDB.Instance.GetRandomQuote();
                if (!string.IsNullOrEmpty(randomQuote))
                {
                    randomQuote = randomQuote.Replace("|", gui.LineBreak + " - <i>") + "</i>";
                    QuoteFactLiteral.Text = gui.BoldFontStart + gui.GreenFontStart + "getputs Quote: " + gui.GreenFontEnd + gui.BoldFontEnd + gui.LineBreak
                        + gui.GrayFontStart + randomQuote + gui.GrayFontEnd;
                }
            }
            #endregion RandomQuoteFact

            #region RandomTip

            gp.Files.FileLoader.FilePath = HttpRuntime.AppDomainAppPath + ConfigurationManager.AppSettings["FilesPath"];
            string randomTip = gp.Files.TipsDB.Instance.GetRandomTip();
            if (!string.IsNullOrEmpty(randomTip))
            {
                //  TipLiteral.Text = gui.MediumFontStart + gui.GrayFontStart + randomTip + gui.GrayFontEnd + gui.MediumFontEnd;
                TipLiteral.Text = randomTip;
            }

            #endregion RandomTip

            GetNavigationTableURL();
            LoadCategoryTable(UID);
            AddMouseEffects();

            //  Load the Carousels only for the Front-Page (Default.aspx)
            //  For all other pages CarouselDiv would be invisible.
            CarouselDiv.Visible = false;
            //  Make the TopAboutTable Invisible for any page other than the Front-Page (Default.aspx)
            TopAboutTable.Visible = false;

            StringBuilder strScript = new StringBuilder();
            strScript.Append("var itemImageList = [];");
            strScript.Append("var itemContentList = [];");
            Page.ClientScript.RegisterClientScriptBlock(GetType(), "CarouselJavaScript", strScript.ToString(), true);

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

            ////  string pagename = System.IO.Path.GetFileName(Request.ServerVariables["SCRIPT_NAME"]);
            //string pagename = Path.GetFileName(System.Web.HttpContext.Current.Request.Url.AbsolutePath);
            //if (links.FrontPageLink.EndsWith(pagename))     //  Load the Carousels only for the Front-Page (Default.aspx)
            //{
            //    List<Item> itemList = engine.LoadItemDB(ProcessingEngine.Sort.New);
            //    if (itemList != null && itemList.Count > 0)
            //    {
            //        LoadItemImageCarousel(itemList);
            //        LoadItemNewsCarousel(itemList);
            //    }

            //}
            //else    //  Do not show the CarouselDiv.
            //{
            //    CarouselDiv.Visible = false;

            //    //  Instantiate Empty JavaScriptLists so as to avoid Client Side Exceptions.
            //    StringBuilder strScript = new StringBuilder();
            //    strScript.Append("var itemImageList = [];");
            //    strScript.Append("var itemContentList = [];");
            //    Page.ClientScript.RegisterClientScriptBlock(GetType(), "CarouselJavaScript", strScript.ToString(), true);

            //    //  Make the TopAboutTable Invisible for any page other than the Front-Page (Default.aspx)
            //    TopAboutTable.Visible = false;
            //}

            //  SearchTB.Attributes.Add("onkeypress", "if ((event.which ? event.which : event.keyCode) == 13){var sendElem = document.getElementById(\"SearchButton\"); if(!sendElem.disabled) DoSearch(); }");
            //  SearchTB.Attributes.Add("onkeypress", "if ((event.which ? event.which : event.keyCode) == 13){document.getElementById('SearchButton').click()}");
            //  SearchTB.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('" + SearchButton.ID + "').click();return false;}} else {return true}; ");

        }
        catch (Exception ex)
        {
            if (log.isLoggingOn && log.isAppLoggingOn)
            {
                log.Log("Error in getputs.master: OnInit() Method: ");
                log.Log(ex);
            }
        }
    }
Exemplo n.º 31
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);
        }
    }
Exemplo n.º 32
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;
        itemDisplayer = ItemDisplayer.Instance;

        seperator = gui.Seperator;

        MyAccountLink.Visible = false;

        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))
        {
            Response.Redirect(links.FrontPageLink, false);
        }
        else
        {
            string queryString = "SELECT PreferredCategories FROM user WHERE UID='" + UID + "';";
            MySqlDataReader retList = dbOps.ExecuteReader(queryString);

            string prefferedCategoriesStr = string.Empty;
            if (retList != null && retList.HasRows)
            {
                while (retList.Read())
                {
                    prefferedCategoriesStr = Convert.ToString(retList["PreferredCategories"]);
                }
                retList.Close();
            }

            if (string.IsNullOrEmpty(prefferedCategoriesStr))
            {
                MessageLabel.Text = "Please visit the My Account Page and select the Categories that you would like to read more news from.";
                MyAccountLink.Visible = true;
                MyAccountLink.NavigateUrl = links.UserDetailsPageLink + "?UID=" + UID;
            }
            else
            {
                MyAccountLink.Visible = false;

                List<string> preferredCategoriesList = GetPreferredCategoriesList(prefferedCategoriesStr);
                List<Item> itemList = LoadItemDB(sort, preferredCategoriesList);
                if (itemList != null && itemList.Count > 0)
                {
                    MessageLabel.Text = gui.GreenFontStart + "Personalized Items for " + gui.GreenFontEnd + gui.BlueFontStart + UID + gui.BlueFontEnd;

                    //  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.MyNewsPageLink.Replace("~\\", ""));
                    ItemDiv.InnerHtml = itemTable;
                }
                else
                {
                    MessageLabel.Text = "getputs did not find anything worth your attention today!";
                }
            }
        }
        //  END: If a getputsCookie with the Username already exists, do not show the Login Page.
        #endregion CookieAlreadyExists
    }
Exemplo n.º 33
0
        public void BasicTable_Test2()
        {
            Image testImage = Bitmap.FromFile("Test Resources/EX-02-8000w.png");

            Assert.AreEqual(1, ImageEngine.ExtractTables(testImage));
        }
Exemplo n.º 34
0
 public void Resize(double scale)
 {
     ImageEngine imgEng = new ImageEngine(m_SourceFolder, m_DestFolder,scale);
     imgEng.progressDelegate += new UpdateProgress(UpdateUI);
     imgEng.GetFilesInDirectory();
     imgEng.Process();
 }
Exemplo n.º 35
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;
            }
        }
    }
Exemplo n.º 36
0
        public DefaultServices()
        {
            ImageEngine imageEngine = new ImageEngine(new LoremPixelProvider());

            Get["/images"] = _ => JsonConvert.SerializeObject(imageEngine.Create(10, null));
        }
Exemplo n.º 37
0
        private void RefreshViews()
        {
            try
            {
                int currentActivity = -1;
                int count           = _activityRows.Length;

                symbolListView1.Items.Clear();
                listView1.Items.Clear();

                for (int i = 0; i < count; i++)
                {
                    AdaSchedulePpc.ADAMobileDataSet.ActivityRow row = _activityRows[i] as AdaSchedulePpc.ADAMobileDataSet.ActivityRow;
                    SymbolListView.SymbolListItem item = new SymbolListView.SymbolListItem();

                    bool isExecuted = (!row.IsExecutionStartNull() && !row.IsExecutionEndNull());

                    item.Checked = isExecuted;

                    if (currentActivity < 0)
                    {
                        if (!isExecuted)
                        {
                            currentActivity = i;
                        }
                    }

                    if (!row.IsSymbolIdNull())
                    {
                        if (!row.SymbolRow.IsImageNull())
                        {
                            item.Image = ImageEngine.FromArray(row.SymbolRow.Image);
                        }

                        if (!row.SymbolRow.IsSoundNull())
                        {
                            item.Sound = row.SymbolRow.Sound;
                        }
                    }

                    item.Text = string.Format("{0}:{1}", row.Sequence, row.Name);

                    symbolListView1.Items.Add(item);

                    ListViewItem lvItem = new ListViewItem();
                    lvItem.Text = row.Name;

                    if (!row.IsStartTimeNull())
                    {
                        lvItem.SubItems.Add(row.StartTime.ToString("hh:mm"));
                    }

                    if (!row.IsEndTimeNull())
                    {
                        lvItem.SubItems.Add(row.EndTime.ToString("hh:mm"));
                    }

                    lvItem.Tag     = isExecuted;
                    lvItem.Checked = isExecuted;
                    listView1.Items.Add(lvItem);
                }

                symbolListView1.SelectedIndex = currentActivity;
                menuItemCurrent.Enabled       = (currentActivity >= 0);
            }
            catch (Exception ex)
            {
                ReportError(ex);
            }
        }
Exemplo n.º 38
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            OutputTB.Text = string.Empty;

            dbOps = DBOperations.Instance;
            links = Links.Instance;
            general = General.Instance;
            gui = GUIVariables.Instance;
            engine = ProcessingEngine.Instance;
            categories = Categories.Instance;
            imageEngine = ImageEngine.Instance;
        }
        catch (Exception ex)
        {
            OutputTB.Text = "Error in PageLoad: " + Environment.NewLine + ex.Message + Environment.NewLine + ex.StackTrace;
        }
    }
Exemplo n.º 39
0
    //  ItemDisplayer.ItemLayoutOptions itemLayoutOptions = ItemDisplayer.ItemLayoutOptions.Columns;
    //  ItemDisplayer.ItemLayoutOptions itemLayoutOptions = ItemDisplayer.ItemLayoutOptions.Categorized;
    protected override void OnInit(EventArgs e)
    {
        // Create dynamic controls here.

        //  Default Search Parameters.
        query = String.Empty;
        sType = SearchEngine.SearchType.Title;
        sCategory = "All Categories";
        sTime = SearchEngine.SearchTime.Today;

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

        seperator = gui.Seperator;

        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

        LoadSearchDDL();
        GetQueryParameters();

        if (!string.IsNullOrEmpty(SearchTB.Text))
        {
            query = SearchTB.Text.Trim();
        }

        string sTypeDDLValue = SearchTypeDDL.SelectedValue;
        string sCategoryDDLValue = SearchCategoryDDL.SelectedValue;
        string sTimeDDLValue = SearchTimeDDL.SelectedValue;

        Control MasterPageSearchTable = this.Master.FindControl("SearchTable");
        MasterPageSearchTable.Visible = false;

        SearchTB.Focus();
        Page.Form.DefaultButton = SearchButton.ID;

        if (!string.IsNullOrEmpty(query))
        {
            SearchTB.Text = query;

            if (sType == SearchEngine.SearchType.Comments)
            {
                sType = SearchEngine.SearchType.Title;
                List<Item> itemList = searchEngine.LoadSearchResults(query, sType, sCategory, sTime);
                LoadItemTable(itemList);
            }
            else
            {

                //  List<Item> itemList = searchEngine.LoadSearchResults(query);
                List<Item> itemList = searchEngine.LoadSearchResults(query, sType, sCategory, sTime);

                //  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.SearchPageLink.Replace("~\\", ""));
                ItemDiv.InnerHtml = itemTable;

            }
        }

        //
        // CODEGEN: This call is required by the ASP.NET Web Form Designer.
        //
        //  InitializeComponent();
        base.OnInit(e);
    }
Exemplo n.º 40
0
    int startItem = 0; //  Default Value;

    #endregion Fields

    #region Methods

    //  ItemDisplayer.ItemLayoutOptions itemLayoutOptions = ItemDisplayer.ItemLayoutOptions.Columns;
    //  ItemDisplayer.ItemLayoutOptions itemLayoutOptions = ItemDisplayer.ItemLayoutOptions.Categorized;
    protected void Page_Load(object sender, EventArgs e)
    {
        links = Links.Instance;
        gui = GUIVariables.Instance;
        dbOps = DBOperations.Instance;
        categories = Categories.Instance;
        log = Logger.Instance;
        engine = ProcessingEngine.Instance;
        general = General.Instance;
        imageEngine = ImageEngine.Instance;
        itemDisplayer = ItemDisplayer.Instance;

        seperator = gui.Seperator;

        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 (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"];
            loggedUID = dbOps.Decrypt(getputsCookie["UID"].ToString().Trim());
        }

        if (string.IsNullOrEmpty(loggedUID))
        {

        }
        else
        {

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

        if (string.IsNullOrEmpty(Request.QueryString["UID"]))
        {

        }
        else
        {
            queryStringUID = Request.QueryString["UID"].Trim().ToLower();
        }

        string message = string.Empty;
        MessageLabel.Text = string.Empty;
        if (string.IsNullOrEmpty(queryStringUID))
        {
            message = gui.GreenFontStart + "No such User exists." + gui.GreenFontEnd;
        }
        else
        {
            List<Item> itemList = engine.LoadItemDB(sort, queryStringUID);
            if (itemList != null && itemList.Count > 0)
            {
                message = gui.GreenFontStart + "Most recent submissions by " + queryStringUID + gui.GreenFontEnd;

                //  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, queryStringUID, sort, links.SubmittedPageLink.Replace("~\\", "") + "?UID=" + queryStringUID);
                ItemDiv.InnerHtml = itemTable;
            }
            else
            {
                message = gui.GreenFontStart + queryStringUID + " has not made any submissions yet." + gui.GreenFontEnd;
            }
        }
        MessageLabel.Text = message;
    }
Exemplo n.º 41
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;
        }
    }
Exemplo n.º 42
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
    }
Exemplo n.º 43
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;
        itemDisplayer = ItemDisplayer.Instance;

        seperator = gui.Seperator;

        //  requestedTag = Request.QueryString["category"].Trim();
        requestedCategory = Request.QueryString.Get("category");

        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

        if (string.IsNullOrEmpty(requestedCategory))
        {
            LoadGenericCategoryTable();
        }
        else if (!(categories.CategoriesList.Contains(requestedCategory) || categories.CategoriesList.Contains(requestedCategory.ToLower())))
        {
            MessageLabel.Text = gui.RedFontStart + "Invalid Category" + gui.RedFontEnd;
        }
        else
        {
            string currentCategory = requestedCategory;
            if (imageEngine.IsIconsOn)
            {
                string iconLocation = imageEngine.LoadIconLocation(currentCategory);
                if (!string.IsNullOrEmpty(iconLocation))
                {
                    System.Web.UI.WebControls.Image icon = new System.Web.UI.WebControls.Image();
                    //  icon.ImageUrl = links.DomainLink + iconLocation;
                    icon.ImageUrl = iconLocation;
                    icon.ToolTip = currentCategory;
                    CategoryDiv.Controls.Add(icon);
                    CategoryDiv.Controls.Add(new LiteralControl(" "));
                }
            }
            MessageLabel.Text = gui.GreenFontStart + requestedCategory + gui.GreenFontEnd;
            //  MessageLabel.Text = gui.WhiteFontStart + requestedCategory + gui.WhiteFontEnd;
            LoadCategoryTable(requestedCategory, sort);
        }
    }