Patcher.Rules.Proxies.Proxy.EnsureWritable C# (CSharp) Method

EnsureWritable() protected method

protected EnsureWritable ( ) : void
return void
        protected void EnsureWritable()
        {
            // Only Target form is writable
            if (Mode != ProxyMode.Target)
            {
                // Provide a specific reason depending on the proxy mode
                if (Mode == ProxyMode.Source)
                    throw new RuntimeException("The Source form cannot be modified.", RuntimeError.ReadOnlyProxy);

                if (Mode == ProxyMode.Discovered)
                    throw new RuntimeException("Forms retrieved via Forms.FindForm() and similar cannot be modified.", RuntimeError.ReadOnlyProxy);

                if (Mode == ProxyMode.Referenced)
                    throw new RuntimeException("Forms retrieved from a references cannot be modified.", RuntimeError.ReadOnlyProxy);
            }
        }