public static LocationFactoryModel GetFromSimulatorFactory(string ip, int port) { LocationFactoryModel lfm = LocationFactoryModel.Instance; lfm.state = FactoryState.FROM_SIMULATOR; lfm.simulator = new Simulator(ip, port); return(lfm); }
public const string SCENARIO_FILE = "~/App_Data/{0}.txt"; // The Path of the Secnario public static LocationFactoryModel GetFromFile(string file) { string path = HttpContext.Current.Server.MapPath(String.Format(SCENARIO_FILE, file)); LocationFactoryModel lfm = LocationFactoryModel.Instance; lfm.state = FactoryState.FROM_FILE; lfm.reader = new System.IO.StreamReader(path); return(lfm); }
public static LocationFactoryModel GetFromSimulatorAndSaveFactory(string ip, int port, string file) { string path = HttpContext.Current.Server.MapPath(String.Format(SCENARIO_FILE, file)); LocationFactoryModel lfm = LocationFactoryModel.Instance; lfm.state = FactoryState.FROM_SIMULATOR_AND_SAVE; lfm.simulator = new Simulator(ip, port); lfm.writer = System.IO.File.CreateText(path); return(lfm); }