private void okayButton_Click(object sender, EventArgs e) { if (!ValidateInputs()) { MessageBox.Show(this, "Please ensure you have filled in all the inputs", "Oops!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } var app = new JavaScriptApp(this.appName.Text, this.rootDirectory.Text, this.outputDirectory.Text, this.includeLowerCaseCheck.Checked); if (_selectedApp != null) { this._javaScriptAppBuilder.OverwriteApp(_selectedApp.Name, app); } else { this._javaScriptAppBuilder.AddApp(app); } if (this._updateParentDialog != null) { this._updateParentDialog(app.Name); } this.Close(); }
public void OverwriteApp(string appName, JavaScriptApp app) { this._configManager.SaveApp(app, appName); _javaScriptApps[app.Name] = app; this._overlord.Unwatch(appName); this._overlord.Watch(app.Name, app.RootDirectory, new FileSystemEventHandler(OnAppChanged)); }
private void SetDialogValues(JavaScriptApp app) { this.rootDirectory.Text = app.RootDirectory; this.outputDirectory.Text = app.OutputDirectory; this.includeLowerCaseCheck.Checked = app.IncludeLowerCase; this.appName.Text = app.Name; }
// Dev Sug - Add \t to start of lines depending on 'depth' private void CreateModuleForDirectory(string path, StringBuilder output, JavaScriptApp app, bool includeLowerCase, string overrideName) { var items = app.OrderInformation.GetOrderedItems(path); var additionalReturnStatements = new List <string>(); var subDirectorys = new List <string>(); var filePaths = new List <string>(); var nameSpace = overrideName ?? Path.GetFileName(path); output.AppendLine("var " + nameSpace + " = function(){"); foreach (var itemPath in items.Keys) { if (items[itemPath].Equals(OrderItemType.Directory)) { this.CreateModuleForDirectory(itemPath, output, app, includeLowerCase, null); subDirectorys.Add(itemPath); } else if (items[itemPath].Equals(OrderItemType.File)) { using (var fileStream = new StreamReader(itemPath)) { readFile(fileStream, output, additionalReturnStatements); filePaths.Add(itemPath); } } } output.AppendLine(CreateReturnStatement(subDirectorys, filePaths, additionalReturnStatements, includeLowerCase)); output.AppendLine("}();"); }
public AddEditApp(string selectedAppName, JavaScriptAppBuilderManager javaScriptAppBuilder) { if (javaScriptAppBuilder == null) { throw new ArgumentNullException("javaScriptAppBuilder"); } this._selectedApp = javaScriptAppBuilder.GetApp(selectedAppName); this._javaScriptAppBuilder = javaScriptAppBuilder; this._updateParentDialog = null; InitializeComponent(); SetDialogValues(this._selectedApp); }
public AddEditApp(JavaScriptAppBuilderManager javaScriptAppBuilder, Action <string> updateParentDialog) { if (javaScriptAppBuilder == null) { throw new ArgumentNullException("javaScriptAppBuidler"); } if (updateParentDialog == null) { throw new ArgumentNullException("updateParentDialog"); } this._selectedApp = null; this._updateParentDialog = updateParentDialog; this._javaScriptAppBuilder = javaScriptAppBuilder; InitializeComponent(); }
public AppOrdering(JavaScriptApp app, JavaScriptAppBuilderManager manager) { if (app == null) { throw new ArgumentNullException("app"); } if (manager == null) { throw new ArgumentNullException("manager"); } this._app = app; this._manager = manager; this._originalOrdering = app.OrderInformation; InitializeComponent(); foreach (var directory in app.OrderInformation.Keys) { var description = directory.Replace(app.RootDirectory, app.Name); _fullPathDictionary.Add(description, directory); this.directoryList.Items.Add(description); } }
public void AddApp(JavaScriptApp app) { this._configManager.SaveApp(app, null); _javaScriptApps.Add(app.Name, app); this._overlord.Watch(app.Name, app.RootDirectory, new FileSystemEventHandler(OnAppChanged)); }