Ejemplo n.º 1
0
 /// <summary>
 /// Leaves the server.
 /// </summary>
 public void Leave()
 {
     if (_User != null)
     {
         var msg = new ChatMessage();
         msg.User = _User;
         Package_Grabber.SendMessage(IP_Address, "chat leave", msg);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Requests a list of online users.
 /// </summary>
 public void GetUsers()
 {
     try
     {
         Package_Grabber.SendMessage(IP_Address, "chat get_users");
     }
     catch
     {
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Requests the topic string of the server.
 /// </summary>
 public void GetTopic()
 {
     try
     {
         Package_Grabber.SendMessage(IP_Address, "chat get_topic");
     }
     catch
     {
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Sends a message to the server.
 /// </summary>
 /// <param name="Text">Message text.</param>
 public void Send(string Text)
 {
     if (_User != null)
     {
         var msg = new ChatMessage();
         msg.User = _User;
         msg.Text = Text;
         Package_Grabber.SendMessage(IP_Address, "chat normal", msg);
     }
 }
Ejemplo n.º 5
0
 public void GetBank()
 {
     try
     {
         Package_Grabber.SendMessage(_IP, "btn getbank");
     }
     catch
     {
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Joins the server.
        /// </summary>
        /// <param name="nick">Nickname.</param>
        public void Join(string nick)
        {
            var usr = new ChatUser();

            usr.Name = nick;
            var msg = new ChatMessage();

            msg.User = usr;
            Package_Grabber.SendMessage(IP_Address, "chat join", msg);
        }
Ejemplo n.º 7
0
 public void UploadBank(List <SaveSystem.PrivateBitnoteAddress> bank)
 {
     try
     {
         Package_Grabber.SendMessage(_IP, "btn setbank", API.BitnoteEncryption.Encrypt(JsonConvert.SerializeObject(bank)));
     }
     catch
     {
     }
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Sets up the HoloCHat UI.
 /// </summary>
 public void SetupUI()
 {
     IPs = new Dictionary <string, string>();
     lbrooms.Items.Clear();
     foreach (var client in Package_Grabber.clients)
     {
         if (client.Value.IsConnected)
         {
             client.Value.OnReceived += (object s, NetReceivedEventArgs <NetObject> a) =>
             {
                 try
                 {
                     if (!IPs.ContainsKey(client.Key))
                     {
                         var obj = (ObjectModel)a.Data.Object;
                         if (obj.Command == "name")
                         {
                             string name = (string)obj.OptionalObject;
                             IPs.Add(client.Key, name);
                         }
                     }
                     else
                     {
                         var obj = (ObjectModel)a.Data.Object;
                         if (obj.Command == "name")
                         {
                             string name = (string)obj.OptionalObject;
                             IPs[client.Key] = name;
                         }
                     }
                     this.Invoke(new Action(() =>
                     {
                         string r = "";
                         foreach (string room in lbrooms.Items)
                         {
                             if (room == IPs[client.Key])
                             {
                                 r = room;
                             }
                         }
                         if (r == "")
                         {
                             lbrooms.Items.Add(IPs[client.Key]);
                         }
                     }));
                 }
                 catch
                 {
                 }
             };
             Package_Grabber.SendMessage(client.Key, "chat get_name");
         }
     }
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Downloads a package.
 /// </summary>
 /// <param name="pkg">Package name to download.</param>
 public void DownloadPackage(string pkg)
 {
     _mode = "";
     Package_Grabber.SendMessage(_IP, $"apm getpackage {pkg}");
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Connects to Appscape server and grabs app package listings.
 /// </summary>
 public void GetPackageData()
 {
     _mode = "getapps";
     Package_Grabber.SendMessage(_IP, "apm getapps");
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Downloads a skin.
 /// </summary>
 /// <param name="skn">The skin name to download.</param>
 public void DownloadSkin(string skn)
 {
     _mode = "";
     Package_Grabber.SendMessage(_IP, $"apm getskin {skn}");
 }
Ejemplo n.º 12
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            //Extract all dependencies before starting the engine.
            ExtractDependencies();
            Package_Grabber.ConnectToServer("shiftos.cloudapp.net", 4433);
            //Start the Windows Forms backend
            Paths.RegisterPaths();                     //Sets ShiftOS path variables based on the current OS.
            SaveSystem.Utilities.CheckForOlderSaves(); //Backs up C:\ShiftOS on Windows systems if it exists and doesn't contain a _engineInfo.txt file telling ShiftOS what engine created it.
            //If there isn't a save folder at the directory specified by ShiftOS.Paths.SaveRoot, create a new save.
            //If not, load that save.
            if (Directory.Exists(Paths.SaveRoot))
            {
                API.Log("Loading ShiftOS save...");
                SaveSystem.Utilities.loadGame();
            }
            else
            {
                SaveSystem.Utilities.NewGame();
            }
            //Load ShiftOS skin
            Skinning.Utilities.loadskin();
            SaveSystem.ShiftoriumRegistry.UpdateShiftorium();
            //Start recieving calls from the Modding API...
            Application.Run(new ShiftOSDesktop());
            //By now, the API receiver has been loaded,
            //and the desktop is shown. So, let's check
            //for auto-start mods.
            if (Directory.Exists(Paths.AutoStart))
            {
                foreach (string file in Directory.GetFiles(Paths.AutoStart))
                {
                    var inf = new FileInfo(file);
                    switch (inf.Extension)
                    {
                    case ".saa":
                        if (API.Upgrades["shiftnet"] == true)
                        {
                            API.Log("Starting start-up mod \"" + inf.FullName + "\"...");
                            API.LaunchMod(inf.FullName);
                        }
                        break;

                    case ".trm":
                        var t = new Terminal();
                        t.runterminalfile(inf.FullName);
                        API.Log("Started terminal file \"" + inf.FullName + "\"...");
                        break;
                    }
                }
            }
            //Now, for some ShiftOS launcher integration.
            try
            {
                if (args[0] != null)
                {
                    if (args[0] != "")
                    {
                        API.CurrentSave.username = args[0];
                        //Username set.
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 13
0
 /// <summary>
 /// Uploads a new package to the server.
 /// </summary>
 /// <param name="pkgMeta">Package metadata (name, description, etc)</param>
 /// <param name="pkg">Byte array representing the .stp file to upload.</param>
 public void UploadPackage(AppscapePackage pkgMeta, byte[] pkg)
 {
     pkgMeta.SetupFile = pkgMeta.Name.Replace(" ", "_") + ".stp";
     Package_Grabber.SendMessage(_IP, $"apm uploadmeta {pkgMeta.Name.Replace(" ", "_")}.json", pkgMeta);
     Package_Grabber.SendMessage(_IP, $"apm upload {pkgMeta.SetupFile}", pkg);
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Connects to Appscape server and grabs skin listings.
 /// </summary>
 public void GetSkinData()
 {
     _mode = "getskins";
     Package_Grabber.SendMessage(_IP, "apm getskins");
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Contacts the server to save the devlist.
 /// </summary>
 /// <param name="dict">Updated dev list to save.</param>
 public void UploadDevList(Dictionary <string, AppscapeModder> dict)
 {
     Package_Grabber.SendMessage(_IP, "apm uploaddevlist", dict);
 }
Ejemplo n.º 16
0
        /// <summary>
        /// Opens a file in the proper program.
        /// </summary>
        /// <param name="filepath">Path to the file.</param>
        public void OpenFile(string filepath)
        {
            bool     success = true;
            FileInfo finf    = new FileInfo(filepath);

            switch (finf.Extension)
            {
            case ".saa":
                if (API.Upgrades["shiftnet"] == true)
                {
                    API.LaunchMod(finf.FullName);
                }
                else
                {
                    success = false;
                }
                break;

            case ".txt":
                if (API.Upgrades["textpadopen"] == true)
                {
                    var pad = new TextPad();
                    pad.txtuserinput.Text = File.ReadAllText(finf.FullName);
                    API.CreateForm(pad, "TextPad", Properties.Resources.iconTextPad);
                }
                else
                {
                    success = false;
                }
                break;

            case ".pkg":
            case ".stp":
                if (API.Upgrades["shiftnet"] == true)
                {
                    API.CreateInfoboxSession("Package Installation", "Would you like to install the package?", infobox.InfoboxMode.YesNo);
                    API.InfoboxSession.FormClosing += (object s, FormClosingEventArgs a) =>
                    {
                        var result = API.GetInfoboxResult();
                        if (result == "Yes")
                        {
                            try
                            {
                                var res = Package_Grabber.ExtractPackage(finf.FullName);
                                if (res == "fail")
                                {
                                    throw new Exception("Michael was dumb and messed something up.");
                                }
                                else
                                {
                                    Package_Grabber.InstallPackage(res + "\\");
                                    API.CreateInfoboxSession("Package Installer - Success", "The package has been installed successfully!", infobox.InfoboxMode.Info);
                                    API.UpdateWindows();
                                    API.CurrentSession.SetupDesktop();
                                }
                            }
                            catch (Exception ex)
                            {
                                if (API.DeveloperMode == true)
                                {
                                    API.CreateInfoboxSession("Package Installer - Error", ex.Message, infobox.InfoboxMode.Info);
                                }
                                else
                                {
                                    API.CreateInfoboxSession("Package Installer - Error", "An error has occurred while installing the package.", infobox.InfoboxMode.Info);
                                }
                            }
                        }
                    };
                }
                else
                {
                    success = false;
                }
                break;

            case ".skn":
                if (API.Upgrades["skinning"] == true)
                {
                    var loader = new SkinLoader();
                    API.CreateForm(loader, API.LoadedNames.SkinLoaderName, Properties.Resources.iconSkinLoader);
                    loader.LoadSkin(finf.FullName);
                }
                else
                {
                    success = false;
                }
                break;

            case ".spk":
                if (API.Upgrades["skinning"] == true)
                {
                    var loader = new SkinLoader();
                    loader.LoadedPack = finf.FullName;
                    API.CreateForm(loader, API.LoadedNames.SkinLoaderName, Properties.Resources.iconSkinLoader);
                    loader.SetupPackUI();
                }
                else
                {
                    success = false;
                }
                break;

            default:
                success = false;
                break;
            }
            //If we made it this far and nothing happened, tell the user.
            if (success == false)
            {
                API.CreateInfoboxSession("File Skimmer", "File Skimmer cannot find a program to open this file.", infobox.InfoboxMode.Info);
            }
        }
Ejemplo n.º 17
0
 /// <summary>
 /// Connects to server and requests a list of all developers.
 /// </summary>
 public void GetDevList()
 {
     _mode = "get_devlist";
     Package_Grabber.SendMessage(_IP, "get_devlist");
 }