Inheritance: MonoBehaviour
Example #1
0
        public static UserResult From(UserData item, ISessionAwareCoreService client)
        {
            var result = new UserResult
            {
                Description = TextEntry.From(item.Description, Resources.LabelDescription)
            };

            if (item.IsEnabled == false)
            {
                result.Status = TextEntry.From(Resources.Disabled, Resources.LabelStatus);
            }
            if (item.Privileges == 1)
            {
                result.IsAdministrator = TextEntry.From(Resources.Yes, Resources.LabelIsAdministrator);
            }
            if (item.LanguageId != null)
            {
                result.Language = TextEntry.From(GetLanguageById(item.LanguageId.Value, client), Resources.LabelLanguage);
            }
            if (item.LocaleId != null)
            {
                result.Locale = TextEntry.From(GetLocaleById(item.LocaleId.Value), Resources.LabelLocale);
            }
            if (item.GroupMemberships != null)
            {
                result.GroupMemberships = TextEntry.From(GetGroupMembershipSummary(item.GroupMemberships), Resources.LabelGroupMemberships);
            }

            AddCommonProperties(item, result);
            return result;
        }
		internal AvatarEffectsInventoryComponent(uint UserId, GameClient Client, UserData Data)
		{
			this.UserId = UserId;
			this.Session = Client;
			this.Effects = new List<AvatarEffect>();
			foreach (AvatarEffect current in Data.effects)
			{
				if (!current.HasExpired)
				{
					this.Effects.Add(current);
				}
				else
				{
					using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
					{
						queryreactor.runFastQuery(string.Concat(new object[]
						{
							"DELETE FROM user_effects WHERE user_id = ",
							UserId,
							" AND effect_id = ",
							current.EffectId,
							"; "
						}));
					}
				}
			}
		}
        public async Task<HttpResponseMessage> Post(int campaignId, [FromBody]string jsonUserData)
        {
            dynamic rawUserData = JsonConvert.DeserializeObject(jsonUserData);

            var userData = new UserData() { Name = rawUserData.Name, 
                Phone = rawUserData.Phone, 
                Birthday = rawUserData.Birthday, 
                Email = rawUserData.Email, 
                CreationDate = DateTimeOffset.Now };

            LogExtensions.Log.DebugCall(() => userData);

            var campaign = context.Campaigns.Include("OnShareConversionTriggers").FirstOrDefault(x => x.ID == campaignId);
            if (campaign == null)
                throw new ArgumentException("No campaign was found with an ID: " + campaignId);

            var landingUser = context.LandingUsers.FirstOrDefault(user => user.Phone == userData.Phone || (user.Email == userData.Email && user.Phone == null));
            if (landingUser == null)
            {
                landingUser = context.LandingUsers.Add(userData);
            }
            else
            {
                landingUser.Phone = string.IsNullOrWhiteSpace(userData.Phone) ? landingUser.Phone : userData.Phone;
                landingUser.Email = string.IsNullOrWhiteSpace(userData.Email) ? landingUser.Email : userData.Email;
                landingUser.Birthday = (userData.Birthday == null) ? landingUser.Birthday : userData.Birthday;
            }
            
            context.SaveChanges();

            await TriggerCampaignTriggersAsync(campaign, landingUser, rawUserData);

            return Request.CreateResponse(HttpStatusCode.OK);
        }
Example #4
0
        public new UserData getObject()
        {
            XmlSerializer serializer = new XmlSerializer(typeof(UserData));
            FileStream fs = new FileStream(xmlFile, FileMode.Open);
            UserData udata = new UserData("名称未設定",
                "",
                2000,
                1,
                1,
                12,
                0,
                0,
                35.685175,
                139.7528,
                "東京都中央区",
                "",
                "JST");
            try
            {
                udata = (UserData)serializer.Deserialize(fs);
            } catch (Exception e)
            {
                MessageBox.Show("ファイルの読み込みで異常が発生しました。");
                Console.WriteLine(e.Message);
            }
            fs.Close();

            return udata;
        }
        // 決定ボタン
        private void submitBtn_Click(object sender, EventArgs e)
        {
            UserData udata = new UserData(nameBox.Text,
                furiganaBox.Text,
                birthDate.Value.Year,
                birthDate.Value.Month,
                birthDate.Value.Day,
                int.Parse(hourBox.Text),
                int.Parse(minuteBox.Text),
                int.Parse(secondBox.Text),
                double.Parse(latBox.Text),
                double.Parse(lngBox.Text),
                placeBox.Text,
                memoBox.Text,
                Common.getTimezoneShortText(timezoneBox.SelectedIndex));

            udata.userevent = this.udata.userevent;
            if (File.Exists(this.filename))
            {
                File.Delete(this.filename);
            }

            XmlSerializer serializer = new XmlSerializer(typeof(UserData));
            FileStream fs = new FileStream(this.filename, FileMode.Create);
            StreamWriter sw = new StreamWriter(fs);
            serializer.Serialize(sw, udata);
            sw.Close();
            fs.Close();

            databaseform.eventListViewRender(udata, this.filename);

            this.Close();
        }
Example #6
0
 //saving data.......................................................................................
 void CreateData()
 {
     UserData user = new UserData();
     user.q_id = "Start Page";
     //user.time1 = Mathf.RoundToInt(Time.timeSinceLevelLoad);
     saveData.createData(user);
 }
        private void btnCreate_Click(object sender, RoutedEventArgs e)
        {
            if (txtAppId.Text.IsNullOrEmpty())
            {
                MessageBox.Show("Application Id не может быть пустым");
                return;
            }

            using (ConfigurationManager man = new ConfigurationManager())
            {
                UserData data = new UserData();
                data.UserName = txtUserName.Text;
                data.Password = txtUserPassword.Text;
                data.Email = txtEmail.Text;

                data.AppId = long.Parse(txtAppId.Text);
                data.AccessKey = txtAccessKey.Text;
                if (man.CreateUser(data))
                    MessageBox.Show("Пользователь успешено создан", "Информация", MessageBoxButton.OK,
                         MessageBoxImage.Information);

                else
                    MessageBox.Show("Ошибка создания пользователя", "Информация", MessageBoxButton.OK,
                         MessageBoxImage.Error);
            }
            Refresh();
        }
        public string DeleteGroup(string id, UserData userData)
        {
            try
            {
                client = new HttpClient();
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                client.DefaultRequestHeaders.Add("Timestamp", userData.Timestamp.ToString());
                client.DefaultRequestHeaders.Add("Digest", userData.AuthenticationHash);
                client.DefaultRequestHeaders.Add("Public-Key", userData.PublicKey);

                client.DeleteAsync("http://localhost:3000/contact/" + id)
                    .ContinueWith(deleteTask =>
                    {
                        deleteTask.Result.EnsureSuccessStatusCode();
                        var result = deleteTask.Result.Content.ReadAsStringAsync();
                        client.Dispose();
                        return result;

                    });

            }
            catch (Exception ex)
            {
                throw ex;

            }
            return null;
        }
Example #9
0
 public User(UserData d, UserEvent e, string filename, int index)
 {
     udata = d;
     uevent = e;
     this.filename = filename;
     this.index = index;
 }
    //post data to server after connecting
    IEnumerator PostData(UserData user)
    {
        playerData = JsonMapper.ToJson(user);
        //Debug.Log(data);
        //This connects to a server side php script that will write the data
        string jdata = postDataURL + sid + "/response";
        //Debug.Log("Posting response at link:" + jdata);
        //Post the URL to the site and create a download object to get the result.
        Dictionary<string,string> headers=new Dictionary<string,string>();
        headers.Add("Content-Type", "application/json");
        byte[] pData= Encoding.ASCII.GetBytes(playerData.ToCharArray());
        WWW data_post = new WWW(jdata, pData, headers);
        //Debug.Log(jdata);
        yield return data_post; // Wait until the download is done

        //Debug.Log(data_post);

        if (data_post.error != null)
        {
            print("There was an error saving data: " + data_post.error);
            Debug.Log("internet connection error");
            //postSuccess[callNumber] = false;
        }
        else
        {
            Debug.Log("Data posted succesfully");
            tempDataList.Remove(user.q_id);
            tempDataList.Remove(user.q_res);
            //postSuccess[callNumber] = true;
            dataPosted = true;
        }
    }
		internal InventoryComponent(uint UserId, GameClient Client, UserData UserData)
		{
			this.mClient = Client;
			this.UserId = UserId;
			this.floorItems = new HybridDictionary();
			this.wallItems = new HybridDictionary();
			this.discs = new HybridDictionary();
			foreach (UserItem current in UserData.inventory)
			{
				if (current.GetBaseItem().InteractionType == InteractionType.musicdisc)
				{
					this.discs.Add(current.Id, current);
				}
				if (current.isWallItem)
				{
					this.wallItems.Add(current.Id, current);
				}
				else
				{
					this.floorItems.Add(current.Id, current);
				}
			}
			this.InventoryPets = new SafeDictionary<uint, Pet>(UserData.pets);
			this.InventoryBots = new SafeDictionary<uint, RoomBot>(UserData.Botinv);
			this.mAddedItems = new HybridDictionary();
			this.mRemovedItems = new HybridDictionary();
			this.isUpdated = false;
		}
