public void RelaseLock(DataLocation dataLocation)
 {
     lock (_locks)
     {
         _locks.Remove(new Lock(dataLocation));
     }
 }
        /// <summary>
        /// Request data for a period
        /// </summary>
        /// <param name="fromDate">The start of the period, in UTC</param>
        /// <param name="toDate">The end of the period, in UTC</param>
        /// <param name="dataLocation"></param>
        /// <param name="filter">Specify a filter. Only releases matching this filter will be returned.</param>
        /// <param name="dataSource">Specify a specific datasource. Otherwise the default one will be used.</param>
        /// <exception cref="ArgumentException">fromDate must be before toDate</exception>
        public EconomicReleaseRequest(DateTime fromDate, DateTime toDate, DataLocation dataLocation = DataLocation.ExternalOnly, Expression<Func<EconomicRelease, bool>> filter = null, string dataSource = null)
        {
            if (fromDate.Date > toDate.Date) throw new ArgumentException("fromDate must be before toDate");

            FromDate = fromDate;
            ToDate = toDate;
            DataLocation = dataLocation;
            Filter = filter;
            DataSource = dataSource;
        }
 public void Write(DataLocation location, byte value)
 {
     Change change = _workspace.GetDataLocation(location);
     if (change == null) // the DataLocation is not in the workspace
     {
         _workspace.AddChange(new Change(location, value, true));
     }
     else // the DataLocation is in the workspace
     {
         change.Value = value;
     }
 }
 public bool GetLock(DataLocation dataLocation)
 {
     lock (_locks)
     {
         if (_locks.Any(takenLock => takenLock.Overlap(dataLocation)))
         {
             return false;
         }
         Lock newLock = new Lock(dataLocation);
         _locks.Add(newLock);
     }
     return true;
 }
 public Lock GetLock(DataLocation location)
 {
     Lock newLock;
     lock (_locks)
     {
         foreach (Lock takenLock in _locks)
         {
             if (takenLock.Overlap(location))
                 return null;
         }
         newLock = new Lock(location);
         _locks.Add(newLock);
     }
     return newLock;
 }
 public byte Read(DataLocation dataLocation)
 {
     Change change = _workspace.GetDataLocation(dataLocation);
     byte value;
     if (change == null) // the DataLocation is not in the workspace
     {
         TransactionManager tm = TransactionManager.GetInstance();
         value = tm.Read(dataLocation);
         _workspace.AddChange(new Change(dataLocation, value, false));
     }
     else // the DataLocation is in the workspace
     {
         value = change.Value;
     }
     return value;
 }
