Esempio n. 1
0
        public static void DoSaveCurrentScene(string sFilename)
        {
            if (sFilename != null && sFilename.Length > 0)
            {
                if (sFilename.EndsWith(".cota", StringComparison.OrdinalIgnoreCase) == false)
                {
                    sFilename += ".cota";
                }

                CotangentSerializer serializer = new CotangentSerializer();
                serializer.SerializeOptions.MinimalMeshStorage     = true;
                serializer.SerializeOptions.FastCompression        = false;
                serializer.SerializeOptions.StoreMeshVertexNormals = false;
                serializer.SerializeOptions.StoreMeshVertexUVs     = false;
                serializer.SerializeOptions.StoreMeshVertexColors  = false;
                try {
                    serializer.StoreCurrent(sFilename);
                    SetCurrentSaveFilePath(sFilename);
                    ClearCurrentSceneModified();
                } catch (Exception e) {
                    DebugUtil.Log("DoSaveCurrentScene: Exception: " + e.Message);
                    CotangentUI.ShowModalMessageDialog("Save Failed",
                                                       "Error writing to file " + sFilename,
                                                       "Ok", null, null);
                }
            }
        }
Esempio n. 2
0
        public static void OpenSceneFile(string sFilename)
        {
            CotangentSerializer serializer = new CotangentSerializer();

            try {
                serializer.RestoreToCurrent(sFilename);
                SetCurrentSaveFilePath(sFilename);
                ClearCurrentSceneModified();
            } catch (Exception e) {
                DebugUtil.Log("OpenSceneFile: exception restoring cota file: " + e.Message);
                CotangentUI.ShowModalMessageDialog("Error Opening Scene",
                                                   "Sorry, errors ocurred while trying to read this scene file.",
                                                   "Ok", null, null);
            }
        }