/// <summary>
 /// Creates an Exponent command if one has not been allocated.
 /// </summary>
 /// <returns>
 /// Returns an allocated Exponent command.
 /// </returns>
 public override Exponent createExponentCommand()
 {
     if (exponent == null)
     {
         exponent = new Exponent();
     }// end if
     return new Exponent();
 }
Beispiel #2
0
        public override string ToString()
        {
            string res;

            if (Prefix.CompareTo(Constant.MinusOne))
            {
                res = "-" + Identifier.ToString();
            }
            else if (!Prefix.CompareTo(Constant.One))
            {
                res = Prefix.ToString() + Identifier.ToString();
            }
            else
            {
                res = Identifier.ToString();
            }

            if (!Exponent.CompareTo(Constant.One))
            {
                res += "^" + Exponent.ToString();
            }

            return(res);
        }
 public override void SyncGestalt()
 {
     if (false == Double.IsNaN(Base))
     {
         if (Exponent != Int32.MinValue && Exponent != 0)
         {
             SetPropRowValue(CswEnumNbtSubFieldName.Gestalt, CswEnumNbtPropColumn.Gestalt, Base.ToString() + "E" + Exponent.ToString());
         }
         else
         {
             SetPropRowValue(CswEnumNbtSubFieldName.Gestalt, CswEnumNbtPropColumn.Gestalt, Base.ToString());
         }
     }
 }
        public void getOperatorTest()
        {
            Exponent pow = new Exponent();

            Assert.AreEqual("pow", pow.getOperator());
        }
Beispiel #5
0
        public override bool CompareTo(Expression other)
        {
            var otherReduced = other.Reduce();

            if (otherReduced is Variable)
            {
                if (Identifier == (otherReduced as Variable).Identifier && Prefix.CompareTo((otherReduced as Variable).Prefix) && Exponent.CompareTo((otherReduced as Variable).Exponent))
                {
                    return(true);
                }

                if (IsDefined && (otherReduced as Variable).IsDefined)
                {
                    return(Value.CompareTo(otherReduced.Value));
                }
            }

            if (IsDefined)
            {
                return(otherReduced.CompareTo(Value));
            }

            return(false);
        }
Beispiel #6
0
 public override int GetHashCode()
 {
     return(significand.GetHashCode() * 13 + Exponent.GetHashCode());
 }
 protected override bool Visit(Exponent exp) => StaticFalse(exp);
Beispiel #8
0
 public override int GetHashCode()
 {
     return(AmbientColor.GetHashCode() ^ DiffuseColor.GetHashCode() ^ SpecularColor.GetHashCode() ^ Exponent.GetHashCode() ^
            TextureID.GetHashCode() ^ Flags.GetHashCode());
 }
 protected override Type Visit(Exponent exp) => BinaryNumeric(exp, true);
 protected override bool Visit(Exponent exp) => Visit(exp.Left) && Visit(exp.Right) && _level >= YololChip.Advanced;
 public override int GetHashCode()
 {
     return(Tuple.Create(Modulus.GetHashCode(), Exponent.GetHashCode()).GetHashCode());
 }
 protected override IEnumerable <BaseStatement> Visit(Exponent exp) => Binary(exp, (a, b) => new Exponent(a, b));
Beispiel #13
0
 public override int GetHashCode()
 {
     return(Mantissa.GetHashCode() * 7 + Exponent.GetHashCode() * 17);
 }
Beispiel #14
0
 protected override bool Visit(Exponent exp) => base.Visit(exp.Left) || base.Visit(exp.Right);
