简体   繁体   中英

how to Save the State of an c# App with powerShell?

I have a C# program in which the user adds multiple objects an editing Panel. These objects are all represented as a classes. Now I want the user to be able to save the scenario, so it can be loaded again.

for that I want to generate a Powershell script of each scénario , but my probléme is how to save diferent objects on Powershell , i tried to use serialization with XMLSerializer but I fail ,because i use a lot of dependant object who has Dictionaries and ListBoxs .

Is there some genereic save method I can use? Can you help me?

Finally, I stored on a PowerShell Script at each time the right properties of the GUI object. When I want to load my stored object, I replay the last sequence directly on PowerShell.

PowerShell has its own object serializer in the cmdlets Export-Clixml and Import-Clixml .

Get-Help Export-Clixml -Full | more Get-Help Export-Clixml -Full | more for details...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM