static DownloadAPI() { if (!active) { int option = EditorUtility.DisplayDialogComplex("Asset message", "It seems you are using some Lerp2Dev content, do you want to download the Lerp2Dev Team API?", "Yes", "No", "Don't remind it more"); switch (option) { case 0: Download(); break; case 2: LerpedCore.SetBool(section, !active); break; default: break; } } //LerpedCore.SetBool(section, !active); }
static LerpedStartCheck() { if (!LerpedCore.GetBool(LerpedCore.UnityBoot)) { LerpedCore.SetBool(LerpedCore.UnityBoot, true); string bPath = Path.GetDirectoryName(LerpedCore.GetString(LerpedEditorCore.buildPath)); if (string.IsNullOrEmpty(bPath)) { bPath = ""; return; } else if (!Directory.Exists(bPath)) { Debug.LogErrorFormat("Your fork from Lerp2API has been moved, re-edit the path under: 'Lerp2Dev Team Tools > Refresh Project API References > Change Path > Build Dependencies Path', click '...' and set the new path, pressing 'Save'.\n'{0}' directory path doesn't exists!", bPath); return; } long estimatedModTime = LerpedCore.GetLong(LerpedEditorCore.lastBuildTime), lastModTime = Helpers.LatestModification(bPath); if (estimatedModTime != lastModTime) { LerpedPaths lp = GetWindow <LerpedPaths>(); lp.iInit(lp, LerpedAPIChange.InEnter); } } }
void OnDestroy() { if (!EditorApplication.isPlayingOrWillChangePlaymode) { LerpedCore.SetBool(LerpedCore.UnityBoot, false); } }
private void Awake() //This must be onenable, only for hook log { LerpedCore.lerpedCore = LerpedCore.AutoHookCore(); Debug.HookLog(!string.IsNullOrEmpty(m_defLogPath) ? m_defLogPath : Path.Combine(Application.dataPath, LerpedCore.defaultLogFilePath)); if (m_runConsoleAtPlayEvent) { ConsoleListener.StartConsole(); } }
public static void __changeDebug() { LerpedCore.SetBool(section, !active); EditorMenu.SetChecked(menuName, active); EditorPrefs.SetBool(menuName, active); if (active) { Debug.Log("Debug is enabled!"); } else { Debug.Log("Debug is disabled!"); } }
private static void HookWatchers() //I have to fix this because it deletes on reload in some editors... { //Detect new file and add them to the solution? (I have to) EditorApplication.update += OnEditorApplicationUpdate; if (!availablePaths) { Debug.LogError("There are one or more paths unsetted, go to Lerp2Dev Team Tools > Refresh Project API Dependencies... to set the paths of the Project in your HDD and the path of this project."); return; } string bPath = LerpedCore.GetString(buildPath); m_Watcher = new LerpedThread <FileSystemWatcher>(t_CompileWatcher, new FSWParams(Path.Combine(Path.GetDirectoryName(bPath), "Project"), "*.cs", NotifyFilters.LastWrite | NotifyFilters.Size, true)); m_Watcher.matchedMethods.Add(WatcherChangeTypes.Changed.ToString(), () => { LerpedPaths lp = EditorWindow.GetWindow <LerpedPaths>(); lp.iInit(lp, LerpedAPIChange.Auto); }); //m_Watcher.Created += new FileSystemEventHandler(); //I have to add files to the raw solution before compile //m_Watcher.Renamed += new FileSystemEventHandler(); //I have to rename files to the raw solution before compile //m_Watcher.Deleted += new FileSystemEventHandler(); //I have to remove files to the raw solution before compile m_Watcher.StartFSW(); }
public void iInit(LerpedPaths rf, LerpedAPIChange change = LerpedAPIChange.Default) { if (rf != null) { rf.Close(); } bool rt = false; if (LerpedEditorCore.availablePaths) { if (LerpedEditorCore.buildPath.Contains(Application.dataPath)) { EditorUtility.DisplayDialog("API Message", "You have reversed the path, you should put in Project API the path from this Project,\nand in Build Path, the path where the DLL are builded!", "Ok"); } else { int r = EditorUtility.DisplayDialogComplex("API Message", GetCaption(change), "Yes", "No", "Change path"); switch (r) { case 0: LerpedEditorCore.UpdateDependencies(); rt = true; return; case 1: rt = true; return; case 2: break; } } } if (rt) { return; } if (me == null) { if (rf == null) { me = GetWindow <LerpedPaths>(); } else { me = rf; } } bPath = LerpedCore.GetString(buildPath); ePath = LerpedCore.GetString(editorPath); //Is null? bPath = string.IsNullOrEmpty(bPath) ? Application.dataPath : bPath; ePath = string.IsNullOrEmpty(ePath) ? Application.dataPath : ePath; me.position = new Rect(Screen.resolutions[0].width / 2 - 200, Screen.resolutions[0].height / 2 - 150, 400, 300); me.Show(); }
internal void SaveChanges() { LerpedCore.SetString(buildPath, bPath); LerpedCore.SetString(editorPath, ePath); me.Close(); }
public static void UpdateDependencies() { string bPath = LerpedCore.GetString(buildPath), bePath = Path.Combine(bPath, "Editor"), bcPath = Path.Combine(bPath, "Console"), brPath = Path.Combine(Path.GetDirectoryName(bPath), "Project/Lerp2Raw"), ePath = LerpedCore.GetString(editorPath), eePath = Path.Combine(ePath, "Editor"), ecPath = Path.Combine(ePath, "Console"), batchPath = Path.Combine(Path.GetDirectoryName(bPath), "Compile/compile.bat"); LerpedCore.SetLong(lastBuildTime, Helpers.LatestModification(Path.GetDirectoryName(bPath))); if (!Directory.Exists(bePath)) { Debug.LogError("Editor path couldn't not be found in Build Path!"); return; } if (!Directory.Exists(eePath)) { Debug.LogError("Editor path couldn't not be found in Project Path!"); return; } if (!File.Exists(batchPath)) { Debug.LogError("Batch compile file couldn't be found, please, download it from Lerp2Dev Repository."); return; } using (var proc = new Process()) { proc.StartInfo.FileName = batchPath; proc.StartInfo.WorkingDirectory = Path.GetDirectoryName(batchPath); //Gracias Elektro: https://foro.elhacker.net/net/processstart_ejecuta_un_batch_y_hace_que_sus_rutas_contiguas_sean_innacesibles-t465478.0.html;msg2109889#msg2109889 //proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; //This will be hidden when the console of the api compiles itsself and could send messages to Unity? proc.Start(); proc.WaitForExit(); //int exitCode = proc.ExitCode; } string[] fbFiles = new string[] { Path.Combine(bPath, "Lerp2API.dll"), Path.Combine(bPath, "Lerp2API.pdb"), Path.Combine(bPath, "Lerp2API.pdb"), Path.Combine(bePath, "Lerp2APIEditor.dll"), Path.Combine(bePath, "Lerp2APIEditor.pdb"), Path.Combine(bePath, "Lerp2APIEditor.xml"), Path.Combine(bcPath, "Lerp2Console.exe"), Path.Combine(bcPath, "Lerp2Console.exe.config"), Path.Combine(bcPath, "Lerp2Console.pdb"), Path.Combine(bcPath, "Lerp2Console.xml") }, feFiles = new string[] { Path.Combine(ePath, "Lerp2API.dll"), Path.Combine(ePath, "Lerp2API.pdb"), Path.Combine(ePath, "Lerp2API.pdb"), Path.Combine(eePath, "Lerp2APIEditor.dll"), Path.Combine(eePath, "Lerp2APIEditor.pdb"), Path.Combine(eePath, "Lerp2APIEditor.xml"), Path.Combine(ecPath, "Lerp2Console.exe"), Path.Combine(ecPath, "Lerp2Console.exe.config"), Path.Combine(ecPath, "Lerp2Console.pdb"), Path.Combine(ecPath, "Lerp2Console.xml") }; //Detect file weight? No, by the moment the Editor makes everything... int i = 0; try { foreach (string b in fbFiles) { if (File.Exists(b)) { File.Copy(b, feFiles[i], true); } else { UnityEngine.Debug.LogErrorFormat("{0} not found!", b); } ++i; } } catch { Debug.LogError("Something gone wrong copying files at Refreshing Dependencies, cancel all new bugged API Messages to Auto Refresh it dependencies! (If this continues, please, restart Unity, we're looking this issue)"); } //Also, copy Lerp2Raw files... foreach (string file in Directory.GetFiles(brPath, "*.cs")) { File.Copy(file, Path.Combine(Application.dataPath, "Lerp2API/AttachedScripts/" + Path.GetFileName(file)), true); } AssetDatabase.Refresh(); int tc = LerpedCore.GetInt(timesCompiled); LerpedCore.SetInt(timesCompiled, ++tc); }
static void OnLoadMethods() { ChangeAPILevelComp(); LerpedCore.HookThis(typeof(LerpedEditorHook)); LerpedCore.HookThis(typeof(LerpedHook)); }