Beispiel #15
0
        public static float GetBurstValue(ModuleType type, float x, float y, float z, NativeArray <ModuleData> data, int dataIndex)
        {
            switch (type)
            {
            case ModuleType.Billow:
                return(Billow.GetBurstValue(x, y, z, data, dataIndex));

            case ModuleType.Checker:
                return(Checker.GetBurstValue(x, y, z, data, dataIndex));

            case ModuleType.Const:
                return(Const.GetBurstValue(x, y, z, data, dataIndex));

            case ModuleType.Cylinders:
                return(Cylinders.GetBurstValue(x, y, z, data, dataIndex));

            case ModuleType.Perlin:
                return(Perlin.GetBurstValue(x, y, z, data, dataIndex));

            case ModuleType.RidgedMultifractal:
                return(RidgedMultifractal.GetBurstValue(x, y, z, data, dataIndex));

            case ModuleType.Spheres:
                return(Spheres.GetBurstValue(x, y, z, data, dataIndex));

            case ModuleType.Voronoi:
                return(Voronoi.GetBurstValue(x, y, z, data, dataIndex));

            case ModuleType.Abs:
                return(Abs.GetBurstValue(x, y, z, data, dataIndex));

            case ModuleType.Add:
                return(Add.GetBurstValue(x, y, z, data, dataIndex));

            case ModuleType.Blend:
                return(Blend.GetBurstValue(x, y, z, data, dataIndex));

            // case ModuleType.Cache:
            //     return Cache.GetBurstValue(x, y, z, data, dataIndex);
            case ModuleType.Clamp:
                return(Clamp.GetBurstValue(x, y, z, data, dataIndex));

            // case ModuleType.Curve:
            //     return Curve.GetBurstValue(x, y, z, data, dataIndex);
            case ModuleType.Displace:
                return(Displace.GetBurstValue(x, y, z, data, dataIndex));

            case ModuleType.Exponent:
                return(Exponent.GetBurstValue(x, y, z, data, dataIndex));

            case ModuleType.Invert:
                return(Invert.GetBurstValue(x, y, z, data, dataIndex));

            case ModuleType.Max:
                return(Max.GetBurstValue(x, y, z, data, dataIndex));

            case ModuleType.Min:
                return(Min.GetBurstValue(x, y, z, data, dataIndex));

            case ModuleType.Multiply:
                return(Multiply.GetBurstValue(x, y, z, data, dataIndex));

            case ModuleType.Power:
                return(Power.GetBurstValue(x, y, z, data, dataIndex));

            case ModuleType.Rotate:
                return(Rotate.GetBurstValue(x, y, z, data, dataIndex));

            case ModuleType.Scale:
                return(Scale.GetBurstValue(x, y, z, data, dataIndex));

            case ModuleType.ScaleBias:
                return(ScaleBias.GetBurstValue(x, y, z, data, dataIndex));

            case ModuleType.Select:
                return(Select.GetBurstValue(x, y, z, data, dataIndex));

            case ModuleType.Subtract:
                return(Subtract.GetBurstValue(x, y, z, data, dataIndex));

            // case ModuleType.Terrace:
            //     return Terrace.GetBurstValue(x, y, z, data, dataIndex);
            case ModuleType.Translate:
                return(Translate.GetBurstValue(x, y, z, data, dataIndex));

            case ModuleType.Turbulence:
                return(Turbulence.GetBurstValue(x, y, z, data, dataIndex));

            default:
                // Debug.LogError("Not a valid module type");
                return(0);
            }
        }
        public void getNumberOfValuesTest()
        {
            Exponent pow = new Exponent();

            Assert.AreEqual(2, pow.getNumberOfValues());
        }
Beispiel #17
0
 /// <summary>
 /// Returns a value that indicates whether the current structure contains the same public key values as the compared structure.
 /// </summary>
 /// <param name="keys"></param>
 /// <returns></returns>
 public bool EqualsPublic(RSAKeys keys)
 {
     return(Modulus.Equals(keys.Modulus) &&
            Exponent.Equals(keys.Exponent));
 }
 [NotNull] protected abstract TResult Visit([NotNull] Exponent exp);
Beispiel #19
0
 private void SetCoinsText()
 {
     //_coins.SetExponentText(coins, coinsText);
     coinsText.text = Exponent.SetExponentText(coins);
     //coinsText.text = coins.ToString("F0");
 }
