コード例 #1
0
        // TODO sprawdzanie bledow, dokonczenie implementacji
        public void Deserialize(string fileName)
        {
            Logger.Info("Deserialize in Cabinet");
            var deserialize = new JsonImport();
            var cab         = deserialize.Import(fileName);

            if (cab == null)
            {
                return;
            }


            Height(cab.Height()).Width(cab.Width()).Depth(cab.Depth()).SizeElement(cab.SizeElement())
            .Name(cab.Name());

            HorizontalBarrierParameter = cab.HorizontalBarrierParameter;
            AddHorizonatlBarriery(cab.HorizontalBarrier);

            VerticalBarrierParameter = cab.VerticalBarrierParameter;
            AddVerticalBarrierList(cab.VerticalBarrier);

            FrontParameter = cab.FrontParameter;
            AddFrontList(cab.FrontList);

            RedrawCabinetElements();
        }
コード例 #2
0
 public static void Main()
 {
     JsonImport.ImportAstronomers();
     JsonImport.ImportTelescopes();
     JsonImport.ImportPlanets();
     XmlImport.ImportStars();
     XmlImport.ImportDiscoveries();
 }
コード例 #3
0
        public static void ExportComponents()
        {
            var connectionString = _config.GetValue <string>("ConnectionString");
            var basePath         = _config.GetValue <string>("BasePath");
            var fileName         = _config.GetValue <string>("Files:Component");
            var fullPath         = Path.Combine(basePath, fileName);
            var importTool       = new JsonImport(connectionString);

            importTool.ExportComponents(fullPath);
            ReShowMenu();
        }
コード例 #4
0
        private static void ImportBuildingRecipes()
        {
            var connectionString = _config.GetValue <string>("ConnectionString");
            var basePath         = _config.GetValue <string>("BasePath");
            var fileName         = _config.GetValue <string>("Files:BuildingRecipes");
            var fullPath         = Path.Combine(basePath, fileName);
            var importTool       = new JsonImport(connectionString);

            importTool.ImportBuildings(fullPath);
            ReShowMenu();
        }
コード例 #5
0
        static void Main(string[] args)
        {
            // Import files saved in Solution/Import

            JsonImport.ImportAstronomers();
            JsonImport.ImportTelescopes();
            JsonImport.ImportPlanets();

            XmlImport.ImportStars();
            XmlImport.ImportDiscoveries();
        }
コード例 #6
0
        static void Main(string[] args)
        {
            /* NB! Copy EntityFrameworkSQLServer.dll
             * from Data/bin/Debug to Import/bin/Debug
             */

            JsonImport.ImportSolarSystems();
            JsonImport.ImportStars();
            JsonImport.ImportPlanets();
            JsonImport.ImportPersons();
            JsonImport.ImportAnomalies();
            JsonImport.ImportAnomalyVictims();

            XmlImport.ImportAnomalyVictims();
        }
コード例 #7
0
    public void AddPlanetEvent(string jsonString, int eventNum, int numEvents)
    {
        // if this is the first event, initialise the planetEvents array
        if (planetEvents == null)
        {
            planetEvents = new PlanetEvent[numEvents];
        }

        // generate a PlanetEvent and its EventCriteria and effects based on this
        JsonData jsonEvent = JsonMapper.ToObject(jsonString);

        PlanetEvent newEvent = new PlanetEvent();

        newEvent.name        = jsonEvent["name"].ToString();
        newEvent.description = jsonEvent["description"].ToString();
        if (JsonImport.JsonDataContainsKey(jsonEvent, "interval"))
        {
            newEvent.interval = Convert.ToInt32(jsonEvent["interval"].ToString());
        }
        else
        {
            newEvent.interval = 0;
        }

        // generate EventCriteria objects
        newEvent.criteria = new EventCriteria[jsonEvent["criteria"].Count];
        for (int i = 0; i < jsonEvent["criteria"].Count; i++)
        {
            newEvent.criteria[i] = GenerateEventCriteria(jsonEvent["criteria"][i]);
        }

        // generate variable effects
        newEvent.variableEffects = new VariableEffect[jsonEvent["variableEffects"].Count];
        for (int i = 0; i < jsonEvent["variableEffects"].Count; i++)
        {
            newEvent.variableEffects[i] = GenerateVariableEffect(jsonEvent["variableEffects"][i]);
        }

        planetEvents[eventNum] = newEvent;
    }
コード例 #8
0
        private void ImportExport_Click(object sender, RoutedEventArgs e)
        {
            int switchInt = ImportTab.IsSelected ? ImportCollection.SelectedIndex : ExportCollection.SelectedIndex;

            switch (switchInt)
            {
            case 0:
                //Import Guests
                if (ImportTab.IsSelected)
                {
                }
                //Export Guests
                else
                {
                    ExportCollectionsToJson(ExportFilePath.Text, controller.Context.Guests);
                }
                break;

            case 1:
                //Import Reservations
                if (ImportTab.IsSelected)
                {
                    controller.ImportReservations(ImportFilePath.Text);
                }
                //Export Reservations
                else
                {
                    ExportCollectionsToJson(ExportFilePath.Text, controller.Context.Reservations
                                            .Include(r => r.Room.Floor.Building).Include(r => r.Guest));
                }
                break;

            case 2:
                //Import Transactions
                if (ImportTab.IsSelected)
                {
                }
                //Export Transactions
                else
                {
                    ExportCollectionsToJson(ExportFilePath.Text, controller.Context.Transactions
                                            .Include(t => t.Guest).Include(t => t.Reservation));
                }
                break;

            case 3:
                //Import Buildings
                if (ImportTab.IsSelected)
                {
                    JsonImport.ImportBuildings(controller, ImportFilePath.Text);
                }
                //Export Buildings
                else
                {
                    ExportCollectionsToJson(ExportFilePath.Text, controller.Context.Buildings);
                }
                break;

            case 4:
                //Import Floors
                if (ImportTab.IsSelected)
                {
                    JsonImport.ImportFloors(controller, ImportFilePath.Text);
                }
                //Export Floors
                else
                {
                    ExportCollectionsToJson(ExportFilePath.Text, controller.Context.Floors.Include(f => f.Building));
                }
                break;

            case 5:
                //Import Rooms
                if (ImportTab.IsSelected)
                {
                    controller.ImportRooms(ImportFilePath.Text);
                }
                //Export Rooms
                else
                {
                    ExportCollectionsToJson(ExportFilePath.Text, controller.Context.Rooms.Include(r => r.Floor.Building));
                }
                break;
            }
            Close();
        }