Example #12
0
        private void PupulateTreeView(UserData userData)
        {
            TreeNode tn = treeViewUser.Nodes.Add("Name","Name:" + userData.Name);
            tn.Nodes.Add("ID", userData.ID.ToString());

            if (userData.Albums.Length == 0)
            {
                return;
            }
            TreeNode albumsTn = tn.Nodes.Add("Albums");
            foreach (var albumData in userData.Albums)
            {
                TreeNode singleAlbumTn = albumsTn.Nodes.Add("Name","Name:"+albumData.Name);
                singleAlbumTn.Nodes.Add("ID", "ID:"+albumData.ID.ToString());
                if (albumData.Images.Length == 0)
                {
                    continue;
                }
                TreeNode imagesTn = singleAlbumTn.Nodes.Add("Images");
                foreach (var imageData in albumData.Images)
                {
                    TreeNode singleImageTn = imagesTn.Nodes.Add("ID", "ID:"+imageData.ID.ToString());
                    singleImageTn.Nodes.Add("Width", "Width:" + imageData.Width.ToString());
                    singleImageTn.Nodes.Add("Height", "Height:" + imageData.Height.ToString());
                    singleImageTn.Nodes.Add("URL", "URL:" + imageData.URL.ToString());
                }
            }
        }
        public string CreateTag(Tag model, UserData userData)
        {
            try
            {
                client = new HttpClient();
                var postData = new List<KeyValuePair<string, string>>();
                postData.Add(new KeyValuePair<string, string>("name", model.name));

                HttpContent content = new FormUrlEncodedContent(postData);
                content.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded");
                content.Headers.Add("Timestamp", userData.Timestamp.ToString());
                content.Headers.Add("Digest", userData.AuthenticationHash);
                content.Headers.Add("Public-Key", userData.PublicKey);

                client.PostAsync("http://localhost:3000/tag", content)
                    .ContinueWith(postTask =>
                    {
                        postTask.Result.EnsureSuccessStatusCode();
                        var result = postTask.Result.Content.ReadAsStringAsync();
                        client.Dispose();
                        return result;

                    });

            }
            catch (Exception ex)
            {
                throw ex;

            }
            return null;
        }
    /**************************************************
     * Server Data Services
     **************************************************/
    public void CreateUser(UserData data)
    {
        // TODO: Refactor string MySql queries
        var query = "INSERT INTO User (UID, Username, Email, Password, DateCreated)" +
                    "VALUES('" + data.UID + "', '" + data.UserName + "','" +
                        data.Email + "','" + data.Password + "', Date('" + data.DateCreated.Date.ToString("yyyy-MM-dd HH:mm:ss") + "'))";

        using (_mySqlConnection = new MySqlConnection(_mySqlConnectionService.ConnectionString()))
        {
            using (var command = new MySqlCommand(query, _mySqlConnection))
            {
                try
                {
                    _mySqlConnection.Open();
                    command.ExecuteNonQuery();
                    _mySqlConnection.Close();
                    Console.print("Created User Successfully");
                }
                catch (SqlException e)
                {
                    throw new Exception(e.ToString());
                }

            }
        }
    }
        /// <summary>
        /// 処理
        /// </summary>
        /// <param name="part"></param>
        public static void OnUpdate( SpritePart part, AttributeBase attribute )
        {
            bool hasInt = attribute.@bool( 0 );
            bool hasPoint = attribute.@bool( 1 );
            bool hasRect = attribute.@bool( 2 );
            bool hasString = attribute.@bool( 3 );

            Vector2 point = Vector2.zero;
            Rect rect = new Rect();

            int index = 0;

            if ( hasPoint ) {
                point = new Vector2( attribute.@float( 0 ), attribute.@float( 1 ) );
                index = 2;
            }
            if ( hasRect ) {
                rect = new Rect(
                        attribute.@float( index + 0 ),
                        attribute.@float( index + 1 ),
                        attribute.@float( index + 2 ),
                        attribute.@float( index + 3 ) );
            }

            var data = new UserData() {
                integer = attribute.@int( 0 ),
                text = hasString ? attribute.@string( 0 ) : null,
                point = point,
                rect = rect,
            };
            part.Root.NotifyUserData( part, data );
        }
    //Load Function called from start of scene to Initialise level/ game
    public void Autoload()
    {
        _FileName="Autosave.xml";
        // Load our UserData into myData
        QuickLoadXML();
        if(_data.ToString() != "")
        {
            // notice how I use a reference to type (UserData) here, you need this
            // so that the returned object is converted into the correct type
            myData = (UserData)DeserializeObject(_data);

            //Load the save position
            savePosition = new Vector3(myData._iUser.x,myData._iUser.y,myData._iUser.z);

            //Load the Time
            saveTime = myData._iUser.time;

            //Load the Date
            saveDate = myData._iUser.date;

            //Load the Play Time
            savePlayTime = myData._iUser.playTime;

            //Load Level Name
            saveLevelName = myData._iUser.levelName;

            //Load Latest Time
            saveLatestTime = myData._iUser.latestTime;

            // just a way to show that we loaded in ok
            //Debug.Log(myData._iUser.x);
        }
    }
Example #17
0
 public void SaveUserData(UserData products)
 {
     using (var stream = File.Create(FileName))
     {
         products.Serialize(stream);
     }
 }
 public List<int> getUsersAndProfesors(int year)
 {
     List<int> results;
     UserData userData = new UserData();
     results = userData.GetUsersAndProfesors(year);
     return results;
 }
 public ConferenceCreateRequest(
     ConferenceName conferenceName,
     Password convenerPassword,
     Password password,
     Asn1Boolean lockedConference,
     Asn1Boolean listedConference,
     Asn1Boolean conductibleConference,
     TerminationMethod terminationMethod,
     Asn1SetOf<Privilege> conductorPrivileges,
     Asn1SetOf<Privilege> conductedPrivileges,
     Asn1SetOf<Privilege> nonConductedPrivileges,
     TextString conferenceDescription,
     TextString callerIdentifier,
     UserData userData)
 {
     this.conferenceName = conferenceName;
     this.convenerPassword = convenerPassword;
     this.password = password;
     this.lockedConference = lockedConference;
     this.listedConference = listedConference;
     this.conductibleConference = conductibleConference;
     this.terminationMethod = terminationMethod;
     this.conductorPrivileges = conductorPrivileges;
     this.conductedPrivileges = conductedPrivileges;
     this.nonConductedPrivileges = nonConductedPrivileges;
     this.conferenceDescription = conferenceDescription;
     this.callerIdentifier = callerIdentifier;
     this.userData = userData;
 }
 public UserDataEditForm(DatabaseForm databaseform, UserData udata, string filename)
 {
     InitializeComponent();
     this.databaseform = databaseform;
     this.udata = udata;
     this.filename = filename;
 }
