Esempio n. 1
0
        private void IniInitializer()
        {
            //foreach (var x in InI.filtersFile.ReadSections())
            //{
            //    InI.filtersFile.RenameSection(x, InI.filtersFile.Read(x, "Name"));
            //    InI.filtersFile.DeleteKey(x, "Name");
            //}

            //foreach (var x in InI.panelsFile.ReadSections())
            //{
            //    File.Move(@"pictures/IMG-" + x.Substring(8) + ".png", @"pictures/" + InI.panelsFile.Read(x, "Name").Replace(":","") + ".png");
            //    InI.panelsFile.RenameSection(x, InI.panelsFile.Read(x, "Name"));
            //}
            //foreach (var x in InI.panelsFile.ReadSections())
            //{
            //    InI.panelsFile.DeleteKey(x, "Name");
            //}

            if (InI.SettingsFileExist())
            {
                InitializeSettings();
            }
            else
            {
                InI.settingsFile.Write("General", "MiniMode", "False");
                InI.settingsFile.Write("General", "TopMode", "False");
                InI.settingsFile.Write("General", "Language", "en-US");
                InI.settingsFile.Write("General", "MessageMode", "True");
            }

            if (InI.FiltersFileExist())
            {
                InitializeFilters();
            }
        }
Esempio n. 2
0
        private void Save()
        {
            Settings.miniMode    = Settings._miniMode;
            Settings.topmostMode = Settings._topmostMode;
            Settings.lang        = Settings._lang;
            Settings.messageMode = Settings._messageMode;
            Settings.filters     = Settings._filters;
            Settings.scripts     = Settings._scripts;

            Application.Current.MainWindow.Topmost = Settings.topmostMode;
            Thread.CurrentThread.CurrentUICulture  = new System.Globalization.CultureInfo(Settings.lang);
            InI.settingsFile.Write("General", "MiniMode", Settings.miniMode.ToString());
            InI.settingsFile.Write("General", "TopMode", Settings.topmostMode.ToString());
            InI.settingsFile.Write("General", "Language", Settings.lang);
            InI.settingsFile.Write("General", "MessageMode", Settings.messageMode.ToString());

            foreach (var x in Settings.filters)
            {
                InI.filtersFile.Write(x[0], "ExcludeUpdate", x[1]);
                InI.filtersFile.Write(x[0], "HideOnStartUp", x[2]);
            }

            if (InI.ScriptsFileExist() && InI.scriptsFile.SectionExists("Scripts"))
            {
                InI.scriptsFile.DeleteSection("Scripts");
            }
            foreach (var x in Settings.scripts)
            {
                InI.scriptsFile.Write("Scripts", x[0], x[1]);
            }

            AnimationEffect();
        }
Esempio n. 3
0
        private void ResetData()
        {
            MessageBoxResult result = CustomMessageBox.Show(Properties.Resources.Message_ResetData, Properties.Resources.Warning, MessageBoxButton.YesNo);

            if (result == MessageBoxResult.Yes)
            {
                if (InI.PanelsFileExist())
                {
                    File.Delete(@"panels.ini");
                }

                if (Directory.Exists(Directory.GetCurrentDirectory() + @"\pictures"))
                {
                    Directory.Delete(Directory.GetCurrentDirectory() + @"\pictures", true);
                }

                if (InI.FiltersFileExist())
                {
                    File.Delete(@"filters.ini");
                }

                if (InI.ScriptsFileExist())
                {
                    File.Delete(@"scripts.ini");
                }

                _ResetSettings();
                Settings.ResetData();
                AnimationEffect();
            }
        }
Esempio n. 4
0
 private void InitializeFilterList()
 {
     filterList.Add(Properties.Resources.NoneSelected);
     if (InI.FiltersFileExist())
     {
         foreach (var x in InI.filtersFile.ReadSections())
         {
             filterList.Add(x);
         }
     }
 }
