diff --git a/Assets/QuickSheet/GDataPlugin/Editor/GDataDB/GDataDB/Impl/.svn/all-wcprops b/Assets/QuickSheet/GDataPlugin/Editor/GDataDB/GDataDB/Impl/.svn/all-wcprops deleted file mode 100644 index ffcefa3..0000000 --- a/Assets/QuickSheet/GDataPlugin/Editor/GDataDB/GDataDB/Impl/.svn/all-wcprops +++ /dev/null @@ -1,53 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 70 -/svn/G9_Canimal/!svn/ver/3357/Trunk/Assets/Editor/GDataDB/GDataDB/Impl -END -Row.cs.meta -K 25 -svn:wc:ra_dav:version-url -V 82 -/svn/G9_Canimal/!svn/ver/3357/Trunk/Assets/Editor/GDataDB/GDataDB/Impl/Row.cs.meta -END -Table.cs.meta -K 25 -svn:wc:ra_dav:version-url -V 84 -/svn/G9_Canimal/!svn/ver/3357/Trunk/Assets/Editor/GDataDB/GDataDB/Impl/Table.cs.meta -END -Serializer.cs.meta -K 25 -svn:wc:ra_dav:version-url -V 89 -/svn/G9_Canimal/!svn/ver/3357/Trunk/Assets/Editor/GDataDB/GDataDB/Impl/Serializer.cs.meta -END -Database.cs -K 25 -svn:wc:ra_dav:version-url -V 82 -/svn/G9_Canimal/!svn/ver/3357/Trunk/Assets/Editor/GDataDB/GDataDB/Impl/Database.cs -END -Row.cs -K 25 -svn:wc:ra_dav:version-url -V 77 -/svn/G9_Canimal/!svn/ver/3357/Trunk/Assets/Editor/GDataDB/GDataDB/Impl/Row.cs -END -Table.cs -K 25 -svn:wc:ra_dav:version-url -V 79 -/svn/G9_Canimal/!svn/ver/3357/Trunk/Assets/Editor/GDataDB/GDataDB/Impl/Table.cs -END -Database.cs.meta -K 25 -svn:wc:ra_dav:version-url -V 87 -/svn/G9_Canimal/!svn/ver/3357/Trunk/Assets/Editor/GDataDB/GDataDB/Impl/Database.cs.meta -END -Serializer.cs -K 25 -svn:wc:ra_dav:version-url -V 84 -/svn/G9_Canimal/!svn/ver/3357/Trunk/Assets/Editor/GDataDB/GDataDB/Impl/Serializer.cs -END diff --git a/Assets/QuickSheet/GDataPlugin/Editor/GDataDB/GDataDB/Impl/.svn/entries b/Assets/QuickSheet/GDataPlugin/Editor/GDataDB/GDataDB/Impl/.svn/entries deleted file mode 100644 index ac2dfe5..0000000 --- a/Assets/QuickSheet/GDataPlugin/Editor/GDataDB/GDataDB/Impl/.svn/entries +++ /dev/null @@ -1,300 +0,0 @@ -10 - -dir -3357 -http://office.gameus.co.kr:7001/svn/G9_Canimal/Trunk/Assets/Editor/GDataDB/GDataDB/Impl -http://office.gameus.co.kr:7001/svn/G9_Canimal - - - -2013-06-05T06:00:05.658445Z -3357 -hwpeterkim - - - - - - - - - - - - - - -69851156-2391-fc40-bb9f-d03dfa9181f8 - -Row.cs.meta -file - - - - -2013-03-29T09:21:42.000000Z -87ffcf3c8d470561956925e25cd3471a -2013-06-05T06:00:05.658445Z -3357 -hwpeterkim - - - - - - - - - - - - - - - - - - - - - -178 - -Table.cs.meta -file - - - - -2013-03-29T09:21:42.000000Z -8e4e686f22b4cda8f292535af3cfd3b9 -2013-06-05T06:00:05.658445Z -3357 -hwpeterkim - - - - - - - - - - - - - - - - - - - - - -178 - -Serializer.cs.meta -file - - - - -2013-03-29T09:21:42.000000Z -b6f7842b62565b49cc48caaf0492a0c2 -2013-06-05T06:00:05.658445Z -3357 -hwpeterkim - - - - - - - - - - - - - - - - - - - - - -178 - -Database.cs -file - - - - -2013-03-29T09:21:42.000000Z -6f18dcf20b380372b5d54323972a7267 -2013-06-05T06:00:05.658445Z -3357 -hwpeterkim - - - - - - - - - - - - - - - - - - - - - -2045 - -Row.cs -file - - - - -2013-03-29T09:21:42.000000Z -fd43d120cffaf9c8c60407e52717d89e -2013-06-05T06:00:05.658445Z -3357 -hwpeterkim - - - - - - - - - - - - - - - - - - - - - -530 - -Table.cs -file - - - - -2013-03-29T09:21:42.000000Z -b7fae19566f5ca74feee66607145494e -2013-06-05T06:00:05.658445Z -3357 -hwpeterkim - - - - - - - - - - - - - - - - - - - - - -3157 - -Database.cs.meta -file - - - - -2013-03-29T09:21:42.000000Z -668139f906e60424e68dd014e5af4664 -2013-06-05T06:00:05.658445Z -3357 -hwpeterkim - - - - - - - - - - - - - - - - - - - - - -178 - -Serializer.cs -file - - - - -2013-04-04T01:41:48.000000Z -51fece3a17cef4e0deb42310cde710d3 -2013-06-05T06:00:05.658445Z -3357 -hwpeterkim - - - - - - - - - - - - - - - - - - - - - -2315 - diff --git a/Assets/QuickSheet/GDataPlugin/Editor/GDataDB/GDataDB/Impl/.svn/text-base/Database.cs.meta.svn-base b/Assets/QuickSheet/GDataPlugin/Editor/GDataDB/GDataDB/Impl/.svn/text-base/Database.cs.meta.svn-base deleted file mode 100644 index 268f9fd..0000000 --- a/Assets/QuickSheet/GDataPlugin/Editor/GDataDB/GDataDB/Impl/.svn/text-base/Database.cs.meta.svn-base +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 95dbd957c296755498c0bfc3f38ac355 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/QuickSheet/GDataPlugin/Editor/GDataDB/GDataDB/Impl/.svn/text-base/Database.cs.svn-base b/Assets/QuickSheet/GDataPlugin/Editor/GDataDB/GDataDB/Impl/.svn/text-base/Database.cs.svn-base deleted file mode 100644 index 1439afc..0000000 --- a/Assets/QuickSheet/GDataPlugin/Editor/GDataDB/GDataDB/Impl/.svn/text-base/Database.cs.svn-base +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using Google.GData.Client; -using Google.GData.Documents; -using Google.GData.Spreadsheets; - -namespace GDataDB.Impl { - public class Database : IDatabase { - private readonly IDatabaseClient client; - private readonly AtomEntry entry; - - public Database(IDatabaseClient client, AtomEntry entry) { - this.client = client; - this.entry = entry; - } - - public ITable CreateTable(string name) { - var link = entry.Links.FindService(GDataSpreadsheetsNameTable.WorksheetRel, null); - var wsFeed = (WorksheetFeed) client.SpreadsheetService.Query(new WorksheetQuery(link.HRef.ToString())); - var length = typeof (T).GetProperties().Length; - var ws = wsFeed.Insert(new WorksheetEntry(1, (uint) length, name)); - var cellLink = new AtomLink(ws.CellFeedLink); - var cFeed = client.SpreadsheetService.Query(new CellQuery(cellLink.HRef.ToString())); - { - uint c = 0; - foreach (var p in typeof (T).GetProperties()) { - var entry1 = new CellEntry(1, ++c, p.Name); - cFeed.Insert(entry1); - } - } - return new Table(client.SpreadsheetService, ws); - } - - public ITable GetTable(string name) { - var link = entry.Links.FindService(GDataSpreadsheetsNameTable.WorksheetRel, null); - var wsFeed = (WorksheetFeed) client.SpreadsheetService.Query(new WorksheetQuery(link.HRef.ToString()) {Title = name, Exact = true}); - if (wsFeed.Entries.Count == 0) - return null; - return new Table(client.SpreadsheetService, (WorksheetEntry) wsFeed.Entries[0]); - } - - public void Delete() { - // cannot call "entry.Delete()" directly after modification as the EditUri is invalid - var feed = client.DocumentService.Query(new DocumentsListQuery(entry.SelfUri.ToString())); - feed.Entries[0].Delete(); - } - } -} \ No newline at end of file diff --git a/Assets/QuickSheet/GDataPlugin/Editor/GDataDB/GDataDB/Impl/.svn/text-base/Row.cs.meta.svn-base b/Assets/QuickSheet/GDataPlugin/Editor/GDataDB/GDataDB/Impl/.svn/text-base/Row.cs.meta.svn-base deleted file mode 100644 index 74f61ca..0000000 --- a/Assets/QuickSheet/GDataPlugin/Editor/GDataDB/GDataDB/Impl/.svn/text-base/Row.cs.meta.svn-base +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 6a5c6b56be3e37c4c939dd0b4527126d -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/QuickSheet/GDataPlugin/Editor/GDataDB/GDataDB/Impl/.svn/text-base/Row.cs.svn-base b/Assets/QuickSheet/GDataPlugin/Editor/GDataDB/GDataDB/Impl/.svn/text-base/Row.cs.svn-base deleted file mode 100644 index 4f7875d..0000000 --- a/Assets/QuickSheet/GDataPlugin/Editor/GDataDB/GDataDB/Impl/.svn/text-base/Row.cs.svn-base +++ /dev/null @@ -1,22 +0,0 @@ -using Google.GData.Spreadsheets; - -namespace GDataDB.Impl { - public class Row : IRow { - public T Element { get; set; } - private readonly ListEntry entry; - private readonly Serializer serializer = new Serializer(); - - public Row(ListEntry entry) { - this.entry = entry; - } - - public void Update() { - serializer.Serialize(Element, entry); - entry.Update(); - } - - public void Delete() { - entry.Delete(); - } - } -} \ No newline at end of file diff --git a/Assets/QuickSheet/GDataPlugin/Editor/GDataDB/GDataDB/Impl/.svn/text-base/Serializer.cs.meta.svn-base b/Assets/QuickSheet/GDataPlugin/Editor/GDataDB/GDataDB/Impl/.svn/text-base/Serializer.cs.meta.svn-base deleted file mode 100644 index c5d2f74..0000000 --- a/Assets/QuickSheet/GDataPlugin/Editor/GDataDB/GDataDB/Impl/.svn/text-base/Serializer.cs.meta.svn-base +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 667b9130d72e9ac4682c2694848ed56b -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/QuickSheet/GDataPlugin/Editor/GDataDB/GDataDB/Impl/.svn/text-base/Serializer.cs.svn-base b/Assets/QuickSheet/GDataPlugin/Editor/GDataDB/GDataDB/Impl/.svn/text-base/Serializer.cs.svn-base deleted file mode 100644 index 8fc8496..0000000 --- a/Assets/QuickSheet/GDataPlugin/Editor/GDataDB/GDataDB/Impl/.svn/text-base/Serializer.cs.svn-base +++ /dev/null @@ -1,77 +0,0 @@ -using UnityEngine; -using UnityEditor; - -using System; -using System.ComponentModel; -using System.Reflection; -using Google.GData.Spreadsheets; - -namespace GDataDB.Impl { - /// - /// (de)serializes an object into a spreadsheet row - /// Uses only the object properties. - /// Property names are used as column names in the spreadsheet - /// - /// - public class Serializer { - public ListEntry Serialize(T e) { - return Serialize(e, new ListEntry()); - } - - public ListEntry Serialize(T e, ListEntry record) { - foreach (var p in typeof (T).GetProperties()) { - if (p.CanRead) { - record.Elements.Add(new ListEntry.Custom { - LocalName = p.Name.ToLowerInvariant(), // for some reason this HAS to be lowercase or it throws - Value = ToNullOrString(p.GetValue(e, null)), - }); - } - } - return record; - } - - public string ToNullOrString(object o) { - if (o == null) - return null; - return o.ToString(); - } - - public object ConvertFrom(object value, Type t) { - if (t.IsGenericType && t.GetGenericTypeDefinition().Equals(typeof (Nullable<>))) { - var nc = new NullableConverter(t); - return nc.ConvertFrom(value); - } - - //HACK: modified to return enum. - if (t.IsEnum) - { - return Enum.Parse(t, value.ToString(), true); - } - else - return Convert.ChangeType(value, t); - } - - public T Deserialize(ListEntry e) { - var t = typeof (T); - var r = (T) Activator.CreateInstance(t); - foreach (ListEntry.Custom c in e.Elements) { - var property = t.GetProperty(c.LocalName, BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Public); - if (property == null) - continue; - if (property.CanWrite) { - - try - { - var value = ConvertFrom(c.Value, property.PropertyType); - property.SetValue(r, value, null); - } - catch(Exception exc) - { - Debug.LogError ("GDataDB Serialization Exception: " + exc.Message + " ListEntry LocalName: " + c.LocalName); - } - } - } - return r; - } - } -} \ No newline at end of file diff --git a/Assets/QuickSheet/GDataPlugin/Editor/GDataDB/GDataDB/Impl/.svn/text-base/Table.cs.meta.svn-base b/Assets/QuickSheet/GDataPlugin/Editor/GDataDB/GDataDB/Impl/.svn/text-base/Table.cs.meta.svn-base deleted file mode 100644 index 22324c8..0000000 --- a/Assets/QuickSheet/GDataPlugin/Editor/GDataDB/GDataDB/Impl/.svn/text-base/Table.cs.meta.svn-base +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 077c0760add2b3e4ebea39ece9adfdf8 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/QuickSheet/GDataPlugin/Editor/GDataDB/GDataDB/Impl/.svn/text-base/Table.cs.svn-base b/Assets/QuickSheet/GDataPlugin/Editor/GDataDB/GDataDB/Impl/.svn/text-base/Table.cs.svn-base deleted file mode 100644 index f3ee12d..0000000 --- a/Assets/QuickSheet/GDataPlugin/Editor/GDataDB/GDataDB/Impl/.svn/text-base/Table.cs.svn-base +++ /dev/null @@ -1,104 +0,0 @@ -using System; -using System.Collections.Generic; -using Google.GData.Client; -using Google.GData.Spreadsheets; - -namespace GDataDB.Impl { - public class Table : ITable { - private readonly IService svc; - private readonly WorksheetEntry entry; - private readonly Serializer serializer = new Serializer(); - - public Table(IService svc, WorksheetEntry entry) { - this.svc = svc; - this.entry = entry; - } - - public void Delete() { - var wsFeed = (WorksheetFeed)svc.Query(new WorksheetQuery(entry.SelfUri.ToString())); - wsFeed.Entries[0].Delete(); - } - - private ListQuery GetQuery() { - return new ListQuery(GetLink().HRef.Content); - } - - private ListFeed GetFeed() { - return (ListFeed) svc.Query(GetQuery()); - } - - private AtomLink GetLink() { - return entry.Links.FindService(GDataSpreadsheetsNameTable.ListRel, null); - } - - public IRow Add(T e) { - var feed = GetFeed(); - var newEntry = serializer.Serialize(e); - var rowEntry = feed.Insert(newEntry); - return new Row((ListEntry) rowEntry) {Element = e}; - } - - public IRow Get(int rowNumber) { - var q = GetQuery(); - q.StartIndex = rowNumber; - q.NumberToRetrieve = 1; - var results = Find(q); - if (results.Count == 0) - return null; - return results[0]; - } - - public IList> FindAll() { - return Find(GetQuery()); - } - - public IList> FindAll(int start, int count) { - return Find(new Query { - Start = start, - Count = count, - }); - } - - public IList> Find(string query) { - return Find(new Query {FreeQuery = query}); - } - - public IList> FindStructured(string query) { - return Find(new Query {StructuredQuery = query}); - } - - public IList> FindStructured(string query, int start, int count) { - return Find(new Query { - StructuredQuery = query, - Start = start, - Count = count, - }); - } - - public IList> Find(Query q) { - var fq = GetQuery(); - fq.Query = q.FreeQuery; - fq.SpreadsheetQuery = q.StructuredQuery; - fq.StartIndex = q.Start; - fq.NumberToRetrieve = q.Count; - if (q.Order != null) { - fq.OrderByColumn = q.Order.ColumnName; - fq.Reverse = q.Order.Descending; - } - return Find(fq); - } - - public Uri GetFeedUrl() { - return new Uri(GetFeed().Feed); - } - - private IList> Find(FeedQuery q) { - var feed = (ListFeed) svc.Query(q); - var l = new List>(); - foreach (ListEntry e in feed.Entries) { - l.Add(new Row(e) { Element = serializer.Deserialize(e) }); - } - return l; - } - } -} \ No newline at end of file