コード例 #1
0
        public override string ToString()
        {
            StringBuilder builder = new StringBuilder();

            builder.AppendLine("import { Injectable } from '@angular/core';");
            builder.AppendLine("import { HttpClient } from '@angular/common/http';");
            builder.AppendLine("import { Observable } from 'rxjs';");

            if (ImportTypes.Count != 0)
            {
                builder.AppendLine($"import {{\r\n{string.Join(",\r\n", ImportTypes.Select(x => "\t" + x))}\r\n }} from '../models';");
            }

            builder.AppendLine();

            builder.Append("@Injectable({\r\n\tprovidedIn: 'root'\r\n})\r\n");
            builder.Append($"export class {Name}Service {{\r\n\r\n");
            builder.Append("\tconstructor(private http: HttpClient) {}\r\n\r\n");
            foreach (var method in Methods)
            {
                builder.Append(string.Join("\r\n", method.ToString().Split("\r\n").Select(x => "\t" + x)) + "\r\n");
            }

            builder.AppendLine("}");

            var   result = builder.ToString().Replace("\t", "  ");
            Regex regex  = new Regex(@"[ ]+\r\n");

            result = regex.Replace(result, "\r\n");

            return(result);
        }
コード例 #2
0
        /// <summary>
        /// 読み込み内容をAppContextに反映する
        /// </summary>
        /// <param name="appContext"></param>
        /// <param name="importType"></param>
        /// <param name="isImportToPrjSettings"></param>
        /// <param name="isImportToWbs"></param>
        /// <param name="output"></param>
        private void UpdateContext(AppContext appContext, ImportTypes importType, bool isImportToPrjSettings, bool isImportToMembers, bool isImportToWbs, CompleteOutput output)
        {
            // インポート種別と取り込み先により適用メソッドを選択
            var applyRoutine = GetRoutine(importType, isImportToPrjSettings, isImportToMembers, isImportToWbs);

            // 適用処理を実行
            applyRoutine.Invoke(appContext, output);
        }
コード例 #3
0
ファイル: FormLoadTAP.cs プロジェクト: Sirozha84/ZX-Font
 public FormLoadTAP(ImportTypes ImportType)
 {
     InitializeComponent();
     this.ImportType = ImportType;
     if (ImportType == ImportTypes.Tap)
         Text = "Импорт шрифта из TAP-файла";
     else
         Text = "Импорт шрифта из бинарного файла";
 }
コード例 #4
0
 /// <summary>
 ///   Initializes a new instance of the DetectionSettings class.
 /// </summary>
 public DetectionSettings()
 {
     this.timeFactor           = 1D;
     this.stimuliImportMode    = StimuliImportModes.UseiViewXMSG;
     this.trialImportMode      = TrialSequenceImportModes.UseMSGLines;
     this.trialTriggerString   = "MSG";
     this.stimuliImportFile    = string.Empty;
     this.stimuliFileExtension = "bmp";
     this.subjectName          = string.Empty;
     this.trialImportFile      = string.Empty;
     this.trialSequenceToStarttimeAssignments = new XMLSerializableSortedList <int, long>();
     this.trialIDToImageAssignments           = new XMLSerializableDictionary <int, string>();
     this.trialSequenceToTrialIDAssignments   = new XMLSerializableDictionary <int, int>();
     this.imageDictionary = new XMLSerializableDictionary <int, string>();
     this.savedSettings   = false;
     this.importType      = ImportTypes.Rawdata;
 }
コード例 #5
0
        /// <summary>
        /// Write Source
        /// </summary>
        /// <param name="writer"></param>
        /// <param name="options"></param>
        /// <param name="info"></param>
        internal override void WriteSource(System.IO.StreamWriter writer, TsGeneratorOptions options, TsWriteInformation info)
        {
            //sec check
            string detailError = null;

            if (!IsValid(out detailError))
            {
                throw new Exception(detailError);
            }
            //get type string
            string typeString;

            //get typestring (if there isnt a type, use all selector)
            if (ImportTypes.Count <= 0)
            {
                typeString = TsDomConstants.START_SIGN;
            }
            else
            {
                var importTypeSourceList    = ImportTypes.OrderBy(el => el.Name).Select(el => el.GetSource());
                var importTypeIsNotSpecific = ImportTypes.Count == 1 && ImportTypes[0].IsImportAll;
                // if the import type is import all and its only one type, we dont need to wrap it in brackets
                typeString = importTypeIsNotSpecific
                    ? ImportTypes[0].GetSource()
                    : string.Format(TsDomConstants.CURLY_INLINE_BRACKETS_FORMAT, string.Join(TsDomConstants.PARAMETER_SEPERATOR, importTypeSourceList));
            }

            string source = null;

            // export
            if (IsExport)
            {
                source = string.Format(TsDomConstants.TS_EXPORT_STATEMENT_FORMAT, typeString, Path);
            }
            // import
            else
            {
                source = string.Format(TsDomConstants.TS_IMPORT_FORMAT, typeString, Path);
            }
            //add end expression
            source += TsDomConstants.EXPRESSION_END;
            //write import
            writer.WriteLine(options.GetPreLineIndentString(info.Depth) + source);
        }
