Exemplo n.º 1
0
        private bool OnPresetSelected(PresetSelect presetSelect)
        {
            ParamCharaController controller = _parent.GetSelectedController();

            ChaFileDefine.CoordinateType    coordinate = _parent.GetSelectedCoordinate();
            ParamCharaController.ParamsKind kind       = _parent.GetSelectedParamsKind();
            string xmlPath = presetSelect.GetSelectedFilePath();

            switch (_parent.GetSelectedParamsKind())
            {
            case ParamCharaController.ParamsKind.Naked:
                if (!XMLPresetIO.LoadXMLBust(controller.paramCustom.paramBustNaked, xmlPath))
                {
                    return(false);
                }
                break;

            case ParamCharaController.ParamsKind.Bra:
                if (!XMLPresetIO.LoadXMLBust(controller.paramCustom.paramBust[coordinate][kind], xmlPath))
                {
                    return(false);
                }
                break;

            case ParamCharaController.ParamsKind.Tops:
                if (!XMLPresetIO.LoadXMLBust(controller.paramCustom.paramBust[coordinate][kind], xmlPath))
                {
                    return(false);
                }
                break;

            case ParamCharaController.ParamsKind.Hip:
                if (!XMLPresetIO.LoadXMLHip(controller.paramCustom.paramHip, xmlPath))
                {
                    return(false);
                }
                break;

            default:
                break;
            }
            controller.changedInfo.SetInfo(coordinate, kind, false, true, false);
            return(true);
        }
        private bool SaveFile(string filename)
        {
            if (filename.IsNullOrEmpty())
            {
                return(false);
            }

            if (!Directory.Exists(PluginPath.presetDirBust))
            {
                Directory.CreateDirectory(PluginPath.presetDirBust);
            }
            string pathBust = Path.Combine(PluginPath.presetDirBust, filename) + ".xml";

            if (!Directory.Exists(PluginPath.presetDirHip))
            {
                Directory.CreateDirectory(PluginPath.presetDirHip);
            }
            string pathHip = Path.Combine(PluginPath.presetDirHip, filename) + ".xml";

            ParamCharaController.ParamsKind paramsKind = _parent.GetSelectedParamsKind();
            switch (paramsKind)
            {
            case ParamCharaController.ParamsKind.Naked:
                XMLPresetIO.SaveXMLBust(_parent.GetSelectedController().paramCustom.paramBustNaked, pathBust);
                break;

            case ParamCharaController.ParamsKind.Bra:
                XMLPresetIO.SaveXMLBust(_parent.GetSelectedController().paramCustom.paramBust[_parent.GetSelectedCoordinate()][paramsKind], pathBust);
                break;

            case ParamCharaController.ParamsKind.Tops:
                XMLPresetIO.SaveXMLBust(_parent.GetSelectedController().paramCustom.paramBust[_parent.GetSelectedCoordinate()][paramsKind], pathBust);
                break;

            case ParamCharaController.ParamsKind.Hip:
                XMLPresetIO.SaveXMLHip(_parent.GetSelectedController().paramCustom.paramHip, pathHip);
                break;

            default:
                break;
            }
            return(true);
        }