public void SaveAllDataToJSONFile(string file_name) { //CheckOutItem[] all_items = new CheckOutItem[check_out_items_list.Count]; ; //Debug.Log("attempting to save all data to JSON at file location: " + file_name); string building_json_string = string.Empty; for (int i = 0; i < check_out_items_list.Count; i++) { if (building_json_string != string.Empty) { building_json_string = building_json_string + ","; } string js_converted = JsonUtility.ToJson(check_out_items_list[i]); building_json_string = building_json_string + js_converted; } building_json_string = "{\"Items\":[" + building_json_string + "]}"; //DoJsonReadtest(building_json_string); FileMan.RewriteFile(building_json_string, file_name); }//end SaveAllDataToJSONFile
private void deletePlugin(int numberInList) { DialogResult window = DialogMan.ShowConfirm( this, LangMan.Get("delete-plugin-warning"), windowTitle: LangMan.Get("warning"), yesBtnText: LangMan.Get("delete-plugin"), yesBtnImage: deleteBtn.Image, darkMode: DarkMode, topMost: TopMost ); if (window == DialogResult.Yes) { listView1.Items[numberInList].Remove(); imageList1.Images[numberInList].Dispose(); string pluginFolder = Path.Combine(PluginMan.pluginsFolder, codenames[numberInList]); if (File.Exists(pluginFolder)) { FileMan.MoveFileOrFolderToRecycleBin(pluginFolder); } else { DialogMan.ShowInfo( this, LangMan.Get("plugin-not-found"), LangMan.Get("error"), DarkMode, TopMost ); } RefreshPluginsList(); } }
public void OpenACheckoutFile(string file_path) { string read_content = FileMan.ReadFileContent(file_path); if (read_content != string.Empty) { all_items = JsonHelper.FromJson <CheckOutItem>(read_content); } }
private void InfoForm_Load(object sender, EventArgs e) { SetDarkMode(DarkMode); InitLanguage(); if (directoryName != null) { string path = Path.Combine(directoryName, fileName); fileNameTextBox.Text = fileName; folderTextBox.Text = directoryName; fullPathTextBox.Text = path; diskSizeTextBox.Text = FileMan.GetFileSizeStr(path); extensionTextBox.Text = Path.GetExtension(path).Substring(1, Path.GetExtension(path).Length - 1).ToUpper(); createdTextBox.Text = File.GetCreationTime(path).ToShortDateString() + " - " + File.GetCreationTime(path).ToLongTimeString(); modifiedTextBox.Text = File.GetLastWriteTime(path).ToShortDateString() + " - " + File.GetLastWriteTime(path).ToLongTimeString(); propertiesButton.Visible = true; } double inchesWidth = bitmap.Width / bitmap.HorizontalResolution; double inchesHeight = bitmap.Height / bitmap.VerticalResolution; double cmWidth = inchesWidth * 2.54; double cmHeight = inchesHeight * 2.54; compressionTextBox.Text = getImageCompression(bitmap); sizeTextBox.Text = bitmap.Width + " x " + bitmap.Height + " " + LangMan.Get("pixels"); megapixelsTextBox.Text = ((((float)bitmap.Height * bitmap.Width) / 1000000)).ToString("0.##") + " " + LangMan.Get("megapixels"); resolutionTextBox.Text = Math.Round(bitmap.HorizontalResolution) + " x " + Math.Round(bitmap.VerticalResolution) + " DPI"; inchesTextBox.Text = inchesWidth.ToString("0.##") + " x " + inchesHeight.ToString("0.##") + " " + LangMan.Get("inches"); cmTextBox.Text = cmWidth.ToString("0.##") + " x " + cmHeight.ToString("0.##") + " " + LangMan.Get("centimeters"); int firstRatio = bitmap.Width / GCD(bitmap.Width, bitmap.Height); int secondRatio = bitmap.Height / GCD(bitmap.Width, bitmap.Height); ratioTextBox.Text = string.Format("{0} : {1} (", firstRatio, secondRatio); if (firstRatio == secondRatio) { ratioTextBox.Text += LangMan.Get("square"); } else if (firstRatio > secondRatio) { ratioTextBox.Text += LangMan.Get("landscape"); } else { ratioTextBox.Text += LangMan.Get("portrait"); } ratioTextBox.Text += ")"; }
static void Main(string[] args) { //Dont.Be.A.Scumbag.And.Remove.This.Warn.warn(); Console.WriteLine("Xri Client"); Console.WriteLine("Flare port to C#"); Console.WriteLine("Xri port to C#"); Console.WriteLine("Discord: https://discord.gg/t8pp4Vm"); Process.Start("minecraft://"); try { MCM.openGame(); MCM.openWindowHost(); CommandHook cmh = new CommandHook(); SDK sdk = new SDK(); FileMan fm = new FileMan(); CategoryHandler ch = new CategoryHandler(); TabUiHandler tuih = new TabUiHandler(); ModuleHandler mh = new ModuleHandler(); KeybindHandler kh = new KeybindHandler(); Thread uiApp = new Thread(() => { OverlayHost ui = new OverlayHost(); Application.Run(ui); }); if (fm.readConfig()) { Console.WriteLine("Loaded configurations!"); } else { Console.WriteLine("Could not load configurations!"); } uiApp.Start(); while (true) { try { mainLoop.Invoke(null, new EventArgs()); Thread.Sleep(threadSleep); } catch (Exception) { } } } catch (Exception ex) { Console.WriteLine("Message: " + ex.Message); Console.WriteLine("Stacktrace: " + ex.StackTrace); MessageBox.Show("Xri crashed! Check the console for error details. Click 'Ok' to quit."); } }
private bool LoadFile(string filename, out Exception exception) { exception = null; object o; if (FileMan.LoadFileBinary(filename, out o, true) || FileMan.LoadFileBinary(filename, out o, false)) { ScriptLabScript sls = o as ScriptLabScript; sls.ForceCompatibility(); ConfigToken token = sls.ToToken(AvailableEffects, Services, EffectSourceSurface); lbScript.Items.Clear(); ((ConfigToken)theEffectToken).effects.Clear(); ((ConfigToken)theEffectToken).effects.AddRange(token.effects); lbScript.Items.AddRange(token.effects.ConvertAll(step => step.Name).ToArray()); FinishTokenUpdate(); return(true); } else { exception = (Exception)o; return(false); } }
static void Main(string[] args) { //Dont.Be.A.Scumbag.And.Remove.This.Warn.warn(); Console.WriteLine("Flare# Client"); Console.WriteLine("Flare port to C#"); Console.WriteLine("Discord: https://discord.gg/Hz3Dxg8"); Process.Start("minecraft://"); try { MCM.openGame(); MCM.openWindowHost(); CommandHook cmh = new CommandHook(); FileMan fm = new FileMan(); CategoryHandler ch = new CategoryHandler(); ModuleHandler mh = new ModuleHandler(); KeybindHandler kh = new KeybindHandler(); Thread uiApp = new Thread(() => { OverlayHost ui = new OverlayHost(); Application.Run(ui); }); if (fm.readConfig()) { Console.WriteLine("Loaded config!"); } else { Console.WriteLine("Could not load config!"); } uiApp.Start(); if (args != null) { if (args.Length > 0) { if (args[0] == "dualThread") { Thread moduleThread = new Thread(() => { while (true) { try { ModuleHandler.registry.tickModuleThread(); Thread.Sleep(1); } catch (Exception) { } } }); moduleThread.Start(); } } } while (true) { try { mainLoop.Invoke(null, new EventArgs()); if (limitCpu) { Thread.Sleep(1); } } catch (Exception) { } } } catch (Exception ex) { Console.WriteLine("Message: " + ex.Message); Console.WriteLine("Stacktrace: " + ex.StackTrace); MessageBox.Show("Flare crashed! Check the console for error details. Click 'Ok' to quit."); } }
private bool SaveSlsFile(string path, out Exception exception) { return(FileMan.SaveFileBinary(path, ScriptLabScript.FromToken((ConfigToken)theEffectToken), out exception, true)); }
private void start_btn_Click(object sender, EventArgs e) { FileMan.CreateFolder(folderBro.SelectedPath, FolderNameBox.Text); string path = System.IO.Path.Combine(folderBro.SelectedPath, FolderNameBox.Text); string JqueryNpm = "cd " + path + " && " + " npm update && npm init && npm install jquery"; string SassNpm = "cd " + path + " && " + " npm update && npm install --global gulp-cli && npm init && npm install --save-dev gulp && npm install gulp-sass --save-dev"; string BootstrapNpm = "cd " + path + " && " + " npm update && npm install bootstrap"; string firstCode = "<html lang=\"en\">" + System.Environment.NewLine + " <head>" + System.Environment.NewLine + " <meta charset= \"UTF-8\"> <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">" + System.Environment.NewLine + " <meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">" + System.Environment.NewLine + " <link rel=\"stylesheet\" href=\"styles/style.css\">" + System.Environment.NewLine + " </head>" + System.Environment.NewLine + " <body>" + System.Environment.NewLine + " </body>" + System.Environment.NewLine + " </html>"; string BootstrapLink = "<link rel= \"stylesheet\" href=\"https://stackpath.bootstrapcdn.com/bootstrap/4.4.0/css/bootstrap.min.css\" integrity=\"sha384-SI27wrMjH3ZZ89r4o+fGIJtnzkAnFs3E4qz9DIYioCQ5l9Rd/7UAa8DHcaL8jkWt\" crossorigin=\"anonymous\">"; string JqueryLink = "<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js\"></script>"; FileMan.CreateFile(path, FolderNameBox.Text + ".html", firstCode); string resetContent = "html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {margin: 0; padding: 0; border: 0;font-size: 100%;font: inherit;vertical-align: baseline; } article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {display: block; } body{line-height:1;} ol,ul{list-style:none;} blockquote {&:before, &:after {content: '';content: none; } } q {&:before, &:after {content: '';content: none; } } table {border-collapse: collapse;border-spacing: 0; }"; string Mixins = "@mixin paddingLR($left,$right){padding-left: $left;padding-right: $right;} @mixin paddingTB($top,$bottom) {padding-top: $top;padding-bottom: $bottom;} @mixin marginLR($left,$right) {margin-left: $left;margin-right: $right;} @mixin marginTB($top,$bottom) {margin-top: $top;margin-bottom: $bottom;} @mixin flex ($justify-content, $align-items) {justify-content: $justify-content;align-items: $align-items;} @mixin border ($size, $type, $color) {border:$size $type $color;}"; string gulpfileContent = "'use strict';var gulp = require('gulp');var sass = require('gulp-sass'); gulp.task('sass', function () {return gulp.src('scss/style.scss') .pipe(sass().on('error', sass.logError)) .pipe(gulp.dest('styles'));}); gulp.task('watch', function () {gulp.watch('scss/*.scss',gulp.parallel('sass'));});"; string stScss = "@import 'starter/reset'; @import 'module/var'; @import 'module/fonts';@import 'module/mixins';"; FileMan.CreateFolder(path, "styles"); FileMan.CreateFile(System.IO.Path.Combine(path, "styles"), "style.css"); FileMan.CreateFolder(path, "Img"); FileMan.CreateFolder(path, "Fonts"); FileMan.CreateFolder(path, "JS"); if (this.boostrap_combo.SelectedItem.ToString().Equals("With Npm")) { ScriptRun.ExecuteCommand(BootstrapNpm); } else if (this.boostrap_combo.SelectedItem.ToString().Equals("With Link")) { FileMan.ReadAndEdit(System.IO.Path.Combine(path, FolderNameBox.Text + ".html"), "<head>", "<head> " + System.Environment.NewLine + BootstrapLink + System.Environment.NewLine); } if (this.jquery_combo.SelectedItem.ToString().Equals("With Npm")) { ScriptRun.ExecuteCommand(JqueryNpm); } else if (this.jquery_combo.SelectedItem.ToString().Equals("With Link")) { FileMan.ReadAndEdit(System.IO.Path.Combine(path, FolderNameBox.Text + ".html"), "<head>", "<head> " + System.Environment.NewLine + JqueryLink + System.Environment.NewLine); } if (SassCheck.Checked) { FileMan.CreateFile(path, "gulpfile.js", gulpfileContent); FileMan.CreateFolder(path, "scss"); FileMan.CreateFolder(System.IO.Path.Combine(path, "scss"), "base"); FileMan.CreateFolder(System.IO.Path.Combine(path, "scss"), "module"); FileMan.CreateFolder(System.IO.Path.Combine(path, "scss"), "starter"); FileMan.CreateFile(System.IO.Path.Combine(path, "scss"), "style.scss", stScss); FileMan.CreateFile(System.IO.Path.Combine(path, "scss", "module"), "mixins.scss", Mixins); FileMan.CreateFile(System.IO.Path.Combine(path, "scss", "module"), "fonts.scss"); FileMan.CreateFile(System.IO.Path.Combine(path, "scss", "module"), "var.scss"); FileMan.CreateFile(System.IO.Path.Combine(path, "scss", "starter"), "reset.scss", resetContent); ScriptRun.ExecuteCommand(SassNpm); } }