Esempio n. 1
0
        public static DialogResult Show(string title, string message, DialogBoxIcon icon, DialogBoxButtons buttons)
        {
            if (ThundershockPlatform.IsPlatform(Platform.Windows))
            {
                var mainWindow = Process.GetCurrentProcess().MainWindowHandle;

                var type = icon switch
                {
                    DialogBoxIcon.Information => MB_ICONINFORMATION,
                    DialogBoxIcon.Warning => MB_ICONWARNING,
                    DialogBoxIcon.Question => MB_ICONQUESTION,
                    DialogBoxIcon.Error => MB_ICONSTOP,
                    _ => MB_ICONINFORMATION
                } | buttons switch
Esempio n. 2
0
        public static FileSystem FromHostOS()
        {
            var node = null as Node;

            if (ThundershockPlatform.IsPlatform(Platform.Windows))
            {
                node = new WindowsMasterNode();
            }
            else
            {
                node = new UnixMasterNode();
            }

            return(new FileSystem(node));
        }
Esempio n. 3
0
        protected override void Main(string[] args)
        {
            var gameUptime = Context.Uptime;

            var uptime        = $"{(int) gameUptime.TotalHours} hours, {gameUptime.Minutes} minutes, {gameUptime.Seconds} seconds";
            var template      = GetTemplate();
            var xnaAsm        = typeof(GraphicalAppBase).Assembly;
            var user          = $"{Context.UserName}@{Context.HostName}";
            var line          = Repeat('-', user.Length);
            var host          = ThundershockPlatform.OsName;
            var version       = GetType().Assembly.GetName().Version.ToString();
            var kernelname    = xnaAsm.GetName().Name;
            var kernelversion = xnaAsm.GetName().Version.ToString();
            var gpu           = GamePlatform.GraphicsCardDescription;
            var memUsed       = (GC.GetTotalMemory(false) / 1024 / 1024).ToString();
            var memTotal      = ThundershockPlatform.GetTotalSystemMemory().ToString();
            var cpu           = ThundershockPlatform.GetProcessorName();
            var term          = Context.Terminal;
            var shell         = Context.Shell;
            var wm            = Context.WindowManager;
            var de            = Context.DesktopEnvironment;
            var pkgs          = "0 (upgrades) | 0 (rpkg) | 0 (modldr)";
            var fps           = Math.Round(1 / Context.FrameTime.TotalSeconds).ToString(CultureInfo.InvariantCulture);
            var width         = Context.ScreenWidth.ToString();
            var height        = Context.ScreenHeight.ToString();

            Substitute(ref template, nameof(width), width);
            Substitute(ref template, nameof(height), height);
            Substitute(ref template, nameof(fps), fps);
            Substitute(ref template, nameof(pkgs), pkgs);
            Substitute(ref template, nameof(uptime), uptime);
            Substitute(ref template, nameof(term), term);
            Substitute(ref template, nameof(shell), shell);
            Substitute(ref template, nameof(wm), wm);
            Substitute(ref template, nameof(de), de);
            Substitute(ref template, nameof(cpu), cpu);
            Substitute(ref template, nameof(user), user);
            Substitute(ref template, nameof(line), line);
            Substitute(ref template, nameof(version), version);
            Substitute(ref template, nameof(host), host);
            Substitute(ref template, nameof(kernelname), kernelname);
            Substitute(ref template, nameof(kernelversion), kernelversion);
            Substitute(ref template, nameof(gpu), gpu);
            Substitute(ref template, nameof(memUsed), memUsed);
            Substitute(ref template, nameof(memTotal), memTotal);

            Console.WriteLine(template);
        }
Esempio n. 4
0
        public IAssetPropertyEditor CreateEditor(IAsset asset)
        {
            if (Property.PropertyType.IsEnum)
            {
                var enumEditor = new EnumEditor();
                enumEditor.Initialize(asset, Property);
                return(enumEditor);
            }

            foreach (var type in ThundershockPlatform.GetAllTypes <IAssetPropertyEditor>())
            {
                if (type.GetConstructor(Type.EmptyTypes) == null)
                {
                    continue;
                }

                var attr = type.GetCustomAttributes(false).OfType <PropertyEditorAttribute>().FirstOrDefault();

                if (attr == null)
                {
                    continue;
                }

                if (attr.Type == this.Property.PropertyType)
                {
                    var e = (IAssetPropertyEditor)Activator.CreateInstance(type, null);

                    e.Initialize(asset, this.Property);

                    return(e);
                }
            }

            var bad = new BadPropertyEditor();

            bad.Initialize(asset, this.Property);
            return(bad);
        }
Esempio n. 5
0
 protected override void Main(string[] args)
 {
     ThundershockPlatform.OpenFile(ThundershockPlatform.LocalDataPath);
 }