Esempio n. 1
0
        private ImageEffectPreset GetSelectedPreset()
        {
            int index = cbPresets.SelectedIndex;

            if (Presets.IsValidIndex(index))
            {
                return(Presets[index]);
            }

            return(null);
        }
Esempio n. 2
0
        public IHttpActionResult GetPresets(int id)
        {
            Presets presets = db.Presetss.Find(id);

            if (presets == null)
            {
                return(NotFound());
            }

            return(Ok(presets));
        }
Esempio n. 3
0
 private void AddPreset(ImageEffectPreset preset)
 {
     if (preset != null)
     {
         Presets.Add(preset);
         cbPresets.Items.Add(preset);
         cbPresets.SelectedIndex = cbPresets.Items.Count - 1;
         LoadPreset(preset);
         txtPresetName.Focus();
     }
 }
Esempio n. 4
0
        public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props)
        {
            IsDrawing = true;
            //Init
            bool reloadUI = _isFirstOnGUICall || (_doReloadNextDraw && Event.current.type == EventType.Layout) || (materialEditor.target as Material).shader != Shader;

            if (reloadUI)
            {
                InitEditorData(materialEditor);
                Properties = props;
                InitlizeThryUI();
            }

            //Update Data
            Properties = props;
            Shader     = Materials[0].shader;
            Input.Update(IsLockedMaterial);
            ActiveRenderer    = Selection.activeTransform?.GetComponent <Renderer>();
            IsInAnimationMode = AnimationMode.InAnimationMode();

            Active = this;

            GUIManualReloadButton();
            GUIShaderVersioning();

            GUITopBar();
            GUISearchBar();
            Presets.PresetEditorGUI(this);
            ShaderTranslator.SuggestedTranslationButtonGUI(this);

            //PROPERTIES
            foreach (ShaderPart part in MainGroup.parts)
            {
                part.Draw();
            }

            //Render Queue selection
            if (VRCInterface.IsVRCSDKInstalled())
            {
                _vRCFallbackProperty.Draw();
            }
            if (Config.Singleton.showRenderQueue)
            {
                _renderQueueProperty.Draw();
            }

            BetterTooltips.DrawActive();

            GUIFooters();

            HandleEvents();

            IsDrawing = false;
        }
Esempio n. 5
0
 static void SetPresets()
 {
     if (!Directory.Exists(ContentLoader.ContentPath + "/Editor/Presets/"))
     {
         // Adds 2D Presets
         Debug.LogWarning("Creating Presets...");
         Presets.Save(new Object2D("Editor_Preset2DObject", Vector2.Zero, new Vector2(50, 50), 0, null, Alignment.Center, 0), ContentLoader.ContentPath + "/Editor/Presets/2D/Empty.pre", true);
         Presets.Save(new Object2D("Editor_Preset2DObject_Image", Vector2.Zero, new Vector2(50, 50), 0, new Component2D[] { new Image2DComponent(DefaultValues.PixelTexture, Color.White) }, Alignment.Center, 0), ContentLoader.ContentPath + "/Editor/Presets/2D/Image.pre", true);
         Presets.Save(new Object2D("Editor_Preset2DObject_Text", Vector2.Zero, new Vector2(135, 30), 0, new Component2D[] { new Text2DComponent("Hello World!", DefaultValues.DefaultFont, Color.White, 0.18f, Alignment.TopLeft, true) }, Alignment.Center, 0), ContentLoader.ContentPath + "/Editor/Presets/2D/Text.pre", true);
     }
 }
Esempio n. 6
0
        /// <summary>
        /// Add a new preset to the settings preset list.
        /// </summary>
        /// <param name="preset">Preset object to add.</param>
        /// <param name="save">If you want to save the file afterwards.</param>
        public void AddPreset(Preset preset, bool save = true)
        {
            // Add the preset to the list.
            Presets.Add(preset);

            // Save the file if save is true
            if (save)
            {
                Save(this);
            }
        }
Esempio n. 7
0
        public void SavingAndLoadingCustom(string name, string flags)
        {
            Presets.Add(name, flags);

            var loaded = Presets.Load(name);

            Assert.Equal(name, loaded.Name);
            Assert.Equal(flags, loaded.FlagString);

            Presets.Remove(name);
        }
Esempio n. 8
0
 private void AddPreset(ImageEffectPreset preset)
 {
     if (preset != null)
     {
         Presets.Add(preset);
         ListViewItem lvi = new ListViewItem(preset.ToString());
         lvPresets.Items.Add(lvi);
         lvPresets.SelectLast();
         txtPresetName.Focus();
     }
 }
Esempio n. 9
0
 /// <summary>
 /// Retrieves a Preset by its MD5 hash. If the hash is not
 /// found in the repository, this method returns null.
 /// </summary>
 /// <param name="hash">MD5 hash to look up.</param>
 /// <returns>Corresponding Preset, or null if no Preset with
 /// this hash exists.</returns>
 public Preset FindByHash(string hash)
 {
     if (String.IsNullOrWhiteSpace(hash))
     {
         return(null);
     }
     else
     {
         return(Presets.FirstOrDefault(p => p.ComputeMD5Hash() == hash));
     }
 }
Esempio n. 10
0
        private void DeleteExec(object sender, ExecutedRoutedEventArgs e)
        {
            int selectedIndex = mPresetsList.SelectedIndex;

            Presets.RemoveAt(selectedIndex);

            if (selectedIndex >= Presets.Count)
            {
                selectedIndex = Presets.Count - 1;
            }
            mPresetsList.SelectedIndex = selectedIndex;
        }
Esempio n. 11
0
        private void buttonDeletePreset_Click(object sender, EventArgs e)
        {
            Preset selectedPreset = this.listBox1.SelectedItem as Preset;

            if (selectedPreset != null)
            {
                int index = this.listBox1.SelectedIndex;
                Presets.RemoveAt(index);
                this.listBox1.Items.Remove(selectedPreset);
            }
            UpdateDisplay();
        }
Esempio n. 12
0
 void ToggelPreset(Material m, bool on)
 {
     if (tickedPresets.Contains(m) && !on)
     {
         tickedPresets.Remove(m);
     }
     if (!tickedPresets.Contains(m) && on)
     {
         tickedPresets.Add(m);
     }
     Presets.ApplyList(shaderEditor, beforePreset, tickedPresets);
 }
Esempio n. 13
0
            private async Task Share()
            {
                var data = Presets.ExportToPresetData();

                if (data == null)
                {
                    return;
                }
                await SharingUiHelper.ShareAsync(SharedEntryType.VideoSettingsPreset,
                                                 Path.GetFileNameWithoutExtension(UserPresetsControl.GetCurrentFilename(Presets.PresetableKey)), null,
                                                 data);
            }
