public static async Task <Dictionary <long, PlayItem> > GetPlayItemsAsync(IDataServer server) { var url = "https://api.whowatch.tv/playitems"; var res = await server.GetAsync(url); var obj = Tools.Deserialize <Low.PlayItems.RootObject[]>(res); var dict = new Dictionary <long, PlayItem>(); foreach (var a in obj) { var item = new PlayItem { Id = a.Id, Name = a.Name, ImageUrl = a.ImageUrl, SmallImageUrl = a.SmallImageUrl, }; foreach (var b in a.PlayItemPattern) { var subItem = new PlayItem { Id = b.Id, Name = b.Name, ImageUrl = b.ImageUrl, SmallImageUrl = b.SmallImageUrl, }; dict.Add(subItem.Id, subItem); } } return(dict); }
public ShowRoomSiteContext(ICommentOptions options, IDataServer server, ILogger logger, IUserStoreManager userStoreManager) : base(options, userStoreManager, logger) { _options = options; _server = server; _logger = logger; }
public DataServerInfo(String url, IDataServer remoteServer, String name, int id) { _myURL = url; _myRemoteServer = remoteServer; _myName = name; _id = id; }
public DataServerInfo(int id) { _myURL = null; _myRemoteServer = null; _myName = null; _id = id; }
/// <summary> /// Attempts to expand a domain lookup value /// </summary> /// <param name="shortValue">The short lookup string</param> /// <param name="columnName">The name of the column the lookup value was obtained from</param> /// <param name="table">The table containing the column</param> /// <returns>The expanded value in the domain associated with the column. If the column is /// not associated with a domain table, or the lookup string cannot be found, you get back /// the supplied <paramref name="shortValue"/>.</returns> /// <remarks>There is some scope for efficiency improvement here. Rather than doing this /// every time some RowTextGeometry is drawn, it would make sense to hold something like /// a <c>PreparedTemplate</c> object that holds a parsed template that points more directly /// to any domains involved.</remarks> static string GetDomainValue(string shortValue, string columnName, ITable table) { // Attempt to locate the column in question IColumnDomain[] cds = table.ColumnDomains; IColumnDomain cd = Array.Find <IColumnDomain>(cds, t => String.Compare(t.ColumnName, columnName, true) == 0); if (cd == null) { return(shortValue); } // Obtain the database server IDataServer ds = EditingController.Current.DataServer; if (ds == null) { return(shortValue); } // Perform a lookup on the domain IDomainTable dt = cd.Domain; string longValue = dt.Lookup(ds.ConnectionString, shortValue); // If it's not there, it SHOULD be blank if (String.IsNullOrEmpty(longValue)) { return(shortValue); } else { return(longValue); } }
/// <summary> /// Initializes a new instance of the <see cref="EditingController"/> class. /// </summary> /// <param name="main">The main dialog for the Cadastral Editor application</param> internal EditingController(MainForm main) : base() { if (main == null) { throw new ArgumentNullException(); } m_Project = null; m_ActiveLayer = null; m_Main = main; m_IsAutoSelect = 0; m_Inverse = null; m_Check = null; m_Sel = null; m_HasSelectionChanged = false; m_DataServer = null; // If we know of a database, create the access class string cs = LastDatabase.ConnectionString; if (!String.IsNullOrWhiteSpace(cs)) { m_DataServer = new DataServer(cs); } }
/// <summary> /// Attempts to locate any rows of attribute data that have a specific key (this involves /// a select on all database tables that have been associated with Backsight). /// </summary> /// <param name="key">The key to look for</param> /// <returns>The rows found (may be an empty array)</returns> internal static DataRow[] FindByKey(string key) { // Locate information about the tables associated with Backsight ITable[] tables = EnvironmentContainer.Current.Tables; if (tables.Length == 0) { return(new DataRow[0]); } IDataServer ds = EditingController.Current.DataServer; if (ds == null) { return(new DataRow[0]); } List <DataRow> result = new List <DataRow>(); foreach (ITable t in tables) { string sql = String.Format("SELECT * FROM {0} WHERE [{1}]='{2}'", t.TableName, t.IdColumnName, key); DataTable tab = ds.ExecuteSelect(sql); tab.TableName = t.TableName; result.AddRange(tab.Select()); } return(result.ToArray()); }
public PanasonicSerialReader(IDataServer server, short id, string name) { _server = server; _id = id; _name = name; //spare1 = {COM3,9600,Odd,8,One} }
public DummyImpl(IDataServer server, string input, ILogger logger, CookieContainer cc, IMixerSiteOptions siteOptions, MessageProvider2 p1) { _server = server; _input = input; _cc = cc; _p1 = p1; }
public static async Task <LiveData> PostCommentAsync(IDataServer server, long live_id, long lastUpdatedAt, string comment, CookieContainer cc) { var url = $"https://api.whowatch.tv/lives/{live_id}/comments"; var headers = new Dictionary <string, string> { { "Referer", "https://whowatch.tv/" }, { "Accept", "application/json" }, { "Origin", "https://whowatch.tv" }, }; var dict = new Dictionary <string, string> { { "last_updated_at", lastUpdatedAt.ToString() }, { "message", comment }, }; var res = await server.PostAsync(url, headers, dict, cc); //"Origin"を"https://whowatch.tv/"と間違って送信したら以下の文字列が返ってきた。コメント投稿に失敗した場合のレスポンスが来たら例外を投げるようにしたい。 //また、その例外には問題解決のためにlive_idとかcookieとか動的な情報を出来るだけ網羅的に入れ込みたい //"{\"error_code\":\"Z-005\",\"error_message\":\"お使いのブラウザではご利用いただけません。お手数ですが、別のブラウザをお試しください。(Z-005)\"}" //live_idが0の時に返ってきた //{"error_code":"C-101","error_message":"指定された配信が見つかりません。(C-101)"} var d = DynamicJson.Parse(res); if (d.IsDefined("error_message")) { var errorMessage = (string)d.error_message; //throw new CommentPostFailedException() throw new Exception($"コメント投稿に失敗 error_message={errorMessage}, live_id={live_id}, comment={comment}"); } var obj = Tools.Deserialize <Low.LiveData.RootObject>(res); return(Tools.Parse(obj)); }
public static async Task <Me> GetMyAsync(IDataServer server, List <Cookie> cookies) { //Cookie: _ga=GA1.2.1887758210.1492703493; _trmccid=8791bd77daaaeab8; _ldbrbid=tr_dc24b04cfc4630fac6c9301351e483618c2d164d9e7449be37fb5890502714b5; ldsuid=y2iOYFvTNEm4X4S1GYs6Ag==; _trmcuser={"id":""}; _ga=GA1.3.1887758210.1492703493; linelive=c7cc59e8f126353cb23192827520afe5f25e8a893efb791d06d70b69a6f70e15; _trmcdisabled2=-1; _trmcsession={"id":"3f8174e641d2b20b","path":"/","query":"","params":{},"time":1541067304256}; _gid=GA1.3.1706626909.1541067304; __try__=1541067317211; _gat=1 string accessToken = null; foreach (var cookie in cookies) { if (cookie.Name == "linelive") { accessToken = cookie.Value; } } if (string.IsNullOrEmpty(accessToken)) { //未ログイン。どうせ情報を取得できないから諦める。 return(null); } var url = "https://live-api.line-apps.com/app/my"; var headers = new Dictionary <string, string>() { { "X-CastService-WebClient-AccessToken", accessToken }, }; var cc = Tools.CreateCookieContainer(cookies); var res = await server.GetAsync(url, headers, cc); var low = JsonConvert.DeserializeObject <Low.My.RootObject>(res); var me = new Me { DisplayName = low.User.DisplayName, UserId = low.User.Id.ToString(), }; return(me); }
public static async Task <Dictionary <int, string> > GetImageDictionary(IDataServer server, long room_id, CookieContainer cc) { var url = $"https://cloudac.mildom.com/nonolive/gappserv/emotion/getListV1?room_id={room_id}&__platform=web"; var res = await server.GetAsync(url, new Dictionary <string, string>()); var d = DynamicJson.Parse(res); var dict = new Dictionary <int, string>(); if ((int)d == 0) { const string urlPrefix = "https://res.mildom.com/download/file/"; var obj = Tools.Deserialize <Low.emotions.RootObject>(res); foreach (var emot in obj.Body.OfficialEmotions) { dict.Add((int)emot.Id, urlPrefix + emot.Pic); } if (obj.Body.FansGroupEmotions != null) { foreach (var emot in obj.Body.FansGroupEmotions) { dict.Add((int)emot.Id, urlPrefix + emot.Pic); } } } return(dict); }
public static string GetTagName(this ITag tag) { IDataServer srv = tag.Parent.Server; int ind = srv.GetItemProperties(tag.ID); return(ind < 0 ? null : srv.MetaDataList[ind].Name); }
public static TagMetaData GetMetaData(this ITag tag) { IDataServer srv = tag.Parent.Server; int index = srv.GetItemProperties(tag.ID); return(index < 0 ? new TagMetaData() : srv.MetaDataList[index]); }
/// <summary> /// Creates a brand new project. If this completes without any exception, you can /// call <see cref="OpenProject"/> to activate the project. /// </summary> /// <param name="projectName">The user-perceived name for the project.</param> /// <param name="layer">The map layer the project is for (not null)</param> internal void CreateProject(string projectName, ILayer layer) { if (String.IsNullOrWhiteSpace(projectName) || layer == null) { throw new ArgumentNullException(); } // Confirm that the project name is unique if (FindProjectId(projectName) != null) { throw new ArgumentException("Specified project already exists"); } // Define the event data NewProjectEvent e = new NewProjectEvent() { ProjectId = Guid.NewGuid(), ProjectName = projectName, LayerId = layer.Id, DefaultSystem = String.Empty, UserName = System.Environment.UserName, MachineName = System.Environment.MachineName }; // Create the index entry CreateIndexEntry(projectName, e.ProjectId); // Create the data folder string dataFolder = CreateDataFolder(e.ProjectId); // Serialize the event data to the data folder. Specify <Change> so that // the class name will be included in the output file. string s = EditSerializer.GetSerializedString <Change>(DataField.Edit, e); string fileName = Path.Combine(dataFolder, GetDataFileName(e.EditSequence)); File.WriteAllText(fileName, s); // Write initial project settings to the data folder ProjectSettings ps = new ProjectSettings(); IDataServer ds = EditingController.Current.DataServer; if (ds != null) { ps.ConnectionString = ds.ConnectionString; } // Turn off auto-number if there's no database connection string if (String.IsNullOrEmpty(ps.ConnectionString)) { ps.IsAutoNumber = false; } // Remember default entity types for points, lines, text, polygons ps.SetEntityTypeDefaults(layer); // Save the settings string settingsFileName = Path.Combine(dataFolder, "settings.txt"); ps.WriteXML(settingsFileName); }
public static bool HasSubCondition(this IDataServer dserver, string sourceName, SubAlarmType alarmType) { IAlarmServer server = dserver as IAlarmServer; if (server == null) { return(false); } var conds = server.QueryConditions(sourceName); if (conds == null) { return(false); } foreach (ICondition cond in conds) { var subs = cond.SubConditions; if (subs != null && subs.Count > 0) { foreach (var sub in subs) { if (sub.SubAlarmType == alarmType) { return(true); } } } } return(false); }
public ModbusTCPReader(IDataServer server, short id, string name) { _id = id; _name = name; _server = server; modbusNet = new ModbusTcpNet(); }
public WhowatchSiteContext(ICommentOptions options, ILogger logger, IUserStoreManager userStoreManager) : base(options, userStoreManager, logger) { _options = options; _server = CreateServer(); _logger = logger; }
/// <summary> /// 現在放送中の番組の情報を取得する /// </summary> /// <param name="server"></param> /// <param name="channel"></param> /// <returns></returns> public static async Task <Stream> GetStreamAsync(IDataServer server, string channel) { //var url = "https://api.twitch.tv/kraken/streams/" + channel; //var headers = new Dictionary<string, string> //{ // {"client-id","jzkbprff40iqj646a697cyrvl0zt2m6" },//固定値 // {"Accept","application/vnd.twitchtv.v3+json" }, //}; //var s = await server.GetAsync(url, headers); var url = "https://api.twitch.tv/helix/streams?user_login="******"client-id", "jzkbprff40iqj646a697cyrvl0zt2m6" },//固定値 //{"Accept","application/vnd.twitchtv.v3+json" }, }; var s = await server.GetAsync(url, headers); //配信していないとき //{"data":[],"pagination":{}} var lowObject = Tools.Deserialize <Low.Streams.RootObject>(s); if (lowObject.Data.Length > 0) { var ret = new Stream(lowObject.Data[0]); return(ret); } else { return(null); } }
/// <summary> /// Removes all data from all Backsight tables. This is done when a new environment /// is being imported. You will probably need to bracket this call with calls /// to <see cref="EnableForeignKeys"/> (disable foreign key constraints, then /// remove, then import, then re-enable constraints). /// </summary> /// <param name="db">The data server containing the tables</param> public void RemoveAll(IDataServer db) { BacksightDataSet ds = new BacksightDataSet(); foreach (DataTable dt in ds.Tables) { // Assume the "ced" schema, since I don't see any DataTable.SchemaName property. string tableName = GetTableName(dt); string sql = String.Format("DELETE FROM [ced].[{0}]", tableName); db.ExecuteNonQuery(sql); } /* * using (IConnection ic = ConnectionFactory.GetConnection()) * { * SqlConnection c = ic.Value; * * foreach (DataTable dt in ds.Tables) * { * // Assume the "ced" schema, since I don't see any DataTable.SchemaName property. * string tableName = GetTableName(dt); * string sql = String.Format("DELETE FROM [ced].[{0}]", tableName); * SqlCommand cmd = new SqlCommand(sql, c); * cmd.ExecuteNonQuery(); * } * } */ }
public void connect(int slavePort) { try { _slavePort = slavePort; _slaveServer = (IDataServer)Activator.GetObject(typeof(IDataServer), PortToUrl(_slavePort)); Console.WriteLine("Backup ServerAt{0} registered", slavePort); SerializableDictionary <int, int> updateall = new SerializableDictionary <int, int> (); foreach (DictionaryEntry pair in PadInts) { Console.WriteLine("{0}={1}", pair.Key, pair.Value); int a = (int)pair.Key; PadInt b = (PadInt)pair.Value; int c = b.Value; updateall.Add(a, c); } _slaveServer.receiveUpdateAll(updateall); if (_isPrimary) { Console.WriteLine(" Connected with the Slave at: " + PortToUrl(_slavePort)); pingService = new Ping(_slaveServer, this); pingService.StartReceive(); } } catch (RemotingException re) { Console.WriteLine("[connect]:\n" + re); throw new OperationException("Server " + name + "cannot connect: SlaveServer is not avaiable."); } }
public MetadataProvider(ILogger logger, IDataServer server, string broadcasterId, MessageUntara messenger) { _logger = logger; _server = server; _broadcasterId = broadcasterId; _messenger = messenger; }
public static PadInt AccessPadInt(int uid) { try { IPadInt padIntObj; PadIntInfo obj = masterServer.AccessPadInt(uid); if (obj == null) { return(null); } if (!obj.hasPadInt()) // Catch remoting exception { IDataServer dataServer = (IDataServer)Activator.GetObject(typeof(IDataServer), obj.ServerUrl); padIntObj = dataServer.load(uid); } else { padIntObj = obj.PadInt; } PadInt localPadInt = new PadInt(uid, padIntObj); return(localPadInt); } catch (TxException re) { //Console.WriteLine("[AccessPadInt]: Cannot accessPadInt with uid " + uid + "\n" + re); String text = "[AccessPadInt]: Cannot accessPadInt with uid " + uid + "\n" + re; Console.WriteLine(text); //textBox.Invoke(new ClearTextDel(textBox.Clear)); //textBox.Invoke(new UpdateTextDel(textBox.AppendText), new object[] { text }); return(null); } }
public void SetUp() { var serverMock = new Mock <IDataServer>(); server = serverMock.Object; logger = new Mock <ILogger>().Object; var optionsMock = new Mock <ICommentOptions>(); options = optionsMock.Object; siteOptions = new LineLiveSiteOptions(); use1 = new UserTest("1"); use2 = new UserTest("2"); use3 = new UserTest("3"); use4 = new UserTest("4"); use5 = new UserTest("5"); use6 = new UserTest("6"); var userStoreMock = new Mock <IUserStoreManager>(); userStoreMock.Setup(s => s.GetUser(SiteType.LineLive, "1")).Returns(use1); userStoreMock.Setup(s => s.GetUser(SiteType.LineLive, "2")).Returns(use2); userStoreMock.Setup(s => s.GetUser(SiteType.LineLive, "3")).Returns(use3); userStoreMock.Setup(s => s.GetUser(SiteType.LineLive, "4")).Returns(use4); userStoreMock.Setup(s => s.GetUser(SiteType.LineLive, "5")).Returns(use5); userStoreMock.Setup(s => s.GetUser(SiteType.LineLive, "6")).Returns(use6); userStoreManager = userStoreMock.Object; }
public WebsocketMessageProvider(IWebsocket websocket, IDataServer server) { _websocket = websocket; _server = server; websocket.Opened += Websocket_Opened; websocket.Received += Websocket_Received; }
public PeriscopeConnector(IDataServer server, string broadcastId, IMessageProvider messageProvider, ILogger logger) { _server = server; _broadcastId = broadcastId; _messageProvider = messageProvider; _logger = logger; }
/// <summary> /// Displays database attributes so that they can be edited by the user. /// </summary> /// <param name="r">The row of interest</param> /// <returns>True if any changes were saved to the database</returns> internal static bool Update(Row r) { // If the row is associated with any RowText, ensure it is removed from // the spatial index NOW (if we wait until the edit has been completed, // it's possible we won't be able to update the index properly) TextFeature[] text = r.Id.GetRowText(); EditingIndex index = CadastralMapModel.Current.EditingIndex; bool isChanged = false; try { // Remove the text from the spatial index (but see comment below) foreach (TextFeature tf in text) { index.RemoveFeature(tf); } // Display the attribute entry dialog AttributeDataForm dial = new AttributeDataForm(r.Table, r.Data); isChanged = (dial.ShowDialog() == DialogResult.OK); dial.Dispose(); if (isChanged) { IDataServer ds = EditingController.Current.DataServer; if (ds == null) { throw new InvalidOperationException("No database available"); } ds.SaveRow(r.Data); } } finally { // Ensure text has been re-indexed... actually, this is likely to be // redundant, because nothing here has actually altered the stored // width and height of the text (if the attributes have become more // verbose, they'll just be scrunched up a bit tighter). The text // metrics probably should be reworked (kind of like AutoSize for // Windows labels), but I'm not sure whether this demands a formal // editing operation. foreach (TextFeature tf in text) { index.AddFeature(tf); } // Re-display the text if any changes have been saved if (isChanged) { ISpatialDisplay display = EditingController.Current.ActiveDisplay; display.Redraw(); } } return(isChanged); }
public override void Init() { base.Init(); mAllRoles = new List <int>(); mCampRoles = new KeyValueList <int, List <int> >(); mDataServer = DataServerName.GetServer <IDataServer>(); }
public PanasonicSerialReader(IDataServer server, short id, string name, string ip, int timeOut = 500, string spare1 = null, string spare2 = null) { _server = server; _id = id; //spare1 = {COM3,9600,Odd,8,One} _serialPort = new SerialPort("COM2", 57600, Parity.Odd, 8, StopBits.One); _devId = byte.Parse(spare2); }
public ModbusTCPReader(IDataServer server, short id, string name, string ip, int timeOut = 500, string spare1 = null, string spare2 = null) { _id = id; _name = name; _server = server; _ip = ip; _timeout = timeOut; }
/// <summary> /// Creates a new <c>ConnectionWrapper</c> that wraps the supplied connection. /// </summary> /// <param name="ds">The data server creating this wrapper (not null).</param> /// <param name="c">The connection to wrap (not null).</param> /// <param name="isDisposable">Should the connection be disposed of by the /// <see cref="Dispose"/> method? Specify <c>false</c> if the connection is being /// used by an enclosing transaction.</param> /// <exception cref="ArgumentNullException">If a null data server or null connection was supplied</exception> internal ConnectionWrapper(IDataServer ds, SqlConnection c, bool isDisposable) { if (ds==null || c==null) throw new ArgumentNullException(); m_DataServer = ds; m_Connection = c; m_IsDisposable = isDisposable; }
/// <summary> /// Initializes a new instance of the <see cref="PropertyPage"/> class. /// </summary> /// <param name="row">The database row that's being displayed (not null)</param> /// <exception cref="ArgumentNullException">If the supplied row is null</exception> /// <exception cref="InvalidOperationException">If no database is available</exception> internal PropertyPage(Row row) : base() { InitializeComponent(); m_DataServer = EditingController.Current.DataServer; if (m_DataServer == null) throw new InvalidOperationException("No database available"); SetRow(row); }
/// <summary> /// Initializes a new instance of the <see cref="ColumnDomainConverter"/> class. /// </summary> /// <param name="ds">The database holding domain data</param> /// <param name="cd">The column domain that is being converted (not null)</param> public ColumnDomainConverter(IDataServer ds, IColumnDomain cd) { if (ds == null || cd == null) throw new ArgumentNullException(); m_DataServer = ds; m_ColumnDomain = cd; IDomainTable dt = cd.Domain; string[] lookups = dt.GetLookupValues(ds.ConnectionString); m_Values = new StandardValuesCollection(lookups); }
/// <summary> /// Creates a new <see cref="AttributeDataForm"/> for a brand new row of attribute data /// </summary> /// <param name="t">The table the attribute data is for</param> /// <param name="id">The ID that will be assigned to the new label</param> /// <exception cref="InvalidOperationException">If no database is available</exception> public AttributeDataForm(ITable t, string id) { InitializeComponent(); if (t==null) throw new ArgumentNullException(); m_Table = t; m_Id = id; m_Data = null; m_DataServer = EditingController.Current.DataServer; if (m_DataServer == null) throw new InvalidOperationException("No database available"); }
public void setBackupServer(String serverUrl) { this.checkFailOrFreeze(); this.backupServer = getDataServerFromUrl(serverUrl); }
public void transferBackupTo(IDataServer server) { this.checkFailOrFreeze(); foreach (KeyValuePair<int, DSPadint> padint in backupPadints) { server.addBackupPadInt(padint.Key, padint.Value); } }
public void transferPrimarysTo(String serverUrl) { this.checkFailOrFreeze(); IDataServer server = getDataServerFromUrl(serverUrl); foreach (KeyValuePair<int, DSPadint> padint in primaryPadints) { server.addBackupPadInt(padint.Key, padint.Value); } // transfer uncommited changes foreach (KeyValuePair<int, Dictionary<int, DSPadint>> transaction in uncommitedChanges) { foreach (KeyValuePair<int, DSPadint> change in transaction.Value) { server.backupUncommitedPadint(transaction.Key, change.Key, change.Value); } } this.backupServer = server; }
private void TryWrite(IDataServer server, int val) { int tries = 3; while(tries > 0) { try { server.Write(this.uid, PadiDstm.currentTimestamp, val); return; } catch (SocketException e) { PadInt refreshed = PadiDstm.AccessPadInt(uid); servers = refreshed.servers; tries--; } } }
private int TryRead(IDataServer server) { int tries = 3; while (tries > 0) { try { return server.Read(this.uid, PadiDstm.currentTimestamp); } catch (SocketException e) { PadInt refreshed = PadiDstm.AccessPadInt(uid); servers = refreshed.servers; tries--; } } throw new Exception("Timeout Error: Could not reach the servers where the PadInt was stored."); }
public bool Recover() { if (doFreeze) { lock (this) { Monitor.PulseAll(this); } } else if(doFail) { backupServer = null; this.primaryPadints = new Dictionary<int, DSPadint>(); this.backupPadints = new Dictionary<int, DSPadint>(); this.uncommitedChanges = new Dictionary<int, Dictionary<int, DSPadint>>(); this.backedUpUncommitedChanges = new Dictionary<int, Dictionary<int, DSPadint>>(); this.padintsBeingCommited = new LinkedList<int>(); this.doFail = false; this.doFreeze = false; this.setId(masterServer.registerDataServer(this.serverUrl)); this.imAliveTimer.Start(); } doFail = false; doFreeze = false; return true; }
static DataManager() { DataManager.initialized = false; DataManager.server = new FileDataServer(); DataManager.barSeriesList = new BarSeriesList(); DataManager.quoteArrayList = new QuoteArrayList(); DataManager.tradeArrayList = new TradeArrayList(); DataManager.fundamentalArrayList = new FundamentalArrayList(); DataManager.corporateActionArrayList = new CorporateActionArrayList(); DataManager.providers = new Hashtable(); DataManager.reqId = 0; DataManager.Init(); }
/// <summary> /// Initializes a new instance of the <see cref="EditingController"/> class. /// </summary> /// <param name="main">The main dialog for the Cadastral Editor application</param> internal EditingController(MainForm main) : base() { if (main==null) throw new ArgumentNullException(); m_Project = null; m_ActiveLayer = null; m_Main = main; m_IsAutoSelect = 0; m_Inverse = null; m_Check = null; m_Sel = null; m_HasSelectionChanged = false; m_DataServer = null; // If we know of a database, create the access class string cs = LastDatabase.ConnectionString; if (!String.IsNullOrWhiteSpace(cs)) m_DataServer = new DataServer(cs); }
/// <summary> /// Defines (or clears) a database server. /// </summary> /// <param name="connectionString">The database connection string (specify null if you want /// to clear a previously defined database).</param> /// <returns>The database server (null if a null connection string was supplied).</returns> internal IDataServer SetDataServer(string connectionString) { if (String.IsNullOrWhiteSpace(connectionString)) m_DataServer = null; else m_DataServer = new DataServer(connectionString); return m_DataServer; }
/// <summary> /// Creates a new <see cref="AttributeDataForm"/> that shows an existing row of attribute data /// </summary> /// <param name="t">The table the attribute data is for</param> /// <param name="row">The row to display</param> public AttributeDataForm(ITable t, DataRow row) { InitializeComponent(); if (t==null || row==null) throw new ArgumentNullException(); m_Table = t; m_Id = row[t.IdColumnName].ToString(); m_Data = row; m_DataServer = EditingController.Current.DataServer; }
/// <summary> /// /// </summary> /// <param name="server">server to replicate to</param> /// <param name="serverURL">Server's url to replicate to</param> private void ReplicatePadInts(IDataServer server, String serverURL) { List<PadIntMetadata> toRemove = new List<PadIntMetadata>(); foreach (PadIntMetadata meta in nonReplicatedPadInts) { IDataServer dataServer = (IDataServer)Activator.GetObject( typeof(IDataServer), meta.servers.ToArray()[0]); //there's only one element in the list after removing the faulty server PadInt p = dataServer.AccessPadInt(meta.uid); server.StorePadInt(meta.uid, p); dataServers[serverURL].PadintCount++; metadata[meta.uid].servers.Add(serverURL); toRemove.Add(meta); } foreach(PadIntMetadata meta in toRemove) { nonReplicatedPadInts.Remove(meta); } }
public void setAsAlone() { this.checkFailOrFreeze(); this.backupServer = null; }
public object execute(IDataServer data, string command) { if (data != null) { data.Unfreeze(); } return null; }
public ServerMetadata(IDataServer remoteObject, string url) { this.url = url; this.remoteObject = remoteObject; this.padintCount = 0; }
public object execute(IDataServer data, string command) { if (data != null) { return data.Dump(); } return null; }
public object execute(IDataServer data, string command) { throw new NotImplementedException(); }