private void ImageCapture_Click(object sender, RoutedEventArgs e) { //HelperLib.CreateFolder("C:/CVCap/test_today/3001"); string filename = string.Format("BangCap_{0}.jpg", DateTime.Now.ToString("yyyyMMdd_hhmmss_fff")); //Debug.WriteLine(filename); HelperLib.Capture("C:\\CVCap", filename, true); }
public void LoadConfig(IConfiguration configuration) { var encryptedString = configuration["AppConfig:DataBase:ConnectionString"]; var helpers = new HelperLib(); Config.DataBase.ConnectionString = helpers.DecryptString(encryptedString); Config.Logger.DateFormat = configuration["AppConfig:Logger:DateFormat"]; Config.Logger.FileName = configuration["AppConfig:Logger:FileName"]; Config.JWT.Audience = configuration["AppConfig:JWT:Audience"]; Config.JWT.Issuer = configuration["AppConfig:JWT:Issuer"]; Config.JWT.Key = configuration["AppConfig:JWT:Key"]; Config.JWT.DaysValid = Convert.ToInt32(configuration["AppConfig:JWT:DaysValid"]); }
public void ProcessTask(HelperLib.Task task) { switch (task.ActionType) { case HelperLib.Task.ActionTypes.SMS: SendSMS(task.SmsRecipient, task.SmsBody, task.Subject); break; case HelperLib.Task.ActionTypes.NOTIFICATION: ShowNotification("<b>" + task.Subject + "</b><br><br>" + task.Notes); break; case HelperLib.Task.ActionTypes.APP: break; default: break; } }
public static void TakeOwnership() { HelperLib.TakeOwnership(Config.LogonFolder); HelperLib.TakeOwnership(Config.PriFileLocation); if (!File.Exists(Config.BakPriFileLocation)) { File.Copy(Config.PriFileLocation, Config.BakPriFileLocation); } HelperLib.TakeOwnership(Config.BakPriFileLocation); File.Copy(Config.BakPriFileLocation, TempPriFile, true); if (File.Exists(NewPriLocation)) { File.Delete(NewPriLocation); } }
public MainWindow() { InitializeComponent(); Debug.WriteLine("[User Picture]: " + Helpers.GetUserTilePath(null)); Settings.Init(Config.SettingsFilePath, new DesEncrpytion("W10Logon", "W10Logon")); var currentLang = CultureInfo.CurrentCulture.ToString().ToLower().Replace("-", "_"); if (!LanguageLibrary.Language.GetLangNames().ContainsValue(currentLang)) { currentLang = "en_us"; } Debug.WriteLine(currentLang); //default all strings to en-us LanguageLibrary.Language.Init(); LanguageLibrary.Language.Set(Settings.Default.Get("language", currentLang)); Debug.WriteLine((string)LanguageLibrary.Language.Default.title_error); if (!Settings.Default.Get("eula", false)) { var dlg = WpfMessageBox.Show( LanguageLibrary.Language.Default.EULA, LanguageLibrary.Language.Default.title_eula, MessageBoxButton.YesNo, MessageBoxImage.Question); if (dlg == MessageBoxResult.No) { Close(); } } if (Helpers.IsBackgroundDisabled()) { WpfMessageBox.Show(LanguageLibrary.Language.Default.background_disabled, LanguageLibrary.Language.Default.title_bg_disabled, MessageBoxButton.OK, MessageBoxImage.Information); } Debug.WriteLine( $"[AccentColor]: {ColorFunctions.GetImmersiveColor(ImmersiveColors.ImmersiveStartBackground)}"); Title += $" - {AssemblyInfo.Version}"; Settings.Default.Set("eula", true); Settings.Default.Save(); Debug.WriteLine("[EULA Test] {0}", Settings.Default.Get <bool>("eula")); ApplicationSettingsFlyout.Content = new SettingsMenuControl(this); SettingFlyout.Content = new BgEditorControl(this); SettingFlyout.IsOpen = true; AboutFlyout.Content = new AboutControl(this); HelperLib.TakeOwnership(Config.LogonFolder); HelperLib.TakeOwnership(Config.PriFileLocation); if (!File.Exists(Config.BakPriFileLocation)) { Debug.WriteLine("[Warning]: Could not find Windows.UI.Logon.pri.bak file. Creating new."); File.Copy(Config.PriFileLocation, Config.BakPriFileLocation); } HelperLib.TakeOwnership(Config.BakPriFileLocation); File.Copy(Config.BakPriFileLocation, _tempPriFile, true); if (File.Exists(Config.CurrentImageLocation)) { var temp = Path.GetTempFileName(); File.Copy(Config.CurrentImageLocation, temp, true); Settings.Default.Set("current.img", File.ReadAllBytes(temp)); Settings.Default.Save(); File.Delete(Config.CurrentImageLocation); } Loaded += (o, i) => { SettingFlyout.Position = Settings.Default.Get("flyout", Position.Right); GlyphsViewer.ToolTip = Settings.Default.Get("filename", "No File"); }; if (Settings.Default.Exist("current.img")) { var temp = Path.GetTempFileName(); File.WriteAllBytes(temp, Settings.Default.Get <byte[]>("current.img")); WallpaperViewer.Source = new BitmapImage(new Uri(temp)); } EditBackgroundLabel.Text = LanguageLibrary.Language.Default.main_top_edit; LockWindowsLabel.Text = LanguageLibrary.Language.Default.main_top_lock; AboutButton.Content = LanguageLibrary.Language.Default.main_top_about; SettingFlyout.Header = LanguageLibrary.Language.Default.flyout_edit_title; AboutFlyout.Header = LanguageLibrary.Language.Default.flyout_about_title; ApplicationSettingsFlyout.Header = LanguageLibrary.Language.Default.flyout_settings_title; settingsName.Text = LanguageLibrary.Language.Default.flyout_settings_title; #if !DEBUG UsernameFeild.Text = Environment.UserName; #endif UserDisplayPicture.Source = Image.FromFile(Helpers.GetUserTilePath(null)) .ResizeImage(new Size(300, 300)) .ToBitmapSource(); }
public HelpersController() { helperLib = new HelperLib(); }
private static int Main(string[] args) { // Uses System.CommandLine beta library // see https://github.com/dotnet/command-line-api/wiki/Your-first-app-with-System.CommandLine // PM> Install-Package System.CommandLine -Version 2.0.0-beta1.20104.2 // Using Arity example: new Option("--sport", argument: new Argument<string> { Arity = ArgumentArity.ExactlyOne }) RootCommand rootCommand = new RootCommand("Load File Type") { new Option <DirectoryInfo>("--folder", "The root folder of the tree to scan which must exist, 'F:/Picasa backup/c/photos'.").ExistingOnly(), new Option <string>("--fileType", "File media type to load, Photo or Video.").FromAmong("Photo", "Video"), new Option <bool>("--replace", getDefaultValue: () => false, "Replace default (true) or append (false) to the db tables CheckSum & CheckSumDupes.") { IsRequired = false }, new Option <bool>("--verbose", getDefaultValue: () => false, "Verbose logging.") { IsRequired = false } }; // setup the root command handler rootCommand.Handler = CommandHandler.Create((DirectoryInfo folder, string fileType, bool replace, bool verbose) => { HelperLib.LoadFileType(folder, fileType, replace, verbose); }); // sub command to extract EXIF date/time from all JPG image files in a folder tree #region "subcommand2 EXIF" Command command2 = new Command("EXIF", "extract EXIF date/time from all JPG image files in a folder tree") { new Option <DirectoryInfo>("--folder", "The root folder to scan image file, 'C:\\Users\\User\\OneDrive\\Photos").ExistingOnly(), new Option <bool>("--replace", getDefaultValue: () => true, "Replace default (true) or append (false) to the db tables CheckSum.") { IsRequired = true } }; command2.Handler = CommandHandler.Create((DirectoryInfo folder, bool replace) => { HelperLib.ProcessEXIF(folder, replace); }); rootCommand.AddCommand(command2); #endregion // Command3 - Log the EXIF directories for a photo or video media file #region "subcommand3 anEXIF" Command command3 = new Command("anEXIF", "Log the EXIF data from a single file.") { new Option <FileInfo>("--image", "An image file, 'C:\\Users\\User\\OneDrive\\Photos\\2013\\02\\2013-02-24 12.34.54-3.jpg'").ExistingOnly() }; command3.Handler = CommandHandler.Create((FileInfo image) => { HelperLib.ProcessAnEXIF(image); }); rootCommand.AddCommand(command3); #endregion // Command4 - CameraRoll_Move #region "subcommand4 CameraRoll_Move" Command command4 = new ("CameraRoll_Move", "Move media file types from CameraRoll folder to date folders.") { new Option <string>("--mediaFileType", "Photo or Video").FromAmong("Photo", "Video"), new Option <bool>("--verbose", getDefaultValue: () => false, "Verbose logging") { IsRequired = false } }; command4.Handler = CommandHandler.Create((string mediaFileType, bool verbose) => { HelperLib.CameraRoll_Move(mediaFileType, verbose); }); rootCommand.AddCommand(command4); #endregion // Command5 - calculate and store up to 3 percuptual hashes and SHA256 in the CheckSum table #region "subcommand5 CalculateHashes - Calculate hashes and store in CheckSum" Command command5 = new ("CalculateHashes", "Calculate and store hashes in the CheckSum table.") { new Option <bool>("--ShaHash", getDefaultValue: () => false, "Calculate the ShaHash.") { IsRequired = true }, new Option <bool>("--AverageHash", getDefaultValue: () => false, "Calculate the AverageHash.") { IsRequired = true }, new Option <bool>("--DifferenceHash", getDefaultValue: () => false, "Calculate the DifferenceHash.") { IsRequired = true }, new Option <bool>("--PerceptualHash", getDefaultValue: () => false, "Calculate the PerceptualHash.") { IsRequired = true }, new Option <bool>("--verbose", getDefaultValue: () => false, "Verbose logging.") }; command5.Handler = CommandHandler.Create((bool ShaHash, bool averageHash, bool differenceHash, bool perceptualHash, bool verbose) => { HelperLib.CalculateHashes(ShaHash, averageHash, differenceHash, perceptualHash, verbose); }); rootCommand.AddCommand(command5); #endregion // Command6 - CheckSumDups insert or update based on hash from CheckSum #region "subcommand6 CheckSumDups - insert or update CheckSumDups based on hash from CheckSum" Command command6 = new ("FindDupsUsingHash", "CheckSumDups - insert or update CheckSumDups based on hash from CheckSum.") { new Option <string>("--hash", "Hash to use average, difference, perceptual.").FromAmong("ShaHash", "AverageHash", "DifferenceHash", "PerceptualHash"), new Option <bool>("--verbose", getDefaultValue: () => false, "Verbose logging.") }; command6.Handler = CommandHandler.Create((string hash, bool verbose) => { HelperLib.FindDupsUsingHash(hash, verbose); }); rootCommand.AddCommand(command6); #endregion // Command7 - PerceptualHash_Move2Hdrive #region "subcommand7 PerceptualHash_Move2Hdrive Command command7 = new("PerceptualHash_Move2Hdrive", "PerceptualHash_Move2Hdrive") { new Option <bool>("--verbose", getDefaultValue: () => false, "Verbose logging.") .AddSuggestions("true", "false") }; command7.Handler = CommandHandler.Create((bool verbose) => { var hL = new HelperLib(); hL.PerceptualHash_Move2Hdrive(verbose); }); rootCommand.AddCommand(command7); #endregion // set up common functionality like --help, --version, and dotnet-suggest support var commandLine = new CommandLineBuilder(rootCommand) .UseDefaults() // automatically configures dotnet-suggest .Build(); // call the method defined in the handler return(commandLine.InvokeAsync(args).Result); } } }
private void Window_Loaded(object sender, RoutedEventArgs e) { HelperLib.DisableMaximaizeButton(Window.GetWindow(this)); HelperLib.DisableMinimaizeButton(Window.GetWindow(this)); }
public void FixConfigTest() { HelperLib.FixConfig(@"D:\_Koikatu\_koikatu hf patch test"); }
public void RemoveSideloaderDuplicatesTest() { HelperLib.RemoveSideloaderDuplicates(@"D:\_Koikatu\_koikatu hf patch test"); }
public void FixConfigTest() { HelperLib.FixConfig(@"D:\Games\Koikatsu"); }
public void RemoveModsExceptModpacksTest() { HelperLib.RemoveModsExceptModpacks(@"D:\Games\Koikatsu"); }
public void CreateBackupTest() { HelperLib.CreateBackup(@"D:\Games\Koikatsu"); }