Beispiel #20
0
 public void UpgradePricesTexts(double single, double max, int upgradesCount)
 {
     tmPriceForOne.text      = Exponent.SetExponentText(single);
     tmPriceForMax.text      = Exponent.SetExponentText(max);
     tmBuyMaxButtonText.text = $"Buy max ({upgradesCount.ToString()})";
 }
Beispiel #21
0
 public override Expression SubstituteVariables(Dictionary <string, Fraction> variableValues, Dictionary <string, Expression> variableExpressions) =>
 Build(BaseValue.SubstituteVariables(variableValues, variableExpressions), Exponent.SubstituteVariables(variableValues, variableExpressions));
Beispiel #22
0
 public override int GetHashCode()
 {
     return(Modulus.GetHashCode() ^
            Exponent.GetHashCode() ^
            PrivateExponent.GetHashCode());
 }
 protected override bool Visit(Exponent exp) => VisitBinary(exp);
Beispiel #24
0
        static void Main(string[] args)
        {
            Console.Title = "HabBit ~ Processing Arguments...";
            HandleArguments(args);

            FileDirectory = Path.GetDirectoryName(Client.Location);
            FileName      = Path.GetFileNameWithoutExtension(Client.Location);
            UpdateConsoleTitle();

            var watch = new Stopwatch();

            watch.Start();

            if (!Decompress(Client))
            {
                WriteLine($"Decompression failed({Client.CompressWith})!");
                Console.Read();
                return;
            }

            Console.Write("Disassembling...");
            Client.ReadTags();
            WriteLine($" | {Client.Tags.Count} Tags Extracted");

            Process(Client.RemoveLocalUseRestrictions,
                    "Removing local usage restrictions...");

            Process(Client.DisableExpirationDateCheck,
                    "Removing expiration date check...");

            Process(Client.BypassRemoteHostCheck,
                    "Bypassing remote host check...");

            Console.Write("Replacing RSA keys...");
            bool rsaKeysReplaced = Client.ReplaceRSA(Exponent, Modulus);

            WriteLine($" | {(rsaKeysReplaced ? "Completed!" : "Failed!")}");

            if (DisableRC4)
            {
                Process(Client.DisableClientEncryption,
                        "Removing client encryption/decryption methods...");
            }

            if (DumpHeaders)
            {
                Console.Write("Searching for message instances...");
                Client.FindMessageInstances();
                WriteLine($" | Incoming({Client.IncomingTypes.Count})/Outgoing({Client.OutgoingTypes.Count}) message instances found.");

                Console.Write("Extracting Incoming/Outgoing message data...");
                string headerDump =
                    (DumpMessages("Outgoing", Client.OutgoingTypes) + "\r\n\r\n") +
                    DumpMessages("Incoming", Client.IncomingTypes);
                WriteLine($" | Unique Hashes Generated: Outgoing[{OutHashes.Count}], Incoming[{InHashes.Count}]");

                File.WriteAllText($"{FileDirectory}\\HEADERS_{FileName}.txt", headerDump);
            }

            WriteLine("Reconstructing...");
            Client.Reconstruct();

            byte[] reconstructed = CompressClient ?
                                   Compress(Client) : Client.ToArray();

            watch.Stop();
            string clientPath = $"{FileDirectory}\\CLEANED_{FileName}.swf";

            File.WriteAllBytes(clientPath, reconstructed);

            Console.Write($"Finished! | Completion Time: {watch.Elapsed}");

            WriteLine();
            Console.Write($"Client: {clientPath}");

            string keysPath = $"{FileDirectory}\\KEYS_{FileName}.txt";

            if (!string.IsNullOrWhiteSpace(PrivateExponent))
            {
                File.WriteAllText(keysPath,
                                  $"Exponent(e): {Exponent.ToString("x")}\r\n" +
                                  $"Modulus(n): {Modulus}\r\n" +
                                  $"Private Exponent(d): {PrivateExponent}");

                Console.Write("\r\nKeys: " + keysPath);
            }
            WriteLine();
            Console.Read();
        }