Example #21
0
    public static UserData ConvertFrom(UserInfo userInfo)
    {
        var data = new UserData();
        data.ID = userInfo.ID;
        data.ScreenName = userInfo.ScreenName;
        data.Name = userInfo.Name;
        data.DefineAs = userInfo.DefineAs;
        data.Province = userInfo.Province;
        data.City = userInfo.City;
        data.Location = userInfo.Location;
        data.Description = userInfo.Description;
        data.Url = userInfo.Url;
        data.ProfileImageUrl = userInfo.ProfileImageUrl;
        data.Domain = userInfo.Domain;
        data.Gender = userInfo.Gender;
        data.FollowersCount = userInfo.FollowersCount;
        data.FriendsCount = userInfo.FriendsCount;
        data.StatusesCount = userInfo.StatusesCount;
        data.FavouritesCount = userInfo.FavouritesCount;
        data.CreatedAt = userInfo.CreatedAt;
        data.GeoEnabled = userInfo.GeoEnabled;
        data.AllowAllActMsg = userInfo.AllowAllActMsg;
        data.Following = userInfo.Following;
        data.Verified = userInfo.Verified;

        if (null != userInfo.LatestStatus)
            data.LatestStatus = ConvertFrom(userInfo.LatestStatus);

        return data;
    }
        public ActionResult Create(Contact model)
        {
            int id = WebSecurity.GetUserId(WebSecurity.CurrentUserName);
            var userProfile = _userContext.UserProfiles.First(x => x.UserId == id);

            if (string.IsNullOrWhiteSpace(userProfile.PrivateKey) || string.IsNullOrWhiteSpace(userProfile.PublicKey))
            {
                TempData["Notification"] = new Notification("Please provide access keys that have been sent you by email", Nature.warning);
                return RedirectToAction("Account", "Settings");
            }

            if (ModelState.IsValid)
            {
                UserData userData = new UserData();
                userData.PublicKey = userProfile.PublicKey;
                userData.Timestamp = DateTime.Now;
                userData.GenerateAuthenticationHash(userProfile.PrivateKey + userProfile.PublicKey + "POST/contact"+ userData.Timestamp + userProfile.PrivateKey);

                ContactEndpoint c = new ContactEndpoint();
                string message = c.CreateContact(model, userData);

                TempData["Notification"] = new Notification("Contact has been added" + message, Nature.success);
                Thread.Sleep(2500);
                return RedirectToAction("Index");

            } else
            {
                return View(model);
            }
        }
 //creating data and calling the saveData...............................................
 void CreateData(Text name)
 {
     UserData user = new UserData();
     user.q_id = LoadingJson.jsonQuestions["fields"][ChangingScenes.fieldNo]["cid"].ToString();
     user.q_res = name.text;
     //user.time1 = Mathf.RoundToInt(Time.timeSinceLevelLoad);
     saveData.createData(user);
 }
Example #24
0
        /// <summary>
        /// Initializes a new instance of the <see cref="User" /> class.
        /// </summary>
        /// <param name="client"><see cref="T:TcmCoreService.Client" /></param>
        /// <param name="userData"><see cref="T:Tridion.ContentManager.CoreService.Client.UserData" /></param>
        protected User(Client client, UserData userData)
            : base(client, userData)
        {
            if (userData == null)
                throw new ArgumentNullException("userData");

            mUserData = userData;
        }
Example #25
0
 public bool DeleteUserByID(UserData user)
 {
     var userdata=(MongoUserData)user;
     var db=Config.GetDB();
     var u=db.GetCollection<MongoUserData>("users");
     u.Remove(Query.EQ("_id",userdata.ID));
     return true;
 }
 //saving data.......................................................................................
 void CreateData()
 {
     UserData user = new UserData();
     user.q_id = LoadingJson.jsonQuestions["fields"][ChangingScenes.fieldNo]["cid"].ToString();
     user.q_res = "a_" + UseMeVariables.forTotalOptions;
     //Debug.Log(user.q_res);
     //user.time1 = Mathf.RoundToInt(Time.timeSinceLevelLoad);
 }
 //creating data and calling the saveData...............................................
 void CreateData()
 {
     UserData user = new UserData();
     user.q_id = LoadingJson.jsonQuestions["fields"][ChangingScenes.fieldNo]["cid"].ToString();
     user.q_res = "I enjoyed this survey";
     //user.time2 = Mathf.RoundToInt(Time.timeSinceLevelLoad);
     saveData.createData(user);
 }
 public User GetUser(User fromUser)
 {
     UserData userData = new UserData();
     VehicleBusiness vehicleBusiness = new VehicleBusiness();
     User userLoaded = userData.GetUser(fromUser);
     userLoaded.ListOfVehicles = vehicleBusiness.LoadListOfVehicles(userLoaded);
     return userLoaded;
 }
 public UserEventEditForm(DatabaseForm databaseform, UserData udata, int index, string filename)
 {
     InitializeComponent();
     this.databaseform = databaseform;
     this.udata = udata;
     this.index = index;
     this.filename = filename;
 }
Example #30
0
 public Authenticator(string username, string encodedPassword, NetClient connection, UserData userData)
 {
     _username = username;
     _userInfo = userData;
     _encodedPassword = encodedPassword;
     _connection = connection;
     _connection.LoginReply += new NetClient.LoginResponse(LoginResponse);
 }
        internal AppdeploymentStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
        {
            #region Application hosting resources

            var vpc = new Vpc(this, "appVpc", new VpcProps
            {
                MaxAzs = 3
            });

            var image = new LookupMachineImage(new LookupMachineImageProps
            {
                // maps to "Amazon Linux 2 with .NET Core 3.0 and Mono 5.18"
                Name   = "amzn2-ami-hvm-2.0.*-x86_64-gp2-mono-*",
                Owners = new [] { "amazon" }
            });

            var userData = UserData.ForLinux();
            userData.AddCommands(new string[]
            {
                "sudo yum install -y httpd",
                "sudo systemctl start httpd",
                "sudo systemctl enable httpd"
            });

            var scalingGroup = new AutoScalingGroup(this, "appASG", new AutoScalingGroupProps
            {
                Vpc              = vpc,
                InstanceType     = InstanceType.Of(InstanceClass.BURSTABLE3, InstanceSize.MEDIUM),
                MachineImage     = image,
                MinCapacity      = 1,
                MaxCapacity      = 4,
                AllowAllOutbound = true,
                UserData         = userData
            });

            var alb = new ApplicationLoadBalancer(this, "appLB", new ApplicationLoadBalancerProps
            {
                Vpc            = vpc,
                InternetFacing = true
            });

            var albListener = alb.AddListener("Port80Listener", new BaseApplicationListenerProps
            {
                Port = 80
            });

            albListener.AddTargets("Port80ListenerTargets", new AddApplicationTargetsProps
            {
                Port    = 80,
                Targets = new [] { scalingGroup }
            });

            albListener.Connections.AllowDefaultPortFromAnyIpv4("Open access to port 80");

            scalingGroup.ScaleOnRequestCount("ScaleOnModestLoad", new RequestCountScalingProps
            {
                TargetRequestsPerSecond = 1
            });

            #endregion

            #region CI/CD resources

            var _sourceOutput = new Artifact_("Source");
            var _buildOutput  = new Artifact_("Build");

            var build = new PipelineProject(this, "CodeBuild", new PipelineProjectProps
            {
                // relative path to sample app's file (single html page for now)
                BuildSpec   = BuildSpec.FromSourceFilename("talk-demos/appdeployment/SimplePage/buildspec.yml"),
                Environment = new BuildEnvironment
                {
                    BuildImage = LinuxBuildImage.AMAZON_LINUX_2_2
                },
            });

            var appDeployment = new ServerApplication(this, "appDeployment");
            // we will use CodeDeploy's default one-at-a-time deployment mode as we are
            // not specifying a deployment config
            var deploymentGroup = new ServerDeploymentGroup(this, "appDeploymentGroup", new ServerDeploymentGroupProps
            {
                Application  = appDeployment,
                InstallAgent = true,
                AutoRollback = new AutoRollbackConfig
                {
                    FailedDeployment = true
                },
                AutoScalingGroups = new [] { scalingGroup }
            });

            // SecretValue.SsmSecure is not currently supported for setting OauthToken,
            // and haven't gotten the SecretsManager approach to work either so
            // resorting to keeping my token in an environment var for now!
            var oauthToken = SecretValue.PlainText(System.Environment.GetEnvironmentVariable("GitHubPersonalToken"));

            var pipeline = new Pipeline(this, "sampleappPipeline", new PipelineProps
            {
                Stages = new StageProps[]
                {
                    new StageProps
                    {
                        StageName = "Source",
                        Actions   = new IAction[]
                        {
                            new GitHubSourceAction(new GitHubSourceActionProps
                            {
                                ActionName = "GitHubSource",
                                Branch     = "master",
                                Repo       = this.Node.TryGetContext("repo-name").ToString(),
                                Owner      = this.Node.TryGetContext("repo-owner").ToString(),
                                OauthToken = oauthToken,
                                Output     = _sourceOutput
                            })
                        }
                    },

                    new StageProps
                    {
                        StageName = "Build",
                        Actions   = new IAction[]
                        {
                            new CodeBuildAction(new CodeBuildActionProps
                            {
                                ActionName = "Build-app",
                                Project    = build,
                                Input      = _sourceOutput,
                                Outputs    = new Artifact_[] { _buildOutput },
                                RunOrder   = 1
                            })
                        }
                    },

                    new StageProps
                    {
                        StageName = "Deploy",
                        Actions   = new IAction[]
                        {
                            new CodeDeployServerDeployAction(new CodeDeployServerDeployActionProps
                            {
                                ActionName      = "Deploy-app",
                                Input           = _buildOutput,
                                RunOrder        = 2,
                                DeploymentGroup = deploymentGroup
                            })
                        }
                    }
                }
            });

            #endregion
        }
