//-------------------------- private async void TokenObj_Timer_Tick(object sender, EventArgs e) { //----------------- ((Timer)sender).Enabled = false; ((Timer)sender).Dispose(); //----------------- StrongString myString = string.Empty; #pragma warning disable IDE0059 SecuredMe Hi = new SecuredMe(ref myString); #pragma warning restore IDE0059 //MessageBox.Show(myString); var ExistingFiles = await ThereIsServer.Actions.GetAllContentsByRef(ThereIsServer.ServersInfo.MyServers[0], Username + ThereIsServer.ServersInfo.EndCheckingFileName); if (ExistingFiles.IsDeadCallBack || ThereIsServer.ServerSettings.HasConnectionClosed) { NoInternetConnectionSandBox.PrepareConnectionClosedSandBox(); return; // don't set ServerSettings.IsWaitingForServerChecking = false; } await ThereIsServer.Actions.UpdateFile(ThereIsServer.ServersInfo.MyServers[0], Username + ThereIsServer.ServersInfo.EndCheckingFileName, new DataBaseUpdateRequest("SAO", QString.Parse(myString), ExistingFiles.Sha)); ThereIsServer.ServerSettings.TokenObj = myString; ((CreateProfileSandBox)ThereIsConstants.Forming.TheMainForm.ShowingSandBox).IsSignInEnded4 = true; //----------------- GC.Collect(); }
//------------------------------------------------- #region static mathods region //These methods are server and online working //so you should use await keyword for them. public static async Task <DataBaseDataChangedInfo> CreateKingdomThrone(KingdomInfo kingdomInfo) { var _notSet = new StrongString[] { ThereIsConstants.Path.NotSet, // 0 ThereIsConstants.Path.NotSet, // 1 ThereIsConstants.Path.NotSet, // 2 ThereIsConstants.Path.NotSet, // 3 ThereIsConstants.Path.NotSet, // 4 ThereIsConstants.Path.NotSet, // 5 ThereIsConstants.Path.NotSet, // 6 }; KingdomThrone kingdomThrone = new KingdomThrone() { PlayerNames = _notSet, PlayerUIDs = UID.GenerateNullUIDs(MAXIMUM_POSITION), }; //--------------------------------------------- var _s = ThereIsServer.ServersInfo.ServerManager.Get_Kingdom_Server(kingdomInfo.Provider); var _target = KingdomThrone_LOC; var _req = new DataBaseCreation(MESSAGE, QString.Parse(kingdomThrone.GetForServer())); return(await ThereIsServer.Actions.CreateData(_s, _target, _req)); //--------------------------------------------- }
//------------------------------------------------- #region Get Method's Region protected StrongString PlayerGetForServer() { StrongString myString = CharSeparater + CastleLvl.ToString() + CharSeparater; return(myString); }
public static string Record(string msg) { if (!IsOpen()) { return("未开启!"); } string host = StrongString.GetRight(msg.Replace(" ", ""), "查询备案"); if (!IsDomain(host)) { return("查询失败,不是域名!"); } byte[] data = HttpWebClient.Post("http://whois.chinaz.com/ylz1.cn", Encoding.UTF8.GetBytes($"DomainName={host}&ws=&isforceupdate=")); string str = Encoding.UTF8.GetString(data); string regTrade = StrongString.Between(str, "注册商</div><div class=\"fr WhLeList-right\"><div class=\"block ball\"><span>", "</span>"); if (str.Contains("未被注册或被隐藏") || str.Contains("站长工具暂不支持") || regTrade.Length > 200) { return("该域名未被注册或被隐藏!"); } //string contact = StrongString.Between(str, "联系人</div><div class=\"fr WhLeList-right block ball lh24\"><span>", "</span>"); //string email = StrongString.Between(str, "联系邮箱</div><div class=\"fr WhLeList-right block ball lh24\"><span>", "</span>"); string createDate = StrongString.Between(str, "创建时间</div><div class=\"fr WhLeList-right\"><span>", "</span>"); string deadline = StrongString.Between(str, "过期时间</div><div class=\"fr WhLeList-right\"><span>", "</span>"); string state = StrongString.Between(str, "状态</div><div class=\"fr WhLeList-right clearfix\"><p class=\"lh30 pr tip-sh\"><span>", "("); string dns = StrongString.Between(str, "DNS</div><div class=\"fr WhLeList-right\">", "</div>").Replace("<br/>", "、"); //return $"域名:{host}\n注册商:{regTrade}\n联系人:{contact}\n联系邮箱:{email}\n创建时间:{createDate}\n到期时间:{deadline}\n状态:{state}\ndns:{dns}"; return($"域名:{host}\n注册商:{regTrade}\n创建时间:{createDate}\n到期时间:{deadline}\n状态:{state}\ndns:{dns}"); }
public static Avatar ConvertToAvatar(StrongString theString) { try { switch (theString[true].ToUpper()[BASE_INDEX]) { case OrdinaryFirst: return(ConvertToAvatar(ConvertToAvatars(theString))); case SpecialFirst: return(ConvertToAvatar(ConvertToAvatars_S(theString))); case TheNPCFirst: return(ConvertToAvatar(ConvertToAvatars_N(theString))); default: return(GetDefaultAvatar()); } } catch { // if there was any error, get the default avatar for the player. return(GetDefaultAvatar()); } }
public static void Completed(StrongString theText) { StrongString[] myString = theText.Split(ServerConfig.CharSeparator); ServerConfig config = new ServerConfig( (ServerStatus)myString[0].ToInt32(), GameVersion.ParseToVersion(myString[1]), myString[2], myString[3]); if (config.ServerStatus == ServerStatus.Online) { Forming.TheMainForm.IsServerOnline = true; if (config.LastVersion == GameVersion.ParseToVersion(AppSettings.AppVersion)) { Forming.TheMainForm.IsTheLastVer = true; } else { Forming.TheMainForm.IsTheLastVer = false; } } else if (config.ServerStatus == ServerStatus.Breaking) { Forming.TheMainForm.IsServerOnBreak = true; } else if (config.ServerStatus == ServerStatus.Updating) { Forming.TheMainForm.IsServerUpdating = true; Forming.TheMainForm.ReleasingDate = config.AccessDate.GetStrong(); } Forming.TheMainForm.IsCheckingForUpdateEnded = true; Forming.TheMainForm.IsCheckingForUpdate = false; }
//------------------------------------------------ //--------------------------------------- /// <summary> /// This function will create the Security data in /// location <see cref="endFileName"/> /// at the server. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void CreatingTheProfileSecurityWorker(object sender, EventArgs e) { ((Timer)sender).Enabled = false; ((Timer)sender).Dispose(); //MessageBox.Show("I am"); var targetFile = _username + endFileName; StrongString myString = _username + charSeparater + _password + charSeparater + _token + charSeparater; await ThereIsServer.Actions.CreateFile(ThereIsServer.ServersInfo.MyServers[0], targetFile, new DataBaseCreation("Testing for Creating", QString.Parse(myString))); Father.IsSecuredMeWorkingOver = true; if (!Directory.Exists(ThereIsConstants.Path.Profile_Folder_Path)) { Directory.CreateDirectory(ThereIsConstants.Path.Profile_Folder_Path); } ProfileInfo myInfo = new ProfileInfo(_username.GetValue(), _token.GetValue(), ThereIsConstants.AppSettings.GlobalTiming.GetForServer().GetValue()); ProfileInfo.UpdateInfo(myInfo, ThereIsConstants.Path.ProfileInfo_File_Path); AccountInfo myAccInfo = new AccountInfo(1, ThereIsConstants.AppSettings.GlobalTiming.GetForServer().GetValue()); AccountInfo.UpdateInfo(myAccInfo, ThereIsConstants.Path.AccountInfo_File_Path); GC.Collect(); }
//------------------------------------------------- #region Get Method's Region public StrongString GetForServer() { StrongString myString = Resources.GetForServer() + OutCharSeparator; return(myString); }
//------------------------------------------------- #region protected Methods Region protected virtual StrongString GetForServer() { StrongString myString = Resources.GetForServer() + OutCharSeparator; return(myString); }
private async void SendLabelControl_Click(object sender, System.EventArgs e) { if (!this.InputControl.ChatBoxControl.Enabled || this.InputControl.ChatBoxControl.Text.Length == 0) { return; } StrongString str = this.InputControl.ChatBoxControl.Text; // make sure that the context of the message, has more than 2 chars. // if the chatbox control is not enabled, then it means this channel // is not available yet, so you should not send the message. if (this.InputControl.ChatBoxControl.Text.Length < MINIMUM_LENGTH) { str = str.Append(INSIDER, MINIMUM_LENGTH - this.InputControl.ChatBoxControl.Text.Length + 1); } this.InputControl.SendLabelControl.Enabled = false; this.InputControl.ChatBoxControl.Clear(); await this.ChatBackgroundLabel.SendMessage(str); this.InputControl.SendLabelControl.Enabled = true; this.InputControl.SendLabelControl.HasMouseClickedOnce = false; }
public void Remove(StrongString playerName) { if (Exist(playerName)) { Names.Remove(playerName); } }
private static Hero Parse(StrongString theString) { StrongString[] myStrings = theString.Split(InCharSeparator); Hero myHero = new Hero( myStrings[0], // custom name myStrings[1], // hero ID myStrings[2].ToUInt16(), // level Unit.ConvertToUnit(myStrings[3]), // Power Unit.ConvertToUnit(myStrings[4]), // Skill Point myStrings[5].ToUInt16(), // Stars myStrings[6] // This is HeroSkill String value, // do NOT convert it here. ) { HP = Unit.ConvertToUnit(myStrings[7]), // HP ATK = Unit.ConvertToUnit(myStrings[8]), // ATK INT = Unit.ConvertToUnit(myStrings[9]), // INT DEF = Unit.ConvertToUnit(myStrings[10]), // DEF RES = Unit.ConvertToUnit(myStrings[11]), // RES SPD = Unit.ConvertToUnit(myStrings[12]), // SPD PEN = Unit.ConvertToUnit(myStrings[13]), // PEN Block = Unit.ConvertToUnit(myStrings[14]), // Block HeroCurrentExp = Unit.ConvertToUnit(myStrings[15]), // Exp ServerIndex = myStrings[16].ToInt32(), // Server Index }; return(myHero); }
//------------------------------------------------- #region static Method's Region public static async Task <bool> GenerateFirstGeneration() { IServerProvider <QString, DataBaseClient> _s; StrongString _target = ServerManager.Generation_Location_Name; StrongString myString; DataBaseCreation _req; int first_index; for (int i = MIN_SERVER_INDEX; i <= MAX_SERVER_INDEX; i++) { _s = ThereIsServer.ServersInfo.ServerManager.Get_UID_Generation_Server(i); if (!await ThereIsServer.Actions.Exists(_s, _target)) { first_index = i + BASE_UID_SERVER_INDEX_SHOW; myString = first_index.ToString(INDEX_FORMAT) + FIRST_GENERATION; _req = new DataBaseCreation(UID_MESSAGE, QString.Parse(myString)); await ThereIsServer.Actions.CreateData(_s, _target, _req); } else { continue; } } return(true); }
/// <summary> /// load UID by username. /// use this for signin. /// </summary> /// <param name="_username_"></param> /// <param name="_socket_"></param> /// <returns></returns> public static async Task <UID> LoadUID(StrongString _username_) { //--------------------------------------------- var _s = ThereIsServer.ServersInfo.ServerManager.Get_UID_Server(_username_); var _target = _username_ + USERNAME_TO_UID; var existing = await ThereIsServer.Actions.GetAllContentsByRef(_s, _target); //--------------------------------------------- if (existing.DoesNotExist) { return(GenerateNullUID()); } if (existing.IsDeadCallBack || ThereIsServer.ServerSettings.HasConnectionClosed) { NoInternetConnectionSandBox.PrepareConnectionClosedSandBox(); return(null); } var _uid_string = existing.Decode(); var _index = _uid_string.Substring(START_INDEX, LENGTH_INDEX).ToInt32() - BASE_UID_SERVER_INDEX_SHOW; //------------------------- _s = ThereIsServer.ServersInfo.ServerManager.Get_UID_Server(_index); _target = _uid_string + UID_Lcation_Name; existing = await ThereIsServer.Actions.GetAllContentsByRef(_s, _target); if (existing.IsDeadCallBack || ThereIsServer.ServerSettings.HasConnectionClosed) { NoInternetConnectionSandBox.PrepareConnectionClosedSandBox(); return(null); } return(Parse(existing.Decode())); }
//------------------------------------------------- #region Ordinary Method's Region private void SetParams(StrongString serverValue) { StrongString[] myStrings = serverValue.Split(CharSeparatpr); KingdomName = myStrings[0]; // 1 KingsPower = Unit.ConvertToUnit(myStrings[1]); // 2 KingdomLevel = myStrings[2].ToUInt16(); // 3 }
//------------------------------------------------- #region Contructors Region public DataBaseUpdateRequest(StrongString theMessage, StrongString theContext, StrongString theSha) : base(theMessage.GetValue(), QString.Parse(theContext).GetString(), theSha.GetValue()) { // do nothing here... }
//----------------------------------------------------------- #region Setting Methods Region // These Methods are offline, so you should update the player info // after using these method, they will only change the // Properties. private void SetParams(StrongString serverValue) { StrongString[] myStrings = serverValue.Split(CharSeparater); StoryStep = (StorySteps)myStrings[0].ToUInt16(); // 0 AvatarFrameList = AvatarFrameList.Parse(myStrings[1]); // 1 AvatarList = AvatarList.Parse(myStrings[2]); // 2 MyBlockList = ChatBlockList.Parse(myStrings[3]); // 3 }
//----------------------------------- //----------------------------------- //----------------------------------- //----------------------------------- public static Archer ParseToArcher(StrongString theString) { StrongString[] myStrings = theString.Split(InCharSeparator); Archer myArcher = new Archer(Unit.ConvertToUnit(myStrings[0]), myStrings[1].ToUInt16(), Unit.ConvertToUnit(myStrings[2])); return(myArcher); }
//----------------------------------- //----------------------------------- //----------------------------------- public static Assassin ParseToAssassin(StrongString theString) { StrongString[] myStrings = theString.Split(InCharSeparator); Assassin myAssassin = new Assassin(Unit.ConvertToUnit(myStrings[0]), myStrings[1].ToUInt16(), Unit.ConvertToUnit(myStrings[2])); return(myAssassin); }
/// <summary> /// use this for link start. /// </summary> /// <param name="_uid_value"></param> /// <returns></returns> public static UID GetUID(StrongString _uid_value) { if (_uid_value == NULL_UID) { return(new UID()); } return(new UID(_uid_value)); }
//------------------------------------------------- #region Constructor's Region /// <summary> /// create a new instance of the UID, /// which is for creating mode. /// in fact, you can create a new UID with this constructor. /// </summary> /// <param name="_index_"></param> /// <param name="_value_"></param> /// <param name="_socket_"></param> /// <param name="_username_"></param> private UID(int _index_, ulong _value_, IPlayerSocket _socket_, IStringProvider <StrongString> _username_) { _uid_server_index_ = _index_; _value = _value_.ToString(); TheSocket = _socket_; PlayerUserName = _username_.GetStrong(); IsLoaded = true; }
//------------------------------------------------- #region Constructor's Region /// <summary> /// this class should Serialize in /// <see cref="Constants.ThereIsConstants.Path.ServerConfiguration_File_Name"/> and /// this file should download from the Server in the start of Game. /// </summary> /// <param name="theCurrentStatusValue"></param> /// <param name="theLastVersionValue"></param> /// <param name="updateInfoPathValue"></param> public ServerConfig(ServerStatus theCurrentStatusValue, GameVersion theLastVersionValue, StrongString updateInfoPathValue, StrongString accessDateValue) { ServerStatus = theCurrentStatusValue; LastVersion = theLastVersionValue; UpdateInfoPath = updateInfoPathValue; AccessDate = accessDateValue; }
//-------------------------------------------------- public UpdatingServerSandBox(GameControls.PageControl theCurrentForm, ref StrongString releaseDate) : base(theCurrentForm) { Mode = SandBoxMode.UpdatingServerMode; ClosedForRetry = false; ReleaseDate = releaseDate.GetValue(); InitializeComponent(); }
//----------------------------------- //----------------------------------- //----------------------------------- public static MagicalTroop ParseToMagicalTroop(StrongString theString) { StrongString[] myStrings = theString.Split(InCharSeparator); MagicalTroop myMagicalTroop = new MagicalTroop(Unit.ConvertToUnit(myStrings[0]), myStrings[1].ToUInt16(), Unit.ConvertToUnit(myStrings[2])); return(myMagicalTroop); }
//------------------------------------------------- #region static Methods Region /// <summary> /// Parse the string value to Troops in the following order: /// <see cref="Saber"/>, <see cref="Archer"/>, <see cref="Lancer"/>, <see cref="Assassin"/> /// </summary> /// <param name="theString"></param> /// <returns></returns> public static PlayerResources ParseToPlayerResources(StrongString theString) { StrongString[] myStrings = theString.Split(OutCharSeparator); PlayerResources playerResources = new PlayerResources(Resources.ParseToResources(myStrings[0])); return(playerResources); }
public static ChatBlockList Parse(StrongString serverStringValue) { ChatBlockList blockList; StrongString[] myStrings = serverStringValue.Split(CharSeparator); blockList = new ChatBlockList(myStrings); return(blockList); }
//----------------------------------- public StrongString GetForServer() { StrongString myString = Count.GetForServer() + InCharSeparator + Level.ToString() + InCharSeparator + Power.GetForServer() + InCharSeparator; return(myString); }
public static StrongString GetForServer(MagicalTroop troops) { StrongString myString = troops.Count.GetForServer() + InCharSeparator + troops.Level.ToString() + InCharSeparator + troops.Power.GetForServer() + InCharSeparator; return(myString); }
//----------------------------------- protected virtual StrongString GetForServer() { StrongString myString = Count.GetForServer() + InCharSeparator + Level.ToString() + InCharSeparator + Power.GetForServer() + InCharSeparator; return(myString); }
private MessageList ParseToMessages(StrongString serverValue) { StrongString[] myStrings = serverValue.Split(CharSeparator); ChatMessage[] messages = new ChatMessage[myStrings.Length]; for (int i = 0; i < messages.Length; i++) { messages[i] = ChatMessage.ParseExact(myStrings[i]); } return(new MessageList(messages)); }