Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }