public override void OnGUI(string searchContext)
        {
            using (new GUIScope())
            {
                var store = PaletteStore.LoadAsset();

                if (store == null)
                {
                    EditorGUILayout.HelpBox(
                        "To use Project Settings, you need to create a PaletteStore to initialize uPalette.",
                        MessageType.Warning);

                    if (GUILayout.Button("Create Palette Store"))
                    {
                        PaletteStore.CreateAsset();
                    }

                    if (GUILayout.Button("Update Version 1 to 2"))
                    {
                        VersionUpdater.Update1To2();
                    }

                    return;
                }

                var projectSettings = UPaletteProjectSettings.instance;

                using (var ccs = new EditorGUI.ChangeCheckScope())
                {
                    store.MissingEntryErrorLevel =
                        (MissingEntryErrorLevel)EditorGUILayout.EnumPopup("Missing Entry Error",
                                                                          store.MissingEntryErrorLevel);

                    if (ccs.changed)
                    {
                        EditorUtility.SetDirty(store);
                    }
                }

                using (var ccs = new EditorGUI.ChangeCheckScope())
                {
                    projectSettings.NameEnumsFileGenerateMode =
                        (NameEnumsFileGenerateMode)EditorGUILayout.EnumPopup("Name Enums File Generation",
                                                                             projectSettings.NameEnumsFileGenerateMode);

                    projectSettings.NameEnumsFolder =
                        (DefaultAsset)EditorGUILayout.ObjectField("Name Enums File Location",
                                                                  projectSettings.NameEnumsFolder,
                                                                  typeof(DefaultAsset), false);

                    if (ccs.changed && projectSettings.NameEnumsFileGenerateMode ==
                        NameEnumsFileGenerateMode.WhenWindowLosesFocus)
                    {
                        EditorPrefs.SetBool(EditorPrefsKey.IsIdOrNameDirtyPrefsKey, true);
                    }
                }
            }
        }
Beispiel #2
0
        static int Main(string[] args)
        {
            if (!ReadExecutionArguments(args, out var projectName, out var assemblyInfo, out var noDialog, out var debug))
            {
                return(-1);
            }
            ;

            Directory.CreateDirectory(Path.GetDirectoryName(ConfigFilePath));

            if (!LoadConfig(ConfigFilePath, out var updaterDictionary))
            {
                updaterDictionary = new Dictionary <string, VersionUpdater>();
            }

            if (!updaterDictionary.TryGetValue(projectName, out var updater))
            {
                updater = new VersionUpdater();
            }

            var currentVersion = Helper.AssemblyInfoFileHelper.ReadAssemblyFileVersion(assemblyInfo);

            Version.Version updatedVersion;
            bool            saveConfig;

            if (noDialog)
            {
                updatedVersion = updater.Update(currentVersion);
                saveConfig     = true;
            }
            else
            {
                var dialog = new Dialog.UpdateDialog();
                dialog.Model.ProjectName    = projectName;
                dialog.Model.VersionUpdater = updater;
                dialog.Model.CurrentVersion = currentVersion;

                if (!(dialog.ShowDialog() is bool result) || result == false)
                {
                    return(1);
                }
                saveConfig     = dialog.Model.SaveConfig;
                updatedVersion = dialog.Model.UpdatedVersion;
            }

            if (currentVersion != updatedVersion)
            {
                Helper.AssemblyInfoFileHelper.WriteAssemblyFileVersion(assemblyInfo, updatedVersion);
            }

            if (saveConfig)
            {
                updaterDictionary[projectName] = updater;
                SaveConfig(ConfigFilePath, updaterDictionary);
            }

            return(0);
        }
Beispiel #3
0
 /// <summary>
 /// Starts the UI updater threads/tasks.
 /// </summary>
 public static void StartUIUpdaters()
 {
     ConnectionStatusUpdater.StartThread();
     ServerListUpdater.StartThread();
     AccountInfoUpdater.StartTask();
     VersionUpdater.StartTask();
     ToastManager.StartThread();
     PingManager.StartThread();
 }
        public static void Main(string[] args)
        {
            if (args.Length != 2)
            {
                throw new ArgumentException($"Expected 2 args, got {args.Length} instead.");
            }

            VersionUpdater.UpdateVersion(args[0], args[1]);
        }
 protected override void OnCreateSplashScreen()
 {
     if (VersionUpdater.hasUpdates())
     {
         WaitForm wf = new WaitForm();
         wf.Message        = "Azuriram bazu podataka. Sacekajte ...";
         this.SplashScreen = wf;
     }
     else
     {
         this.SplashScreen = new SplashScreenForm();
     }
 }
