public SaeSocket(AwaitIo awaitable, DataStorage dts) { if (dts == null || awaitable == null) throw new ArgumentNullException(); _awaitable = awaitable; _data = dts; }
/// <summary> /// Constructor: Initialise instance variables. /// </summary> public Favourites() { this.model = new DataStorage(); var savedStops = this.model.GetAllFavourites(); savedStops.Sort(); this.Faves = new ObservableCollection<DataStorage.Favourite>(savedStops); }
public void Start() { storage = source.Read(); if (storage.Item.Items == null) { storage.Item.Items = new ObservableCollection<ItemModel>(); } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var currentIngredients = value as BindingList<StockItem> ?? new BindingList<StockItem>(); BindingList<StockItem> allIngredients; using (var dataStorage = new DataStorage()) allIngredients = dataStorage.StockItems() as BindingList<StockItem> ?? new BindingList<StockItem>(); return allIngredients.ExceptBy(currentIngredients, s => s.ItemName).Select(i => i.ItemName); }
public frmSchedule(DataStorage data, TaskScheduler.ScheduledTasks tasks, DataStorage.JobRow job, bool newJob) { Localization.ChangeLanguage(); InitializeComponent(); m_Data = data; m_NewJob = newJob; m_Job = job; m_Tasks = tasks; }
private void Save_OnClick(object sender, RoutedEventArgs e) { if (!Validate()) return; using (var dataStorage = new DataStorage()) { dataStorage.SaveItem(_item); } MessageBox.Show("Item has been saved successfully.", "Success"); }
public PrintItemWrapper(DataStorage.PrintItem printItem, List<ProviderLocatorNode> sourceLibraryProviderLocator = null) { this.PrintItem = printItem; if (FileLocation != null) { this.fileType = Path.GetExtension(FileLocation).ToUpper(); } SourceLibraryProviderLocator = sourceLibraryProviderLocator; }
private void NewIngredientList_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { NewIngredientDropDown.IsOpen = false; if (e.AddedItems.Count == 0) return; var itemName = e.AddedItems[0].ToString(); _item.Ingredients.Add(new StockItem(itemName)); using (var dataStorage = new DataStorage()) _item.Ingredients.Last().Unit = dataStorage.StockItem(itemName).Unit; StockDataGrid.Focus(); StockDataGrid.CurrentCell = new DataGridCellInfo(StockDataGrid.Items[StockDataGrid.Items.Count - 1], StockDataGrid.Columns[1]); StockDataGrid.BeginEdit(); }
public PLC(byte address, string portName, int baudRate) { Address = address; Connection = new PLCConnection(portName, baudRate); Provider = new PLCDataProvider(this); DataIn = new DataStorage<CommunicationData>(); RemoteSubscribers = new DataStorage<RemoteSubscriberData>(); Consumer = new PLCDataConsumer(this); Consumer.AttachStorageSource(DataIn); }
void Start() { dataStorage = GetComponent<DataStorage> (); // inicjalizacja 'dataStorage' if(!System.IO.File.Exists(dataStorage.settFilePatch)) // Jeśli na dysku NIE MA pliku konfiguracyjnego { CreateSettFile(); dataStorage.firstStart = true; } else // Ale jeśli istnieje { dataStorage.firstStart = false; } LoadSettFile(); LoadLangFile(); }
public void ConnectToAWSMongoDB() { bool success = true; try { dataContext = new DataStorage() { Record = new AuditRecord() { AreaAccessed = "http://...", AuditID = new Guid(), IPAddress = "1.1.1.1", Timestamp = DateTime.Now, UserName = "******" } }; dataContext.Insert(); } catch { success = false; } Assert.IsTrue(success, "No Exception Thrown"); }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); DataStorage ds = new DataStorage(); global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny(); any1.Namespace = "http://www.w3.org/2001/XMLSchema"; any1.MinOccurs = new decimal(0); any1.MaxOccurs = decimal.MaxValue; any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any1); global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny(); any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; any2.MinOccurs = new decimal(1); any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any2); global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute1.Name = "namespace"; attribute1.FixedValue = ds.Namespace; type.Attributes.Add(attribute1); global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute2.Name = "tableTypeName"; attribute2.FixedValue = "JobActionsDataTable"; type.Attributes.Add(attribute2); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte())); ) { ; } if ((s1.Position == s1.Length)) { return type; } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return type; }
public async Task GetData() { await Context.Channel.SendMessageAsync("Data Has " + DataStorage.GetPairsCount() + " pairs."); DataStorage.AddPairToStorage("Count" + DataStorage.GetPairsCount(), "TheCount" + DataStorage.GetPairsCount()); }
public void FillDeserialize(byte[] buffer) { var ds = DataStorage.CreateForRead(buffer); ReadFromDs(ds); }
public void OnGameOver() { DataStorage.UpdateMaxScore(CurrentScore); }
public void ReadFromDs(DataStorage ds) { X = ds.ReadFloat(); Y = ds.ReadFloat(); Z = ds.ReadFloat(); }
public FillWeaponListsWithSimilars(ILogger <FillArmorListsWithSimilars> logger, DataStorage storage, IPatcherState <ISkyrimMod, ISkyrimModGetter> state) : base(logger, storage, state) { }
public GetChildrenCommand(DataStorage dataStorage) { Assert.ArgumentNotNull(dataStorage, "dataStorage"); this.dataStorage = dataStorage; }
public SettingsLayer LoadConfigurationSettingsFromFile(string pathAndFileName, DataStorage.SliceSettingsCollection collection) { Dictionary<string, DataStorage.SliceSetting> settingsDictionary = new Dictionary<string, DataStorage.SliceSetting>(); SettingsLayer activeCollection; try { if (StaticData.Instance.FileExists(pathAndFileName)) { foreach (string line in StaticData.Instance.ReadAllLines(pathAndFileName)) { //Ignore commented lines if (!line.StartsWith("#")) { string[] settingLine = line.Split('='); string keyName = settingLine[0].Trim(); string settingDefaultValue = settingLine[1].Trim(); DataStorage.SliceSetting sliceSetting = new DataStorage.SliceSetting(); sliceSetting.Name = keyName; sliceSetting.Value = settingDefaultValue; settingsDictionary.Add(keyName, sliceSetting); } } activeCollection = new SettingsLayer(collection, settingsDictionary); return activeCollection; } return null; } catch (Exception e) { Debug.WriteLine(string.Format("Error loading configuration: {0}", e)); return null; } }
private void ParseRequests(DataStorage dts) { int dataLeft = 0, skip = 0; for (_parsePos = 0; true; dts.CommitSentBytes()) { var ds = dts.GetSegmentToSend(); if (ds == null) break; int cnt = ds.Count, offset = ds.Offset; // may need to skip some bytes if packet splits. if (skip != 0) { if (skip >= cnt) { skip -= cnt; continue; } cnt -= skip; offset += skip; skip = 0; } // process storage buffer/page. fixed (byte* bp = ds.Buffer) { byte* cp = bp + offset, ep = cp + cnt; if (dataLeft > 0) { // append bytes to "open" value. var sz = Math.Min(dataLeft, (int)(ep - cp)); _ce->AppendValue(cp, sz, _ce->ValSize - dataLeft); if (sz == dataLeft) { cp += sz; dataLeft = 0; _ce = null; } else { cp = ep; dataLeft -= sz; } } while ((cp = ParsePacket(cp, ep)) != null) { // quick path, no page breaks. var vsz = _ce->ValSize; if (vsz > 0) { var left = vsz - (int)(ep - cp); if (left > 0) { dataLeft = left; _ce->AppendValue(cp, vsz - left, 0); break; } _ce->AppendValue(cp, vsz, 0); cp += vsz; } // indicates that request is fully built. _ce = null; } if (cp == null && _parsePos > 0) { // read "split" request into continuos area[]. int tsz = iDataKeyLimit - _parsePos, lsz = tsz, pos = ds.Count; var bt = dts.Peek(ref tsz, ref pos); if (lsz < tsz) tsz = lsz; _memcopy(_split + _parsePos, bt, pos, tsz); tsz += _parsePos; var nx = ParsePacket(_split, _split + tsz); if (nx == null) throw new InvalidOperationException("eos"); skip = (int)(nx - _split) - _parsePos; dataLeft = _ce->ValSize; if (dataLeft == 0) _ce = null; _parsePos = 0; } } } }
public static Task ClientOnGuildCreated(GuildCreateEventArgs e) { DataStorage.CreateGuild(e.Guild); return(Task.CompletedTask); }
public override void LoadSettings() { AreBuildingsVisible = (bool)DataStorage.LoadState <object>(StorageKey.VisibleOutlines, AreBuildingsVisible); AreLabelsVisible = (bool)DataStorage.LoadState <object>(StorageKey.VisibleLabels, AreLabelsVisible); }
public SpellPatcher(ILogger <SpellPatcher> logger, DataStorage storage, IPatcherState <ISkyrimMod, ISkyrimModGetter> state) : base(logger, storage, state) { }
protected void Page_Load(object sender, EventArgs e) { try { string saveFoler = Server.MapPath("upload_files/"); string savePath, fileName, newName = ""; //遍历File表单元素 for (int iFile = 0; iFile < Request.Files.Count; iFile++) { HttpPostedFile postedFile = Request.Files[iFile]; fileName = Path.GetFileName(postedFile.FileName); if (fileName != "") { string fileType = fileName.Substring(fileName.LastIndexOf(".")); if (!fileType.ToLower().Equals(".xls")) { throw (new Exception("文件类型错误")); } // newName = "dbtask001" + fileType; newName = Guid.NewGuid().ToString("N") + fileType; savePath = saveFoler + newName; //检查是否在服务器上已经存在用户上传的同名文件 if (File.Exists(savePath)) { File.Delete(savePath); } postedFile.SaveAs(savePath); // 文件保存完成了,现在开始分析Excel 导入到数据库中 string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + savePath + "; Extended Properties=Excel 8.0;"; OleDbConnection oleConn = new OleDbConnection(strConn); oleConn.Open(); OleDbCommand mdo = new OleDbCommand("select * from [sheet1$]", oleConn); Boolean rsOpen = false; OleDbDataReader rst = mdo.ExecuteReader(); DicCache obj_DicCache = DicCache.getInstance(); DataStorage obj_Storage = new DataStorage(); while (rst.Read()) { //string dbdate = rst["打标日期"].ToString().Trim(); //string customid = obj_DicCache.getCode("DIC_CUSTOM", rst["客户"].ToString().Trim()); //if(dbdate != "" && customid != "") //{ //string strtaskid = NumAssign.assignID_B("200001", General.curYear2() + General.curMonth()); //string strtasksubid = NumAssign.assignID_B("200005", customid + General.cDateStr(dbdate)); string PIPEID = NumAssign.assignID_B("100004", General.curYear2() + General.curMonth() + General.curDay()); string DATA1 = rst["管道名称"].ToString().Trim(); string sql = "insert into PIPELINE(PIPEID,DATA1) VALUES('" + PIPEID + "','" + DATA1 + "')"; //string sql = "insert into BARCODETASK (TASKID,DQ,CUSTOMID,DBDATE,WRITETIME,TASKSUBID,SELLNO,XS,JB,DCTYPE,MODEL,ZPLX,CDZH,DBJDM,ZY,GROUPNUM,ORDNUM,STATUS,BAK) values ('" + strtaskid // + "','" + obj_DicCache.getCode("DIC_DQ", rst["地区"].ToString().Trim()) + "','" // + customid + "'," + General.formatDate(dbdate) + "," + General.formatDate(rst["任务下达日期"].ToString().Trim()) + ",'" + strtasksubid + "','" // + rst["销售单据号"].ToString().Trim() + "'," + rst["系数"].ToString().Trim() + ",'" // + obj_DicCache.getCode("DIC_JB", rst["极板"].ToString().Trim()) + "','" // + obj_DicCache.getCode("DIC_DCTYPE", rst["电池类型"].ToString().Trim()) + "','" // + obj_DicCache.getCode("DIC_MODEL", rst["型号"].ToString().Trim()) + "','" // + obj_DicCache.getCode("DIC_ZPLX", rst["装配类型"].ToString().Trim()) + "','" // + obj_DicCache.getCode("DIC_CDZH", rst["充电组号"].ToString().Trim()) + "','" // + obj_DicCache.getCode("DIC_DBJDM", rst["打码机器"].ToString().Trim()) + "','" // + obj_DicCache.getCode("DIC_ZY", rst["专用"].ToString().Trim()) + "'," + rst["组数"].ToString().Trim() + ",0,'0','" // + rst["备注"].ToString().Trim() + "')"; obj_Storage.addSQL(sql); //} rsOpen = true; } /// 执行 string str_Return = obj_Storage.runSQL(); if (!General.empty(str_Return)) { throw (new Exception(str_Return)); } if (rsOpen) { rst.Close(); } oleConn.Close(); } } jSONString = "{success:true,message:'上传完成!',filename:'" + newName + "'}"; }//try catch (Exception ex) { jSONString = "{success:false,message:'" + ex.Message.Replace('\'', '"') + "'}"; }//catch Response.Write(jSONString); Response.Flush(); }
public static void SaveQueues() { DataStorage.SaveQueues(audioQueues, queuesFile); }
public HttpResponseMessage GetSearchResult(object data) { var db = DbUtils.GetDBConnection(); db.Connection.Open(); DataStorage dataStorage = DataStorage.GetInstance(); var jsonData = JsonConvert.SerializeObject(data); var dictJson = JsonConvert.DeserializeObject <Dictionary <string, object> >(jsonData); object queryObect; object userName; dictJson.TryGetValue("queried_by_username", out userName); dictJson.TryGetValue("query", out queryObect); string Query = queryObect.ToString(); try { var parser = QueryParser.QueryParser.GetInstance(); var indexes = parser.Parse(Query, dataStorage.wordsVector, dataStorage.documentsVector, dataStorage.documentsVector.DocumentsSet()); var resultant = new List <IDictionary <string, object> >(); foreach (var index in indexes) { if (dataStorage.FYP_Data.ContainsKey(index)) { resultant.Add(dataStorage.FYP_Data[index].cast()); } } SqlConnection dbConnection = new SqlConnection(ConfigurationManager.AppSettings["SqlDBConn"].ToString()); try { string query = "INSERT INTO dbo.SearchLog(input_query, actionName, queried_by_username) VALUES(@input_query,@actionName,@queried_by_username)"; using (SqlCommand command = new SqlCommand(query, dbConnection)) { command.Parameters.AddWithValue("@input_query", queryObect); command.Parameters.AddWithValue("@actionName", "FYPSearch"); command.Parameters.AddWithValue("@queried_by_username", userName.ToString()); dbConnection.Open(); int result = command.ExecuteNonQuery(); // Check Error if (result < 0) { Console.WriteLine("Error inserting data into Database!"); } } } catch (Exception e) { } return(Request.CreateResponse(HttpStatusCode.OK, resultant)); } catch (Exception e) { return(Request.CreateResponse(HttpStatusCode.BadRequest, JsonConvert.SerializeObject(e.Message))); } }
public SettingsLayer(DataStorage.SliceSettingsCollection settingsCollection, Dictionary<string, DataStorage.SliceSetting> settingsDictionary) { this.settingsCollectionData = settingsCollection; this.settingsDictionary = settingsDictionary; }
public MockDataService(DataStorage dataStorage, Config config) : base(dataStorage) { timeout = config.ExpectedReadInterval; }
public async Task GetData() { await Context.Channel.SendMessageAsync("Data Has " + DataStorage.GetPairsCount() + " pairs."); }
void Awake() { PlayersDataStorage = new DataStorage <List <PlayerData> >(pluginInstance.Directory, "MoreHomesData.json"); SaveManager.onPostSave += SaveData; }
public virtual void Initialize(DataStorage dataStorage) { Assert.ArgumentNotNull(dataStorage, "dataStorage"); this.innerCommand.Initialize(dataStorage); }
/// <summary> /// Retrieve an existing named Guid /// in the specified Revit document or /// optionally create and return a new /// one if it does not yet exist. /// </summary> public static bool Get( Document doc, string name, out Guid guid, bool create = true) { bool rc = false; guid = Guid.Empty; // Retrieve a DataStorage element with our // extensible storage entity attached to it // and the specified element name. Only zero // or one should exist. ExtensibleStorageFilter f = new ExtensibleStorageFilter( JtNamedGuidStorageSchema.SchemaGuid); DataStorage dataStorage = new FilteredElementCollector(doc) .OfClass(typeof(DataStorage)) .WherePasses(f) .Where <Element>(e => name.Equals(e.Name)) .FirstOrDefault <Element>() as DataStorage; if (dataStorage == null) { if (create) { using (Transaction t = new Transaction( doc, "Create named Guid storage")) { t.Start(); // Create named data storage element dataStorage = DataStorage.Create(doc); dataStorage.Name = name; // Create entity to store the Guid data Entity entity = new Entity( JtNamedGuidStorageSchema.GetSchema()); entity.Set("Guid", guid = Guid.NewGuid()); // Set entity to the data storage element dataStorage.SetEntity(entity); t.Commit(); rc = true; } } } else { // Retrieve entity from the data storage element. Entity entity = dataStorage.GetEntity( JtNamedGuidStorageSchema.GetSchema(false)); Debug.Assert(entity.IsValid(), "expected a valid extensible storage entity"); if (entity.IsValid()) { guid = entity.Get <Guid>("Guid"); rc = true; } } return(rc); }
public void PushToDs(DataStorage ds) { ds.Push(X).Push(Y).Push(Z).Push(W); }
public byte[] Serialize() { var buffer = Msg.Serialize(); return(DataStorage.CreateForWrite().Push(buffer.Length).Push(buffer).Serialize()); }
public AddFromTemplateCommand(DataStorage dataStorage) { Assert.ArgumentNotNull(dataStorage, "dataStorage"); this.dataStorage = dataStorage; }
private int Eval(BinaryNode expr, DataRow row, DataRowVersion version) { if (expr._op == Operators.And) { int lResult = Eval((BinaryNode)expr._left, row, version); if (lResult != 0) { return(lResult); } int rResult = Eval((BinaryNode)expr._right, row, version); if (rResult != 0) { return(rResult); } return(0); } long c = 0; object vLeft = expr._left.Eval(row, version); if (expr._op != Operators.Is && expr._op != Operators.IsNot) { object vRight = expr._right.Eval(row, version); bool isLConst = (expr._left is ConstNode); bool isRConst = (expr._right is ConstNode); if ((vLeft == DBNull.Value) || (expr._left.IsSqlColumn && DataStorage.IsObjectSqlNull(vLeft))) { return(-1); } if ((vRight == DBNull.Value) || (expr._right.IsSqlColumn && DataStorage.IsObjectSqlNull(vRight))) { return(1); } StorageType leftType = DataStorage.GetStorageType(vLeft.GetType()); if (StorageType.Char == leftType) { if ((isRConst) || (!expr._right.IsSqlColumn)) { vRight = Convert.ToChar(vRight, _table.FormatProvider); } else { vRight = SqlConvert.ChangeType2(vRight, StorageType.Char, typeof(char), _table.FormatProvider); } } StorageType rightType = DataStorage.GetStorageType(vRight.GetType()); StorageType resultType; if (expr._left.IsSqlColumn || expr._right.IsSqlColumn) { resultType = expr.ResultSqlType(leftType, rightType, isLConst, isRConst, expr._op); } else { resultType = expr.ResultType(leftType, rightType, isLConst, isRConst, expr._op); } if (StorageType.Empty == resultType) { expr.SetTypeMismatchError(expr._op, vLeft.GetType(), vRight.GetType()); } // if comparing a Guid column value against a string literal // use InvariantCulture instead of DataTable.Locale because in the Danish related cultures // sorting a Guid as a string has different results than in Invariant and English related cultures. // This fix is restricted to DataTable.Select("GuidColumn = 'string literal'") types of queries NameNode namedNode = null; System.Globalization.CompareInfo comparer = ((isLConst && !isRConst && (leftType == StorageType.String) && (rightType == StorageType.Guid) && (null != (namedNode = expr._right as NameNode)) && (namedNode._column.DataType == typeof(Guid))) || (isRConst && !isLConst && (rightType == StorageType.String) && (leftType == StorageType.Guid) && (null != (namedNode = expr._left as NameNode)) && (namedNode._column.DataType == typeof(Guid)))) ? System.Globalization.CultureInfo.InvariantCulture.CompareInfo : null; c = expr.BinaryCompare(vLeft, vRight, resultType, expr._op, comparer); } switch (expr._op) { case Operators.EqualTo: c = (c == 0 ? 0 : c < 0 ? -1 : 1); break; case Operators.GreaterThen: c = (c > 0 ? 0 : -1); break; case Operators.LessThen: c = (c < 0 ? 0 : 1); break; case Operators.GreaterOrEqual: c = (c >= 0 ? 0 : -1); break; case Operators.LessOrEqual: c = (c <= 0 ? 0 : 1); break; case Operators.Is: c = (vLeft == DBNull.Value ? 0 : -1); break; case Operators.IsNot: c = (vLeft != DBNull.Value ? 0 : 1); break; default: Debug.Assert(true, "Unsupported Binary Search Operator!"); break; } return((int)c); }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { DataStorage ds = new DataStorage(); global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte())); ) { ; } if ((s1.Position == s1.Length)) { return type; } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return type; }
internal override object Eval(DataRow row, DataRowVersion version) { object[] argumentValues = new object[this.argumentCount]; if (funcs[this.info].id == FunctionId.Convert) { if (this.argumentCount != 2) { throw ExprException.FunctionArgumentCount(this.name); } argumentValues[0] = this.arguments[0].Eval(row, version); argumentValues[1] = this.GetDataType(this.arguments[1]); } else if (funcs[this.info].id != FunctionId.Iif) { for (int i = 0; i < this.argumentCount; i++) { argumentValues[i] = this.arguments[i].Eval(row, version); if (funcs[this.info].IsValidateArguments) { if ((argumentValues[i] == DBNull.Value) || (typeof(object) == funcs[this.info].parameters[i])) { return(DBNull.Value); } if (argumentValues[i].GetType() != funcs[this.info].parameters[i]) { if ((funcs[this.info].parameters[i] == typeof(int)) && ExpressionNode.IsInteger(DataStorage.GetStorageType(argumentValues[i].GetType()))) { argumentValues[i] = Convert.ToInt32(argumentValues[i], base.FormatProvider); } else { if (((funcs[this.info].id != FunctionId.Trim) && (funcs[this.info].id != FunctionId.Substring)) && (funcs[this.info].id != FunctionId.Len)) { throw ExprException.ArgumentType(funcs[this.info].name, i + 1, funcs[this.info].parameters[i]); } if ((typeof(string) != argumentValues[i].GetType()) && (typeof(SqlString) != argumentValues[i].GetType())) { throw ExprException.ArgumentType(funcs[this.info].name, i + 1, funcs[this.info].parameters[i]); } } } } } } return(this.EvalFunction(funcs[this.info].id, argumentValues, row, version)); }
public PresetListItem(SlicePresetsWindow windowController, DataStorage.SliceSettingsCollection preset) { this.preset = preset; this.BackgroundColor = RGBA_Bytes.White; this.HAnchor = HAnchor.ParentLeftRight; this.Margin = new BorderDouble(6, 0, 6, 3); this.Padding = new BorderDouble(3); LinkButtonFactory linkButtonFactory = new LinkButtonFactory(); linkButtonFactory.fontSize = 10; int maxLabelWidth = 300; TextWidget materialLabel = new TextWidget(preset.Name, pointSize: 14); materialLabel.EllipsisIfClipped = true; materialLabel.VAnchor = Agg.UI.VAnchor.ParentCenter; materialLabel.MinimumSize = new Vector2(maxLabelWidth, materialLabel.Height); materialLabel.Width = maxLabelWidth; Button materialEditLink = linkButtonFactory.Generate("edit"); materialEditLink.VAnchor = Agg.UI.VAnchor.ParentCenter; materialEditLink.Click += (sender, e) => { UiThread.RunOnIdle(() => { windowController.ChangeToSlicePresetDetail(preset); }); }; Button materialRemoveLink = linkButtonFactory.Generate("remove"); materialRemoveLink.Margin = new BorderDouble(left: 4); materialRemoveLink.VAnchor = Agg.UI.VAnchor.ParentCenter; materialRemoveLink.Click += (sender, e) => { UiThread.RunOnIdle(() => { //Unwind this setting if it is currently active if (ActivePrinterProfile.Instance.ActivePrinter != null) { if (preset.Id == ActivePrinterProfile.Instance.ActiveQualitySettingsID) { ActivePrinterProfile.Instance.ActiveQualitySettingsID = 0; } string[] activeMaterialPresets = ActivePrinterProfile.Instance.ActivePrinter.MaterialCollectionIds.Split(','); for (int i = 0; i < activeMaterialPresets.Count(); i++) { int index = 0; Int32.TryParse(activeMaterialPresets[i], out index); if (preset.Id == index) { ActivePrinterProfile.Instance.SetMaterialSetting(i + 1, 0); } } } preset.Delete(); windowController.ChangeToSlicePresetList(); ActiveSliceSettings.Instance.LoadAllSettings(); ApplicationController.Instance.ReloadAdvancedControlsPanel(); }); }; this.AddChild(materialLabel); this.AddChild(new HorizontalSpacer()); this.AddChild(materialEditLink); this.AddChild(materialRemoveLink); this.Height = 35; }
private object EvalFunction(FunctionId id, object[] argumentValues, DataRow row, DataRowVersion version) { StorageType type; switch (id) { case FunctionId.Charindex: if (!DataStorage.IsObjectNull(argumentValues[0]) && !DataStorage.IsObjectNull(argumentValues[1])) { if (argumentValues[0] is SqlString) { SqlString str6 = (SqlString)argumentValues[0]; argumentValues[0] = str6.Value; } if (argumentValues[1] is SqlString) { SqlString str5 = (SqlString)argumentValues[1]; argumentValues[1] = str5.Value; } return(((string)argumentValues[1]).IndexOf((string)argumentValues[0], StringComparison.Ordinal)); } return(DBNull.Value); case FunctionId.Len: { if (!(argumentValues[0] is SqlString)) { goto Label_02D4; } SqlString str4 = (SqlString)argumentValues[0]; if (!str4.IsNull) { SqlString str3 = (SqlString)argumentValues[0]; argumentValues[0] = str3.Value; goto Label_02D4; } return(DBNull.Value); } case FunctionId.Substring: { int startIndex = ((int)argumentValues[1]) - 1; int length = (int)argumentValues[2]; if (startIndex < 0) { throw ExprException.FunctionArgumentOutOfRange("index", "Substring"); } if (length < 0) { throw ExprException.FunctionArgumentOutOfRange("length", "Substring"); } if (length == 0) { return(""); } if (argumentValues[0] is SqlString) { SqlString str2 = (SqlString)argumentValues[0]; argumentValues[0] = str2.Value; } int num3 = ((string)argumentValues[0]).Length; if (startIndex > num3) { return(DBNull.Value); } if ((startIndex + length) > num3) { length = num3 - startIndex; } return(((string)argumentValues[0]).Substring(startIndex, length)); } case FunctionId.IsNull: if (!DataStorage.IsObjectNull(argumentValues[0])) { return(argumentValues[0]); } return(argumentValues[1]); case FunctionId.Iif: if (!DataExpression.ToBoolean(this.arguments[0].Eval(row, version))) { return(this.arguments[2].Eval(row, version)); } return(this.arguments[1].Eval(row, version)); case FunctionId.Convert: { if (this.argumentCount != 2) { throw ExprException.FunctionArgumentCount(this.name); } if (argumentValues[0] == DBNull.Value) { return(DBNull.Value); } Type dataType = (Type)argumentValues[1]; StorageType storageType = DataStorage.GetStorageType(dataType); type = DataStorage.GetStorageType(argumentValues[0].GetType()); if ((storageType == StorageType.DateTimeOffset) && (type == StorageType.String)) { return(SqlConvert.ConvertStringToDateTimeOffset((string)argumentValues[0], base.FormatProvider)); } if (StorageType.Object == storageType) { return(argumentValues[0]); } if ((storageType == StorageType.Guid) && (type == StorageType.String)) { return(new Guid((string)argumentValues[0])); } if (ExpressionNode.IsFloatSql(type) && ExpressionNode.IsIntegerSql(storageType)) { if (StorageType.Single == type) { return(SqlConvert.ChangeType2((float)SqlConvert.ChangeType2(argumentValues[0], StorageType.Single, typeof(float), base.FormatProvider), storageType, dataType, base.FormatProvider)); } if (StorageType.Double == type) { return(SqlConvert.ChangeType2((double)SqlConvert.ChangeType2(argumentValues[0], StorageType.Double, typeof(double), base.FormatProvider), storageType, dataType, base.FormatProvider)); } if (StorageType.Decimal == type) { return(SqlConvert.ChangeType2((decimal)SqlConvert.ChangeType2(argumentValues[0], StorageType.Decimal, typeof(decimal), base.FormatProvider), storageType, dataType, base.FormatProvider)); } } return(SqlConvert.ChangeType2(argumentValues[0], storageType, dataType, base.FormatProvider)); } case FunctionId.cInt: return(Convert.ToInt32(argumentValues[0], base.FormatProvider)); case FunctionId.cBool: { StorageType type4 = DataStorage.GetStorageType(argumentValues[0].GetType()); if (type4 > StorageType.Int32) { switch (type4) { case StorageType.Double: return(!(((double)argumentValues[0]) == 0.0)); case StorageType.String: return(bool.Parse((string)argumentValues[0])); } break; } switch (type4) { case StorageType.Boolean: return((bool)argumentValues[0]); case StorageType.Int32: return(((int)argumentValues[0]) != 0); } break; } case FunctionId.cDate: return(Convert.ToDateTime(argumentValues[0], base.FormatProvider)); case FunctionId.cDbl: return(Convert.ToDouble(argumentValues[0], base.FormatProvider)); case FunctionId.cStr: return(Convert.ToString(argumentValues[0], base.FormatProvider)); case FunctionId.Abs: type = DataStorage.GetStorageType(argumentValues[0].GetType()); if (!ExpressionNode.IsInteger(type)) { if (!ExpressionNode.IsNumeric(type)) { throw ExprException.ArgumentTypeInteger(funcs[this.info].name, 1); } return(Math.Abs((double)argumentValues[0])); } return(Math.Abs((long)argumentValues[0])); case FunctionId.In: throw ExprException.NYI(funcs[this.info].name); case FunctionId.Trim: if (!DataStorage.IsObjectNull(argumentValues[0])) { if (argumentValues[0] is SqlString) { SqlString str = (SqlString)argumentValues[0]; argumentValues[0] = str.Value; } return(((string)argumentValues[0]).Trim()); } return(DBNull.Value); case FunctionId.DateTimeOffset: if (((argumentValues[0] != DBNull.Value) && (argumentValues[1] != DBNull.Value)) && (argumentValues[2] != DBNull.Value)) { DateTime time = (DateTime)argumentValues[0]; switch (time.Kind) { case DateTimeKind.Utc: if ((((int)argumentValues[1]) != 0) && (((int)argumentValues[2]) != 0)) { throw ExprException.MismatchKindandTimeSpan(); } break; case DateTimeKind.Local: if ((DateTimeOffset.Now.Offset.Hours != ((int)argumentValues[1])) && (DateTimeOffset.Now.Offset.Minutes != ((int)argumentValues[2]))) { throw ExprException.MismatchKindandTimeSpan(); } break; } if ((((int)argumentValues[1]) < -14) || (((int)argumentValues[1]) > 14)) { throw ExprException.InvalidHoursArgument(); } if ((((int)argumentValues[2]) < -59) || (((int)argumentValues[2]) > 0x3b)) { throw ExprException.InvalidMinutesArgument(); } if ((((int)argumentValues[1]) == 14) && (((int)argumentValues[2]) > 0)) { throw ExprException.InvalidTimeZoneRange(); } if ((((int)argumentValues[1]) == -14) && (((int)argumentValues[2]) < 0)) { throw ExprException.InvalidTimeZoneRange(); } return(new DateTimeOffset((DateTime)argumentValues[0], new TimeSpan((int)argumentValues[1], (int)argumentValues[2], 0))); } return(DBNull.Value); default: throw ExprException.UndefinedFunction(funcs[this.info].name); } throw ExprException.DatatypeConvertion(argumentValues[0].GetType(), typeof(bool)); Label_02D4: return(((string)argumentValues[0]).Length); }
protected void OutputResponse(DataStorage dts) { int valPos = 0, valLeft = 0; RefCountPtr* valData = null; for (var oe = _clist; oe != null; ) { var ds = dts.GetSegmentToRead(iBigBlockSize); fixed (byte* bp = ds.Buffer) { byte* cp = bp + ds.Offset + ds.Count, ep = cp + ds.Size; for (; oe != null; oe = oe->next) { if (valLeft == 0) { if (SkipResponse(oe)) continue; // write response header information. var xp = WritePacket(oe, cp, ep); // check for boundary crossing in buffer. if (xp == cp) break; cp = xp; if (oe->status != iSuccess) continue; valLeft = oe->ValSize; if (valLeft == 0) continue; valData = oe->val_addr; // quick path, small value copy to output. if (valLeft < iBigBlockSize) { var bleft = (int)(ep - cp); if (bleft >= valLeft) { _memcopy(cp, _skip(valData, 0), valLeft); cp += valLeft; valLeft = 0; continue; } } valPos = 0; } // copy value bytes into the buffer. do { int dleft = (int)(ep - cp), sleft = iBigBlockSize - valPos; if (sleft > valLeft) sleft = valLeft; if (dleft <= sleft) { _memcopy(cp, _skip(valData, valPos), dleft); valLeft -= dleft; valPos += dleft; cp += dleft; break; } _memcopy(cp, _skip(valData, valPos), sleft); cp += sleft; valLeft -= sleft; if (valLeft == 0) break; valData = valData->Next; valPos = 0; } while (true); // may need to switch the page. if (valLeft != 0) break; } // "commit" generated memcached responses. var bytes = (int)(cp - bp) - ds.Offset; if (bytes > 0) dts.ReadCommit(bytes); } } }
public HasChildrenCommand(DataStorage dataStorage) { Assert.ArgumentNotNull(dataStorage, "dataStorage"); this.dataStorage = dataStorage; }
public MemcachedProtocol(LocalCache cache, Connection dtc) { _cache = cache; _dtc = dtc; _data = dtc.Data; }
public DeleteItemCommand(DataStorage dataStorage) { Assert.ArgumentNotNull(dataStorage, "dataStorage"); this.dataStorage = dataStorage; }
public SetBlobStreamCommand(DataStorage dataStorage) { Assert.ArgumentNotNull(dataStorage, "dataStorage"); this.dataStorage = dataStorage; }
public PrintItemWrapper(DataStorage.PrintItem printItem) { this.PrintItem = printItem; this.fileType = System.IO.Path.GetExtension(printItem.FileLocation).ToUpper(); //if (this.fileType == ".GCODE") //{ //gcodeStatus = GcodeStatuses.Prepared; //} }
protected void Page_Load(object sender, EventArgs e) { try { string saveFoler = Server.MapPath("upload_files/"); string savePath, fileName,newName = ""; //遍历File表单元素 for (int iFile = 0; iFile < Request.Files.Count; iFile++) { HttpPostedFile postedFile = Request.Files[iFile]; fileName = Path.GetFileName(postedFile.FileName); if (fileName != "") { string fileType = fileName.Substring(fileName.LastIndexOf(".")); if (!fileType.ToLower().Equals(".xls")) { throw (new Exception("文件类型错误")); } // newName = "dbtask001" + fileType; newName = Guid.NewGuid().ToString("N") + fileType; savePath = saveFoler + newName; //检查是否在服务器上已经存在用户上传的同名文件 if (File.Exists(savePath)) { File.Delete(savePath); } postedFile.SaveAs(savePath); // 文件保存完成了,现在开始分析Excel 导入到数据库中 string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + savePath + "; Extended Properties=Excel 8.0;"; OleDbConnection oleConn = new OleDbConnection(strConn); oleConn.Open(); OleDbCommand mdo = new OleDbCommand("select * from [sheet1$]", oleConn); Boolean rsOpen = false; OleDbDataReader rst = mdo.ExecuteReader(); DicCache obj_DicCache = DicCache.getInstance(); DataStorage obj_Storage = new DataStorage(); while (rst.Read()) { //string dbdate = rst["打标日期"].ToString().Trim(); //string customid = obj_DicCache.getCode("DIC_CUSTOM", rst["客户"].ToString().Trim()); //if(dbdate != "" && customid != "") //{ //string strtaskid = NumAssign.assignID_B("200001", General.curYear2() + General.curMonth()); //string strtasksubid = NumAssign.assignID_B("200005", customid + General.cDateStr(dbdate)); string PIPEID= NumAssign.assignID_B("100004", General.curYear2() + General.curMonth() + General.curDay()); string DATA1 = rst["管道名称"].ToString().Trim(); string sql = "insert into PIPELINE(PIPEID,DATA1) VALUES('"+PIPEID+"','"+DATA1+"')"; //string sql = "insert into BARCODETASK (TASKID,DQ,CUSTOMID,DBDATE,WRITETIME,TASKSUBID,SELLNO,XS,JB,DCTYPE,MODEL,ZPLX,CDZH,DBJDM,ZY,GROUPNUM,ORDNUM,STATUS,BAK) values ('" + strtaskid // + "','" + obj_DicCache.getCode("DIC_DQ", rst["地区"].ToString().Trim()) + "','" // + customid + "'," + General.formatDate(dbdate) + "," + General.formatDate(rst["任务下达日期"].ToString().Trim()) + ",'" + strtasksubid + "','" // + rst["销售单据号"].ToString().Trim() + "'," + rst["系数"].ToString().Trim() + ",'" // + obj_DicCache.getCode("DIC_JB", rst["极板"].ToString().Trim()) + "','" // + obj_DicCache.getCode("DIC_DCTYPE", rst["电池类型"].ToString().Trim()) + "','" // + obj_DicCache.getCode("DIC_MODEL", rst["型号"].ToString().Trim()) + "','" // + obj_DicCache.getCode("DIC_ZPLX", rst["装配类型"].ToString().Trim()) + "','" // + obj_DicCache.getCode("DIC_CDZH", rst["充电组号"].ToString().Trim()) + "','" // + obj_DicCache.getCode("DIC_DBJDM", rst["打码机器"].ToString().Trim()) + "','" // + obj_DicCache.getCode("DIC_ZY", rst["专用"].ToString().Trim()) + "'," + rst["组数"].ToString().Trim() + ",0,'0','" // + rst["备注"].ToString().Trim() + "')"; obj_Storage.addSQL(sql); //} rsOpen = true; } /// 执行 string str_Return = obj_Storage.runSQL(); if (!General.empty(str_Return)) { throw (new Exception(str_Return)); } if (rsOpen) rst.Close(); oleConn.Close(); } } jSONString = "{success:true,message:'上传完成!',filename:'" + newName + "'}"; }//try catch(Exception ex) { jSONString = "{success:false,message:'" + ex.Message.Replace('\'','"') + "'}"; }//catch Response.Write(jSONString); Response.Flush(); }
public override void SaveSettings() { DataStorage.SaveState(StorageKey.VisibleOutlines, AreBuildingsVisible); DataStorage.SaveState(StorageKey.VisibleLabels, AreLabelsVisible); }
private SettingsLayer LoadConfigurationSettingsFromDatastore(DataStorage.SliceSettingsCollection collection) { Dictionary<string, DataStorage.SliceSetting> settingsDictionary = new Dictionary<string, DataStorage.SliceSetting>(); IEnumerable<DataStorage.SliceSetting> settingsList = GetCollectionSettings(collection.Id); foreach (DataStorage.SliceSetting s in settingsList) { settingsDictionary[s.Name] = s; } SettingsLayer settingsLayer = new SettingsLayer(collection, settingsDictionary); return settingsLayer; }
public GetRootItemCommand(DataStorage dataStorage) { Assert.ArgumentNotNull(dataStorage, "dataStorage"); this.dataStorage = dataStorage; }
public void DataReset() { DataStorage.EraseData(); }
public string createNewRecording(string nameServer, string user, AccrualPayment[] accrualsPayments) { // Получить список идентификаторов приложений с указанного центрального ИнМета-сервера. string[] idAppCentralServer = DataApplication.GetAppIds(nameServer); DataApplication app; if (idAppCentralServer.Contains("EstateOrenburg")) { app = new DataApplication(idAppCentralServer[0], nameServer); } else { app = null; return("Create application failure"); } // Создание сессии (подключение к БД) DataSession session = app.CreateSession(user); //DataSession session = app.CreateSession(); //session.Db.BeginTransaction("",""); // Прописываем свойства, которые нам необходимо прогрузить при первом запросе string loadPlan = "<Executor/>"; Dictionary <string, List <string> > dictMappingOIDwithPersonalAccount = getMappingOIDwithPersonalAccount(); for (int i = 0; i < accrualsPayments.Length; i++) { if (dictMappingOIDwithPersonalAccount.ContainsKey(accrualsPayments[i].PersonalAccount)) { accrualsPayments[i].OIDobject = dictMappingOIDwithPersonalAccount[accrualsPayments[i].PersonalAccount][0]; // Получение списка объектов DataObjectList rentApartContrProc; if (session != null) { DataStorage dataStorage = session["Constr/RentPrivatizationApartmentContractProcess"]; rentApartContrProc = dataStorage.Query(loadPlan, "OID=?", accrualsPayments[i].OIDobject); // 000859F5EC33 } else { return("Create session failure"); } // Создание нового объекта //session["Constr/AccrualsPaymentsSocialContract"].AddNew(); foreach (Integro.InMeta.Runtime.DataObject racp in rentApartContrProc) { //// Чтение свойств объекта //racp.GetString("ContractNo", "No date"); //racp.GetDateTime("ContractDate"); ////Запись свойств объекта //racp.SetString("ContractNo", "xxx"); //racp.SetDateTime("ContractDate", DateTime.Today); // Добавлению нового дочернего объекта DataObject accrualsPaymentsSocialContract = racp.GetChilds("Constr/AccrualsPaymentsSocialContract").AddNew(); DataObjectChildList employers = racp.GetChilds("Constr/Employers"); DataObject searchEmployer = null; foreach (DataObject employer in employers) { if (employer.GetString("PersonalAccount").Equals(accrualsPayments[i].PersonalAccount)) { searchEmployer = employer; break; } } if (searchEmployer != null) { accrualsPaymentsSocialContract.SetLink("Subject", searchEmployer); } // var dateTime2 = DateTime.ParseExact(accrualsPayments[i].DateAccrual, "dd.M.yyyy", null); string[] periodStr = accrualsPayments[i].Period.Split('.'); DateTime period = new DateTime(Convert.ToInt32(periodStr[0]), Convert.ToInt32(periodStr[1]), Convert.ToInt32(periodStr[2])); accrualsPaymentsSocialContract.SetString("PersonalAccount", accrualsPayments[i].PersonalAccount ?? String.Empty); accrualsPaymentsSocialContract.SetString("IdAccrual", accrualsPayments[i].IdAccrual ?? String.Empty); accrualsPaymentsSocialContract.SetDateTime("Period", period); accrualsPaymentsSocialContract.SetDouble("Accrual", Convert.ToDouble(accrualsPayments[i].SummAccrual ?? String.Empty)); accrualsPaymentsSocialContract.SetDouble("SummPayment", Convert.ToDouble(accrualsPayments[i].SummPayment ?? String.Empty)); } } else { accrualsPayments[i].OIDobject = "Not Found"; } } //Сохранение объектов в БД session.Commit(); //Запись не найденых ЛС writeInFile(accrualsPayments); return("Upload successful"); }
public AddMemeCommand(ServiceCollectionClass services, Action <Exception> onException = null) : base(onException) { _dataStorage = services._dataStorage; _dialogService = services._dialogService; }
private void LoadData() { string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); //string path = System.IO.Path.GetDirectoryName(Application.ExecutablePath); path = System.IO.Path.Combine(path, "Jobs.dat"); m_Data = new DataStorage(); if (System.IO.File.Exists(path)) { m_Data.ReadXml(path, XmlReadMode.ReadSchema); } }
public static void Convert(Stream source, Stream destination) { int i = 0; byte[][] array = null; byte[] array2 = null; using (Stream stream = new SuppressCloseStream(source)) { using (MimeReader mimeReader = new MimeReader(stream, true, DecodingOptions.Default, MimeLimits.Unlimited, true, false)) { while (mimeReader.ReadNextPart()) { while (i >= mimeReader.Depth) { byte[] array3 = array[--i]; if (array3 != null) { destination.Write(array3, 0, array3.Length - 2); destination.Write(MimeString.TwoDashesCRLF, 0, MimeString.TwoDashesCRLF.Length); } } if (i > 0) { byte[] array3 = array[i - 1]; if (array3 != null) { destination.Write(array3, 0, array3.Length); } } HeaderList headerList = HeaderList.ReadFrom(mimeReader); ContentTypeHeader contentTypeHeader = headerList.FindFirst(HeaderId.ContentType) as ContentTypeHeader; bool flag; bool flag2; bool flag3; EightToSevenBitConverter.Analyse(contentTypeHeader, out flag, out flag2, out flag3); Header header = headerList.FindFirst(HeaderId.ContentTransferEncoding); if (flag2 || flag) { if (header != null) { headerList.RemoveChild(header); } headerList.WriteTo(destination); byte[] array3; if (flag) { array3 = null; destination.Write(MimeString.CrLf, 0, MimeString.CrLf.Length); } else { array3 = MimePart.GetBoundary(contentTypeHeader); } if (array == null) { array = new byte[4][]; } else if (array.Length == i) { byte[][] array4 = new byte[array.Length * 2][]; Array.Copy(array, 0, array4, 0, i); array = array4; } array[i++] = array3; } else { Stream stream2 = null; try { stream2 = mimeReader.GetRawContentReadStream(); if (header != null && stream2 != null) { ContentTransferEncoding encodingType = MimePart.GetEncodingType(header.FirstRawToken); if (encodingType == ContentTransferEncoding.EightBit || encodingType == ContentTransferEncoding.Binary) { if (flag3) { header.RawValue = MimeString.QuotedPrintable; stream2 = new EncoderStream(stream2, new QPEncoder(), EncoderStreamAccess.Read); } else { header.RawValue = MimeString.Base64; stream2 = new EncoderStream(stream2, new Base64Encoder(), EncoderStreamAccess.Read); } } } headerList.WriteTo(destination); destination.Write(MimeString.CrLf, 0, MimeString.CrLf.Length); if (stream2 != null) { DataStorage.CopyStreamToStream(stream2, destination, long.MaxValue, ref array2); } } finally { if (stream2 != null) { stream2.Dispose(); } } } } while (i > 0) { byte[] array3 = array[--i]; if (array3 != null) { destination.Write(array3, 0, array3.Length - 2); destination.Write(MimeString.TwoDashesCRLF, 0, MimeString.TwoDashesCRLF.Length); } } } } }
new = DrillRepository(DataStorage);
public SimpleTestRepository() { _storage = new DataStorage(); }
public PrintItemWrapper(DataStorage.PrintItem printItem) { this.PrintItem = printItem; this.fileType = Path.GetExtension(printItem.FileLocation).ToUpper(); }
public DataStorageTest() { this.dataStorage = new DataStorage(Database.GetDatabase("master")); }