@@ -346,7 +346,7 @@ namespace FlaxEditor.Windows
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(gitPath))
|
if (string.IsNullOrEmpty(gitPath))
|
||||||
{
|
{
|
||||||
Editor.LogError($"Failed to create plugin project due to no GIT path.");
|
Editor.LogError("Failed to create plugin project due to no GIT path.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(pluginName))
|
if (string.IsNullOrEmpty(pluginName))
|
||||||
@@ -369,7 +369,7 @@ namespace FlaxEditor.Windows
|
|||||||
Directory.CreateDirectory(clonePath);
|
Directory.CreateDirectory(clonePath);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Editor.LogError($"Plugin Name is already used. Pick a different Name.");
|
Editor.LogError("Plugin Name is already used. Pick a different Name.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
@@ -390,7 +390,7 @@ namespace FlaxEditor.Windows
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Editor.Log($"Plugin project has been cloned.");
|
Editor.Log("Plugin project has been cloned.");
|
||||||
|
|
||||||
// Find project config file. Could be different then what the user named the folder.
|
// Find project config file. Could be different then what the user named the folder.
|
||||||
var files = Directory.GetFiles(clonePath);
|
var files = Directory.GetFiles(clonePath);
|
||||||
@@ -405,7 +405,7 @@ namespace FlaxEditor.Windows
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(pluginProjectName))
|
if (string.IsNullOrEmpty(pluginProjectName))
|
||||||
Editor.LogError($"Failed to find plugin project file to add to Project config. Please add manually.");
|
Editor.LogError("Failed to find plugin project file to add to Project config. Please add manually.");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await AddReferenceToProject(pluginName, pluginProjectName);
|
await AddReferenceToProject(pluginName, pluginProjectName);
|
||||||
@@ -553,7 +553,7 @@ namespace FlaxEditor.Windows
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(pluginName))
|
if (string.IsNullOrEmpty(pluginName))
|
||||||
{
|
{
|
||||||
Editor.LogError($"Failed to create plugin project due to no plugin name.");
|
Editor.LogError("Failed to create plugin project due to no plugin name.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -579,7 +579,7 @@ namespace FlaxEditor.Windows
|
|||||||
Editor.LogError($"Failed to download template project. Trying to use local file. {e}");
|
Editor.LogError($"Failed to download template project. Trying to use local file. {e}");
|
||||||
if (!File.Exists(localTemplatePath))
|
if (!File.Exists(localTemplatePath))
|
||||||
{
|
{
|
||||||
Editor.LogError($"Failed to use local file. Does not exist.");
|
Editor.LogError("Failed to use local file. Does not exist.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -690,15 +690,24 @@ namespace FlaxEditor.Windows
|
|||||||
var files = Directory.GetFiles(directory);
|
var files = Directory.GetFiles(directory);
|
||||||
foreach (var file in files)
|
foreach (var file in files)
|
||||||
{
|
{
|
||||||
if (file.Contains("MyPlugin.cs") || file.Contains("MyPluginEditor.cs"))
|
if (file.Contains("MyPluginEditor.cs"))
|
||||||
{
|
{
|
||||||
File.Delete(file);
|
File.Delete(file);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var fileText = await File.ReadAllTextAsync(file);
|
|
||||||
await File.WriteAllTextAsync(file, fileText.Replace("ExamplePlugin", pluginCodeName));
|
|
||||||
var fileName = Path.GetFileName(file).Replace("ExamplePlugin", pluginCodeName);
|
var fileName = Path.GetFileName(file).Replace("ExamplePlugin", pluginCodeName);
|
||||||
|
var fileText = await File.ReadAllTextAsync(file);
|
||||||
|
fileText = fileText.Replace("ExamplePlugin", pluginCodeName);
|
||||||
|
if (file.Contains("MyPlugin.cs"))
|
||||||
|
{
|
||||||
|
fileName = "ExamplePlugin.cs";
|
||||||
|
fileText = fileText.Replace("MyPlugin", pluginCodeName);
|
||||||
|
fileText = fileText.Replace("My Plugin", pluginName);
|
||||||
|
fileText = fileText.Replace("Flax Engine", companyName);
|
||||||
|
fileText = fileText.Replace("new Version(1, 0)", $"new Version({pluginVersion.Trim().Replace(".", ", ")})");
|
||||||
|
}
|
||||||
|
await File.WriteAllTextAsync(file, fileText);
|
||||||
File.Move(file, Path.Combine(directory, fileName));
|
File.Move(file, Path.Combine(directory, fileName));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -856,13 +865,11 @@ namespace FlaxEditor.Windows
|
|||||||
{
|
{
|
||||||
if (pluginType == null)
|
if (pluginType == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
foreach (var e in _entries.Keys)
|
foreach (var e in _entries.Keys)
|
||||||
{
|
{
|
||||||
if (e.GetType() == pluginType && _entries.ContainsKey(e))
|
if (e.GetType() == pluginType && _entries.ContainsKey(e))
|
||||||
return _entries[e];
|
return _entries[e];
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user