public static bool Prefix(bool _debugPrints, string _savePath)
            {
                ItemSerializer.savePath    = _savePath;
                ItemSerializer.debugPrints = true;
                List <PlaceableItem> originalItemList = new List <PlaceableItem>(Singleton <BuildingController> .Instance.allItemsArray.array);
                List <PlaceableItem> itemsUsingDefaultSerializationSystem = new List <PlaceableItem>();
                List <PlaceableItem> itemsUsingCustomSerializationSystem  = new List <PlaceableItem>();

                foreach (PlaceableItem pl in originalItemList)
                {
                    if (pl == null)
                    {
                        continue;
                    }

                    bool isModded             = ActivePlaceableItemCreators.HasCreatorFromEnum(pl.itemType);
                    bool usesCustomSerializer = ActivePlaceableItemCreators.GetCreatorFromEnum(pl.itemType) is IACMFPlaceableItemCustomSerializationSystem;

                    if (isModded && usesCustomSerializer)
                    {
                        itemsUsingCustomSerializationSystem.Add(pl);
                    }
                    else
                    {
                        itemsUsingDefaultSerializationSystem.Add(pl);
                    }
                }

                DynamicArray <PlaceableItem> itemsToUseDefaultSerialisationBehaviour = new DynamicArray <PlaceableItem>(256);

                itemsToUseDefaultSerialisationBehaviour.AddRange(itemsUsingDefaultSerializationSystem.ToArray());
                ItemSerializer.SerializeItems(itemsToUseDefaultSerialisationBehaviour);
                PlaceableItemSerializer.SerializePlaceableItemsUsingCustomSerializationSystem(ItemSerializer.savePath, itemsUsingCustomSerializationSystem);
                return(false);
            }
Example #2
0
    // 바이너리 데이터를 패킷 데이터로 디시리얼라이즈 하는 생성자.
    public ItemPacket(byte[] data)
    {
        ItemSerializer serializer = new ItemSerializer();

        serializer.SetDeserializedData(data);
        serializer.Deserialize(ref m_packet);
    }
Example #3
0
    // 송신용 byte[]형 데이터를 획득.
    public byte[] GetData()
    {
        ItemSerializer serializer = new ItemSerializer();

        serializer.Serialize(m_packet);

        return(serializer.GetSerializedData());
    }
Example #4
0
 /// <summary>
 /// Serialize Item to an xml file
 /// </summary>
 /// <param name="item"></param>
 /// <param name="folderPath"></param>
 public static void SerializeItem(this Item item, string folderPath)
 {
     //Write the file
     using (StreamWriter sw = new StreamWriter(@folderPath + @"\" + item.ID + " " + item.Name + ".xml"))
     {
         sw.Write(ItemSerializer.GetItemXml(item, false));
     }
 }
        internal static void Serialize(List<IdleTimer> idleTimeCollection)
        {
            if (serializer == null)
            {
                serializer = new ItemSerializer<List<IdleTimer>>("IdleTimerCollection.dat");
            }

            serializer.Serialize(idleTimeCollection);
        }
        internal static void Serialize(List<JiraTimer> timerCollection)
        {
            if (serializer == null)
            {
                serializer = new ItemSerializer<List<JiraTimer>>("TimerCollection.dat");
            }

            serializer.Serialize(timerCollection);
        }
        internal static SettingsCollection DeSerialize()
        {
            if (serializer == null)
            {
                serializer = new ItemSerializer<SettingsCollection>("Settings.dat");
            }

            return serializer.DeSerialize();
        }
        internal static void Serialize(List<RecentJira> recentJiraCollection)
        {
            if (serializer == null)
            {
                serializer = new ItemSerializer<List<RecentJira>>("RecentJira.dat");
            }

            serializer.Serialize(recentJiraCollection);
        }
        internal static List<RecentJira> DeSerialize()
        {
            if (serializer == null)
            {
                serializer = new ItemSerializer<List<RecentJira>>("RecentJira.dat");
            }

            return serializer.DeSerialize();
        }
        internal static List<IdleTimer> DeSerialize()
        {
            if (serializer == null)
            {
                serializer = new ItemSerializer<List<IdleTimer>>("IdleTimerCollection.dat");
            }

            return serializer.DeSerialize();
        }
        internal static void Serialize(SettingsCollection settingsCollection)
        {
            if (serializer == null)
            {
                serializer = new ItemSerializer<SettingsCollection>("Settings.dat");
            }

            serializer.Serialize(settingsCollection);
        }
Example #12
0
        public void Serialize(System.IO.Stream stream, object graph, string rootElement = "this", string dtdFile = null)
        {
            EXmlWriter wrt = new EXmlWriter(stream);

            ItemSerializer ser = new ItemSerializer();

            ser.Serialize(wrt, graph, rootElement, dtdFile);

            wrt.Flush();
            wrt.Close();
        }
Example #13
0
        public ItemModule()
        {
            var serializer = new ItemSerializer();

            _actions = new ModuleAction[]
            {
                new ItemAction(serializer),
                new VersionsAction(serializer),
                new HelpAction()
            };
        }
Example #14
0
 public DynamicStore(string filePathPathWithoutExtension, long capacity, Func <TKey, long> hashFunction,
                     ItemSerializer <TKey, TValue> itemSerializer, HashTableOptions <TKey, TValue> options = null)
     : base(filePathPathWithoutExtension, capacity, new BaseHashTableOptions <TKey, TValue>
 {
     HashFunction  = hashFunction,
     KeyComparer   = options?.KeyComparer,
     ValueComparer = options?.ValueComparer
 })
 {
     initialDataFileSize         = options?.InitialDataFileSize ?? 8 * 1024 * 1024;
     dataFileSizeGrowthIncrement = options?.DataFileSizeGrowthIncrement ?? 4 * 1024 * 1024;
     this.itemSerializer         = itemSerializer;
 }
        internal static SettingsCollection DeSerialize()
        {
            if (serializer == null)
            {
                serializer = new ItemSerializer<SettingsCollection>("Settings.dat");
            }

            var settings = serializer.DeSerialize();

            if (settings.InternalSettings.ValidateInstallationId())
            {
                Serialize(settings);
            }

            return settings;
        }
Example #16
0
 // Writer
 public static void JsonSerializer(Jboy.JsonWriter writer, object instance)
 {
     ItemSerializer.JsonSerializer(writer, instance);
 }
Example #17
0
 // Reader
 public static object JsonDeserializer(Jboy.JsonReader reader)
 {
     return(ItemSerializer.JsonDeserializer(reader));
 }
Example #18
0
 public static StaticStore <TKey, TValue> GetStaticStore <TKey, TValue>(string filePathWithoutExtension, long capacity, Func <TKey, long> hashFunction, ItemSerializer <TKey, TValue> itemSerializer, HashTableOptions <TKey, TValue> options = null)
 {
     return(new StaticStore <TKey, TValue>(filePathWithoutExtension, capacity, hashFunction, itemSerializer, options));
 }
Example #19
0
 public ItemAction(ItemSerializer serializer)
 {
     _serializer = serializer;
 }