Пример #1
0
        public void Load()
        {
            var config = WorkspaceConfig.Load();

            Open(config.CitrusProject);
            The.UI.LoadFromWorkspaceConfig(config);
        }
Пример #2
0
 public static void Save(WorkspaceConfig config)
 {
     using (FileStream stream = new FileStream(GetConfigPath(), FileMode.Create, FileAccess.Write, FileShare.None)) {
         var js = new Yuzu.Json.JsonSerializer();
         js.ToStream(config, stream);
     }
 }
Пример #3
0
        public void RemoveRecentProject(string projectPath)
        {
            var config = WorkspaceConfig.Load();

            config.RemoveRecentProject(projectPath);
            WorkspaceConfig.Save(config);
        }
Пример #4
0
        public override void LoadFromWorkspaceConfig(WorkspaceConfig config)
        {
            var newIndex = config.ActiveTargetIndex;

            if (newIndex < 0 || newIndex >= platformPicker.Items.Count)
            {
                newIndex = 0;
            }
            platformPicker.Index       = newIndex;
            updateVcs.CheckBox.Checked = config.UpdateBeforeBuild;
            projectPicker.ChosenFile   = config.CitrusProject;
            if (config.ClientPosition.X < 0)
            {
                config.ClientPosition.X = 0;
            }
            if (config.ClientPosition.Y < 0)
            {
                config.ClientPosition.Y = 0;
            }
            if (config.ClientPosition != Vector2.Zero)
            {
                window.ClientPosition = config.ClientPosition;
            }
            if (config.ClientSize != Vector2.Zero)
            {
                window.ClientSize = config.ClientSize;
            }
        }
Пример #5
0
        public override void LoadFromWorkspaceConfig(WorkspaceConfig config)
        {
            var newIndex = config.ActiveTargetIndex;

            if (newIndex < 0 || newIndex >= platformPicker.Items.Count)
            {
                newIndex = 0;
            }
            platformPicker.Index     = newIndex;
            projectPicker.ChosenFile = config.CitrusProject;
            if (config.ClientPosition.X < 0)
            {
                config.ClientPosition.X = 0;
            }
            if (config.ClientPosition.Y < 0)
            {
                config.ClientPosition.Y = 0;
            }
            if (config.ClientPosition != Vector2.Zero)
            {
                window.ClientPosition = config.ClientPosition;
            }
            if (config.ClientSize != Vector2.Zero)
            {
                window.ClientSize = config.ClientSize;
            }
            UpdateCacheModeCheckboxes(config.AssetCacheMode);
            UpdateBundlePicker(config.BundlePickerVisible);
        }
Пример #6
0
        public void Load(string projectFilePath = null)
        {
            // heuristic behavior: always try to go up and search for a citproj file
            // if found, ignore the one saved in app data, since we're opening citrus directory
            // related to found game project as a submodule
            var config = WorkspaceConfig.Load();

            if (projectFilePath != null)
            {
                Open(projectFilePath);
            }
            else if (Toolbox.TryFindCitrusProjectForExecutingAssembly(out projectFilePath))
            {
                Open(projectFilePath);
            }
            var projectConfig = config.GetProjectConfig(projectFilePath);

            The.UI.LoadFromWorkspaceConfig(config, projectConfig);
            var citrusVersion = CitrusVersion.Load();

            if (citrusVersion.IsStandalone)
            {
                Console.WriteLine($"Welcome to Citrus. Version {citrusVersion.Version}, build number: {citrusVersion.BuildNumber}");
            }
            BenchmarkEnabled = config.BenchmarkEnabled;
            if (projectConfig != null)
            {
                BundlePickerVisible = projectConfig.BundlePickerVisible;
            }
#pragma warning disable CS4014
            Orange.Updater.CheckForUpdates();
#pragma warning restore CS4014
            LoadCacheSettings();
        }
Пример #7
0
        public void Save()
        {
            var config = WorkspaceConfig.Load();

            config.CitrusProject = ProjectFile;
            The.UI.SaveToWorkspaceConfig(ref config);
            WorkspaceConfig.Save(config);
        }
Пример #8
0
        public string GetTangerineCacheBundlePath()
        {
            var name = string
                       .Join("_", ProjectFilePath.Split(new[] { "\\", "/", ":" }, StringSplitOptions.RemoveEmptyEntries))
                       .ToLower(System.Globalization.CultureInfo.InvariantCulture);

            name = Path.ChangeExtension(name, "tancache");
            return(Path.Combine(WorkspaceConfig.GetDataPath(), name));
        }
Пример #9
0
 public override void SaveToWorkspaceConfig(ref WorkspaceConfig config)
 {
     config.ActiveTargetIndex   = platformPicker.Index;
     config.BundlePickerVisible = bundlePickerWidget.Visible;
     if (window.State != WindowState.Minimized)
     {
         config.ClientPosition = window.ClientPosition;
         config.ClientSize     = window.ClientSize;
     }
 }
Пример #10
0
 public override void SaveToWorkspaceConfig(ref WorkspaceConfig config)
 {
     config.UpdateBeforeBuild = DoesNeedSvnUpdate();
     config.ActiveTargetIndex = platformPicker.Index;
     if (window.State != WindowState.Minimized)
     {
         config.ClientPosition = window.ClientPosition;
         config.ClientSize     = window.ClientSize;
     }
 }
Пример #11
0
        public override void LoadFromWorkspaceConfig(WorkspaceConfig config)
        {
            var newIndex = config.ActiveTargetIndex;

            if (newIndex < 0 || newIndex >= platformPicker.Items.Count)
            {
                newIndex = 0;
            }
            platformPicker.Index       = newIndex;
            updateVcs.CheckBox.Checked = config.UpdateBeforeBuild;
            projectPicker.ChosenFile   = config.CitrusProject;
        }
Пример #12
0
        public void Save()
        {
            var config = WorkspaceConfig.Load();

            config.RegisterRecentProject(ProjectFilePath);
            var projectConfig = config.GetProjectConfig(ProjectFilePath);

            if (projectConfig != null)
            {
                projectConfig.AssetCacheMode = AssetCacheMode;
            }
            The.UI.SaveToWorkspaceConfig(ref config, projectConfig);
            WorkspaceConfig.Save(config);
        }
Пример #13
0
        public void LoadCacheSettings()
        {
            var config = WorkspaceConfig.Load();

            if (ProjectFile != string.Empty)
            {
                AssetCacheMode      = config.AssetCacheMode;
                LocalAssetCachePath = config.LocalAssetCachePath;
                if (ProjectDirectory != null && !Path.IsPathRooted(LocalAssetCachePath))
                {
                    LocalAssetCachePath = Path.Combine(ProjectDirectory, LocalAssetCachePath);
                }
            }
        }
Пример #14
0
        public void LoadCacheSettings()
        {
            var config        = WorkspaceConfig.Load();
            var projectConfig = config.GetProjectConfig(ProjectFilePath);

            if (projectConfig != null)
            {
                AssetCacheMode      = projectConfig.AssetCacheMode;
                LocalAssetCachePath = projectConfig.LocalAssetCachePath;
                if (ProjectDirectory != null && !Path.IsPathRooted(LocalAssetCachePath))
                {
                    LocalAssetCachePath = Path.Combine(ProjectDirectory, LocalAssetCachePath);
                }
            }
        }
Пример #15
0
        public void Load()
        {
            var config = WorkspaceConfig.Load();

            Open(config.CitrusProject);
            The.UI.LoadFromWorkspaceConfig(config);
            var citrusVersion = CitrusVersion.Load();

            if (citrusVersion.IsStandalone)
            {
                Console.WriteLine($"Welcome to Citrus. Version {citrusVersion.Version}, build number: {citrusVersion.BuildNumber}");
            }
#pragma warning disable CS4014
            Orange.Updater.CheckForUpdates();
#pragma warning restore CS4014
        }
