public override void runAssetFile(Asset asset)
        {
            foreach (var obj in asset.ObjectInfos) {
                ulong oldSize = 0;
                mSizeDic.TryGetValue(obj.classID, out oldSize);
                mSizeDic[obj.classID] = oldSize + obj.length;
                totalSize += obj.length;
                var typeTree = typeTreeDatabase.GetType(asset.AssetVersion, obj.classID);
                if (typeTree != null) {
                    try {
                        SerializeObject sobj = new SerializeObject(typeTree, obj.data);
                        var property = sobj.FindProperty("m_Resource.m_Size");
                        if (property != null) {
                            ulong resSize = (ulong)property.Value;
                            totalSize += resSize;
                            mSizeDic[obj.classID] += resSize;
                        }
                    } catch {
                        Debug.LogError("Can't Create SerializeObject.TypeVerion:{0},TypeClassID:{1},TypeName:{2}",
                       typeTree.version, obj.classID, typeTree.type);
                    }

                }
            }
        }
        public void Extract(SerializeObject obj, string outputPath)
        {
            Unity.Texture2D tex = new Unity.Texture2D();
            tex.Deserialize(obj.RootProperty);
            //string m_Name = obj.FindProperty("m_Name").Value as string;
            //int m_Width = (int)obj.FindProperty("m_Width").Value;
            //int m_Height = (int)obj.FindProperty("m_Height").Value;
            //int m_CompleteImageSize = (int)obj.FindProperty("m_CompleteImageSize").Value;
            //int m_TextureFormat = (int)obj.FindProperty("m_TextureFormat").Value;
            //byte[] data = (byte[])obj.FindProperty("image data").Value;
            //Bitmap bmp = new Bitmap(m_Width, m_Height, PixelFormat.Format32bppArgb);
            //var bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
            //int bytes = Math.Abs(bmpData.Stride) * bmp.Height;
            //IntPtr ptr = bmpData.Scan0;
            //System.Runtime.InteropServices.Marshal.Copy(data, 0, ptr, bytes);
            Image iamg;

            //bmp.UnlockBits(bmpData);
            outputPath = outputPath + "/" + tex.name + "."+tex.m_TextureFormat;
            outputPath = AssetToolUtility.FixOuputPath(outputPath);
            if (!Directory.Exists(Path.GetDirectoryName(outputPath))) {
                Directory.CreateDirectory(Path.GetDirectoryName(outputPath));
            }
            File.WriteAllBytes(outputPath, tex.image_data);
            //bmp.Save(outputPath);
        }
 public void Extract(SerializeObject obj, string outputPath)
 {
     Font font = new Font();
     font.Deserialize(obj.RootProperty);
     string name = font.name;
     outputPath = outputPath + "/" + name + ".ttf";
     outputPath = AssetToolUtility.FixOuputPath(outputPath);
     if (!Directory.Exists(Path.GetDirectoryName(outputPath))) {
         Directory.CreateDirectory(Path.GetDirectoryName(outputPath));
     }
     File.WriteAllBytes(outputPath, font.FontData);
 }
            public static PAPNetworkContainer LoadPAPContainer(string pathName, string fileName)
            {
                throw new NotImplementedException();

                //Load the container
                PAPNetworkContainer returnItem = (PAPNetworkContainer)SerializeObject.Load(pathName + fileName + ".PAPc");

                //Load the network in as well
                returnItem.playerNetworkPool = new NNThreadSafeNetworkPool(NNLoadSave.loadNetwork(fileName + ".eNN", pathName), returnItem.playerId.ToString(), NNThreadSafeNetworkPool.DefaultListLength);

                return(returnItem);
            }
        public void TestPersistSerial()
        {
            BoltzmannMachine network = new BoltzmannMachine(4);

            network.SetWeight(1, 1, 1);
            network.Threshold[2] = 2;

            SerializeObject.Save(SERIAL_FILENAME.ToString(), network);
            BoltzmannMachine network2 = (BoltzmannMachine)SerializeObject.Load(SERIAL_FILENAME.ToString());

            ValidateHopfield(network2);
        }
            public void SavePAPContainer(string pathName, string fileName)
            {
                if (playerNetworkPool == null)
                {
                    throw new Exception("Network must be set before the PAP container can be saved out.");
                }

                //Save out the PAPContainer (without the network)
                SerializeObject.Save(pathName + fileName + ".PAPc", this);

                //Save out the network
                NNLoadSave.saveNetwork(playerNetworkPool.BaseNetwork, fileName + ".eNN", pathName);
            }