Beispiel #7
0
        static Log()
        {
            CurrentLogDirectory = Path.Combine(DataLocation.DataDirectory(), DirectoryName, Constant.Version);
            if (!Directory.Exists(CurrentLogDirectory))
            {
                Directory.CreateDirectory(CurrentLogDirectory);
            }

            var configuration = new LoggingConfiguration();
            var target        = new FileTarget();

            configuration.AddTarget("file", target);
            target.FileName = CurrentLogDirectory.Replace(@"\", "/") + "/${shortdate}.txt";
#if DEBUG
            var rule = new LoggingRule("*", LogLevel.Debug, target);
#else
            var rule = new LoggingRule("*", LogLevel.Info, target);
#endif
            configuration.LoggingRules.Add(rule);
            LogManager.Configuration = configuration;
        }
Beispiel #8
0
        // Constructor
        public PK3Reader(DataLocation dl) : base(dl)
        {
            General.WriteLogLine("Opening ZIP resource \"" + location.location + "\"");

            if (!File.Exists(location.location))
            {
                throw new FileNotFoundException("Could not find the file \"" + location.location + "\"", location.location);
            }

            // Open the zip file
            ZipInputStream zipstream = OpenPK3File();

            // Make list of all files
            List <DirectoryFileEntry> fileentries = new List <DirectoryFileEntry>();
            ZipEntry entry = zipstream.GetNextEntry();

            while (entry != null)
            {
                if (entry.IsFile)
                {
                    fileentries.Add(new DirectoryFileEntry(entry.Name));
                }

                // Next
                entry = zipstream.GetNextEntry();
            }

            // Make files list
            files = new DirectoryFilesList(fileentries);

            // Done with the zip file
            zipstream.Close();
            zipstream.Dispose();

            // Initialize without path (because we use paths relative to the PK3 file)
            Initialize();

            // We have no destructor
            //GC.SuppressFinalize(this);
        }
Beispiel #9
0
        internal ProbeBrickPool(ProbeVolumeTextureMemoryBudget memoryBudget, ProbeVolumeSHBands shBands)
        {
            Profiler.BeginSample("Create ProbeBrickPool");
            m_NextFreeChunk.x = m_NextFreeChunk.y = m_NextFreeChunk.z = 0;

            m_MemoryBudget = memoryBudget;
            m_SHBands      = shBands;

            m_FreeList = new Stack <BrickChunkAlloc>(256);

            int width, height, depth;

            DerivePoolSizeFromBudget(memoryBudget, out width, out height, out depth);
            int estimatedCost = 0;

            m_Pool            = CreateDataLocation(width * height * depth, false, shBands, "APV", out estimatedCost);
            estimatedVMemCost = estimatedCost;

            m_AvailableChunkCount = (width / (kProbePoolChunkSize * kBrickProbeCountPerDim)) * (height / kBrickProbeCountPerDim) * (depth / kBrickProbeCountPerDim);

            Profiler.EndSample();
        }
        // Returns a list of the resources
        public DataLocationList GetResources()
        {
            DataLocationList list = new DataLocationList();

            // Go for all items
            for (int i = 0; i < resourceitems.Items.Count; i++)
            {
                // Item not grayed?
                if (resourceitems.Items[i].ForeColor == SystemColors.WindowText)
                {
                    // Add item to list
                    DataLocation dl = (DataLocation)resourceitems.Items[i].Tag;
                    if (!list.Contains(dl))
                    {
                        list.Add(dl);                                        //mxd. Duplicates check
                    }
                }
            }

            // Return result
            return(list);
        }
        static void Main(string[] args)
        {
            DataManager dm = new DataManager(11000);

            dm.Start();
            dm.GetLocation();

            DMLocation     dmLocation      = new DMLocation("127.0.0.1:11000");//(@"db://[fe80::a91e:3a94:e27a:9035%13]:11000");
            ObjectLocation objectLocation0 = new ObjectLocation(ObjectType.FileWithHeader, @"C:\DB\arrayName.db", 0);
            ObjectLocation objectLocation1 = new ObjectLocation(ObjectType.FileWithHeader, @"C:\DB\arrayName.db", 1);
            DataLocation   dataLocation0   = new DataLocation(dmLocation, objectLocation0);
            DataLocation   dataLocation1   = new DataLocation(dmLocation, objectLocation1);

            //First transaction
            Transaction t = new Transaction();

            t.Begin();

            t.Write(dataLocation0, 42);
            t.Write(dataLocation1, 77);
            Console.WriteLine("Read: " + t.Read(dataLocation0));
            Console.WriteLine("Read: " + t.Read(dataLocation1));

            //Second transaction
            Transaction t2 = new Transaction();

            t2.Begin();
            t2.Write(dataLocation1, 99);
            Console.WriteLine("Read: " + t2.Read(dataLocation1));

            t.End();

            t2.End();

            dm.Stop();

            Console.WriteLine("Press Enter....");
            Console.ReadLine();
        }
        // Constructor
        public ResourceOptionsForm(DataLocation settings, string caption, string startPath)         //mxd. added startPath
        {
            // Initialize
            InitializeComponent();

            // Set caption
            this.Text = caption;

            // Apply settings from ResourceLocation
            this.res = settings;
            switch (res.type)
            {
            // Setup for WAD File
            case DataLocation.RESOURCE_WAD:
                wadlocation.Text      = res.location;
                strictpatches.Checked = res.option1;
                break;

            // Setup for Directory
            case DataLocation.RESOURCE_DIRECTORY:
                dirlocation.Text     = res.location;
                dir_textures.Checked = res.option1;
                dir_flats.Checked    = res.option2;
                break;

            // Setup for PK3 File
            case DataLocation.RESOURCE_PK3:
                pk3location.Text = res.location;
                break;
            }

            // Select appropriate tab
            tabs.SelectedIndex = res.type;

            // Checkbox
            notfortesting.Checked = res.notfortesting;

            this.startPath = startPath;
        }
Beispiel #13
0
        //mxd. This parses the given decorate stream. Returns false on errors
        public virtual bool Parse(TextResourceData parsedata, bool clearerrors)
        {
            // Clear error status?
            if (clearerrors)
            {
                ClearError();
            }

            // Integrity checks
            // INFO: MapManager.CompileLump() prepends lumpname with "?" to distinguish between temporary files and files compiled in place
            // We don't want this to show up in error messages
            if (parsedata.Stream == null)
            {
                ReportError("Unable to load \"" + parsedata.Filename.Replace("?", "") + "\"");
                return(false);
            }

            if (parsedata.Stream.Length == 0)
            {
                if (!string.IsNullOrEmpty(sourcename) && sourcename != parsedata.Filename)
                {
                    LogWarning("Include file \"" + parsedata.Filename.Replace("?", "") + "\" is empty");
                }
                else
                {
                    sourcename = parsedata.Filename;                     // LogWarning() needs "sourcename" property to properly log the warning...
                    LogWarning("File is empty");
                }
            }

            datastream      = parsedata.Stream;
            datareader      = new BinaryReader(parsedata.Stream, Encoding.ASCII);
            sourcename      = parsedata.Filename;
            sourcelumpindex = parsedata.LumpIndex;
            datalocation    = parsedata.SourceLocation;
            datastream.Seek(0, SeekOrigin.Begin);

            return(true);
        }
Beispiel #14
0
        public string UpdateLocation(short locationID, DataLocation newLocation)
        {
            using (dbContext = new DatabaseDataContext())
            {
                Location toUpdate = dbContext.Location.SingleOrDefault(location => location.LocationID == locationID);

                toUpdate.Name         = newLocation.Name;
                toUpdate.CostRate     = newLocation.CostRate;
                toUpdate.Availability = newLocation.Availability;
                toUpdate.ModifiedDate = newLocation.ModifiedDate;

                try
                {
                    dbContext.SubmitChanges();
                }
                catch
                {
                    return("Could not submit changes");
                }
                return("Changes submitted successfully");
            }
        }
Beispiel #15
0
        public static IDisposable InitializedSentry(string systemLanguage)
        {
            var s = SentrySdk.Init(o =>
            {
                o.Dsn            = new Dsn("https://[email protected]/5219588");
                o.Debug          = true; // todo
                o.Release        = Constant.Version;
                o.SendDefaultPii = true;
                o.DisableAppDomainUnhandledExceptionCapture();
            });

            SentrySdk.ConfigureScope(scope =>
            {
                scope.SetExtra("commandLine", Environment.CommandLine);
                scope.SetExtra("portableMode", DataLocation.PortableDataLocationInUse());
                scope.SetTag("systemLanguage", systemLanguage);
                scope.SetTag("timezone", TimeZoneInfo.Local.DisplayName);
                scope.SetExtra("x64OS", Environment.Is64BitOperatingSystem);
                scope.SetExtra("x64Process", Environment.Is64BitProcess);
            });
            return(s);
        }
Beispiel #16
0
        static Log()
        {
            CurrentLogDirectory = Path.Combine(DataLocation.DataDirectory(), DirectoryName, Constant.Version);
            if (!Directory.Exists(CurrentLogDirectory))
            {
                Directory.CreateDirectory(CurrentLogDirectory);
            }

            var configuration = new LoggingConfiguration();
            var fileTarget    = new FileTarget()
            {
                FileName = CurrentLogDirectory.Replace(@"\", "/") + "/${shortdate}.txt",
            };
            var consoleTarget = new NLog.Targets.ConsoleTarget();

#if DEBUG
            configuration.AddRule(LogLevel.Debug, LogLevel.Fatal, fileTarget);
#else
            configuration.AddRule(LogLevel.Info, LogLevel.Fatal, fileTarget);
#endif
            LogManager.Configuration = configuration;
        }
Beispiel #17
0
        public ProcedureCompilation(
            Procedure procedure,
            List <Variable> parameters,
            List <IInstruction> instructions,
            Dictionary <Constant, DataLocation> constantTable,
            DataLocation falseConstant,
            DataLocation trueConstant,
            RegisterAllocation registerAllocation)
        {
            Procedure              = procedure;
            Parameters             = parameters;
            Instructions           = instructions;
            ConstantTable          = constantTable;
            FalseConstant          = falseConstant;
            TrueConstant           = trueConstant;
            RegisterAllocation     = registerAllocation;
            StackRegisterTemporary = Align(RegisterAllocation.StackOffset);

            var calls = Instructions
                        .Select((x, i) => (x, i))
                        // Get all CallInstructions with their indicies
                        .Where(x => x.x is CallInstruction)
                        .Select(x => (Call: (CallInstruction)x.x, Index: x.i))
                        .ToList();

            int maxCallDeposit = calls.Count > 0
                ? // Check how many variables are live at the instruction and get the max
                                 calls.Max(x => RegisterAllocation.GetAllInAt(x.Index).Count())
                : 0;

            StackHomeSpace = Align(StackRegisterTemporary + (maxCallDeposit * 8));

            int maxParameters = calls.Count > 0
                ? calls.Max(x => Math.Max(0, x.Call.Parameters.Count - 4)) // - 4 since the first 4 parameters are saved in registers
                : 0;

            StackEnd = StackHomeSpace + 32 + Align(maxParameters * 8);
        }
        private void GenerateDataText(ref StringBuilder sb, DataLocation data)
        {
            string endOffset = string.Empty;
            if (data.EndOffset.HasValue)
            {
                endOffset = data.EndOffset.Value.ToString();
            }
            sb.Append(string.Format("{0} - ${1}", data.Name, PadHex(data.StartOffset)));
            if (!string.IsNullOrEmpty(endOffset))
            {
                if (data.EndOffset.Value != data.StartOffset)
                {
                    sb.AppendLine(" - $" + PadHex(data.EndOffset.Value));
                }
                else
                {
                    sb.AppendLine();
                }
            }
            else
            {
                sb.AppendLine();
            }

            sb.AppendLine();

            if (!string.IsNullOrEmpty(data.Description))
            {
                sb.AppendLine(data.Description);
            }

            if (!string.IsNullOrEmpty(data.DataFormat))
            {
                sb.AppendLine("See " + data.DataFormat);
            }
        }
        static void Main(string[] args)
        {
            DataManager dm = new DataManager(11000);
            dm.Start();
            dm.GetLocation();

            DMLocation dmLocation = new DMLocation("127.0.0.1:11000");//(@"db://[fe80::a91e:3a94:e27a:9035%13]:11000");
            ObjectLocation objectLocation0 = new ObjectLocation(ObjectType.FileWithHeader, @"C:\DB\arrayName.db", 0);
            ObjectLocation objectLocation1 = new ObjectLocation(ObjectType.FileWithHeader, @"C:\DB\arrayName.db", 1);
            DataLocation dataLocation0 = new DataLocation(dmLocation, objectLocation0);
            DataLocation dataLocation1 = new DataLocation(dmLocation, objectLocation1);

            //First transaction
            Transaction t = new Transaction();
            t.Begin();

            t.Write(dataLocation0, 42);
            t.Write(dataLocation1, 77);
            Console.WriteLine("Read: " + t.Read(dataLocation0));
            Console.WriteLine("Read: " + t.Read(dataLocation1));

            //Second transaction
            Transaction t2 = new Transaction();
            t2.Begin();
            t2.Write(dataLocation1, 99);
            Console.WriteLine("Read: " + t2.Read(dataLocation1));

            t.End();

            t2.End();

            dm.Stop();

            Console.WriteLine("Press Enter....");
            Console.ReadLine();
        }
Beispiel #20
0
        public static string RuntimeInfo()
        {
            var sb = new StringBuilder();

            sb.AppendLine("## Runtime Info");
            sb.AppendLine($"* Command Line: {Environment.CommandLine}");
            sb.AppendLine($"* Portable Mode: {DataLocation.PortableDataLocationInUse()}");
            sb.AppendLine($"* Timestamp: {DateTime.Now.ToString(CultureInfo.InvariantCulture)}");
            sb.AppendLine($"* Wox version: {Constant.Version}");
            sb.AppendLine($"* OS Version: {Environment.OSVersion.VersionString}");
            sb.AppendLine($"* x64 OS: {Environment.Is64BitOperatingSystem}");
            sb.AppendLine($"* x64 Process: {Environment.Is64BitProcess}");
            sb.AppendLine($"* System Language: {_systemLanguage}");
            sb.AppendLine($"* Wox Language: {_woxLanguage}");
            sb.AppendLine($"* CLR Version: {Environment.Version}");
            sb.AppendLine("* Installed .NET Framework: ");
            foreach (var result in GetFrameworkVersionFromRegistry())
            {
                sb.Append("   * ");
                sb.AppendLine(result);
            }

            return(sb.ToString());
        }
Beispiel #21
0
     public DataTable GetLettersDataTable(string _Number, string _Provider, string _Type, string _From, string _To, string _Money, string _Money2, string _User, string _Inc,
 DateType _DateType, DateTime startDate, DateTime endDate, DataLocation loc)
     {
         string query = @"SELECT [number],[cdate],[edate],[ldate],[provider],[type],[from],[to],[money],[money2],[user],[inc] FROM #{TABLE}";
         if (loc == DataLocation.Current)
             query = query.Replace("#{TABLE}", "[Letter]");
         else
             if (loc == DataLocation.Archive)
                 query = query.Replace("#{TABLE}", "[Archive2014]");
             else
             {
                 query = query.Replace("#{TABLE}", "[Letter]");
                 query += " UNION SELECT * FROM [Archive2014]";
                 query = "SELECT * FROM (" + query;
                 query += ")";
             }
         query += " WHERE '1=1'";
         OleDbCommand command = new OleDbCommand();
         command.CommandText = query;
         if (!string.IsNullOrEmpty(_Number))
         {
             command.CommandText += " AND [number] = @_Number";
             command.Parameters.Add("@_Number", OleDbType.Integer).Value = _Number;
         }
         if (!string.IsNullOrEmpty(_Provider))
         {
             command.CommandText += " AND [provider] = @_Provider";
             command.Parameters.Add("@_Provider", OleDbType.WChar).Value = _Provider;
         }
         if (!string.IsNullOrEmpty(_Type))
         {
             command.CommandText += " AND [type] = @_Type";
             command.Parameters.Add("@_Type", OleDbType.WChar).Value = _Type;
         }
         if (!string.IsNullOrEmpty(_From))
         {
             command.CommandText += " AND [from] = @_From";
             command.Parameters.Add("@_From", OleDbType.WChar).Value = _From;
         }
         if (!string.IsNullOrEmpty(_To))
         {
             command.CommandText += " AND [to] = @_To";
             command.Parameters.Add("@_To", OleDbType.WChar).Value = _To;
         }
         if (!string.IsNullOrEmpty(_Money))
         {
             command.CommandText += " AND [money] = @_Money";
             command.Parameters.Add("@_Money", OleDbType.WChar).Value = _Money;
         }
         if (!string.IsNullOrEmpty(_Money2))
         {
             command.CommandText += " AND [money2] = @_Money2";
             command.Parameters.Add("@_Money2", OleDbType.WChar).Value = _Money2;
         }
         if (!string.IsNullOrEmpty(_User))
         {
             command.CommandText += " AND [user] = @_User";
             command.Parameters.Add("@_User", OleDbType.WChar).Value = _User;
         }
         if (!string.IsNullOrEmpty(_Inc))
         {
             command.CommandText += " AND [inc] = @_Inc";
             command.Parameters.Add("@_Inc", OleDbType.Numeric).Value = _Inc;
         }
         if (_DateType != DateType.All)
         {
             switch (_DateType)
             {
                 case DateType.Creation: command.CommandText += " AND [cdate] Between @start AND @end";
                     command.Parameters.Add("@start", OleDbType.Date).Value = startDate;
                     command.Parameters.Add("@end", OleDbType.Date).Value = endDate;
                     break;
                 case DateType.Event: command.CommandText += " AND [edate] Between @start AND @end";
                     command.Parameters.Add("@start", OleDbType.Date).Value = startDate;
                     command.Parameters.Add("@end", OleDbType.Date).Value = endDate;
                     break;
                 case DateType.Letter: command.CommandText += " AND [ldate] Between @start AND @end";
                     command.Parameters.Add("@start", OleDbType.Date).Value = startDate;
                     command.Parameters.Add("@end", OleDbType.Date).Value = endDate;
                     break;
             }
         }
         command.CommandText += " ORDER BY [number] DESC";
         return GetData(command);
     }
Beispiel #22
0
 // New texture set constructor
 public ResourceImageSet(string name, DataLocation location)
 {
     this.name     = name;
     this.location = location;
     this.images   = new Dictionary <int, ImageData>();
 }
Beispiel #23
0
        // Should be called after all decorate actors are parsed
        public override bool Parse(TextResourceData data, bool clearerrors)
        {
            // Already parsed?
            if (!base.AddTextResource(data))
            {
                if (clearerrors)
                {
                    ClearError();
                }
                return(true);
            }

            // Cannot process?
            if (!base.Parse(data, clearerrors))
            {
                return(false);
            }

            // Keep local data
            Stream       localstream           = datastream;
            string       localsourcename       = sourcename;
            BinaryReader localreader           = datareader;
            DataLocation locallocation         = datalocation;     //mxd
            string       localtextresourcepath = textresourcepath; //mxd

            // Continue until at the end of the stream
            while (SkipWhitespace(true))
            {
                string token = ReadToken();

                if (string.IsNullOrEmpty(token) || token.ToLowerInvariant() != "model")
                {
                    if (token != null && token.ToLowerInvariant() == "#include")
                    {
                        //INFO: ZDoom DECORATE include paths can't be relative ("../actor.txt")
                        //or absolute ("d:/project/actor.txt")
                        //or have backward slashes ("info\actor.txt")
                        //include paths are relative to the first parsed entry, not the current one
                        //also include paths may or may not be quoted
                        SkipWhitespace(true);
                        string filename = StripQuotes(ReadToken(false)); //mxd. Don't skip newline

                        //mxd. Sanity checks
                        if (string.IsNullOrEmpty(filename))
                        {
                            ReportError("Expected file name to include");
                            return(false);
                        }

                        //mxd. Check invalid path chars
                        if (!CheckInvalidPathChars(filename))
                        {
                            return(false);
                        }

                        //mxd. Absolute paths are not supported...
                        if (Path.IsPathRooted(filename))
                        {
                            ReportError("Absolute include paths are not supported by ZDoom");
                            return(false);
                        }

                        //mxd. Relative paths are not supported
                        if (filename.StartsWith(RELATIVE_PATH_MARKER) || filename.StartsWith(CURRENT_FOLDER_PATH_MARKER) ||
                            filename.StartsWith(ALT_RELATIVE_PATH_MARKER) || filename.StartsWith(ALT_CURRENT_FOLDER_PATH_MARKER))
                        {
                            ReportError("Relative include paths are not supported by ZDoom");
                            return(false);
                        }

                        //mxd. Backward slashes are not supported
                        if (filename.Contains("\\"))
                        {
                            ReportError("Only forward slashes are supported by ZDoom");
                            return(false);
                        }

                        //mxd. Already parsed?
                        if (parsedlumps.Contains(filename))
                        {
                            ReportError("Already parsed \"" + filename + "\". Check your include directives");
                            return(false);
                        }

                        //mxd. Add to collection
                        parsedlumps.Add(filename);

                        // Callback to parse this file now
                        if (OnInclude != null)
                        {
                            OnInclude(this, filename);
                        }

                        //mxd. Bail out on error
                        if (this.HasError)
                        {
                            return(false);
                        }

                        // Set our buffers back to continue parsing
                        datastream       = localstream;
                        datareader       = localreader;
                        sourcename       = localsourcename;
                        datalocation     = locallocation;         //mxd
                        textresourcepath = localtextresourcepath; //mxd
                    }

                    continue;
                }

                // Find classname
                SkipWhitespace(true);
                string classname = StripQuotes(ReadToken(ActorStructure.ACTOR_CLASS_SPECIAL_TOKENS));
                if (string.IsNullOrEmpty(classname))
                {
                    ReportError("Expected actor class");
                    return(false);
                }

                // Check if actor exists
                bool haveplaceableactor = actorsbyclass.ContainsKey(classname);
                if (!haveplaceableactor && (General.Map.Data.GetZDoomActor(classname) == null))
                {
                    LogWarning("DECORATE class \"" + classname + "\" does not exist");
                }

                // Now find opening brace
                if (!NextTokenIs("{"))
                {
                    return(false);
                }

                // Parse the structure
                ModeldefStructure mds = new ModeldefStructure();
                if (mds.Parse(this))
                {
                    // Fetch Actor info
                    if (haveplaceableactor)
                    {
                        ThingTypeInfo info = General.Map.Data.GetThingInfoEx(actorsbyclass[classname]);
                        if (info != null)
                        {
                            // Already have a voxel model?
                            if (General.Map.Data.ModeldefEntries.ContainsKey(info.Index) && General.Map.Data.ModeldefEntries[info.Index].IsVoxel)
                            {
                                LogWarning("Both voxel(s) and model(s) are defined for actor\"" + classname + "\". Consider using either former or latter");
                            }
                            // Actor has a valid sprite?
                            else if (!string.IsNullOrEmpty(info.Sprite) && !info.Sprite.ToLowerInvariant().StartsWith(DataManager.INTERNAL_PREFIX) &&
                                     (info.Sprite.Length == 6 || info.Sprite.Length == 8))
                            {
                                string targetsprite = info.Sprite.Substring(0, 5);
                                if (mds.Frames.ContainsKey(targetsprite))
                                {
                                    // Create model data
                                    ModelData md = new ModelData {
                                        InheritActorPitch = mds.InheritActorPitch, UseActorPitch = mds.UseActorPitch, UseActorRoll = mds.UseActorRoll, Path = mds.DataPath
                                    };

                                    // Things are complicated in GZDoom...
                                    Matrix moffset = Matrix.Translation(mds.Offset.Y, -mds.Offset.X, mds.Offset.Z);
                                    //Matrix mrotation = Matrix.RotationZ(Angle2D.DegToRad(mds.AngleOffset)) * Matrix.RotationY(-Angle2D.DegToRad(mds.RollOffset)) * Matrix.RotationX(-Angle2D.DegToRad(mds.PitchOffset));
                                    Matrix mrotation = Matrix.RotationY((float)-Angle2D.DegToRad(mds.RollOffset)) * Matrix.RotationX((float)-Angle2D.DegToRad(mds.PitchOffset)) * Matrix.RotationZ((float)Angle2D.DegToRad(mds.AngleOffset));
                                    md.SetTransform(mrotation, moffset, mds.Scale);

                                    // Add models
                                    int disabledframescount = 0;
                                    foreach (var fs in mds.Frames[targetsprite])
                                    {
                                        // Sanity checks
                                        if (string.IsNullOrEmpty(mds.ModelNames[fs.ModelIndex]))
                                        {
                                            LogWarning("Model definition \"" + classname + "\", frame \"" + fs.SpriteName + " " + fs.FrameName + "\" references undefined model index " + fs.ModelIndex);
                                            continue;
                                        }

                                        //INFO: setting frame index to a negative number disables model rendering in GZDoom
                                        if (fs.FrameIndex < 0)
                                        {
                                            disabledframescount++;
                                            continue;
                                        }

                                        // Texture name will be empty when skin path is embedded in the model
                                        string skinname = (!string.IsNullOrEmpty(mds.SkinNames[fs.ModelIndex]) ? mds.SkinNames[fs.ModelIndex].ToLowerInvariant() : string.Empty);

                                        md.SkinNames.Add(skinname);
                                        md.SurfaceSkinNames.Add(mds.SurfaceSkinNames[fs.ModelIndex]);
                                        md.ModelNames.Add(mds.ModelNames[fs.ModelIndex].ToLowerInvariant());
                                        md.FrameNames.Add(fs.FrameName);
                                        md.FrameIndices.Add(fs.FrameIndex);
                                    }

                                    // More sanity checks...
                                    if (md.ModelNames.Count == 0)
                                    {
                                        // Show warning only when frames were not delibeartely disabled
                                        if (mds.Frames[targetsprite].Count > 0 && disabledframescount < mds.Frames[targetsprite].Count)
                                        {
                                            LogWarning("Model definition \"" + classname + "\" has no defined models");
                                        }
                                    }
                                    else
                                    {
                                        // Add to collection
                                        entries[classname] = md;
                                    }
                                }
                            }
                        }
                    }
                }

                if (HasError)
                {
                    LogError();
                    ClearError();
                }
            }

            return(true);
        }
Beispiel #24
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="fromDate"></param>
 /// <param name="toDate"></param>
 /// <param name="dataLocation"></param>
 /// <param name="symbol">Leave empty to get all symbols</param>
 /// <param name="dataSource">Leave empty to use default</param>
 public EarningsAnnouncementRequest(DateTime fromDate, DateTime toDate, List <string> symbol, DataLocation dataLocation = DataLocation.LocalOnly, string dataSource = null)
 {
     FromDate     = fromDate;
     ToDate       = toDate;
     DataLocation = dataLocation;
     Symbol       = symbol;
     DataSource   = dataSource;
 }
Beispiel #25
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="fromDate"></param>
 /// <param name="toDate"></param>
 /// <param name="dataLocation"></param>
 /// <param name="symbols">Request multiple symbols at once</param>
 /// <param name="dataSource">Leave empty to use default</param>
 public DividendRequest(DateTime fromDate, DateTime toDate, List <string> symbols, DataLocation dataLocation = DataLocation.LocalOnly, string dataSource = null)
 {
     FromDate     = fromDate;
     ToDate       = toDate;
     DataLocation = dataLocation;
     Symbol       = symbols;
     DataSource   = dataSource;
 }
 public byte Read(DataLocation dataLocation)
 {
     return _communicator.Read(dataLocation);
 }
 public void Write(DataLocation dataLocation, byte value)
 {
     _communicator.Write(dataLocation, value);
 }
        private bool ParseInclude(string filename)
        {
            Stream           localstream           = datastream;
            string           localsourcename       = sourcename;
            BinaryReader     localreader           = datareader;
            DataLocation     locallocation         = datalocation;     //mxd
            string           localtextresourcepath = textresourcepath; //mxd
            ZScriptTokenizer localtokenizer        = tokenizer;        // [ZZ]

            //INFO: ZDoom DECORATE include paths can't be relative ("../actor.txt")
            //or absolute ("d:/project/actor.txt")
            //or have backward slashes ("info\actor.txt")
            //include paths are relative to the first parsed entry, not the current one
            //also include paths may or may not be quoted
            //mxd. Sanity checks
            if (string.IsNullOrEmpty(filename))
            {
                ReportError("Expected file name to include");
                return(false);
            }

            //mxd. Check invalid path chars
            if (!CheckInvalidPathChars(filename))
            {
                return(false);
            }

            //mxd. Absolute paths are not supported...
            if (Path.IsPathRooted(filename))
            {
                ReportError("Absolute include paths are not supported by ZDoom");
                return(false);
            }

            //mxd. Relative paths are not supported
            if (filename.StartsWith(RELATIVE_PATH_MARKER) || filename.StartsWith(CURRENT_FOLDER_PATH_MARKER) ||
                filename.StartsWith(ALT_RELATIVE_PATH_MARKER) || filename.StartsWith(ALT_CURRENT_FOLDER_PATH_MARKER))
            {
                ReportError("Relative include paths are not supported by ZDoom");
                return(false);
            }

            //mxd. Backward slashes are not supported
            if (filename.Contains(Path.DirectorySeparatorChar.ToString(CultureInfo.InvariantCulture)))
            {
                ReportError("Only forward slashes are supported by ZDoom");
                return(false);
            }

            //mxd. Already parsed?
            if (parsedlumps.Contains(filename))
            {
                ReportError("Already parsed \"" + filename + "\". Check your include directives");
                return(false);
            }

            //mxd. Add to collection
            parsedlumps.Add(filename);

            // Callback to parse this file now
            if (OnInclude != null)
            {
                OnInclude(this, filename);
            }

            //mxd. Bail out on error
            if (this.HasError)
            {
                return(false);
            }

            // Set our buffers back to continue parsing
            datastream       = localstream;
            datareader       = localreader;
            sourcename       = localsourcename;
            datalocation     = locallocation;         //mxd
            textresourcepath = localtextresourcepath; //mxd
            tokenizer        = localtokenizer;

            return(true);
        }
Beispiel #29
0
 public HistoricalDataRequest(Instrument instrument, BarSize frequency, DateTime startingDate, DateTime endingDate, DataLocation dataLocation = DataLocation.Both, bool saveToLocalStorage = true, bool rthOnly = true, int requestID = 0)
 {
     Frequency = frequency;
     Instrument = instrument;
     StartingDate = startingDate;
     EndingDate = endingDate;
     DataLocation = dataLocation;
     SaveDataToStorage = saveToLocalStorage;
     RTHOnly = rthOnly;
     RequestID = requestID;
 }
Beispiel #30
0
        // This takes the unconverted parameters (with placeholders) and converts it
        // to parameters with full paths, names and numbers where placeholders were put.
        // The tempfile must be the full path and filename to the PWAD file to test.
        public string ConvertParameters(string parameters, int skill, bool shortpaths)
        {
            string       outp = parameters;
            DataLocation iwadloc;
            string       p_wp = "", p_wf = "";
            string       p_ap = "", p_apq = "";
            string       p_l1 = "", p_l2 = "";
            string       p_nm = "";
            string       f    = tempwad;

            // Make short path if needed
            if (shortpaths)
            {
                f = General.GetShortFilePath(f);
            }

            // Find the first IWAD file
            if (General.Map.Data.FindFirstIWAD(out iwadloc))
            {
                // %WP and %WF result in IWAD file
                p_wp = iwadloc.location;
                p_wf = Path.GetFileName(p_wp);
                if (shortpaths)
                {
                    p_wp = General.GetShortFilePath(p_wp);
                    p_wf = General.GetShortFilePath(p_wf);
                }
            }

            // Make a list of all data locations, including map location
            DataLocation     maplocation = new DataLocation(DataLocation.RESOURCE_WAD, General.Map.FilePathName, false, false, false);
            DataLocationList locations   = new DataLocationList();

            locations.AddRange(General.Map.ConfigSettings.Resources);
            locations.AddRange(General.Map.Options.Resources);
            locations.Add(maplocation);

            // Go for all data locations
            foreach (DataLocation dl in locations)
            {
                // Location not the IWAD file?
                if ((dl.type != DataLocation.RESOURCE_WAD) || (dl.location != iwadloc.location))
                {
                    // Location not included?
                    if (!dl.notfortesting)
                    {
                        // Add to string of files
                        if (shortpaths)
                        {
                            p_ap  += General.GetShortFilePath(dl.location) + " ";
                            p_apq += "\"" + General.GetShortFilePath(dl.location) + "\" ";
                        }
                        else
                        {
                            p_ap  += dl.location + " ";
                            p_apq += "\"" + dl.location + "\" ";
                        }
                    }
                }
            }

            // Trim last space from resource file locations
            p_ap  = p_ap.TrimEnd(' ');
            p_apq = p_apq.TrimEnd(' ');

            // Try finding the L1 and L2 numbers from the map name
            string numstr = "";
            bool   first  = true;

            foreach (char c in General.Map.Options.CurrentName)
            {
                // Character is a number?
                if (NUMBERS.IndexOf(c) > -1)
                {
                    // Include it
                    numstr += c;
                }
                else
                {
                    // Store the number if we found one
                    if (numstr.Length > 0)
                    {
                        int num = 0;
                        int.TryParse(numstr, out num);
                        if (first)
                        {
                            p_l1 = num.ToString();
                        }
                        else
                        {
                            p_l2 = num.ToString();
                        }
                        numstr = "";
                        first  = false;
                    }
                }
            }

            // Store the number if we found one
            if (numstr.Length > 0)
            {
                int num = 0;
                int.TryParse(numstr, out num);
                if (first)
                {
                    p_l1 = num.ToString();
                }
                else
                {
                    p_l2 = num.ToString();
                }
            }

            // No monsters?
            if (!General.Settings.TestMonsters)
            {
                p_nm = "-nomonsters";
            }

            // Make sure all our placeholders are in uppercase
            outp = outp.Replace("%f", "%F");
            outp = outp.Replace("%wp", "%WP");
            outp = outp.Replace("%wf", "%WF");
            outp = outp.Replace("%wP", "%WP");
            outp = outp.Replace("%wF", "%WF");
            outp = outp.Replace("%Wp", "%WP");
            outp = outp.Replace("%Wf", "%WF");
            outp = outp.Replace("%l1", "%L1");
            outp = outp.Replace("%l2", "%L2");
            outp = outp.Replace("%l", "%L");
            outp = outp.Replace("%ap", "%AP");
            outp = outp.Replace("%aP", "%AP");
            outp = outp.Replace("%Ap", "%AP");
            outp = outp.Replace("%s", "%S");
            outp = outp.Replace("%nM", "%NM");
            outp = outp.Replace("%Nm", "%NM");
            outp = outp.Replace("%nm", "%NM");

            // Replace placeholders with actual values
            outp = outp.Replace("%F", f);
            outp = outp.Replace("%WP", p_wp);
            outp = outp.Replace("%WF", p_wf);
            outp = outp.Replace("%L1", p_l1);
            outp = outp.Replace("%L2", p_l2);
            outp = outp.Replace("%L", General.Map.Options.CurrentName);
            outp = outp.Replace("\"%AP\"", p_apq);
            outp = outp.Replace("%AP", p_ap);
            outp = outp.Replace("%S", skill.ToString());
            outp = outp.Replace("%NM", p_nm);

            // Return result
            return(outp);
        }
 public byte Read(DataLocation location)
 {
     throw new NotImplementedException();
 }
Beispiel #32
0
        /// <summary>
        /// the method can be called by execute "update-database" with the nuget-console
        /// </summary>
        /// <param name="context">the database context</param>
        protected override void Seed(BrokerContext context)
        {
            context.ServiceClass.SeedEnumValues <ServiceClass, ServiceClassEnum>(@enum => @enum);

            var uMgr      = new UserManager <ApplicationUser, Guid>(new UserStore <ApplicationUser, ApplicationRole, Guid, ApplicationUserLogin, ApplicationUserRole, ApplicationUserClaim>(context));
            var rMgr      = new RoleManager <ApplicationRole, Guid>(new RoleStore <ApplicationRole, Guid, ApplicationUserRole>(context));
            var adminRole = new ApplicationRole
            {
                Name = "Admin"
            };

            context.Roles.AddOrUpdate(x => x.Name, adminRole);
            var userRole = new ApplicationRole
            {
                Name = "User"
            };

            context.Roles.AddOrUpdate(x => x.Name, userRole);
            var adminUser = new ApplicationUser
            {
                UserName     = "******",
                PasswordHash = uMgr.PasswordHasher.HashPassword("cloudBroker01")
            };

            context.Users.AddOrUpdate(x => x.UserName, adminUser);
            var defaultUser = new ApplicationUser
            {
                UserName     = "******",
                PasswordHash = uMgr.PasswordHasher.HashPassword("12345678")
            };

            context.Users.AddOrUpdate(x => x.UserName, defaultUser);

            var createServicesRule = new Rule
            {
                RuleCode  = "create-services",
                RuleTitle = "Services anlegen",
                RuleDesc  = "Dürfen Nutzer der Rollengruppe neue Services in der Datenbank anlegen?"
            };

            context.Rule.AddOrUpdate(x => x.RuleCode, createServicesRule);
            var editServicesRule = new Rule
            {
                RuleCode  = "edit-services",
                RuleTitle = "Services bearbeiten",
                RuleDesc  = "Dürfen Nutzer der Rollengruppe Services in der Datenbank verändern?"
            };

            context.Rule.AddOrUpdate(x => x.RuleCode, editServicesRule);
            var deleteServicesRule = new Rule
            {
                RuleCode  = "delete-services",
                RuleTitle = "Services löschen",
                RuleDesc  = "Dürfen Nutzer der Rollengruppe Services aus der Datenbank löschen?"
            };

            context.Rule.AddOrUpdate(x => x.RuleCode, deleteServicesRule);
            var editSecurityGuidelines = new Rule
            {
                RuleCode  = "edit-security-guidelines",
                RuleTitle = "Rollenberechtigungen bearbeiten",
                RuleDesc  = "Dürfen Nutzer der Rollengruppe Rollenberechtigungen bearbeiten?"
            };

            context.Rule.AddOrUpdate(x => x.RuleCode, editSecurityGuidelines);
            var registerRoles = new Rule
            {
                RuleCode  = "register-roles",
                RuleTitle = "Rollen anlegen",
                RuleDesc  = "Dürfen Nutzer der Rollengruppe Rollen hinzufügen?"
            };

            context.Rule.AddOrUpdate(x => x.RuleCode, registerRoles);
            var deleteRoles = new Rule
            {
                RuleCode  = "delete-roles",
                RuleTitle = "Rollen löschen",
                RuleDesc  = "Dürfen Nutzer der Rollengruppe Rollen entfernen?"
            };

            context.Rule.AddOrUpdate(x => x.RuleCode, deleteRoles);
            var manageUseCases = new Rule
            {
                RuleCode  = "manage-use-cases",
                RuleTitle = "Use-Cases verwalten",
                RuleDesc  = "Dürfen Nutzer der Rollengruppe Use-Cases erstellen, ändern und löschen?"
            };

            context.Rule.AddOrUpdate(x => x.RuleCode, deleteRoles);

            context.SaveChanges();

            context.UseCase.Add(new UseCase
            {
                Creation            = DateTime.Now,
                TitleDE             = "Ich möchte mit meinen Kollegen gemeinsam Dokumente erstellen und bearbeiten",
                TitleEN             = null,
                TitleES             = null,
                InternalDescription = null,
                ServiceClassMapping = context.ServiceClass.Where(x => new List <int> {
                    4
                }.Contains(x.Id)).ToList()
            });
            context.UseCase.Add(new UseCase
            {
                Creation            = DateTime.Now,
                TitleDE             = "Ich möchte meinen Arbeitsplatz mit mehreren Endgeräten synchronisieren",
                TitleEN             = null,
                TitleES             = null,
                InternalDescription = null,
                ServiceClassMapping = context.ServiceClass.Where(x => new List <int> {
                    4
                }.Contains(x.Id)).ToList()
            });
            context.UseCase.Add(new UseCase
            {
                Creation            = DateTime.Now,
                TitleDE             = "Ich möchte Medien (Fotos, Videos etc,) über das Internet streamen",
                TitleEN             = null,
                TitleES             = null,
                InternalDescription = null,
                ServiceClassMapping = context.ServiceClass.Where(x => new List <int> {
                    3
                }.Contains(x.Id)).ToList()
            });
            context.UseCase.Add(new UseCase
            {
                Creation            = DateTime.Now,
                TitleDE             = "Ich möchte Dateien und Ordner mit anderen teilen",
                TitleEN             = null,
                TitleES             = null,
                InternalDescription = null,
                ServiceClassMapping = context.ServiceClass.Where(x => new List <int> {
                    4
                }.Contains(x.Id)).ToList()
            });
            context.UseCase.Add(new UseCase
            {
                Creation            = DateTime.Now,
                TitleDE             = "Ich möchte regelmäßige Backups von meinen Dateien erstellen",
                TitleEN             = null,
                TitleES             = null,
                InternalDescription = null,
                ServiceClassMapping = context.ServiceClass.Where(x => new List <int> {
                    4
                }.Contains(x.Id)).ToList()
            });
            context.UseCase.Add(new UseCase
            {
                Creation            = DateTime.Now,
                TitleDE             = "Ich möchte Dateien für eine Applikation bereitstellen",
                TitleEN             = null,
                TitleES             = null,
                InternalDescription = null,
                ServiceClassMapping = context.ServiceClass.Where(x => new List <int> {
                    0
                }.Contains(x.Id)).ToList()
            });
            context.UseCase.Add(new UseCase
            {
                Creation            = DateTime.Now,
                TitleDE             = "Ich benötige (peristenten) Speicher für einen Container (z.B. Docker)",
                TitleEN             = null,
                TitleES             = null,
                InternalDescription = null,
                ServiceClassMapping = context.ServiceClass.Where(x => new List <int> {
                    0
                }.Contains(x.Id)).ToList()
            });
            context.UseCase.Add(new UseCase
            {
                Creation            = DateTime.Now,
                TitleDE             = "Ich benötige Speicher für den Betrieb eigener Applikationen (z.B. ERP-System)",
                TitleEN             = null,
                TitleES             = null,
                InternalDescription = null,
                ServiceClassMapping = context.ServiceClass.Where(x => new List <int> {
                    0
                }.Contains(x.Id)).ToList()
            });
            context.UseCase.Add(new UseCase
            {
                Creation            = DateTime.Now,
                TitleDE             = "Ich benötige Laufwerke für virtuelle Maschinen",
                TitleEN             = null,
                TitleES             = null,
                InternalDescription = null,
                ServiceClassMapping = context.ServiceClass.Where(x => new List <int> {
                    0
                }.Contains(x.Id)).ToList()
            });
            context.UseCase.Add(new UseCase
            {
                Creation            = DateTime.Now,
                TitleDE             = "Ich benötige lokalen Speicher für Datenbanken",
                TitleEN             = null,
                TitleES             = null,
                InternalDescription = null,
                ServiceClassMapping = context.ServiceClass.Where(x => new List <int> {
                    0
                }.Contains(x.Id)).ToList()
            });
            context.UseCase.Add(new UseCase
            {
                Creation            = DateTime.Now,
                TitleDE             = "Ich benötige Speicher für die Bereitstellung von Bildern und Websiteinhalten",
                TitleEN             = null,
                TitleES             = null,
                InternalDescription = null,
                ServiceClassMapping = context.ServiceClass.Where(x => new List <int> {
                    3
                }.Contains(x.Id)).ToList()
            });

            uMgr.AddToRole <ApplicationUser, Guid>(adminUser.Id, adminRole.Name);
            uMgr.AddToRole <ApplicationUser, Guid>(defaultUser.Id, userRole.Name);

            adminRole.Rules.Add(createServicesRule);
            adminRole.Rules.Add(editServicesRule);
            adminRole.Rules.Add(deleteServicesRule);
            adminRole.Rules.Add(editSecurityGuidelines);
            adminRole.Rules.Add(registerRoles);
            adminRole.Rules.Add(deleteRoles);
            adminRole.Rules.Add(manageUseCases);

            var pricingPeriodD = new PricingPeriod {
                PricingPeriodName = "Täglich", PricingPeriodeCode = "daily"
            };
            var pricingPeriodM = new PricingPeriod {
                PricingPeriodName = "Monatlich", PricingPeriodeCode = "monthly"
            };
            var pricingPeriodA = new PricingPeriod {
                PricingPeriodName = "Jährlich", PricingPeriodeCode = "annually"
            };

            context.PricingPeriod.Add(pricingPeriodD);
            context.PricingPeriod.Add(pricingPeriodM);
            context.PricingPeriod.Add(pricingPeriodA);

            var pricingModelUSR = new PricingModel {
                PricingModelName = "Nutzer-basiert"
            };
            var pricingModelUSA = new PricingModel {
                PricingModelName = "Nutzungs-basiert"
            };
            var pricingModelHYB = new PricingModel {
                PricingModelName = "Hybride Preiskalkulation"
            };

            context.PricingModel.Add(pricingModelUSR);
            context.PricingModel.Add(pricingModelUSA);
            context.PricingModel.Add(pricingModelHYB);

            var deploymentPUB = new DeploymentInfo {
                DeploymentName = "Public"
            };
            var deploymentPRV = new DeploymentInfo {
                DeploymentName = "Private"
            };

            context.DeploymentInfo.Add(deploymentPUB);
            context.DeploymentInfo.Add(deploymentPRV);

            var cert1 = new Certificate {
                CertificateName = "ISO 27001"
            };
            var cert3 = new Certificate {
                CertificateName = "SOC 1"
            };
            var cert4 = new Certificate {
                CertificateName = "SOC 2"
            };
            var cert5 = new Certificate {
                CertificateName = "SOC 3"
            };
            var cert6 = new Certificate {
                CertificateName = "PCI DSS"
            };
            var cert7 = new Certificate {
                CertificateName = "CSA STAR"
            };
            var cert8 = new Certificate {
                CertificateName = "GDPR"
            };
            var cert9 = new Certificate {
                CertificateName = "ISO 27017"
            };
            var cert10 = new Certificate {
                CertificateName = "ISO 27018"
            };

            context.Certificate.Add(cert1);
            context.Certificate.Add(cert3);
            context.Certificate.Add(cert4);
            context.Certificate.Add(cert5);
            context.Certificate.Add(cert6);
            context.Certificate.Add(cert7);
            context.Certificate.Add(cert8);
            context.Certificate.Add(cert9);
            context.Certificate.Add(cert10);

            var locationTypeC = new DataLocationType {
                TypeNameDE = "Kontinent",
                TypeNameEN = "Continent",
                TypeNameES = "Continente"
            };
            var locationTypeR = new DataLocationType {
                TypeNameDE = "Region",
                TypeNameEN = "Region",
                TypeNameES = "Región"
            };
            var locationTypeL = new DataLocationType {
                TypeNameDE = "Land",
                TypeNameEN = "Country",
                TypeNameES = "Pais"
            };

            context.DataLocationType.Add(locationTypeC);
            context.DataLocationType.Add(locationTypeR);
            context.DataLocationType.Add(locationTypeL);

            context.SaveChanges();

            var dataLocationEU = new DataLocation {
                DataLocationNameDE = "EU",
                DataLocationNameEN = "EU",
                DataLocationNameES = "EU",
                DataLocationTypeId = locationTypeC.Id
            };
            var dataLocationGER = new DataLocation {
                DataLocationNameDE = "Deutschsprachiger Raum",
                DataLocationNameEN = "German speaking area",
                DataLocationNameES = "Área de habla alemana",
                DataLocationTypeId = locationTypeR.Id
            };

            context.DataLocation.Add(dataLocationEU);
            context.DataLocation.Add(dataLocationGER);

            CloudServiceModel saaSModel = new CloudServiceModel
            {
                CloudServiceModelName = "Saas"
            };
            CloudServiceModel iaaSModel = new CloudServiceModel
            {
                CloudServiceModelName = "IaaS"
            };
            CloudServiceModel paaSModel = new CloudServiceModel
            {
                CloudServiceModelName = "PaaS"
            };

            context.CloudServiceModel.AddOrUpdate(saaSModel);
            context.CloudServiceModel.AddOrUpdate(iaaSModel);
            context.CloudServiceModel.AddOrUpdate(paaSModel);

            Provider dropboxProvider = new Provider
            {
                ProviderName = "Dropbox",
                URL          = "https://www.dropbox.com/"
            };
            Provider stratoProvider = new Provider
            {
                ProviderName = "Strato",
                URL          = "https://www.strato.de/cloud-speicher/"
            };
            Provider googleProvider = new Provider
            {
                ProviderName = "Google Cloud",
                URL          = "https://cloud.google.com/"
            };
            Provider awsProvider = new Provider
            {
                ProviderName = "Amazon Web Services (AWS)",
                URL          = "https://aws.amazon.com/de/"
            };
            Provider azureProvider = new Provider
            {
                ProviderName = "Microsoft Azure",
                URL          = "https://azure.microsoft.com/de-de/"
            };
            Provider digitalOceanProvider = new Provider
            {
                ProviderName = "DigitalOcean",
                URL          = "https://www.digitalocean.com/"
            };
            Provider hetznerProvider = new Provider
            {
                ProviderName = "Hetzner",
                URL          = "https://www.hetzner.de"
            };
            Provider rackspaceProvider = new Provider
            {
                ProviderName = "Rackspace",
                URL          = "https://www.rackspace.com/"
            };
            Provider ibmProvider = new Provider
            {
                ProviderName = "IBM",
                URL          = "https://www.ibm.com/cloud/"
            };
            Provider ionosProvider = new Provider
            {
                ProviderName = "IONOS",
                URL          = "https://www.ionos.de/enterprise-cloud/object-storage"
            };
            Provider gridscaleProvider = new Provider
            {
                ProviderName = "Gridscale",
                URL          = "https://gridscale.io/"
            };

            context.Provider.AddOrUpdate(dropboxProvider);
            context.Provider.AddOrUpdate(stratoProvider);
            context.Provider.AddOrUpdate(googleProvider);
            context.Provider.AddOrUpdate(awsProvider);
            context.Provider.AddOrUpdate(azureProvider);
            context.Provider.AddOrUpdate(digitalOceanProvider);
            context.Provider.AddOrUpdate(hetznerProvider);
            context.Provider.AddOrUpdate(rackspaceProvider);
            context.Provider.AddOrUpdate(ibmProvider);
            context.Provider.AddOrUpdate(ionosProvider);
            context.Provider.AddOrUpdate(gridscaleProvider);

            Feature hasFileEncryption = new Feature
            {
                Color         = "#1a78b8",
                DescriptionDE = "Dateiverschlüsselung",
                DescriptionEN = "File encryption",
                DescriptionES = "Cifrado de archivos",
                Icon          = "vpn_key"
            };
            Feature hasReplication = new Feature
            {
                Color         = "#1c17bd",
                DescriptionDE = "Redundante Datenspeicherung",
                DescriptionEN = "File replication",
                DescriptionES = "Replicación de archivos",
                Icon          = "file_copy"
            };
            Feature hasVersioning = new Feature
            {
                Color         = "#a74ddb",
                DescriptionDE = "Dateiversionierung",
                DescriptionEN = "File versioning",
                DescriptionES = "Versionado de archivos",
                Icon          = "restore"
            };
            Feature hasPermissions = new Feature
            {
                Color         = "#f00e7b",
                DescriptionDE = "Nutzerberechtigungssystem",
                DescriptionEN = "File permissions",
                DescriptionES = "Permisos de archivos",
                Icon          = "security"
            };
            Feature hasAutomatedSynchronization = new Feature
            {
                Color         = "#3c9e49",
                DescriptionDE = "Automatische Synchronisation",
                DescriptionEN = "Automated synchronization",
                DescriptionES = "sincronización automatizada",
                Icon          = "cached"
            };
            Feature hasLocking = new Feature
            {
                Color         = "#e81046",
                DescriptionDE = "Datei Sperren",
                DescriptionEN = "File locking",
                DescriptionES = "bloqueo de archivos",
                Icon          = "block"
            };

            context.Feature.Add(hasFileEncryption);
            context.Feature.Add(hasReplication);
            context.Feature.Add(hasVersioning);
            context.Feature.Add(hasPermissions);
            context.Feature.Add(hasAutomatedSynchronization);
            context.Feature.Add(hasLocking);
            context.SaveChanges();

            context.OnlineDriveStorageService.AddOrUpdate(
                x => x.ServiceName,
                new OnlineDriveStorageService
            {
                ServiceName          = "Dropbox Basic",
                ServiceDescriptionDE = "Dropbox bietet Speicherplatz für Dateien auf all Ihren verknüpften Geräten",
                ServiceTitleDE       = "Kostenlose Version von Dropbox",
                CloudServiceModelId  = saaSModel.Id,
                CloudServiceModel    = saaSModel,
                ProviderId           = dropboxProvider.Id,
                Provider             = dropboxProvider,
                Creation             = DateTime.Now,
                LastModified         = DateTime.Now,
                Features             = new List <Feature> {
                }
            }
                );
            context.OnlineDriveStorageService.AddOrUpdate(
                x => x.ServiceName,
                new OnlineDriveStorageService
            {
                ServiceName          = "OneDrive",
                ServiceDescriptionDE = "Speichern Sie Ihre Dateien und Fotos auf OneDrive, um sie von jedem Gerät und überall aus abrufen zu können",
                CloudServiceModelId  = saaSModel.Id,
                CloudServiceModel    = saaSModel,
                Creation             = DateTime.Now,
                LastModified         = DateTime.Now,
                Features             = new List <Feature> {
                }
            }
                );
            context.OnlineDriveStorageService.AddOrUpdate(
                x => x.ServiceName,
                new OnlineDriveStorageService {
                ServiceName          = "HiDrive",
                ServiceDescriptionDE = "Der Cloud-Speicher für Ihre Fotos, Videos & Dateien",
                ServiceTitleDE       = "HiDrive",
                ServiceAvailability  = "99,99",
                CloudServiceModelId  = saaSModel.Id,
                CloudServiceModel    = saaSModel,
                ProviderId           = stratoProvider.Id,
                Provider             = stratoProvider,
                Creation             = DateTime.Now,
                LastModified         = DateTime.Now,
                Features             = new List <Feature> {
                }
            }
                );
            context.ObjectStorageService.AddOrUpdate(
                x => x.ServiceName,
                new ObjectStorageService {
                ServiceName          = "Amazon S3",
                ServiceDescriptionDE = "Filehosting-Dienst, der beliebig große Datenmengen speichern kann und nach Verbrauch abgerechnet wird",
                ServiceTitleDE       = "Amazon Simple Storage Service",
                ServiceAvailability  = "99,99",
                CloudServiceModelId  = iaaSModel.Id,
                CloudServiceModel    = iaaSModel,
                Creation             = DateTime.Now,
                LastModified         = DateTime.Now,
                Features             = new List <Feature> {
                    hasFileEncryption, hasVersioning, hasPermissions, hasReplication, hasLocking
                }
            }
                );
            context.ObjectStorageService.AddOrUpdate(
                x => x.ServiceName,
                new ObjectStorageService {
                ServiceName          = "Google Cloud Storage",
                ServiceDescriptionDE = "Einheitlicher Objektspeicher für Entwickler und Unternehmen",
                ServiceTitleDE       = "Google Cloud Storage",
                ServiceAvailability  = "99,99",
                CloudServiceModelId  = iaaSModel.Id,
                CloudServiceModel    = iaaSModel,
                ProviderId           = googleProvider.Id,
                Provider             = googleProvider,
                Creation             = DateTime.Now,
                LastModified         = DateTime.Now,
                Features             = new List <Feature> {
                    hasFileEncryption, hasVersioning, hasPermissions
                }
            }
                );
            context.BlockStorageService.AddOrUpdate(
                x => x.ServiceName,
                new BlockStorageService {
                ServiceName          = "Azure Disk Storage",
                ServiceDescriptionDE = "Persistente und leistungsstarke Datenträger für virtuelle Azure-Computer",
                ServiceAvailability  = "99,95",
                CloudServiceModelId  = iaaSModel.Id,
                CloudServiceModel    = iaaSModel,
                Creation             = DateTime.Now,
                LastModified         = DateTime.Now,
                Features             = new List <Feature> {
                }
            }
                );
            context.ObjectStorageService.AddOrUpdate(
                x => x.ServiceName,
                new ObjectStorageService {
                ServiceName         = "S3 Object Storage",
                ServiceAvailability = "99,95",
                CloudServiceModelId = iaaSModel.Id,
                CloudServiceModel   = iaaSModel,
                Creation            = DateTime.Now,
                LastModified        = DateTime.Now,
                Features            = new List <Feature> {
                    hasFileEncryption, hasPermissions
                }
            }
                );
            context.BlockStorageService.AddOrUpdate(
                x => x.ServiceName,
                new BlockStorageService {
                ServiceName          = "Amazon Elastic Block Store",
                ServiceDescriptionDE = "Amazon Elastic Block Store (Amazon EBS) bietet Volumes für die Speicherung auf Blockebene, die in Verbindung mit EC2-Instances verwendet werden. EBS-Volumes verhalten sich wie unformatierte Blockgeräte",
                ServiceTitleDE       = "Amazon EBS",
                ServiceAvailability  = "99,99",
                CloudServiceModelId  = iaaSModel.Id,
                CloudServiceModel    = iaaSModel,
                ProviderId           = awsProvider.Id,
                Provider             = awsProvider,
                Creation             = DateTime.Now,
                LastModified         = DateTime.Now,
                Features             = new List <Feature> {
                    hasFileEncryption, hasReplication
                }
            }
                );
            context.BlockStorageService.AddOrUpdate(
                x => x.ServiceName,
                new BlockStorageService {
                ServiceName          = "Blockspeicher für VM-Instanzen",
                ServiceDescriptionDE = "Zuverlässiger, leistungsstarker Blockspeicher für VM-Instanzen",
                ServiceTitleDE       = "Persistent Disk",
                ServiceAvailability  = "99,99",
                CloudServiceModelId  = iaaSModel.Id,
                CloudServiceModel    = iaaSModel,
                ProviderId           = googleProvider.Id,
                Provider             = googleProvider,
                Creation             = DateTime.Now,
                LastModified         = DateTime.Now,
                Features             = new List <Feature> {
                    hasFileEncryption, hasReplication
                }
            }
                );
            context.BlockStorageService.AddOrUpdate(
                x => x.ServiceName,
                new BlockStorageService {
                ServiceName          = "Azure Disk Storage",
                ServiceDescriptionDE = "Persistente und leistungsstarke Datenträger für virtuelle Azure-Compute",
                ServiceTitleDE       = "Azure Disk Storage",
                ServiceAvailability  = "99,99",
                CloudServiceModelId  = iaaSModel.Id,
                CloudServiceModel    = iaaSModel,
                ProviderId           = azureProvider.Id,
                Provider             = azureProvider,
                Creation             = DateTime.Now,
                LastModified         = DateTime.Now,
                Features             = new List <Feature> {
                    hasFileEncryption, hasReplication
                }
            }
                );
            context.ObjectStorageService.AddOrUpdate(
                x => x.ServiceName,
                new ObjectStorageService {
                ServiceName          = "Blob Storage",
                ServiceDescriptionDE = "Hochgradig skalierbarer Objektspeicher für unstrukturierte Daten",
                ServiceTitleDE       = "Blob Storage",
                ServiceAvailability  = "99,99",
                CloudServiceModelId  = iaaSModel.Id,
                CloudServiceModel    = iaaSModel,
                Creation             = DateTime.Now,
                LastModified         = DateTime.Now,
                Features             = new List <Feature> {
                    hasPermissions, hasReplication
                }
            }
                );
            context.ObjectStorageService.AddOrUpdate(
                x => x.ServiceName,
                new ObjectStorageService {
                ServiceName          = "Spaces",
                ServiceDescriptionDE = "Spaces ergänzt den lokalen und Netzwerkspeicher, um Ihrem Unternehmen die Skalierung zu erleichtern",
                ServiceTitleDE       = "Spaces",
                ServiceAvailability  = "99,95",
                CloudServiceModelId  = iaaSModel.Id,
                CloudServiceModel    = iaaSModel,
                ProviderId           = digitalOceanProvider.Id,
                Provider             = digitalOceanProvider,
                Creation             = DateTime.Now,
                LastModified         = DateTime.Now,
                Features             = new List <Feature> {
                    hasPermissions, hasReplication
                }
            }
                );
            context.BlockStorageService.AddOrUpdate(
                x => x.ServiceName,
                new BlockStorageService {
                ServiceName          = "Volumes Block Storage",
                ServiceDescriptionDE = "Hochverfügbaren und skalierbaren SSD-basierten Blockspeicher",
                ServiceTitleDE       = "Volumes Block Storage",
                ServiceAvailability  = "99,95",
                CloudServiceModelId  = iaaSModel.Id,
                CloudServiceModel    = iaaSModel,
                ProviderId           = digitalOceanProvider.Id,
                Provider             = digitalOceanProvider,
                Creation             = DateTime.Now,
                LastModified         = DateTime.Now,
                Features             = new List <Feature> {
                    hasReplication
                }
            }
                );
            context.BlockStorageService.AddOrUpdate(
                x => x.ServiceName,
                new BlockStorageService {
                ServiceName          = "Volumes",
                ServiceDescriptionDE = "Volumes bieten hochverfügbaren und zuverlässigen SSD-Speicherplatz für Ihre Cloud Server",
                ServiceTitleDE       = "Volumes",
                CloudServiceModelId  = iaaSModel.Id,
                CloudServiceModel    = iaaSModel,
                ProviderId           = hetznerProvider.Id,
                Provider             = hetznerProvider,
                Creation             = DateTime.Now,
                LastModified         = DateTime.Now,
                Features             = new List <Feature> {
                    hasReplication
                }
            }
                );
            context.OnlineDriveStorageService.AddOrUpdate(
                x => x.ServiceName,
                new OnlineDriveStorageService {
                ServiceName          = "Storage Share",
                ServiceDescriptionDE = "Daten speichern und teilen",
                ServiceTitleDE       = "Storage Share",
                ServiceTitleEN       = "Storage Share",
                ServiceTitleES       = "Storage Share",
                CloudServiceModelId  = saaSModel.Id,
                CloudServiceModel    = saaSModel,
                ProviderId           = hetznerProvider.Id,
                Provider             = hetznerProvider,
                Creation             = DateTime.Now,
                LastModified         = DateTime.Now,
                Features             = new List <Feature> {
                }
            }
                );
            context.ObjectStorageService.AddOrUpdate(
                x => x.ServiceName,
                new ObjectStorageService {
                ServiceName          = "Cloud Files",
                ServiceDescriptionDE = "Cloud Files bietet Online-Objektspeicher für Dateien und Medien und stellt sie weltweit mit rasender Geschwindigkeit über ein weltweites Content-Delivery-Netzwerk (CDN) bereit",
                ServiceAvailability  = "99,99",
                ServiceTitleDE       = "Cloud Files",
                ServiceTitleEN       = "Cloud Files",
                ServiceTitleES       = "Cloud Files",
                CloudServiceModelId  = iaaSModel.Id,
                CloudServiceModel    = iaaSModel,
                Creation             = DateTime.Now,
                LastModified         = DateTime.Now,
                Features             = new List <Feature> {
                    hasPermissions, hasReplication
                }
            }
                );
            context.BlockStorageService.AddOrUpdate(
                x => x.ServiceName,
                new BlockStorageService {
                ServiceName          = "Cloud Block Storage",
                ServiceDescriptionDE = "Cloud Block Storage bietet zuverlässigen, leistungsstarken On-Demand-Speicher für Anwendungen, die auf Cloud-Servern gehostet werden",
                ServiceTitleDE       = "Cloud Block Storage",
                CloudServiceModelId  = iaaSModel.Id,
                CloudServiceModel    = iaaSModel,
                ProviderId           = rackspaceProvider.Id,
                Provider             = rackspaceProvider,
                Creation             = DateTime.Now,
                LastModified         = DateTime.Now,
                Features             = new List <Feature> {
                    hasFileEncryption, hasReplication
                }
            }
                );
            context.ObjectStorageService.AddOrUpdate(
                x => x.ServiceName,
                new ObjectStorageService {
                ServiceName          = "Cloud Object Storage",
                ServiceDescriptionDE = "Stelle deine Daten von überall aus wieder her oder mache Backups einfach über unseren redundanten Objekt Storage mit S3-kompatibler Schnittstelle",
                ServiceTitleDE       = "Cloud Object Storage",
                ServiceAvailability  = "99,95",
                CloudServiceModelId  = iaaSModel.Id,
                CloudServiceModel    = iaaSModel,
                Creation             = DateTime.Now,
                LastModified         = DateTime.Now,
                Features             = new List <Feature> {
                    hasPermissions
                }
            }
                );
            context.ObjectStorageService.AddOrUpdate(
                x => x.ServiceName,
                new ObjectStorageService {
                ServiceName          = "IBM Cloud Object Storage",
                ServiceDescriptionDE = "IBM Cloud Object Storage wurde entwickelt, um ein exponentielles Datenwachstum und Cloud-native Arbeitslasten zu unterstützen",
                ServiceTitleDE       = "IBM Cloud Object Storage",
                ServiceAvailability  = "99,99",
                CloudServiceModelId  = iaaSModel.Id,
                CloudServiceModel    = iaaSModel,
                ProviderId           = ibmProvider.Id,
                Provider             = ibmProvider,
                Creation             = DateTime.Now,
                LastModified         = DateTime.Now,
                Features             = new List <Feature> {
                    hasPermissions, hasReplication
                }
            }
                );
            context.BlockStorageService.AddOrUpdate(
                x => x.ServiceName,
                new BlockStorageService {
                ServiceName          = "IBM Block Storage",
                ServiceDescriptionDE = "Flash-basierter, leistungsstarker lokaler Plattenspeicher mit SAN-Persistenz und -Beständigkeit, anpassbaren E/A-Operationen pro Sekunde und kalkulierbaren Kosten",
                ServiceTitleDE       = "IBM Block Storage",
                ServiceAvailability  = "99,99",
                CloudServiceModelId  = iaaSModel.Id,
                CloudServiceModel    = iaaSModel,
                ProviderId           = ibmProvider.Id,
                Provider             = ibmProvider,
                Creation             = DateTime.Now,
                LastModified         = DateTime.Now,
                Features             = new List <Feature> {
                    hasFileEncryption, hasReplication
                }
            }
                );

            context.SaveChanges();
        }
Beispiel #33
0
        public Data.Letter[] GetLetters(string _Number, string _Provider, string _Type, string _From, string _To, string _Money, string _Money2, string _User, string _Inc,
            DateType _DateType,DateTime startDate, DateTime endDate, DataLocation loc)
        {
            string query = @"SELECT * FROM #{TABLE}";
            if (loc == DataLocation.Current)
                query = query.Replace("#{TABLE}", "[Letter]");
            else
                if (loc == DataLocation.Archive)
                    query = query.Replace("#{TABLE}", "[Archive2014]");
                else
                {
                    query = query.Replace("#{TABLE}", "[Letter]");
                    query += " UNION SELECT * FROM [Archive2014]";
                    query = "SELECT * FROM (" + query;
                    query += ")";
                }
            query += " WHERE '1=1'";
            OleDbCommand command = new OleDbCommand();
            command.CommandText = query;
            if (!string.IsNullOrEmpty(_Number))
            {
                command.CommandText += " AND [number] = @_Number";
                command.Parameters.Add("@_Number", OleDbType.Integer).Value = _Number;
            }
            if (!string.IsNullOrEmpty(_Provider))
            {
                command.CommandText += " AND [provider] = @_Provider";
                command.Parameters.Add("@_Provider", OleDbType.WChar).Value = _Provider;
            }
            if (!string.IsNullOrEmpty(_Type))
            {
                command.CommandText += " AND [type] = @_Type";
                command.Parameters.Add("@_Type", OleDbType.WChar).Value = _Type;
            }
            if (!string.IsNullOrEmpty(_From))
            {
                command.CommandText += " AND [from] = @_From";
                command.Parameters.Add("@_From", OleDbType.WChar).Value = _From;
            }
            if (!string.IsNullOrEmpty(_To))
            {
                command.CommandText += " AND [to] = @_To";
                command.Parameters.Add("@_To", OleDbType.WChar).Value = _To;
            }
            if (!string.IsNullOrEmpty(_Money))
            {
                command.CommandText += " AND [money] = @_Money";
                command.Parameters.Add("@_Money", OleDbType.WChar).Value = _Money;
            }
            if (!string.IsNullOrEmpty(_Money2))
            {
                command.CommandText += " AND [money2] = @_Money2";
                command.Parameters.Add("@_Money2", OleDbType.WChar).Value = _Money2;
            }
            if (!string.IsNullOrEmpty(_User))
            {
                command.CommandText += " AND [user] = @_User";
                command.Parameters.Add("@_User", OleDbType.WChar).Value = _User;
            }
            if (!string.IsNullOrEmpty(_Inc))
            {
                command.CommandText += " AND [inc] = @_Inc";
                command.Parameters.Add("@_Inc", OleDbType.Numeric).Value = _Inc;
            }
            if (_DateType != DateType.All)
            {
                switch (_DateType)
                {
                    case DateType.Creation: command.CommandText += " AND [cdate] Between @start AND @end";
                        command.Parameters.Add("@start", OleDbType.Date).Value = startDate;
                        command.Parameters.Add("@end", OleDbType.Date).Value = endDate;
                        break;
                    case DateType.Event: command.CommandText += " AND [edate] Between @start AND @end";
                        command.Parameters.Add("@start", OleDbType.Date).Value = startDate;
                        command.Parameters.Add("@end", OleDbType.Date).Value = endDate;
                        break;
                    case DateType.Letter: command.CommandText += " AND [ldate] Between @start AND @end";
                        command.Parameters.Add("@start", OleDbType.Date).Value = startDate;
                        command.Parameters.Add("@end", OleDbType.Date).Value = endDate;
                        break;
                }
            }
            command.CommandText += " ORDER BY [number] DESC";

            var table = GetData(command);
            List<Data.Letter> list = new List<Data.Letter>();
            if (table == null) return list.ToArray();
            foreach (DataRow Row in table.Rows)
            {
                Data.Letter L = new Data.Letter();
                L.Number = Convert.ToInt32(Row["number"]);
                L.Provider = Row["provider"].ToString();
                L.Type = Row["type"].ToString();
                L.From = Row["from"].ToString();
                L.To = Row["to"].ToString();
                L.Money = Row["money"].ToString();
                L.Money2 = Row["money2"].ToString();
                L.User = Row["user"].ToString();
                L.Inc = Row["inc"].ToString();
                try { L.CreationDate = Convert.ToDateTime(Row["cdate"].ToString()); }
                catch { L.CreationDate = new DateTime(0); }
                try { L.EventDate = Convert.ToDateTime(Row["edate"].ToString()); }
                catch { L.EventDate = new DateTime(0); }
                try { L.LetterDate = Convert.ToDateTime(Row["ldate"].ToString()); }
                catch { L.LetterDate = new DateTime(0); }
                list.Add(L);
                List<OleDbParameter> pars = new List<OleDbParameter>();
            }
            return list.ToArray();
        }
Beispiel #34
0
 public Data.Letter[] GetLetters(DataLocation loc)
 {
     string query = @"SELECT * FROM #{TABLE} ORDER BY [number] DESC";
     if (loc == DataLocation.Current)
         query = query.Replace("#{TABLE}", "[Letter]");
     else
         if (loc == DataLocation.Archive)
             query = query.Replace("#{TABLE}", "[Archive2014]");
         else
         {
             query = query.Replace("#{TABLE}", "[Letter]");
             query += " UNION SELECT * FROM [Archive2014]";
         }
     List<Data.Letter> list = new List<Data.Letter>();
     var table = GetData(query);
     if (table == null) return list.ToArray();
     foreach (DataRow Row in table.Rows)
     {
         Data.Letter L = new Data.Letter();
         L.Number = Convert.ToInt32(Row["number"]);
         L.Provider = Row["provider"].ToString();
         L.Type = Row["type"].ToString();
         L.From = Row["from"].ToString();
         L.To = Row["to"].ToString();
         L.Money = Row["money"].ToString();
         L.Money2 = Row["money2"].ToString();
         L.User = Row["user"].ToString();
         L.Inc = Row["inc"].ToString();
         try { L.CreationDate = Convert.ToDateTime(Row["cdate"].ToString()); }
         catch { L.CreationDate = new DateTime(0); }
         try { L.EventDate = Convert.ToDateTime(Row["edate"].ToString()); }
         catch { L.EventDate = new DateTime(0); }
         try { L.LetterDate = Convert.ToDateTime(Row["ldate"].ToString()); }
         catch { L.LetterDate = new DateTime(0); }
         list.Add(L);
     }
     return list.ToArray();
 }
Beispiel #35
0
        public async Task UpdateApp(bool silentIfLatestVersion = true, bool updateToPrereleases = false)
        {
            try
            {
                using (UpdateManager updateManager = await GitHubUpdateManager(GitHubRepository, updateToPrereleases))
                {
                    UpdateInfo newUpdateInfo;
                    try
                    {
                        // UpdateApp CheckForUpdate will return value only if the app is squirrel installed
                        newUpdateInfo = await updateManager.CheckForUpdate().NonNull();
                    }
                    catch (Exception e) when(e is HttpRequestException || e is WebException || e is SocketException)
                    {
                        Logger.WoxError($"Check your connection and proxy settings to api.github.com.", e);
                        updateManager.Dispose();
                        return;
                    }

                    var newReleaseVersion = Version.Parse(newUpdateInfo.FutureReleaseEntry.Version.ToString());
                    var currentVersion    = Version.Parse(Constant.Version);

                    Logger.WoxInfo($"Future Release <{newUpdateInfo.FutureReleaseEntry.Formatted()}>");

                    if (newReleaseVersion <= currentVersion)
                    {
                        if (!silentIfLatestVersion)
                        {
                            MessageBox.Show("You already have the latest Wox version");
                        }
                        updateManager.Dispose();
                        return;
                    }

                    try
                    {
                        await updateManager.DownloadReleases(newUpdateInfo.ReleasesToApply);
                    }
                    catch (Exception e) when(e is HttpRequestException || e is WebException || e is SocketException)
                    {
                        Logger.WoxError($"Check your connection and proxy settings to github-cloud.s3.amazonaws.com.", e);
                        updateManager.Dispose();
                        return;
                    }

                    await updateManager.ApplyReleases(newUpdateInfo);

                    if (DataLocation.PortableDataLocationInUse())
                    {
                        var targetDestination = updateManager.RootAppDirectory + $"\\app-{newReleaseVersion.ToString()}\\{DataLocation.PortableFolderName}";
                        FilesFolders.Copy(DataLocation.PortableDataPath, targetDestination);
                        if (!FilesFolders.VerifyBothFolderFilesEqual(DataLocation.PortableDataPath, targetDestination))
                        {
                            MessageBox.Show(string.Format("Wox was not able to move your user profile data to the new update version. Please manually" +
                                                          "move your profile data folder from {0} to {1}", DataLocation.PortableDataPath, targetDestination));
                        }
                    }
                    else
                    {
                        await updateManager.CreateUninstallerRegistryEntry();
                    }

                    var newVersionTips = NewVersinoTips(newReleaseVersion.ToString());

                    MessageBox.Show(newVersionTips);
                    Logger.WoxInfo($"Update success:{newVersionTips}");
                }
            }
            catch (Exception e) when(e is HttpRequestException || e is WebException || e is SocketException)
            {
                Logger.WoxError($"Please check your connection and proxy settings to api.github.com.", e);
            }
        }
Beispiel #36
0
 /// <summary>
 /// Request data for a single day
 /// </summary>
 /// <param name="date">The date, in UTC</param>
 /// <param name="dataLocation"></param>
 /// <param name="filter">Specify a filter. Only releases matching this filter will be returned.</param>
 /// <param name="dataSource">Specify a specific datasource. Otherwise the default one will be used.</param>
 public EconomicReleaseRequest(DateTime date, DataLocation dataLocation = DataLocation.ExternalOnly, Expression<Func<EconomicRelease, bool>> filter = null, string dataSource = null)
     : this(date, date, dataLocation, filter, dataSource)
 {
 }
 public void Write(DataLocation location, byte value)
 {
     throw new NotImplementedException();
 }
Beispiel #38
0
 public Lock(DataLocation location)
 {
     StartLocation = location;
     EndLocation = location;
 }
 private void OpenPluginFolder(object sender, RoutedEventArgs e)
 {
     FilesFolders.OpenPath(Path.Combine(DataLocation.DataDirectory(), Constant.Themes));
 }
Beispiel #40
0
        /// <summary>
        /// Open a DataClient with the specified data client id
        /// </summary>
        /// <param name="headNode">head node name</param>
        /// <param name="dataClientId">data client id</param>
        /// <param name="scheme">the transport scheme</param>
        /// <param name="location">the data location</param>
        /// <param name="userName">the user name</param>
        /// <param name="password">the password</param>
        /// <returns>data store path</returns>
        private static DataClientInfo OpenInternal(string headNode, string dataClientId, DataLocation location, TransportScheme scheme, string userName, string password)
        {
            IDataService dataAgent = GetDataServiceAgent(headNode, scheme, userName, password);

            return(InvokeDataOperation <DataClientInfo>(
                       dataAgent,
                       delegate(IDataService agent)
            {
                return agent.OpenDataClientV4(dataClientId, location);
            }));
        }
 public byte Read(DataLocation location)
 {
     throw new NotImplementedException();
 }
Beispiel #42
0
        // Constructor to load from Doom Builder Map Settings Configuration
        internal MapOptions(Configuration cfg, string mapname, bool longtexturenamessupported)
        {
            // Initialize
            this.previousname   = "";
            this.currentname    = mapname;
            this.strictpatches  = General.Int2Bool(cfg.ReadSetting("strictpatches", 0));
            this.configfile     = cfg.ReadSetting("gameconfig", "");
            this.resources      = new DataLocationList();
            this.mapconfig      = new Configuration(true);
            this.scriptsettings = new Dictionary <string, ScriptDocumentSettings>(StringComparer.OrdinalIgnoreCase);            //mxd

            // Read map configuration
            this.mapconfig.Root = cfg.ReadSetting("maps." + mapname, new Hashtable());

            //mxd. Read Tag Labels
            this.tagLabels = new Dictionary <int, string>();
            ListDictionary tagLabelsData = (ListDictionary)this.mapconfig.ReadSetting("taglabels", new ListDictionary());

            foreach (DictionaryEntry tagLabelsEntry in tagLabelsData)
            {
                int    tag   = 0;
                string label = string.Empty;

                foreach (DictionaryEntry entry in (ListDictionary)tagLabelsEntry.Value)
                {
                    switch ((string)entry.Key)
                    {
                    case "tag": tag = (int)entry.Value; break;

                    case "label": label = (string)entry.Value; break;
                    }
                }

                if (tag != 0 && !string.IsNullOrEmpty(label))
                {
                    tagLabels.Add(tag, label);
                }
            }

            //mxd. Script compiler
            scriptcompiler = this.mapconfig.ReadSetting("scriptcompiler", string.Empty);

            //mxd. Read Sector drawing options
            defaultfloortexture  = this.mapconfig.ReadSetting("defaultfloortexture", string.Empty);
            defaultceiltexture   = this.mapconfig.ReadSetting("defaultceiltexture", string.Empty);
            defaulttoptexture    = this.mapconfig.ReadSetting("defaulttoptexture", string.Empty);
            defaultwalltexture   = this.mapconfig.ReadSetting("defaultwalltexture", string.Empty);
            defaultbottomtexture = this.mapconfig.ReadSetting("defaultbottomtexture", string.Empty);
            custombrightness     = General.Clamp(this.mapconfig.ReadSetting("custombrightness", 196), 0, 255);
            customfloorheight    = this.mapconfig.ReadSetting("customfloorheight", 0);
            customceilheight     = this.mapconfig.ReadSetting("customceilheight", 128);

            //mxd. Read Sector drawing overrides
            overridefloortexture  = this.mapconfig.ReadSetting("overridefloortexture", false);
            overrideceiltexture   = this.mapconfig.ReadSetting("overrideceiltexture", false);
            overridetoptexture    = this.mapconfig.ReadSetting("overridetoptexture", false);
            overridemiddletexture = this.mapconfig.ReadSetting("overridemiddletexture", false);
            overridebottomtexture = this.mapconfig.ReadSetting("overridebottomtexture", false);
            overridefloorheight   = this.mapconfig.ReadSetting("overridefloorheight", false);
            overrideceilheight    = this.mapconfig.ReadSetting("overrideceilheight", false);
            overridebrightness    = this.mapconfig.ReadSetting("overridebrightness", false);

            //mxd
            uselongtexturenames        = longtexturenamessupported && this.mapconfig.ReadSetting("uselongtexturenames", false);
            useresourcesinreadonlymode = this.mapconfig.ReadSetting("useresourcesinreadonlymode", false);

            //mxd. Position and scale
            float vpx = this.mapconfig.ReadSetting("viewpositionx", float.NaN);
            float vpy = this.mapconfig.ReadSetting("viewpositiony", float.NaN);

            if (!float.IsNaN(vpx) && !float.IsNaN(vpy))
            {
                viewposition = new Vector2D(vpx, vpy);
            }
            viewscale = this.mapconfig.ReadSetting("viewscale", float.NaN);

            // Resources
            IDictionary reslist = this.mapconfig.ReadSetting("resources", new Hashtable());

            foreach (DictionaryEntry mp in reslist)
            {
                // Item is a structure?
                IDictionary resinfo = mp.Value as IDictionary;
                if (resinfo != null)
                {
                    // Create resource
                    DataLocation res = new DataLocation();

                    // Copy information from Configuration to ResourceLocation
                    if (resinfo.Contains("type") && (resinfo["type"] is int))
                    {
                        res.type = (int)resinfo["type"];
                    }
                    if (resinfo.Contains("location") && (resinfo["location"] is string))
                    {
                        res.location = (string)resinfo["location"];
                    }
                    if (resinfo.Contains("textures") && (resinfo["textures"] is bool))
                    {
                        res.option1 = (bool)resinfo["textures"];
                    }
                    if (resinfo.Contains("flats") && (resinfo["flats"] is bool))
                    {
                        res.option2 = (bool)resinfo["flats"];
                    }

                    // Add resource
                    AddResource(res);
                }
            }

            //mxd. Read script documents settings
            IDictionary sflist = this.mapconfig.ReadSetting("scriptdocuments", new Hashtable());

            foreach (DictionaryEntry mp in sflist)
            {
                // Item is a structure?
                IDictionary scfinfo = mp.Value as IDictionary;
                if (scfinfo != null)
                {
                    ScriptDocumentSettings settings = ReadScriptDocumentSettings(scfinfo);
                    if (!string.IsNullOrEmpty(settings.Filename))
                    {
                        scriptsettings[settings.Filename] = settings;
                    }
                }
            }
        }
Beispiel #43
0
        /// <summary>
        /// Create a DataClient instance with the specified data client id
        /// </summary>
        /// <param name="headNode">head node name</param>
        /// <param name="dataClientId">data client id</param>
        /// <param name="allowedUsers">privileged users who has read permission to the data client</param>
        /// <param name="scheme">the transport scheme</param>
        /// <param name="location">the data location</param>
        /// <param name="userName">the user name</param>
        /// <param name="password">the password</param>
        /// <returns>a new DataClient instance</returns>
        private static DataClient CreateInternal(string headNode, string dataClientId, string[] allowedUsers, TransportScheme scheme, DataLocation location, string userName, string password)
        {
            if (allowedUsers != null)
            {
                foreach (string allowedUser in allowedUsers)
                {
                    Microsoft.Hpc.Scheduler.Session.Internal.Utility.ThrowIfNullOrEmpty(allowedUser, "allowed user");
                }
            }

            IDataService dataAgent = GetDataServiceAgent(headNode, scheme, userName, password);

            DataClientInfo info = InvokeDataOperation <DataClientInfo>(
                dataAgent,
                delegate(IDataService agent)
            {
                return(agent.CreateDataClientV4(dataClientId, allowedUsers, location));
            });

            Debug.Assert(!string.IsNullOrEmpty(info.PrimaryDataPath), "primaryDataPath");
            return(new DataClient(headNode, dataClientId, info, /*readOnly = */ false, scheme, userName, password));
        }
Beispiel #44
0
        public Stream Read(DataLocation location, string filepath)
        {
            var path = GetFilepath(location, filepath);

            return(new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite));
        }
Beispiel #45
0
 public HistoricalDataRequest(Instrument instrument, BarSize frequency, DateTime startingDate, DateTime endingDate, DataLocation dataLocation = DataLocation.Both, bool saveToLocalStorage = true, bool rthOnly = true, int requestID = 0)
 {
     Frequency         = frequency;
     Instrument        = instrument;
     StartingDate      = startingDate;
     EndingDate        = endingDate;
     DataLocation      = dataLocation;
     SaveDataToStorage = saveToLocalStorage;
     RTHOnly           = rthOnly;
     RequestID         = requestID;
 }
Beispiel #46
0
 public bool Overlap(DataLocation location)
 {
     return StartLocation.IsBefore(location) && EndLocation.IsAfter(location);
 }
Beispiel #47
0
        public void CreateDirectory(DataLocation location, string directory)
        {
            var path = FixDirectory(GetFilepath(location, directory));

            Directory.CreateDirectory(path);
        }
 public void Write(DataLocation location, byte value)
 {
     throw new NotImplementedException();
 }
Beispiel #49
0
        public bool Exists(DataLocation location, string filepath)
        {
            var path = GetFilepath(location, filepath);

            return(File.Exists(path));
        }
Beispiel #50
0
 public Lock(DataLocation startLocation, DataLocation endLocation)
 {
     StartLocation = startLocation;
     EndLocation = endLocation;
 }