public static void saveFile(){
		SaveFileName sfn = new SaveFileName ();
		
		sfn.structSize = Marshal.SizeOf (sfn);
		
		sfn.filter = "All Files\0*.*\0\0";
		
		sfn.file = new string (new char[256]);
		
		sfn.maxFile = sfn.file.Length;
		
		sfn.fileTitle = new string (new char[64]);
		
		sfn.maxFileTitle = sfn.fileTitle.Length;
		
		sfn.initialDir = UnityEngine.Application.dataPath;
		
		sfn.title = "Attache file to your email";
		
		sfn.defExt = "png";
		sfn.flags = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008;
		//OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST| OFN_ALLOWMULTISELECT|OFN_NOCHANGEDIR
		
		if (DllSave.GetSaveFileName (sfn)) {
			//Debug.Log("Nom du fichier a sauvegardé : "+sfn.file);
			Application.CaptureScreenshot (sfn.file, imageSmooth);
		}
	}
Example #2
0
    // Saves the object of generic type <T> as the file of the name of enum SaveFileName.Whatever
    public static void Save(T myObject, SaveFileName saveFileName)
    {
        string json = JsonUtility.ToJson(myObject);

        PlayerPrefs.SetString(saveFileName.ToString(), json);
        PlayerPrefs.Save();
    }
Example #3
0
    public static void saveFile()
    {
        SaveFileName sfn = new SaveFileName();

        sfn.structSize = Marshal.SizeOf(sfn);

        sfn.filter = "All Files\0*.*\0\0";

        sfn.file = new string (new char[256]);

        sfn.maxFile = sfn.file.Length;

        sfn.fileTitle = new string (new char[64]);

        sfn.maxFileTitle = sfn.fileTitle.Length;

        sfn.initialDir = UnityEngine.Application.dataPath;

        sfn.title = "Attache file to your email";

        sfn.defExt = "png";
        sfn.flags  = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008;
        //OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST| OFN_ALLOWMULTISELECT|OFN_NOCHANGEDIR

        if (DllSave.GetSaveFileName(sfn))
        {
            //Debug.Log("Nom du fichier a sauvegardé : "+sfn.file);
            Application.CaptureScreenshot(sfn.file, imageSmooth);
        }
    }
Example #4
0
        public void SaveFileName_Parse([ValueSource(nameof(GetExpectations))] SaveFileNameExpectation expectation)
        {
            var sfn = SaveFileName.Parse(expectation.RenderedName);

            AssertAll.Of(
                () => Assert.That(sfn.Rendered, Is.EqualTo(expectation.RenderedName)),
                () => Assert.That(sfn.Nickname, Is.EqualTo(expectation.Nickname)),
                () => Assert.That(sfn.TimeStamp, Is.EqualTo(expectation.TimeStamp)),
                () => Assert.That(sfn.FullExtension, Is.EqualTo(expectation.Extension.PrefixIfMissing(".")))
                );
        }
Example #5
0
        public void SaveFileName_Fancy([ValueSource(nameof(GetExpectations))] SaveFileNameExpectation expectation)
        {
            var sfn = new SaveFileName()
            {
                Nickname      = expectation.Nickname,
                TimeStamp     = expectation.TimeStamp,
                FullExtension = expectation.Extension
            };

            Assert.That(sfn.Rendered, Is.EqualTo(expectation.RenderedName));
        }