Beispiel #7
0
        public static EncogNeuralNetworkSlow DeSerialize()
        {
            var fileDialog = new OpenFileDialog();

            fileDialog.Filter = "enns files (*.enns)|*.enns";
            if (fileDialog.ShowDialog() == DialogResult.OK)
            {
                var ENNetwork = new EncogNeuralNetworkSlow();
                ENNetwork.Network = (BasicNetwork)SerializeObject.Load(fileDialog.FileName);
                return(ENNetwork);
            }
            return(null);
        }
Beispiel #8
0
        private void SaveToJson(ControlCollection control)
        {
            var    fieldControl             = ConvertListToJson.GetValueJsonForList(control);
            string json                     = SerializeObject.SerializeObjectByFieldControl(fieldControl);
            NameValueCollection appSettings = ConfigurationManager.AppSettings;
            string path                     = appSettings["PathDesignUI"] + objModules.ModuleLink;

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            File.WriteAllText(path + @"\" + objModules.ModuleNo + ".json", json);
        }
Beispiel #9
0
        public void TestContractSerializer()
        {
            var obj = new SerializeObject();

            obj.Data = new Dictionary <string, string>();
            obj.Data.Add("CAPITAL", "value");
            var json = JsonConvert.SerializeObject(obj, new JsonSerializerSettings
            {
                ContractResolver = new KeepCapitalCasePropertyNamesContractResolver(),
            });

            output.WriteLine(json);
            Assert.Equal("{\"data\":{\"CAPITAL\":\"value\"}}", json);
        }
        /// <summary>
        /// 将历史记录序列化为 Json 格式
        /// </summary>
        public string Serialize()
        {
            var json = new SerializeObject()
            {
                BeginTime = beginTime,
                Data      = data,
            };

#if UNITY_EDITOR
            return(JsonConvert.SerializeObject(json, Formatting.Indented));
#else
            return(JsonConvert.SerializeObject(json));
#endif
        }
Beispiel #11
0
        public void Serialize()
        {
            using (SaveFileDialog dialog = new SaveFileDialog())
            {
                dialog.Filter           = "ennq files (*.ennq)|*.ennq";
                dialog.FilterIndex      = 2;
                dialog.RestoreDirectory = true;

                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    SerializeObject.Save(dialog.FileName, Network);
                }
            }
        }
Beispiel #12
0
        public void Extract(SerializeObject obj, string outputPath)
        {
            Font font = new Font();

            font.Deserialize(obj.RootProperty);
            string name = font.name;

            outputPath = outputPath + "/" + name + ".ttf";
            outputPath = AssetToolUtility.FixOuputPath(outputPath);
            if (!Directory.Exists(Path.GetDirectoryName(outputPath)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(outputPath));
            }
            File.WriteAllBytes(outputPath, font.FontData);
        }
