/// <summary>
        /// Write configuration to XmlConfigurationFile location
        /// </summary>
        /// <param name="config"></param>
        /// <returns></returns>
        public override bool Write(AppConfiguration config)
        {
            EncryptFields(config);

            bool result = JsonSerializationUtils.SerializeToFile(config, JsonConfigurationFile, false, true);

            // Have to decrypt again to make sure the properties are readable afterwards
            DecryptFields(config);

            return(result);
        }
        /// <summary>
        /// Return
        /// </summary>
        /// <typeparam name="TAppConfig"></typeparam>
        /// <returns></returns>
        public override TAppConfig Read <TAppConfig>()
        {
            var result = JsonSerializationUtils.DeserializeFromFile(JsonConfigurationFile, typeof(TAppConfig)) as TAppConfig;

            if (result != null)
            {
                DecryptFields(result);
            }

            return(result);
        }
        private void CoreWebView2_WebMessageReceived(object sender, Microsoft.Web.WebView2.Core.CoreWebView2WebMessageReceivedEventArgs e)
        {
            var text = e.TryGetWebMessageAsString();

            var callbackJson = JsonSerializationUtils.Deserialize(text, typeof(JsonCallbackObject)) as JsonCallbackObject;

            if (callbackJson.Method == "showMessage")
            {
                MessageBox.Show(callbackJson.Parameters[0] + "\r\n" + text, "WPF Window");
            }
        }
        private async void GetContent_Click(object sender, RoutedEventArgs e)
        {
            var cmd  = "textEditor.getvalue()";
            var json = await webView.ExecuteScriptAsync(cmd);

            var markdown = JsonSerializationUtils.Deserialize <string>(json);

            //var markdown = await JsInterop.CallMethod<string>("getvalue");

            MessageBox.Show(this, markdown, "Editor Content", MessageBoxButton.OK, MessageBoxImage.Information);
        }
        /// <summary>
        /// Calls a method on the TextEditor in JavaScript a single JSON encoded
        /// value or object. The receiving function should expect a JSON object and parse it.
        ///
        /// This version returns no result value.
        /// </summary>
        public async Task CallMethodWithJson(string method, object parameter = null)
        {
            string cmd = method;

            if (parameter != null)
            {
                var jsonParm = JsonSerializationUtils.Serialize(parameter);
                cmd += "(" + jsonParm + ")";
            }

            await WebBrowser.CoreWebView2.ExecuteScriptAsync(cmd);
        }
Beispiel #6
0
        public TableData GetJsonTableData()
        {
            string tdata = Invoke("parseTable", true) as string;  // asJson

            if (string.IsNullOrEmpty(tdata))
            {
                return(null);
            }

            var td = JsonSerializationUtils.Deserialize <TableData>(tdata);

            return(td);
        }
Beispiel #7
0
        private void ButtonSave_Click(object sender, RoutedEventArgs e)
        {
            if (IsPreCaptureMode)
            {
                DialogResult = true;
            }

            if (!ScreenCaptureConfiguration.Current.Write())
            {
                mmApp.Log("Failed to save Screen Capture " + ScreenCaptureConfiguration.Current.ErrorMessage + "\r\n" +
                          JsonSerializationUtils.Serialize(ScreenCaptureConfiguration.Current));
            }
            Close();
        }
        /// <summary>
        /// Calls a method on the TextEditor in JavaScript a single JSON encoded
        /// value or object. The receiving function should expect a JSON object and parse it.
        /// </summary>
        /// <param name="method"></param>
        /// <param name="parameter"></param>
        /// <returns></returns>
        public async Task <object> CallMethodWithJson <TResult>(string method, object parameter = null)
        {
            string cmd = method;

            if (parameter != null)
            {
                var jsonParm = JsonSerializationUtils.Serialize(parameter);
                cmd += "(" + jsonParm + ")";
            }

            string result = await WebBrowser.CoreWebView2.ExecuteScriptAsync(cmd);

            return(JsonSerializationUtils.Deserialize(result, typeof(TResult), true));
        }
Beispiel #9
0
        public void JsonDeserializeStringTest()
        {
            var config = new AutoConfigFileConfiguration();

            config.ApplicationName = "New App";
            config.DebugMode       = DebugModes.DeveloperErrorMessage;
            string json = JsonSerializationUtils.Serialize(config, true, true);

            config = null;

            config = JsonSerializationUtils.Deserialize(json, typeof(AutoConfigFileConfiguration), true) as AutoConfigFileConfiguration;

            Assert.IsNotNull(config);
            Assert.IsTrue(config.ApplicationName == "New App");
            Assert.IsTrue(config.DebugMode == DebugModes.DeveloperErrorMessage);
        }
Beispiel #10
0
        /// <summary>
        /// Reads configuration into the current instance of the config object passed in.
        /// </summary>
        /// <param name="config"></param>
        /// <returns></returns>
        public override bool Read(AppConfiguration config)
        {
            var newConfig = JsonSerializationUtils.DeserializeFromFile(JsonConfigurationFile, typeof(TAppConfiguration)) as TAppConfiguration;

            if (newConfig == null)
            {
                if (Write(config))
                {
                    return(true);
                }
                return(false);
            }
            DecryptFields(newConfig);
            DataUtils.CopyObjectData(newConfig, config, "Provider,ErrorMessage");

            return(true);
        }
        public async Task ProcessRequest()
        {
            var context = new ServiceHandlerRequestContext()
            {
                HttpContext   = HttpContext,
                ServiceConfig = ServiceConfiguration,

                Url = new ServiceHandlerRequestContextUrl()
                {
                    Url         = UriHelper.GetDisplayUrl(HttpContext.Request),
                    UrlPath     = HttpContext.Request.Path.Value.ToString(),
                    QueryString = HttpContext.Request.QueryString,
                    HttpMethod  = HttpContext.Request.Method.ToUpper()
                }
            };

            try
            {
                if (context.ServiceConfig.HttpsMode == ControllerHttpsMode.RequireHttps && HttpContext.Request.Scheme != "https")
                {
                    throw new UnauthorizedAccessException(Resources.ServiceMustBeAccessedOverHttps);
                }

                if (ServiceConfiguration.OnAfterMethodInvoke != null)
                {
                    await ServiceConfiguration.OnBeforeMethodInvoke(context);
                }

                await ExecuteMethod(context);

                ServiceConfiguration.OnAfterMethodInvoke?.Invoke(context);

                if (string.IsNullOrEmpty(context.ResultJson))
                {
                    context.ResultJson = JsonSerializationUtils.Serialize(context.ResultValue);
                }

                SendJsonResponse(context, context.ResultValue);
            }
            catch (Exception ex)
            {
                var error = new ErrorResponse(ex);
                SendJsonResponse(context, error);
            }
        }
        public bool Load(string filename = "~/LocalizationConfigurations.json")
        {
            if (filename.StartsWith("~/"))
            {
                filename = HttpContext.Current.Server.MapPath(filename);
            }

            if (!File.Exists(filename))
            {
                return(false);
            }

            var config =
                JsonSerializationUtils.DeserializeFromFile(filename, typeof(ConfigurationEntry))
                as List <ConfigurationEntry>;

            return(config != null);
        }
        private async Task <IEnumerable <Item> > DeserializeStashItemsAsync()
        {
            try
            {
                var file = Path.Combine(AppData.GetFolder(), "stash.json");
                if (File.Exists(file))
                {
                    var jArray = await JsonSerializationUtils.DeserializeJArrayFromFileAsync(file, true)
                                 .ConfigureAwait(false);

                    return(jArray.Select(item => new Item(PersistentData.EquipmentData, (JObject)item)));
                }
            }
            catch (Exception e)
            {
                Log.Error(e, "Could not deserialize stash");
            }
            return(Enumerable.Empty <Item>());
        }
Beispiel #14
0
        /// <summary>
        /// Writes out the request data to disk
        /// </summary>
        /// <param name="requests"></param>
        /// <param name="filename"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        public bool Save(List <HttpRequestData> requests, string filename,
                         StressTesterConfiguration options = null)
        {
            StringBuilder sb = new StringBuilder();

            foreach (var request in requests)
            {
                sb.Append(request.ToRequestHttpHeader());

                if (!string.IsNullOrEmpty(request.ResponseHeaders))
                {
                    sb.Append(request.ToResponseHttpHeader());
                }

                sb.AppendLine(STR_Separator);
            }

            if (options != null)
            {
                sb.AppendLine("\r\n" + STR_StartWebSurgeOptions + "\r\n");

                // Encrypt and write
                string password = options.Password;
                if (!string.IsNullOrEmpty(password))
                {
                    options.Password = Encryption.EncryptString(options.Password, App.EncryptionMachineKey);
                }
                sb.AppendLine(JsonSerializationUtils.Serialize(options, false, true));
                options.Password = password;

                sb.AppendLine("\r\n// This file was generated by West Wind WebSurge");
                sb.AppendLine($"// Get your free copy at {App.WebHomeUrl}");
                sb.AppendLine("// to easily test or load test the requests in this file.");

                sb.AppendLine("\r\n" + STR_EndWebSurgeOptions + "\r\n");
            }

            File.WriteAllText(filename, sb.ToString());

            return(true);
        }
Beispiel #15
0
        /// <summary>
        /// Retrieves results from various request files
        /// </summary>
        /// <returns></returns>
        public override List <HttpRequestData> GetResults()
        {
            if (FileCount < 1)
            {
                return(Results);
            }

            var list = new List <HttpRequestData>();

            if (!EnsureFileExists(Path.Combine(TempFolderName, "WebSurgeRequests_" + FileCount + ".json")))
            {
                return(null);
            }

            var files = Directory.GetFiles(
                Path.Combine(TempFolderName), "WebSurgeRequests_*.json", SearchOption.TopDirectoryOnly);

            foreach (var file in files)
            {
                int x = 0;

                if (!EnsureFileExists(file))
                {
                    return(null);
                }

                var reqs = JsonSerializationUtils.DeserializeFromFile(file, typeof(List <HttpRequestData>), true) as List <HttpRequestData>;
                if (reqs != null)
                {
                    list.AddRange(reqs);
                }
                else
                {
                    int yx = 1;
                }
            }

            list.AddRange(Results);

            return(list);
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public bool LoadKeyBindings(string filename = null)
        {
            if (filename == null)
            {
                filename = KeyBindingsFilename;
            }

            List <AppKeyBinding> keyBindings;

            keyBindings = JsonSerializationUtils.DeserializeFromFile(filename, typeof(List <AppKeyBinding>))
                          as List <AppKeyBinding>;

            if (keyBindings == null || keyBindings.Count < 1)
            {
                return(false);
            }

            // TODO: Fix bug with multiple keybindings to the same Command - need Unique Identifier
            foreach (var kb in keyBindings)
            {
                var keyBinding = KeyBindings.FirstOrDefault(binding => binding.Id == kb.Id);
                if (keyBinding == null)
                {
                    if (kb.CommandName == "EditorCommand")
                    {
                        keyBinding = kb;
                        keyBinding.HasJavaScriptHandler = true;
                        KeyBindings.Add(keyBinding);
                    }
                    continue;
                }

                keyBinding.Key = kb.Key;
                if (keyBinding.Command != null)
                {
                    keyBinding.Command.KeyboardShortcut = kb.Key;
                }
            }

            return(true);
        }
Beispiel #17
0
        public void PrettifyJsonStringTest()
        {
            var test = new
            {
                name    = "rick",
                company = "Westwind",
                entered = DateTime.UtcNow
            };

            string json = JsonConvert.SerializeObject(test);

            Console.WriteLine(json);


            string jsonFormatted = JsonSerializationUtils.FormatJsonString(json);

            //string jsonFormatted = JValue.Parse(json).ToString(Formatting.Indented);

            //JValue.Parse()
            Console.WriteLine(jsonFormatted);
        }
Beispiel #18
0
        public void DeserializeFromFileTest()
        {
            string fname = "serialized.config";

            var config = new AutoConfigFileConfiguration();

            config.ApplicationName = "New App";
            config.DebugMode       = DebugModes.DeveloperErrorMessage;
            bool result = JsonSerializationUtils.SerializeToFile(config, fname, true, true);

            Assert.IsTrue(result);

            config = null;

            config = JsonSerializationUtils.DeserializeFromFile(fname, typeof(AutoConfigFileConfiguration)) as
                     AutoConfigFileConfiguration;

            Assert.IsNotNull(config);
            Assert.IsTrue(config.ApplicationName == "New App");
            Assert.IsTrue(config.DebugMode == DebugModes.DeveloperErrorMessage);
        }
Beispiel #19
0
        StressTesterConfiguration ParseConfiguration(ref string sessionString)
        {
            StressTesterConfiguration options = null;

            string json = StringUtils.ExtractString(sessionString, STR_StartWebSurgeOptions, STR_EndWebSurgeOptions);

            if (!string.IsNullOrEmpty(json))
            {
                options = JsonSerializationUtils.Deserialize(json, typeof(StressTesterConfiguration))
                          as StressTesterConfiguration;

                if (options == null)
                {
                    options = new StressTesterConfiguration();
                }

                options.Password = Encryption.DecryptString(options.Password, App.EncryptionMachineKey);
            }

            return(options);
        }
Beispiel #20
0
        public void Native2PerfTest()
        {
            var config = new AutoConfigFileConfiguration();

            config.ApplicationName = "New App";
            config.DebugMode       = DebugModes.DeveloperErrorMessage;

            string result = JsonSerializationUtils.Serialize(config, true, true);

            var sw = new Stopwatch();

            sw.Start();

            for (int i = 0; i < 10000; i++)
            {
                result = JsonSerializationUtils.Serialize(config, true, true);
            }

            sw.Stop();
            Console.WriteLine("Utils Serialize: " + sw.ElapsedMilliseconds + "ms");
            Console.WriteLine(result);
        }
        /// <summary>
        /// Calls a method with simple parameters: String, number, boolean
        /// This version returns no results.
        /// </summary>
        /// <param name="method"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public async Task CallMethod(string method, params object[] parameters)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(method + "(");

            if (parameters != null)
            {
                for (var index = 0; index < parameters.Length; index++)
                {
                    object parm     = parameters[index];
                    var    jsonParm = JsonSerializationUtils.Serialize(parm);
                    sb.Append(jsonParm);
                    if (index < parameters.Length - 1)
                    {
                        sb.Append(",");
                    }
                }
            }
            sb.Append(")");

            await WebBrowser.CoreWebView2.ExecuteScriptAsync(sb.ToString());
        }
Beispiel #22
0
        /// <summary>
        /// Parses out the decoded text from the URL formatted text
        /// </summary>
        /// <returns></returns>
        public static string ParseUntitledString(string untitledText)
        {
            string text = null;

            try
            {
                if (untitledText.StartsWith("untitled.base64,", StringComparison.OrdinalIgnoreCase))
                {
                    text = untitledText.Substring("untitled.base64,".Length);
                    text = FromBase64(text);
                }
                else if (untitledText.StartsWith("untitled.urlencoded,", StringComparison.OrdinalIgnoreCase))
                {
                    text = untitledText.Substring("untitled.urlencoded,".Length);
                    text = FromBase64(WebUtility.UrlDecode(text));
                }
                else if (untitledText.StartsWith("untitled.text,", StringComparison.OrdinalIgnoreCase))
                {
                    text = untitledText.Substring("untitled.text,".Length);
                }
                else if (untitledText.StartsWith("untitled.json,", StringComparison.OrdinalIgnoreCase))
                {
                    text = untitledText.Substring("untitled.json,".Length);
                    if (!text.StartsWith("\'") && !text.StartsWith("\""))
                    {
                        text = "\"" + text + "\"";
                    }
                    text = JsonSerializationUtils.Deserialize(text, typeof(string)) as string;
                }
            }
            catch
            {
                text = "Invalid text formatting for imported text.";
            }

            return(text);
        }
        /// <summary>
        /// Writes a response with a full WebServerResult structure
        /// that allows maximum control over the response output.
        /// </summary>
        /// <param name="result"></param>

        public void WriteResponse(WebServerResult result)
        {
            var status = "OK";

            if (result.HttpStatusCode == 500)
            {
                status = "Server Error";
            }
            else if (result.HttpStatusCode == 404)
            {
                status = "Not Found";
            }
            else if (result.HttpStatusCode == 401)
            {
                status = "Unauthorized";
            }
            else if (result.HttpStatusCode == 204)
            {
                status = "No Content";
            }

            string headers =
                $"HTTP/1.1 {result.HttpStatusCode} {status}\r\n" +
                "Access-Control-Allow-Origin: *\r\n" +
                "Access-Control-Allow-Methods: GET,POST,PUT,OPTIONS\r\n" +
                "Access-Control-Allow-Headers: *\r\n";

            if (result.hasNoData)
            {
                WriteResponseInternal(null, headers);
            }
            else
            {
                var json = JsonSerializationUtils.Serialize(result, formatJsonOutput: true);
                WriteResponseInternal(json, headers + "Content-Type: application/json\r\n");
            }
        }