Esempio n. 5
0
 private void Tags()
 {
     if (InI.FiltersFileExist())
     {
         foreach (var x in InI.filtersFile.ReadSections())
         {
             var _cb = new System.Windows.Controls.CheckBox {
                 Content = x
             };
             _cb.Click += _cb_Click;
             wnd.tagsCB.Items.Add(_cb);
             _cb = null;
         }
     }
 }
Esempio n. 6
0
        private int VisibleFiltersCB()
        {
            int _count = 0;

            if (InI.FiltersFileExist())
            {
                for (int i = 1; i < filterList.Count; i++)
                {
                    if (InI.filtersFile.Read("Filter - " + i, "HideOnStartUp") == "False")
                    {
                        _count++;
                    }
                }
            }
            return(_count);
        }
Esempio n. 7
0
        private void _webBrowser_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e)
        {
            navigating = false;
            if (_uri != _webBrowser.Source && InI.PanelsFileExist())
            {
                if (InI.FiltersFileExist() && !InI.filtersFile.SectionExists("Update"))
                {
                    InI.filtersFile.Write("Update", "ExcludeUpdate", "true");
                    InI.filtersFile.Write("Update", "HideOnStartUp", "false");
                    (mPage as MainPage).filterList.Add("Update");
                }

                Array.Resize(ref updateList, updateList.Length + 1);
                updateList[updateList.Length - 1] = panelName;
                Array.Resize(ref versionList, versionList.Length + 1);
                versionList[versionList.Length - 1] = InI.panelsFile.Read(panelName, "Version");
                if (InI.ScriptsFileExist() && InI.scriptsFile.SectionExists("Scripts") && InI.scriptsFile.KeyExists("Scripts", "Version"))
                {
                    Array.Resize(ref newVersionList, newVersionList.Length + 1);
                    newVersionList[newVersionList.Length - 1] = Regex.Match(_webBrowser.Source.ToString(), InI.scriptsFile.Read("Scripts", "Version")).Value.Replace("-", ".").TrimStart('.').TrimEnd('.');
                }
                if (!InI.panelsFile.Read(panelName, "Tags").Contains("Update"))
                {
                    if (!string.IsNullOrWhiteSpace(InI.panelsFile.Read(panelName, "Tags")))
                    {
                        InI.panelsFile.Write(panelName, "Tags", InI.panelsFile.Read(panelName, "Tags") + ";Update");
                    }
                    else
                    {
                        InI.panelsFile.Write(panelName, "Tags", InI.panelsFile.Read(panelName, "Tags") + "Update");
                    }
                }

                if (!(((StackPanel)(mPage.mainLB.Items[panelUpdatedIndex] as ListBoxItem).Content).Tag).ToString().Contains("Update"))
                {
                    if (!string.IsNullOrWhiteSpace((((StackPanel)(mPage.mainLB.Items[panelUpdatedIndex] as ListBoxItem).Content).Tag).ToString()))
                    {
                        ((StackPanel)(mPage.mainLB.Items[panelUpdatedIndex] as ListBoxItem).Content).Tag += ";Update";
                    }
                    else
                    {
                        ((StackPanel)(mPage.mainLB.Items[panelUpdatedIndex] as ListBoxItem).Content).Tag += "Update";
                    }
                }
            }
        }
Esempio n. 8
0
 private void SiteTB_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
 {
     if (InI.ScriptsFileExist() && InI.scriptsFile.SectionExists("Scripts"))
     {
         if (string.IsNullOrEmpty(wnd.nameTB.Text) && InI.scriptsFile.KeyExists("Scripts", "Name") &&
             !string.IsNullOrEmpty(Regex.Match(wnd.siteTB.Text,
                                               InI.scriptsFile.Read("Scripts", "Name")).Groups["name"].Value.Replace("-", " ")))
         {
             wnd.nameTB.Text = Regex.Match(wnd.siteTB.Text,
                                           InI.scriptsFile.Read("Scripts", "Name")).Groups["name"].Value.Replace("-", " ");
         }
         if (InI.scriptsFile.KeyExists("Scripts", "Version") &&
             !string.IsNullOrEmpty(Regex.Match(wnd.siteTB.Text,
                                               InI.scriptsFile.Read("Scripts", "Version")).Value.Replace("-", ".").TrimStart('.').TrimEnd('.')))
         {
             wnd.versionTB.Text = Regex.Match(wnd.siteTB.Text,
                                              InI.scriptsFile.Read("Scripts", "Version")).Value.Replace("-", ".").TrimStart('.').TrimEnd('.');
         }
     }
 }
