mirror of
https://github.com/ZuneDev/ZuneShell.dll.git
synced 2026-07-27 13:11:51 -07:00
Write generated data mapping models to files
This commit is contained in:
@@ -60,12 +60,32 @@ namespace ZuneHost.Wpf
|
||||
}
|
||||
}
|
||||
|
||||
Microsoft.Iris.Application.DebugSettings.GenerateDataMappingModels = true;
|
||||
Microsoft.Iris.Application.DebugSettings.DataMappingModels.CollectionChanged += DataMappingModels_CollectionChanged;
|
||||
|
||||
IntPtr hWnd = new System.Windows.Interop.WindowInteropHelper(this).Handle;
|
||||
Thread zuneThread = new Thread(new ThreadStart(() =>
|
||||
Microsoft.Zune.Shell.ZuneApplication.Launch(strArgs, hWnd)));
|
||||
zuneThread.Start();
|
||||
}
|
||||
|
||||
private void DataMappingModels_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
string destDir = Path.Combine(Environment.CurrentDirectory, "DataMappings");
|
||||
Directory.CreateDirectory(destDir);
|
||||
|
||||
foreach (var item in e.NewItems.Cast<Microsoft.Iris.Debug.DataMappingModel>())
|
||||
{
|
||||
FileInfo file = new(Path.Combine(destDir, $"{item.Provider}_{item.Type}.cs"));
|
||||
if (file.Exists) file.Delete();
|
||||
|
||||
using var stream = file.Open(FileMode.Create);
|
||||
using var writer = new StreamWriter(stream);
|
||||
writer.Write(item.GeneratedCode);
|
||||
writer.Flush();
|
||||
}
|
||||
}
|
||||
|
||||
public static void CopyAll(DirectoryInfo source, DirectoryInfo target)
|
||||
{
|
||||
// Check if the target directory exists
|
||||
|
||||
+1
-1
Submodule libs/MicrosoftIris updated: 5741116340...21fbce65df
Reference in New Issue
Block a user