Beispiel #6
0
 public Task Update(IMongoDatabase db)
 {
     lock (_instance)
     {
         if (_update == null)
         {
             _mongoMappers = new MongoMappers();
             _mongoMappers.InitializeMappers();
             var versionUpdater = new VersionUpdater(_updates);
             _update = versionUpdater.Update(db);
         }
     }
     return(_update);
 }
Beispiel #7
0
        public ActionResult Update(Guid pk, string agency, string name, string value)
        {
            using (var db = ApplicationDbContext.Create())
            {
                try
                {
                    // Fetch the appropriate variable by ID.
                    var client   = RepositoryHelper.GetClient();
                    var variable = client.GetLatestItem(pk, agency) as Variable;

                    // Get all related items that will have their versions
                    // increased, because they reference the variable.
                    // That is: PhysicalInstance, DataRelationship, and VariableStatistic.
                    PhysicalInstance  physicalInstance;
                    DataRelationship  dataRelationship;
                    VariableStatistic variableStatistic;
                    GetReferencingItems(client, variable.CompositeId, out physicalInstance, out dataRelationship, out variableStatistic);

                    // Copy information from the POST to the Variable.
                    VariableMapper.UpdateVariableProperty(variable, physicalInstance, dataRelationship, variableStatistic, name, value);

                    // Save the new version of the variable.
                    VersionUpdater.UpdateVersionsAndSave(variable, physicalInstance, dataRelationship, variableStatistic);

                    Guid?piID = physicalInstance?.Identifier;
                    if (piID.HasValue)
                    {
                        var file = db.Files.Where(x => x != null && x.Id == piID)
                                   .FirstOrDefault();
                        if (file != null)
                        {
                            file.HasPendingMetadataUpdates = true;
                            db.SaveChanges();
                        }
                    }


                    // For x-editable, just a simple 200 return is sufficient if things went well.
                    return(Content(value));
                }
                catch (Exception ex)
                {
                    throw new HttpException(500, ex.Message, ex);
                }
            }
        }
