public void ConnectToDatabase(bool appStartup)
        {
            DBConnectionWindow    window = new DBConnectionWindow();
            DBConnectionViewModel vm     = new DBConnectionViewModel(window);

            window.DataContext = vm;

            vm.Server   = RegistrySettings.GetValue <string>("DatabaseServer", "localhost");
            vm.Database = RegistrySettings.GetValue <string>("Database", "Lithnet.Acma");

            bool?result = window.ShowDialog();

            if (result.HasValue && result.Value)
            {
                try
                {
                    ActiveConfig.OpenDatabase(vm.Server, vm.Database);
                    this.Database = new AcmaDatabaseViewModel(this);
                    RegistrySettings.SetValue("DatabaseServer", vm.Server);
                    RegistrySettings.SetValue("Database", vm.Database);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Could not connect to specified database. " + ex.Message);
                    this.ConnectToDatabase(appStartup);
                }
            }
            else
            {
                if (appStartup)
                {
                    Environment.Exit(0);
                }
            }
        }
Exemple #2
0
 public override void Initialize()
 {
     _config = new ActiveConfig <TextRotatorConfig>(new FileInfo(ConfigFile));
     _config.OnConfigChanged       += OnConfigChanged;
     Instance.EventQueryCellResult += EventQueryCellResult;
     Instance.QueryCell(_config.Config.CellX, _config.Config.CellY);
 }
Exemple #3
0
        private void SetLabelHelp(ActiveConfig config)
        {
            switch (config)
            {
            case ActiveConfig.Language:
                break;

            case ActiveConfig.Clipboard:
                labelStringConfigHelp.Text = Kernel.LocalTexts.GetString("label_clipboard");
                break;

            case ActiveConfig.History:
                labelStringConfigHelp.Text = Kernel.LocalTexts.GetString("label_historial");
                break;

            case ActiveConfig.Colors:
                break;

            case ActiveConfig.TextFont:
                break;

            case ActiveConfig.Stream:
                labelStringConfigHelp.Text = Kernel.LocalTexts.GetString("label_stream");
                break;

            default:
                break;
            }
        }
Exemple #4
0
        public void Open(string filename)
        {
            XmlConfigFile         existingModel   = this.Model;
            UnitTestFileViewModel existingUTModel = this.UnitTestFile;

            try
            {
                ActiveConfig.DB.CanCache = true;
                AcmaSchemaAttribute.MissingAttributeEvent += AcmaSchemaAttribute_MissingAttributeEvent;
                UINotifyPropertyChanges.BeginIgnoreAllChanges();
                this.Model        = ActiveConfig.LoadXml(filename);
                this.unitTestFile = TestEngine.UnitTestFile.LoadXml(this.FileName);
                this.ReloadRootNodes();
                this.ResetChangeState();
            }
            catch
            {
                this.Model        = existingModel;
                this.UnitTestFile = existingUTModel;
                throw;
            }
            finally
            {
                UINotifyPropertyChanges.EndIgnoreAllChanges();
                this.RaisePropertyChanged("DisplayName");
                this.RaisePropertyChanged("ChildNodes");
                AcmaSchemaAttribute.ClearLostFoundCache();
                AcmaSchemaAttribute.MissingAttributeEvent -= AcmaSchemaAttribute_MissingAttributeEvent;
                ActiveConfig.DB.CanCache = false;
            }
        }
