Esempio n. 1
0
        public static ProjectClass.ProjectFile ReadProject(string projFile)
        {
            if (project != null)
            {
                CurrentProjectVariables.ResetProjectVariables();
            }

            if (project == null)
            {
                project = new ProjectClass.ProjectFile();
            }

            if (!File.Exists(projFile))
            {
                ConsoleHandler.append("Something went wrong when trying to read the" +
                                      "project. Project not found...");
                return(null);

                //Create new project
                //CreateProject();  //Commented out until im sure this is what needs to happen next
            }

            if (!IsProjectVald(projFile))
            {
                return(null);
            }

            string json = File.ReadAllText(projFile);

            project = JsonConvert.DeserializeObject <ProjectClass.ProjectFile>(json);

            CurrentProjectVariables.ProjectName            = project.ProjectName.Replace("\\", "");
            CurrentProjectVariables.PathToProjectFiles     = project.PathToProjectFiles.Replace("\\\\", "\\");
            CurrentProjectVariables.PathToProjectClassFile = project.PathToProjectClassFile.Replace("\\\\", "\\");
            CurrentProjectVariables.GameName              = project.GameName;
            CurrentProjectVariables.GamePath              = project.GamePath.Replace("\\\\", "\\");
            CurrentProjectVariables.GameVersion           = project.GameVersion;
            CurrentProjectVariables.JetPassword           = project.JetPassword;
            CurrentProjectVariables.ExportPath            = project.ExportPath;
            CurrentProjectVariables.DateLastOpened        = project.DateLastOpened;
            CurrentProjectVariables.JsonEditor_OpenedTabs = project.JsonEditor_OpenedTabs;
            CurrentProjectVariables.ModifiedFiles         = project.ModifiedFiles;

            CurrentProjectVariables.UseNKHook       = false;
            CurrentProjectVariables.DontAskAboutNKH = false;
            if (CurrentProjectVariables.GameName == "BTD5")
            {
                if (NKHook.DoesNkhExist())
                {
                    CurrentProjectVariables.UseNKHook       = project.UseNKHook;
                    CurrentProjectVariables.DontAskAboutNKH = project.DontAskAboutNKH;
                }
            }

            return(project);
        }
Esempio n. 2
0
 public static void CreateProject()
 {
     project = new ProjectClass.ProjectFile();
     CurrentProjectVariables.ResetProjectVariables();
 }