Represents properties supplied to the plugin on loading.
Exemple #1
0
 /// <summary>Is called when the plugin is loaded.</summary>
 /// <param name="properties">The properties supplied to the plugin on loading.</param>
 /// <returns>Whether the plugin was loaded successfully.</returns>
 public bool Load(LoadProperties properties)
 {
     properties.Panel = new int[256];
     properties.AISupport = AISupport.Basic;
     train = new Train(properties.Panel, properties.PlaySound);
     return true;
 }
Exemple #2
0
		/// <summary>Is called when the plugin is loaded.</summary>
		/// <param name="properties">The properties supplied to the plugin on loading.</param>
		/// <returns>Whether the plugin was loaded successfully.</returns>
		public bool Load(LoadProperties properties) {
			Panel = new int[256];
			Sound = new SoundHelper(properties.PlaySound, 256);
			properties.Panel = Panel;
			properties.AISupport = AISupport.None;
			// TODO: Your old Load code goes here.
			return true;
		}
Exemple #3
0
        internal bool Load(LoadProperties properties)
        {
            timsPipeServer = new AsyncPipeServer();
            timsPipeServer.OnReceiveMessageComplete += new AsyncPipeServer.ReceivedMessageOutput(timsPipeServer_OnReceiveMessageComplete);
            timsPipeServer.Start();

            return true;
        }
Exemple #4
0
        /// <summary>Is called when the plugin is loaded.</summary>
        /// <param name="properties">The properties supplied to the plugin on loading.</param>
        /// <returns>Whether the plugin was loaded successfully.</returns>
        public bool Load(LoadProperties properties)
        {
            if (!DllLoader.ConfirmUseDll()) {
                return false;
            }

            properties.Panel = Panel;
            SoundManager.Initialise(properties.PlaySound, 256);
            properties.AISupport = AISupport.None; // TODO: AI support?

            ms.Load(properties);
            tims.Load(properties);

            return true;
        }
Exemple #5
0
		// --- interface functions ---
		
		/// <summary>Is called when the plugin is loaded.</summary>
		/// <param name="properties">The properties supplied to the plugin on loading.</param>
		/// <returns>Whether the plugin was loaded successfully.</returns>
		public bool Load(LoadProperties properties) {
			properties.Panel = new int[272];
			properties.AISupport = AISupport.Basic;
			this.Train = new Train(properties.Panel, properties.PlaySound);
			try {
				string file = OpenBveApi.Path.CombineFile(properties.TrainFolder, "train.dat");
				if (!this.Train.LoadTrainDatFile(file)) {
					this.Train.AtsSx = new AtsSx(this.Train);
					this.Train.Devices = new Device[] { this.Train.AtsSx };
				}
			} catch {
				this.Train.AtsSx = new AtsSx(this.Train);
				this.Train.Devices = new Device[] { this.Train.AtsSx };
			}
			return true;
		}
Exemple #6
0
		// --- functions ---
		internal override bool Load(VehicleSpecs specs, InitializationModes mode) {
			LoadProperties properties = new LoadProperties(this.PluginFolder, this.TrainFolder, this.PlaySound);
			bool success;
			#if !DEBUG
			try {
				#endif
				success = this.Api.Load(properties);
				base.SupportsAI = properties.AISupport == AISupport.Basic;
				#if !DEBUG
			} catch (Exception ex) {
				base.LastException = ex;
				throw;
			}
			#endif
			if (success) {
				base.Panel = properties.Panel ?? new int[] { };
				#if !DEBUG
				try {
					#endif
					Api.SetVehicleSpecs(specs);
					Api.Initialize(mode);
					#if !DEBUG
				} catch (Exception ex) {
					base.LastException = ex;
					throw;
				}
				#endif
				UpdatePower();
				UpdateBrake();
				UpdateReverser();
				return true;
			}
			if (properties.FailureReason != null) {
				Debug.AddMessage(Debug.MessageType.Error, false, "The train plugin " + base.PluginTitle + " failed to load for the following reason: " + properties.FailureReason);
				return false;
			}
			Debug.AddMessage(Debug.MessageType.Error, false, "The train plugin " + base.PluginTitle + " failed to load for an unspecified reason.");
			return false;
		}
 public void Load(LoadProperties properties)
 {
     Panel = properties.Panel;
     Panel[PanelID.DistanceToNextStation.FirstDigit] = 12;
     Panel[PanelID.DistanceToNextStation.SecondDigit] = 12;
     Panel[PanelID.DistanceToNextStation.ThirdDigit] = 11;
     Panel[PanelID.DistanceToNextStation.ForthDigit] = 12;
     Panel[PanelID.DistanceToNextStation.Unit] = 0;
 }
