Ejemplo n.º 1
0
            public void Import(string filename)
            {
                using (FileStream file = File.OpenRead(filename))
                {
                    if (file.Length != 0x54 || !Win32.ByteArrayCompare(magicword, FileIO.ReadChunk(file, 4)))
                    {
                        throw new InvalidDataException();
                    }

                    ProfileSave profile = this;
                    ReadData(FileIO.ReadChunk(file, 0x50), ref profile);
                }
            }
Ejemplo n.º 2
0
 // GET api/<controller>/5
 public bool Get(string OtherUserID)
 {
     try
     {
         int  _UserID = Convert.ToInt32(HttpContext.Current.User.Identity.Name);
         bool _Return = new ProfileSave().IsProfileSaved(_UserID, Convert.ToInt32(OtherUserID));
         return(_Return);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Ejemplo n.º 3
0
        // POST api/<controller>
        public int Post([FromBody] ProfileSaveData ProfileSaveData)
        {
            try
            {
                int _UserID = Convert.ToInt32(HttpContext.Current.User.Identity.Name);

                bool _Return = false;
                if (ProfileSaveData.SaveType == "check")
                {
                    _Return = new ProfileSave().IsProfileSaved(_UserID, ProfileSaveData.OtherUserID);
                    if (_Return)
                    {
                        return(1);
                    }
                    else
                    {
                        return(0);
                    }
                }
                else if (ProfileSaveData.SaveType == "save")
                {
                    bool IsSavingAnonymously = false;

                    _Return = new ProfileSave().SaveProfile(_UserID, ProfileSaveData.OtherUserID, IsSavingAnonymously);
                    if (_Return)
                    {
                        return(1);
                    }
                    else
                    {
                        return(0);
                    }
                }
                else
                {
                    _Return = new ProfileSave().UnsaveProfile(_UserID, ProfileSaveData.OtherUserID);
                    if (_Return)
                    {
                        return(0);
                    }
                    else
                    {
                        return(1);
                    }
                }
            }
            catch (Exception)
            {
                return(0);
            }
        }