コード例 #6
0
        /// <summary>
        /// フラグ状況によって異なる更新ルーチンを生成
        /// </summary>
        /// <param name="importType"></param>
        /// <param name="isImportToPrjSettings"></param>
        /// <param name="isImportToWbs"></param>
        /// <returns></returns>
        private Action <AppContext, CompleteOutput> GetRoutine(ImportTypes importType, bool isImportToPrjSettings, bool isImportToMembers, bool isImportToWbs)
        {
            var importPrjSettingAction = null as Action <AppContext, CompleteOutput>;
            var importMembersAction    = null as Action <AppContext, CompleteOutput>;
            var importWbsAction        = null as Action <AppContext, CompleteOutput>;

            if (importType == ImportTypes.Overwrite)
            {
                importPrjSettingAction = new Action <AppContext, CompleteOutput>(OverwritePrjSettings);
                importMembersAction    = new Action <AppContext, CompleteOutput>(OverwriteMembers);
                importWbsAction        = new Action <AppContext, CompleteOutput>(OverriteWbs);
            }
            else if (importType == ImportTypes.Addition)
            {
                importPrjSettingAction = new Action <AppContext, CompleteOutput>(AddPrjSettings);
                importMembersAction    = new Action <AppContext, CompleteOutput>(AddMembers);
                importWbsAction        = new Action <AppContext, CompleteOutput>(AddWbs);
            }

            return
                (new Action <AppContext, CompleteOutput>((appContext, output) =>
            {
                if (isImportToPrjSettings)
                {
                    importPrjSettingAction.Invoke(appContext, output);
                }
                if (isImportToMembers)
                {
                    importMembersAction.Invoke(appContext, output);
                }
                if (isImportToWbs)
                {
                    importWbsAction.Invoke(appContext, output);
                }
            }));
        }
コード例 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ImportTypeAttribute"/> class.
 /// </summary>
 /// <param name="importType">Type of the import to be performed on the class.</param>
 public ImportTypeAttribute(ImportTypes importType)
 {
     this.ImportType = importType;
 }
コード例 #8
0
ファイル: Controller.cs プロジェクト: bowmark/allauth.desktop
        public bool ImportProcess(ImportTypes importType, string importFilePath)
        {
            if (!_activeDatabase || _activeDatabaseId == 0)
                return false;

            var database = Model.Databases.Get(_activeDatabaseId);

            var importSuccess = false;
            using (var fileStream = new FileStream(importFilePath, FileMode.Open))
            {
                switch (importType)
                {
                    case ImportTypes.LastPass:
                        importSuccess = ImportLastPass(fileStream);
                        break;
                    case ImportTypes.Dashlane:
                        importSuccess = ImportDashlane(fileStream);
                        break;
                    case ImportTypes.KeePass:
                        importSuccess = ImportKeePass(fileStream);
                        break;
                    case ImportTypes.OnePassword:
                        importSuccess = Import1Password(fileStream);
                        break;
                }
            }

            UpdateDatabaseView();
            GetSyncServerInstance(database.ServerAccountId).RestartSyncLoop();

            return importSuccess;
        }
コード例 #9
0
ファイル: DetectionSettings.cs プロジェクト: DeSciL/Ogama
 /// <summary>
 ///   Initializes a new instance of the DetectionSettings class.
 /// </summary>
 public DetectionSettings()
 {
   this.timeFactor = 1D;
   this.stimuliImportMode = StimuliImportModes.UseiViewXMSG;
   this.trialImportMode = TrialSequenceImportModes.UseMSGLines;
   this.trialTriggerString = "MSG";
   this.stimuliImportFile = string.Empty;
   this.stimuliFileExtension = "bmp";
   this.subjectName = string.Empty;
   this.trialImportFile = string.Empty;
   this.trialSequenceToStarttimeAssignments = new XMLSerializableSortedList<int, long>();
   this.trialIDToImageAssignments = new XMLSerializableDictionary<int, string>();
   this.trialSequenceToTrialIDAssignments = new XMLSerializableDictionary<int, int>();
   this.imageDictionary = new XMLSerializableDictionary<int, string>();
   this.savedSettings = false;
   this.importType = ImportTypes.Rawdata;
 }