Exemple #8
0
 /// <summary>Is called when the plugin is loaded.</summary>
 /// <param name="properties">The properties supplied to the plugin on loading.</param>
 /// <returns>Whether the plugin was loaded successfully.</returns>
 public bool Load(LoadProperties properties)
 {
     soundManager = new TrainSoundManager(properties.PlaySound);
     cabControlManager = new TrainControlManager(ref properties);
     return true;
 }
        internal void Load(LoadProperties properties)
        {
            Panel = properties.Panel;

            stationsMemory = new StationsMemory();
            stationsMemory.Load(properties);

            trackGradientMemory = new TrackGradientMemory();
            trackGradientMemory.Load(properties);

            driverless = new Driverless();
            driverless.Load(properties);
            stationsMemory.OnStationDataRefreshed += new StationsMemory.NewStationDataReceiver(driverless.WriteRefreshedStationsCollection);
            stationsMemory.OnLastDockIndexRefreshed += new StationsMemory.LastDockIndexReceiver(driverless.WriteRefreshedLastDockedIndex);

            rm = new RM();
            rm.Load(properties);

            atp2 = new ATP2();
            atp2.Load(properties);
            stationsMemory.OnStationDataRefreshed += new StationsMemory.NewStationDataReceiver(atp2.WriteRefreshedStationsCollection);
            stationsMemory.OnLastDockIndexRefreshed += new StationsMemory.LastDockIndexReceiver(atp2.WriteRefreshedLastDockedIndex);

            ato = new ATO();
            ato.Load(properties);
            stationsMemory.OnStationDataRefreshed += new StationsMemory.NewStationDataReceiver(ato.WriteRefreshedStationsCollection);
            stationsMemory.OnLastDockIndexRefreshed += new StationsMemory.LastDockIndexReceiver(ato.WriteRefreshedLastDockedIndex);
            trackGradientMemory.OnGradientPointsDataRefreshed += new TrackGradientMemory.NewGradientPointsDataReceiver(ato.WriteRefreshedGradientPointCollection);
            //			driverless.OnDriverlessAvailableElapse += new CallDriverlessAvailableEventHandlers();
        }
 // --- api functions ---
 /// <summary>Is called when the plugin is loaded.</summary>
 /// <param name="properties">The properties supplied to the plugin on loading.</param>
 /// <returns>Whether the plugin was loaded successfully.</returns>
 public bool Load(LoadProperties properties)
 {
     Panel = new int[2048];
     Sounds = new List<Sound>();
     PlaySound = properties.PlaySound;
     properties.Panel = this.Panel;
     properties.AISupport = AISupport.Basic;
     this.ScriptsDirectory = OpenBveApi.Path.CombineDirectory(properties.TrainFolder, "Scripts");
     try {
         string file = OpenBveApi.Path.CombineFile(properties.TrainFolder, "train.dat");
         string[] lines = System.IO.File.ReadAllLines(file);
         for (int i = 0; i < lines.Length; i++) {
             if (lines[i].Equals("#PRESSURE", StringComparison.OrdinalIgnoreCase)) {
                 string text = lines[i + 1];
                 int semicolon = text.IndexOf(';');
                 if (semicolon >= 0) {
                     text = text.Substring(0, semicolon).Trim();
                 } else {
                     text = text.Trim();
                 }
                 this.MaximumBrakeCylinderPressure = 1000.0 * double.Parse(text, System.Globalization.CultureInfo.InvariantCulture);
                 break;
             }
         }
     } catch {
         this.MaximumBrakeCylinderPressure = 490000.0;
     }
     return true;
 }
Exemple #11
0
		public void Load(LoadProperties properties)
		{
			Panel = properties.Panel;
			
			string[] trainDat = System.IO.File.ReadAllLines(System.IO.Path.Combine(properties.TrainFolder, "train.dat"));
			
			// TODO: re-write trainDatParser
			
			bool inPerformanceTag = false;
			bool inDelayTag = false;
			for (int i = 0; i < trainDat.Length; i++) {
				if (trainDat[i] == "#PERFORMANCE") {
					inPerformanceTag = true;
				} else if (trainDat[i] == "#DELAY") {
					inDelayTag = true;
				}
				
				if (inPerformanceTag) {
					int cmt = trainDat[i+1].IndexOf(";");
					MaxSvcBrkRate = Convert.ToDouble(trainDat[i+1].Substring(0, cmt > -1 ? cmt : trainDat[i+1].Length).Replace(" ", ""));
					inPerformanceTag = false;
				} else if (inDelayTag) {
					int cmt = trainDat[i+1].IndexOf(";");
					BrakeUpDelay = Convert.ToDouble(trainDat[i+3].Substring(0, cmt > -1 ? cmt : trainDat[i+1].Length).Replace(" ", ""));
					inDelayTag = false;
				}
			}
		}
Exemple #12
0
 public void Load(LoadProperties properties)
 {
     Panel = properties.Panel;
 }
 // =================
 internal void Load(LoadProperties properties)
 {
     _gPtC = new GradientPointCollection();
 }