Example #6
0
        /// <summary>
        /// LUA结构支持
        /// </summary>
        /// <returns></returns>
        public override void GetLuaStruct(StringBuilder code)
        {
            base.GetLuaStruct(code);
            int idx;

            if (!string.IsNullOrWhiteSpace(SaveFileName))
            {
                code.AppendLine($@"['FileName'] = '{SaveFileName.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['FileName'] = nil,");
            }
        }
    private void OnGUI()
    {
        // This method will show on the screen all the button when we'll login at, as
        if (Network.isServer)
        {
            registerGUI();
            switch (i)
            {
            case 6:
                if (GUI.Button(new Rect(Screen.width - texture.width - 10, 5, texture.width, texture.height), texture))
                {
                    // Here's go the code for regestring new user
                    showInventory = !showInventory;
                }
                break;
            }
        }
        // Log in as Expert (type)
        if (Network.isClient && (cameraBehaviour_scripts.webSelected))
        {
            if ((clientType == "worker" || clientType == "expert") && i < 5)
            {
                switch (i)
                {
                case 1:
                    if (GUI.Button(new Rect(Screen.width - texture.width - 10, 5, texture.width, texture.height), texture))
                    {
                        sendMailBox_scripts.showInventory = !sendMailBox_scripts.showInventory;
                    }
                    break;

                case 2:
                    if (GUI.Button(new Rect(Screen.width - 2 * texture.width - 15, 5, texture.width, texture.height), texture))
                    {
                        screenShot_scripts.saveFile();
                    }
                    break;

                case 4:
                    if (GUI.Button(new Rect(Screen.width - 4 * texture.width - 25, 5, texture.width, texture.height), texture))
                    {
                        SaveFileName ofn = new SaveFileName();

                        ofn.structSize = Marshal.SizeOf(ofn);

                        ofn.filter = "All Files\0*.*\0\0";

                        ofn.file = new string (new char[256]);

                        ofn.maxFile = ofn.file.Length;

                        ofn.fileTitle = new string (new char[64]);

                        ofn.maxFileTitle = ofn.fileTitle.Length;

                        ofn.initialDir = UnityEngine.Application.dataPath;

                        ofn.title = "Save Report Log";

                        ofn.defExt = "txt";
                        ofn.flags  = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008;                       //OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST| OFN_ALLOWMULTISELECT|OFN_NOCHANGEDIR

                        if (DllSave.GetSaveFileName(ofn))
                        {
                            StartCoroutine(WaitLoad(ofn.file));
                        }
                    }
                    break;
                }
            }
            // Log in as worker (type)
            if (clientType == "worker")
            {
                switch (i)
                {
                case 7:
                    if (GUI.Button(new Rect(Screen.width - 6 * texture.width - 35, 5, texture.width, texture.height), texture))
                    {
                        // Change the voice mode: enale/disable voice recongnition
                        int indexCombo = ARComboBox_scripts.selectedItem_;
                        switch (indexCombo)
                        {
                        case 0:
                            GameObject.Find("Bugatti-Veyron").GetComponent <NetworkView>().RPC("reloadObject", RPCMode.Server, true);
                            break;

                        case 1:
                            GameObject.Find("lamborghini").GetComponent <NetworkView>().RPC("reloadObject", RPCMode.Server, true);
                            break;

                        case 2:
                            GameObject.Find("Car").GetComponent <NetworkView>().RPC("reloadObject", RPCMode.Server, true);
                            break;
                        }
                    }
                    break;
                }
            }
        }
    }
