void OnReplace(MyGuiControlButton button)
        {
            if (m_selectedItem == null)
            {
                return;
            }

            MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(
                                       buttonType : MyMessageBoxButtonsType.YES_NO,
                                       styleEnum : MyMessageBoxStyleEnum.Info,
                                       messageCaption : MyTexts.Get(MySpaceTexts.BlueprintsMessageBoxTitle_Replace),
                                       messageText : MyTexts.Get(MySpaceTexts.BlueprintsMessageBoxDesc_Replace),
                                       callback : delegate(MyGuiScreenMessageBox.ResultEnum callbackReturn)
            {
                if (callbackReturn == MyGuiScreenMessageBox.ResultEnum.YES)
                {
                    string name = m_selectedItem.Text.ToString();
                    var path    = Path.Combine(m_localBlueprintFolder, name, "bp.sbc");
                    if (File.Exists(path))
                    {
                        var oldBlueprint = LoadPrefab(path);
                        MyCubeBuilder.Static.Clipboard.CopiedGrids[0].DisplayName = name;
                        oldBlueprint.ShipBlueprints[0].CubeGrids = MyCubeBuilder.Static.Clipboard.CopiedGrids.ToArray();

                        if (MyFakes.ENABLE_BATTLE_SYSTEM)
                        {
                            oldBlueprint.ShipBlueprints[0].Points = MyBattleHelper.GetBattlePoints(oldBlueprint.ShipBlueprints[0].CubeGrids);
                        }

                        SavePrefabToFile(oldBlueprint, replace: true);
                        RefreshBlueprintList();
                    }
                }
            }));
        }
        public void CreateFromClipboard(bool withScreenshot = false, bool replace = false)
        {
            if (MyCubeBuilder.Static.Clipboard.CopiedGridsName == null)
            {
                return;
            }
            string name    = MyUtils.StripInvalidChars(MyCubeBuilder.Static.Clipboard.CopiedGridsName);
            string newName = name;
            string path    = Path.Combine(m_localBlueprintFolder, name);
            int    index   = 1;

            while (MyFileSystem.DirectoryExists(path))
            {
                newName = name + "_" + index;
                path    = Path.Combine(m_localBlueprintFolder, newName);
                index++;
            }
            string imagePath = Path.Combine(path, "thumb.png");

            if (withScreenshot)
            {
                TakeScreenshot(newName);
            }

            var prefab = MyObjectBuilderSerializer.CreateNewObject <MyObjectBuilder_ShipBlueprintDefinition>();

            prefab.Id           = new MyDefinitionId(new MyObjectBuilderType(typeof(MyObjectBuilder_ShipBlueprintDefinition)), MyUtils.StripInvalidChars(name));
            prefab.CubeGrids    = MyCubeBuilder.Static.Clipboard.CopiedGrids.ToArray();
            prefab.RespawnShip  = false;
            prefab.DisplayName  = MySteam.UserName;
            prefab.OwnerSteamId = MySteam.UserId;
            if (MyFakes.ENABLE_BATTLE_SYSTEM)
            {
                prefab.Points = MyBattleHelper.GetBattlePoints(prefab.CubeGrids);
            }
            prefab.CubeGrids[0].DisplayName = name;

            var definitions = MyObjectBuilderSerializer.CreateNewObject <MyObjectBuilder_Definitions>();

            definitions.ShipBlueprints    = new MyObjectBuilder_ShipBlueprintDefinition[1];
            definitions.ShipBlueprints[0] = prefab;

            SavePrefabToFile(definitions, replace: replace);
            RefreshBlueprintList();
        }