Esempio n. 9
0
 private void BTemp_PreviewMouseUp(object sender, MouseButtonEventArgs e)
 {
     if (e.ChangedButton == MouseButton.Middle)
     {
         MessageBoxResult result = CustomMessageBox.Show(Properties.Resources.Message_Delete_Item_Begin + "\"" + ((((Button)sender).Parent as StackPanel).Children[1] as TextBlock).Text + "\"" + Properties.Resources.Message_Delete_Item_End, Properties.Resources.Delete, MessageBoxButton.YesNo);
         if (result == MessageBoxResult.Yes)
         {
             mPage._itemCollection.Remove((((Button)sender).Parent as StackPanel).Parent as ListBoxItem);
             if (Directory.Exists(@"pictures") && File.Exists(Directory.GetCurrentDirectory() +
                                                              @"\pictures\" + ((Button)sender).Tag.ToString() + ".png"))
             {
                 File.Delete(Directory.GetCurrentDirectory() +
                             @"\pictures\" + ((Button)sender).Tag.ToString() + ".png");
             }
             if (InI.PanelsFileExist())
             {
                 InI.panelsFile.DeleteSection(((Button)sender).Tag.ToString());
             }
         }
     }
 }
Esempio n. 10
0
        private void SortCB_DropDownOpened(object sender, EventArgs e)
        {
            if ((((ComboBox)sender).Items[((ComboBox)sender).Items.Count - 1] as Grid).Children[1].Visibility == Visibility.Visible)
            {
                (((ComboBox)sender).Items[((ComboBox)sender).Items.Count - 1] as Grid).Children[0].Visibility = Visibility.Visible;
                (((ComboBox)sender).Items[((ComboBox)sender).Items.Count - 1] as Grid).Children[1].Visibility = Visibility.Collapsed;
            }

            var _list = new ObservableCollection <object>()
            {
                Properties.Resources.NoneSelected
            };
            int y = -1;

            if (InI.FiltersFileExist())
            {
                foreach (var x in filterList)
                {
                    y++;
                    if (InI.filtersFile.Read(x, "HideOnStartUp") == "false")
                    {
                        _list.Add(x);
                    }
                }
            }

            _list.Add(grd);
            y = 0;

            foreach (var x in currentFilter)
            {
                y++;
                if ((int)((ComboBox)sender).Tag != y)
                {
                    _list.Remove(x);
                }
            }

            ((ComboBox)sender).ItemsSource = _list;
        }
Esempio n. 11
0
 private void _CBI_MouseDown(object sender, MouseButtonEventArgs e)
 {
     if (e.ChangedButton == MouseButton.Middle && ((ComboBoxItem)sender).Content is string && ((ComboBoxItem)sender).Content.ToString() != Properties.Resources.NoneSelected)
     {
         MessageBoxResult _result = CustomMessageBox.Show(Properties.Resources.Message_DeleteFilter_Begin + ((ComboBoxItem)sender).Content.ToString() + Properties.Resources.Message_DeleteFilter_End, Properties.Resources.Delete, MessageBoxButton.YesNo);
         if (_result == MessageBoxResult.Yes)
         {
             if (InI.FiltersFileExist())
             {
                 InI.filtersFile.DeleteSection(((ComboBoxItem)sender).Content.ToString());
             }
             filterList.Remove(((ComboBoxItem)sender).DataContext.ToString());
             if (counter > VisibleFiltersCB() && counter > 1)
             {
                 DeleteSortCB();
             }
             if (sortB.IsVisible && (VisibleFiltersCB() < 2 || VisibleFiltersCB() == counter))
             {
                 sortB.Visibility = Visibility.Collapsed;
             }
         }
     }
 }
Esempio n. 12
0
        private void Initializer()
        {
            Settings.scripts = Settings._scripts = new List <string[]>();
            Settings.filters = Settings._filters = new List <string[]>();

            if (InI.FiltersFileExist() && InI.filtersFile.ReadSections().Length > 0)
            {
                foreach (var x in InI.filtersFile.ReadSections())
                {
                    Settings.filters.Add(new string[] { x, InI.filtersFile.Read(x, "ExcludeUpdate"), InI.filtersFile.Read(x, "HideOnStartUp") });
                }
                Settings.filters = Settings._filters;
            }

            if (InI.ScriptsFileExist() && InI.scriptsFile.SectionExists("Scripts"))
            {
                foreach (var x in InI.scriptsFile.ReadKeys("Scripts"))
                {
                    Settings.scripts.Add(new string[] { x, InI.scriptsFile.Read("Scripts", x) });
                }
                Settings.scripts = Settings._scripts;
            }
        }
Esempio n. 13
0
        private void Initializer()
        {
            string[]   _tagList    = null;
            bool       _found      = false;
            Visibility _visibility = Visibility.Visible;
            bool       _isEnabled  = true;

            // Init _hideList
            if (InI.FiltersFileExist())
            {
                foreach (var x in InI.filtersFile.ReadSections())
                {
                    if (InI.filtersFile.Read(x, "HideOnStartUp") == "true")
                    {
                        Array.Resize(ref _hideList, _hideList.Length + 1);
                        _hideList[_hideList.Length - 1] = x;
                    }
                }
            }

            // Init panels
            if (InI.PanelsFileExist() && InI.panelsFile.ReadSections() != null)
            {
                System.Drawing.Bitmap img;
                foreach (var x in InI.panelsFile.ReadSections())
                {
                    if (File.Exists(Directory.GetCurrentDirectory() +
                                    @"\pictures\" + x.Replace(":", "") + ".png"))
                    {
                        using (var bmpTemp = new System.Drawing.Bitmap(Directory.GetCurrentDirectory() +
                                                                       @"\pictures\" + x.Replace(":", "") + ".png"))
                        {
                            img = new System.Drawing.Bitmap(bmpTemp);
                        }
                    }
                    else
                    {
                        img = null;
                    }

                    _tagList = InI.panelsFile.Read(x, "Tags").Split(';');

                    if (InI.FiltersFileExist())
                    {
                        if (_hideList.Length < _tagList.Length)
                        {
                            foreach (var y in _hideList)
                            {
                                foreach (var z in _tagList)
                                {
                                    if (y == z)
                                    {
                                        _found = true;
                                        break;
                                    }
                                }
                            }
                        }
                        else
                        {
                            foreach (var y in _tagList)
                            {
                                foreach (var z in _hideList)
                                {
                                    if (y == z)
                                    {
                                        _found = true;
                                        break;
                                    }
                                }
                            }
                        }
                    }

                    if (_found)
                    {
                        _visibility = Visibility.Collapsed;
                        _isEnabled  = false;
                    }
                    else
                    {
                        _visibility = Visibility.Visible;
                        _isEnabled  = true;
                    }
                    _found = false;
                    NewPanel(x, InI.panelsFile.Read(x, "Tags"), img, _visibility, _isEnabled);
                }
            }
        }
Esempio n. 14
0
        private void Update()
        {
            ((MainWindow)Application.Current.MainWindow).oL.Visibility = Visibility.Visible;
            ((MainWindow)Application.Current.MainWindow).oLText.Text   = Properties.Resources.Message_Updating;

            if (InI.PanelsFileExist())
            {
                _webBrowser            = new WebBrowser();
                _webBrowser.Navigated += _webBrowser_Navigated;
                var _excludeList = new string[] { };

                if (InI.FiltersFileExist())
                {
                    foreach (var x in InI.filtersFile.ReadSections())
                    {
                        if (InI.filtersFile.Read(x, "ExcludeUpdate") == "true")
                        {
                            Array.Resize(ref _excludeList, _excludeList.Length + 1);
                            _excludeList[_excludeList.Length - 1] = x;
                        }
                    }
                }

                foreach (var x in (mPage as MainPage)._itemCollection.OfType <ListBoxItem>())
                {
                    if (InI.panelsFile.SectionExists(
                            ((x.Content as StackPanel).Children[0] as Button).Tag.ToString()))
                    {
                        if (!_excludeList.Intersect(
                                InI.panelsFile.Read(
                                    ((x.Content as StackPanel).Children[0] as Button).Tag.ToString(), "Tags")
                                .Split(';')).Any() &&
                            Uri.IsWellFormedUriString(
                                InI.panelsFile.Read(
                                    ((x.Content as StackPanel).Children[0] as Button).Tag.ToString(), "Site"),
                                UriKind.Absolute))
                        {
                            panelName         = ((x.Content as StackPanel).Children[0] as Button).Tag.ToString();
                            panelUpdatedIndex = mPage.mainLB.Items.IndexOf(x);
                            navigating        = true;
                            _uri = new Uri(InI.panelsFile.Read(
                                               ((x.Content as StackPanel).Children[0] as Button).Tag.ToString(), "Site"));
                            _webBrowser.Navigate(_uri);
                            while (navigating)
                            {
                                Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new Action(delegate { }));
                            }
                        }
                    }
                }
                _excludeList = null;
                _webBrowser  = null;

                ((MainWindow)Application.Current.MainWindow).oLText.Text = "";

                #region Creating the expander
                var _nSP = new StackPanel();
                _nSP.Children.Add(new TextBlock
                {
                    Text            = Properties.Resources.Add_Name,
                    TextDecorations = TextDecorations.Underline,
                    Margin          = new Thickness(0, 0, 20, 0)
                });
                _nSP.Children.Add(new TextBlock
                {
                    Text   = string.Join("\n", updateList),
                    Margin = new Thickness(0, 0, 20, 0)
                });

                var _vSP = new StackPanel();
                _vSP.Children.Add(new TextBlock
                {
                    Text            = Properties.Resources.Update_Current_Version,
                    TextDecorations = TextDecorations.Underline,
                    Margin          = new Thickness(0, 0, 20, 0)
                });
                _vSP.Children.Add(new TextBlock
                {
                    Text   = string.Join("\n", versionList),
                    Margin = new Thickness(0, 0, 20, 0)
                });

                var _nvSP = new StackPanel();
                _nvSP.Children.Add(new TextBlock
                {
                    Text            = Properties.Resources.Update_New_Version,
                    TextDecorations = TextDecorations.Underline,
                    Margin          = new Thickness(0, 0, 0, 0)
                });
                _nvSP.Children.Add(new TextBlock
                {
                    Text   = string.Join("\n", newVersionList),
                    Margin = new Thickness(0, 0, 0, 0)
                });

                var _newSP = new StackPanel()
                {
                    Orientation = Orientation.Horizontal
                };
                _newSP.Children.Add(_nSP);
                _newSP.Children.Add(_vSP);
                _newSP.Children.Add(_nvSP);

                var _expander = new Expander
                {
                    Content    = _newSP,
                    Header     = Properties.Resources.Update_Found_Begin + updateList.Length + Properties.Resources.Update_Found_End,
                    Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Red)
                };
                #endregion

                if (updateList.Length > 0)
                {
                    CustomMessageBox.Show(_expander);
                }
                else
                {
                    CustomMessageBox.Show(Properties.Resources.Message_NoUpdates, Properties.Resources.Warning);
                }
                updateList     = new string[] { };
                versionList    = new string[] { };
                newVersionList = new string[] { };
                ((MainWindow)Application.Current.MainWindow).oL.Visibility = Visibility.Collapsed;
            }
        }
Esempio n. 15
0
        private void AddNewPanel_Click()
        {
            AddNewPanel addF = new AddNewPanel()
            {
                Owner = (MainWindow)Application.Current.MainWindow
            };

            addF.ShowDialog();
            if ((addF.DataContext as AddNewPanelViewModel).ok && (addF.DataContext as AddNewPanelViewModel).image != null)
            {
                Visibility _visibility = Visibility.Visible;
                bool       _isEnabled  = true;
                if (InI.FiltersFileExist())
                {
                    _hideList = new string[] { };
                    foreach (var x in InI.filtersFile.ReadSections())
                    {
                        if (InI.filtersFile.Read(x, "HideOnStartUp") == "true")
                        {
                            Array.Resize(ref _hideList, _hideList.Length + 1);
                            _hideList[_hideList.Length - 1] = x;
                        }
                    }

                    bool _found = false;
                    if (_hideList.Length < (addF.DataContext as AddNewPanelViewModel).tags.Length)
                    {
                        foreach (var x in _hideList)
                        {
                            foreach (var y in (addF.DataContext as AddNewPanelViewModel).tags)
                            {
                                if (x == y)
                                {
                                    _found = true;
                                    break;
                                }
                            }
                        }
                    }
                    else
                    {
                        foreach (var x in (addF.DataContext as AddNewPanelViewModel).tags)
                        {
                            foreach (var y in _hideList)
                            {
                                if (x == y)
                                {
                                    _found = true;
                                    break;
                                }
                            }
                        }
                    }

                    if (_found)
                    {
                        _visibility = Visibility.Collapsed;
                        _isEnabled  = false;
                    }
                    else
                    {
                        _visibility = Visibility.Visible;
                        _isEnabled  = true;
                    }
                }
                NewPanel((addF.DataContext as AddNewPanelViewModel).name, string.Join(";", (addF.DataContext as AddNewPanelViewModel).tags), (addF.DataContext as AddNewPanelViewModel).image, _visibility, _isEnabled);
                //_counter = (int.Parse(InI.panelsFile.Read("PanelCount", "Count")) + 1).ToString();
                InI.panelsFile.Write((addF.DataContext as AddNewPanelViewModel).name, "Path", (addF.DataContext as AddNewPanelViewModel).path);
                InI.panelsFile.Write((addF.DataContext as AddNewPanelViewModel).name, "Version", (addF.DataContext as AddNewPanelViewModel).version);
                if ((addF.DataContext as AddNewPanelViewModel).updateDate.ToShortDateString() != "1/1/0001")
                {
                    InI.panelsFile.Write((addF.DataContext as AddNewPanelViewModel).name, "Update", (addF.DataContext as AddNewPanelViewModel).updateDate.ToShortDateString());
                }
                else
                {
                    InI.panelsFile.Write((addF.DataContext as AddNewPanelViewModel).name, "Update", "Unknown");
                }
                InI.panelsFile.Write((addF.DataContext as AddNewPanelViewModel).name, "Site", (addF.DataContext as AddNewPanelViewModel).site);
                //InI.panelsFile.Write((addF.DataContext as AddNewPanelViewModel).name, "Completed", (addF.DataContext as AddNewPanelViewModel).completed.ToString());
                InI.panelsFile.Write((addF.DataContext as AddNewPanelViewModel).name, "Tags", string.Join(";", (addF.DataContext as AddNewPanelViewModel).tags));
                if ((addF.DataContext as AddNewPanelViewModel).image != null)
                {
                    CreateNewImage(null,
                                   (addF.DataContext as AddNewPanelViewModel).name,
                                   (addF.DataContext as AddNewPanelViewModel).image);
                }
            }
        }