Beispiel #13
0
        public static EncogNeuralNetworkQuick DeSerialize(int divisionCountX, int divisionCountY)
        {
            var fileDialog = new OpenFileDialog();

            fileDialog.Filter = "ennq files (*.ennq)|*.ennq";
            if (fileDialog.ShowDialog() == DialogResult.OK)
            {
                var ENNetwork = new EncogNeuralNetworkQuick();
                ENNetwork.Network         = (BasicNetwork)SerializeObject.Load(fileDialog.FileName);
                ENNetwork._divisionCountX = divisionCountX;
                ENNetwork._divisionCountY = divisionCountY;
                return(ENNetwork);
            }
            return(null);
        }
        public void ReadXml(XmlReader reader)
        {
            reader.Read();
            if (reader.IsEmptyElement)
            {
                return;
            }

            SerializeObject serializeObject = (SerializeObject) new XmlSerializer(typeof(SerializeObject)).Deserialize(reader);


            this.AccessToken       = serializeObject.AccessToken;
            this.AccessTokenSecret = serializeObject.AccessTokenSecret;
            reader.Read();
        }
        public void Process()
        {
            this.network = NetworkUtil.CreateNetwork();
            Console.WriteLine("Preparing training sets...");
            this.common        = new CommonWords(Config.FILENAME_COMMON_WORDS);
            this.histogramGood = new WordHistogram(this.common);
            this.histogramBad  = new WordHistogram(this.common);

            // load the good words
            this.histogramGood.BuildFromFile(Config.FILENAME_GOOD_TRAINING_TEXT);
            this.histogramGood.BuildComplete();

            // load the bad words
            this.histogramBad.BuildFromFile(Config.FILENAME_BAD_TRAINING_TEXT);
            this.histogramBad.BuildComplete();

            // remove low scoring words
            this.histogramGood
            .RemoveBelow((int)this.histogramGood.CalculateMean());
            this.histogramBad.RemovePercent(0.99);

            // remove common words
            this.histogramGood.RemoveCommon(this.histogramBad);

            this.histogramGood.Trim(Config.INPUT_SIZE);

            this.goodAnalysis = new AnalyzeSentences(this.histogramGood,
                                                     Config.INPUT_SIZE);
            this.badAnalysis = new AnalyzeSentences(this.histogramGood,
                                                    Config.INPUT_SIZE);

            this.goodAnalysis.Process(this.trainingSet, 0.9,
                                      Config.FILENAME_GOOD_TRAINING_TEXT);
            this.badAnalysis.Process(this.trainingSet, 0.1,
                                     Config.FILENAME_BAD_TRAINING_TEXT);

            this.sampleCount = this.trainingSet.Ideal.Count;
            Console.WriteLine("Processing " + this.sampleCount + " training sets.");

            AllocateTrainingSets();

            CopyTrainingSets();

            TrainNetworkBackpropBackprop();
            SerializeObject.Save(Config.FILENAME_WHENBORN_NET, this.network);
            SerializeObject.Save(Config.FILENAME_HISTOGRAM, this.histogramGood);
            Console.WriteLine("Training complete.");
        }
Beispiel #16
0
        private static bool ReadYaml(string configPath)
        {
            config = new Config();

            if (!System.IO.File.Exists(configPath))
            {
                Console.WriteLine("Error! Can not find ./model/model.yaml file!");
                return(false);
            }
            else
            {
                SerializeObject.SetFilePath(configPath);
                config = SerializeObject.Deserializer <Config>();
            }
            return(true);
        }
Beispiel #17
0
        public void Execute(IExampleInterface app)
        {
            this.app = app;
            this.app = app;
            IMLDataSet   trainingSet = new BasicMLDataSet(XOR_INPUT, XOR_IDEAL);
            BasicNetwork network     = EncogUtility.SimpleFeedForward(2, 6, 0, 1, false);

            EncogUtility.TrainToError(network, trainingSet, 0.01);
            double error = network.CalculateError(trainingSet);

            SerializeObject.Save("encog.ser", network);
            network = (BasicNetwork)SerializeObject.Load("encog.ser");
            double error2 = network.CalculateError(trainingSet);

            app.WriteLine("Error before save to ser: " + Format.FormatPercent(error));
            app.WriteLine("Error before after to ser: " + Format.FormatPercent(error2));
        }
 public void Extract(SerializeObject obj, string outputPath)
 {
     TextAsset textAsset = new TextAsset();
     textAsset.Deserialize(obj.RootProperty);
     string name = textAsset.name;
     string script = "";
     outputPath = outputPath + "/" + name + ".txt";
     outputPath = AssetToolUtility.FixOuputPath(outputPath);
     if (!Directory.Exists(Path.GetDirectoryName(outputPath))) {
         Directory.CreateDirectory(Path.GetDirectoryName(outputPath));
     }
     var bytes = System.Text.Encoding.Unicode.GetBytes(script);
     var fs = new FileStream(outputPath, FileMode.OpenOrCreate, FileAccess.Write);
     fs.Write(bytes, 0, bytes.Length);
     fs.Flush();
     fs.Dispose();
 }
Beispiel #19
0
        public void geneticNeural()
        {
            Stopwatch          sw      = new Stopwatch();
            FeedforwardNetwork network = createNetwork();

            // train the neural network
            Console.WriteLine("Determining initial scores");
            TicTacToeGenetic train = new TicTacToeGenetic(network, true,
                                                          NeuralTicTacToe.POPULATION_SIZE,
                                                          NeuralTicTacToe.MUTATION_PERCENT, NeuralTicTacToe.MATE_PERCENT,
                                                          this.player2.GetType());

            train.UseThreadPool = true;
            sw.Stop();

            string duration = String.Format("Training_time: {0}", sw.Elapsed.Minutes);

            Console.WriteLine(duration);

            ThreadPool.SetMaxThreads(NeuralTicTacToe.THREAD_POOL_SIZE, NeuralTicTacToe.THREAD_POOL_SIZE);
            int epoch = 1;

            DateTime started = DateTime.Now;

            int    minutes = 0;
            double error   = train.getScore();

            do
            {
                sw.Start();
                error = train.getScore();
                if (error > 0)
                {
                    train.Iteration();
                }
                sw.Stop();

                minutes = sw.Elapsed.Minutes;

                string observation = String.Format("Epoch: {0}, Error:{1}, minutes_left : {2}", epoch, error, (NeuralTicTacToe.TRAIN_MINUTES - minutes));
                Console.WriteLine(observation);
                epoch++;
            } while (minutes < NeuralTicTacToe.TRAIN_MINUTES && error > 0.00001d);

            SerializeObject.Save("tictactoe.net", train.Network);
        }
