Example #1
0
        public override void DocumentChanged()
        {
            // Clear the list.
            this.listView1.Items.Clear();

            if (manager.Opened)
            {
                //	Update main form heading.
                this.Text = Application.ProductName + " - " + manager.Document.Name;
                JavaProperties properties = ((JavaPropertiesDocument)manager.Document).Properties;

                //	Update the content window.
                foreach (String key in properties.Keys)
                {
                    ListViewItem item = new ListViewItem(key);
                    String       text = properties.GetProperty(key);
                    item.SubItems.Add(new ListViewItem.ListViewSubItem(item, text));

                    this.listView1.Items.Add(item);
                }
            }
            else
            {
                //	Update main form heading.
                this.Text = Application.ProductName;
            }

            //	Force a display update.
            this.Refresh();
        }
Example #2
0
        public override String GetPropertyValue(String key)
        {
            if (_properties == null)
            {
                return(null);
            }

            return(_properties.GetProperty(key));
        }
        public void LoadSettings()
        {
            FileStream stream = new FileStream(pathSettings, FileMode.Open);

            try
            {
                JavaProperties settings = new JavaProperties();
                settings.Load(stream);
                pathSongs   = settings.GetProperty("pathSongs");
                pathReplays = settings.GetProperty("pathReplays");
                pathOsuDB   = settings.GetProperty("pathOsuDB");
                Console.WriteLine(pathOsuDB);
                osuDbP = new OsuDbAPI.OsuDbFile(pathOsuDB);
            }
            catch (Exception exp)
            {
                Console.WriteLine("Error parsing settings:\n" + exp.ToString());
            }
            finally
            {
                stream.Close();
            }
        }
Example #4
0
 public string lookup(string key)
 {
     return(_properties.GetProperty(key));
 }
        bool IsInstalled(AndroidToolchainComponent component, string path, out bool missing)
        {
            missing = true;
            if (!Directory.Exists(path))
            {
                Log.DebugLine($"Component '{component.Name}' directory does not exist: {path}");
                return(false);
            }

            // This is just a cursory check, we might want to check versions
            string propsFile = Path.Combine(path, "source.properties");

            if (!File.Exists(propsFile))
            {
                Log.DebugLine($"Component '{component.Name}' properties file does not exist: {propsFile}");
                return(false);
            }

            missing = false;
            if ((RefreshSdk && !IsNdk(component)) || (RefreshNdk && IsNdk(component)))
            {
                Log.DebugLine($"A reinstall has been requested for component '{component.Name}'");
                return(false);
            }

            if (String.IsNullOrEmpty(component.PkgRevision))
            {
                Log.DebugLine($"Component '{component.Name}' does not specify required Pkg.Revision, assuming it's valid");
                return(true);
            }

            Log.DebugLine($"Component '{component.Name}' requires Pkg.Revision to be '{component.PkgRevision}', verifying");
            var props = new JavaProperties();

            try {
                using (var fs = File.OpenRead(propsFile)) {
                    props.Load(fs);
                }
            } catch (Exception ex) {
                Log.DebugLine($"Failed to read '{component.Name}' source.properties. Assuming invalid version, component will be reinstalled.");
                Log.DebugLine(ex.ToString());
                return(false);
            }

            string pkgRevision = props.GetProperty("Pkg.Revision", String.Empty);

            if (String.IsNullOrEmpty(pkgRevision))
            {
                Log.DebugLine($"Component '{component.Name}' does not have Pkg.Revision in its source.properties file, it will be reinstalled.");
                return(false);
            }

            if (!ParseVersion(pkgRevision, out Version pkgVer))
            {
                Log.DebugLine($"Failed to parse a valid version from Pkg.Revision ({pkgRevision}) for component '{component.Name}'. Component will be reinstalled.");
                return(false);
            }

            if (!ParseVersion(component.PkgRevision, out Version expectedPkgVer))
            {
                throw new InvalidOperationException($"Invalid expected package version for component '{component.Name}': {component.PkgRevision}");
            }

            bool equal = pkgVer == expectedPkgVer;

            if (!equal)
            {
                Log.DebugLine($"Installed version of '{component.Name}' ({pkgVer}) is different than the required one ({expectedPkgVer})");
            }

            return(equal);
        }