Beispiel #25
0
 protected override IDataFlowGraphExpressionNode Visit(Exponent exp) => VisitBinary(exp, YololBinaryOp.Exponent);
Beispiel #26
0
 [NotNull] protected virtual BaseExpression Visit([NotNull] Exponent exp)
 {
     return(new Exponent(Visit(exp.Left), Visit(exp.Right)));
 }
 protected override BaseExpression Visit(Exponent exp)
 {
     using (AppendLine("^"))
         return(base.Visit(exp));
 }
 public override int GetHashCode()
 {
     return(DP.GetHashCode() ^ DQ.GetHashCode() ^ Exponent.GetHashCode() ^ Modulus.GetHashCode()
            ^ P.GetHashCode() ^ Q.GetHashCode() ^ PublicExponent.GetHashCode() ^ QInv.GetHashCode());
 }
        public void getNameTest()
        {
            Exponent pow = new Exponent();

            Assert.AreEqual("Power", pow.getName());
        }
Beispiel #30
0
 public string ToDecimalString()
 {
     Contract.Ensures(Contract.Result <string>() != null);
     return(value == "" ? String.Format("{0}x2^{1}", significand.ToString(), Exponent.ToString()) : value);
 }
Beispiel #31
0
    public static void genNoise(int channelId)
    {
        moduleBase[channelId] = new Perlin();
        if (teNoiseChanTypeIndex[channelId] == 1)
        {
            int tIdx = teNoiseTypeIndex[channelId];
            if (tIdx == 0) { moduleBase[channelId] = new Perlin(frequency[channelId], lacunarity[channelId], persistance[channelId], octaves[channelId], seed[channelId], QualityMode.High); }
            if (tIdx == 1) { moduleBase[channelId] = new Billow(frequency[channelId], lacunarity[channelId], persistance[channelId], octaves[channelId], seed[channelId], QualityMode.High); }
            if (tIdx == 2) { moduleBase[channelId] = new RidgedMultifractal(frequency[channelId], lacunarity[channelId], octaves[channelId], seed[channelId], QualityMode.High); }
            if (tIdx == 3) { moduleBase[channelId] = new Voronoi(frequency[channelId], displacement[channelId], seed[channelId], distance[channelId]); }
            if (tIdx == 4) { moduleBase[channelId] = new BrownianMotion(frequency[channelId], lacunarity[channelId], octaves[channelId], seed[channelId], QualityMode.High); }
            if (tIdx == 5) { moduleBase[channelId] = new HeterogeneousMultiFractal(frequency[channelId], lacunarity[channelId], octaves[channelId], persistance[channelId], seed[channelId], offset[channelId], QualityMode.High); }
            if (tIdx == 6) { moduleBase[channelId] = new HybridMulti(frequency[channelId], lacunarity[channelId], octaves[channelId], persistance[channelId], seed[channelId], offset[channelId], gain[channelId], QualityMode.High); }
            if (tIdx == 7) { moduleBase[channelId] = new LinearGradientNoise(frequency[channelId]); }
        }
        if (teNoiseChanTypeIndex[channelId] == 2)
        {
            int fIdx = teFunctionTypeIndex[channelId];
            if (fIdx == 0) { moduleBase[channelId] = new Add(moduleBase[srcChannel1Id[channelId]], moduleBase[srcChannel2Id[channelId]]); }
            if (fIdx == 1) { moduleBase[channelId] = new Subtract(moduleBase[srcChannel1Id[channelId]], moduleBase[srcChannel2Id[channelId]]); }
            if (fIdx == 2) { moduleBase[channelId] = new Multiply(moduleBase[srcChannel1Id[channelId]], moduleBase[srcChannel2Id[channelId]]); }
            if (fIdx == 3) { moduleBase[channelId] = new Min(moduleBase[srcChannel1Id[channelId]], moduleBase[srcChannel2Id[channelId]]); }
            if (fIdx == 4) { moduleBase[channelId] = new Max(moduleBase[srcChannel1Id[channelId]], moduleBase[srcChannel2Id[channelId]]); }
            if (fIdx == 5) { moduleBase[channelId] = new Blend(moduleBase[srcChannel1Id[channelId]], moduleBase[srcChannel2Id[channelId]], moduleBase[srcChannel3Id[channelId]]); }
            if (fIdx == 6) { moduleBase[channelId] = new Clamp((double)noiseFuncMin[channelId], (double)noiseFuncMax[channelId], moduleBase[srcChannel1Id[channelId]]); }
			if (fIdx == 7) { moduleBase[channelId] = new Power(moduleBase[srcChannel1Id[channelId]],moduleBase[srcChannel2Id[channelId]]);}
			if (fIdx == 8) { Curve tmpCurve = new Curve(moduleBase[srcChannel1Id[channelId]]);
				double adjust = double.Parse((controlpointcount[channelId]-1).ToString())*0.5;
				for(int i=0;i<controlpointcount[channelId];i++){
					tmpCurve.Add(double.Parse(i.ToString())-adjust,(double)cpval[channelId,i]);
					moduleBase[channelId] = tmpCurve;
				}
			}
			if(fIdx==9){Terrace tmpTerrace = new Terrace(invertTerrace[channelId],moduleBase[srcChannel1Id[channelId]]);
				for(int i=0;i<controlpointcount[channelId];i++){
					tmpTerrace.Add((double)cpval[channelId,i]-0.5);
					moduleBase[channelId] = tmpTerrace;
				}
			}
            if (fIdx == 18) { moduleBase[channelId] = new Mask(moduleBase[srcChannel1Id[channelId]], (double)noiseFuncMin[channelId], (double)noiseFuncMax[channelId]); }
            if (fIdx == 17) { moduleBase[channelId] = new WindexWarp(moduleBase[srcChannel1Id[channelId]]); }
			if (fIdx == 16) { moduleBase[channelId] = new TEWarp(moduleBase[srcChannel1Id[channelId]]); }
            if (fIdx == 15) { moduleBase[channelId] = new Select((double)noiseFuncMin[channelId], (double)noiseFuncMax[channelId], falloff[channelId], moduleBase[srcChannel1Id[channelId]], moduleBase[srcChannel2Id[channelId]], moduleBase[srcChannel3Id[channelId]]); }
			if (fIdx == 14) { moduleBase[channelId] = new Turbulence(power[channelId],moduleBase[srcChannel1Id[channelId]]); }
			if (fIdx == 13) { moduleBase[channelId] = new ScaleBias(scale[channelId],bias[channelId],moduleBase[srcChannel1Id[channelId]]); }
			if (fIdx == 12) { moduleBase[channelId] = new Invert(moduleBase[srcChannel1Id[channelId]]);}
			if (fIdx == 11) { moduleBase[channelId] = new Exponent(exponent[channelId],moduleBase[srcChannel1Id[channelId]]); }
			if (fIdx == 10) { moduleBase[channelId] = new Abs(moduleBase[srcChannel1Id[channelId]]);}
		}
        int resolution = 64;
        int xoffset = 0; int yoffset = 0;
        m_noiseMap[channelId] = new Noise2D(resolution, resolution, moduleBase[channelId]);
        float x1 = xoffset * zoom[channelId];
        float x2 = (xoffset * zoom[channelId]) + ((zoom[channelId] / resolution) * (resolution + 1));
        float y1 = -yoffset * zoom[channelId];
        float y2 = (-yoffset * zoom[channelId]) + ((zoom[channelId] / resolution) * (resolution + 1));
        m_noiseMap[channelId].GeneratePlanar(x1, x2, y1, y2);
        m_textures[channelId] = m_noiseMap[channelId].GetTexture();
        m_textures[channelId].Apply();
    }