<commit_before><commit_msg>added<commit_after>package hxd;

class Save {
	
	static var cur = new Map();
	
	public static function load<T>( ?defValue : T, ?name = "save" ) : T {
		#if flash
		var saveObj = flash.net.SharedObject.getLocal(name);
		try {
			var data = Reflect.field(saveObj.data, "data");
			cur.set(name, data);
			return haxe.Unserializer.run(data);
		} catch( e : Dynamic ) {
			return defValue;
		}
		#else
		return defValue;
		#end
	}
	
	public static function save( val : Dynamic, ?name = "save" ) {
		#if flash
		var data = haxe.Serializer.run(val);
		if( data == cur.get(name) )
			return false;
		cur.set(name, data);
		var saveObj = flash.net.SharedObject.getLocal(name);
		saveObj.setProperty("data", data);
		saveObj.flush();
		return true;
		#else
		return false;
		#end
	}
	
}
{'fraction_non_alphanumeric': 0.1455223880597015, 'fraction_numerical': 0.0, 'mean_word_length': 3.398907103825137, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1911656', 'n_tokens_mistral': 331, 'n_tokens_neox': 290, 'n_words': 73}