Example #8
0
    // Loads the json with the name of enum SaveFileName.Whatever converts it back to the object type <T> and returns it as an object of type <T>
    public static T Load(SaveFileName saveFileName)
    {
        string json = PlayerPrefs.GetString(saveFileName.ToString());

        return(JsonUtility.FromJson <T>(json));
    }
	private void OnGUI ()
	{

		// This method will show on the screen all the button when we'll login at, as
		if (Network.isServer) {
			registerGUI ();
			switch (i) {
			case 6:
				if (GUI.Button (new Rect (Screen.width - texture.width - 10, 5, texture.width, texture.height), texture)) {
					// Here's go the code for regestring new user
					showInventory = !showInventory;
				}
				break;
			}
		}
		// Log in as Expert (type)
		if (Network.isClient && ( cameraBehaviour_scripts.webSelected  ) ) {
			if ( (clientType == "worker" || clientType == "expert") && i < 5) {
				switch (i) {
				case 1:
					if (GUI.Button (new Rect (Screen.width - texture.width - 10, 5, texture.width, texture.height), texture)) {
						sendMailBox_scripts.showInventory = !sendMailBox_scripts.showInventory;
					}
					break;
				case 2:
					if (GUI.Button (new Rect (Screen.width - 2 * texture.width - 15, 5, texture.width, texture.height), texture)) {
						screenShot_scripts.saveFile ();
					}
					break;
				case 4:
					if (GUI.Button (new Rect (Screen.width - 4 * texture.width - 25, 5, texture.width, texture.height), texture)) {
						SaveFileName ofn = new SaveFileName ();
						
						ofn.structSize = Marshal.SizeOf (ofn);
						
						ofn.filter = "All Files\0*.*\0\0";
						
						ofn.file = new string (new char[256]);
						
						ofn.maxFile = ofn.file.Length;
						
						ofn.fileTitle = new string (new char[64]);
						
						ofn.maxFileTitle = ofn.fileTitle.Length;
						
						ofn.initialDir = UnityEngine.Application.dataPath;
						
						ofn.title = "Save Report Log";
						
						ofn.defExt = "txt";
						ofn.flags = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008;//OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST| OFN_ALLOWMULTISELECT|OFN_NOCHANGEDIR
						
						if (DllSave.GetSaveFileName (ofn)) {
							
							StartCoroutine (WaitLoad (ofn.file));
							
						}
					}
					break;
				}
			}
			// Log in as worker (type)
			if (clientType == "worker") {
				switch (i) {
				case 7:
					if (GUI.Button (new Rect (Screen.width - 6 * texture.width - 35, 5, texture.width, texture.height), texture)) {
						// Change the voice mode: enale/disable voice recongnition
						int indexCombo = ARComboBox_scripts.selectedItem_;
						switch(indexCombo){
						case 0:
							GameObject.Find("Bugatti-Veyron").GetComponent<NetworkView>().RPC ("reloadObject", RPCMode.Server, true);
							break;
						case 1:
							GameObject.Find("lamborghini").GetComponent<NetworkView>().RPC ("reloadObject", RPCMode.Server, true);
							break;
						case 2:
							GameObject.Find("Car").GetComponent<NetworkView>().RPC ("reloadObject", RPCMode.Server, true);	
							break;
						}
					}
					break;

				}
			}
		}
	}
    public static bool GetSaveFileName1([In, Out] SaveFileName sfn)

    {
        return(GetSaveFileName(sfn));
    }
 public static extern bool GetSaveFileName([In, Out] SaveFileName sfn);
