public void Load(string ramlPathParam, string serverPath, string clientPath) { ramlPath = ramlPathParam; if (ramlPathParam.Contains(serverPath) && !ramlPathParam.Contains(clientPath)) { isServerUseCase = true; } var ramlProperties = RamlPropertiesManager.Load(ramlPathParam); Namespace = ramlProperties.Namespace; Source = ramlProperties.Source; if (isServerUseCase) { UseAsyncMethods = ramlProperties.UseAsyncMethods.HasValue && ramlProperties.UseAsyncMethods.Value; IncludeApiVersionInRoutePrefix = ramlProperties.IncludeApiVersionInRoutePrefix.HasValue && ramlProperties.IncludeApiVersionInRoutePrefix.Value; ModelsFolder = ramlProperties.ModelsFolder; AddGeneratedSuffixToFiles = ramlProperties.AddGeneratedSuffix != null && ramlProperties.AddGeneratedSuffix.Value; ImplementationControllersFolder = ramlProperties.ImplementationControllersFolder; } else { ClientName = ramlProperties.ClientName; } NotifyOfPropertyChange(() => ServerIsVisible); NotifyOfPropertyChange(() => ClientIsVisible); }
public void SaveButton() { if (Namespace == null || NetNamingMapper.HasIndalidChars(Namespace)) { MessageBox.Show("Error: invalid namespace."); return; } if (clientName != null && NetNamingMapper.HasIndalidChars(ClientName)) { MessageBox.Show("Error: invalid client name."); return; } if (source != null && NetNamingMapper.HasIndalidChars(source)) { MessageBox.Show("Error: invalid source."); return; } if (HasInvalidPath(ModelsFolder)) { MessageBox.Show("Error: invalid path specified for models. Path must be relative."); return; } if (HasInvalidPath(ImplementationControllersFolder)) { MessageBox.Show("Error: invalid path specified for controllers. Path must be relative."); return; } var ramlProperties = new RamlProperties { Namespace = Namespace, Source = Source, ClientName = ClientName, UseAsyncMethods = UseAsyncMethods, IncludeApiVersionInRoutePrefix = IncludeApiVersionInRoutePrefix, ModelsFolder = ModelsFolder, AddGeneratedSuffix = AddGeneratedSuffixToFiles, ImplementationControllersFolder = ImplementationControllersFolder }; RamlPropertiesManager.Save(ramlProperties, ramlPath); WasSaved = true; TryClose(); }