Beispiel #24
0
        /// <summary>
        /// Shows the WPF Preview menu
        /// </summary>
        /// <param name="positionAndElementType"></param>
        public void PreviewContextMenu(string positionAndElementType)
        {
            var pos = JsonSerializationUtils.Deserialize(positionAndElementType, typeof(PositionAndDocumentType));

            mmApp.Model.Window.PreviewBrowser.ExecuteCommand("PreviewContextMenu", pos);
        }
        public void RequestSummaryTest()
        {
            var time = DateTime.UtcNow;

            var requests = new List <HttpRequestData>()
            {
                new HttpRequestData()
                {
                    Url          = "http://localhost/",
                    Timestamp    = time,
                    IsError      = false,
                    TimeTakenMs  = 10,
                    ErrorMessage = "Invalid Server Response",
                    StatusCode   = "500"
                },
                new HttpRequestData()
                {
                    Url         = "http://localhost/wconnect",
                    Timestamp   = time.AddMilliseconds(20),
                    IsError     = false,
                    TimeTakenMs = 95
                },
                new HttpRequestData
                {
                    Url          = "http://localhost/",
                    Timestamp    = time.AddMilliseconds(220),
                    IsError      = false,
                    TimeTakenMs  = 15,
                    ErrorMessage = "Bogus Invalid Server Response",
                    StatusCode   = "500"
                },
                new HttpRequestData
                {
                    Url         = "http://localhost/",
                    Timestamp   = time.AddMilliseconds(1020),
                    TimeTakenMs = 20
                },
                new HttpRequestData
                {
                    Url         = "http://localhost/wconnect",
                    Timestamp   = time.AddMilliseconds(1050),
                    TimeTakenMs = 20
                },
                new HttpRequestData
                {
                    Url         = "http://localhost/",
                    Timestamp   = time.AddMilliseconds(1200),
                    TimeTakenMs = 20
                },
                new HttpRequestData
                {
                    Url         = "http://localhost/",
                    Timestamp   = time.AddMilliseconds(3020),
                    TimeTakenMs = 20
                },
                new HttpRequestData
                {
                    Url         = "http://localhost/",
                    Timestamp   = time.AddMilliseconds(3050),
                    TimeTakenMs = 20
                },
                new HttpRequestData
                {
                    Url         = "http://localhost/wconnect",
                    Timestamp   = time.AddMilliseconds(3200),
                    TimeTakenMs = 20
                },
                new HttpRequestData
                {
                    Url         = "http://localhost/wconnect",
                    Timestamp   = time.AddMilliseconds(3500),
                    TimeTakenMs = 50
                },
                new HttpRequestData
                {
                    Url         = "http://localhost/wconnect/testpage",
                    Timestamp   = time.AddMilliseconds(3100),
                    IsError     = false,
                    TimeTakenMs = 50
                },
                new HttpRequestData
                {
                    Url         = "http://localhost/wconnect/testpage",
                    IsError     = false,
                    Timestamp   = time.AddMilliseconds(3200),
                    TimeTakenMs = 57
                },
                new HttpRequestData
                {
                    Url         = "http://localhost/wconnect/testpage2",
                    Timestamp   = time.AddMilliseconds(3100),
                    TimeTakenMs = 50
                },
                new HttpRequestData
                {
                    Url         = "http://localhost/wconnect/testpage2",
                    Timestamp   = time.AddMilliseconds(3200),
                    TimeTakenMs = 57
                }
            };

            var writer = new RequestWriter(null, requests);


            var parser = new ResultsParser();
            var res    = parser.UrlSummary(writer, 200);

            Assert.IsNotNull(res);
            Assert.IsTrue(res.Count() > 0);

            foreach (var r in res)
            {
                Console.WriteLine(r.Url + ": " + JsonSerializationUtils.Serialize(r.Results, false, true));
            }


            var html = parser.GetResultReportHtml(writer, 10, 2);

            Console.WriteLine(html);

            var file = App.UserDataPath + "html\\_preview.html";

            File.WriteAllText(file, html);
            ShellUtils.GoUrl(file);
        }
        public void ResultsReportTimeTakenTest()
        {
            var time = DateTime.UtcNow;

            var requests = new List <HttpRequestData>()
            {
                new HttpRequestData()
                {
                    Timestamp   = time,
                    TimeTakenMs = 10
                },
                new HttpRequestData()
                {
                    Timestamp   = time.AddMilliseconds(20),
                    TimeTakenMs = 15
                },
                new HttpRequestData
                {
                    Timestamp   = time.AddMilliseconds(220),
                    TimeTakenMs = 15
                },
                new HttpRequestData
                {
                    Timestamp   = time.AddMilliseconds(1020),
                    TimeTakenMs = 20
                },
                new HttpRequestData
                {
                    Timestamp   = time.AddMilliseconds(1050),
                    TimeTakenMs = 20
                },
                new HttpRequestData
                {
                    Timestamp   = time.AddMilliseconds(1200),
                    TimeTakenMs = 20
                },
                new HttpRequestData
                {
                    Timestamp   = time.AddMilliseconds(3020),
                    TimeTakenMs = 20
                },
                new HttpRequestData
                {
                    Timestamp   = time.AddMilliseconds(3050),
                    TimeTakenMs = 20
                },
                new HttpRequestData
                {
                    Timestamp   = time.AddMilliseconds(3200),
                    TimeTakenMs = 20
                }, new HttpRequestData
                {
                    Timestamp   = time.AddMilliseconds(3500),
                    TimeTakenMs = 50
                }
            };
            var timeTakenMs = 30000;

            var stressTester = new StressTester();
            var writer       = new RequestWriter(stressTester);

            writer.SetResults(requests);

            var parser  = new ResultsParser();
            var results = parser.GetResultReport(writer, timeTakenMs, 10);

            Assert.AreEqual(timeTakenMs / 1000, results.TestResult.TimeTakenSecs);

            Console.WriteLine(JsonSerializationUtils.Serialize(results, false, true));
        }