Exemple #5
0
        private void LoadLanguageConfig()
        {
            ActiveConfig        = ActiveConfig.Language;
            radioButtonsIdiomas = new RadioButton[Kernel.NumLanguages];
            PictureBox[] pictureBoxesIdiomas = new PictureBox[Kernel.NumLanguages];
            groupBoxRaiz.Text = Kernel.LocalTexts.GetString("cambiar_idioma");
            int y = 44;

            for (int i = 0; i < Kernel.NumLanguages; i++)
            {
                radioButtonsIdiomas[i]          = new RadioButton();
                radioButtonsIdiomas[i].Location = new Point(44, y);
                radioButtonsIdiomas[i].Text     = Kernel.Languages[i];
                if (radioButtonsIdiomas[i].Text == Config.Language)
                {
                    radioButtonsIdiomas[i].Checked = true;
                }
                radioButtonsIdiomas[i].Font     = new Font("Segoe UI", 9);
                pictureBoxesIdiomas[i]          = new PictureBox();
                pictureBoxesIdiomas[i].Location = new Point(6, y);
                pictureBoxesIdiomas[i].Size     = new Size(32, 32);
                pictureBoxesIdiomas[i].SizeMode = PictureBoxSizeMode.StretchImage;
                CultureInfo nombreIdioma = new CultureInfo(Kernel.Languages[i]);
                radioButtonsIdiomas[i].Text  = nombreIdioma.NativeName;
                pictureBoxesIdiomas[i].Image = Config.GetIconoBandera(Kernel.Languages[i]);

                groupBoxRaiz.Controls.Add(radioButtonsIdiomas[i]);
                groupBoxRaiz.Controls.Add(pictureBoxesIdiomas[i]);
                y += 35;
                radioButtonsIdiomas[i].Show();
                pictureBoxesIdiomas[i].Show();
            }
        }
 public void OpenDatabase(string server, string database)
 {
     try
     {
         ActiveConfig.OpenDatabase(server, database);
         this.Database = new AcmaDatabaseViewModel(this);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Could not connect to database: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
 public static void Initialize()
 {
     if (!initialized)
     {
         Lithnet.MetadirectoryServices.Resolver.MmsAssemblyResolver.RegisterResolver();
         Logger.LogPath  = @"D:\MAData\ACMA\acma-unit-test.log";
         Logger.LogLevel = LogLevel.Debug;
         XmlDocument doc = new XmlDocument();
         ActiveConfig.OpenDatabase("localhost", "AcmaUnitTestDB2");
         LoadTestTransforms();
         initialized = true;
     }
 }
Exemple #8
0
        private void LoadStreamConfig()
        {
            ActiveConfig = ActiveConfig.Stream;

            labelStringConfigPreview          = new Label();
            labelStringConfigPreview.AutoSize = true;

            groupBoxRaiz.Text         = Kernel.LocalTexts.GetString("cambiar_stream");
            stringConfig              = new TextBox();
            stringConfig.TextChanged += StringConfig_TextChanged;
            stringConfig.Location     = new Point(35, groupBoxRaiz.Height / 4);
            Size size = stringConfig.Size;

            size.Width        = 420; stringConfig.Size = size;
            stringConfig.Font = new Font("Segoe UI", 9);
            stringConfig.Text = Config.StreamString;


            labelStringConfigPreview.Font     = stringConfig.Font;
            labelStringConfigPreview.Location = new Point(stringConfig.Location.X, stringConfig.Location.Y + 30);

            streamEnabledConfigCheckBox          = new CheckBox();
            streamEnabledConfigCheckBox.Location = new Point(44, stringConfig.Location.Y - 25);
            streamEnabledConfigCheckBox.Checked  = Config.StreamEnabled;
            streamEnabledConfigCheckBox.Text     = Kernel.LocalTexts.GetString("enable_stream_log");
            streamEnabledConfigCheckBox.AutoSize = true;
            streamEnabledConfigCheckBox.Font     = new Font("Segoe UI", 9);

            labelStringConfigHelp          = new Label();
            labelStringConfigHelp.Font     = stringConfig.Font;
            labelStringConfigHelp.AutoSize = true;
            labelStringConfigHelp.Location = new Point(labelStringConfigPreview.Location.X, labelStringConfigPreview.Location.Y + 50);
            SetLabelHelp(ActiveConfig);

            string Preview = Config.History;

            AlbumData album = Utils.GetRandomAlbum();

            if (album is not null)
            {
                SongPreview = Utils.GetRandomSong(album);
            }

            StringConfig_TextChanged(null, null);

            groupBoxRaiz.Controls.Add(stringConfig);
            groupBoxRaiz.Controls.Add(labelStringConfigPreview);
            groupBoxRaiz.Controls.Add(labelStringConfigHelp);
            groupBoxRaiz.Controls.Add(streamEnabledConfigCheckBox);
            SetLeftAnchor();
        }
        public override bool InspectInList(IList list, int ind, ref int edited)
        {
            var changed = ActiveConfig.InspectInList(list, ind, ref edited);

            if (_coverImage)
            {
                this.ClickHighlight(_coverImage);
            }
            else
            {
                this.ClickHighlight();
            }

            return(changed);
        }
Exemple #10
0
        private void LoadConfiguration()
        {
            if (this.ConfigFile == null)
            {
                throw new ConfigurationErrorsException("No configuration file was specified in the service config file");
            }

            if (!System.IO.File.Exists(this.ConfigFile))
            {
                throw new FileNotFoundException(string.Format("The configuration file '{0}' could not be found. Ensure the file is accessible by the service and the path specified in the app.config file is correct", this.ConfigFile));
            }

            ActiveConfig.LoadXml(this.ConfigFile);
            this.configUpdateQueued = false;
            Logger.WriteLine("Loaded configuration from {0}", this.ConfigFile);
        }
Exemple #11
0
        private void Aplicar(ActiveConfig config)
        {
            switch (config)
            {
            case ActiveConfig.Language:
                for (int i = 0; i < radioButtonsIdiomas.Length; i++)
                {
                    if (radioButtonsIdiomas[i].Checked)
                    {
                        Kernel.ChangeLanguage(Kernel.Languages[i]);
                    }
                }
                PonerTextos();
                groupBoxRaiz.Text = Kernel.LocalTexts.GetString("cambiar_idioma");
                break;

            case ActiveConfig.Clipboard:
                Config.Clipboard = stringConfig.Text;
                break;

            case ActiveConfig.History:
                Config.History        = stringConfig.Text;
                Config.HistoryEnabled = checkBoxHistoryConfigCheckBox.Checked;
                break;

            case ActiveConfig.Colors:
                Config.ColorBonus    = btColorBonus.BackColor;
                Config.ColorLongSong = btColorLongSong.BackColor;
                break;

            case ActiveConfig.TextFont:
                Config.FontView   = btTextView.Font;
                Config.FontLyrics = btTextLyrics.Font;
                Kernel.ReloadView();
                break;

            case ActiveConfig.Stream:
                Config.StreamEnabled = streamEnabledConfigCheckBox.Checked;
                Config.StreamString  = stringConfig.Text;
                break;

            default:
                break;
            }
        }
Exemple #12
0
        private void LoadColorConfig()
        {
            ActiveConfig      = ActiveConfig.Colors;
            groupBoxRaiz.Text = Kernel.LocalTexts.GetString("colorsHighlight");
            //Create stuff
            btColorBonus      = new Button();
            btColorLongSong   = new Button();
            ttbtColorBonus    = new ToolTip();
            ttbtColorLongSong = new ToolTip();

            ttbtColorLongSong.SetToolTip(btColorLongSong, Kernel.LocalTexts.GetString("helpColorLongSong"));
            ttbtColorBonus.SetToolTip(btColorBonus, Kernel.LocalTexts.GetString("helpColorBonus"));
            //Event config
            btColorBonus.Click    += buttonColor_Click;
            btColorLongSong.Click += buttonColor_Click;

            btColorBonus.Size    = new Size(220, 60);
            btColorLongSong.Size = btColorBonus.Size;

            int x = (groupBoxRaiz.Width / 2) - 110;
            int y = groupBoxRaiz.Height / 2;

            btColorBonus.Location    = new Point(x, y - 70);
            btColorLongSong.Location = new Point(x, y + 10);

            btColorBonus.BackColor = Config.ColorBonus;
            btColorBonus.Text      = Kernel.LocalTexts.GetString("bonus");

            btColorLongSong.BackColor = Config.ColorLongSong;
            btColorLongSong.Text      = Kernel.LocalTexts.GetString("longSong");

            //Config internal tags
            btColorBonus.Tag    = "bonus";
            btColorLongSong.Tag = "longsong";

            btColorBonus.AutoSize    = false;
            btColorLongSong.AutoSize = false;
            btColorBonus.Anchor      = AnchorStyles.None;
            btColorLongSong.Anchor   = AnchorStyles.None;

            groupBoxRaiz.Controls.Add(btColorBonus);
            groupBoxRaiz.Controls.Add(btColorLongSong);
        }
Exemple #13
0
        private void LoadTextConfig()
        {
            groupBoxRaiz.Text = Kernel.LocalTexts.GetString("tipografíaLyrics");
            ActiveConfig      = ActiveConfig.TextFont;
            //Create stuff
            btTextLyrics   = new Button();
            btTextView     = new Button();
            ttbtTextLyrics = new ToolTip();
            ttbtTextView   = new ToolTip();

            ttbtTextView.SetToolTip(btTextView, Kernel.LocalTexts.GetString("helpView"));
            ttbtTextLyrics.SetToolTip(btTextLyrics, Kernel.LocalTexts.GetString("helpLyrics"));
            //Event config
            btTextLyrics.Click += buttonText_Click;
            btTextView.Click   += buttonText_Click;

            btTextLyrics.Size = new Size(220, 60);
            btTextView.Size   = btTextLyrics.Size;

            int x = (groupBoxRaiz.Width / 2) - 110;
            int y = groupBoxRaiz.Height / 2;

            btTextLyrics.Location = new Point(x, y - 70);
            btTextView.Location   = new Point(x, y + 10);

            btTextLyrics.Font = Config.FontLyrics;
            btTextView.Font   = Config.FontView;

            btTextLyrics.Text = Kernel.LocalTexts.GetString("lyrics");

            btTextView.Text = Kernel.LocalTexts.GetString("configView");

            //Config internal tags
            btTextLyrics.Tag    = "lyrics";
            btTextView.Tag      = "view";
            btTextLyrics.Anchor = AnchorStyles.None;
            btTextView.Anchor   = AnchorStyles.None;

            groupBoxRaiz.Controls.Add(btTextLyrics);
            groupBoxRaiz.Controls.Add(btTextView);
        }
Exemple #14
0
        private void LoadClipboardConfig()
        {
            ActiveConfig              = ActiveConfig.Clipboard;
            labelStringConfigPreview  = new Label();
            labelStringConfigHelp     = new Label();
            groupBoxRaiz.Text         = Kernel.LocalTexts.GetString("cambiar_portapapeles");
            stringConfig              = new TextBox();
            stringConfig.TextChanged += StringConfig_TextChanged;
            stringConfig.Location     = new Point(35, groupBoxRaiz.Height / 4);
            Size size = stringConfig.Size; size.Width = 420; stringConfig.Size = size;

            stringConfig.Font = new Font("Segoe UI", 9);
            stringConfig.Text = Config.Clipboard;
            labelStringConfigPreview.Location = new Point(stringConfig.Location.X, stringConfig.Location.Y + 30);
            labelStringConfigPreview.AutoSize = true;
            labelStringConfigPreview.Font     = stringConfig.Font;
            labelStringConfigHelp.Font        = stringConfig.Font;
            labelStringConfigHelp.AutoSize    = true;
            labelStringConfigHelp.Location    = new Point(labelStringConfigPreview.Location.X, labelStringConfigPreview.Location.Y + 50);
            SetLabelHelp(ActiveConfig);

            string    Preview = "";
            AlbumData album   = Utils.GetRandomAlbum();

            if (album is null)
            {
                Preview = Config.Clipboard.Replace("%artist%", AlbumCopyPreview.Artist);
            }
            else
            {
                AlbumCopyPreview = album;
            }
            stringConfig.Text = Config.Clipboard;
            StringConfig_TextChanged(null, null);
            groupBoxRaiz.Controls.Add(stringConfig);
            groupBoxRaiz.Controls.Add(labelStringConfigPreview);
            groupBoxRaiz.Controls.Add(labelStringConfigHelp);
            SetLeftAnchor();
        }
        protected void Connect(string database, string server, string configFile, bool manualConnection)
        {
            ActiveConfig.OpenDatabase(server, database);

            if (configFile != null)
            {
                ActiveConfig.LoadXml(configFile);
            }
            else
            {
                ActiveConfig.XmlConfig = new XmlConfigFile();
            }

            Global.Connected = true;

            ActiveConfig.DB.CanCache = true;

            if (manualConnection)
            {
                AcmaCmdletConnected.isManuallyConnected = true;
                AcmaCmdletConnected.isAutoConnected     = false;
            }
        }
Exemple #16
0
 public override void Initialize()
 {
     _keywordItems       = new ActiveConfig <List <KeywordItem> >(new FileInfo(@".\KeywordBot\KeywordBotData.xml"));
     Instance.EventChat += EventChat;
 }
        //readonly LoopLock _loopLock = new LoopLock();

        public override bool Inspect()
        {
            var changed = pegi.toggleDefaultInspector(this);

            /*if (_loopLock.Unlocked && source != null && source.inspectionLock.Unlocked) {
             *  using (_loopLock.Lock()) {
             *      if (pegi.Try_Nested_Inspect(source).changes(ref changed)) {
             *
             *          if (name != source.name)
             *              NameForPEGI = source.name;
             *
             *          Shortcuts.visualLayer.OnLogicVersionChange();
             *      }
             *  }
             * } else {*/

            var onPlayScreen = pegi.PaintingGameViewUI;

            if (source != null)
            {
                var conditionPassed = source.Conditions_isEnabled();

                var nd = source.AsNode;

                if (nd != null)
                {
                    if (IsCurrent && nd.parentNode != null && icon.Back.Click("Exit this Node"))
                    {
                        Shortcuts.TryExitCurrentNode();
                    }

                    if (!IsCurrent && icon.Enter.Click("Enter this Node"))
                    {
                        Shortcuts.CurrentNode = nd;
                    }
                }

                if ((conditionPassed ? icon.Active : icon.InActive).Click("Try Force Active conditions to {0}".F(!conditionPassed)) && !source.TryForceEnabledConditions(Values.global, !conditionPassed))
                {
                    Debug.Log("No Conditions to force to {0}".F(!conditionPassed));
                }

                pegi.nl();

                if (IsCurrent)
                {
                    source.name.write(PEGI_Styles.ListLabel);
                }
                else
                {
                    source.name.write("Lerp parameter {0}".F(dominantParameter), conditionPassed ? PEGI_Styles.EnterLabel : PEGI_Styles.ExitLabel);
                }
            }

            pegi.nl();

            if (source == null)
            {
                "No source node is currently linked.".writeHint();
            }

            if ("Shape & Color".enter(ref inspectedItems, 2).nl())
            {
                if (circleRenderer && source != null)
                {
                    var node = source.AsNode;

                    if (node != null)
                    {
                        var bg = TaggedTypes.TryGetByTag(Mgmt.presentationControllers, node.visualStyleTag);

                        if (bg != null)
                        {
                            if (pegi.Try_Nested_Inspect(bg).nl(ref changed))
                            {
                                source.visualStyleConfigs[NodesVisualLayer.SelectedPresentationMode.ClassTag] =
                                    bg.Encode().CfgData;
                            }
                        }
                    }
                }

                if (source == null || (!source.InspectingTriggerItems))
                {
                    var altVis = PossibleOverrideVisualConfig;
                    var act    = ActiveConfig;

                    if (altVis != _nodeActiveDefaultVisuals)
                    {
                        if ("Override visuals for {0}".F(altVis == _nodeInactiveVisuals ? "Disabled" : "Entered")
                            .toggleIcon(ref altVis.enabled).nl())
                        {
                            if (altVis.enabled)
                            {
                                altVis.Decode(act.Encode().ToString());
                            }
                        }
                    }

                    ActiveConfig.Nested_Inspect().changes(ref changed);
                }
            }

            if ("Mesh Object".enter(ref inspectedItems, 3).nl())
            {
                if (!LevelArea && "Create Mesh Object".Click())
                {
                    MeshObjectGetOrCreate();
                }

                if (LevelArea && icon.Delete.ClickConfirm("dMo", "This will also erase any data of this meshobject"))
                {
                    LevelArea.FadeAway();
                    LevelArea = null;
                }

                LevelArea.Nested_Inspect().nl(ref changed);
            }

            if ("Image".enter(ref inspectedItems, 4).nl())
            {
                if (_imageIndex != -1)
                {
                    if (!pegi.PaintingGameViewUI)
                    {
                        "Downloading {0} [1]".F(imageUrl, _imageIndex).write();
                    }
                }
                else
                {
                    if ("Image".edit("Will not be saved", 40, ref _coverImage).nl())
                    {
                        SetImage();
                    }

                    var shortUrl = imageUrl.SimplifyDirectory();

                    var reload = false;

                    var changedUrl = "Paste URL".edit(90, ref shortUrl).changes(ref changed);
                    if (changedUrl && (shortUrl.Length > 8 || shortUrl.Length == 0))
                    {
                        reload   = true;
                        imageUrl = shortUrl;
                    }

                    reload |= (imageUrl.Length > 8 && icon.Refresh.Click().changes(ref changed));

                    if (reload)
                    {
                        LoadCoverImage();
                    }

                    pegi.nl();

                    if (_coverImage)
                    {
                        if ("Img Mode".editEnum(50, ref _mode).nl())
                        {
                            SetImage();
                        }

                        if (_mode == ImageMode.Tile)
                        {
                            "Image Scale".edit(70, ref _imageScaling, 1, 10).nl(ref changed);
                        }
                        else
                        {
                            "Hide Label".toggleIcon(ref _hideLabel).nl(ref changed);
                        }

                        if (!pegi.PaintingGameViewUI)
                        {
                            _coverImage.write(200);
                        }
                        pegi.nl();
                    }
                }
            }

            if ("Lerp Debug".enter(ref inspectedItems, 5).nl())
            {
                "Is Lerping: {0}".F(lerpsFinished).nl();
                "Fade portion: {0}".F(fadePortion).nl();
                "Fading: {0}".F(isFading).nl();
            }

            if (!onPlayScreen)
            {
                pegi.nl();

                var seeDependencies = "Dependencies".enter(ref inspectedItems, 8).nl();

                if (!textA || seeDependencies)
                {
                    "Text A".edit(ref textA).nl(ref changed);
                }

                if (!textB || seeDependencies)
                {
                    "Text B".edit(ref textB).nl(ref changed);
                }

                if (!circleRenderer || seeDependencies)
                {
                    "Mesh Renderer".edit(ref circleRenderer).nl(ref changed);
                }

                if (!circleCollider || seeDependencies)
                {
                    "Collider".edit(ref circleCollider).nl(ref changed);
                }

                if (!linkRenderer || seeDependencies)
                {
                    "Link Renderer".edit(ref linkRenderer).nl(ref changed);
                }

                if (!audioSource || seeDependencies)
                {
                    "Aduio Source".edit(ref audioSource).nl(ref changed);
                }
            }
            // }

            if (changed)
            {
                SetDirty();
                bgColor = ActiveConfig.targetColor;
                OnShaderParametersChanged();
            }

            return(changed);
        }