Beispiel #20
0
        /// <summary>
        /// Loads a normalization from the specified directory and file.
        /// </summary>
        /// <param name="directory">The directory.</param>
        /// <param name="file">The file.</param>
        /// <returns>a datanormalization object</returns>
        public static DataNormalization LoadNormalization(string directory, string file)
        {
            DataNormalization norm        = null;
            FileInfo          networkFile = FileUtil.CombinePath(new FileInfo(@directory), @file);

            if (networkFile.Exists)
            {
                norm = (DataNormalization)SerializeObject.Load(networkFile.FullName);
            }

            if (norm == null)
            {
                Console.WriteLine(@"Can't find normalization resource: "
                                  + directory + file);
                return(null);
            }
            return(norm);
        }
Beispiel #21
0
        public DataNormalization LoadNormalization()
        {
            DataNormalization norm = null;

            if (_config.NormalizeFile.Exists)
            {
                norm = (DataNormalization)SerializeObject.Load(_config.NormalizeFile.ToString());
            }

            if (norm == null)
            {
                Console.WriteLine(@"Can't find normalization resource: "
                                  + _config.NormalizeFile);
                return(null);
            }

            return(norm);
        }
Beispiel #22
0
        /// <summary>
        /// The serialize person current.
        /// </summary>
        protected override void SerializePersonCurrent()
        {
            SerializeObject.EndPacket.CountMessages = SerializeObject.MessageCount().ToString(CultureInfo.InvariantCulture);

            // Сериализуем
            XmlSerializationHelper.SerializePersonErp(SerializeObject, GetFileNameFull());
            base.SerializePersonCurrent();

            // Пишем в базу код успешной выгрзуки
            var batch = ObjectFactory.GetInstance <IBatchManager>().GetById(BatchId);

            if (batch != null)
            {
                batch.CodeConfirm = ObjectFactory.GetInstance <IConceptCacheManager>().GetById(CodeConfirm.AA);
                ObjectFactory.GetInstance <IBatchManager>().SaveOrUpdate(batch);
                ObjectFactory.GetInstance <ISessionFactory>().GetCurrentSession().Flush();
            }
        }
Beispiel #23
0
        public static void Generate(ForestConfig config, bool useOneOf)
        {
            var generate = new GenerateData(config);

            generate.Step1();
            generate.Step2();
            DataNormalization norm = generate.Step3(useOneOf);

            // save the normalize object
            SerializeObject.Save(config.NormalizeFile.ToString(), norm);

            // create and save the neural network
            BasicNetwork network =
                EncogUtility.SimpleFeedForward(norm.GetNetworkInputLayerSize(),
                                               config.HiddenCount, 0, norm.GetNetworkOutputLayerSize(), true);

            EncogDirectoryPersistence.SaveObject(config.TrainedNetworkFile, network);
        }
Beispiel #24
0
        public JsonSerializers()
        {
            Utf8Json.JsonSerializer.SetDefaultResolver(Utf8Json.Resolvers.StandardResolver.Default);

            _obj = new SerializeObject
            {
                Foo = 1,
                Bar = "AAA",
                Baz = Baz.One,
                Qux = DateTimeOffset.Now,
            };
            _jsonNet = new Newtonsoft.Json.JsonSerializer();

            _jsonNetString  = Newtonsoft.Json.JsonConvert.SerializeObject(_obj);
            _jilString      = Jil.JSON.Serialize(_obj);
            _utf8jsonString = Encoding.UTF8.GetString(Utf8Json.JsonSerializer.Serialize(_obj));

            _jsonNetBytes  = Encoding.UTF8.GetBytes(_jsonNetString);
            _jilBytes      = Encoding.UTF8.GetBytes(_jilString);
            _utf8jsonBytes = Utf8Json.JsonSerializer.Serialize(_obj);

            using (var memory = new MemoryStream())
                using (var writer = new StreamWriter(memory)
                {
                    AutoFlush = true
                })
                {
                    _jsonNet.Serialize(writer, _obj);

                    _jsonNetStream = memory.ToArray();
                }

            using (var memory = new MemoryStream())
                using (var writer = new StreamWriter(memory)
                {
                    AutoFlush = true
                })
                {
                    Jil.JSON.Serialize(_obj, writer);

                    _jilStream = memory.ToArray();
                }
        }
