示例#1
0
    private void MultiThreadedSave(string scenarioName)
    {
        //Get the factory.
        ObjectFactory objectFactory = new ObjectFactory(scenarioName);

        objectFactory.BuildFilePath();

        int i    = 0;
        int size = ControllerShell.Container.Count;

        //Debug.Log("ControllerShell Count: " + size);
        //Debug.Log("GUIDLIST Count: " + GuidList.GetAllObjects().Count);

        foreach (string toSave in ControllerShell.Keys)
        {
            switch (toSave.Split('-')[0])
            {
            case "Surface":
                objectFactory.SaveSurfaceToScenarioMultiThreaded(toSave, (i++).ToString());
                break;

            case "Air":
                objectFactory.SaveAirToScenarioMultiThreaded(toSave, (i++).ToString());
                break;

            case "Subsurface":
                objectFactory.SaveSubSurfaceToScenarioMultiThreaded(toSave, (i++).ToString());
                break;

            case "Marine":
                objectFactory.SaveMarineToScenarioMultiThreaded(toSave, (i++).ToString());
                break;

            default:
                break;
            }

            _saveStatus += .25f / size;
        }


        objectFactory.SaveEnvironmentVariablesMultiThreaded();
        _saveStatus += .125f;

        objectFactory.SaveToFile();
        _saveStatus = 1f;
    }