public static IceCreamProject OpenProjectFile(string filename) { XmlSerializer _ser = new XmlSerializer(typeof(IceCreamProject)); Stream _stream = File.Open(filename, FileMode.Open); IceCreamProject _proj = (IceCreamProject)_ser.Deserialize(_stream); //_proj.LoadAssemblies(__proj.RootDIR + @"bin\x86\Debug\"); Instance = _proj; _stream.Close(); return _proj; }
public static IceCreamProject OpenProjectFile(string filename) { XmlSerializer _ser = new XmlSerializer(typeof(IceCreamProject)); Stream _stream = File.Open(filename, FileMode.Open); IceCreamProject _proj = (IceCreamProject)_ser.Deserialize(_stream); //_proj.LoadAssemblies(__proj.RootDIR + @"bin\x86\Debug\"); Instance = _proj; _stream.Close(); return(_proj); }
public IceCreamProject() { _filename = ""; _path = ""; _name = "New Project"; _description = "This is a new project"; _visualStudioProjectPath = ""; _contentFolderRelativePath = ""; _binaryFolderRelativePath = ""; _lastOpenedScene = ""; _currentSceneFile = ""; IceSceneComponents = new Dictionary <Type, Assembly>(); IceSceneItemComponents = new Dictionary <Type, Assembly>(); Instance = this; }
private void LoadProjectData(string filename) { try { LoadingForm.ChangeStatus("Loading Project", 0); _currentProject = IceCreamProject.OpenProjectFile(filename); _preferences.LastOpenedProject = filename; _currentProject.Path = Path.GetDirectoryName(filename); _currentProject.Filename = Path.GetFileName(filename); string binPath = Path.Combine(_currentProject.Path, _currentProject.BinaryFolderRelativePath); Microsoft.Build.BuildEngine.Project _p = new Microsoft.Build.BuildEngine.Project(); _p.Load(Path.Combine(_currentProject.Path, _currentProject.VisualStudioProjectPath)); string str = _p.EvaluatedProperties["AssemblyName"].Value; _currentProject.GameExe = str + ".exe"; _currentProject.VSProj = _p; LoadingForm.ChangeStatus("Loading Assemblies", 0); CopyAssembliesFromProject(); ComponentTypeContainer.LoadAssemblyInformation(Path.GetDirectoryName(Application.ExecutablePath)); ComponentTypeContainer.LoadAssemblyInformation(binPath); LoadingForm.ChangeStatus("Reading Assembly Info", 0); LoadAssemblyInformation(); LoadingForm.ChangeStatus("Loading Global Project Data", 0); SceneManager.InitializeEmbedded(this.sceneEditorControl.Services, true); SceneManager.LoadGlobalData(_currentProject.Path); LoadingForm.ChangeStatus("Initializing Global Data", 0); SceneManager.InitializeGlobal(this.sceneEditorControl.Services, false); LoadingForm.ChangeStatus("Loading Global Textures", 0); LoadTextures(SceneManager.GlobalDataHolder); LoadingForm.ChangeStatus("Finished Loading Project Data", 100); _fileWatcher.Path = binPath; _fileWatcher.EnableRaisingEvents = true; } catch (Exception e) { MilkshakeForm.ShowErrorMessage(e); LoadingForm.HideForm(); _preferences.LastOpenedProject = ""; _preferences.Save(); } }
private void MilkshakeForm_Load(object sender, EventArgs e) { InitializeNodes(); _preferences = MilkshakePreferences.Load(); sceneEditorControl.Preferences = _preferences; this.SceneEditorTool = MilkshakeSceneEditorTool.Select; if (_preferences.ForceWindowParametersAtStartup == true) { this.Left = _preferences.LastEditorPosition.X; this.Top = _preferences.LastEditorPosition.Y; this.Size = new Size(_preferences.LastEditorSize.X, _preferences.LastEditorSize.Y); this.WindowState = _preferences.LastEditorMaximizedState ? FormWindowState.Maximized : FormWindowState.Normal; } if (_projToLoad != string.Empty) { LoadProject(_projToLoad); } else { if (_preferences.EditorStartupAction == MilkshakePreferencesEditorStartupAction.OpenStartupWizard) { _currentProject = new IceCreamProject(); _projectWasModified = true; } else if (_preferences.EditorStartupAction == MilkshakePreferencesEditorStartupAction.OpenLastEditedProject && String.IsNullOrEmpty(_preferences.LastOpenedProject) == false) { try { LoadProject(_preferences.LastOpenedProject); } catch { } } } RefreshEditorStatus(); // focus by default on the scene sceneEditorControl.Focus(); }
public MilkshakeForm(string projToLoad) { //Sprite testPlanet = new Sprite(); //testPlanet.AddComponent(new FarseerBodyCircle()); //XmlWriterSettings xmlSettings = new XmlWriterSettings(); //xmlSettings.Indent = true; //using (XmlWriter xmlWriter = XmlWriter.Create("test.xml", xmlSettings)) //{ // IntermediateSerializer.Serialize(xmlWriter, testPlanet, null); //} InitializeComponent(); Instance = this; _currentProject = null; _contentBuilder = new ContentBuilder(); _sceneItemsTypeTable = GetSceneItemTypesTable(); Trace.WriteLine("Startup", "MilkShake Main"); //Trace.Listeners.Add(new DebugTraceListener()); _fileWatcher = new FileSystemWatcher(); _fileWatcher.Changed += new FileSystemEventHandler(_fileWatcher_Changed); _fileWatcher.NotifyFilter = NotifyFilters.LastWrite; _fileWatcher.Filter = "*.exe"; _projToLoad = projToLoad; }
private void OpenNewProjectWizardAndProcessResult() { if (_sceneWasModified || _projectWasModified) { if (ShowWarningQuestion("The project was modified, if you open a new project all changes will be lost.\nDo you want to close it without saving?") == false) { return; } } CloseActiveScene(); _currentProject = null; ProjectWasModified = true; sceneEditorControl.HighlightedItem = null; sceneEditorControl.SelectedItems.Clear(); RefreshEditorStatus(); }
private void LoadProjectData(string filename) { try { LoadingForm.ChangeStatus("Loading Project", 0); _currentProject = IceCreamProject.OpenProjectFile(filename); _preferences.LastOpenedProject = filename; _currentProject.Path = Path.GetDirectoryName(filename); _currentProject.Filename = Path.GetFileName(filename); string binPath = Path.Combine(_currentProject.Path, _currentProject.BinaryFolderRelativePath); String projectPath = Path.Combine(_currentProject.Path, _currentProject.VisualStudioProjectPath); Microsoft.Build.Evaluation.Project _p = new Microsoft.Build.Evaluation.Project(projectPath); _p.Build(); string str = _p.GetPropertyValue("AssemblyName"); _currentProject.GameExe = str + ".exe"; _currentProject.VSProj = _p; // finding Content Project foreach (var item in _p.AllEvaluatedItems) { if (item.ItemType == "ProjectReference") { ProjectMetadata previousMetadata = null; foreach (var metadata in item.Metadata) { if (metadata.Name == "XnaReferenceType" && metadata.EvaluatedValue == "Content") { if (previousMetadata == null) { throw new Exception("Found XnaContent Project reference but Metadata order is incorrect"); } _currentProject.ContentFolderPath = Path.Combine(_currentProject.Path, Path.GetDirectoryName(item.UnevaluatedInclude)); } previousMetadata = metadata; } } } LoadingForm.ChangeStatus("Loading Assemblies", 0); CopyAssembliesFromProject(); ComponentTypeContainer.LoadAssemblyInformation(Path.GetDirectoryName(Application.ExecutablePath)); ComponentTypeContainer.LoadAssemblyInformation(binPath); LoadingForm.ChangeStatus("Reading Assembly Info", 0); LoadAssemblyInformation(); LoadingForm.ChangeStatus("Loading Global Project Data", 0); SceneManager.InitializeEmbedded(this.sceneEditorControl.Services, true); SceneManager.LoadGlobalData(_currentProject.ContentFolderPath); LoadingForm.ChangeStatus("Initializing Global Data", 0); SceneManager.InitializeGlobal(this.sceneEditorControl.Services, false); LoadingForm.ChangeStatus("Loading Global Textures", 0); LoadTextures(SceneManager.GlobalDataHolder); LoadingForm.ChangeStatus("Finished Loading Project Data", 100); _fileWatcher.Path = binPath; _fileWatcher.EnableRaisingEvents = true; } catch (Exception e) { MilkshakeForm.ShowErrorMessage(e); LoadingForm.HideForm(); _preferences.LastOpenedProject = ""; _preferences.Save(); } }
public IceCreamProject() { _filename = ""; _path = ""; _name = "New Project"; _description = "This is a new project"; _visualStudioProjectPath = ""; _contentFolderRelativePath = ""; _binaryFolderRelativePath = ""; _lastOpenedScene = ""; _currentSceneFile = ""; IceSceneComponents = new Dictionary<Type, Assembly>(); IceSceneItemComponents= new Dictionary<Type, Assembly>(); Instance = this; }