Beispiel #8
0
        static async Task CheckRoslynAndNuGet(string mono_repo, string mono_branch_head, string msbuild_repo, string old_msbuild_ref, string new_msbuild_ref, bool verbose = false)
        {
            using var new_fs = await GitHub.GetRaw(msbuild_repo, new_msbuild_ref, VersionsPropsFileName, verbose);

            using var old_fs = await GitHub.GetRaw(msbuild_repo, old_msbuild_ref, VersionsPropsFileName, verbose);

            var new_props = await VersionUpdater.ReadProps(new_fs, false);

            var old_props = await VersionUpdater.ReadProps(old_fs, false);

            if ((new_props.TryGetValue(VersionUpdater.RoslynPackagePropertyName, out var new_version) &&
                 old_props.TryGetValue(VersionUpdater.RoslynPackagePropertyName, out var old_version)))
            {
                if (string.Compare(new_version, old_version) != 0)
                {
                    Console.WriteLine($"\n** NOTE: Roslyn will need an update. It changed from '{old_version}' to '{new_version}'\n");
                }
            }
        private async void UpdateCommandExecute(object obj)
        {
            await VersionChecker.GetUpdatesInformation(true).ContinueWith(async task =>
            {
                var updatesInfo = task.Result;
                if (!updatesInfo.HasNewVersion)
                {
                    VersionChanges = "Версія програми є найновішою, оновлення не виконано.";
                    return;
                }

                await VersionUpdater.StartUpdate(() =>
                {
                    if (CloseApplicationEventHandler != null)
                    {
                        CloseApplicationEventHandler(this, EventArgs.Empty);
                    }
                });
            }, TaskContinuationOptions.OnlyOnRanToCompletion);
        }
Beispiel #10
0
        static bool LoadConfig(string filePath, out Dictionary <string, VersionUpdater> updaterDictionary)
        {
            try {
                if (!File.Exists(filePath))
                {
                    updaterDictionary = null;
                    return(false);
                }

                updaterDictionary = new Dictionary <string, VersionUpdater>();
                var doc = XDocument.Load(filePath);

                foreach (var element in doc.Element("Pairs").Elements())
                {
                    var projectName       = element.Element("ProjectName").Value;
                    var updateRuleElement = element.Element("Updater");
                    var updateModel       = new VersionUpdater(
                        convert(updateRuleElement.Element("MajorVersion")),
                        convert(updateRuleElement.Element("MinorVersion")),
                        convert(updateRuleElement.Element("BuildNumber")),
                        convert(updateRuleElement.Element("RevisionNumber"))
                        );
                    updaterDictionary.Add(projectName, updateModel);
                }

                return(true);
            }
            catch {
                updaterDictionary = null;
                return(false);
            }

            VersionUpdateRule convert(XElement x)
            {
                var method   = (VersionUpdateMethod)Enum.Parse(typeof(VersionUpdateMethod), x.Element(nameof(VersionUpdateRule.Method)).Value);
                var argument = x.Element(nameof(VersionUpdateRule.Argument)).Value is string s && s != "null" ? s : null;

                return(new VersionUpdateRule(method, argument));
            }
        }
        public override bool Execute()
        {
            List <String>  buildoptions = new List <string>();
            Options        options      = null;
            string         input        = null;
            VersionUpdater updater      = null;
            StringBuilder  message      = new StringBuilder();

            ///////////////////////////////////////////////////////////////////
            // validate the options
            try
            {
                if (string.IsNullOrEmpty(m_startDateOption) == false)
                {
                    buildoptions.Add("-s");
                    buildoptions.Add(m_startDateOption);
                }
                if (string.IsNullOrEmpty(m_buildOption) == false)
                {
                    buildoptions.Add("-b");
                    buildoptions.Add(m_buildOption);
                }
                if (string.IsNullOrEmpty(m_pinOption) == false)
                {
                    buildoptions.Add("-p");
                    buildoptions.Add(m_pinOption);
                }
                if (string.IsNullOrEmpty(m_revisionOption) == false)
                {
                    buildoptions.Add("-r");
                    buildoptions.Add(m_revisionOption);
                }
                if (string.IsNullOrEmpty(m_inputFile) == false)
                {
                    buildoptions.Add("-i");
                    buildoptions.Add(m_inputFile);
                }
                if (string.IsNullOrEmpty(m_outputFile) == false)
                {
                    buildoptions.Add("-o");
                    buildoptions.Add(m_outputFile);
                }
                if (string.IsNullOrEmpty(m_versionOption) == false)
                {
                    buildoptions.Add("-v");
                    buildoptions.Add(m_versionOption);
                }

                options = new Options(buildoptions.ToArray());
            }
            catch (Exception e)
            {
                message.AppendLine("Error validating options.");
                message.AppendLine(e.Message);
                message.AppendLine();
                message.AppendLine(Options.Usage);
                Log.LogError(message.ToString());
                return(false);
            }

            ///////////////////////////////////////////////////////////////////
            // Get the input
            try
            {
                input = GetInput(options);
            }
            catch (Exception e)
            {
                message.AppendLine("Error reading input.");
                message.AppendLine(e.Message);
                Log.LogError(message.ToString());
                return(false);
            }

            ///////////////////////////////////////////////////////////////////
            // Update the version number in the input
            try
            {
                updater = new VersionUpdater(input, options);
            }
            catch (Exception e)
            {
                message.AppendLine("Error updating version.");
                message.AppendLine(e.Message);
                Log.LogError(message.ToString());
                return(false);
            }

            ///////////////////////////////////////////////////////////////////
            // Write the output
            try
            {
                m_updatedInput = updater.Output;

                if (String.IsNullOrEmpty(options.OutputFilename) == false)
                {
                    using (StreamWriter writer =
                               new StreamWriter(options.OutputFilename, false, Encoding.Default))
                    {
                        writer.Write(m_updatedInput);
                    }
                }
            }
            catch (Exception e)
            {
                message.AppendLine("Error writing output.");
                message.AppendLine(e.Message);
                Log.LogError(message.ToString());
                return(false);
            }

            // Return normally
            return(true);
        }