private void btnsave_Click(object sender, EventArgs e) { var conf = ShiftOS.Objects.UserConfig.Get(); conf.DigitalSocietyAddress = txtdsaddress.Text; int p = 0; if (int.TryParse(txtdsport.Text, out p) == false || p < 0 || p > 65535) { Infobox.Show("{TITLE_INVALIDPORT}", "{PROMPT_INVALIDPORT}"); return; } conf.DigitalSocietyPort = p; bool requiresRestart = (conf.Language != cblanguage.Text); conf.Language = cblanguage.Text; System.IO.File.WriteAllText("servers.json", Newtonsoft.Json.JsonConvert.SerializeObject(conf, Newtonsoft.Json.Formatting.Indented)); HideOptions(); if (requiresRestart == true) { Infobox.Show("{TITLE_RESTARTREQUIRED}", "{PROMPT_RESTARTREQUIRED}", () => { Application.Restart(); }); } }
private void btnlogin_Click(object sender, EventArgs e) { string sys = txtsys.Text; string uname = txtuname.Text; string root = txtroot.Text; // validation if (string.IsNullOrWhiteSpace(sys)) { Infobox.Show("{TITLE_EMPTY_SYSNAME}", "{MSG_EMPTY_SYSNAME}"); return; } if (sys.Length < 5) { Infobox.Show("{TITLE_VALIDATION_ERROR}", "{MSG_VALIDATION_ERROR_SYSNAME_LENGTH}"); return; } if (string.IsNullOrWhiteSpace(uname)) { Infobox.Show("{TITLE_VALIDATION_ERROR}", "You must provide a username."); return; } Callback?.Invoke(new SignupCredentials { SystemName = sys, Username = uname, RootPassword = root }); AppearanceManager.Close(this); }
private void btnplay_Click(object sender, EventArgs e) { if (o == null) { if (lbtracks.Items.Count > 0) { Play(lbtracks.Items[0].ToString()); btnplay.Text = "Pause"; } else { Infobox.Show("Error", "No tracks to play! Please add a track to the playlist."); } } else if (o.PlaybackState == NAudio.Wave.PlaybackState.Paused) { o.Resume(); btnplay.Text = "Pause"; } else if (o.PlaybackState == NAudio.Wave.PlaybackState.Playing) { o.Pause(); btnplay.Text = "Play"; } }
protected override void Run() { this.SetStatus("Downloading..."); SetProgress(0); int i = 0; while (i <= Size) { double progress = ((i / Size) * 100); SetProgress((int)progress); i += Applications.DownloadManager.GetDownloadSpeed(); Thread.Sleep(1000); } SetProgress(0); SetStatus("Installing..."); i = 0; while (i <= Size) { double progress = ((i / Size) * 100); SetProgress((int)progress); i += 1024; Thread.Sleep(1000); } Desktop.InvokeOnWorkerThread(() => { Shiftorium.Buy(ShiftoriumId, 0); Infobox.Show("Install complete!", "The installation of " + Name + " has completed."); SaveSystem.SaveGame(); }); }
private void btnapply_Click(object sender, EventArgs e) { SkinEngine.LoadedSkin.AppIcons = Icons; SkinEngine.SaveSkin(); SkinEngine.LoadSkin(); Infobox.Show("Icons applied!", "The new icons have been applied to ShiftOS successfully!"); }
private void btnlogin_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(txtusername.Text)) { Infobox.Show("Enter a username", "You must enter your username to login."); return; } //Don't check for blank passwords. var user = SaveSystem.CurrentSave.Users.FirstOrDefault(x => x.Username == txtusername.Text); if (user == null) { Infobox.Show("Invalid username", "That username was not found on your system."); return; } if (user.Password != txtpassword.Text) { Infobox.Show("Access denied.", "That password didn't work. Please try a different one."); return; } User = user; userRequestClose = false; shuttingdown = false; this.Close(); }
private void btnok_Click(object sender, EventArgs e) { var sys = VirtualEnvironments.Get(txtcsys.Text); if (sys != null) { //user auth var user = sys.Users.FirstOrDefault(x => x.Username == txtcuser.Text && x.Password == txtcpass.Text); if (user != null) { OpenConnection = sys; CurrentRemoteUser = user; if (Mounts.Count == 3) { Mounts.RemoveAt(2); } Mounts.Add(sys.Filesystem); ChangeDirectory("2:"); pnlconnect.Hide(); connectToRemoteServerToolStripMenuItem.Text = "Reauthenticate"; disconnectToolStripMenuItem.Visible = true; return; } Infobox.Show("Access denied.", "Authentication failed for the specified user. Connection aborted."); return; } var t = new System.Threading.Thread(() => { System.Threading.Thread.Sleep(5000); Infobox.Show("Connection timeout.", "Cannot connect to the specified system name..."); }); t.IsBackground = true; t.Start(); }
private void btnsubscribe_Click(object sender, EventArgs e) { if (btnsubscribe.Text == SOL_YOUARESUBSCRIBED) { Infobox.PromptYesNo("Unsubscribe", "Are you sure you want to unsubscribe from ShiftOS Online?", (result) => { if (result == true) { SaveSystem.CurrentSave.ShiftnetSubscription = 0; Setup(); OnSkinLoad(); } }); } else { Infobox.PromptYesNo("Subscribe?", "Would you like to subscribe to ShiftOS Online to get 768 kb/s for 300 Codepoints?", (result) => { if (result == true) { if (SaveSystem.CurrentSave.Codepoints >= 300) { SaveSystem.CurrentSave.Codepoints -= 300; SaveSystem.CurrentSave.ShiftnetSubscription = 3; Infobox.Show("Subscribed.", "You have sent 300 Codepoints to ShiftOS Online and have successfully subscribed to their Shiftnet Service."); } else { Infobox.Show("Insufficient Codepoints", "You do not have enough Codepoints to complete this operation."); } } }); } }
public void Granted() { Infobox.Show("{ACCESS_GRANTED}", "{ACCESS_GRANTED_MUDADMIN_EXP}"); //This will tell the server to take the granted password off the list of granted passwords //so the user must generate and crack a new one. ServerManager.SendMessage("mudhack_killpass", ""); SetupAuthUI(); }
public List <IInfobox> GetInfobox(string wikiText) { if (string.IsNullOrWhiteSpace(wikiText)) { return(null); } var result = new List <IInfobox>(); var buildingName = _titleParserSingle.GetBuildingTitle(wikiText); if (string.IsNullOrWhiteSpace(buildingName)) { } var buildingIcon = getBuildingIcon(wikiText); if (string.IsNullOrWhiteSpace(buildingIcon)) { } var buildingType = getBuildingType(wikiText); if (buildingType == BuildingType.Unknown) { } var productionInfo = getProductionInfo(wikiText); if (productionInfo == null && buildingType == BuildingType.Production) { } var supplyInfo = getSupplyInfo(wikiText); var unlockInfo = getUnlockInfo(wikiText); var buildingSize = getBuildingSize(wikiText); var constructionInfo = getConstructionInfo(wikiText); var parsedInfobox = new Infobox { Name = buildingName, Icon = buildingIcon, Type = buildingType, ProductionInfos = productionInfo, SupplyInfos = supplyInfo, UnlockInfos = unlockInfo, BuildingSize = buildingSize, ConstructionInfos = constructionInfo //Region }; result.Add(parsedInfobox); return(result); }
private void button1_Click(object sender, EventArgs e) { // Make codePoints and difficulty in this function int codePoints = Convert.ToInt32(Math.Round(cpUpDown.Value, 0)); int difficulty = Convert.ToInt32(Math.Round(difUpDown.Value, 0)); if (SaveSystem.CurrentSave.Codepoints < 10) { Infobox.Show("Not enough Codepoints", "You do not have enough Codepoints to use ShiftLotto!"); } else { if (SaveSystem.CurrentSave.Codepoints < (ulong)(codePoints * difficulty)) { Infobox.Show("Not enough Codepoints", "You do not have enough Codepoints to gamble this amount!"); } else { // Create Random Ints Random rnd = new Random(); // Set their highest possible number to Difficulty int guessedNumber = rnd.Next(0, difficulty); int winningNumber = rnd.Next(0, difficulty); // Multiply CodePoints * Difficulty ulong jackpot = (ulong)(codePoints * difficulty); // Test the random ints if (guessedNumber == winningNumber) { // If you win // Add Codepoints SaveSystem.TransferCodepointsFrom("shiftlotto", (ulong)(codePoints * difficulty)); // Infobox Infobox.Show("YOU WON!", "Good Job! " + jackpot.ToString() + " CP has been added to your account. "); } else { // If you fail // Remove Codepoints SaveSystem.TransferCodepointsToVoid(jackpot); // Infobox Infobox.Show("YOU FAILED!", "Sorry! " + jackpot.ToString() + " CP has been removed from your account."); } } } }
private void btnjoinfreebie_Click(object sender, EventArgs e) { Infobox.PromptYesNo("Switch providers", "Would you like to switch from your current Shiftnet provider, " + Applications.DownloadManager.GetAllSubscriptions()[SaveSystem.CurrentSave.ShiftnetSubscription].Name + ", to Freebie Solutions by ShiftSoft?", (res) => { if (res == true) { SaveSystem.CurrentSave.ShiftnetSubscription = 0; Infobox.Show("Switch providers", "The operation has completed successfully."); } }); }
private void btnstart_Click(object sender, EventArgs e) { if (FileExists(txtfilepath.Text)) { var install = new StpInstallation(txtfilepath.Text); InitiateInstall(install); } else { Infobox.Show("File not found.", "The file you requested was not found on the system."); } }
private void addContactToolStripMenuItem_Click(object sender, EventArgs e) { Infobox.PromptText("Add Contact", "What is the contact's name?", delegate(string name) { if (name != "") { Infobox.PromptText("Add Contact", "What is the user's username?", delegate(string uname) { if (uname != "") { Infobox.PromptText("Add Contact", "What is the user's systemname?", delegate(string sysname) { if (sysname != "") { Infobox.PromptText("Add Contact", "How would you describe this user?", delegate(string desc) { if (desc != "") { Contact contact = new Contact(); contact.Name = name; contact.UserName = uname; contact.SystemName = sysname; contact.Relationship = ContactRelationship.Acquaintance; contact.IsStoryCharacter = false; contact.Description = desc; var contactJson = JsonConvert.SerializeObject(contact); WriteAllText(data_dir + "/" + name, contactJson); OnLoad(); // Reload to show changes } else { Infobox.Show("Add Contact", "Description cannot be empty."); } }); } else { Infobox.Show("Add Contact", "System name cannot be empty."); } }); } else { Infobox.Show("Add Contact", "Username cannot be empty."); } }); } else { Infobox.Show("Add Contact", "Name cannot be empty."); } }); }
private void btnapply_Click(object sender, EventArgs e) { //Apply the skin. Utils.WriteAllText(Paths.GetPath("skin.json"), JsonConvert.SerializeObject(LoadedSkin)); SkinEngine.LoadSkin(); CodepointValue = CodepointValue / 4; Infobox.Show("{SHIFTER_SKIN_APPLIED}", "{YOU_HAVE_EARNED} " + CodepointValue.ToString() + " {CODEPOINTS}."); ShiftOS.Engine.Shiftorium.Silent = true; SaveSystem.CurrentSave.Codepoints += CodepointValue; SaveSystem.SaveGame(); ShiftOS.Engine.Shiftorium.Silent = false; CodepointValue = 0; }
public static void DisconnectRemote() { Desktop.InvokeOnWorkerThread(() => { OnDisconnect?.Invoke(); CurrentRemoteUser = new Objects.ClientSave(); if (!string.IsNullOrWhiteSpace(OpenConnection.SystemName)) { Infobox.Show("Connections terminated.", "All outbound File Skimmer connections have been terminated."); } OpenConnection = new ShiftOSEnvironment(); }); }
public void Lose() { InitializeCoordinates(); counterTimer.Stop(); secondsleft = 60; level = 1; speedFactor = 0.0125; pnlgamestart.Show(); pnlgamestart.BringToFront(); pnlgamestart.CenterParent(); Infobox.Show("{TITLE_PONG_YOULOSE}", "{PROMPT_PONGLOST}"); doAi = false; doBallCalc = false; }
private void reset_Click(object sender, EventArgs e) { if (InterpreterThread != null) { if (InterpreterThread.IsAlive) { Infobox.Show("Cannot Reset", "The program is still running."); } else { Interpreter.Reset(); } } }
private void addSongToolStripMenuItem_Click(object sender, EventArgs e) { FileSkimmerBackend.GetFile(new[] { ".mp3", ".wav" }, FileOpenerStyle.Open, (path) => { if (!lbtracks.Items.Contains(path)) { lbtracks.Items.Add(path); } else { Infobox.Show("Song already added!", "That song is already added to the Audio Player playlist."); } }); }
private void deleteToolStripMenuItem_Click(object sender, EventArgs e) { try { Infobox.PromptYesNo("Delete file", "Are you sure you want to delete " + lvitems.SelectedItems[0].Text + "?", (result) => { if (result == true) { Delete(currentdir + "/" + lvitems.SelectedItems[0].Tag.ToString()); ResetList(); } }); } catch { } }
/// <summary> /// Executes the specified string as a Lua script. /// </summary> /// <param name="lua">The Lua code to execute.</param> public void Execute(string lua) { try { Console.WriteLine(""); Lua(lua); Console.WriteLine($"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); } catch (Exception e) { Infobox.Show("Script error", $@"Script threw {e.GetType().Name}: {e.Message}"); } }
public List <IInfobox> GetInfobox(string wikiText) { if (string.IsNullOrWhiteSpace(wikiText)) { return(null); } var result = new List <IInfobox>(); var buildingName = getBuildingName(wikiText); if (string.IsNullOrWhiteSpace(buildingName)) { } var buildingType = getBuildingType(wikiText); if (buildingType == BuildingType.Unknown) { } var productionInfo = getProductionInfo(wikiText); if (productionInfo == null && buildingType == BuildingType.Production) { } var supplyInfo = getSupplyInfo(wikiText); var unlockInfo = getUnlockInfo(wikiText); var specialBuildingNameHelper = new SpecialBuildingNameHelper(); buildingName = specialBuildingNameHelper.CheckSpecialBuildingName(buildingName); var parsedInfobox = new Infobox { Name = buildingName, Type = buildingType, ProductionInfos = productionInfo, SupplyInfos = supplyInfo, UnlockInfos = unlockInfo, //Region }; result.Add(parsedInfobox); return(result); }
public static void InitiateEngine(System.IO.TextWriter writer) { OutOfBoxExperience.Init(new OOBE()); AppearanceManager.Initiate(new WpfWindowManager()); Infobox.Init(new WpfInfoboxFrontend()); FileSkimmerBackend.Init(new Applications.WpfFSFrontend()); if (writer != null) { Console.SetOut(writer); } SaveSystem.Begin(false); AppearanceManager.OnExit += () => { Environment.Exit(0); }; }
private void btnimport_Click(object sender, EventArgs e) { AppearanceManager.SetupDialog(new FileDialog(new[] { ".skn" }, FileOpenerStyle.Open, new Action <string>((filename) => { try { LoadedSkin = JsonConvert.DeserializeObject <Skin>(ShiftOS.Objects.ShiftFS.Utils.ReadAllText(filename)); } catch { Infobox.Show("Invalid Skin", "This skin is not compatible with this version of ShiftOS."); } SetupUI(); }))); }
private void btnapply_Click(object sender, EventArgs e) { //Apply the skin. Utils.WriteAllText(Paths.GetPath("skin.json"), JsonConvert.SerializeObject(LoadedSkin)); SkinEngine.LoadSkin(); CodepointValue = CodepointValue / 4; Infobox.Show("{TITLE_SKINAPPLIED}", Localization.Parse("{PROMPT_SKINAPPLIED}", new Dictionary <string, string> { ["%cp"] = CodepointValue.ToString() })); ShiftOS.Engine.Shiftorium.Silent = true; SaveSystem.CurrentSave.Codepoints += CodepointValue; SaveSystem.SaveGame(); ShiftOS.Engine.Shiftorium.Silent = false; CodepointValue = 0; }
private void buybtn_Click(object sender, EventArgs e) { if (Shiftorium.UpgradeInstalled("mindblow")) { Infobox.Show("Already Purchased", "You have already bought MindBlow."); } else if (SaveSystem.CurrentSave.Codepoints < 50000) { Infobox.Show("Not Enough Codepoints", "You do not have enough Codepoints to buy MindBlow."); } else { Shiftorium.Buy("mindblow", 50000); Infobox.Show("Installation Complete", "MindBlow has been successfully installed."); } }
private void lnkdownload_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { var attrib = typeof(Applications.WidgetManagerFrontend).GetCustomAttributes(false).FirstOrDefault(x => x is StpContents) as StpContents; if (attrib != null) { FileSkimmerBackend.GetFile(new[] { ".stp" }, FileOpenerStyle.Save, (file) => { WriteAllText(file, JsonConvert.SerializeObject(attrib)); }); } else { Infobox.Show("Service not available.", "The Shiftnet service you requested is not available."); } }
private void btncashout_Click(object sender, EventArgs e) { pnllevelwon.Hide(); SaveSystem.CurrentSave.Codepoints += (ulong)codepointsToEarn; level = 1; speedFactor = 0.0125; Infobox.Show("{TITLE_CODEPOINTSTRANSFERRED}", Localization.Parse("{PROMPT_CODEPOINTSTRANSFERRED}", new Dictionary <string, string> { ["%transferrer"] = "Pong", ["%amount"] = codepointsToEarn.ToString() })); codepointsToEarn = 0; pnlgamestart.Show(); pnlgamestart.BringToFront(); pnlgamestart.CenterParent(); }
private void run_Click(object sender, EventArgs e) { InterpreterThread = new Thread(() => { try { Interpreter.Reset(); Interpreter.Execute(programinput.Text); } catch (ThreadAbortException) { } // ignore catch (Exception ex) { Desktop.InvokeOnWorkerThread(() => Infobox.Show("Program Error", "An error occurred while executing your program: " + ex.GetType().ToString())); } }); InterpreterThread.Start(); }
/// <summary> /// Run a compressed .SFT file as a lua script. /// </summary> /// <param name="sft">The .sft file to run.</param> public static void RunSft(string sft) { if (Utils.FileExists(sft)) { try { string b64 = Utils.ReadAllText(sft); byte[] bytes = Convert.FromBase64String(b64); string lua = Encoding.UTF8.GetString(bytes); CurrentDirectory = sft.Replace(Utils.GetFileInfo(sft).Name, ""); new LuaInterpreter().Execute(lua); } catch { Infobox.Show("Invalid binary.", "This file is not a valid ShiftOS binary executable."); } } }
static void Main(string[] args) { if (args.Length != 0 && File.Exists(args[0])) { var infoboxParser = new InfoboxParser(); var parseType = args.Length > 1 ? args[1] : "json"; var infoboxes = new List<Infobox>(); using (StreamWriter writer = new StreamWriter("output.txt")) { foreach (var infobox in infoboxParser.GetInfoboxFromWikiDump(args[0])) { if (parseType == "json") { writer.WriteLine(JsonConvert.SerializeObject(infobox, Formatting.Indented)); } else if (parseType == "triplestore") { writer.WriteLine(infobox.ArticleName + "\tINFOBOX_NAME\t" + infobox.Name); foreach (var record in infobox.Records) { writer.WriteLine(infobox.ArticleName + "\t" + record.Property + "\t" + record.Value); } } else if (parseType == "mappings") { var properties = new List<string>(); var infoboxName = infobox.Name; var existedInfobox = infoboxes.FirstOrDefault(i => i.Name == infoboxName); var existed = existedInfobox != null; if (existedInfobox == null) { existedInfobox = new Infobox(); existedInfobox.Name = infoboxName; existedInfobox.Records = new List<InfoboxRecord>(); } foreach (var record in infobox.Records) { var existedProp = existedInfobox.Records.FirstOrDefault(p => p.Property == record.Property); existedProp = new InfoboxRecord(); existedProp.Property = record.Property; existedInfobox.Records.Add(existedProp); } if (!existed) { infoboxes.Add(existedInfobox); } } } if (parseType == "mappings") { foreach (var infobox in infoboxes) { var properties = infobox.Records.Select(s => s.Property); properties = properties.Distinct().ToList(); writer.WriteLine("{{ TemplateMapping | mapToClass = " + infobox.Name + " | mappings = "); foreach (var property in properties) { writer.WriteLine("{{ PropertyMapping | templateProperty = " + property + " | ontologyProperty = }}"); } writer.WriteLine("}}"); } } } } }