public static SendDataStorage FromString(string json, string name)
        {
            DataContractJsonSerializer deseralizer = new DataContractJsonSerializer(typeof(SendDataStorage));

            try {
                using (var ms = new MemoryStream(Encoding.UTF8.GetBytes(json))) {
                    SendDataStorage st = (SendDataStorage)deseralizer.ReadObject(ms);
                    st.file_name = name;
                    return(st);
                }
            } catch {
            } finally {
            }
            return(null);
        }
Esempio n. 2
0
        private void loadData(string conf)
        {
            conf = confNameToDataName(conf);
            if (conf == null)
            {
                return;
            }
            SendDataStorage s = SendDataStorage.Load(conf);

            if (s == null)
            {
                s           = new SendDataStorage();
                s.file_name = conf;
                s.Save();
            }
            sds = s;
            historyDataBox.BeginUpdate();
            for (int i = 0; i < sds.dataList.Count; i++)
            {
                SendDataStruct sd = sds.dataList[i];
                addHistoryBox(sd);
            }
            historyDataBox.EndUpdate();
        }