Example #32
0
        public ActionResult CreateUser(UserData objuser)
        {
            try
            {
                if (objuser.UserId == null)
                {
                    MembershipUser newUser = Membership.CreateUser(objuser.name, objuser.Password);
                    if (newUser != null)
                    {
                        newUser.IsApproved = objuser.IsApproved;
                        newUser.Email      = objuser.Email;
                        Membership.UpdateUser(newUser);
                        Roles.AddUserToRoles(newUser.UserName, objuser.Roles);
                        TempData["Message"] = "User Created";
                        return(RedirectToAction("Index", "ManageUser"));
                    }
                }
                else
                {
                    Guid           newid = new Guid(objuser.UserId);
                    MembershipUser u     = Membership.GetUser(newid);
                    if (u != null)
                    {
                        //u.Email=objuser.Email ;
                        //Membership.UpdateUser(u);
                        //u.IsApproved= objuser.IsApproved;
                        //Membership.UpdateUser(u);
                        var rolessaved = Roles.GetRolesForUser(u.UserName);
                        if (!string.IsNullOrEmpty(objuser.Password))
                        {
                            u.ChangePassword(u.ResetPassword(), objuser.Password);
                        }

                        if (rolessaved.Count() > 0)
                        {
                            Roles.RemoveUserFromRoles(u.UserName, rolessaved);
                        }
                        Roles.AddUserToRoles(u.UserName, objuser.Roles);
                        var checkusername = context.aspnet_Users.Where(x => x.UserName == objuser.name && x.UserId != newid).Count();
                        var userdetails   = context.aspnet_Membership.Where(x => x.UserId == newid).FirstOrDefault();
                        if (userdetails != null)
                        {
                            userdetails.Email       = objuser.Email;
                            userdetails.IsApproved  = objuser.IsApproved;
                            userdetails.IsLockedOut = objuser.IsLockedOut;
                            userdetails.FailedPasswordAttemptCount = 0;
                            context.SaveChanges();
                        }
                        if (checkusername == 0)
                        {
                            var usernamedata = context.aspnet_Users.Where(x => x.UserId == newid).FirstOrDefault();
                            usernamedata.UserName = objuser.name;
                            context.SaveChanges();
                            TempData["Message"] = "User Updated";
                            return(RedirectToAction("Index", "ManageUser"));
                        }
                        else
                        {
                            TempData["Message"] = "Username already exist";
                        }
                    }
                    else
                    {
                        TempData["Message"] = "Username not exist";
                    }
                }
            }
            catch (MembershipCreateUserException e)
            {
                cm.ErrorExceptionLogingByService(e.ToString(), "ManageUser" + ":" + new StackTrace().GetFrame(0).GetMethod().Name, "CreateUser", "NA", "NA", "NA", "WEB");
                var msg = GetErrorMessage(e.StatusCode);
                TempData["Message"] = msg;
            }
            return(RedirectToAction("SaveUser", new { UserId = objuser.UserId }));
        }
Example #33
0
 public ChemicalBalanceMessage(UserData ud, IAgriConfigurationRepository sd)
 {
     _ud = ud;
     _sd = sd;
 }
Example #34
0
 public bool AddUserSkills(UserData model)
 {
     return(this.userRepository.AddUserSkills(model));
 }
 /// <summary>
 /// Creates an enum value from a ulong
 /// </summary>
 private DynValue CreateValueUnsigned(ulong value)
 {
     CreateUnsignedConversionFunctions();
     return(UserData.Create(m_ULongToEnum(value), this));
 }
Example #36
0
 public ClientData()
 {
     UserData User = new UserData();
 }
Example #37
0
    //编辑游戏结束Canvas中的排行版
    void EditGameOverCanvas()
    {
        //根据当前玩家的姓名、得分、所用时间生成新的用户数据
        currentUserData        = new UserData(PlayerPrefs.GetString("Username") + " 0 " + currentScore.ToString() + " " + currentTime.ToString("0.00"));
        currentUserData.isUser = true;                          //该标识表示该数据是否为当前玩家数据
        //将当前玩家以及第一至第三名玩家的信息保存在userDataArray数组里
        userDataArray [0] = currentUserData;
        int arrayLength = 1;

        if (firstUserData.order != "0")
        {
            userDataArray [arrayLength++] = firstUserData;
        }
        if (secondUserData.order != "0")
        {
            userDataArray [arrayLength++] = secondUserData;
        }
        if (thirdUserData.order != "0")
        {
            userDataArray [arrayLength++] = thirdUserData;
        }

        //排序函数
        mySort(arrayLength);
        //排序完毕后重新设置用户的名词
        foreach (UserData i in userDataArray)
        {
            if (i.isUser == true)
            {
                currentUserData = i;
                break;
            }
        }
        //若玩家进入前三名,则显示相应的游戏信息
        switch (currentUserData.order)
        {
        case "1":
            gameMessage.text = "恭喜你荣登慕课英雄榜榜首!";
            break;

        case "2":
            gameMessage.text = "恭喜你荣登慕课英雄榜榜眼!";
            break;

        case "3":
            gameMessage.text = "恭喜你荣登慕课英雄榜探花!";
            break;

        default:
            gameMessage.text = "";
            break;
        }

        //将更新后的排名信息显示在排行榜上
        Text[] texts;
        if (arrayLength > 0)
        {
            PlayerPrefs.SetString("FirstUser", userDataArray [0].DataToString());
            texts = firstUserText.GetComponentsInChildren <Text> ();
            LeaderBoardChange(texts, userDataArray [0]);
            arrayLength--;
        }
        if (arrayLength > 0)
        {
            PlayerPrefs.SetString("SecondUser", userDataArray [1].DataToString());
            texts = secondUserText.GetComponentsInChildren <Text> ();
            LeaderBoardChange(texts, userDataArray [1]);
            arrayLength--;
        }
        if (arrayLength > 0)
        {
            PlayerPrefs.SetString("ThirdUser", userDataArray [2].DataToString());
            texts = thirdUserText.GetComponentsInChildren <Text> ();
            LeaderBoardChange(texts, userDataArray [2]);
            arrayLength--;
        }

        //如果玩家未进入前三名,则显示玩家信息,并将显示玩家信息的Text内容加粗
        if (currentUserData.order != "1" && currentUserData.order != "2" && currentUserData.order != "3")
        {
            texts = userText.GetComponentsInChildren <Text> ();
            LeaderBoardChange(texts, currentUserData);
        }
        else
        {
            userText.SetActive(false);                  //若玩家进入前三名,则不显示玩家信息,直接在前三名显示当前玩家的成绩
        }
    }
Example #38
0
        public static DynValue open(ScriptExecutionContext executionContext, CallbackArguments args)
        {
            string   filename  = args.AsType(0, "open", DataType.String, false).String;
            DynValue vmode     = args.AsType(1, "open", DataType.String, true);
            DynValue vencoding = args.AsType(2, "open", DataType.String, true);

            string mode = vmode.IsNil() ? "r" : vmode.String;

            string invalidChars = mode.Replace("+", "")
                                  .Replace("r", "")
                                  .Replace("a", "")
                                  .Replace("w", "")
                                  .Replace("b", "")
                                  .Replace("t", "");

            if (invalidChars.Length > 0)
            {
                throw ScriptRuntimeException.BadArgument(1, "open", "invalid mode");
            }


            try
            {
                string encoding = vencoding.IsNil() ? null : vencoding.String;

                // list of codes: http://msdn.microsoft.com/en-us/library/vstudio/system.text.encoding%28v=vs.90%29.aspx.
                // In addition, "binary" is available.
                Encoding e        = null;
                bool     isBinary = Framework.Do.StringContainsChar(mode, 'b');

                if (encoding == "binary")
                {
                    isBinary = true;
                    e        = new BinaryEncoding();
                }
                else if (encoding == null)
                {
                    if (!isBinary)
                    {
                        e = GetUTF8Encoding();
                    }
                    else
                    {
                        e = new BinaryEncoding();
                    }
                }
                else
                {
                    if (isBinary)
                    {
                        throw new ScriptRuntimeException("Can't specify encodings other than nil or 'binary' for binary streams.");
                    }

                    e = Encoding.GetEncoding(encoding);
                }

                return(UserData.Create(Open(executionContext, filename, e, mode)));
            }
            catch (Exception ex)
            {
                return(DynValue.NewTuple(DynValue.Nil,
                                         DynValue.NewString(IoExceptionToLuaMessage(ex, filename))));
            }
        }
Example #39
0
        /// <summary>
        /// event to delete the selected record
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void Delete_btn_Click(object sender, EventArgs e)
        {
            int selectedrowindex = ProcessWork_dgv.SelectedCells[0].RowIndex;

            DataGridViewRow selectedRow = ProcessWork_dgv.Rows[selectedrowindex];

            messageData = new MessageData("mmcc00004", Properties.Resources.mmcc00004, selectedRow.Cells["colProcessWorkCode"].Value.ToString());
            // Logger.Info(messageData);
            DialogResult dialogResult = popUpMessage.ConfirmationOkCancel(messageData, Text);

            if (dialogResult == DialogResult.OK)
            {
                ProcessWorkVo inVo = new ProcessWorkVo
                {
                    ProcessWorkId        = Convert.ToInt32(selectedRow.Cells["colProcessWorkId"].Value),
                    RegistrationDateTime = Convert.ToDateTime(DateTime.Now.ToString(UserData.GetUserData().DateTimeFormat)),
                    RegistrationUserCode = UserData.GetUserData().UserCode,
                };

                inVo.ProcessWorkCode = selectedRow.Cells["colProcessWorkCode"].Value.ToString();
                try
                {
                    ProcessWorkVo outCountVo = CheckProcessWorkRelation(inVo);

                    if (outCountVo != null)
                    {
                        StringBuilder message = new StringBuilder();

                        if (outCountVo.DefectiveIdCount > 0)
                        {
                            message.Append(ProcessWorkRelationTables.ProcessWorkDefectiveReason);
                        }
                        if (outCountVo.ItemProcessWorkIdCount > 0)
                        {
                            if (message.Length > 0)
                            {
                                message.Append("  And  ");
                            }

                            message.Append(ProcessWorkRelationTables.ItemProcessWork);
                        }
                        if (outCountVo.ProcessSupplierIdCount > 0)
                        {
                            if (message.Length > 0)
                            {
                                message.Append("  And  ");
                            }

                            message.Append(ProcessWorkRelationTables.ProcessWorkSupplier);
                        }
                        if (message.Length > 0)
                        {
                            messageData = new MessageData("mmce00007", Properties.Resources.mmce00007, message.ToString());
                            popUpMessage.Information(messageData, Text);
                            return;
                        }
                    }
                    ProcessWorkVo outVo = (ProcessWorkVo)base.InvokeCbm(new DeleteProcessWorkMasterMntCbm(), inVo, false);

                    if (outVo.AffectedCount > 0)
                    {
                        messageData = new MessageData("mmci00003", Properties.Resources.mmci00003, null);
                        logger.Info(messageData);
                        popUpMessage.Information(messageData, Text);

                        GridBind(FormConditionVo());
                    }
                    else if (outVo.AffectedCount == 0)
                    {
                        messageData = new MessageData("mmci00007", Properties.Resources.mmci00007, null);
                        logger.Info(messageData);
                        popUpMessage.Information(messageData, Text);
                        GridBind(FormConditionVo());
                    }
                }
                catch (Framework.ApplicationException exception)
                {
                    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                    logger.Error(exception.GetMessageData());
                }
            }
            else if (dialogResult == DialogResult.Cancel)
            {
                //do something else
            }
        }
Example #40
0
        internal static void SetDefaultFile(Script script, StandardFileType file, FileUserDataBase fileHandle)
        {
            Table R = script.Registry;

            R.Set("853BEAAF298648839E2C99D005E1DF94_" + file.ToString(), UserData.Create(fileHandle));
        }
Example #41
0
 private static string GetFileName(string dir, string prefix, int index)
 {
     return(UserData.Create(dir) + prefix + index.ToString("D7") + ".png");
 }
