public static void GeneratePropertyDefinitionFile(EntityProperty entityProperty) { _entityProperty = entityProperty; _generatedFileContent = ""; var path = ""; var fullPath = ""; try { path = Path.Combine(GdOrganizerEditorUtils.GetSettingsFile().DefinitionTemplatePath); fullPath = Path.Combine(path, $"{_entityProperty}{NameSuffix}.cs"); if (File.Exists(fullPath)) { return; } Writeheader(); WriteDisclaimer(); WriteBody(); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } File.WriteAllText(fullPath, _generatedFileContent); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); } catch { // ignored } }
public static void GenerateFile() { _generatedFileContent = ""; _now = DateTime.Now; var path = ""; try { path = GdOrganizerEditorUtils.GetSettingsFile().GeneratedScriptsRootPath; } catch { // ignored } Writeheader(); WriteDisclaimer(); WriteBody(); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string fullPath = Path.Combine(path, GeneratedFileName); File.WriteAllText(fullPath, _generatedFileContent); AssetDatabase.SaveAssets(); }