Пример #1
0
        public override void SyncTo(ProjectBase projectBase, bool performTranslation)
        {
#if GLUE
            Load(FullFileName);

            AddCodeBuildItems(projectBase);

            AddContentFileItemsFrom(projectBase);

            if (NeedToSaveContentProject)
            {
                ContentProject.Save(ContentProject.FullFileName);
            }

            Save(FullFileName);
#endif
        }
        public override void SyncTo(ProjectBase projectBase, bool performTranslation)
        {
#if GLUE
            Load(FullFileName);

            AddCodeBuildItems(projectBase);

            Plugins.EmbeddedPlugins.SyncedProjects.SyncedProjectLogic.Self.SyncContentFromTo(projectBase, this);

            if (NeedToSaveContentProject)
            {
                ContentProject.Save(ContentProject.FullFileName);
            }

            Save(FullFileName);
#endif
        }
Пример #3
0
        public static void SaveProjects()
        {
            lock (mProjectBase)
            {
                bool shouldSync = false;
                // IsDirty means that the project has items that haven't
                // been updated to the "evaluated" list, not if it needs to
                // be saved.
                //if (mProjectBase != null && mProjectBase.IsDirty)
                if (mProjectBase != null)
                {
                    bool succeeded = true;
                    try
                    {
                        mProjectBase.Save(mProjectBase.FullFileName);
                    }
                    catch (UnauthorizedAccessException)
                    {
                        MessageBox.Show("Could not save the file because the file is in use");
                        succeeded = false;
                    }

                    if (succeeded)
                    {
                        shouldSync = true;
                    }
                }
                if (ContentProject != null && ContentProject != mProjectBase)
                {
                    ContentProject.Save(ContentProject.FullFileName);
                    shouldSync = true;
                }

                //Save projects in case they are dirty
                foreach (var syncedProject in mSyncedProjects)
                {
                    try
                    {
                        syncedProject.Save(syncedProject.FullFileName);
                    }
                    catch (Exception e)
                    {
                        PluginManager.ReceiveError(e.ToString());
                        syncedProject.IsDirty = true;
                    }
                    if (syncedProject.ContentProject != syncedProject)
                    {
                        syncedProject.ContentProject.Save(syncedProject.ContentProject.FullFileName);
                    }
                }

                //Sync all synced projects
                if (shouldSync || mHaveNewProjectsBeenSyncedSinceSave)
                {
                    var syncedProjects = mSyncedProjects.ToArray();
                    foreach (var syncedProject in syncedProjects)
                    {
                        ProjectSyncer.SyncProjects(mProjectBase, syncedProject, false);
                    }
                }

                // It may be that only the synced projects have changed, so we have to save those:
                foreach (var syncedProject in mSyncedProjects)
                {
                    syncedProject.Save(syncedProject.FullFileName);
                    if (syncedProject != syncedProject.ContentProject)
                    {
                        syncedProject.ContentProject.Save(syncedProject.ContentProject.FullFileName);
                    }
                }

                mHaveNewProjectsBeenSyncedSinceSave = false;
            }
        }