Example #12
0
        public override void Execute()
        {
            RetCode rc;

            Globals.RevealContentCounter--;

            SaveFilesetsCount = Globals.Database.GetFilesetsCount();

            Debug.Assert(SaveFilesetsCount <= gEngine.NumSaveSlots);

            Debug.Assert(SaveSlot >= 1 && SaveSlot <= Math.Min(SaveFilesetsCount + 1, gEngine.NumSaveSlots));

            Debug.Assert(SaveName != null);

            if (SaveSlot == SaveFilesetsCount + 1)
            {
                SaveFileset = Globals.CreateInstance <IFileset>(x =>
                {
                    x.Uid  = Globals.Database.GetFilesetUid();
                    x.Name = "(none)";
                });

                rc = Globals.Database.AddFileset(SaveFileset);

                Debug.Assert(gEngine.IsSuccess(rc));
            }

            SaveFilesetList = Globals.Database.FilesetTable.Records.OrderBy(f => f.Uid).ToList();

            SaveFileset = SaveFilesetList[(int)SaveSlot - 1];

            if (SaveName.Length == 0)
            {
                if (!SaveFileset.Name.Equals("(none)", StringComparison.OrdinalIgnoreCase))
                {
                    gOut.Write("{0}Change name of save (Y/N): ", Environment.NewLine);

                    Globals.Buf.Clear();

                    rc = Globals.In.ReadField(Globals.Buf, Constants.BufSize02, null, ' ', '\0', false, null, gEngine.ModifyCharToUpper, gEngine.IsCharYOrN, null);

                    Debug.Assert(gEngine.IsSuccess(rc));

                    if (Globals.Buf.Length > 0 && Globals.Buf[0] == 'Y')
                    {
                        SaveFileset.Name = "(none)";
                    }
                }

                while (SaveFileset.Name.Equals("(none)", StringComparison.OrdinalIgnoreCase))
                {
                    gOut.Write("{0}Enter new name: ", Environment.NewLine);

                    Globals.Buf.Clear();

                    rc = Globals.In.ReadField(Globals.Buf, Constants.FsNameLen, null, ' ', '\0', false, null, null, null, null);

                    Debug.Assert(gEngine.IsSuccess(rc));

                    Globals.Buf.SetFormat("{0}", Regex.Replace(Globals.Buf.ToString(), @"\s+", " ").Trim());

                    SaveFileset.Name = gEngine.Capitalize(Globals.Buf.ToString());

                    if (SaveFileset.Name.Length == 0)
                    {
                        SaveFileset.Name = "(none)";
                    }
                }
            }
            else
            {
                if (!SaveFileset.Name.Equals("(none)", StringComparison.OrdinalIgnoreCase) && SaveName.Equals("Quick Saved Game", StringComparison.OrdinalIgnoreCase))
                {
                    SaveName = Globals.CloneInstance(SaveFileset.Name);
                }

                SaveName = gEngine.Capitalize(SaveName);

                SaveFileset.Name = Globals.CloneInstance(SaveName);

                gOut.Print("[QUICK SAVE {0}: {1}]", SaveSlot, SaveName);
            }

            SaveConfig = Globals.CreateInstance <IConfig>();

            SaveSlotString = SaveSlot.ToString("D3");

            SaveFileset.WorkDir = "NONE";

            SaveFileset.PluginFileName = "NONE";

            SaveFilePath = "";

            SaveFileName = "";

            SaveFileExtension = "";

            rc = gEngine.SplitPath(Globals.ConfigFileName, ref _saveFilePath, ref _saveFileName, ref _saveFileExtension);

            Debug.Assert(gEngine.IsSuccess(rc));

            SaveFileNameIndex = SaveFileName.IndexOf('_');

            if (SaveFileNameIndex >= 0)
            {
                SaveFileName = SaveFileName.Substring(0, (int)SaveFileNameIndex);
            }

            Globals.Buf.SetFormat("{0}{1}_{2}{3}", SaveFilePath, SaveFileName, SaveSlotString, SaveFileExtension);

            SaveFileset.ConfigFileName = Globals.Buf.ToString().Truncate(Constants.FsFileNameLen);

            SaveFileset.FilesetFileName = "NONE";

            rc = gEngine.SplitPath(Globals.Config.RtCharacterFileName, ref _saveFilePath, ref _saveFileName, ref _saveFileExtension);

            Debug.Assert(gEngine.IsSuccess(rc));

            Globals.Buf.SetFormat("{0}{1}_{2}{3}", SaveFilePath, SaveFileName, SaveSlotString, SaveFileExtension);

            SaveFileset.CharacterFileName = Globals.Buf.ToString().Truncate(Constants.FsFileNameLen);

            rc = gEngine.SplitPath(Globals.Config.RtModuleFileName, ref _saveFilePath, ref _saveFileName, ref _saveFileExtension);

            Debug.Assert(gEngine.IsSuccess(rc));

            Globals.Buf.SetFormat("{0}{1}_{2}{3}", SaveFilePath, SaveFileName, SaveSlotString, SaveFileExtension);

            SaveFileset.ModuleFileName = Globals.Buf.ToString().Truncate(Constants.FsFileNameLen);

            rc = gEngine.SplitPath(Globals.Config.RtRoomFileName, ref _saveFilePath, ref _saveFileName, ref _saveFileExtension);

            Debug.Assert(gEngine.IsSuccess(rc));

            Globals.Buf.SetFormat("{0}{1}_{2}{3}", SaveFilePath, SaveFileName, SaveSlotString, SaveFileExtension);

            SaveFileset.RoomFileName = Globals.Buf.ToString().Truncate(Constants.FsFileNameLen);

            rc = gEngine.SplitPath(Globals.Config.RtArtifactFileName, ref _saveFilePath, ref _saveFileName, ref _saveFileExtension);

            Debug.Assert(gEngine.IsSuccess(rc));

            Globals.Buf.SetFormat("{0}{1}_{2}{3}", SaveFilePath, SaveFileName, SaveSlotString, SaveFileExtension);

            SaveFileset.ArtifactFileName = Globals.Buf.ToString().Truncate(Constants.FsFileNameLen);

            rc = gEngine.SplitPath(Globals.Config.RtEffectFileName, ref _saveFilePath, ref _saveFileName, ref _saveFileExtension);

            Debug.Assert(gEngine.IsSuccess(rc));

            Globals.Buf.SetFormat("{0}{1}_{2}{3}", SaveFilePath, SaveFileName, SaveSlotString, SaveFileExtension);

            SaveFileset.EffectFileName = Globals.Buf.ToString().Truncate(Constants.FsFileNameLen);

            rc = gEngine.SplitPath(Globals.Config.RtMonsterFileName, ref _saveFilePath, ref _saveFileName, ref _saveFileExtension);

            Debug.Assert(gEngine.IsSuccess(rc));

            Globals.Buf.SetFormat("{0}{1}_{2}{3}", SaveFilePath, SaveFileName, SaveSlotString, SaveFileExtension);

            SaveFileset.MonsterFileName = Globals.Buf.ToString().Truncate(Constants.FsFileNameLen);

            rc = gEngine.SplitPath(Globals.Config.RtHintFileName, ref _saveFilePath, ref _saveFileName, ref _saveFileExtension);

            Debug.Assert(gEngine.IsSuccess(rc));

            Globals.Buf.SetFormat("{0}{1}_{2}{3}", SaveFilePath, SaveFileName, SaveSlotString, SaveFileExtension);

            SaveFileset.HintFileName = Globals.Buf.ToString().Truncate(Constants.FsFileNameLen);

            if (!string.IsNullOrWhiteSpace(Globals.Config.RtTriggerFileName))                      // TODO: remove this check at some point
            {
                rc = gEngine.SplitPath(Globals.Config.RtTriggerFileName, ref _saveFilePath, ref _saveFileName, ref _saveFileExtension);

                Debug.Assert(gEngine.IsSuccess(rc));

                Globals.Buf.SetFormat("{0}{1}_{2}{3}", SaveFilePath, SaveFileName, SaveSlotString, SaveFileExtension);

                SaveFileset.TriggerFileName = Globals.Buf.ToString().Truncate(Constants.FsFileNameLen);
            }

            if (!string.IsNullOrWhiteSpace(Globals.Config.RtScriptFileName))                      // TODO: remove this check at some point
            {
                rc = gEngine.SplitPath(Globals.Config.RtScriptFileName, ref _saveFilePath, ref _saveFileName, ref _saveFileExtension);

                Debug.Assert(gEngine.IsSuccess(rc));

                Globals.Buf.SetFormat("{0}{1}_{2}{3}", SaveFilePath, SaveFileName, SaveSlotString, SaveFileExtension);

                SaveFileset.ScriptFileName = Globals.Buf.ToString().Truncate(Constants.FsFileNameLen);
            }

            rc = gEngine.SplitPath(Globals.Config.RtGameStateFileName, ref _saveFilePath, ref _saveFileName, ref _saveFileExtension);

            Debug.Assert(gEngine.IsSuccess(rc));

            Globals.Buf.SetFormat("{0}{1}_{2}{3}", SaveFilePath, SaveFileName, SaveSlotString, SaveFileExtension);

            SaveFileset.GameStateFileName = Globals.Buf.ToString().Truncate(Constants.FsFileNameLen);

            SaveConfig.RtFilesetFileName = Globals.CloneInstance(Globals.Config.RtFilesetFileName);

            SaveConfig.RtCharacterFileName = Globals.CloneInstance(SaveFileset.CharacterFileName);

            SaveConfig.RtModuleFileName = Globals.CloneInstance(SaveFileset.ModuleFileName);

            SaveConfig.RtRoomFileName = Globals.CloneInstance(SaveFileset.RoomFileName);

            SaveConfig.RtArtifactFileName = Globals.CloneInstance(SaveFileset.ArtifactFileName);

            SaveConfig.RtEffectFileName = Globals.CloneInstance(SaveFileset.EffectFileName);

            SaveConfig.RtMonsterFileName = Globals.CloneInstance(SaveFileset.MonsterFileName);

            SaveConfig.RtHintFileName = Globals.CloneInstance(SaveFileset.HintFileName);

            SaveConfig.RtTriggerFileName = Globals.CloneInstance(SaveFileset.TriggerFileName);

            SaveConfig.RtScriptFileName = Globals.CloneInstance(SaveFileset.ScriptFileName);

            SaveConfig.RtGameStateFileName = Globals.CloneInstance(SaveFileset.GameStateFileName);

            Globals.Config.DdFilesetFileName = SaveConfig.RtFilesetFileName;

            Globals.Config.DdCharacterFileName = SaveConfig.RtCharacterFileName;

            Globals.Config.DdModuleFileName = SaveConfig.RtModuleFileName;

            Globals.Config.DdRoomFileName = SaveConfig.RtRoomFileName;

            Globals.Config.DdArtifactFileName = SaveConfig.RtArtifactFileName;

            Globals.Config.DdEffectFileName = SaveConfig.RtEffectFileName;

            Globals.Config.DdMonsterFileName = SaveConfig.RtMonsterFileName;

            Globals.Config.DdHintFileName = SaveConfig.RtHintFileName;

            Globals.Config.DdTriggerFileName = SaveConfig.RtTriggerFileName;

            Globals.Config.DdScriptFileName = SaveConfig.RtScriptFileName;

            Globals.Config.DdEditingFilesets = true;

            Globals.Config.DdEditingCharacters = true;

            Globals.Config.DdEditingModules = true;

            Globals.Config.DdEditingRooms = true;

            Globals.Config.DdEditingArtifacts = true;

            Globals.Config.DdEditingEffects = true;

            Globals.Config.DdEditingMonsters = true;

            Globals.Config.DdEditingHints = true;

            Globals.Config.DdEditingTriggers = true;

            Globals.Config.DdEditingScripts = true;

            FullArtifactList = Globals.Database.ArtifactTable.Records.ToList();

            foreach (var artifact in FullArtifactList)
            {
                if (artifact.IsCarriedByCharacter())
                {
                    artifact.SetCarriedByMonsterUid(gGameState.Cm);
                }
                else if (artifact.IsWornByCharacter())
                {
                    artifact.SetWornByMonsterUid(gGameState.Cm);
                }
            }

            GameSaved = true;

            rc = SaveConfig.SaveGameDatabase(false);

            if (gEngine.IsFailure(rc))
            {
                Globals.Error.WriteLine("Error: SaveGameDatabase function call failed");

                GameSaved = false;
            }

            foreach (var artifact in FullArtifactList)
            {
                if (artifact.IsCarriedByMonsterUid(gGameState.Cm))
                {
                    artifact.SetCarriedByCharacter();
                }
                else if (artifact.IsWornByMonsterUid(gGameState.Cm))
                {
                    artifact.SetWornByCharacter();
                }
            }

            rc = Globals.Database.SaveConfigs(SaveFileset.ConfigFileName, false);

            if (gEngine.IsFailure(rc))
            {
                Globals.Error.WriteLine("Error: SaveConfigs function call failed");

                GameSaved = false;
            }

            SaveConfig.Dispose();

            gOut.Print(GameSaved ? "Game saved." : "Game not saved.");

            if (NextState == null)
            {
                NextState = Globals.CreateInstance <IStartState>();
            }

            Globals.RevealContentCounter++;
        }
        public void Ongo()
        {
            try
            {
                TaskInfoDialog = TaskInfoDialogViewModel.getInstance();
                TaskMessage taskMessage = new TaskMessage();
                taskMessage.Title    = "导出项目:" + Project.ProjectName;
                taskMessage.Progress = 0.0;
                TaskInfoDialog.Messages.Insert(0, taskMessage);

                NaturalBuildingDal naturalBuildingDal = new NaturalBuildingDal();
                LogicalBuildingDal logicalBuildingDal = new LogicalBuildingDal();
                FloorDal           floorDal           = new FloorDal();
                HouseholdDal       householdDal       = new HouseholdDal();
                ObligeeDal         obligeeDal         = new ObligeeDal();
                MortgageDal        mortgageDal        = new MortgageDal();
                SequestrationDal   sequestrationDal   = new SequestrationDal();

                Task task = new Task(() =>
                {
                    try
                    {
                        book.Project          = Project;
                        book.TaskMessage      = taskMessage;
                        book.NaturalBuildings = naturalBuildingDal.GetListBy(t => t.ProjectID == Project.ID);
                        book.LogicalBuildings = logicalBuildingDal.GetListBy(t => t.ProjectID == Project.ID);
                        book.Floors           = floorDal.GetListBy(t => t.ProjectID == Project.ID);
                        book.Households       = householdDal.GetListBy(t => t.ProjectID == Project.ID);
                        book.Obligees         = obligeeDal.GetListBy(t => t.ProjectID == Project.ID);
                        if ("2".Equals(Project.OwnershipType))
                        {
                            book.Mortgages      = mortgageDal.GetListBy(t => t.ProjectID == Project.ID);
                            book.Sequestrations = sequestrationDal.GetListBy(t => t.ProjectID == Project.ID);
                        }

                        book.Open(TemplateFileName);
                        book.Write();
                        //book.SaveAsExcel(SaveFileName);
                    }
                    catch (Exception ex)
                    {
                        ErrorMsg.Add(ex.Message);
                    }
                    ErrorMsg.AddRange(book.ErrorMsg);
                });
                task.Start();
                task.ContinueWith(t =>
                {
                    ThreadPool.QueueUserWorkItem(delegate
                    {
                        SynchronizationContext.SetSynchronizationContext(new
                                                                         System.Windows.Threading.DispatcherSynchronizationContext(System.Windows.Application.Current.Dispatcher));
                        SynchronizationContext.Current.Post(pl =>
                        {
                            foreach (var error in ErrorMsg)
                            {
                                taskMessage.DetailMessages.Add(error);
                            }
                            if (ErrorMsg != null && ErrorMsg.Count > 0)
                            {
                                taskMessage.DetailMessages.Add("导出失败");
                            }
                            else
                            {
                                string bufferPath = System.AppDomain.CurrentDomain.BaseDirectory + @"Buffer\" + Path.GetFileName(SaveFileName);
                                try
                                {
                                    book.SaveAsExcel(bufferPath);

                                    //// 压缩成报盘
                                    //ZipHelper zipHelper = new ZipHelper();
                                    //zipHelper.ZipFile(SaveFileName.Replace(".bpf", ".xls"), SaveFileName, 5, 500);
                                    //// 删除excel
                                    //File.Delete(SaveFileName.Replace(".bpf", ".xls"));

                                    if (Path.GetExtension(bufferPath) == ".xls")
                                    {
                                        File.Copy(bufferPath, SaveFileName, true);
                                        File.Delete(bufferPath);
                                    }
                                    else if (Path.GetExtension(bufferPath) == ".bpf")
                                    {
                                        File.Copy(bufferPath.Replace(".xls", ".bpf"), SaveFileName.Replace(".xls", ".bpf"), true);
                                        File.Delete(bufferPath.Replace(".xls", ".bpf"));
                                    }

                                    taskMessage.Progress = 100.00;
                                    taskMessage.DetailMessages.Add("导出成功");
                                }
                                catch (Exception ex)
                                {
                                    taskMessage.DetailMessages.Add(ex.Message + ex.StackTrace);
                                }
                            }
                        }, null);
                    });
                });
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }