Beispiel #1
0
 /// <summary>
 /// If automatic update checking is enabled, checks if there are any updates available.
 /// Returns the download URL if an update is available.
 /// Returns null if no update is available, or if no check was performed.
 /// </summary>
 public static Task<string> CheckForUpdatesIfEnabledAsync(DNSpySettings spySettings)
 {
     var tcs = new TaskCompletionSource<string>();
     UpdateSettings s = new UpdateSettings(spySettings);
     if (checkForUpdateCode && s.AutomaticUpdateCheckEnabled) {
         // perform update check if we never did one before;
         // or if the last check wasn't in the past 7 days
         if (s.LastSuccessfulUpdateCheck == null
             || s.LastSuccessfulUpdateCheck < DateTime.UtcNow.AddDays(-7)
             || s.LastSuccessfulUpdateCheck > DateTime.UtcNow)
         {
             GetLatestVersionAsync().ContinueWith(
                 delegate (Task<AvailableVersionInfo> task) {
                     try {
                         s.LastSuccessfulUpdateCheck = DateTime.UtcNow;
                         AvailableVersionInfo v = task.Result;
                         if (v.Version > currentVersion)
                             tcs.SetResult(v.DownloadUrl);
                         else
                             tcs.SetResult(null);
                     } catch (AggregateException) {
                         // ignore errors getting the version info
                         tcs.SetResult(null);
                     }
                 });
         } else {
             tcs.SetResult(null);
         }
     } else {
         tcs.SetResult(null);
     }
     return tcs.Task;
 }
        /// <summary>
        /// Initializes a new instance of class RoleSelectionControl
        /// </summary>
        /// <param name="roles">List of existing roles</param>
        /// <param name="settings"> </param>
        public RoleSelectionControl(List <Entity> roles, UpdateSettings settings)
        {
            InitializeComponent();

            this.roles    = roles;
            this.settings = settings;
        }