Example #42
0
        public void LoadUserData(UserData_v4 sUser, Program program, UserData user, string projectFilePath)
        {
            if (sUser == null)
            {
                return;
            }
            user.OnLoadedScript = sUser.OnLoadedScript;
            if (sUser.Processor != null)
            {
                user.Processor = sUser.Processor.Name;
                if (program.Architecture == null && !string.IsNullOrEmpty(user.Processor))
                {
                    program.Architecture = Services.RequireService <IConfigurationService>().GetArchitecture(user.Processor !) !;
                }
                //$BUG: what if architecture isn't supported? fail the whole thing?
                program.Architecture !.LoadUserOptions(XmlOptions.LoadIntoDictionary(sUser.Processor.Options, StringComparer.OrdinalIgnoreCase));
            }
            if (sUser.PlatformOptions != null)
            {
                user.Environment = sUser.PlatformOptions.Name;
                program.Platform.LoadUserOptions(XmlOptions.LoadIntoDictionary(sUser.PlatformOptions.Options, StringComparer.OrdinalIgnoreCase));
            }
            if (sUser.Procedures != null)
            {
                user.Procedures = sUser.Procedures
                                  .Select(sup => LoadUserProcedure_v1(program, sup))
                                  .Where(kv => !(kv.Key is null))
                                  .ToSortedList(kv => kv.Key, kv => kv.Value);
                user.ProcedureSourceFiles = user.Procedures
                                            .Where(kv => !string.IsNullOrEmpty(kv.Value.OutputFile))
                                            .ToDictionary(kv => kv.Key !, kv => ConvertToAbsolutePath(projectFilePath, kv.Value.OutputFile) !);
            }
            if (sUser.GlobalData != null)
            {
                user.Globals = sUser.GlobalData
                               .Select(sud =>
                {
                    program.Architecture.TryParseAddress(sud.Address, out Address addr);
                    return(new KeyValuePair <Address, GlobalDataItem_v2>(
                               addr,
                               sud));
                })
                               .Where(kv => !(kv.Key is null))
                               .ToSortedList(kv => kv.Key, kv => kv.Value);
            }

            if (sUser.Annotations != null)
            {
                user.Annotations = new AnnotationList(sUser.Annotations
                                                      .Select(LoadAnnotation)
                                                      .Where(a => !(a.Address is null))
                                                      .ToList());
            }
            if (sUser.Heuristics != null)
            {
                user.Heuristics.UnionWith(sUser.Heuristics
                                          .Where(h => !(h.Name is null))
                                          .Select(h => h.Name !));
            }
            if (sUser.TextEncoding != null)
            {
                Encoding enc = null;
                try
                {
                    enc = Encoding.GetEncoding(sUser.TextEncoding);
                }
                catch
                {
                    listener.Warn(
                        "Unknown text encoding '{0}'. Defaulting to platform text encoding.",
                        sUser.TextEncoding);
                }
                user.TextEncoding = enc;
            }
            program.EnvironmentMetadata = project.LoadedMetadata;
            if (sUser.Calls != null)
            {
                program.User.Calls = sUser.Calls
                                     .Select(c => LoadUserCall(c, program))
                                     .Where(c => c != null && !(c.Address is null))
                                     .ToSortedList(k => k !.Address !, v => v !);
            }
            if (sUser.RegisterValues != null)
            {
                program.User.RegisterValues = LoadRegisterValues(sUser.RegisterValues);
            }
            if (sUser.JumpTables != null)
            {
                program.User.JumpTables = sUser.JumpTables.Select(LoadJumpTable_v4)
                                          .Where(t => t != null && t.Address != null)
                                          .ToSortedList(k => k !.Address, v => v);
            }
            if (sUser.IndirectJumps != null)
            {
                program.User.IndirectJumps = sUser.IndirectJumps
                                             .Select(ij => LoadIndirectJump_v4(ij, program))
                                             .Where(ij => ij.Item1 != null)
                                             .ToSortedList(k => k !.Item1, v => v !.Item2);
            }
            if (sUser.Segments != null)
            {
                program.User.Segments = sUser.Segments
                                        .Select(s => LoadUserSegment_v4(s))
                                        .Where(s => s != null)
                                        .ToList();
            }
            program.User.ShowAddressesInDisassembly = sUser.ShowAddressesInDisassembly;
            program.User.ShowBytesInDisassembly     = sUser.ShowBytesInDisassembly;
            program.User.ExtractResources           = sUser.ExtractResources;
            // Backwards compatibility: older versions used single file policy.
            program.User.OutputFilePolicy        = sUser.OutputFilePolicy ?? Program.SingleFilePolicy;
            program.User.AggressiveBranchRemoval = sUser.AggressiveBranchRemoval;
        }
        protected void Application_AcquireRequestState(object sender, EventArgs e)
        {
            System.Web.SessionState.HttpSessionState Session = System.Web.HttpContext.Current.Session;
            HttpRequest Request = System.Web.HttpContext.Current.Request;

            string[] host = Request.Url.Host.Split('.');
            if (Session != null && Session.IsNewSession && (host[0].ToLower() == "demo" || host[0].ToLower() == "freecases"))
            {
                // temporarily saving user agent strings, gotta catch that google bot.
                var userAgentString = Request.UserAgent;

                /*  using (StreamWriter sw = new StreamWriter(Server.MapPath("~/Logs/ua.txt"), true))
                 * {
                 *    sw.WriteLine(userAgentString);
                 * }*/
                // end of temp saving

                UserData ud = UserMng.Login("sysdemo", ConfigurationManager.AppSettings["DEMO_USER_PASS"], false, Request.UserHostAddress);
                if (ud != null)
                {
                    if (ud.SessionId > 0)
                    {
                        Session["UserData"] = ud;
                        Session.Timeout     = ud.SessionTimeout; // minutes

                        var productsList = UserMng.GetProductsList(ud.UserId);
                        Session["ProductsList"] = productsList;

                        var selectedProductCookie = Request.Cookies["SelectedProductId"];
                        int selectedProductId     = 1;

                        if (ud.Products.Where(p => p.IsActive.HasValue && p.IsActive == true).ToList().Count == 1)
                        {
                            selectedProductId = ud.Products.FirstOrDefault().ProductId;
                            var newCookie = new HttpCookie("SelectedProductId");
                            newCookie.Value = selectedProductId.ToString();

                            Response.SetCookie(newCookie);
                        }
                        else
                        {
                            if (selectedProductCookie != null && selectedProductCookie.Value != null && selectedProductCookie.Value.ToString() != "")
                            {
                                selectedProductId = int.Parse(selectedProductCookie.Value.ToString());
                            }
                        }
                        Session["SelectedProductId"] = selectedProductId;
                    }
                }
            }


            if (Session != null)
            {
                if (Request.Cookies["sitelang"] != null)
                {
                    Language currentLang = InterfaceLanguages.GetLanguageByCode(Request.Cookies["sitelang"].Value);
                    if (!currentLang.IsInterfaceLang) // some bad cookie
                    {
                        currentLang = null;
                    }
                    if (currentLang != null) // check if cookie contains valid language code, mmmmmm cookieeee (Cookie monster was here)
                    {
                        Session["LanguageId"] = currentLang.Id;
                    }
                }

                if (Session["LanguageId"] == null)
                {
                    Language preferedLang = null;
                    string   languageCode;

                    if (Request.UserLanguages != null)
                    {
                        foreach (var headerLang in Request.UserLanguages)
                        {
                            languageCode = headerLang.Split(';')[0];

                            if (languageCode.Length == 2)
                            {
                                preferedLang = InterfaceLanguages.GetLanguageByShortCode(languageCode);
                            }
                            else
                            {
                                preferedLang = InterfaceLanguages.GetLanguageByCode(languageCode);
                            }

                            if (preferedLang != null && !preferedLang.IsInterfaceLang)
                            {
                                preferedLang = null;
                            }

                            if (preferedLang != null)
                            {
                                break;
                            }
                        }
                    }

                    if (preferedLang == null)
                    {
                        preferedLang = InterfaceLanguages.GetLanguageById(Convert.ToInt32(ConfigurationManager.AppSettings["DefaultLanguageId"]));
                    }

                    Session["LanguageId"] = preferedLang.Id;

                    //HttpCookie cultureCookie = new HttpCookie("sitelang", defaultLang.Code);
                    //cultureCookie.Expires = DateTime.Now.AddYears(1);
                    //Response.Cookies.Add(cultureCookie);
                }

                string      code = InterfaceLanguages.GetLanguageById(Convert.ToInt32(Session["LanguageId"])).Code;
                CultureInfo ci   = new CultureInfo(code);
                System.Threading.Thread.CurrentThread.CurrentCulture   = ci;
                System.Threading.Thread.CurrentThread.CurrentUICulture = ci;

                if (Request.Cookies["SelectedProductId"] != null)
                {
                    Session["SelectedProductId"] = Request.Cookies["SelectedProductId"].Value.ToString();
                }

                if (Session["SelectedProductId"] == null)
                {
                    Session["SelectedProductId"] = 1;
                }

                // Refreshing language to english in T&FSt if previously another not primary language has been selected. Sry for this. Blame it on the financists.
                if (Convert.ToInt32(Session["SelectedProductId"]) == 2 &&
                    Convert.ToInt32(Session["LanguageId"]) > 4 &&
                    Session["UserData"] != null &&
                    ((Session["UserData"] as UserData).ClientId != 1 || (Session["UserData"] as UserData).Username.ToUpper() == "SYSDEMO")) // Apis Europe client ignore
                {
                    Session["LanguageId"] = 4;                                                                                              // english
                    var newLangCookie = new HttpCookie("sitelang");
                    newLangCookie.Value = "en-GB";
                    newLangCookie.Expires.AddYears(365);
                    Response.SetCookie(newLangCookie);
                }
            }
        }
Example #44
0
        public void ProcessRequest(HttpContext context)
        {
            #region "Initialize"

            var strOut = "** No Action **";

            var paramCmd       = Utils.RequestQueryStringParam(context, "cmd");
            var itemId         = Utils.RequestQueryStringParam(context, "itemid");
            var ctlType        = Utils.RequestQueryStringParam(context, "ctltype");
            var idXref         = Utils.RequestQueryStringParam(context, "idxref");
            var xpathpdf       = Utils.RequestQueryStringParam(context, "pdf");
            var xpathref       = Utils.RequestQueryStringParam(context, "pdfref");
            var lang           = Utils.RequestQueryStringParam(context, "lang");
            var language       = Utils.RequestQueryStringParam(context, "language");
            var moduleId       = Utils.RequestQueryStringParam(context, "mid");
            var moduleKey      = Utils.RequestQueryStringParam(context, "mkey");
            var parentid       = Utils.RequestQueryStringParam(context, "parentid");
            var entryid        = Utils.RequestQueryStringParam(context, "entryid");
            var entryxid       = Utils.RequestQueryStringParam(context, "entryxid");
            var catid          = Utils.RequestQueryStringParam(context, "catid");
            var catxid         = Utils.RequestQueryStringParam(context, "catxid");
            var templatePrefix = Utils.RequestQueryStringParam(context, "tprefix");
            var value          = Utils.RequestQueryStringParam(context, "value");
            var itemListName   = Utils.RequestQueryStringParam(context, "listname");
            if (itemListName == "")
            {
                itemListName = "ItemList";
            }
            if (itemListName == "*")
            {
                itemListName = "ItemList";
            }

            #region "setup language"

            // because we are using a webservice the system current thread culture might not be set correctly,
            NBrightBuyUtils.SetContextLangauge(context);
            var ajaxInfo = NBrightBuyUtils.GetAjaxFields(context);
            _editlang = NBrightBuyUtils.GetEditLang(ajaxInfo, Utils.GetCurrentCulture());

            #endregion

            Logging.Debug($"XmlConnector called with: paramCmd='{paramCmd}', itemId='{itemId}', itemListName='{itemListName}'");

            #endregion

            try
            {
                #region "Do processing of command"

                if (paramCmd.StartsWith("client."))
                {
                    strOut = ClientFunctions.ProcessCommand(paramCmd, context);
                }
                else if (paramCmd.StartsWith("orderadmin_"))
                {
                    strOut = OrderFunctions.ProcessCommand(paramCmd, context);
                }
                else if (paramCmd.StartsWith("payment_"))
                {
                    strOut = PaymentFunctions.ProcessCommand(paramCmd, context);
                }
                else if (paramCmd.StartsWith("product_"))
                {
                    ProductFunctions.EntityTypeCode = "PRD";
                    strOut = ProductFunctions.ProcessCommand(paramCmd, context, _editlang);
                }
                else if (paramCmd.StartsWith("category_"))
                {
                    CategoryFunctions.EntityTypeCode = "CATEGORY";
                    strOut = CategoryFunctions.ProcessCommand(paramCmd, context, _editlang);
                }
                else if (paramCmd.StartsWith("property_"))
                {
                    PropertyFunctions.EntityTypeCode = "CATEGORY";
                    strOut = PropertyFunctions.ProcessCommand(paramCmd, context, _editlang);
                }
                else if (paramCmd.StartsWith("itemlist_"))
                {
                    strOut = ItemListsFunctions.ProcessCommand(paramCmd, context);
                }
                else if (paramCmd.StartsWith("addressadmin_"))
                {
                    strOut = AddressAdminFunctions.ProcessCommand(paramCmd, context);
                }
                else if (paramCmd.StartsWith("plugins_"))
                {
                    strOut = PluginFunctions.ProcessCommand(paramCmd, context);
                }
                else if (paramCmd.StartsWith("cart_"))
                {
                    strOut = CartFunctions.ProcessCommand(paramCmd, context);
                }
                else
                {
                    switch (paramCmd)
                    {
                    case "test":
                        strOut = "<root>" + UserController.Instance.GetCurrentUserInfo().Username + "</root>";
                        break;

                    case "setdata":
                        break;

                    case "deldata":
                        break;

                    case "getdata":
                        strOut = GetReturnData(context);
                        break;

                    case "fileupload":
                        if (NBrightBuyUtils.CheckRights())
                        {
                            strOut = FileUpload(context);
                        }
                        break;

                    case "fileclientupload":
                        if (StoreSettings.Current.GetBool("allowupload"))
                        {
                            strOut = FileUpload(context, itemId);
                        }
                        break;

                    case "docdownload":

                        var fname   = Utils.RequestQueryStringParam(context, "filename");
                        var filekey = Utils.RequestQueryStringParam(context, "key");
                        if (filekey != "")
                        {
                            var uData = new UserData();
                            if (uData.HasPurchasedDocByKey(filekey))
                            {
                                fname = uData.GetPurchasedFileName(filekey);
                            }
                            fname = StoreSettings.Current.FolderDocuments + "/" + fname;
                        }
                        if (fname != "")
                        {
                            strOut = fname;     // return this is error.
                            var downloadname = Utils.RequestQueryStringParam(context, "downloadname");
                            var fpath        = HttpContext.Current.Server.MapPath(fname);
                            if (downloadname == "")
                            {
                                downloadname = Path.GetFileName(fname);
                            }
                            try
                            {
                                Utils.ForceDocDownload(fpath, downloadname, context.Response);
                            }
                            catch (Exception ex)
                            {
                                // ignore, robots can cause error on thread abort.
                                //Exceptions.LogException(ex);
                                Logging.Debug($"XmlConnector.ProcessRequest exception for {paramCmd} which is ignored because bots tend to cause these on thread abort: {ex.Message}.");
                            }
                        }
                        break;

                    case "printproduct":
                        break;

                    case "renderpostdata":
                        strOut = RenderPostData(context);
                        break;

                    case "getsettings":
                        strOut = GetSettings(context);
                        break;

                    case "savesettings":
                        if (NBrightBuyUtils.CheckRights())
                        {
                            strOut = SaveSettings(context);
                        }
                        break;

                    case "updateprofile":
                        strOut = UpdateProfile(context);
                        break;

                    case "dosearch":
                        strOut = DoSearch(context);
                        break;

                    case "resetsearch":
                        strOut = ResetSearch(context);
                        break;

                    case "orderby":
                        strOut = DoOrderBy(context);
                        break;

                    case "renderthemefolders":
                        strOut = RenderThemeFolders(context);
                        break;
                    }
                }

                if (strOut == "** No Action **")
                {
                    var pluginData = new PluginData(PortalSettings.Current.PortalId);
                    var provList   = pluginData.GetAjaxProviders();
                    foreach (var d in provList)
                    {
                        if (paramCmd.ToLower().StartsWith(d.Key.ToLower() + "_") || paramCmd.ToLower().StartsWith("cmd" + d.Key.ToLower() + "_"))
                        {
                            var ajaxprov = AjaxInterface.Instance(d.Key);
                            if (ajaxprov != null)
                            {
                                strOut = ajaxprov.ProcessCommand(paramCmd, context, _editlang);
                            }
                        }
                    }
                }

                #endregion
            }
            catch (Exception ex)
            {
                strOut = ex.ToString();
                Logging.LogException(ex);
                //Exceptions.LogException(ex);
            }


            #region "return results"

            //send back xml as plain text
            context.Response.Clear();
            context.Response.ContentType = "text/plain";
            context.Response.Write(strOut);
            context.Response.End();

            #endregion
        }
Example #45
0
 public void SendMessageWithUserData(UserData userData, string message)
 {
     Clients.All.processMessageFromUser(userData, message);
 }
Example #46
0
        private void UpdateUserInfo()
        {
            UserData ud = UserManager.Instance.MainUserData;

            txtUserInfo.text = ud.name + "(Lv." + ud.level + ")";
        }
Example #47
0
    private bool isGameOver = false;            //标识,保证游戏结束时的相关行为只执行一次

    //初始化函数
    void Start()
    {
        Cursor.visible = false;         //禁用鼠标光标
        if (gm == null)                 //静态游戏管理器初始化
        {
            gm = GetComponent <GameManager> ();
        }
        if (player == null)                     //获取场景中的游戏主角
        {
            player = GameObject.FindGameObjectWithTag("Player");
        }
        //获取场景中的AudioListener组件
        audioListener = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <AudioListener> ();

        gm.gameState = GameState.Playing;                     //游戏状态设置为游戏进行中
        currentScore = 0;                                     //当前得分初始化为0
        startTime    = Time.time;                             //记录场景加载的时刻

        playerHealth = player.GetComponent <PlayerHealth> (); //获取玩家生命值组件,并初始化玩家生命值与HealthSlider参数
        if (playerHealth)
        {
            healthSlider.maxValue = playerHealth.startHealth;
            healthSlider.minValue = 0;
            healthSlider.value    = playerHealth.currentHealth;
        }

        playingCanvas.SetActive(true);                  //启用游戏进行中Canvas
        gameResultCanvas.SetActive(false);              //禁用游戏结果Canvas

        if (PlayerPrefs.GetString("Username") == "")    //若玩家未输入姓名,则将其姓名改为无名英雄
        {
            PlayerPrefs.SetString("Username", "无名英雄");
        }
        //从本地保存的数据中获取前三名信息
        if (PlayerPrefs.GetString("FirstUser") != "")
        {
            firstUserData = new UserData(PlayerPrefs.GetString("FirstUser"));
        }
        else
        {
            firstUserData = new UserData();
        }
        if (PlayerPrefs.GetString("SecondUser") != "")
        {
            secondUserData = new UserData(PlayerPrefs.GetString("SecondUser"));
        }
        else
        {
            secondUserData = new UserData();
        }
        if (PlayerPrefs.GetString("ThirdUser") != "")
        {
            thirdUserData = new UserData(PlayerPrefs.GetString("ThirdUser"));
        }
        else
        {
            thirdUserData = new UserData();
        }
        //根据GameStart场景中的声音设置,控制本场景中AudioListener的启用与禁用
        audioListener.enabled = (PlayerPrefs.GetInt("SoundOff") != 1);
    }
 private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
 {
     userdata = UserData.Instance;
     PrePopulate();
 }
Example #49
0
 /// <summary>
 /// 设置User和UserData与该client对象绑定
 /// </summary>
 public void SetUserAndData(User user, UserData userData)
 {
     this.user     = user;
     this.userData = userData;
 }
 public static void RegisterUser(UserData newUser)
 {
     UserDataDB.RegisterUser(newUser);
 }
        private static string GenerateResponseValueWithEmail(ref LoginSocketState state, ref UserData clientData)
        {
            string value = state.PasswordEncrypted;

            value += new String(' ', 48);
            value += state.Name + "@" + (state.Email ?? clientData.Email);
            value += state.ClientChallenge;
            value += state.ServerChallenge;
            value += state.PasswordEncrypted;

            return(value.ToMD5());
        }
 public void SetAllPlayerResSync(UserData ud1, UserData ud2)
 {
     this.ud1 = ud1;
     this.ud2 = ud2;
 }
Example #53
0
 /// <summary>
 /// Выполнить действия после успешного входа пользователя в систему
 /// </summary>
 public virtual void OnUserLogin(UserData userData)
 {
 }
        public void TryAuthenticate(string AuthTicket)
        {
            if (string.IsNullOrEmpty(AuthTicket))
            {
                return;
            }

            try
            {
                string   ip       = this.GetConnection().getIp();
                UserData userData = UserDataFactory.GetUserData(AuthTicket, ip, this.MachineId);
                if (userData == null)
                {
                    return;
                }
                else
                {
                    ButterflyEnvironment.GetGame().GetClientManager().LogClonesOut(userData.userID);
                    this.Habbo  = userData.user;
                    this.Langue = this.Habbo.Langue;

                    ButterflyEnvironment.GetGame().GetClientManager().RegisterClient(this, userData.userID, this.Habbo.Username);
                    if (this.Langue == Language.FRANCAIS)
                    {
                        ButterflyEnvironment.onlineUsersFr++;
                    }
                    else if (this.Langue == Language.ANGLAIS)
                    {
                        ButterflyEnvironment.onlineUsersEn++;
                    }
                    else if (this.Langue == Language.PORTUGAIS)
                    {
                        ButterflyEnvironment.onlineUsersBr++;
                    }

                    if (this.Habbo.MachineId != this.MachineId)
                    {
                        using (IQueryAdapter queryreactor = ButterflyEnvironment.GetDatabaseManager().GetQueryReactor())
                        {
                            queryreactor.SetQuery("UPDATE users SET machine_id = @machineid WHERE id = '" + this.Habbo.Id + "'");
                            queryreactor.AddParameter("machineid", this.MachineId);
                            queryreactor.RunQuery();
                        }
                    }

                    this.Habbo.Init(this, userData);
                    this.Habbo.LoadData(userData);

                    this.IsNewUser();

                    this.SendPacket(new AuthenticationOKComposer());
                    this.SendPacket(new NavigatorSettingsComposer(this.Habbo.HomeRoom));
                    this.SendPacket(new FavouritesComposer(this.Habbo.FavoriteRooms));
                    this.SendPacket(new FigureSetIdsComposer());
                    this.SendPacket(new UserRightsComposer(this.Habbo.Rank < 2 ? 2 : this.GetHabbo().Rank));
                    this.SendPacket(new AvailabilityStatusComposer());
                    this.SendPacket(new AchievementScoreComposer(this.Habbo.AchievementPoints));
                    this.SendPacket(new BuildersClubMembershipComposer());
                    this.SendPacket(new ActivityPointsComposer(Habbo.Duckets, Habbo.WibboPoints));
                    this.SendPacket(new CfhTopicsInitComposer(ButterflyEnvironment.GetGame().GetModerationTool().UserActionPresets));
                    this.SendPacket(new SoundSettingsComposer(this.Habbo.ClientVolume, false, false, false, 1));
                    this.SendPacket(new AvatarEffectsComposer(ButterflyEnvironment.GetGame().GetEffectsInventoryManager().GetEffects()));

                    this.Habbo.UpdateActivityPointsBalance();
                    this.Habbo.UpdateCreditsBalance();
                    this.Habbo.UpdateDiamondsBalance();

                    if (this.Habbo.HasFuse("fuse_mod"))
                    {
                        ButterflyEnvironment.GetGame().GetClientManager().AddUserStaff(Habbo.Id);
                        this.SendPacket(ButterflyEnvironment.GetGame().GetModerationTool().SerializeTool());
                    }

                    return;
                }
            }
            catch (Exception ex)
            {
                Logging.LogException("Invalid Dario bug duing user login: " + (ex).ToString());
            }
        }
Example #55
0
 /// <summary>
 /// Выполнить действия после выхода пользователя из системы
 /// </summary>
 public virtual void OnUserLogout(UserData userData)
 {
 }
Example #56
0
 /// <summary>
 /// Получить элементы меню, доступные пользователю
 /// </summary>
 /// <remarks>Поддерживается не более 2 уровней вложенности меню</remarks>
 public virtual List <MenuItem> GetMenuItems(UserData userData)
 {
     return(null);
 }
 public void SetLocalPlayerResSync()
 {
     ud = facade.GetUserData();
 }
        protected void Application_Error(Object sender, EventArgs e)
        {
#if DEBUG
            return;
#endif

            if (!System.Diagnostics.EventLog.SourceExists
                    ("Interlex"))
            {
                System.Diagnostics.EventLog.CreateEventSource
                    ("Interlex", "Application");
            }

            var ex = Server.GetLastError();

            Server.ClearError();

            string userInfo = "";
            if (Session["UserData"] != null)
            {
                UserData userData = Session["UserData"] as UserData;
                if (userData != null)
                {
                    userInfo = "-- " + userData.Username + " (" + userData.UserId + ")";
                }
            }
            string urlPath = Request.Url.PathAndQuery;

            string errorMsg = DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss") + "--" + urlPath + "-- " + userInfo + Environment.NewLine + "Message: " + ex.Message + "|| Stack Trace: " + ex.StackTrace + "|| Target: " + ex.TargetSite
                              + Environment.NewLine + Environment.NewLine;

            System.Diagnostics.EventLog.WriteEntry("Interlex", errorMsg, System.Diagnostics.EventLogEntryType.Error);

            /*exception logging in logs folder*/
            var logsDirectory = HttpRuntime.AppDomainAppPath;
            logsDirectory = logsDirectory + "Logs\\";

            var timeOfLoging   = DateTime.Now;
            var timePathParsed = "";

            if (timeOfLoging.Day.ToString().Length == 1)
            {
                if (timeOfLoging.Month.ToString().Length == 1)
                {
                    timePathParsed = timePathParsed + timeOfLoging.Year + "_0" + timeOfLoging.Month + "_0" + timeOfLoging.Day;
                }
                else
                {
                    timePathParsed = timePathParsed + timeOfLoging.Year + "_" + timeOfLoging.Month + "_0" + timeOfLoging.Day;
                }
            }
            else
            {
                if (timeOfLoging.Month.ToString().Length == 1)
                {
                    timePathParsed = timePathParsed + timeOfLoging.Year + "_0" + timeOfLoging.Month + "_" + timeOfLoging.Day;
                }
                else
                {
                    timePathParsed = timePathParsed + timeOfLoging.Year + "_" + timeOfLoging.Month + "_" + timeOfLoging.Day;
                }
            }

            var fullPath = logsDirectory + timePathParsed + ".txt";

            //File.Create(fullPath);
            System.IO.File.AppendAllText(fullPath, errorMsg + Environment.NewLine);

            // xslt error
            if (ex.StackTrace.Contains("AkomaNtosoXml.Xslt.Core.Classes.Resolver"))
            {
                var dbName = ConfigurationManager.ConnectionStrings["ConnPG"].DatabaseName();

                var title = $"[{dbName}] Xslt error";
                var body  = $"<div>{ex}</div>";

                ApisEmail.SendFromSupport(to: "*****@*****.**", title: title, body: body);
            }

            Server.TransferRequest("~/Error/500", true);
            // Response.Redirect("~/Error/500", false);
            //  Response.End();
            //  Response.End();
            //  HttpContext.Current.ApplicationInstance.CompleteRequest();
        }
Example #59
0
 /// <summary>
 /// 通过登录等逻辑来更新用户数据
 /// </summary>
 /// <param name="data"></param>
 public void UpdateMainUserData(UserData data)
 {
     m_mainUserData = data;
 }
        public async Task <bool> StoreUserInfo(UserData userData)
        {
            var userDataStr = JsonSerializer.Serialize(userData);

            return(await _jsRuntime.InvokeAsync <bool>("storeUserDataToLocalStorage", AuthKey, userDataStr));
        }