Beispiel #25
0
        public void Extract(SerializeObject obj, string outputPath)
        {
            TextAsset textAsset = new TextAsset();

            textAsset.Deserialize(obj.RootProperty);
            string name   = textAsset.name;
            string script = "";

            outputPath = outputPath + "/" + name + ".txt";
            outputPath = AssetToolUtility.FixOuputPath(outputPath);
            if (!Directory.Exists(Path.GetDirectoryName(outputPath)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(outputPath));
            }
            var bytes = System.Text.Encoding.Unicode.GetBytes(script);
            var fs    = new FileStream(outputPath, FileMode.OpenOrCreate, FileAccess.Write);

            fs.Write(bytes, 0, bytes.Length);
            fs.Flush();
            fs.Dispose();
        }
Beispiel #26
0
        internal void UpdateServersCache(string key, RawResponse rawResponse, string pathUrl, string currentSiteUrl)
        {
            foreach (string server in _servers)
            {
#pragma warning disable 612,618
                ServicePointManager.CertificatePolicy = new TrustAllCertificatePolicy();
#pragma warning restore 612,618

                NameValueCollection queryString = HttpUtility.ParseQueryString(string.Empty);
                queryString["CacheLevel"]     = "First";
                queryString["key"]            = key;
                queryString["pathUrl"]        = pathUrl;
                queryString["currentSiteUrl"] = currentSiteUrl;

                queryString.ToString();

                var httpHandlerUrlBuilder = new UriBuilder(server + "_layouts/OceanikCacheSync.ashx")
                {
                    Query = queryString.ToString()
                };

                var req = (HttpWebRequest)WebRequest.Create(httpHandlerUrlBuilder.Uri);
                req.Method      = "POST";
                req.Credentials = CredentialCache.DefaultCredentials;

                byte[] rawResponseBytes = SerializeObject <RawResponse> .Object2ByteArray(rawResponse);

                req.ContentLength = rawResponseBytes.Length;
                req.ContentType   = "text/xml";

                Stream requestStream = req.GetRequestStream();
                requestStream.Write(rawResponseBytes, 0, rawResponseBytes.Length);
                requestStream.Close();
                req.GetResponse();
            }
        }
Beispiel #27
0
        private static SerializeObject ProcessPhoto(SerializeObject anprInfo)
        {
            var anpr  = new cmAnpr("default");
            var image = new gxImage("default");

            image.Load(anprInfo.PhotoPath);

            if (!anpr.FindFirst(image))
            {
                throw new NotFoundPhotoException($"Nie znaleziono zdjęcia o ścieżce: {anprInfo.PhotoPath}");
            }
            var frame = anpr.GetFrame();

            anprInfo.Vehicles.First().PlateLPR   = anpr.GetText();
            anprInfo.Vehicles.First().Confidence = anpr.GetConfidence();
            anprInfo.Vehicles.First().PlateX     = frame.x1;
            anprInfo.Vehicles.First().PlateY     = frame.y1;
            //anprInfo.Vehicles.First().PlateHeight = ;
            //anprInfo.Vehicles.First().PlateWidth = ;

            //while (anpr.FindNext())
            //{
            //    frame = anpr.GetFrame();
            //    anprInfo.Vehicles.Add(new Vehicle
            //    {
            //        PlateLPR = anpr.GetText(),
            //        Confidence = anpr.GetConfidence(),
            //        PlateX = frame.x1,
            //        PlateY = frame.y1,
            //        //PlateHeight =
            //        //PlateWidth =
            //    });
            //}

            return(anprInfo);
        }
Beispiel #28
0
 /// <summary>
 /// The add node.
 /// </summary>
 /// <param name="node">
 /// The node.
 /// </param>
 public override void AddNode(BaseMessageTemplate node)
 {
     SerializeObject.AddNode(node);
 }
