|
2 | 2 | using System.Diagnostics;
|
3 | 3 | using System.IO;
|
4 | 4 | using System.Management;
|
| 5 | +using System.Text; |
5 | 6 |
|
6 | 7 | namespace livelywpf.Core
|
7 | 8 | {
|
@@ -42,56 +43,35 @@ public WebProcess(string path, LibraryModel model, LivelyScreen display)
|
42 | 43 | }
|
43 | 44 | }
|
44 | 45 |
|
45 |
| - string cmdArgs; |
46 |
| - if (model.LivelyInfo.Type == WallpaperType.web) |
| 46 | + StringBuilder cmdArgs = new StringBuilder(); |
| 47 | + cmdArgs.Append("--url " + "\"" + path + "\"" + " --display " + "\"" + display + "\""); |
| 48 | + cmdArgs.Append(model.LivelyInfo.Type == WallpaperType.url ? " --type online" : " --type local" + " --property " + "\"" + LivelyPropertyCopy + "\""); |
| 49 | + //Fail to send empty string as arg; "debug" is set as optional variable in cmdline parser library. |
| 50 | + if (!string.IsNullOrWhiteSpace(Program.SettingsVM.Settings.WebDebugPort)) |
47 | 51 | {
|
48 |
| - //Fail to send empty string as arg; "debug" is set as optional variable in cmdline parser library. |
49 |
| - if (string.IsNullOrWhiteSpace(Program.SettingsVM.Settings.WebDebugPort)) |
50 |
| - { |
51 |
| - cmdArgs = "--url " + "\"" + path + "\"" + " --type local" + " --display " + "\"" + display + "\"" + |
52 |
| - " --property " + "\"" + LivelyPropertyCopy + "\""; |
53 |
| - } |
54 |
| - else |
55 |
| - { |
56 |
| - cmdArgs = "--url " + "\"" + path + "\"" + " --type local" + " --display " + "\"" + display + "\"" + |
57 |
| - " --property " + "\"" + LivelyPropertyCopy + "\"" + " --debug " + Program.SettingsVM.Settings.WebDebugPort; |
58 |
| - } |
| 52 | + cmdArgs.Append(" --debug " + Program.SettingsVM.Settings.WebDebugPort); |
59 | 53 | }
|
60 |
| - else if (model.LivelyInfo.Type == WallpaperType.webaudio) |
| 54 | + |
| 55 | + if (Program.SettingsVM.Settings.CefDiskCache) |
61 | 56 | {
|
62 |
| - if (string.IsNullOrWhiteSpace(Program.SettingsVM.Settings.WebDebugPort)) |
63 |
| - { |
64 |
| - cmdArgs = "--url " + "\"" + path + "\"" + " --type local" + " --display " + "\"" + display + "\"" + " --audio true" + |
65 |
| - " --property " + "\"" + LivelyPropertyCopy + "\""; |
66 |
| - } |
67 |
| - else |
68 |
| - { |
69 |
| - cmdArgs = "--url " + "\"" + path + "\"" + " --type local" + " --display " + "\"" + display + "\"" + " --audio true" + |
70 |
| - " --property " + "\"" + LivelyPropertyCopy + "\"" + " --debug " + Program.SettingsVM.Settings.WebDebugPort; |
71 |
| - } |
| 57 | + cmdArgs.Append(" --cache " + "\"" + Path.Combine(Program.AppDataDir, "Cef", "cache", display.DeviceNumber) + "\""); |
72 | 58 | }
|
73 |
| - else |
| 59 | + |
| 60 | + if (model.LivelyInfo.Type == WallpaperType.webaudio) |
74 | 61 | {
|
75 |
| - if (string.IsNullOrWhiteSpace(Program.SettingsVM.Settings.WebDebugPort)) |
76 |
| - { |
77 |
| - cmdArgs = "--url " + "\"" + path + "\"" + " --type online" + " --display " + "\"" + display + "\""; |
78 |
| - } |
79 |
| - else |
80 |
| - { |
81 |
| - cmdArgs = "--url " + "\"" + path + "\"" + " --type online" + " --display " + "\"" + display + "\"" + |
82 |
| - " --debug " + Program.SettingsVM.Settings.WebDebugPort; |
83 |
| - } |
| 62 | + cmdArgs.Append(" --audio true"); |
84 | 63 | }
|
85 | 64 |
|
86 | 65 | ProcessStartInfo start = new ProcessStartInfo
|
87 | 66 | {
|
88 |
| - Arguments = cmdArgs, |
| 67 | + Arguments = cmdArgs.ToString(), |
89 | 68 | FileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "plugins", "cef", "LivelyCefSharp.exe"),
|
90 | 69 | RedirectStandardInput = true,
|
91 | 70 | RedirectStandardOutput = true,
|
92 | 71 | UseShellExecute = false,
|
93 | 72 | WorkingDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "plugins", "cef")
|
94 | 73 | };
|
| 74 | + cmdArgs.Clear(); |
95 | 75 |
|
96 | 76 | Process webProcess = new Process
|
97 | 77 | {
|
|
0 commit comments