コード例 #1
0
 private void btnlounge_Click(object sender, EventArgs e)
 {
     API.CreateInfoboxSession("Appscape Developer Lounge", "Please enter your Developer Key to enter the Lounge.", infobox.InfoboxMode.TextEntry);
     API.InfoboxSession.FormClosing += (object s, FormClosingEventArgs a) =>
     {
         var  res  = API.GetInfoboxResult();
         bool cont = true;
         if (res != "fail")
         {
             try
             {
                 var dev = GetModderByDevID(res);
                 MyDevProfile = dev.Key;
                 LoungeClient = dev.Value;
                 SetupLounge();
             }
             catch
             {
                 cont = false;
             }
         }
         if (cont != true)
         {
             API.CreateInfoboxSession("Appscape Developer Lounge", "That Developer Key was not found in the database.", infobox.InfoboxMode.Info);
         }
     };
 }
コード例 #2
0
        /// <summary>
        /// Gets developer info using the specified key.
        ///
        /// Bugs: If two servers contain the same key, the first key the method sees will be returned.
        /// </summary>
        /// <param name="DevID">The key to search for.</param>
        /// <returns>A pair containing the developer info as well as the client that contained the key.</returns>
        public KeyValuePair <AppscapeModder, AppscapeClient> GetModderByDevID(string DevID)
        {
            AppscapeModder dev = null;
            AppscapeClient clt = null;

            foreach (var client in clients)
            {
                if (client.DevList.ContainsKey(DevID))
                {
                    if (dev == null)
                    {
                        dev = client.DevList[DevID];
                        clt = client;
                    }
                }
            }
            return(new KeyValuePair <AppscapeModder, AppscapeClient>(dev, clt));
        }
コード例 #3
0
        /// <summary>
        /// Adds a new developer key to the specified client's listing.
        /// </summary>
        /// <param name="client">The client to add to.</param>
        public void GenerateNewDevKey(AppscapeClient client)
        {
            var rnd = new Random();
            int key = rnd.Next(1, 99999999);
            var dev = new AppscapeModder();

            dev.DevKey = key.ToString();
            dev.Name   = "Modder";
            bool done = false;

            if (!client.DevList.ContainsKey(key.ToString()))
            {
                if (done != true)
                {
                    client.DevList.Add(dev.DevKey, dev);
                    client.UploadDevList(client.DevList);
                    done = true;
                    API.CreateInfoboxSession("Success.", $"Your new developer key is {dev.DevKey}. As long as you are connected to the {client.IP} repository, you can use this key to enter the Appscape Lounge, make a name for yourself, and start uploading.", infobox.InfoboxMode.Info);
                }
            }
        }
コード例 #4
0
 /// <summary>
 /// Front-end to handle uploading of an Appscape package.
 /// </summary>
 /// <param name="modder">The developer of the new package.</param>
 /// <param name="repo">The client representing the repository to upload to.</param>
 public AppscapeUploader(AppscapeModder modder, AppscapeClient repo)
 {
     InitializeComponent();
     MyProfile = modder;
     Repo      = repo;
 }