Esempio n. 14
0
        /// <summary>
        /// Adding new preset.
        /// </summary>
        private void OnAddPreset()
        {
            // Can't do unless game is loaded.
            if (!CheckCanDo())
            {
                return;
            }

            try
            {
                // Create window for add preset.
                var win = new NewPreset
                {
                    // Owner set to MainWindow.
                    Owner = Application.Current.MainWindow
                };

                // Get the VM for this window.
                var vm = win.DataContext as NewPresetViewModel;

                // Show the dialog for the preset window.
                if (win.ShowDialog() == true)
                {
                    // Initialize the creation of our preset with the preset name.
                    var p = new Preset()
                    {
                        Name = vm.Name
                    };

                    // If we use the current waymarks, set them in our preset.
                    if (vm.UseCurrentWaymarks)
                    {
                        p.A     = GameMemory.A;
                        p.B     = GameMemory.B;
                        p.C     = GameMemory.C;
                        p.D     = GameMemory.D;
                        p.One   = GameMemory.One;
                        p.Two   = GameMemory.Two;
                        p.Three = GameMemory.Three;
                        p.Four  = GameMemory.Four;
                        p.MapID = GameMemory.MapID;
                    }

                    // Add the preset.
                    Presets.Add(p);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Something happened while creating your preset!", "Paisley Park", MessageBoxButton.OK, MessageBoxImage.Error);
                logger.Error(ex, "Exception while adding a new preset.");
            }
        }
Esempio n. 15
0
        private void RefreshPresets()
        {
            Presets = ProcAirships.Instance.Presets.Where((preset) => { return(preset.bodyID == bodyGrid.Selection); }).ToList();
            Presets.Sort(new PresetComparer());

            if (null != presetsList)
            {
                IEnumerable <PresetList.Item> items = Presets.Select <EditorPreset, PresetList.Item>((p) => { return(new PresetList.Item(p.name + " (" + p.altitude + "m)")); });
                presetsList.ClearItems();
                presetsList.AddItems(items);
            }
        }
 public bool DeletePreset(int index)
 {
     if (index >= 0 && index < Presets.Count)
     {
         Presets.RemoveAt(index);
         return(true);
     }
     else
     {
         return(false);
     }
 }
Esempio n. 17
0
        private void GUITopBar()
        {
            //if header is texture, draw it first so other ui elements can be positions below
            if (_shaderHeader != null && _shaderHeader.Options.texture != null)
            {
                _shaderHeader.Draw();
            }

            bool drawAboveToolbar = EditorGUIUtility.wideMode == false;

            if (drawAboveToolbar)
            {
                _shaderHeader.Draw(new CRect(EditorGUILayout.GetControlRect()));
            }

            Rect mainHeaderRect = EditorGUILayout.BeginHorizontal();

            //draw editor settings button
            if (GuiHelper.ButtonWithCursor(Styles.icon_style_settings, "Settings", 25, 25))
            {
                EditorWindow.GetWindow <Settings>(false, "Thry Settings", true);
            }
            if (GuiHelper.ButtonWithCursor(Styles.icon_style_search, "Search", 25, 25))
            {
                DoShowSearchBar = !DoShowSearchBar;
                if (!DoShowSearchBar)
                {
                    ClearSearch();
                }
            }
            Presets.PresetGUI(this);

            //draw master label text after ui elements, so it can be positioned between
            if (_shaderHeader != null && !drawAboveToolbar)
            {
                _shaderHeader.Draw(new CRect(mainHeaderRect));
            }

            GUILayout.FlexibleSpace();
            Rect popupPosition;

            if (GuiHelper.ButtonWithCursor(Styles.icon_style_tools, "Tools", 25, 25, out popupPosition))
            {
                PopupTools(popupPosition);
            }
            ShaderTranslator.TranslationSelectionGUI(this);
            if (GuiHelper.ButtonWithCursor(Styles.icon_style_thryIcon, "Thryrallo", 25, 25))
            {
                Application.OpenURL("https://www.twitter.com/thryrallo");
            }
            EditorGUILayout.EndHorizontal();
        }
Esempio n. 18
0
        /// <summary>
        /// Copies the this.
        /// </summary>
        /// <param name="o">The o.</param>
        private void CopyThis(ZeroitBusyBarPainterPathGradient o)
        {
            _Preset = o._Preset;

            _Shape = o._Shape;

            _ColorCentre     = o._ColorCentre;
            _ColorCorner     = o._ColorCorner;
            _ColorVertical   = o._ColorVertical;
            _ColorHorizontal = o._ColorHorizontal;

            //			_Wrap             = o._Wrap            ;
        }
Esempio n. 19
0
 private void AddPreset(ImageEffectPreset preset)
 {
     if (preset != null)
     {
         Presets.Add(preset);
         cbPresets.Items.Add(preset);
         ignorePresetsSelectedIndexChanged = true;
         cbPresets.SelectedIndex           = cbPresets.Items.Count - 1;
         ignorePresetsSelectedIndexChanged = false;
         LoadPreset(preset);
         txtPresetName.Focus();
     }
 }
Esempio n. 20
0
        void UpdatePresetList()
        {
            Presets.Clear();

            for (var a = 0; a < 128; ++a)
            {
                var name = BassMidi.FontGetPreset(_font, a, _drums ? 128 : 0) ?? ""; // get preset name

                Presets.Add(new KeyValuePair <int, string>(a, $"{a:D3}: {name}"));
            }

            Preset = 0;
        }
Esempio n. 21
0
 void GetPresetValues(Presets preset)
 {
     X_LB_SavedPresets.GetPresetValues(this, "color", preset.ToString());
     X_LB_SavedPresets.GetPresetValues(this, "thinStyle", preset.ToString());
     X_LB_SavedPresets.GetPresetValues(this, "darkStyle", preset.ToString());
     X_LB_SavedPresets.GetPresetValues(this, "fadeEffect", preset.ToString());
     X_LB_SavedPresets.GetPresetValues(this, "lightSize", preset.ToString());
     X_LB_SavedPresets.GetPresetValues(this, "freezeShape", preset.ToString());
     X_LB_SavedPresets.GetPresetValues(this, "segmentSize", preset.ToString());
     X_LB_SavedPresets.GetPresetValues(this, "flickeringStrength", preset.ToString());
     X_LB_SavedPresets.GetPresetValues(this, "streamingSpeed", preset.ToString());
     X_LB_SavedPresets.GetPresetValues(this, "branchAmount", preset.ToString());
 }
Esempio n. 22
0
        public async Task DeleteItemClickedAsync(object sender, ButtonClickArgs e)
        {
            if (SelectedPreset == null ||
                MessageBoxProvider.ShowDeleteDialog("Preset")?.DialogResult != DialogResults.Yes)
            {
                return;
            }

            await _presetController.DeleteAsync(SelectedPreset);

            Presets.Remove(SelectedPreset);
            SelectedPreset = null;
        }
        /// <summary>
        ///     Sets a few defaults the players to use
        /// </summary>
        private static void InitializeDefaultPresetWindows()
        {
            Standard = CreatePresetWindows("Standard*", 0);

            Presets.Add(CreatePresetWindows("Peaceful", -3));
            Presets.Add(CreatePresetWindows("Lenient", -2));
            Presets.Add(CreatePresetWindows("Chill", -1));
            Presets.Add(Standard);
            Presets.Add(CreatePresetWindows("Strict", 1));
            Presets.Add(CreatePresetWindows("Tough", 2));
            Presets.Add(CreatePresetWindows("Extreme", 3));
            Presets.Add(CreatePresetWindows("Impossible", 8));
        }
Esempio n. 24
0
        private ImageEffectPreset GetSelectedPreset(out ListViewItem lvi)
        {
            int index = lvPresets.SelectedIndex;

            if (Presets.IsValidIndex(index))
            {
                lvi = lvPresets.Items[index];
                return(Presets[index]);
            }

            lvi = null;
            return(null);
        }
 public int ImportPreset(GamePreset gamePresetData)
 {
     try
     {
         WaymarkPreset importedPreset = WaymarkPreset.Parse(gamePresetData);
         importedPreset.Name = "Imported";
         Presets.Add(importedPreset);
         return(Presets.Count - 1);
     }
     catch
     {
         return(-1);
     }
 }
 /// <summary>
 /// Removing selected preset.
 /// </summary>
 private void OnRemovePreset()
 {
     if (SelectedItem != null)
     {
         if (MessageBox.Show(
                 "Are you sure you want to delete this preset?",
                 "Paisley Park",
                 MessageBoxButton.YesNo,
                 MessageBoxImage.Warning) == MessageBoxResult.Yes)
         {
             Presets.Remove(SelectedItem);
         }
     }
 }
Esempio n. 27
0
        /// <summary>
        /// Import presets from path.
        /// </summary>
        public void LoadPresets(string path, bool merge = false)
        {
            if (!merge && Presets.Count > 0)
            {
                Presets.Clear();
            }

            List <Preset> presetData = new List <Preset>();

            if (TryDeserialize(path, ref presetData))
            {
                Presets.AddRange(presetData);
            }
        }
Esempio n. 28
0
        private void BuildPresets(XmlElement presetsElement)
        {
            foreach (XmlNode child in presetsElement.ChildNodes)
            {
                XmlElement childElement = child as XmlElement;
                if (childElement == null)
                {
                    continue;
                }

                Preset preset = new Preset(RootGroup, childElement);
                Presets.Add(preset);
            }
        }
Esempio n. 29
0
        public void SetSettings(XmlNode settings)
        {
            ConvertOldSettings(settings);
            var element = (XmlElement)settings;

            disableNbrSplitCheck = true;

            AutoStart         = SettingsHelper.ParseBool(settings["AutoStart"], DEFAULT_AUTOSTART);
            AutoReset         = SettingsHelper.ParseBool(settings["AutoReset"], DEFAULT_AUTORESET);
            AutoUpdatePresets = SettingsHelper.ParseBool(settings["AutoUpdatePresets"], DEFAULT_AUTOUPDATEPRESETS);

            if (settings["AutoSplitList"] != null)
            {
                CustomAutosplits.Clear();
                AutoSplitList customList = null;
                try { customList = AutoSplitList.FromXml(settings["AutoSplitList"], _autoSplitEnv); }
                catch { }
                if (customList != null)
                {
                    CustomAutosplits.AddRange(customList);
                }
            }

            Preset = SettingsHelper.ParseString(settings["Preset"], DEFAULT_PRESET_NAME);
            if (!updatedPresets)
            {
                if ((AutoUpdatePresets || !File.Exists(PRESETS_FILE_PATH)) && !CheckForComponentUpdate())
                {
                    if (DownloadPresetsFile())
                    {
                        LoadPresets();
                    }
                }
                updatedPresets = true;
            }
            UsePreset(Presets.FirstOrDefault(p => p.Name == Preset) ?? CustomAutosplits);

            LoadBearCartConfig();
            BearCartPBNotification    = SettingsHelper.ParseBool(settings["BearCartPBNotification"], DEFAULT_BEARCARTPBNOTIFICATION);
            PlayBearCartSound         = SettingsHelper.ParseBool(settings["PlayBearCartSound"], DEFAULT_PLAYBEARCARTSOUND);
            BearCartSoundPath         = SettingsHelper.ParseString(settings["BearCartSoundPath"], String.Empty);
            PlayBearCartSoundOnlyOnPB = SettingsHelper.ParseBool(settings["PlayBearCartSoundOnlyOnPB"], DEFAULT_PLAYBEARCARTSOUNDONLYONPB);
            if (_component.MediaPlayer != null)
            {
                _component.MediaPlayer.GeneralVolume = SettingsHelper.ParseInt(settings["Volume"], 100);
            }

            disableNbrSplitCheck = false;
            CheckNbrAutoSplits();
        }
Esempio n. 30
0
 void ReloadPresets()
 {
     Presets.Clear();
     subscription.Add(CurrentSession.GetPresets(profileToken)
                      .ObserveOnCurrentDispatcher()
                      .Subscribe(presets => {
         presets.ForEach(pres => {
             Presets.Add(pres);
         });
     }, err => {
         dbg.Error(err);
         SetErrorMessage(err.Message);
     }));
 }
Esempio n. 31
0
 public static MCACommand SetPresets(Presets presets, uint value)
 {
     return new MCACommand(CommandName.CMD_SET_PRESETS, (byte)presets, value);
 }
Esempio n. 32
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // Load saved configuration
            Config.Prop.load();

            cmdLine = new CmdLine(this);
            avrdude = new Avrdude();
            avrsize = new Avrsize();

            avrdude.OnProcessStart += avrdude_OnProcessStart;
            avrdude.OnProcessEnd += avrdude_OnProcessEnd;
            avrdude.OnVersionChange += avrdude_OnVersionChange;
            avrdude.OnDetectedMCU += avrdude_OnDetectedMCU;

            avrdude.load();
            avrsize.load();

            // Setup memory files/usage bars
            // Flash
            fileFlash = new MemTypeFile(txtFlashFile, avrsize);
            fileFlash.sizeChanged += fileFlash_sizeChanged;
            pbFlashUsage.Width = txtFlashFile.Width;
            pbFlashUsage.Height = 3;
            pbFlashUsage.Location = new Point(txtFlashFile.Location.X, txtFlashFile.Location.Y - pbFlashUsage.Height);
            pbFlashUsage.Image = new Bitmap(pbFlashUsage.Width, pbFlashUsage.Height);
            memoryUsageBar(fileFlash, pbFlashUsage, 0);

            // EEPROM
            fileEEPROM = new MemTypeFile(txtEEPROMFile, avrsize);
            fileEEPROM.sizeChanged += fileEEPROM_sizeChanged;
            pbEEPROMUsage.Width = txtEEPROMFile.Width;
            pbEEPROMUsage.Height = 3;
            pbEEPROMUsage.Location = new Point(txtEEPROMFile.Location.X, txtEEPROMFile.Location.Y - pbEEPROMUsage.Height);
            pbEEPROMUsage.Image = new Bitmap(pbEEPROMUsage.Width, pbEEPROMUsage.Height);
            memoryUsageBar(fileEEPROM, pbEEPROMUsage, 0);

            enableClientAreaDrag(Controls);

            // Update serial ports etc
            cmbPort.DropDown += cbPort_DropDown;

            // Drag and drop flash file
            gbFlashFile.AllowDrop = true;
            gbFlashFile.DragEnter += event_DragEnter;
            gbFlashFile.DragDrop += event_DragDrop;

            // Drag and drop EEPROM file
            gbEEPROMFile.AllowDrop = true;
            gbEEPROMFile.DragEnter += event_DragEnter;
            gbEEPROMFile.DragDrop += event_DragDrop;

            // Flash file
            openFileDialog1.Filter = "Hex files (*.hex)|*.hex";
            openFileDialog1.Filter += "|EEPROM files (*.eep)|*.eep";
            openFileDialog1.Filter += "|All files (*.*)|*.*";
            openFileDialog1.CheckFileExists = false;
            openFileDialog1.FileName = "";
            openFileDialog1.Title = "Open flash file";

            // EEPROM file
            openFileDialog2.Filter = "EEPROM files (*.eep)|*.eep";
            openFileDialog2.Filter += "|Hex files (*.hex)|*.hex";
            openFileDialog2.Filter += "|All files (*.*)|*.*";
            openFileDialog2.CheckFileExists = false;
            openFileDialog2.FileName = "";
            openFileDialog2.Title = "Open EEPROM file";

            // MCU & programmer combo box data source
            setComboBoxDataSource(cmbMCU, avrdude.mcus, "fullName");
            cmbMCU.SelectedIndexChanged += cmbMCU_SelectedIndexChanged;
            setComboBoxDataSource(cmbProg, avrdude.programmers, "fullName");
            cmbProg.SelectedIndexChanged += cmbProg_SelectedIndexChanged;

            // USBasp frequency settings
            cmbUSBaspFreq.Hide();
            setComboBoxDataSource(cmbUSBaspFreq, Avrdude.USBaspFreqs, "name");
            cmbUSBaspFreq.Width = txtBitClock.Width;
            cmbUSBaspFreq.Left = txtBitClock.Left;
            cmbUSBaspFreq.Top = txtBitClock.Top;

            // Flash & EEPROM file formats
            setComboBoxDataSource(cmbFlashFormat, Avrdude.fileFormats, "fullName");
            setComboBoxDataSource(cmbEEPROMFormat, Avrdude.fileFormats, "fullName");

            // Verbosity levels
            cmdVerbose.Items.Clear();
            for (byte i=0;i<5;i++)
                cmdVerbose.Items.Add(i);
            cmdVerbose.SelectedIndex = 0;

            // Tool tips
            ToolTips = new ToolTip();
            ToolTips.ReshowDelay = 100;
            ToolTips.UseAnimation = false;
            ToolTips.UseFading = false;
            ToolTips.SetToolTip(cmbProg, "Programmer");
            ToolTips.SetToolTip(cmbMCU, "MCU to program");
            ToolTips.SetToolTip(cmbPort, "Set COM/LTP/USB port");
            ToolTips.SetToolTip(txtBaudRate, "Port baud rate");
            ToolTips.SetToolTip(txtBitClock, "Bit clock period (us)");
            ToolTips.SetToolTip(txtFlashFile, "Hex file (.hex)" + Environment.NewLine + "You can also drag and drop files here");
            ToolTips.SetToolTip(pFlashOp, "");
            ToolTips.SetToolTip(txtEEPROMFile, "EEPROM file (.eep)" + Environment.NewLine + "You can also drag and drop files here");
            ToolTips.SetToolTip(pEEPROMOp, "");
            ToolTips.SetToolTip(cbForce, "Skip signature check");
            ToolTips.SetToolTip(cbNoVerify, "Don't verify after writing");
            ToolTips.SetToolTip(cbDisableFlashErase, "Don't erase flash before writing");
            ToolTips.SetToolTip(cbEraseFlashEEPROM, "Erase both flash and EEPROM");
            ToolTips.SetToolTip(cbDoNotWrite, "Don't write anything, used for debugging AVRDUDE");
            ToolTips.SetToolTip(txtLFuse, "Low fuse");
            ToolTips.SetToolTip(txtHFuse, "High fuse");
            ToolTips.SetToolTip(txtEFuse, "Extended fuse");
            ToolTips.SetToolTip(txtLock, "Lock bits");
            ToolTips.SetToolTip(btnFlashGo, "Only write/read/verify flash");
            ToolTips.SetToolTip(btnEEPROMGo, "Only write/read/verify EEPROM");
            ToolTips.SetToolTip(btnWriteFuses, "Write fuses now");
            ToolTips.SetToolTip(btnWriteLock, "Write lock now");
            ToolTips.SetToolTip(cbSetFuses, "Write fuses when programming");
            ToolTips.SetToolTip(cbSetLock, "Write lock when programming");

            // Load saved presets
            presets = new Presets(this);
            presets.load();
            presets.setDataSource(cmbPresets);

            // Enable/disable tool tips based on saved config
            ToolTips.Active = Config.Prop.toolTips;

            ready = true;

            // If a preset has not been specified by the command line then use the last used preset
            // Credits:
            // Uwe Tanger (specifing preset in command line)
            // neptune (sticky presets)
            if (presetToLoad == null)
                presetToLoad = Config.Prop.preset;

            // Load preset
            PresetData p = presets.presets.Find(s => s.name == presetToLoad);
            cmbPresets.SelectedItem = (p != null) ? p : presets.presets.Find(s => s.name == "Default");

            // Check for updates
            UpdateCheck.check.checkNow();
        }
Esempio n. 33
0
        //Handy attributes to use on properties
        //[Browsable(false)]
        //[ReadOnly(true)]
        internal void SetPreset(Presets preset)
        {
            YesNo y = YesNo.Yes;
            YesNo n = YesNo.No;

            bool full = preset == Presets.FullPrep;
            bool song = preset == Presets.OnlyAddSongs;
            bool space = preset == Presets.OnlySaveSpace;

            this.EnableAudioBlanking = (full ? y : n);
            this.BlankTierSongs = (full ? y : n);
            this.BlankBonus = (full ? y : n);
            this.BlankAddedSongs = (full ? y : n);
            this.BlankNonCareerSongs = (full ? y : n);
            this.BlankBattles = (full ? y : n);

            this.EnableTierEditing = (full || song ? y : n);
            this.TiersCount = string.Empty;
            this.TierSongsCount = string.Empty;
            this.BonusTierSongsCount = string.Empty;
            this.RemoveBossBattles = YesNo.No;

            this.UnlockSetlistTiers = (full ? y : n);
            this.CompleteTier1Song = (full ? y : n);
            this.AddNonCareerTracksToBonus = (full || song ? y : n);
            this.SetCheats = (full ? y : n);
            this.FreeStore = (full ? y : n);
            this.DefaultBonusSongArt = (full ? y : n);
            this.DefaultBonusSongInfo = (full ? y : n);
            this.DefaultBonusSongInfoText = "Custom song replaced with TheGHOST";

            this.ReplaceVideos = (full || space ? y : n);
            this.RemoveIntroVideos = (full || space ? y : n);
            this.RemoveUnusedFiles = (full || space ? y : n);
            this.RemoveOtherLanguages = (full || space ? y : n);
            this.RemoveUpdatePartition = (full || space ? y : n);
            this.ManualEditing = n;
        }
Esempio n. 34
0
        /*
        public static void initVLC()
        {
            if (Environment.Is64BitOperatingSystem)
            {
                // Set libvlc.dll and libvlccore.dll directory path
                VlcContext.LibVlcDllsPath = @"VLC\";

                // Set the vlc plugins directory path
                VlcContext.LibVlcPluginsPath = @"VLC\plugins";
            }
            else
            {
                // Set libvlc.dll and libvlccore.dll directory path
                VlcContext.LibVlcDllsPath = @"VLC\";

                // Set the vlc plugins directory path
                VlcContext.LibVlcPluginsPath = @"VLC\plugins";
            }

            // Ignore the VLC configuration file
            VlcContext.StartupOptions.IgnoreConfig = true;
#if DEBUG
            // Enable file based logging
            VlcContext.StartupOptions.LogOptions.LogInFile = true;

            // Shows the VLC log console (in addition to the applications window)
            VlcContext.StartupOptions.LogOptions.ShowLoggerConsole = true;
#else
            VlcContext.StartupOptions.LogOptions.ShowLoggerConsole = false;
            VlcContext.StartupOptions.LogOptions.LogInFile = false;
#endif
            // Set the log level for the VLC instance
            VlcContext.StartupOptions.LogOptions.Verbosity = VlcLogVerbosities.Debug;
            VlcContext.StartupOptions.AddOption("--ffmpeg-hw");
            // Disable showing the movie file name as an overlay
            VlcContext.StartupOptions.AddOption("--no-video-title-show");
            VlcContext.StartupOptions.AddOption("--rtsp-tcp");
            VlcContext.StartupOptions.AddOption("--rtsp-mcast");
            // VlcContext.StartupOptions.AddOption("--rtsp-host=192.168.10.35");
            // VlcContext.StartupOptions.AddOption("--sap-addr=192.168.10.35");
            VlcContext.StartupOptions.AddOption("--rtsp-port=8554");
            VlcContext.StartupOptions.AddOption("--rtp-client-port=8554");
            VlcContext.StartupOptions.AddOption("--sout-rtp-rtcp-mux");
            VlcContext.StartupOptions.AddOption("--rtsp-wmserver");


            VlcContext.StartupOptions.AddOption("--file-caching=18000");
            VlcContext.StartupOptions.AddOption("--sout-rtp-caching=18000");
            VlcContext.StartupOptions.AddOption("--sout-rtp-port=8554");
            VlcContext.StartupOptions.AddOption("--sout-rtp-proto=tcp");
            VlcContext.StartupOptions.AddOption("--network-caching=1000");

            VlcContext.StartupOptions.AddOption("--vout-filter=wall");
            VlcContext.StartupOptions.AddOption("--wall-cols=2");
            VlcContext.StartupOptions.AddOption("--wall-rows=2");

            // Pauses the playback of a movie on the last frame
            VlcContext.StartupOptions.AddOption("--play-and-pause");
            VlcContext.CloseAll();
            // Initialize the VlcContext
            VlcContext.Initialize();
        }
        */

        private void Application_Startup(object sender, StartupEventArgs e)
        {
            bool login = true;
            Rows = new List<CsvRow>();
            RowsSend = new List<CsvRow>();
            Fonts = ExCss.ReadFile(@"Asset\Fonts\font-awesome.min.css");
            Timethread = new Thread(CheckTimeFunctionThread);
            Timethread.IsBackground = true;
            listSerialPort = new List<SerialPort>();
            QueueCMD = new Queue<string>();
            m_bInitSDK = CHCNetSDK.NET_DVR_Init();
            if (m_bInitSDK == false)
            {
                MessageBox.Show("NET_DVR_Init error!");
                return;
            }
            if (!File.Exists(_FILE_CSV_COMMAND))
            {
                File.Create(_FILE_CSV_COMMAND);
            }
            if (!File.Exists(_FILE_Send_COMMAND))
            {
                File.Create(_FILE_Send_COMMAND);
            }
            //  initVLC();
            DefineCommand = CommandDefine.Read(_FILE_DEFINE_COMMAND);
            setting = Config.Read(_FILE_Config);
            if (!Directory.Exists("Data"))
            {
                DirectoryInfo di = Directory.CreateDirectory("Data");
                di.Attributes = FileAttributes.Directory | FileAttributes.Hidden;
            }
            if (!Directory.Exists(setting.Folder))
            {
                Directory.CreateDirectory(setting.Folder);
            }
            curDate = DateTime.Now;
            Timethread.Start();
            curFolder = System.IO.Path.Combine(setting.Folder, this.curDate.ToString("dd-MM-yyyy"));
            if (!Directory.Exists(curFolder))
            {
                Directory.CreateDirectory(curFolder);
            }
            DataUser = Users.read(@"Data\User.mtc");
            if (DataUser == null)
            {
                DataUser = new Users();
                User root = new User("root", 1);
                root.Pass = "******".toMD5();
                root.type = 0;
                root.FullName = "Root";
                DataUser.Add(root);
                Users.write(_FILE_User_Data, DataUser);
            }
            DataCamera = Cameras.Read(_FILE_Camera_Data);
            DataPreset = Presets.Read(_FILE_PRESET_DATA);
            DataAlarm = Alarms.Read(_FILE_Alarm_Data);
            this.checkFile = new Thread(checkFileFunctionThread);
            checkFile.IsBackground = true;
            this.checkFile.Start();
#if DEBUG
            if (DataCamera.Count == 0)
            {
                Camera camera = new Camera("192.168.10.199");
                camera.name = "Camera Demo";
                camera.channel = 1;
                camera.port = 8000;
                camera.admin = "admin";
                camera.pass = "******";
                camera.icon = "fa-video-camera";
                DataCamera.Add(camera);
            }
            
            if (DataUser.Datas.Count < 2)
            {
                User root = new User("admin", 2);
                root.Pass = "******".toMD5();
                root.type = 1;
                root.FullName = "Admin";
                DataUser.Add(root);

                User root2 = new User("htdm",3);
                root2.Pass = "******".toMD5();
                root2.type = 2;
                root2.FullName = "Camera";
                DataUser.Add(root2);
                Users.write(_FILE_User_Data, DataUser);
            }
            
#endif
            var listCom = getListCOM();
            if (listCom.Length > 0)
            {
                foreach (string i in listCom)
                {
                    try
                    {
                        SerialPort serialPort = new SerialPort();
                        serialPort = new SerialPort();
                        serialPort.openCOM(i, BAUDRATE, DATABITS, StopBits.One);
                        serialPort.DataReceived += serialPort_DataReceived;
                        serialPort.sendCommand("#0$");
                        listSerialPort.Add(serialPort);
                    }
                    catch (Exception)
                    {

                    }
                }

            }
            Map = Map.Read(_FILE_Map_Data);
            for (int i = 0; i != e.Args.Length; i += 2)
            {
                if (e.Args[i] == "-u")
                {
                    string hash = e.Args[i + 1];
                    User u = App.DataUser.Login(hash);
                    if (u != null)
                    {
                        login = false;
                        App.User = u;
                    }
                }
                else if (e.Args[i] == "-mode")
                {
                    Mode = (Camera_Final.Mode)int.Parse(e.Args[i + 1]);
                }
            }
            if (login)
            {
                this.MainWindow = new Login();
            }
            else
            {
                this.MainWindow = new MainWindow();
            }
            this.MainWindow.Show();
        }