Esempio n. 1
0
        private void StartItem_Click(object sender, EventArgs e)
        {
            if (Directory.Exists(ThereIsConstants.Path.Profile_Folder_Path) &&
                File.Exists(ThereIsConstants.Path.ProfileInfo_File_Path))
            {
                ProfileInfo          myInfo   = ProfileInfo.FromFile(ThereIsConstants.Path.ProfileInfo_File_Path);
                CreateProfileSandBox myCreate = new CreateProfileSandBox(this, myInfo, true);
                this.IsShowingSandBox = true;
                this.ShowingSandBox   = myCreate;
                myCreate.Show();
                this.Enabled      = false;
                myCreate.Location = new Point((this.Width / 2) - (myCreate.Width / 2),
                                              (this.Height / 2) - (myCreate.Height / 2));
                myCreate.FormClosed += CreateNewProfileSandBox_FormClosed;
            }
            else
            {
                this.IsShowingSandBox = true;
                this.ShowingSandBox   = new CreateProfileSandBox(this);
                this.ShowingSandBox.Show();
                this.Enabled = false;
                this.ShowingSandBox.Location = new Point((this.Width / 2) -
                                                         (ShowingSandBox.Width / 2),
                                                         (this.Height / 2) - (ShowingSandBox.Height / 2));
                this.ShowingSandBox.FormClosed += CreateNewProfileSandBox_FormClosed;
            }

            this.StartItem.HasMouseClickedOnce = false;
        }
Esempio n. 2
0
        //--------------------------
        /// <summary>
        /// Checking for Existance, setting the <see cref="CreateProfileSandBox.DoesPlayerExists"/>
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void CheckingForExistingUserTimer_Tick(object sender, EventArgs e)
        {
            ((Timer)sender).Enabled = false;
            ((Timer)sender).Dispose();
            var targetFile = Username + ThereIsServer.ServersInfo.EndCheckingFileName;

            HasAccExist =
                await ThereIsServer.Actions.DeleteFile(ThereIsServer.ServersInfo.MyServers[0], targetFile,
                                                       new DataBaseDeleteRequest("DeletedForCheckingBySAO", "NoSHA"));

            if (ThereIsServer.ServerSettings.HasConnectionClosed)
            {
                NoInternetConnectionSandBox.PrepareConnectionClosedSandBox();
                return;
            }
            if (HasAccExist)
            {
                if (ThereIsConstants.Forming.TheMainForm.IsShowingSandBox)
                {
                    CreateProfileSandBox mySand =
                        (CreateProfileSandBox)ThereIsConstants.Forming.TheMainForm.ShowingSandBox;
                    mySand.IsCheckingForExistingEnded = true;
                    mySand.DoesPlayerExists           = true;
                }
                return;
            }
            else
            {
                if (ThereIsConstants.Forming.TheMainForm.IsShowingSandBox)
                {
                    CreateProfileSandBox mySand =
                        (CreateProfileSandBox)ThereIsConstants.Forming.TheMainForm.ShowingSandBox;
                    mySand.IsCheckingForExistingEnded = true;
                    mySand.DoesPlayerExists           = false;
                }
            }

            /*
             *
             * try
             * {
             *  await ThereIsServer.ServersInfo.Server1.ServerClient.
             *      Repository.Content.DeleteFile(ThereIsServer.ServersInfo.Server1.Owner,
             *      ThereIsServer.ServersInfo.Server1.Repo, targetFile,
             *      new DeleteFileRequest("DeletedForCheckingBySAO", "NoSHA"));
             *  await ThereIsServer.ServersInfo.Server1.ServerClient.
             *      Repository.Content.CreateFile(ThereIsServer.ServersInfo.Server1.Owner,
             *      ThereIsServer.ServersInfo.Server1.Repo, targetFile,
             *      new CreateFileRequest("ReCreatedBySAO", "SAO"));
             *  HasAccExist = true;
             *
             *  if (ThereIsConstants.Forming.TheMainForm.IsShowingSandBox)
             *  {
             *      CreateProfileSandBox mySand =
             *          (CreateProfileSandBox)ThereIsConstants.Forming.TheMainForm.ShowingSandBox;
             *      mySand.IsCheckingForExistingEnded = true;
             *      mySand.DoesPlayerExists = true;
             *  }
             *  return;
             * }
             * catch(NotFoundException)
             * {
             *
             *  HasAccExist = false;
             *  if (ThereIsConstants.Forming.TheMainForm.IsShowingSandBox)
             *  {
             *      CreateProfileSandBox mySand =
             *          (CreateProfileSandBox)ThereIsConstants.Forming.TheMainForm.ShowingSandBox;
             *      mySand.IsCheckingForExistingEnded = true;
             *      mySand.DoesPlayerExists = false;
             *  }
             * }
             * catch(ApiException)
             * {
             *  HasAccExist = true;
             *  if (ThereIsConstants.Forming.TheMainForm.IsShowingSandBox)
             *  {
             *      CreateProfileSandBox mySand =
             *          (CreateProfileSandBox)ThereIsConstants.Forming.TheMainForm.ShowingSandBox;
             *      mySand.IsCheckingForExistingEnded = true;
             *      mySand.DoesPlayerExists = true;
             *  }
             *  return;
             * }
             */
        }