Example #1
0
 public static void LaunchOneShot()
 {
     try
     {
         Logger.WriteLine("starting oneshot");
         if (File.Exists(baseOneShotPath + "\\steamshim.exe"))
         {
             Logger.WriteLine("steamshim.exe");
             Process.Start(baseOneShotPath + "\\steamshim.exe");
         }
         else
         {
             Logger.WriteLine("oneshot.exe");
             Process.Start(baseOneShotPath + "\\oneshot.exe");
         }
     }
     catch (Exception ex)
     {
         ExceptionMessage.New(ex, false);
         MessageBox.Show("Failed to start OneShot.\nThe log may contain more information.");
     }
 }
Example #2
0
        public ModBox(string path)
        {
            try
            {
                modPath = path;
                Size    = new Size(230, 50);

                Label      displayName = new Label();
                Label      author      = new Label();
                Label      desc        = new Label();
                PictureBox icon        = new PictureBox();

                modName    = modPath.Substring(modPath.LastIndexOf("Mods") + 5);
                desc.Text  = "Metadata is nonexistent or unreadable";
                icon.Image = Image.FromFile(Static.spritesPath + "mmd_icon_default.png");

                // read from metadata
                if (File.Exists(modPath + "\\.osml\\metadata.ini"))
                {
                    IniData data = INIManage.Read(modPath + "\\.osml\\metadata.ini");

                    modName     = data["config"]["displayName"] + " - " + data["config"]["version"];
                    author.Text = "by " + data["config"]["author"];
                    desc.Text   = data["config"]["description"];
                }
                // and the icon
                if (File.Exists(modPath + "\\.osml\\icon.png"))
                {
                    icon.Image = Image.FromFile(modPath + "\\.osml\\icon.png");
                }

                displayName.Text = modName;

                // position
                icon.Location        = new Point(0, 0);
                displayName.Location = new Point(50, 0);
                author.Location      = new Point(50, 10);
                desc.Location        = new Point(50, 20);

                // icon size
                icon.Size     = new Size(50, 50);
                icon.SizeMode = PictureBoxSizeMode.StretchImage;

                // font
                displayName.Font = Static.GetTerminusFont(9);
                author.Font      = Static.GetTerminusFont(9);
                desc.Font        = Static.GetTerminusFont(9);

                // colour
                displayName.ForeColor = Color.MediumPurple;
                author.ForeColor      = Color.MediumPurple;
                desc.ForeColor        = Color.MediumPurple;

                displayName.AutoSize = true;
                author.AutoSize      = true;
                desc.AutoSize        = true;

                Controls.Add(displayName);
                Controls.Add(author);
                Controls.Add(desc);
                Controls.Add(icon);
            }
            catch (Exception ex)
            {
                ExceptionMessage.New(ex, true);
            }
        }
Example #3
0
        static void Main(string[] args)
        {
            try
            {
                // initialize logger
                if (!Directory.Exists(Static.appDataPath + "logs"))
                {
                    Directory.CreateDirectory(Static.appDataPath + "logs");
                }
                Logger.Init();

                Logger.WriteLine("les goooooooooooooo");
                Logger.WriteLine(Static.ver);

                // base os stuff
                doneSetup = Directory.Exists(Static.modsPath + "/base oneshot") && File.Exists(Static.appDataPath + "path.molly");

                if (File.Exists(Static.appDataPath + "path.molly"))
                {
                    Static.baseOneShotPath = File.ReadAllText(Static.appDataPath + "path.molly");
                }
                else
                {
                    Static.baseOneShotPath = "woah";
                }

                // create modinfo path (this will be used in a future update)
                if (!Directory.Exists(Static.modInfoPath))
                {
                    Directory.CreateDirectory(Static.modInfoPath);
                }

                // append contents of osmlargs.txt to args
                ReadArgsFile(ref args);

                // add terminus to the font collection
                Static.AddFonts();

                // start divide by zero thread
                Thread divideByZeroThread = new Thread(new ThreadStart(DivideByZeroThread));
                divideByZeroThread.Start();

                //////////////////////////////////////////////////////////////
                // Run Application
                //////////////////////////////////////////////////////////////

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                if (args.Length == 0)
                {
                    Application.Run(new MainForm());
                }
                else
                {
                    ProcessArgs(args);
                }

                //////////////////////////////////////////////////////////////
                // After the application has finished running
                //////////////////////////////////////////////////////////////

                // abort background threads
                divideByZeroThread.Abort();

                // write the logger to a file
                Logger.ToFile();
            }
            catch (ObjectDisposedException) { }
            catch (Exception ex)
            {
                Logger.WriteLine("caught in Program.Main():");
                ExceptionMessage.New(ex, true, "OneShot ModLoader will now close.");
            }
        }