Beispiel #29
0
 public SerializeObject GetInfoFromPhoto(SerializeObject anprInfo)
 {
     anprInfo = ProcessPhoto(anprInfo);
     return(anprInfo);
 }
 public void saveNeuralNetwork()
 {
     SerializeObject.Save("sp500.net", network);
 }
 public void loadNeuralNetwork()
 {
     network = (BasicNetwork)SerializeObject.Load("sp500.net");
 }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            //获取到标记对应的id
            int markerID = Convert.ToInt32(context.Request["id"]);

            //农田基本数据对象
            SoilNutrientSoft.BLL.FarmlandMeg   newFarmlandMegBll   = new SoilNutrientSoft.BLL.FarmlandMeg();
            SoilNutrientSoft.Model.FarmlandMeg newFarmlandMegModel = new SoilNutrientSoft.Model.FarmlandMeg();
            //根据id查询数据
            newFarmlandMegModel = newFarmlandMegBll.GetModel(markerID);

            //创建序列化对象
            JavaScriptSerializer JavaScriptSerializer = new JavaScriptSerializer();

            //转换成JSON字符串
            // var dataStr = JavaScriptSerializer.Serialize(newFarmlandMegModel);

            //**************************************************
            //土壤养分信息
            SoilNutrientSoft.BLL.SoilNutrientMeg          newSoilNutrientMegBll  = new SoilNutrientSoft.BLL.SoilNutrientMeg();
            List <SoilNutrientSoft.Model.SoilNutrientMeg> newSoilNutrientMegList = newSoilNutrientMegBll.GetModelList(" All_id = " + markerID.ToString());

            //转换成JSON字符串
            // var dataStr = JavaScriptSerializer.Serialize(newSoilNutrientMegList[0]);

            //**************************************************


            //作物数据
            SoilNutrientSoft.BLL.CropsMeg          newCropsMegBll  = new SoilNutrientSoft.BLL.CropsMeg();
            List <SoilNutrientSoft.Model.CropsMeg> newCropsMegList = newCropsMegBll.GetModelList(" All_id = " + markerID.ToString());

            //转换成JSON字符串
            //var dataStr = JavaScriptSerializer.Serialize(newCropsMegList[0]);

            //***************************************

            //农田建议
            SoilNutrientSoft.BLL.FarmlandMSug          newFarmlandMSugBll  = new SoilNutrientSoft.BLL.FarmlandMSug();
            List <SoilNutrientSoft.Model.FarmlandMSug> newFarmlandMSugList = newFarmlandMSugBll.GetModelList(" All_id = " + markerID.ToString());

            //转换成JSON字符串
            //var dataStr = JavaScriptSerializer.Serialize(newFarmlandMSugList[0]);


            //***************************************

            //图片
            SoilNutrientSoft.BLL.Picture newPictureBll = new SoilNutrientSoft.BLL.Picture();
            //得到数据集合
            List <SoilNutrientSoft.Model.Picture> newPictureModelList = newPictureBll.GetModelList(" All_id = " + markerID.ToString());

            //添加至内部类List中
            List <Pic> newPicList = new List <Pic>();

            foreach (var item in newPictureModelList)
            {
                newPicList.Add(new Pic()
                {
                    picPath = item.picturePath
                });
            }
            //转换成JSON字符串
            //var dataStr = JavaScriptSerializer.Serialize(newPicList);


            SerializeObject newSerializeObject = new SerializeObject()
            {
                FarmlandMegObject     = newFarmlandMegModel,
                SoilNutrientMegObject = newSoilNutrientMegList[0],
                CropsMegObject        = newCropsMegList[0],
                FarmlandMSugObject    = newFarmlandMSugList[0],
                PicObject             = newPicList
            };

            var dataStr = JavaScriptSerializer.Serialize(newSerializeObject);


            context.Response.Write(dataStr);
        }
Beispiel #33
0
 select new StringContent(SerializeObject(body, SerializerSettings)),
 () => null
 );
Beispiel #34
0
 /// <summary>
 /// Saves a normalization to the specified folder with the specified name.
 /// </summary>
 /// <param name="directory">The directory.</param>
 /// <param name="file">The file.</param>
 /// <param name="normTosave">The norm tosave.</param>
 public static void SaveNormalization(string directory, string file, DataNormalization normTosave)
 {
     SerializeObject.Save(directory + file, normTosave);
 }