public static void doUserAndPassword() { string droneshareusername = MainV2.getConfig("droneshareusername"); InputBox.Show("Username", "Username", ref droneshareusername); MainV2.config["droneshareusername"] = droneshareusername; string dronesharepassword = MainV2.getConfig("dronesharepassword"); if (dronesharepassword != "") { try { // fail on bad entry var crypto = new Crypto(); dronesharepassword = crypto.DecryptString(dronesharepassword); } catch { } } InputBox.Show("Password", "Password", ref dronesharepassword, true); var crypto2 = new Crypto(); string encryptedpw = crypto2.EncryptString(dronesharepassword); MainV2.config["dronesharepassword"] = encryptedpw; }
public static string DeCryptPasswd(string key, string value) { if (string.IsNullOrEmpty(value)) return ""; Crypto cpt = new Crypto(Crypto.SymmProvEnum.DES); return cpt.Decrypting(value, key); }
public static string CryptPasswd(string data, string cryptKey) { if (string.IsNullOrEmpty(data)) return ""; Crypto cpt = new Crypto(Crypto.SymmProvEnum.DES); return cpt.Encrypting(data, cryptKey); }
public static SecretShare[] SplitKey(Crypto.EncryptedData encryptedData) { var keySplitIndex = (int)Math.Round((double)encryptedData.Key.Length / 2); var split1 = encryptedData.Key.Substring(0, keySplitIndex); var split2 = encryptedData.Key.Substring(keySplitIndex); var encryptedDataString = encryptedData.ToString(); return new[] { new SecretShare { Type = SecretShareType.StringSplit, EncryptedData = encryptedDataString, SharedSecret = split1}, new SecretShare { Type = SecretShareType.StringSplit, EncryptedData = encryptedDataString, SharedSecret = split2}, }; }
public static void doUpload(string file) { if (!validcred) { doUserAndPassword(); } string droneshareusername = MainV2.getConfig("droneshareusername"); string dronesharepassword = MainV2.getConfig("dronesharepassword"); if (dronesharepassword != "") { try { // fail on bad entry var crypto = new Crypto(); dronesharepassword = crypto.DecryptString(dronesharepassword); } catch { } } MAVLinkInterface mav = new MAVLinkInterface(); mav.BaseStream = new Comms.CommsFile(); mav.BaseStream.PortName = file; mav.BaseStream.Open(); if (mav.getHeartBeat().Length == 0) { CustomMessageBox.Show("Invalid log"); return; } mav.Close(); string viewurl = Utilities.DroneApi.droneshare.doUpload(file, droneshareusername, dronesharepassword, mav.MAV.Guid , Utilities.DroneApi.APIConstants.apiKey); if (viewurl != "") { try { validcred = true; System.Diagnostics.Process.Start(viewurl); } catch (Exception ex) { log.Error(ex); CustomMessageBox.Show("Failed to open url " + viewurl); } } }
public static void doUpload(string file) { if (file == null) return; if (!validcred) { doUserAndPassword(); } string droneshareusername = MainV2.getConfig("droneshareusername"); string dronesharepassword = MainV2.getConfig("dronesharepassword"); if (dronesharepassword != "") { try { // fail on bad entry var crypto = new Crypto(); dronesharepassword = crypto.DecryptString(dronesharepassword); } catch { } } String tempguid = null; if (!doLogin(droneshareusername, dronesharepassword)) { CustomMessageBox.Show("Bad Credentials", Strings.ERROR); return; } validcred = true; if (uuidcached == "") { UI.VehicleSelection veh = new VehicleSelection(accountuuids); veh.ShowDialog(); tempguid = veh.uuid; uuidcached = veh.uuid; } else { tempguid = uuidcached; } string viewurl = Utilities.DroneApi.droneshare.doUpload(file, droneshareusername, dronesharepassword, tempguid); if (viewurl != "") { try { System.Diagnostics.Process.Start(viewurl); } catch (Exception ex) { log.Error(ex); CustomMessageBox.Show("Failed to open url " + viewurl); } } }
public static Config LoadFrom(string filename) { Config config = new Config(); try { IConfigSource conf = new IniConfigSource(filename); config.Version = conf.Configs["General"].GetInt("Version", 0); config.MainWindowState = conf.Configs["Interface"].GetInt("MainWindowState", 0); config.InterfaceStyle = conf.Configs["Interface"].GetInt("Style", 1); // Login config.FirstName = conf.Configs["Login"].GetString("FirstName", string.Empty); config.LastName = conf.Configs["Login"].GetString("LastName", string.Empty); string epwd = conf.Configs["Login"].GetString("Password", string.Empty); config.LoginGrid = conf.Configs["Login"].GetInt("Grid", 0); config.LoginUri = conf.Configs["Login"].GetString("Uri", string.Empty); config.LoginLocationType = conf.Configs["Login"].GetInt("LocationType", 0); config.LoginLocation = conf.Configs["Login"].GetString("Location", string.Empty); config.iRemPWD = conf.Configs["Login"].GetBoolean("iRemPWD", false); config.UserNameList = conf.Configs["Login"].GetString("UserNameList", string.Empty); // General config.Connect4 = conf.Configs["General"].GetBoolean("Connect4", false); config.DisableNotifications = conf.Configs["General"].GetBoolean("DisableNotifications", false); config.DisableInboundGroupInvites = conf.Configs["General"].GetBoolean("DisableInboundGroupInvites", false); config.AutoSit = conf.Configs["General"].GetBoolean("AutoSit", false); config.RadarRange = conf.Configs["General"].GetInt("RadarRange", 64); config.ObjectRange = conf.Configs["General"].GetInt("ObjectRange", 20); config.GroupManPro = conf.Configs["General"].GetString("GroupManPro"); config.HeaderFont = conf.Configs["General"].GetString("HeaderFont", "Tahoma"); config.HeaderFontStyle = conf.Configs["General"].GetString("HeaderFontStyle", "Regular"); config.HeaderFontSize = conf.Configs["General"].GetFloat("HeaderFontSize", 8.5f); config.StartMinimised = conf.Configs["General"].GetBoolean("StartMinimised", false); config.HideDisconnectPrompt = conf.Configs["General"].GetBoolean("HideDisconnectPrompt", false); try { int clr = conf.Configs["General"].GetInt("HeaderBackColour", Color.Lavender.ToArgb()); config.HeaderBackColour = Color.FromArgb(clr); } catch { config.HeaderBackColour = Color.Lavender; } config.TextFont = conf.Configs["General"].GetString("TextFont", "Tahoma"); config.TextFontStyle = conf.Configs["General"].GetString("TextFontStyle", "Regular"); config.TextFontSize = conf.Configs["General"].GetFloat("TextFontSize", 8.5f); config.GivePresent = conf.Configs["General"].GetBoolean("GivePresent", false); config.HideMeta = conf.Configs["General"].GetBoolean("HideMeta", true); config.DeclineInv = conf.Configs["General"].GetBoolean("DeclineInv", false); config.DisableLookAt = conf.Configs["General"].GetBoolean("DisableLookAt", true); config.ClassicChatLayout = conf.Configs["General"].GetBoolean("ClassicChatLayout", false); config.AutoRestart = conf.Configs["General"].GetBoolean("AutoRestart", false); config.LogOffTime = conf.Configs["General"].GetInt("LogOffTime", 0); config.ReStartTime = conf.Configs["General"].GetInt("ReStartTime", 10); config.BandwidthThrottle = conf.Configs["General"].GetFloat("BandwidthThrottle", 500f); config.PlayFriendOnline = conf.Configs["General"].GetBoolean("PlayFriendOnline", false); config.PlayFriendOffline = conf.Configs["General"].GetBoolean("PlayFriendOffline", false); config.PlayIMreceived = conf.Configs["General"].GetBoolean("PlayIMreceived", false); config.PlayGroupIMreceived = conf.Configs["General"].GetBoolean("PlayGroupIMreceived", false); config.PlayGroupNoticeReceived = conf.Configs["General"].GetBoolean("PlayGroupNoticeReceived", false); config.PlayInventoryItemReceived = conf.Configs["General"].GetBoolean("PlayInventoryItemReceived", false); config.PlayPaymentReceived = conf.Configs["General"].GetBoolean("PlayPaymentReceived", false); config.AutoAcceptItems = conf.Configs["General"].GetBoolean("AutoAcceptItems", false); config.AdRemove = conf.Configs["General"].GetString("AdRemove", string.Empty); config.MasterAvatar = conf.Configs["General"].GetString("MasterAvatar", UUID.Zero.ToString()); config.EnforceLSLsecurity = conf.Configs["General"].GetBoolean("EnforceLSLsecurity", true); config.DisplayLSLcommands = conf.Configs["General"].GetBoolean("DisplayLSLcommands", true); // backward compatibility pre V 0.9.47.0 if (string.IsNullOrEmpty(config.MasterAvatar)) { config.MasterAvatar = UUID.Zero.ToString(); } config.MasterObject = conf.Configs["General"].GetString("MasterObject", UUID.Zero.ToString()); config.AutoTransfer = conf.Configs["General"].GetBoolean("AutoTransfer", false); config.DisableTrayIcon = conf.Configs["General"].GetBoolean("DisableTrayIcon", false); config.DisableFriendsNotifications = conf.Configs["General"].GetBoolean("DisableFriendsNotifications", false); config.DisableTyping = conf.Configs["General"].GetBoolean("DisableTyping", false); config.AutoAcceptFriends = conf.Configs["General"].GetBoolean("AutoAcceptFriends", false); //config.BroadcastID = conf.Configs["General"].GetBoolean("BroadcastID", true); config.DisableRadar = conf.Configs["General"].GetBoolean("DisableRadar", false); config.RestrictRadar = conf.Configs["General"].GetBoolean("RestrictRadar", false); config.DisableVoice = conf.Configs["General"].GetBoolean("DisableVoice", false); config.DisableFavs = conf.Configs["General"].GetBoolean("DisableFavs", false); config.DisableHTTPinv = conf.Configs["General"].GetBoolean("DisableHTTPinv", true); config.DisableRadarImageMiniMap = conf.Configs["General"].GetBoolean("DisableRadarImageMiniMap", false); config.AppMenuPos = conf.Configs["General"].GetString("AppMenuPos", "Top"); config.LandMenuPos = conf.Configs["General"].GetString("LandMenuPos", "Top"); config.FnMenuPos = conf.Configs["General"].GetString("FnMenuPos", "Top"); config.UseLLSD = conf.Configs["General"].GetBoolean("UseLLSD", false); config.ChatBufferLimit = conf.Configs["General"].GetInt("ChatBufferLimit", 20); config.ScriptUrlBufferLimit = conf.Configs["General"].GetInt("ScriptUrlBufferLimit", 5); // AI config.AIon = conf.Configs["AI"].GetBoolean("AIon", false); config.replyAI = conf.Configs["AI"].GetBoolean("ReplyAI", false); config.replyText = conf.Configs["AI"].GetString("ReplyText", "I am sorry but I didn't understand what you said or I haven't been taught a response for it. Can you try again, making sure your sentences are short and clear."); config.MultiLingualAI = conf.Configs["AI"].GetBoolean("MultiLingualAI", false); config.ChatTimestamps = conf.Configs["Text"].GetBoolean("ChatTimestamps", true); config.IMTimestamps = conf.Configs["Text"].GetBoolean("IMTimestamps", true); config.ChatSmileys = conf.Configs["Text"].GetBoolean("ChatSmileys", false); config.lineMax = conf.Configs["Text"].GetInt("lineMax", 5000); config.ParcelMusic = conf.Configs["Text"].GetBoolean("ParcelMusic", true); config.ParcelMedia = conf.Configs["Text"].GetBoolean("ParcelMedia", true); config.UseSLT = conf.Configs["Text"].GetBoolean("UseSLT", false); config.PlaySound = conf.Configs["Text"].GetBoolean("PlaySound", false); config.SaveIMs = conf.Configs["Text"].GetBoolean("SaveIMs", true); config.SaveChat = conf.Configs["Text"].GetBoolean("SaveChat", false); config.LogDir = conf.Configs["Text"].GetString("LogDir", METAbolt.DataFolder.GetDataFolder() + "\\Logs\\"); config.DisableGroupNotices = conf.Configs["Text"].GetBoolean("DisableGroupNotices", true); config.DisableGroupIMs = conf.Configs["Text"].GetBoolean("DisableGroupIMs", false); config.BusyReply = conf.Configs["Text"].GetString("BusyReply", "The Resident you messaged is in 'busy mode' which means they have requested not to be disturbed. Your message will still be shown in their IM panel for later viewing."); config.InitialIMReply = conf.Configs["Text"].GetString("InitialIMReply", ""); // Proxy config.UseProxy = conf.Configs["Proxy"].GetBoolean("UseProxy", false); config.ProxyURL = conf.Configs["Proxy"].GetString("ProxyURL", string.Empty); config.ProxyPort = conf.Configs["Proxy"].GetString("ProxyPort", string.Empty); config.ProxyUser = conf.Configs["Proxy"].GetString("ProxyUser", string.Empty); config.ProxyPWD = conf.Configs["Proxy"].GetString("ProxyPWD", string.Empty); // META3D try { config.DisableMipmaps = conf.Configs["META3D"].GetBoolean("DisableMipmaps", false); } catch { ; } //config.TweeterName = conf.Configs["Twitter"].GetString("TweeterName", string.Empty); //config.TweeterPwd = conf.Configs["Twitter"].GetString("TweeterPwd", string.Empty); //config.EnableTweeter = conf.Configs["Twitter"].GetBoolean("EnableTweeter", false); //config.EnableChatTweets = conf.Configs["Twitter"].GetBoolean("EnableChatTweets", false); //config.Tweet = conf.Configs["Twitter"].GetBoolean("Tweet", false); //config.TweeterUser = conf.Configs["Twitter"].GetString("TweeterUser", string.Empty); config.PluginsToLoad = conf.Configs["LoadedPlugIns"].GetString("PluginsToLoad", string.Empty); try { if (!string.IsNullOrEmpty(epwd)) { Crypto cryp = new Crypto(Crypto.SymmProvEnum.Rijndael); //string cpwd = cryp.Decrypting(epwd); string cpwd = cryp.Decrypt(epwd); config.PasswordMD5 = cpwd; } else { config.PasswordMD5 = epwd; } } catch { epwd = config.PasswordMD5 = string.Empty; MessageBox.Show("An error occured while decrypting your stored password.\nThis could mean you have the old format INI file. \nYou will have to re-enter your password so it can be ecrypted with the new method.", "METAbolt", MessageBoxButtons.OK, MessageBoxIcon.Error); //Process.Start("explorer.exe", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\METAbolt\\"); } //added by GM on 2-JUL-2009 config.groupManagerUid = conf.Configs["PlugIn"].GetString("GroupManager", "ned49b54-325d-486a-af3m"); config.chairAnnouncerUuid = UUID.Parse(conf.Configs["PlugIn"].GetString("ChairAnnouncer", UUID.Zero.ToString())); config.chairAnnouncerInterval = conf.Configs["PlugIn"].GetInt("ChairAnnouncerInterval", 5); config.chairAnnouncerGroup1 = UUID.Parse(conf.Configs["PlugIn"].GetString("ChairAnnouncerGroup1", UUID.Zero.ToString())); config.chairAnnouncerGroup2 = UUID.Parse(conf.Configs["PlugIn"].GetString("ChairAnnouncerGroup2", UUID.Zero.ToString())); config.chairAnnouncerGroup3 = UUID.Parse(conf.Configs["PlugIn"].GetString("ChairAnnouncerGroup3", UUID.Zero.ToString())); config.chairAnnouncerGroup4 = UUID.Parse(conf.Configs["PlugIn"].GetString("ChairAnnouncerGroup4", UUID.Zero.ToString())); config.chairAnnouncerGroup5 = UUID.Parse(conf.Configs["PlugIn"].GetString("ChairAnnouncerGroup5", UUID.Zero.ToString())); config.chairAnnouncerGroup6 = UUID.Parse(conf.Configs["PlugIn"].GetString("ChairAnnouncerGroup6", UUID.Zero.ToString())); config.chairAnnouncerEnabled = conf.Configs["PlugIn"].GetBoolean("ChairAnnouncerEnabled", false); config.chairAnnouncerChat = conf.Configs["PlugIn"].GetBoolean("ChairAnnouncerChat", true); //added by GM on 1-APR-2010 config.chairAnnouncerAdvert = conf.Configs["PlugIn"].GetString("ChairAnnouncerAdvert", "Brought to you by METAbolt"); // removed reference to Machin's Machines, no longer exist //throw new Exception("Test"); try { // Spelling config.EnableSpelling = conf.Configs["Spelling"].GetBoolean("EnableSpelling", false); config.SpellLanguage = conf.Configs["Spelling"].GetString("SpellLanguage", "en_GB"); } catch { ; } } catch (Exception exp) { try { exp.HelpLink = "http://www.metabolt.net/METAwiki/index.php?title=Main_Page"; // updated link addy //Logger.Log("ERROR while loading config file'" + filename + "'. Your settings may not have fully loaded. Message: " + exp.Message, Helpers.LogLevel.Error); MessageBox.Show("The was an error when loading your Config (METAbolt.ini) file.\nNot all of your settings may have been loaded.", "METAbolt", MessageBoxButtons.OK, MessageBoxIcon.Warning); } catch { ; } } return config; }
public void Save(string filename) { IniConfigSource source = new IniConfigSource(); // General IConfig config = source.AddConfig("General"); config.Set("Version", configVersion.ToString(CultureInfo.CurrentCulture)); //config.Set("iRadar", iradar.ToString()); config.Set("Connect4", connect4.ToString(CultureInfo.CurrentCulture)); config.Set("DisableNotifications", disablenotifications.ToString(CultureInfo.CurrentCulture)); config.Set("DisableInboundGroupInvites", disableinboundgroupinvites.ToString(CultureInfo.CurrentCulture)); config.Set("AutoSit", autosit.ToString(CultureInfo.CurrentCulture)); config.Set("RadarRange", radarrange.ToString(CultureInfo.CurrentCulture)); config.Set("ObjectRange", objectrange.ToString(CultureInfo.CurrentCulture)); config.Set("GroupManPro", groupmanpro); config.Set("GivePresent", givepressie.ToString(CultureInfo.CurrentCulture)); config.Set("HideMeta", metahide.ToString(CultureInfo.CurrentCulture)); config.Set("DeclineInv", declineinv.ToString(CultureInfo.CurrentCulture)); config.Set("DisableLookAt", disablelookat); config.Set("AutoRestart", autorestart.ToString(CultureInfo.CurrentCulture)); config.Set("LogOffTime", logofftime.ToString(CultureInfo.CurrentCulture)); config.Set("ReStartTime", restarttime.ToString(CultureInfo.CurrentCulture)); config.Set("BandwidthThrottle", bandwidththrottle.ToString(CultureInfo.CurrentCulture)); config.Set("ClassicChatLayout", useclassicchatlayout.ToString(CultureInfo.CurrentCulture)); config.Set("HideDisconnectPrompt", hidedisconnectprompt.ToString(CultureInfo.CurrentCulture)); if (headerfont == null) { headerfont = "Tahoma"; headerfontstyle = "Regular"; headerfontsize = 8.5f; headerbackcolour = Color.Lavender.ToArgb(); } config.Set("HeaderFont", headerfont); config.Set("HeaderFontStyle", headerfontstyle); config.Set("HeaderFontSize", headerfontsize.ToString(CultureInfo.CurrentCulture)); config.Set("HeaderBackColour", headerbackcolour.ToString(CultureInfo.CurrentCulture)); //config.Set("BgColour", bgcolour.ToString()); if (textfont == null) { textfont = "Tahoma"; textfontstyle = "Regular"; textfontsize = 8.5f; } config.Set("TextFont", textfont); config.Set("TextFontStyle", textfontstyle); config.Set("TextFontSize", textfontsize.ToString(CultureInfo.CurrentCulture)); config.Set("PlayFriendOnline", playfriendonline.ToString(CultureInfo.CurrentCulture)); config.Set("PlayFriendOffline", playfriendoffline.ToString(CultureInfo.CurrentCulture)); config.Set("PlayIMreceived", playimreceived.ToString(CultureInfo.CurrentCulture)); config.Set("PlayGroupIMreceived", playgroupimreceived.ToString(CultureInfo.CurrentCulture)); config.Set("PlayGroupNoticeReceived", playgroupnotice.ToString(CultureInfo.CurrentCulture)); config.Set("PlayInventoryItemReceived", playintentoryitem.ToString(CultureInfo.CurrentCulture)); config.Set("PlayPaymentReceived", playpaymentreceived.ToString(CultureInfo.CurrentCulture)); config.Set("AutoAcceptItems", autoacceptitems.ToString(CultureInfo.CurrentCulture)); config.Set("StartMinimised", startminimised.ToString(CultureInfo.CurrentCulture)); config.Set("AdRemove", adremove); config.Set("MasterAvatar", masteravatar); config.Set("MasterObject", masterobject); config.Set("EnforceLSLsecurity", enforcelslsecurity.ToString(CultureInfo.CurrentCulture)); config.Set("DisplayLSLcommands", displaylslcommands.ToString(CultureInfo.CurrentCulture)); config.Set("AutoTransfer", autotransfer.ToString(CultureInfo.CurrentCulture)); config.Set("DisableTrayIcon", disabletrayicon.ToString(CultureInfo.CurrentCulture)); config.Set("DisableFriendsNotifications", disablefriendsnotifications.ToString(CultureInfo.CurrentCulture)); config.Set("DisableTyping", disabletyping.ToString(CultureInfo.CurrentCulture)); config.Set("AutoAcceptFriends", autoacceptfriends.ToString(CultureInfo.CurrentCulture)); //config.Set("BroadcastID", broadcastid.ToString(CultureInfo.CurrentCulture)); config.Set("DisableRadar", disableradar.ToString(CultureInfo.CurrentCulture)); config.Set("RestrictRadar", restrictradar.ToString(CultureInfo.CurrentCulture)); config.Set("DisableVoice", disablevoice.ToString(CultureInfo.CurrentCulture)); config.Set("DisableFavs", disablefavs.ToString(CultureInfo.CurrentCulture)); config.Set("DisableHTTPinv", disablehttpinv.ToString(CultureInfo.CurrentCulture)); config.Set("DisableRadarImageMiniMap", disableradarminimap.ToString(CultureInfo.CurrentCulture)); config.Set("AppMenuPos", appmenupos.ToString(CultureInfo.CurrentCulture)); config.Set("LandMenuPos", landmenupos.ToString(CultureInfo.CurrentCulture)); config.Set("FnMenuPos", fnmenupos.ToString(CultureInfo.CurrentCulture)); config.Set("UseLLSD", usellsd.ToString(CultureInfo.CurrentCulture)); config.Set("ChatBufferLimit", chatbufferlimit.ToString(CultureInfo.CurrentCulture)); config.Set("ScriptUrlBufferLimit", scripturlbufferlimit.ToString(CultureInfo.CurrentCulture)); // Interface config = source.AddConfig("Interface"); config.Set("MainWindowState", mainWindowState.ToString(CultureInfo.CurrentCulture)); config.Set("Style", interfaceStyle.ToString(CultureInfo.CurrentCulture)); // Login config = source.AddConfig("Login"); config.Set("FirstName", firstName); config.Set("LastName", lastName); if (irempwd) { string epwd = passwordMD5; if (!string.IsNullOrEmpty(epwd)) { Crypto cryp = new Crypto(Crypto.SymmProvEnum.Rijndael); //string cpwd = cryp.Encrypting(epwd); string cpwd = cryp.Encrypt(epwd); config.Set("Password", cpwd); } } else { config.Set("Password", string.Empty); } config.Set("UserNameList", usernamelist); config.Set("Grid", loginGrid.ToString(CultureInfo.CurrentCulture)); config.Set("Uri", loginUri); config.Set("LocationType", loginLocationType.ToString(CultureInfo.CurrentCulture)); config.Set("Location", loginLocation); config.Set("iRemPWD", irempwd.ToString(CultureInfo.CurrentCulture)); // AI config = source.AddConfig("AI"); config.Set("AIon", aion.ToString(CultureInfo.CurrentCulture)); config.Set("ReplyAI", replyAI.ToString(CultureInfo.CurrentCulture)); config.Set("ReplyText", replyText); config.Set("MultiLingualAI", multilingualai.ToString(CultureInfo.CurrentCulture)); // Text config = source.AddConfig("Text"); config.Set("ChatTimestamps", chatTimestamps.ToString(CultureInfo.CurrentCulture)); config.Set("IMTimestamps", imTimestamps.ToString(CultureInfo.CurrentCulture)); config.Set("ChatSmileys", chatSmileys.ToString(CultureInfo.CurrentCulture)); config.Set("ParcelMusic", parcelmusic.ToString(CultureInfo.CurrentCulture)); config.Set("ParcelMedia", parcelmedia.ToString(CultureInfo.CurrentCulture)); config.Set("lineMax", linemax.ToString(CultureInfo.CurrentCulture)); config.Set("UseSLT", useslt.ToString(CultureInfo.CurrentCulture)); config.Set("PlaySound", playsound.ToString(CultureInfo.CurrentCulture)); config.Set("BusyReply", busyreply); config.Set("InitialIMReply", initialIMreply); config.Set("SaveIMs", saveims.ToString(CultureInfo.CurrentCulture)); config.Set("SaveChat", savechat.ToString(CultureInfo.CurrentCulture)); config.Set("LogDir", logdir); config.Set("DisableGroupNotices", disablegnotices.ToString(CultureInfo.CurrentCulture)); config.Set("DisableGroupIMs", disablegims.ToString(CultureInfo.CurrentCulture)); //// Twitter //config = source.AddConfig("Twitter"); //config.Set("TweeterName", tweetername); //config.Set("TweeterPwd", tweeterpwd); //config.Set("EnableTweeter", enabletweeter.ToString()); //config.Set("EnableChatTweets", enablechattweets.ToString()); //config.Set("Tweet", tweet.ToString()); //config.Set("TweeterUser", tweetuser); // Proxy config = source.AddConfig("Proxy"); config.Set("UseProxy", useproxy.ToString(CultureInfo.CurrentCulture)); config.Set("ProxyURL", proxyurl); config.Set("ProxyPort", proxyport); config.Set("ProxyUser", proxyuser); config.Set("ProxyPWD", proxypwd); // META3D config = source.AddConfig("META3D"); config.Set("DisableMipmaps", disablemipmaps.ToString(CultureInfo.CurrentCulture)); // Plugins Loaded config = source.AddConfig("LoadedPlugIns"); config.Set("PluginsToLoad", pluginstoload); // Plugins //added by GM on 2-JUL-2009 config = source.AddConfig("PlugIn"); //don't save if default if (groupManagerUid != "ned49b54-325d-486a-af3m") { config.Set("GroupManager", groupManagerUid); } config.Set("ChairAnnouncer", chairAnnouncerUuid.ToString()); config.Set("ChairAnnouncerInterval", chairAnnouncerInterval); config.Set("ChairAnnouncerGroup1", chairAnnouncerGroup1.ToString()); config.Set("ChairAnnouncerGroup2", chairAnnouncerGroup2.ToString()); config.Set("ChairAnnouncerGroup3", chairAnnouncerGroup3.ToString()); config.Set("ChairAnnouncerGroup4", chairAnnouncerGroup4.ToString()); config.Set("ChairAnnouncerGroup5", chairAnnouncerGroup5.ToString()); config.Set("ChairAnnouncerGroup6", chairAnnouncerGroup6.ToString()); config.Set("ChairAnnouncerEnabled", chairAnnouncerEnabled); config.Set("ChairAnnouncerChat", chairAnnouncerChat); //added by GM on 1-APR-2009 config.Set("ChairAnnouncerAdvert", chairAnnouncerAdvert); config = source.AddConfig("Spelling"); config.Set("EnableSpelling", enablespellcheck.ToString(CultureInfo.CurrentCulture)); config.Set("SpellLanguage", spelllang); FileInfo newFileInfo = new FileInfo(Path.Combine(METAbolt.DataFolder.GetDataFolder(), filename)); if (newFileInfo.Exists) { if (newFileInfo.IsReadOnly) { newFileInfo.IsReadOnly = false; } } source.Save(filename); }
private void netcom_ClientLoginStatus(object sender, LoginProgressEventArgs e) { try { switch (e.Status) { case LoginStatus.ConnectingToLogin: lblLoginStatus.Text = "Connecting to login server..."; lblLoginStatus.ForeColor = Color.Black; break; case LoginStatus.ConnectingToSim: lblLoginStatus.Text = "Connecting to region..."; lblLoginStatus.ForeColor = Color.Black; break; case LoginStatus.Redirecting: lblLoginStatus.Text = "Redirecting..."; lblLoginStatus.ForeColor = Color.Black; break; case LoginStatus.ReadingResponse: lblLoginStatus.Text = "Reading response..."; lblLoginStatus.ForeColor = Color.Black; break; case LoginStatus.Success: //SetLang(); lblLoginStatus.Text = "Logged in as " + netcom.LoginOptions.FullName; lblLoginStatus.ForeColor = Color.Blue; string uname = client.Self.Name + "\\"; Wildcard wildcard = new Wildcard(client.Self.Name + "*", System.Text.RegularExpressions.RegexOptions.IgnoreCase); List<string> torem = new List<string>(); foreach (string s in usernlist) { if(wildcard.IsMatch(s)) { torem.Add(s); } } foreach (string s in torem) { if (wildcard.IsMatch(s)) { usernlist.Remove(s); } } //string epwd1 = txtPassword.Text; if (chkPWD.Checked) { string epwd = txtPassword.Text; Crypto cryp = new Crypto(Crypto.SymmProvEnum.Rijndael); string cpwd = cryp.Encrypt(epwd); uname += cpwd; } usernlist.Add(uname); btnLogin.Text = "Exit"; btnLogin.Enabled = true; instance.ReBooted = false; timer2.Enabled = false; timer2.Stop(); try { SaveUserSettings(); string fname = client.Self.FirstName + "_" + client.Self.LastName; if (chkCmd.Checked) { // create the CMD file CreateCmdFile(); FileInfo newFileInfo = new FileInfo(Path.Combine(METAbolt.DataFolder.GetDataFolder(), fname + "_METAbolt.ini")); if (!newFileInfo.Exists) { string pth = Path.Combine(METAbolt.DataFolder.GetDataFolder(), fname + "_METAbolt.ini"); instance.Config.CurrentConfig.Save(pth); } } //instance.Config.ChangeConfigFile(fname); this.instance.ReapplyConfig(fname); if (instance.Config.CurrentConfig.AIon) { instance.InitAI(); } } catch (Exception ex) { Logger.Log("Error trying to save user settings to METAbolt.ini ", Helpers.LogLevel.Warning, ex); } //LoadWebPage(); client.Self.Movement.Camera.Far = (float)instance.Config.CurrentConfig.RadarRange; break; case LoginStatus.Failed: lblLoginStatus.Text = e.Message; Logger.Log("Login Failed: " + e.FailReason, Helpers.LogLevel.Info); lblLoginStatus.ForeColor = Color.Red; //proLogin.Visible = false; btnLogin.Text = "Retry"; btnLogin.Enabled = true; break; } } catch (Exception ex) { Logger.Log("Login (status): " + ex.Message, Helpers.LogLevel.Error); } }
private void InitializeConfig() { // Populate usernames //usernlist string ulist = instance.Config.CurrentConfig.UserNameList; if (!string.IsNullOrEmpty(ulist)) { string[] llist = ulist.Split('|'); foreach (string s in llist) { string[] llist1 = s.Split('\\'); usernlist.Add(s); //cboUserList.Items.Add(s); string epwd = string.Empty; if (llist1.Length == 2) { epwd = llist1[1]; if (!string.IsNullOrEmpty(epwd)) { try { Crypto cryp = new Crypto(Crypto.SymmProvEnum.Rijndael); string cpwd = cryp.Decrypt(epwd); epwd = cpwd; } catch { epwd = string.Empty; } } cboUserList.Items.Add(new Item(llist1[0], epwd)); } else { cboUserList.Items.Add(new Item(llist1[0], string.Empty)); } } } chkPWD.Checked = instance.Config.CurrentConfig.iRemPWD; txtFirstName.Text = instance.Config.CurrentConfig.FirstName; txtLastName.Text = instance.Config.CurrentConfig.LastName; if (instance.Config.CurrentConfig.iRemPWD) { string epwd = instance.Config.CurrentConfig.PasswordMD5; txtPassword.Text = epwd; } netcom.LoginOptions.IsPasswordMD5 = true; cbxLocation.SelectedIndex = instance.Config.CurrentConfig.LoginLocationType; cbxLocation.Text = instance.Config.CurrentConfig.LoginLocation; cbxGrid.SelectedIndex = instance.Config.CurrentConfig.LoginGrid; txtCustomLoginUri.Text = instance.Config.CurrentConfig.LoginUri; if (instance.ReBooted) { BeginLogin(); //btnLogin.PerformClick(); timer2.Enabled = true; timer2.Start(); } }
private ECDSASignature ToPositive(Crypto.ECDSASignature sig) { return new ECDSASignature(new BouncyCastle.Math.BigInteger(1, sig.R.ToByteArray()), new BouncyCastle.Math.BigInteger(1, sig.S.ToByteArray())); }
/// <summary> /// Static 생성자를 이용해서 초기화 해야할것들을 한번만 실행시키도록 함 /// 초기화과정: 에러로그, 성능카운터객체 초기화, 연결문자열처리(암호화포함) /// </summary> static SqlDbAgent() { AppSettingsReader reader = new AppSettingsReader(SECTIONNAME_SQLDBAGENT); reader.RaiseException = false; reader = new AppSettingsReader(SECTIONNAME_SQLDBAGENT); Crypto crypto = new Crypto(); _errorLog = new ErrorLog("SqlDbAgent", "SMFramework", reader[KEYNAME_LOG_FILE_PATH]); try { // 퍼포먼스 카운터 객체가 존재하는지 검사하고 존재하지 않으면 생성한다. // 별도의 셋업프로그램이 필요하지 않게 하기 위한 부분이다. if (PerformanceCounterCategory.Exists("SqlDbAgent") == false) { CounterCreationData[] creationDataArray = { new CounterCreationData("Fill","", PerformanceCounterType.NumberOfItems32), new CounterCreationData("ExecuteNonQuery","", PerformanceCounterType.NumberOfItems32), new CounterCreationData("ExecuteReader","", PerformanceCounterType.NumberOfItems32), new CounterCreationData("ExecuteScalar","", PerformanceCounterType.NumberOfItems32), new CounterCreationData("Update","", PerformanceCounterType.NumberOfItems32), new CounterCreationData("ExecuteXmlReader","", PerformanceCounterType.NumberOfItems32) }; CounterCreationDataCollection collection = new CounterCreationDataCollection(creationDataArray); PerformanceCounterCategoryType categoryType = new PerformanceCounterCategoryType(); PerformanceCounterCategory.Create("SqlDbAgent", "", categoryType, collection); } _encConnStringYn = reader[KEYNAME_ENCCONNSTRINGYN]; _staticConnectionString = reader[KEYNAME_CONNECTIONSTRING]; _staticCommandTimeout = reader[KEYNAME_COMMANDTIMEOUT, 30]; _keyFileResourceName = reader[KEYNAME_KEYFILERESOURCENAME,string.Empty]; reader = new AppSettingsReader(SECTIONNAME_CONNECTIONSTRINGS); _connectionStrings = reader.KeyValues; //암호화된 연결문자열을 복호화함 if (_encConnStringYn != string.Empty) { if (_encConnStringYn == "true") { _staticConnectionString = crypto.Decrypt(_staticConnectionString); } } else { throw new Exception("연결문자열 암호화여부의 설정값을 얻을수 없습니다."); } _counter = new PerformanceCounter(); _counter.CategoryName = "SqlDbAgent"; _counter.ReadOnly = false; } catch( Exception ex ) { _errorLog.WriteExceptionLog(ex, "SqlDbAgent\t:"); throw ex; } }
public static void doUserAndPassword() { string droneshareusername = Settings.Instance["droneshareusername"]; InputBox.Show("Username", "Username", ref droneshareusername); Settings.Instance["droneshareusername"] = droneshareusername; string dronesharepassword = Settings.Instance["dronesharepassword"]; if (dronesharepassword != "") { try { // fail on bad entry var crypto = new Crypto(); dronesharepassword = crypto.DecryptString(dronesharepassword); } catch { } } InputBox.Show("Password", "Password", ref dronesharepassword, true); var crypto2 = new Crypto(); string encryptedpw = crypto2.EncryptString(dronesharepassword); Settings.Instance["dronesharepassword"] = encryptedpw; }