FromBase64String









How do I use From Base64 String
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: ReorderableListResources.cs Copy
168         private static void LoadResourceAssets()
169         {
170             var skin = EditorGUIUtility.isProSkin ? s_DarkSkin : s_LightSkin;
171             s_Cached = new Texture2D[ skin.Length ];
172
173             for( int i = 0; i < s_Cached.Length; ++i )
174             {
175                 // Get image data (PNG) from base64 encoded strings.
176                 byte[] imageData = Convert.FromBase64String( skin[ i ] );
177
178                 // Gather image size from image data.
179                 int texWidth, texHeight;
180                 GetImageSize( imageData, out texWidth, out texHeight );
181
182                 // Generate texture asset.
183                 var tex = new Texture2D( texWidth, texHeight, TextureFormat.ARGB32, false, true );
184                 tex.hideFlags = HideFlags.HideAndDontSave;
185                 tex.name = "(Generated) ReorderableList:" + i;
186                 tex.filterMode = FilterMode.Point;
187                 tex.LoadImage( imageData );
188
189                 s_Cached[ i ] = tex;
190             }
191
192             s_LightSkin = null;
193             s_DarkSkin = null;
194         }
File name: ImportUtils.cs Copy
105         public static byte[] Base64ToBytes(string base64)
106         {
107             return Convert.FromBase64String(base64);
108         }
File name: ImportUtils.cs Copy
110         public static string Base64ToString(string base64)
111         {
112             byte[] bytes = Convert.FromBase64String(base64);
113             return Encoding.ASCII.GetString(bytes);
114         }

FromBase64String 134 lượt xem

Gõ tìm kiếm nhanh...