Пример #16
0
 public override void LoadFromWorkspaceConfig(WorkspaceConfig config, ProjectConfig projectConfig)
 {
     if (config.ClientPosition.X < 0)
     {
         config.ClientPosition.X = 0;
     }
     if (config.ClientPosition.Y < 0)
     {
         config.ClientPosition.Y = 0;
     }
     if (config.ClientPosition != Vector2.Zero)
     {
         window.ClientPosition = config.ClientPosition;
     }
     if (config.ClientSize != Vector2.Zero)
     {
         window.ClientSize = config.ClientSize;
     }
     if (config.WindowState != WindowState.Minimized)
     {
         window.State = config.WindowState;
     }
     if (projectConfig != null)
     {
         var newIndex = projectConfig.ActiveTargetIndex;
         if (newIndex < 0 || newIndex >= platformPicker.Items.Count)
         {
             newIndex = 0;
         }
         platformPicker.Index = newIndex;
         UpdateCacheModeCheckboxes(projectConfig.AssetCacheMode);
         UpdateBundlePicker(projectConfig.BundlePickerVisible);
     }
     else
     {
         UpdateBundlePicker(false);
         startPageWidget = ProduceStartPage(config.RecentProjects);
         windowWidget.Nodes.Clear();
         windowWidget.AddNode(startPageWidget);
     }
 }
Пример #17
0
        public void Load()
        {
            var config          = WorkspaceConfig.Load();
            var citrusDirectory = Toolbox.CalcCitrusDirectory();

            {
                // heuristic behavior: always try to go up and search for a citproj file
                // if found, ignore the one saved in app data, since we're opening citrus directory
                // related to found game project as a submodule
                var directoryInfo = (new DirectoryInfo(citrusDirectory)).Parent;
                while (directoryInfo != null)
                {
                    var citprojFiles = directoryInfo.EnumerateFiles("*.citproj");
                    if (citprojFiles.Any())
                    {
                        config.CitrusProject = citprojFiles.First().FullName;
                        break;
                    }
                    directoryInfo = directoryInfo.Parent;
                }
            }
            Open(config.CitrusProject);
            The.UI.LoadFromWorkspaceConfig(config);
            var citrusVersion = CitrusVersion.Load();

            if (citrusVersion.IsStandalone)
            {
                Console.WriteLine($"Welcome to Citrus. Version {citrusVersion.Version}, build number: {citrusVersion.BuildNumber}");
            }
            BenchmarkEnabled    = config.BenchmarkEnabled;
            BundlePickerVisible = config.BundlePickerVisible;
#pragma warning disable CS4014
            Orange.Updater.CheckForUpdates();
#pragma warning restore CS4014
            LoadCacheSettings();
        }
Пример #18
0
 public static void Save(WorkspaceConfig config) => persistence.WriteObjectToFile(GetConfigPath(), config, Persistence.Format.Json);
Пример #19
0
 public override void SaveToWorkspaceConfig(ref WorkspaceConfig config)
 {
     config.UpdateBeforeBuild = DoesNeedSvnUpdate();
     config.ActiveTargetIndex = platformPicker.Index;
 }
Пример #20
0
 public virtual void LoadFromWorkspaceConfig(WorkspaceConfig config)
 {
 }
Пример #21
0
 public virtual void SaveToWorkspaceConfig(ref WorkspaceConfig config)
 {
 }
Пример #22
0
 public virtual void SaveToWorkspaceConfig(ref WorkspaceConfig config, ProjectConfig projectConfig)
 {
 }
Пример #23
0
 public virtual void LoadFromWorkspaceConfig(WorkspaceConfig config, ProjectConfig projectConfig)
 {
 }
Пример #24
0
        public static string GetCodeCachePath()
        {
            var name = string.Join("_", The.Workspace.ProjectFilePath.Split(new string[] { "\\", "/", ":" }, StringSplitOptions.RemoveEmptyEntries)).ToLower(CultureInfo.InvariantCulture);

            return(Path.Combine(WorkspaceConfig.GetDataPath(), name, "code_cooker_cache.json"));
        }