Пример #1
0
        // ================================================================================== List implementation

        /// <summary>
        /// Adds a Node object to the end of the <see cref="T:System.Collections.Generic.List`1"></see>, and then fires the Change event.
        /// </summary>
        /// <param name="item">The object to be added to the end of the <see cref="T:System.Collections.Generic.List`1"></see>. The value can be null for reference types.</param>
        public void Add(T item)
        {
            CheckId(item);
            Modifying();
            RawData.Add(item == null ? 0 : item.Id);
            Modified();
        }
Пример #2
0
 internal void SetSingleValue <Q>(Q value) where Q : Node
 {
     // Clear if value is null.
     if (value == null)
     {
         // Clear if there was any items.
         if (RawData.Count > 0)
         {
             Modifying(); // This clears th resolved list too.
             RawData.Clear();
             Modified();
         }
     }
     // Insert or change if value is notn ull.
     else
     {
         CheckId(value);
         Modifying(); // This clears th resolved list too.
         // Add if empty.
         if (RawData.Count == 0)
         {
             RawData.Add(value.Id);
         }
         // Change if not empty.
         else
         {
             RawData[0] = value.Id;
         }
         Modified();
     }
 }
Пример #3
0
 internal void SetSingleValue <Q>(Q value) where Q : Node
 {
     //-- Clear if value is null.
     if (value == null)
     {
         //-- Clear if there was any items.
         if (RawData.Count > 0)
         {
             Modifying(); //-- This clears th resolved list too.
             RawData.Clear();
             Modified();
         }
     }
     //-- Insert or change if value is notn ull.
     else
     {
         CheckId(value);
         Modifying(); //-- This clears th resolved list too.
         //-- Add if empty.
         if (RawData.Count == 0)
         {
             RawData.Add(value.Id);
         }
         //-- ha eddig nem volt ures, akkor a nulladik elem csereje
         //-- Change if not empty.
         else
         {
             RawData[0] = value.Id;
         }
         Modified();
         //_resolvedList = new List<Node>(new Q[] { value });
     }
 }
        public static RawData GetShaderVariantEntries(Shader shader)
        {
            if (shader == null)
            {
                return(null);
            }
            int[]    types    = null;
            String[] keywords = null;
            object[] args     = new object[] { shader, new ShaderVariantCollection(), types, keywords };
            ShaderUtils.GetShaderVariantEntriesMethod.Invoke(null, args);
            types    = args[2] as int[];
            keywords = args[3] as String[];
            var result = new RawData();

            for (int i = 0; i < keywords.Length; ++i)
            {
                var keyword = keywords[i];
                var sv      = new ShaderVariant(shader, ( PassType )types[i], keyword.Split(' '));
                List <ShaderVariant> variants;
                if (!result.TryGetValue(shader, out variants))
                {
                    variants = new List <ShaderVariant>();
                    result.Add(shader, variants);
                }
                variants.Add(sv);
            }
            return(result);
        }
Пример #5
0
 private RawData ParseData(SLDocument doc)
 {
     RawData data = new RawData();
     for (int i = 1; i <= numCols; i++)
     {
         data.Add(GetDataGroup(doc, i));
     }
     return data;
 }
Пример #6
0
        ///<summary>
        ///The weather controler of this run.
        ///</summary>

        /* public Weather Weather
         * {
         *   get { return weather; }
         * }*/

        // public Phenology.Phenology Ph { set; get; }

        #endregion

        ///<summary>
        ///Clone the current <c>Universe</c> and store it in the array <c>universes</c>.
        ///</summary>
        private void SaveCurrentUniverse()
        {
            var clone = new Universe(this, currentUniverse, false);

            savedUniverses.Add(clone);
            if (!IsSowDateEstimate)
            {
                currentUniverse.GrowthDay += 1;
            }
        }
Пример #7
0
        /// <summary>
        /// Add new value to Ring-Buffer and Raw-Value-List
        /// </summary>
        /// <param name="newValue"></param>
        public void Add(float newValue)
        {
            if (Values.Count >= Capacity)
            {
                Values.RemoveAt(0);
            }

            Values.Add(newValue);
            RawData.Add(new DataPayload(newValue, InitTime));
        }
Пример #8
0
 private RawData ParseData(string filepath)
 {
     RawData data = new RawData();
     XDocument doc = XDocument.Load(filepath);
     XNamespace ns = "AnovaXMLSchema.xsd";
     XElement root = doc.Descendants(ns + "DataSet").First();
     foreach (XElement group in root.Descendants(ns + "Group"))
     {
         data.Add(ReadXmlGroup(group, ns));
     }
     return data;
 }
        public static RawData ExtractData(ShaderVariantCollection svc)
        {
            var shaderVariants = new RawData();

            using (var so = new SerializedObject(svc)) {
                var array = so.FindProperty("m_Shaders.Array");
                if (array != null && array.isArray)
                {
                    var arraySize = array.arraySize;
                    for (int i = 0; i < arraySize; ++i)
                    {
                        var shaderRef            = array.FindPropertyRelative(String.Format("data[{0}].first", i));
                        var shaderShaderVariants = array.FindPropertyRelative(String.Format("data[{0}].second.variants", i));
                        if (shaderRef != null && shaderRef.propertyType == SerializedPropertyType.ObjectReference &&
                            shaderShaderVariants != null && shaderShaderVariants.isArray)
                        {
                            var shader = shaderRef.objectReferenceValue as Shader;
                            if (shader == null)
                            {
                                continue;
                            }
                            var shaderAssetPath           = AssetDatabase.GetAssetPath(shader);
                            List <ShaderVariant> variants = null;
                            if (!shaderVariants.TryGetValue(shader, out variants))
                            {
                                variants = new List <ShaderVariant>();
                                shaderVariants.Add(shader, variants);
                            }
                            var variantCount = shaderShaderVariants.arraySize;
                            for (int j = 0; j < variantCount; ++j)
                            {
                                var prop_keywords = shaderShaderVariants.FindPropertyRelative(String.Format("Array.data[{0}].keywords", j));
                                var prop_passType = shaderShaderVariants.FindPropertyRelative(String.Format("Array.data[{0}].passType", j));
                                if (prop_keywords != null && prop_passType != null && prop_keywords.propertyType == SerializedPropertyType.String)
                                {
                                    var srcKeywords = prop_keywords.stringValue;
                                    var keywords    = srcKeywords.Split(' ');
                                    var pathType    = (UnityEngine.Rendering.PassType)prop_passType.intValue;
                                    variants.Add(new ShaderVariant(shader, pathType, keywords));
                                }
                            }
                        }
                    }
                }
            }
            return(shaderVariants);
        }
Пример #10
0
 public bool TryParseData(string filepath, out RawData output)
 {
     try
     {
         output = new RawData();
         IEnumerable<string[]> fieldArrays = ExtractFields(filepath);
         foreach (string[] array in fieldArrays)
         {
             IEnumerable<string> fields = RemoveEmptyFields(array);
             DataGroup group = ParseDataGroup(fields);
             output.Add(group);
         }
         return true;
     }
     catch (Exception)
     {
         //todo: implement logging code here
         output = null;
         return false;
     }
 }
Пример #11
0
 public void Store(string key, object value)
 {
     RawData.Add(key, value);
 }
Пример #12
0
 public void FinalizeReport()
 {
     AnalyseData();
     this.RawData = new List <Item>();
     this.AllItems.ForEach(i => RawData.Add(i.GetCopy(true)));
 }