Ejemplo n.º 1
0
        bool CheckReferenceCycles(AudioContainerSettings settings, List <AudioSettingsBase> references)
        {
            bool isCycling = false;

            if (settings != null && settings.Sources != null)
            {
                for (int i = 0; i < settings.Sources.Count; i++)
                {
                    var source = settings.Sources[i];

                    if (source == null || source.Settings == null || isCycling)
                    {
                        continue;
                    }

                    if (references.Contains(source.Settings))
                    {
                        source.Settings = null;
                        isCycling       = true;
                    }
                    else
                    {
                        references.Add(source.Settings);
                        var containerSettings = source.Settings as AudioContainerSettings;

                        if (containerSettings != null)
                        {
                            isCycling |= CheckReferenceCycles(containerSettings, references);
                        }

                        references.Remove(source.Settings);
                    }
                }
            }

            return(isCycling);
        }
        bool CheckReferenceCycles(AudioContainerSettings settings, List<AudioSettingsBase> references)
        {
            bool isCycling = false;

            if (settings != null && settings.Sources != null)
            {
                for (int i = 0; i < settings.Sources.Count; i++)
                {
                    var source = settings.Sources[i];

                    if (source == null || source.Settings == null || isCycling)
                        continue;

                    if (references.Contains(source.Settings))
                    {
                        source.Settings = null;
                        isCycling = true;
                    }
                    else
                    {
                        references.Add(source.Settings);
                        var containerSettings = source.Settings as AudioContainerSettings;

                        if (containerSettings != null)
                            isCycling |= CheckReferenceCycles(containerSettings, references);

                        references.Remove(source.Settings);
                    }
                }
            }

            return isCycling;
        }