Beispiel #27
0
        /// <summary>
        /// Retrieves a list of addins from the addin repository. Note this list
        /// is retrieved in chunks - first the summary list is retrieved and the
        /// remaining data is filled in later from individual repos.
        /// </summary>
        /// <param name="addinList"></param>
        /// <returns></returns>
        public async Task <List <AddinItem> > GetAddinListAsync(List <AddinItem> addinList = null)
        {
            if (addinList == null)
            {
                addinList = await GetInitialAddinListAsync();
            }

            if (addinList == null)
            {
                return(null);
            }

            //foreach (var ai in addinList)

            Parallel.ForEach(addinList,
                             new ParallelOptions {
                MaxDegreeOfParallelism = 20
            },
                             ai =>
            {
                try
                {
                    // not using async here so we can wait for final list result
                    // before returning
                    Debug.WriteLine(ai.gitVersionUrl);
                    var dl = HttpUtils.JsonRequest <AddinItem>(new HttpRequestSettings
                    {
                        Url = ai.gitVersionUrl
                    });

                    DataUtils.CopyObjectData(dl, ai, "id,name,gitVersionUrl,gitUrl");

                    string addinFolder = mmApp.Configuration.AddinsFolder;

                    if (Directory.Exists(Path.Combine(addinFolder, ai.id)) ||
                        Directory.Exists(Path.Combine(addinFolder, "Install", ai.id)))
                    {
                        ai.isInstalled = true;
                    }

                    try
                    {
                        var versionFile = Path.Combine(addinFolder, ai.id, "version.json");
                        if (File.Exists(versionFile))
                        {
                            var addinItem = JsonSerializationUtils.DeserializeFromFile(
                                versionFile, typeof(AddinItem), false)
                                            as AddinItem;

                            ai.installedVersion = addinItem.version;
                            if (addinItem != null && addinItem.version.CompareTo(ai.version) < 0)
                            {
                                ai.updateAvailable = true;
                            }
                        }
                    }
                    catch { }


                    if (File.Exists(".\\Addins\\Install\\" + ai.id + ".delete"))
                    {
                        ai.isInstalled = false;
                    }
                }
                catch (Exception ex)
                {
                    mmApp.Log($"Addin {ai.name} version failed", ex);
                }
            });


            return(addinList
                   .Where(ai => ai.updated > new DateTime(2016, 1, 1))
                   .OrderBy(ai => ai.isInstalled ? 0 : 1)
                   .ThenByDescending(ai => ai.updated)
                   .ToList());
        }
Beispiel #28
0
 public static string SaveUsersToJsonString(List <UserEntry> users)
 {
     return(JsonSerializationUtils.Serialize(users, throwExceptions: true, formatJsonOutput: true));
 }
Beispiel #29
0
 public static bool SaveUsersToJsonFile(List <UserEntry> users, string filename)
 {
     return(JsonSerializationUtils.SerializeToFile(users, filename, throwExceptions: true, formatJsonOutput: true));
 }
Beispiel #30
0
        public static List <UserEntry> LoadUsersFromJson(string json)
        {
            object result = JsonSerializationUtils.Deserialize(json, typeof(List <UserEntry>), throwExceptions: true);

            return(result as List <UserEntry>);
        }