Beispiel #3
0
        /// <summary>
        /// If automatic update checking is enabled, checks if there are any updates available.
        /// Returns the download URL if an update is available.
        /// Returns null if no update is available, or if no check was performed.
        /// </summary>
        public static async Task <string> CheckForUpdatesIfEnabledAsync(ILSpySettings spySettings)
        {
            UpdateSettings s = new UpdateSettings(spySettings);

            // If we're in an MSIX package, updates work differently
            if (s.AutomaticUpdateCheckEnabled && !WindowsVersionHelper.HasPackageIdentity)
            {
                // perform update check if we never did one before;
                // or if the last check wasn't in the past 7 days
                if (s.LastSuccessfulUpdateCheck == null ||
                    s.LastSuccessfulUpdateCheck < DateTime.UtcNow.AddDays(-7) ||
                    s.LastSuccessfulUpdateCheck > DateTime.UtcNow)
                {
                    return(await CheckForUpdateInternal(s));
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
Beispiel #4
0
        /// <summary>
        /// Lädt die Konfigurationsdatei aus dem Anwendungsverzeichnis des Updaters.
        /// </summary>
        private void loadConfig()
        {
            try {
                var    t_config     = new InternalConfig();
                var    t_settings   = new UpdateSettings();
                string SettingsPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "update.xml");

                if (!File.Exists(SettingsPath))
                {
                    throw new FileNotFoundException(SettingsPath);
                }

                using (var sr = new StreamReader(SettingsPath)) {
                    var xs = new XmlSerializer(typeof(UpdateSettings));
                    t_settings      = (UpdateSettings)xs.Deserialize(sr);
                    t_config.Result = t_settings.Result;
                    t_config.ServerConfiguration = t_settings.Config;
                    t_config.Settings            = t_settings;
                    m_config = t_config;
                }
            }
            //catch (Exception ex) { raiseException(ex); }
            catch {
                throw;
            }
        }
Beispiel #5
0
 public static Task<string> CheckForUpdatesAsync(ILSpySettings spySettings)
 {
     var tcs = new TaskCompletionSource<string>();
     UpdateSettings s = new UpdateSettings(spySettings);
     CheckForUpdateInternal(tcs, s);
     return tcs.Task;
 }
Beispiel #6
0
        /// <summary>
        /// If automatic update checking is enabled, checks if there are any updates available.
        /// Returns the download URL if an update is available.
        /// Returns null if no update is available, or if no check was performed.
        /// </summary>
        public static Task <string> CheckForUpdatesIfEnabledAsync(ILSpySettings spySettings)
        {
            var            tcs = new TaskCompletionSource <string>();
            UpdateSettings s   = new UpdateSettings(spySettings);

            if (s.AutomaticUpdateCheckEnabled)
            {
                // perform update check if we never did one before;
                // or if the last check wasn't in the past 7 days
                if (s.LastSuccessfulUpdateCheck == null ||
                    s.LastSuccessfulUpdateCheck < DateTime.UtcNow.AddDays(-7) ||
                    s.LastSuccessfulUpdateCheck > DateTime.UtcNow)
                {
                    CheckForUpdateInternal(tcs, s);
                }
                else
                {
                    tcs.SetResult(null);
                }
            }
            else
            {
                tcs.SetResult(null);
            }
            return(tcs.Task);
        }
Beispiel #7
0
        public UpdateManager(string basePath, string productName, string productVersion)
        {
            if (!Directory.Exists(basePath))
            {
                throw new ArgumentException("The specified path must be valid and exist as a directory.", "basePath");
            }
            BasePath       = basePath;
            ProductName    = productName;
            ProductVersion = productVersion;
            try
            {
                Settings = new UpdateSettings();
                State    = new UpdateState();
                Channel  = new UpdateSettings(ChannelName = Settings.Channel);
            }
            catch (ArgumentException)
            {
                // Updater.ini doesn't exist. That's cool, we'll just disable updating.
            }

            // Check for elevation to update; elevation is needed if the update writes failed and the user is NOT an
            // Administrator. Weird cases (like no permissions on the directory for anyone) are not handled.
            try
            {
                TestUpdateWrites();
            }
            catch
            {
                var identity  = WindowsIdentity.GetCurrent();
                var principal = new WindowsPrincipal(identity);
                UpdaterNeedsElevation = !principal.IsInRole(WindowsBuiltInRole.Administrator);
            }
        }
Beispiel #8
0
        /// <summary>
        /// Kontruktor
        /// </summary>
        /// <param name="Settings">Die lokalen Updateeinstellungen</param>
        /// <param name="Result">Das Suchresultat</param>
        /// <param name="Config">Die heruntergeladene Updatekonfiguration</param>
        /// <param name="changelogs">Die Changelogs</param>
        /// <param name="requestElevation">Gibt an, ob eine Elevation notwendig ist.</param>
        public updatePreviewDialog(UpdateSettings Settings, List <updatePackage> Result, updateConfiguration Config,
                                   changelogDictionary changelogs, bool requestElevation)
        {
            InitializeComponent();
            Font         = SystemFonts.MessageBoxFont;
            SizeChanged += UpdateDialog_SizeChanged;

            //Setze private Variablen
            m_settings   = Settings;
            m_result     = Result;
            m_config     = Config;
            m_changelogs = changelogs;

            //Setze Sprachstrings
            lblStatus.Text         = localizationHelper.Instance.controlText(lblStatus);
            btnCancel.Text         = localizationHelper.Instance.controlText(btnCancel);
            btnStartUpdate.Text    = localizationHelper.Instance.controlText(btnStartUpdate);
            lblCurrentVersion.Text = string.Format(localizationHelper.Instance.controlText(lblCurrentVersion),
                                                   Settings.releaseInfo.Version);

            if (Settings.releaseInfo.Type != releaseTypes.Final)
            {
                lblCurrentVersion.Text += string.Format(" ({0} {1})", Settings.releaseInfo.Type.ToString(),
                                                        Settings.releaseInfo.Step.ToString(CultureInfo.InvariantCulture));
            }

            if (Result.Count > 0)
            {
                lblNewestVersion.Text = string.Format(localizationHelper.Instance.controlText(lblNewestVersion),
                                                      Result[Result.Count - 1].releaseInfo.Version);
                if (Result[Result.Count - 1].releaseInfo.Type != releaseTypes.Final)
                {
                    lblNewestVersion.Text += string.Format(" ({0} {1})", Result[Result.Count - 1].releaseInfo.Type.ToString(),
                                                           Result[Result.Count - 1].releaseInfo.Step.ToString(CultureInfo.InvariantCulture));
                }
            }

            Text = m_config.applicationName;

            //Updatedetails erstellen
            buildUpdateDetails();

            //Setze vor den Start-Button ein Schild wenn der Benutzer nicht über Administratorrechte verfügt
            if (!IsAdmin() && Environment.OSVersion.Version.Major >= 6 && requestElevation)
            {
                SendMessage(new HandleRef(btnStartUpdate, btnStartUpdate.Handle), 0x160c, IntPtr.Zero, new IntPtr(1));
                btnStartUpdate.MinimumSize = new Size(
                    btnStartUpdate.Width + 20,                     //Etwas platz für das ShieldIcon schaffen
                    btnStartUpdate.MinimumSize.Height);
            }


            //Setze Anwendungsbild
            try {
                imgApp.Image = Icon.ExtractAssociatedIcon(Assembly.GetEntryAssembly().Location).ToBitmap();
            }
            catch {
                imgApp.Image = SystemIcons.Application.ToBitmap();
            }
        }
Beispiel #9
0
        /// <summary>
        /// Launch process to update attributes
        /// </summary>
        /// <param name="us">Settings for update operation</param>
        public void UpdateAttributes(UpdateSettings us)
        {
            // We need to process only items that have their IsValidForAdvancedFind
            // property updated
            var itemsToManage = (from item in us.Items
                                 let amd = (AttributeMetadata)item.Tag
                                           where
                                           amd.IsValidForAdvancedFind.Value != item.Checked && us.UpdateValidForAdvancedFind ||
                                           amd.IsAuditEnabled.Value != item.Checked && us.UpdateAuditIsEnabled ||
                                           (item.Checked && amd.RequiredLevel.Value != AttributeRequiredLevel.SystemRequired && amd.RequiredLevel.Value != us.RequirementLevelValue && us.UpdateRequirementLevel)
                                           select item).ToList();

            if (itemsToManage.Count == 0)
            {
                MessageBox.Show(this, "No attributes need to be updated!", "Information", MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                Close();
                return;
            }

            bwUpdateAttributes = new BackgroundWorker();
            bwUpdateAttributes.RunWorkerCompleted        += bwUpdateAttributes_RunWorkerCompleted;
            bwUpdateAttributes.ProgressChanged           += bwUpdateAttributes_ProgressChanged;
            bwUpdateAttributes.DoWork                    += bwUpdateAttributes_DoWork;
            bwUpdateAttributes.WorkerReportsProgress      = true;
            bwUpdateAttributes.WorkerSupportsCancellation = true;
            bwUpdateAttributes.RunWorkerAsync(new Tuple <List <ListViewItem>, UpdateSettings>(itemsToManage, us));
        }
Beispiel #10
0
        public MainWindow()
        {
            InitializeComponent();

            UpdateSettings updateSettings = new UpdateSettings();

            updateSettings.CurrentVersion = new Version("1.0.0.0");
            updateSettings.UpdatePath     = new Uri("http://localhost:12345/update.xml");
            updateSettings.UpdateKeys     = UpdateKeys.FromPublicKey(new byte[] { 0x00, 0x24, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x06, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x52, 0x53, 0x41, 0x31, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x09, 0x55, 0xec, 0x4b, 0x45, 0xc1, 0x5c, 0xb1, 0x31, 0xd0, 0xdc, 0xd5, 0x39, 0x4e, 0xd5, 0xef, 0x82, 0x7e, 0xaf, 0x8f, 0x9c, 0x3a, 0x16, 0xe2, 0x44, 0xf9, 0x61, 0x58, 0x9d, 0x0f, 0x9c, 0x99, 0x24, 0x2a, 0x2c, 0x26, 0x84, 0xe2, 0x4e, 0xd0, 0x57, 0xfc, 0x03, 0xbe, 0xf6, 0xb3, 0xe6, 0xa9, 0xa5, 0x31, 0x61, 0xe6, 0x3b, 0x49, 0x92, 0xea, 0x9c, 0xfa, 0x2a, 0x5f, 0x1b, 0xb1, 0xbb, 0x9a, 0x5d, 0x5f, 0x68, 0x75, 0xdf, 0x48, 0x99, 0xf5, 0x7c, 0xe8, 0x0e, 0x87, 0x9b, 0x95, 0x0f, 0xfa, 0x50, 0x60, 0x4f, 0x7c, 0x81, 0xa7, 0x4e, 0xfa, 0x8d, 0xef, 0x5f, 0xbe, 0x5a, 0x6a, 0xbb, 0xd3, 0xe6, 0x68, 0x79, 0xb6, 0x6a, 0xeb, 0x81, 0xdb, 0xa2, 0xd8, 0xd6, 0x78, 0x51, 0xe3, 0xa3, 0x69, 0xc2, 0x4a, 0x91, 0xe2, 0x44, 0x6e, 0x4a, 0xe3, 0xcf, 0xb2, 0x6d, 0xff, 0x12, 0x05, 0xd9, 0xba });
            _autoUpdate.UpdateSettings    = updateSettings;

            Loaded += delegate
            {
                ThreadPool.QueueUserWorkItem((state) =>
                {
                    _updatePending = _autoUpdate.IsUpdatePending();

                    Dispatcher.BeginInvoke(new Action(delegate
                    {
                        if (_updatePending)
                        {
                            MessageBox.Show("Found pending updates!");
                            PendingUpdates = _autoUpdate.PendingUpdates;
                        }
                    }));
                });
            };
        }
        public AttackEditor(bool editMode, Attack attack)
        {
            InitializeComponent();

            types = ReadDatabase.getListOfCardTypes();
            RefreshTypes();

            UpdateSettings.UpdateDarkMode(this);

            if (editMode)
            {
                editAttack = true;
                AttackEditor_Window.Title = "AttackEditor - Edit mode";
                AttackEditor_CreateAttack_Button.Content = "Save";
                AttackEditor_Delete_Button.Visibility    = Visibility.Visible;
            }

            if (attack != null)
            {
                currentAttack = attack;
                AttackEditor_Name_Textbox.Text = attack.Name;

                foreach (var t in types)
                {
                    if (attack.CardTypeID == t.ID)
                    {
                        currentType = t;
                        break;
                    }
                }

                AttackEditor_Type_Combobox.SelectedItem = currentType;
                AttackEditor_Damage_Textbox.Text        = attack.Damage.ToString();
            }
        }
        /// <summary>
        /// Launch process to update attributes
        /// </summary>
        /// <param name="us">Settings for update operation</param>
        public void UpdateAttributes(UpdateSettings us)
        {
            // We need to process only items that have their IsValidForAdvancedFind
            // property updated
            var itemsToManage = (from item in us.Items
                let amd = (AttributeMetadata) item.Tag
                where
                    amd.IsValidForAdvancedFind.Value != item.Checked && us.UpdateValidForAdvancedFind ||
                    amd.IsAuditEnabled.Value != item.Checked && us.UpdateAuditIsEnabled ||
                    (item.Checked && amd.RequiredLevel.Value != AttributeRequiredLevel.SystemRequired && amd.RequiredLevel.Value != us.RequirementLevelValue && us.UpdateRequirementLevel)
                select item).ToList();

            if (itemsToManage.Count == 0)
            {
                MessageBox.Show(this, "No attributes need to be updated!", "Information", MessageBoxButtons.OK,
                    MessageBoxIcon.Information);
                Close();
                return;
            }

            bwUpdateAttributes = new BackgroundWorker();
            bwUpdateAttributes.RunWorkerCompleted += bwUpdateAttributes_RunWorkerCompleted;
            bwUpdateAttributes.ProgressChanged += bwUpdateAttributes_ProgressChanged;
            bwUpdateAttributes.DoWork += bwUpdateAttributes_DoWork;
            bwUpdateAttributes.WorkerReportsProgress = true;
            bwUpdateAttributes.WorkerSupportsCancellation = true;
            bwUpdateAttributes.RunWorkerAsync(new Tuple<List<ListViewItem>,UpdateSettings>(itemsToManage, us));
        }
        public async Task <IActionResult> LightningSettings(
            UpdateSettings <LightningSettings, AdditionalDataStub> updateSettings)
        {
            var configuratorSettings = string.IsNullOrEmpty(updateSettings.Json)
                ? new ConfiguratorSettings()
                : JsonSerializer.Deserialize <ConfiguratorSettings>(updateSettings.Json);

            if (configuratorSettings.ChainSettings.PruneMode != PruneMode.NoPruning &&
                updateSettings.Settings.Implementation == "eclair")
            {
                ModelState.AddModelError(
                    nameof(updateSettings.Settings) + "." + nameof(updateSettings.Settings.Implementation),
                    "You cannot use Eclair when you have pruning enabled.");
            }
            else if (configuratorSettings.ChainSettings.PruneMode == PruneMode.ExtraExtraSmall &&
                     !string.IsNullOrEmpty(updateSettings.Settings.Implementation))
            {
                ModelState.AddModelError(
                    nameof(updateSettings.Settings) + "." + nameof(updateSettings.Settings.Implementation),
                    "You cannot use lightning when you have your level of pruning set.");
            }

            if (!ModelState.IsValid)
            {
                return(View(updateSettings));
            }

            configuratorSettings.LightningSettings = updateSettings.Settings;
            SetConfiguratorSettings(configuratorSettings);
            return(RedirectToAction(nameof(AdditionalServices)));
        }
Beispiel #14
0
        public async Task <IActionResult> UpdateSetting(UpdateSettings toSaveSetting)
        {
            try
            {
                await _setting.Set("AppName", toSaveSetting.appName);

                await _setting.Set("WebName", toSaveSetting.webName);

                await _setting.Set("DefaultDrive", toSaveSetting.defaultDrive);

                await _setting.Set("Footer", toSaveSetting.footer);

                await _setting.Set("UploadPassword", toSaveSetting.uploadPassword);

                await _setting.Set("AllowAnonymouslyUpload", toSaveSetting.allowAnonymouslyUpload.ToString());
            }
            catch (Exception e)
            {
                return(StatusCode(500, new ErrorResponse()
                {
                    message = e.Message
                }));
            };
            return(StatusCode(204));
        }
Beispiel #15
0
        private string GetArgs(UpdateSettings settings)
        {
            var url     = _appConfig.Get(ConfigurationTypes.Url);
            var storage = _appConfig.Get(ConfigurationTypes.StoragePath);

            var currentLocation = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
            var processName     = (settings.ProcessName.HasValue() ? settings.ProcessName : "Ombi");

            var sb = new StringBuilder();

            sb.Append($"--applicationPath \"{currentLocation}\" --processname \"{processName}\" ");
            //if (settings.WindowsService)
            //{
            //    sb.Append($"--windowsServiceName \"{settings.WindowsServiceName}\" ");
            //}
            var sb2 = new StringBuilder();

            if (url?.Value.HasValue() ?? false)
            {
                sb2.Append($" --host {url.Value}");
            }
            if (storage?.Value.HasValue() ?? false)
            {
                sb2.Append($" --storage {storage.Value}");
            }

            return(sb.ToString());
        }
        public IActionResult LightningSettings(
            UpdateSettings <LightningSettings, AdditionalDataStub> updateSettings)
        {
            var configuratorSettings = string.IsNullOrEmpty(updateSettings.Json)
                ? new ConfiguratorSettings()
                : JsonSerializer.Deserialize <ConfiguratorSettings>(updateSettings.Json);

            if (configuratorSettings.ChainSettings.PruneMode != PruneMode.NoPruning &&
                updateSettings.Settings.Implementation == "eclair")
            {
                ModelState.AddModelError(
                    nameof(updateSettings.Settings) + "." + nameof(updateSettings.Settings.Implementation),
                    "You cannot use Eclair when you have pruning enabled.");
            }
            else if (configuratorSettings.ChainSettings.PruneMode == PruneMode.ExtraExtraSmall &&
                     !updateSettings.Settings.Implementation.Equals("none", StringComparison.InvariantCultureIgnoreCase))
            {
                ModelState.AddModelError(
                    nameof(updateSettings.Settings) + "." + nameof(updateSettings.Settings.Implementation),
                    "You cannot use lightning when you have your level of pruning set.");
            }

            if (!ModelState.IsValid)
            {
                return(View(updateSettings));
            }

            configuratorSettings.LightningSettings = updateSettings.Settings;
            if (configuratorSettings.LightningSettings.Implementation.Equals("eclair"))
            {
                configuratorSettings.AdvancedSettings.EnsureTxIndex();
            }
            SetConfiguratorSettings(configuratorSettings);
            return(RedirectToAction(nameof(AdditionalServices)));
        }
Beispiel #17
0
 protected override async void OnCancel()
 {
     var config = new UpdateSettings {
         SkippedUpdateVersion = _details.Version.ToString(3)
     };
     await _store.StoreAsync(config);
 }
Beispiel #18
0
		public static Task<string> CheckForUpdatesAsync(ILSpySettings spySettings)
		{
			var tcs = new TaskCompletionSource<string>();
			UpdateSettings s = new UpdateSettings(spySettings);
			CheckForUpdateInternal(tcs, s);
			return tcs.Task;
		}
        /// <summary>
        /// Initializes a new instance of class RoleSelectionControl
        /// </summary>
        /// <param name="roles">List of existing roles</param>
        /// <param name="settings"> </param>
        public RoleSelectionControl(List<Entity> roles, UpdateSettings settings)
        {
            InitializeComponent();

            this.roles = roles;
            this.settings = settings;
        }
		/// <summary>
		/// Kontruktor
		/// </summary>
		/// <param name="Settings">Die lokalen Updateeinstellungen</param>
		/// <param name="Result">Das Suchresultat</param>
		/// <param name="Config">Die heruntergeladene Updatekonfiguration</param>
		/// <param name="changelogs">Die Changelogs</param>
		/// <param name="requestElevation">Gibt an, ob eine Elevation notwendig ist.</param>
		public updatePreviewDialog(UpdateSettings Settings, List<updatePackage> Result, updateConfiguration Config,
		                           changelogDictionary changelogs, bool requestElevation) {
			InitializeComponent();

			//Systemschriftart ermitteln
			Font = SystemFonts.MessageBoxFont;

			//Initialisiere Events
			SizeChanged += UpdateDialog_SizeChanged;

			//Setze private Variablen
			m_settings = Settings;
			m_result = Result;
			m_config = Config;
			m_changelogs = changelogs;

			//Setze Sprachstrings
			lblStatus.Text = Language.GetString("UpdateForm_lblStatus_text");
			btnCancel.Text = Language.GetString("general_button_cancel");
			btnStartUpdate.Text = Language.GetString("UpdateForm_btnStartUpdate_text");
			lblCurrentVersion.Text = string.Format(Language.GetString("UpdateForm_lblCurrentVersion_text"),
			                                       Settings.releaseInfo.Version);

			if (Settings.releaseInfo.Type != releaseTypes.Final)
				lblCurrentVersion.Text += string.Format(" ({0} {1})", Settings.releaseInfo.Type.ToString(),
				                                        Settings.releaseInfo.Step.ToString());

			if (Result.Count > 0) {
				lblNewestVersion.Text = string.Format(Language.GetString("UpdateForm_lblNewestVersion_text"),
				                                      Result[Result.Count - 1].releaseInfo.Version);
				if (Result[Result.Count - 1].releaseInfo.Type != releaseTypes.Final) {
					lblNewestVersion.Text += string.Format(" ({0} {1})", Result[Result.Count - 1].releaseInfo.Type.ToString(),
					                                       Result[Result.Count - 1].releaseInfo.Step.ToString());
				}
			}

			Text = m_config.applicationName;

			//Updatedetails erstellen
			buildUpdateDetails();

			//Setze vor den Start-Button ein Schild wenn der Benutzer nicht über Administratorrechte verfügt
			if (!IsAdmin() && Environment.OSVersion.Version.Major >= 6 && requestElevation) {
				SendMessage(new HandleRef(btnStartUpdate, btnStartUpdate.Handle), 0x160c, IntPtr.Zero, new IntPtr(1));
				btnStartUpdate.MinimumSize = new Size(
					btnStartUpdate.Width + 20, //Etwas platz für das ShieldIcon schaffen
					btnStartUpdate.MinimumSize.Height);
			}


			//Setze Anwendungsbild
			try {
				imgApp.Image = Icon.ExtractAssociatedIcon(Assembly.GetEntryAssembly().Location).ToBitmap();
			}
			catch {
				imgApp.Image = SystemIcons.Application.ToBitmap();
			}
		}
        /// <summary>
        /// Initializes a new instance of class UpdateAttributesForm
        /// </summary>
        /// <param name="service">Crm Organization service</param>
        /// <param name="us">Settings for update operation</param>
        public UpdateAttributesForm(IOrganizationService service, UpdateSettings us)
        {
            InitializeComponent();

            innerService = service;
            FillImagesInListView();

            UpdateAttributes(us);
        }
        /// <summary>
        /// Initializes a new instance of class PrivilegeLevelSelectionControl
        /// </summary>
        public PrivilegeLevelSelectionControl(RoleManager roleManager, List<EntityMetadata> entities, UpdateSettings settings)
        {
            InitializeComponent();

            actions = new List<PrivilegeAction>();
            rManager = roleManager;
            this.entities = entities;
            this.settings = settings;
        }
        private async Task DangerouslyUpdateProfileSettings(UpdateSettings updateDto, Guid userId)
        {
            var profile = await context.UserProfiles.FindAsync(userId);

            profile.Birthday    = updateDto.DateOfBirth;
            profile.Email       = updateDto.Email;
            profile.UserName    = updateDto.Username + $"#{MurmurHash2.ComputeHash(updateDto.Email) % 100000}";
            profile.DisplayName = updateDto.Username;
        }
Beispiel #24
0
        public void DefaultsTest()
        {
            UpdateSettings settings = new UpdateSettings();

            Assert.AreEqual(string.Empty, settings.URL);
            Assert.AreEqual(string.Empty, settings.ChangeLogLink);
            Assert.AreEqual(string.Empty, settings.Channel);
            Assert.AreEqual(TimeSpan.FromDays(1), settings.TTL);
        }
Beispiel #25
0
        public static void Display(DecompilerTextView textView)
        {
            AvalonEditTextOutput output = new AvalonEditTextOutput()
            {
                EnableHyperlinks = true
            };

            output.WriteLine(Resources.ILSpyVersion + RevisionClass.FullVersion);
            output.AddUIElement(
                delegate {
                StackPanel stackPanel          = new StackPanel();
                stackPanel.HorizontalAlignment = HorizontalAlignment.Center;
                stackPanel.Orientation         = Orientation.Horizontal;
                if (latestAvailableVersion == null)
                {
                    AddUpdateCheckButton(stackPanel, textView);
                }
                else
                {
                    // we already retrieved the latest version sometime earlier
                    ShowAvailableVersion(latestAvailableVersion, stackPanel);
                }
                CheckBox checkBox       = new CheckBox();
                checkBox.Margin         = new Thickness(4);
                checkBox.Content        = Resources.AutomaticallyCheckUpdatesEveryWeek;
                UpdateSettings settings = new UpdateSettings(ILSpySettings.Load());
                checkBox.SetBinding(CheckBox.IsCheckedProperty, new Binding("AutomaticUpdateCheckEnabled")
                {
                    Source = settings
                });
                return(new StackPanel {
                    Margin = new Thickness(0, 4, 0, 0),
                    Cursor = Cursors.Arrow,
                    Children = { stackPanel, checkBox }
                });
            });
            output.WriteLine();
            foreach (var plugin in App.ExportProvider.GetExportedValues <IAboutPageAddition>())
            {
                plugin.Write(output);
            }
            output.WriteLine();
            using (Stream s = typeof(AboutPage).Assembly.GetManifestResourceStream(typeof(AboutPage), "README.txt")) {
                using (StreamReader r = new StreamReader(s)) {
                    string line;
                    while ((line = r.ReadLine()) != null)
                    {
                        output.WriteLine(line);
                    }
                }
            }
            output.AddVisualLineElementGenerator(new MyLinkElementGenerator("SharpDevelop", "http://www.icsharpcode.net/opensource/sd/"));
            output.AddVisualLineElementGenerator(new MyLinkElementGenerator("MIT License", "resource:license.txt"));
            output.AddVisualLineElementGenerator(new MyLinkElementGenerator("LGPL", "resource:LGPL.txt"));
            output.AddVisualLineElementGenerator(new MyLinkElementGenerator("MS-PL", "resource:MS-PL.txt"));
            textView.ShowText(output);
        }
Beispiel #26
0
        /// <summary>
        /// Initializes a new instance of class UpdateAttributesForm
        /// </summary>
        /// <param name="service">Crm Organization service</param>
        /// <param name="us">Settings for update operation</param>
        public UpdateAttributesForm(IOrganizationService service, UpdateSettings us)
        {
            InitializeComponent();

            innerService = service;
            FillImagesInListView();

            UpdateAttributes(us);
        }
        /// <summary>
        /// Initializes a new instance of class PrivilegeLevelSelectionControl
        /// </summary>
        public PrivilegeLevelSelectionControl(RoleManager roleManager, List <EntityMetadata> entities, UpdateSettings settings)
        {
            InitializeComponent();

            actions       = new List <PrivilegeAction>();
            rManager      = roleManager;
            this.entities = entities;
            this.settings = settings;
        }
Beispiel #28
0
        public CardEditor(bool editCard, Card card)
        {
            InitializeComponent();

            UpdateSettings.UpdateDarkMode(this);

            cardTypes = ReadDatabase.getListOfCardTypes();
            attacks   = ReadDatabase.getListOfAttacks();

            this.editCard = editCard;
            currentCard   = card;
            RefreshTypes();

            if (CardEditor_Type_Combobox.SelectedIndex == -1)
            {
                CardEditor_EditType_Button.IsEnabled = false;
            }

            if (editCard)
            {
                CardEditor_Tab_Window.Title                 = "CardEditor - Edit mode";
                CardEditor_CreateCard_Button.Visibility     = Visibility.Collapsed;
                CardEditor_CreateCardAndExit_Button.Content = "Save & Close";

                CardEditor_Type_Combobox.SelectedItem    = cardTypes.Find(i => i.ID == card.CardTypeID);
                CardEditor_Attack1_Combobox.SelectedItem = attacks.Find(i => i.ID == card.Attack1ID);
                CardEditor_Attack2_Combobox.SelectedItem = attacks.Find(i => i.ID == card.Attack2ID);
            }

            if (card != null)
            {
                CardEditor_Name_Textbox.Text = card.Name;

                CardEditor_HP_Textbox.Text = card.HP.ToString();

                ImageSourceConverter converter = new ImageSourceConverter();
                CardEditor_Card_Preview.Image.Source = (ImageSource)converter.ConvertFromString(card.ImagePath);

                currentType    = cardTypes.Find(t => t.ID == card.CardTypeID);
                currentAttack1 = attacks.Find(i => i.ID == card.Attack1ID);
                currentAttack2 = attacks.Find(i => i.ID == card.Attack2ID);



                CardEditor_Type_Combobox.SelectedItem = currentType;
                if (currentAttack1 != null)
                {
                    CardEditor_Attack1_Combobox.SelectedItem = attacks.Find(a => a.ID == currentAttack1.ID);
                }
                if (currentAttack2 != null)
                {
                    CardEditor_Attack2_Combobox.SelectedItem = attacks.Find(a => a.ID == currentAttack2.ID);
                }
            }
        }
Beispiel #29
0
 public void GetChannelsTest()
 {
     using (TestFile testFile = new TestFile("[Test1Settings]\r\n[Test2Settings]\r\n[Test3Settings]\r\n[Test4Settings]\r\n[Settings]\r\n[UpdateState]"))
     {
         UpdateSettings settings = new UpdateSettings(StoreType.Ini, testFile.FileName);
         var            channels = settings.GetChannels();
         Assert.AreEqual(5, channels.Length);
         Assert.AreEqual("Test1", channels[0]);
         Assert.AreEqual(string.Empty, channels[4]);
     }
 }
Beispiel #30
0
 /// <summary>
 /// Static constructor
 /// </summary>
 static Settings()
 {
     UI            = new UISettings();
     G15           = new G15Settings();
     IGB           = new IGBSettings();
     Proxy         = new ProxySettings();
     Updates       = new UpdateSettings();
     Calendar      = new CalendarSettings();
     Exportation   = new ExportationSettings();
     Notifications = new NotificationSettings();
 }
        public async Task <ServiceResult> UpdateSettings(Guid userId, UpdateSettings updateDto)
        {
            var result = new ServiceResult();

            if (updateDto == null || string.IsNullOrEmpty(updateDto.Email) || string.IsNullOrEmpty(updateDto.Username))
            {
                result.Error = Shared.ErrorKey.UserProfile.InvalidUserSettings;
                return(result);
            }

            if (updateDto.DateOfBirth.HasValue)
            {
                var userAgeInDays = (DateTimeOffset.UtcNow - updateDto.DateOfBirth.Value).TotalDays;
                if (userAgeInDays > Shared.Configuration.UserProfileValidations.MaxAgeInDays)
                {
                    result.Error = Shared.ErrorKey.UserProfile.UserTooOld;
                    return(result);
                }
                else if (userAgeInDays < Shared.Configuration.UserProfileValidations.MinAgeInDays)
                {
                    result.Error = Shared.ErrorKey.UserProfile.UserTooYoung;
                    return(result);
                }
            }

            if (!await context.UserProfiles.AnyAsync(up => up.Id.Equals(userId)))
            {
                result.Error = Shared.ErrorKey.UserProfile.UserNotFound;
                return(result);
            }

            if (await context.UserProfiles.AnyAsync(up => !up.Id.Equals(userId) && up.Email.Equals(updateDto.Email, StringComparison.InvariantCultureIgnoreCase)))
            {
                result.Error = Shared.ErrorKey.UserProfile.ProfileExists;
                return(result);
            }

            var passportResult = await passportClient.UpdateProfile(userId, AutoMapper.Mapper.Map <UpdatePassportUser>(updateDto));

            if (!passportResult.Success)
            {
                return(passportResult);
            }


            await DangerouslyUpdateProfileSettings(updateDto, userId);

            await this.backgroundWorker.SendMessage(this.queues.Contact, new DTO.Marketing.ContactSync(userId), 5);

            result.Succeed();
            return(result);
        }
Beispiel #32
0
        public static void Display(DecompilerTextView textView)
        {
            AvalonEditTextOutput output = new AvalonEditTextOutput();

            output.WriteLine("ILSpy version " + RevisionClass.FullVersion);
            output.AddUIElement(
                delegate {
                StackPanel stackPanel          = new StackPanel();
                stackPanel.HorizontalAlignment = HorizontalAlignment.Center;
                stackPanel.Orientation         = Orientation.Horizontal;
                if (latestAvailableVersion == null)
                {
                    AddUpdateCheckButton(stackPanel, textView);
                }
                else
                {
                    // we already retrieved the latest version sometime earlier
                    ShowAvailableVersion(latestAvailableVersion, stackPanel);
                }
                CheckBox checkBox       = new CheckBox();
                checkBox.Margin         = new Thickness(4);
                checkBox.Content        = "Automatically check for updates every week";
                UpdateSettings settings = new UpdateSettings(ILSpySettings.Load());
                checkBox.SetBinding(CheckBox.IsCheckedProperty, new Binding("AutomaticUpdateCheckEnabled")
                {
                    Source = settings
                });
                return(new StackPanel {
                    Margin = new Thickness(0, 4, 0, 0),
                    Cursor = Cursors.Arrow,
                    Children = { stackPanel, checkBox }
                });
            });
            output.WriteLine();
            foreach (var plugin in App.CompositionContainer.GetExportedValues <IAboutPageAddition>())
            {
                plugin.Write(output);
            }
            output.WriteLine();
            using (Stream s = typeof(AboutPage).Assembly.GetManifestResourceStream(typeof(AboutPage), "README.txt")) {
                using (StreamReader r = new StreamReader(s)) {
                    string line;
                    while ((line = r.ReadLine()) != null)
                    {
                        output.WriteLine(line);
                    }
                }
            }
            textView.Show(output);
        }
Beispiel #33
0
		public static void Display(DecompilerTextView textView) {
			AvalonEditTextOutput output = new AvalonEditTextOutput();
			output.WriteLine(string.Format("dnSpy version {0}", currentVersion.ToString()), TextTokenType.Text);
			var decVer = typeof(ICSharpCode.Decompiler.Ast.AstBuilder).Assembly.GetName().Version;
			output.WriteLine(string.Format("ILSpy Decompiler version {0}.{1}.{2}", decVer.Major, decVer.Minor, decVer.Build), TextTokenType.Text);
			if (checkForUpdateCode)
				output.AddUIElement(
					delegate {
						StackPanel stackPanel = new StackPanel();
						stackPanel.HorizontalAlignment = HorizontalAlignment.Center;
						stackPanel.Orientation = Orientation.Horizontal;
						if (latestAvailableVersion == null) {
							AddUpdateCheckButton(stackPanel, textView);
						}
						else {
						// we already retrieved the latest version sometime earlier
						ShowAvailableVersion(latestAvailableVersion, stackPanel);
						}
						CheckBox checkBox = new CheckBox();
						checkBox.Margin = new Thickness(4);
						checkBox.Content = "Automatically check for updates every week";
						UpdateSettings settings = new UpdateSettings(DNSpySettings.Load());
						checkBox.SetBinding(CheckBox.IsCheckedProperty, new Binding("AutomaticUpdateCheckEnabled") { Source = settings });
						return new StackPanel {
							Margin = new Thickness(0, 4, 0, 0),
							Cursor = Cursors.Arrow,
							Children = { stackPanel, checkBox }
						};
					});
			if (checkForUpdateCode)
				output.WriteLine();
			foreach (var plugin in App.CompositionContainer.GetExportedValues<IAboutPageAddition>())
				plugin.Write(output);
			output.WriteLine();
			using (Stream s = typeof(AboutPage).Assembly.GetManifestResourceStream(typeof(dnSpy.StartUpClass), "README.txt")) {
				using (StreamReader r = new StreamReader(s)) {
					string line;
					while ((line = r.ReadLine()) != null) {
						output.WriteLine(line, TextTokenType.Text);
					}
				}
			}
			output.AddVisualLineElementGenerator(new MyLinkElementGenerator("SharpDevelop", "http://www.icsharpcode.net/opensource/sd/"));
			output.AddVisualLineElementGenerator(new MyLinkElementGenerator("MIT License", "resource:license.txt"));
			output.AddVisualLineElementGenerator(new MyLinkElementGenerator("LGPL", "resource:LGPL.txt"));
			output.AddVisualLineElementGenerator(new MyLinkElementGenerator("COPYING", "resource:COPYING"));
			textView.ShowText(output);
			MainWindow.Instance.SetTitle(textView, "About");
		}
Beispiel #34
0
        public void SetChannel(string channel)
        {
            if (Channel == null)
            {
                throw new InvalidOperationException();
            }

            // Switch channel and save the change.
            Settings.Channel = channel;
            Settings.Save();
            Channel = new UpdateSettings(ChannelName = Settings.Channel);

            // Do a forced update check because the cached update data is likely to only be valid for the old channel.
            Force = true;
        }
Beispiel #35
0
        /// <summary>
        /// Static constructor.
        /// </summary>
        static Settings()
        {
            UI                          = new UISettings();
            G15                         = new G15Settings();
            Proxy                       = new ProxySettings();
            Updates                     = new UpdateSettings();
            Calendar                    = new CalendarSettings();
            Exportation                 = new ExportationSettings();
            MarketPricer                = new MarketPricerSettings();
            Notifications               = new NotificationSettings();
            LoadoutsProvider            = new LoadoutsProviderSettings();
            PortableEveInstallations    = new PortableEveInstallationsSettings();
            CloudStorageServiceProvider = new CloudStorageServiceProviderSettings();

            EveMonClient.TimerTick += EveMonClient_TimerTick;
        }
Beispiel #36
0
		public static void Display(DecompilerTextView textView)
		{
			AvalonEditTextOutput output = new AvalonEditTextOutput();
			output.WriteLine("ILSpy version " + RevisionClass.FullVersion);
			output.AddUIElement(
				delegate {
					StackPanel stackPanel = new StackPanel();
					stackPanel.HorizontalAlignment = HorizontalAlignment.Center;
					stackPanel.Orientation = Orientation.Horizontal;
					if (latestAvailableVersion == null) {
						AddUpdateCheckButton(stackPanel, textView);
					} else {
						// we already retrieved the latest version sometime earlier
						ShowAvailableVersion(latestAvailableVersion, stackPanel);
					}
					CheckBox checkBox = new CheckBox();
					checkBox.Margin = new Thickness(4);
					checkBox.Content = "Automatically check for updates every week";
					UpdateSettings settings = new UpdateSettings(ILSpySettings.Load());
					checkBox.SetBinding(CheckBox.IsCheckedProperty, new Binding("AutomaticUpdateCheckEnabled") { Source = settings });
					return new StackPanel {
						Margin = new Thickness(0, 4, 0, 0),
						Cursor = Cursors.Arrow,
						Children = { stackPanel, checkBox }
					};
				});
			output.WriteLine();
			foreach (var plugin in App.CompositionContainer.GetExportedValues<IAboutPageAddition>())
				plugin.Write(output);
			output.WriteLine();
			using (Stream s = typeof(AboutPage).Assembly.GetManifestResourceStream(typeof(AboutPage), "README.txt")) {
				using (StreamReader r = new StreamReader(s)) {
					string line;
					while ((line = r.ReadLine()) != null) {
						output.WriteLine(line);
					}
				}
			}
			output.AddVisualLineElementGenerator(new MyLinkElementGenerator("SharpDevelop", "http://www.icsharpcode.net/opensource/sd/"));
			output.AddVisualLineElementGenerator(new MyLinkElementGenerator("MIT License", "resource:license.txt"));
			output.AddVisualLineElementGenerator(new MyLinkElementGenerator("LGPL", "resource:LGPL.txt"));
			textView.ShowText(output);
			
			//reset icon bar
			textView.manager.Bookmarks.Clear();
		}
Beispiel #37
0
		private static void CheckForUpdateInternal(TaskCompletionSource<string> tcs, UpdateSettings s)
		{
			GetLatestVersionAsync().ContinueWith(
				delegate (Task<AvailableVersionInfo> task) {
					try {
						s.LastSuccessfulUpdateCheck = DateTime.UtcNow;
						AvailableVersionInfo v = task.Result;
						if (v.Version > currentVersion)
							tcs.SetResult(v.DownloadUrl);
						else
							tcs.SetResult(null);
					} catch (AggregateException) {
						// ignore errors getting the version info
						tcs.SetResult(null);
					}
				});
		}
        /// <summary>
        /// Initializes a new instance of the <see cref="HttpTimeoutTroubleshooter"/> class.
        /// </summary>
        public HttpTimeoutTroubleshooter()
        {
            InitializeComponent();

            var Options        = new List <TimeoutOption>();
            var updateSettings = new UpdateSettings();

            // lets add 10 - 60 to the list.
            for (int i = 10; i <= 60; i += 10)
            {
                string text = String.Empty;

                if (i == updateSettings.HttpTimeout)
                {
                    text = "Default";
                }

                if (i == Settings.Updates.HttpTimeout)
                {
                    text = "Current";
                }

                Options.Add(new TimeoutOption(i, text));
            }

            // if the current is set to something odd we add it and sort by Seconds
            if (!Options.Any(x => x.Seconds == Settings.Updates.HttpTimeout))
            {
                Options.Add(new TimeoutOption(Settings.Updates.HttpTimeout, "Current"));
            }

            // if the default is not in the list we add it
            if (!Options.Any(x => x.Seconds == updateSettings.HttpTimeout))
            {
                Options.Add(new TimeoutOption(updateSettings.HttpTimeout, "Default"));
            }

            Options.Sort((a, b) => a.Seconds.CompareTo(b.Seconds));


            // databind
            TimeoutDropDown.DataSource    = Options;
            TimeoutDropDown.DisplayMember = "Label";
            TimeoutDropDown.ValueMember   = "Seconds";
        }
Beispiel #39
0
        public SerializableSettings()
        {
            Plans               = new List <SerializablePlan>();
            Accounts            = new List <SerializableAccount>();
            Characters          = new List <SerializableSettingsCharacter>();
            MonitoredCharacters = new List <MonitoredCharacterSettings>();

            APIProviders  = new SerializableAPIProviders();
            Notifications = new NotificationSettings();
            Exportation   = new ExportationSettings();
            Scheduler     = new SerializableScheduler();
            Calendar      = new CalendarSettings();
            Updates       = new UpdateSettings();
            Proxy         = new ProxySettings();
            IGB           = new IGBSettings();
            G15           = new G15Settings();
            UI            = new UISettings();
        }
Beispiel #40
0
 public static void Display(DecompilerTextView textView)
 {
     AvalonEditTextOutput output = new AvalonEditTextOutput();
     output.WriteLine("ILSpy version " + RevisionClass.FullVersion);
     output.AddUIElement(
         delegate {
             StackPanel stackPanel = new StackPanel();
             stackPanel.HorizontalAlignment = HorizontalAlignment.Center;
             stackPanel.Orientation = Orientation.Horizontal;
             if (latestAvailableVersion == null) {
                 AddUpdateCheckButton(stackPanel, textView);
             } else {
                 // we already retrieved the latest version sometime earlier
                 ShowAvailableVersion(latestAvailableVersion, stackPanel);
             }
             CheckBox checkBox = new CheckBox();
             checkBox.Margin = new Thickness(4);
             checkBox.Content = "Automatically check for updates every week";
             UpdateSettings settings = new UpdateSettings(ILSpySettings.Load());
             checkBox.SetBinding(CheckBox.IsCheckedProperty, new Binding("AutomaticUpdateCheckEnabled") { Source = settings });
             return new StackPanel {
                 Margin = new Thickness(0, 4, 0, 0),
                 Cursor = Cursors.Arrow,
                 Children = { stackPanel, checkBox }
             };
         });
     output.WriteLine();
     output.WriteLine();
     using (Stream s = typeof(AboutPage).Assembly.GetManifestResourceStream(typeof(AboutPage), "README.txt")) {
         using (StreamReader r = new StreamReader(s)) {
             string line;
             while ((line = r.ReadLine()) != null)
                 output.WriteLine(line);
         }
     }
     textView.Show(output);
 }
Beispiel #41
0
 static void CheckForUpdateInternal(TaskCompletionSource<string> tcs, UpdateSettings s)
 {
     GetLatestVersionAsync().ContinueWith(
         delegate (Task<AvailableVersionInfo> task) {
             try {
                 s.LastSuccessfulUpdateCheck = DateTime.UtcNow;
                 AvailableVersionInfo v = task.Result;
                 if (v.Version > currentVersion)
                     tcs.SetResult(v.DownloadUrl);
                 else
                     tcs.SetResult(null);
             } catch (AggregateException) {
                 // ignore errors getting the version info
                 tcs.SetResult(null);
             }
         });
 }
Beispiel #42
0
 /// <summary>
 /// If automatic update checking is enabled, checks if there are any updates available.
 /// Returns the download URL if an update is available.
 /// Returns null if no update is available, or if no check was performed.
 /// </summary>
 public static Task<string> CheckForUpdatesIfEnabledAsync(ILSpySettings spySettings)
 {
     var tcs = new TaskCompletionSource<string>();
     UpdateSettings s = new UpdateSettings(spySettings);
     if (s.AutomaticUpdateCheckEnabled) {
         // perform update check if we never did one before;
         // or if the last check wasn't in the past 7 days
         if (s.LastSuccessfulUpdateCheck == null
             || s.LastSuccessfulUpdateCheck < DateTime.UtcNow.AddDays(-7)
             || s.LastSuccessfulUpdateCheck > DateTime.UtcNow)
         {
             CheckForUpdateInternal(tcs, s);
         } else {
             tcs.SetResult(null);
         }
     } else {
         tcs.SetResult(null);
     }
     return tcs.Task;
 }
		/// <summary>
		/// Lädt die Konfigurationsdatei aus dem Anwendungsverzeichnis des Updaters.
		/// </summary>
		private void loadConfig() {
			try {
				var t_config = new InternalConfig();
				var t_settings = new UpdateSettings();
				string SettingsPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "update.xml");

				if (!File.Exists(SettingsPath)) {
					throw new FileNotFoundException(SettingsPath);
				}

				using (var sr = new StreamReader(SettingsPath)) {
					var xs = new XmlSerializer(typeof (UpdateSettings));
					t_settings = (UpdateSettings) xs.Deserialize(sr);
					t_config.Result = t_settings.Result;
					t_config.ServerConfiguration = t_settings.Config;
					t_config.Settings = t_settings;
					m_config = t_config;
				}
			}
				//catch (Exception ex) { raiseException(ex); }
			catch {
				throw;
			}
		}