Ejemplo n.º 1
0
 internal static void SerializeObject(string filename, Settings objectToSerialize)
 {
     Stream stream = File.Open(filename, FileMode.Create);
     var bFormatter = new BinaryFormatter();
     bFormatter.Serialize(stream, objectToSerialize);
     stream.Close();
 }
Ejemplo n.º 2
0
        internal static double GetBuyPrice(double buy, Settings settings)
        {
            if (settings == null) return .0;

            double result = buy;

            if (settings.AdvancedStepSettings)
            {
                result += result*settings.BuyPercentage > settings.BuyThreshold
                              ? settings.BuyThreshold
                              : settings.BuyPercentage*result;
            }
            else
            {
                result += .01;
            }

            return result;
        }
Ejemplo n.º 3
0
        internal static double GetSellPrice(double sell, Settings settings)
        {
            if (settings == null) return .0;

            double result = sell;

            if (settings.AdvancedStepSettings)
            {
                result -= (result*settings.SellPercentage > settings.SellThreshold)
                              ? settings.SellThreshold
                              : settings.SellPercentage*result;
            }
            else
            {
                result -= .01;
            }

            return result;
        }
Ejemplo n.º 4
0
 public static void SaveSettings(Settings settings)
 {
     if (settings.ProfileName == "Default") return;
     Directory.CreateDirectory("profiles");
     Serializer.SerializeObject(string.Format("profiles\\{0}.dat", settings.ProfileName), settings);
 }