public picBoxConfWindow() { InitializeComponent(); Settings = Storage.GetNamespace(Entry.NAMESPACE); Instance = this; }
static picBoxUploader() { Settings = Storage.GetNamespace(Entry.NAMESPACE); bool useAuth; if (!Settings.RetrieveSafe<bool>(SETTING_AUTH, out useAuth)) Settings[SETTING_AUTH] = false.ToString(); }
public GeneralSettings() { InitializeComponent(); this.QuitButton.Click += QuitHandler; this.Loaded += LoadedHandler; this.pSettings = Storage.GetNamespace(Entry.NAMESPACE); }
public PlainFtpConfigWindow() { InitializeComponent(); this.Settings = Storage.GetNamespace(Entry.NAMESPACE); this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner; this.FLengthLabel.Content = String .Format( "Filename Length ({0} - {1})", PlainFtpUploader.SETTING_FTP_NLENMIN, PlainFtpUploader.SETTING_FTP_NLENMAX ); }
public ImgurConfigWindow() { InitializeComponent(); Instance = this; this.Settings = Storage.GetNamespace(Entry.NAMESPACE); this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner; this.Loaded += LoadedHandler; this.Closing += ClosingHandler; this.EnableAuth.Checked += EnableAuthCheckedHandler; this.EnableAuth.Unchecked += (s, e) => this.AuthContent.Content = new ImgurConfigAuthStartDisabledPanel(); this.AuthContent.Content = new ImgurConfigAuthStartDisabledPanel(); }
static NetworkSettings() { pSettings = Storage.GetNamespace(Entry.NAMESPACE); }
static PlainFtpUploader() { Settings = Storage.GetNamespace(Entry.NAMESPACE); SHA512 = new SHA512CryptoServiceProvider(); FtpPassword = new SecureString(); }
static Uploader() { Settings = Storage.Storage.GetNamespace(Entry.NAMESPACE); Uploaders = new Dictionary<string, Type>(); ModesOfCapture = new Dictionary<string, Type>(); DetermineIfLoad(); #region Load Modes of Capture Assembly thisAsm = Assembly.GetEntryAssembly(); var captureTypes = from T in thisAsm.GetTypes() where typeof(ImageCaptor).IsAssignableFrom(T) where T.Name != typeof(ImageCaptor).Name select T; foreach (Type T in captureTypes) { ImageCaptor ic = null; try { ic = Activator.CreateInstance(T) as ImageCaptor; } catch (Exception) { continue; } ModesOfCapture.Add(ic.Name, T); } #endregion #region Set uploader settings if ( !Settings.Keys.Contains(Entry.SETTING_HOST) || !Uploaders.Keys.Contains(Settings[Entry.SETTING_HOST]) ) Settings[Entry.SETTING_HOST] = Uploaders.ElementAt(0).Key; #endregion #region Set capture settings if ( !Settings.Keys.Contains(Entry.SETTING_CAPTUREMODE) || !ModesOfCapture.Keys.Contains(Settings[Entry.SETTING_CAPTUREMODE]) ) Settings[Entry.SETTING_CAPTUREMODE] = ModesOfCapture.ElementAt(0).Key; #endregion #region Load image log if (!Storage.Storage.ObjectExists<StorableStringList>(LOGGING_OBJECT)) { ImageLog = new StorableStringList(LOGGING_OBJECT); Storage.Storage.StoreObject(ImageLog); } else { ImageLog = Storage.Storage.GetObject<StorableStringList>(LOGGING_OBJECT); } #endregion bool doBacks; if (!bool.TryParse(Settings[Entry.SETTING_DOBACKUP], out doBacks)) { Settings[Entry.SETTING_DOBACKUP] = Entry.DefaultSettings[Entry.SETTING_DOBACKUP]; } }
static Entry() { #region Notification Icon setup NotifyIcon = new System.Windows.Forms.NotifyIcon() { Icon = zSnap.Properties.Resources.zSnap_ico_p, Text = "zSnap", }; #endregion #region Default settings try { DefaultSettings = new Namespace( NAMESPACE, new Dictionary<string, string>() { { SETTING_DOBACKUP, true.ToString() }, { SETTING_MODS, true.ToString() }, { SETTING_UPDATES, true.ToString() }, { SETTING_DOLOGGING, true.ToString() } } ); } catch (TypeInitializationException tiex) { if (tiex.InnerException != null) if (tiex.InnerException.GetType() == typeof(StorageInaccessibleException)) { System.Windows.MessageBox.Show( String.Format( "{0}\n\n{1}\n{2}\n\n\n{3}\n\n\"{4}\"", "zSnap could not start.", "The file used by zSnap to store settings could not be opened.", "It may be in use by another program, or may have incorrect permission settings.", "Provided below is the error message generated:", tiex.InnerException.InnerException.Message ), "Error Starting", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error, System.Windows.MessageBoxResult.OK ); Environment.Exit(-1); } else throw tiex; } DefaultSettings.Lock(); #endregion #region Set up loading icon timer LoadingTimer = new System.Timers.Timer(400); LoadingTimer.Elapsed += (s, e) => { NotifyIcon.Icon = (LoadingTimerCounter++ % 2) == 0 ? Properties.Resources.zSnap_load_icon : Properties.Resources.zSnap_24_p_load2 ; }; #endregion #region Check API keys var keys = typeof(Keys) .GetFields() .Where(f => f.FieldType == typeof(string)); if (keys.Count() == 0 || keys.Any(f => String.IsNullOrEmpty(f.GetValue(null).ToString()))) { MessageBox.Show( "One or more API keys is not defined.", "Missing API Keys", MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(-1); } #endregion }
static ImgurUploader() { Settings = Storage.GetNamespace(Entry.NAMESPACE); }